In the last episode (Jan 22), [EMAIL PROTECTED] said:
Hello,
Doing C coding with MSql.
What am I missing here?
I am needing to do standard INSERT statements using variables for the
VALUE fields These fields are changed in the application befre I
issue the INSERT. The current proram uses : before the variable to
make it work.
Like this: INSERT INTO EMP_MASTER (EMP_NO, SUPERVISOR,BADGE_NO)
VALUES (:emp_no, :super, :badge_no);
The :emp_no etc. is obviously what is not working...Why?
Mysql doesn't support named bind variables in the C API; it only
understands the ? markers. If you take a look at the MYSQL_BIND
struct, you can see there is no name field. Which really just means
that when you call mysql_stmt_bind_param() you have to pass your
variables in the same order as they appeared in your query when you
called mysql_stmt_prepare().
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-prepare.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-bind-param.html
This has some example code:
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-execute.html
My guess is that if you were to extend mysql_stmt_prepare() and
mysql_stmt_bind_param() to support named variables and submitted them
to bugs.mysql.com as a patch, no-one would object :)
--
Dan Nelson
[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]