Exportforce Posted September 14, 2013 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
GmOcean Posted September 15, 2013 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
Exportforce Posted September 15, 2013 Author 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
GmOcean Posted September 15, 2013 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
Emistry Posted September 15, 2013 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
DeadlySilence Posted September 15, 2013 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
Exportforce Posted September 15, 2013 Author 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
Emistry Posted September 16, 2013 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
Brian Posted September 16, 2013 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
Exportforce Posted September 17, 2013 Author 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
Khazou Posted September 17, 2013 Posted September 17, 2013 500-1000 sql request in 1 second when your server is up ? oO Quote
Brian Posted September 17, 2013 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
Exportforce Posted September 17, 2013 Author Posted September 17, 2013 I don't want to put that open, to keep it unique. (Yeah I know "selfish"... Sorry) Quote
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 ?
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.