mariadb_stmt_execute_direct - Online Linux Manual PageSection : 3
Updated :
Source : Version 3.2.2
Note : MariaDB Connector/C

Namemariadb_stmt_execute_direct − prepares and executes a prepared statement

Synopsis #include <mysql.h> int mariadb_stmt_execute_direct(MYSQL_STMT * stmt, const char *query, size_t length);

DescriptionPrepares and executes a statement which was previously allocated by mysql_stmt_init(3), using the current values of the parameter variables if any parameters exist in the statement.

Parameters• stmt − A statement handle, which was previously allocated by mysql_stmt_init(3). • query SQL statement • length Length of SQL statement

Return valueReturns zero on success, non−zero on failure.

Notes• Since the number of parameter of the statement is unknown before execution it is mandatory to set the number of parameters via the mysql_stmt_attr_set(3) function. • If the SQL statement is a zero−terminated string, you can also pass −1 as length. • The statement handle is intended for one−time execution. Reusing the statement handle might lead to unexpected behavior.

HistoryThis function was added in Connector/C 3.0 and requires MariaDB 10.2 or later versions.

See Also• mysql_stmt_attr_set(3) • mysql_stmt_bind_param(3)

Example```C static int execute_direct_example(MYSQL mysql) { MYSQL_STMT stmt= mysql_stmt_init(mysql); MYSQL_BIND bind[2]; int intval= 1; int param_count= 2; char *strval= execute_direct_example; /* Direct execution without parameters */ if (mariadb_stmt_execute_direct(stmt, CREATE TABLE execute_direct (a int, b varchar(30)), −1)) goto error; memset(&bind, 0, sizeof(MYSQL_BIND) * 2); bind[0].buffer_type= MYSQL_TYPE_SHORT; bind[0].buffer= &intval; bind[1].buffer_type= MYSQL_TYPE_STRING; bind[1].buffer= strval; bind[1].buffer_length= strlen(strval); /* set number of parameters */ if (mysql_stmt_attr_set(stmt, STMT_ATTR_PREBIND_PARAMS, ¶m_count)) goto error; /* bind parameters */ if (mysql_stmt_bind_param(stmt, bind)) goto error; if (mariadb_stmt_execute_direct(stmt, INSERT INTO execute_direct VALUES (?,?), −1)) goto error; mysql_stmt_close(stmt); return 0; error: printf(Error: %s, mysql_stmt_error(stmt)); mysql_stmt_close(stmt); return 1; }
0
Johanes Gumabo
Data Size   :   10,342 byte
man-mariadb_stmt_execute_direct.3Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 190,889
Visitor ID   :     :  
Visitor IP   :   3.141.19.115   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.