Exportforce Posted September 14, 2013 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 09/05/13 Last Seen: September 21, 2013 Share Posted September 14, 2013 [Warning]: script:query_sql: Too many columns, discarding last 2 columns. I googled a bit and found out, that this just counts my queries and tells me how much of these fetched values I did not take into variables. Since they won't be used as variables but only, in that script, for sql itself, this warning seems useless to me. So is there a way to "block" this warning ? In php you can just add @ infront of the line that never may spread an error/warning. Is there something here too ? Quote Link to comment Share on other sites More sharing options...
DeadlySilence Posted September 15, 2013 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 181 Reputation: 53 Joined: 04/07/13 Last Seen: August 23, 2014 Share Posted September 15, 2013 The problem is you're selecting more columns than you assign to variables. For example query_sql("SELECT `account_id`, `name` FROM `char`", .@ids, .@names$); would not produce a warning, but query_sql("SELECT `account_id`, `name` FROM `char`", .@ids); will produce a warning as the number of variables does not match the number of columns selected. 2 Quote Link to comment Share on other sites More sharing options...
GmOcean Posted September 15, 2013 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted September 15, 2013 Hmm, I think you can just recompile your server and select " Release " instead of Debug, if your using Visual++. In my experience, it got rid of all Debug/Warning notices, and only presented me with actual ' Errors '. Quote Link to comment Share on other sites More sharing options...
Exportforce Posted September 15, 2013 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 09/05/13 Last Seen: September 21, 2013 Author Share Posted September 15, 2013 No, this warning comes in the debug console when the SQL is running. All in all that warning is good and for other scripts really wanted (even better if it would read the exact line and/or the sql which is having this problem). Just here not ,since I don't need to use those variables ingame directly since I just do a check if 2 variables exist, if yes -> script does something else. Quote Link to comment Share on other sites More sharing options...
GmOcean Posted September 15, 2013 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted September 15, 2013 I see. Wish I could help further, but sadly, I don't think it's one that can be fixed without knowing exactly how the db is set up. Also, for curiosities sake, how many columns are in your a single entry in that db? Quote Link to comment Share on other sites More sharing options...
Emistry Posted September 15, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted September 15, 2013 perhap you can show your script .... ? you can do like this .. if( query_sql( "SELECT 1 FROM `table` WHERE `column`='xyz'",.@foo ) ){ mes "Query Success"; }else{ mes "Query Failed."; } Quote Link to comment Share on other sites More sharing options...
Exportforce Posted September 15, 2013 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 09/05/13 Last Seen: September 21, 2013 Author Share Posted September 15, 2013 DeadlySilence, read my own text I know that. But I do not need any variables where I do my coding from the SQL. Thats why I asked if there is a way, like in PHP with @, to have one line where I know that this will produce a warning that is not wanted because it is intended, to block those warnings from that line. But if not, I seem to just to fill in a never used variable... :/ useless server impact. Quote Link to comment Share on other sites More sharing options...
Emistry Posted September 16, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted September 16, 2013 this is how the current query_sql work .... if you want to remove that warning ..you have to either create you own custom query_sql .. or simply disable it from showing you these warning message in the source part. Quote Link to comment Share on other sites More sharing options...
Brian Posted September 16, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted September 16, 2013 Just here not ,since I don't need to use those variables ingame directly since I just do a check if 2 variables exist, if yes -> script does something else.1. make query_sql put the variable(s) you don't need in .@dummy2. if your script really does NOT need those variables, then rewrite the script to use query_sql() return values if (query_sql("SELECT 1, 1 FROM table WHERE `column1`='value1' AND `column2`='value2'", .@dummy, .@dummy)) { // do this }(you can make query_sql save more than 1 column in the same variable name; it will overwrite previous values) Quote Link to comment Share on other sites More sharing options...
Exportforce Posted September 17, 2013 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 09/05/13 Last Seen: September 21, 2013 Author Share Posted September 17, 2013 @Brian Yeah, thats what I am doing atm. Hope that saving in a variable, doesn't consume much. Since it will happen up to 500-1000 times a second if my server should get bigger ^^ Thanks for the replies Quote Link to comment Share on other sites More sharing options...
Khazou Posted September 17, 2013 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 44 Reputation: 5 Joined: 12/06/11 Last Seen: May 2, 2020 Share Posted September 17, 2013 500-1000 sql request in 1 second when your server is up ? oO Quote Link to comment Share on other sites More sharing options...
Brian Posted September 17, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted September 17, 2013 Maybe there's a more efficient way than 100s of SQL queries per second. XD Could you describe what you want the script to do? Quote Link to comment Share on other sites More sharing options...
Exportforce Posted September 17, 2013 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 09/05/13 Last Seen: September 21, 2013 Author Share Posted September 17, 2013 I don't want to put that open, to keep it unique. (Yeah I know "selfish"... Sorry) Quote Link to comment Share on other sites More sharing options...
Question
Exportforce
I googled a bit and found out, that this just counts my queries and tells me how much of these fetched values I did not take into variables.
Since they won't be used as variables but only, in that script, for sql itself, this warning seems useless to me.
So is there a way to "block" this warning ? In php you can just add @ infront of the line that never may spread an error/warning.
Is there something here too ?
Link to comment
Share on other sites
12 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.