Documentation Home
MySQL 5.6 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 31.4Mb
PDF (A4) - 31.5Mb
PDF (RPM) - 30.0Mb
EPUB - 7.7Mb
HTML Download (TGZ) - 7.5Mb
HTML Download (Zip) - 7.5Mb
HTML Download (RPM) - 6.5Mb
Eclipse Doc Plugin (TGZ) - 8.2Mb
Eclipse Doc Plugin (Zip) - 10.1Mb
Man Pages (TGZ) - 181.3Kb
Man Pages (Zip) - 292.3Kb
Info (Gzip) - 2.8Mb
Info (Zip) - 2.8Mb
Excerpts from this Manual

23.8.11.12 mysql_stmt_fetch_column()

int mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind, unsigned int column, unsigned long offset)

Description

Fetch one column from the current result set row. bind provides the buffer where data should be placed. It should be set up the same way as for mysql_stmt_bind_result(). column indicates which column to fetch. The first column is numbered 0. offset is the offset within the data value at which to begin retrieving data. This can be used for fetching the data value in pieces. The beginning of the value is offset 0.

Return Values

Zero for success. Nonzero if an error occurred.

Errors

User Comments
  Posted by Flávio Saraiva on September 12, 2007
This is a bit missleading: "bind provides the buffer where data should be placed. It should be set up the same way as for mysql_stmt_bind_result()."

The 'bind' argument expects a MYSQL_BIND structure setup for the target field, not the array of MYSQL_BIND structures used in 'mysql_stmt_bind_result()'.
  Posted by Etienne DECHAMPS on December 11, 2008
Please note: even if you only use this function to fetch your fields, you still have to bind the result parameters using mysql_bind_result(). If you don't, mysql_stmt_fetch_column() will SEGFAULT at this line (libmysql/libmysql.c:4069 in MySQL 5.0.67):

*my_bind->length= *param->length;

...because "param" will be an invalid pointer.
  Posted by Yuri Zak on February 19, 2015
use force ...

http://bugs.mysql.com/bug.php?id=33086

like mysql_stmt_fetch_column(stmt, &bind[1], 1, 0) instead mysql_stmt_fetch_column(stmt, bind, 1, 0)
Sign Up Login You must be logged in to post a comment.