From C a call to mysql_query with the query string (using copy and paste
from the debugger):
"INSERT AB VALUES (NULL,129,2,\"Computational Mathematics\",0)"
fails, giving a result of -1. Note that the '\'s on the inside are not
really there, it is just
what the debugger prints. (At least if I look at consecutive memory
locations, 2, is followed by a ".) Etc. for the " at the front and the
Removing the '\'s in the middle and the "'a at the front and back, this
statement works just fine when put in the mysql program. This has me
The same situation applies with:
"INSERT AB VALUES (NULL,129,2,'Computational Mathematics',0)"
That is, it doesn't work in C, but with the quotes removed (which aren't
really there) it works in mysql.
I've also found mysql_escape_string confusing to use. First I tried
"Computational Mathematics" and got back \"Computational Mathematics\",
giving a string that I could not use successfully in an insert. Passing
Computational Mathematics gave back Computational Mathematics, again
something that would not work in an insert. Perhaps I shouldn't
complain too much about this since even when I pass in a string I think
should work, it doesn't. (And I do know how to get this to do what I
want, even if the result doesn't work.)
Suggestion welcome. Thanks,