Introduction
This is a simple C++ wrapper for working with MySQL... It requires the download of MySQL headers and lib (included with MySQL server here).
Sample
A simple example on how to use:
#include "mysqlplus.h"
#include <STDIO.H>
void main()
{
sql_connection_c connection( "database",
"localhost", "root", "mypassword" );
sql_query_c query( &connection );
sql_result_c *sql_result = 0;
if ( !query.execute( "select * from customers" ) )
{
printf( "oops... didn't execute!!\n" );
return;
}
sql_result = query.store();
int n_fields = sql_result->n_fields();
for ( int idx = 0; idx < n_fields; idx++ )
{
sql_field_c sql_field = sql_result->fetch_field( idx );
printf( "field %d [%s]\n", idx, sql_field.get_name() );
}
}