#include #include #include #include #include #include int main() { MYSQL_STMT * gpstmtP ; MYSQL * pcP ; unsigned char gpit1buf ; //!< buffer of type unsigned char gpit2buf ; //!< buffer of type MYSQL_BIND gpibind [ 2 ] ; //!< input parameter my_bool gpis_null[ 9 ] , //!< out result gpierrind [ 9 ] ; //!< out result unsigned long gpilength [ 9 ] ; //!< out result int r ; char * pbufP = "insert into infnet.e1370 values ( ? , ? )" ; pcP = mysql_init( NULL ) ; if ( ! mysql_real_connect( pcP , "localhost" , "user" , "password" , "database" , 0 , NULL , 196608 )) { fprintf( stderr, "no connection\n" ); exit(1); } gpstmtP = mysql_stmt_init( pcP ) ; r = mysql_stmt_prepare( gpstmtP , pbufP , strlen( pbufP )) ; gpibind[ 0 ].is_null = 0 ; gpibind[ 0 ].length = 0 ; gpibind[ 0 ].buffer_type = MYSQL_TYPE_TINY ; gpibind[ 0 ].buffer = & gpit1buf ; gpibind[ 1 ].is_null = 0 ; gpibind[ 1 ].length = 0 ; gpibind[ 1 ].buffer_type = MYSQL_TYPE_TINY ; gpibind[ 1 ].buffer = & gpit2buf ; r = mysql_stmt_bind_param( gpstmtP , gpibind ) ; gpit1buf = 127 ; //<----------------------------------------- ok gpit2buf = 128 ; //<----------------------------------------- notok r = mysql_stmt_execute( gpstmtP ) ; mysql_commit( pcP ) ; mysql_close( pcP ) ; }