#include #include "C:/Program Files (x86)/MySQL/MySQL Server 5.5/include/my_global.h" #include "C:/Program Files (x86)/MySQL/MySQL Server 5.5/include/mysql.h" //NOTE: Please add your path #define INSERT_QUERY "INSERT INTO ggvam.emp(longcol) VALUES(?)" int main() { MYSQL_STMT *stmt = NULL; MYSQL *conn = NULL; MYSQL_BIND bind[1]; unsigned long length; int noOfRepetitions = 1000000; char *server = "localhost"; char *user = "root"; char *password = "ggvam"; //set me first char *database = "ggvam"; char data[] = "This is the sample application that will show you how poorly the function mysql_stmt_send_long_data performs\ This is the sample application that will show you how poorly the function mysql_stmt_send_long_data performs\ This is the sample application that will show you how poorly the function mysql_stmt_send_long_data performs\ This is the sample application that will show you how poorly the function mysql_stmt_send_long_data performs\ This is the sample application that will show you how poorly the function mysql_stmt_send_long_data performs\ This is the sample application that will show you how poorly the function mysql_stmt_send_long_data performs\ This is the sample application that will show you how poorly the function mysql_stmt_send_long_data performs\ This is the sample application that will show you how poorly the function mysql_stmt_send_long_data performs\ This is the sample application that will show you how poorly the function mysql_stmt_send_long_data performs\ This is the sample application that will show you how poorly the function mysql_stmt_send_long_data performs"; conn = mysql_init (NULL); if (conn == NULL) { printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); exit(0); } // Connect to database if (!mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) { fprintf(stderr, "%s\n", mysql_error(conn)); exit(0); } stmt = mysql_stmt_init(conn); if (!stmt) { fprintf(stderr, " mysql_stmt_init(), out of memory\n"); exit(0); } if (mysql_stmt_prepare(stmt, INSERT_QUERY, strlen(INSERT_QUERY))) { fprintf(stderr, "\n mysql_stmt_prepare(), INSERT failed"); fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); exit(0); } memset(bind, 0, sizeof(bind)); bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].length= &length; bind[0].is_null= 0; /* Bind the buffers */ if (mysql_stmt_bind_param(stmt, bind)) { fprintf(stderr, "\n param bind failed"); fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); exit(0); } int count = 0; while(count < noOfRepetitions) { /* Supply data in chunks to server */ if (mysql_stmt_send_long_data(stmt,0,data, sizeof(data))) { fprintf(stderr, "\n send_long_data failed"); fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); exit(0); } count = count + 1 ; } /* Now, execute the query */ if (mysql_stmt_execute(stmt)) { fprintf(stderr, "\n mysql_stmt_execute failed"); fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); exit(0); } return 1; }