Click here to Skip to main content
Click here to Skip to main content

MySQL C++ Wrapper

By , 4 May 2003
Rate this:
Please Sign up or sign in to vote.

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() );
   }
}

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Goncalo Oliveira
Software Developer (Senior)
Portugal Portugal
No Biography provided

Comments and Discussions

 
Rant[My vote of 1] I don't think so. PinmemberJohnWallis426-Jan-10 20:06 
GeneralHi Pinmembercaesten28-May-09 9:02 
GeneralI am having "ISO C++ forbids declaration of `operator=' with no type " PinmemberMustafanabulsi12-Sep-08 22:07 
GeneralRe: I am having "ISO C++ forbids declaration of `operator=' with no type " [modified] PinmemberAbsalomx19-Apr-09 9:34 
Generalhelp with an clear example,, please Pinmemberjones16-Mar-08 19:17 
QuestionHow to find "mysql.h" Pinmemberdivide_and_conquer14-Sep-07 4:38 
AnswerRe: How to find "mysql.h" PinmemberMaikel8320-Sep-07 23:34 
QuestionCan not locate mysql.h in win32 distribution Pinmembersansweb19-Jul-07 4:43 
AnswerRe: Can not locate mysql.h in win32 distribution PinmemberEjdesgaard9-Aug-07 2:12 
GeneralMySQL with TEXT type column PinmemberAlexEvans6-Jul-07 12:56 
Generalmysql connection problem Pinmembermongol khvv4-Jul-07 23:56 
QuestionBug? Pinmemberschwarzi8118-Apr-07 23:29 
Questionhey hey hey What about *nix??? PinmemberMaxJoa30-Jan-07 17:25 
QuestionHow to get row value? Pinmember"kavin"21-Sep-06 0:48 
AnswerRe: How to get row value? Pinmembercrsreid26-Oct-07 23:00 
AnswerRe: How to get row value? Pinmembercrsreid27-Oct-07 0:38 
GeneralDon't work with MYSQL 5.0 PinmemberCHEICKNA TRAORE20-Jul-06 4:01 
GeneralRe: Don't work with MYSQL 5.0 Pinmemberr4d4r29-Aug-06 4:53 
GeneralWow! PinmemberRolando E. Cruz-Marshall11-Jul-06 8:20 
GeneralSome fixes PinmemberFreelanc3r28-Jun-06 0:19 
GeneralLinker Error PinmemberA.T27-Jun-06 5:25 
GeneralRe: Linker Error Pinmemberruying19-May-08 17:02 
GeneralBorland C++ Builder 6.0 Pinmemberwinsth10-May-06 0:13 
GeneralI Donnow .... PinmemberSPrutnik1-Apr-06 22:08 
Generalnewbie - error C2065: 'mysql_connect' : Pinmemberdoctorrie19-Mar-06 12:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 5 May 2003
Article Copyright 2003 by Goncalo Oliveira
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid