Click here to Skip to main content
Licence 
First Posted 4 May 2003
Views 178,336
Bookmarked 49 times

MySQL C++ Wrapper

By | 4 May 2003 | Article
A set of C++ classes for working with the MySQL library.
 
Part of The SQL Zone sponsored by
See Also

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

Kensho

Software Developer (Senior)

Portugal Portugal

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Rant[My vote of 1] I don't think so. PinmemberJohnWallis4220:06 6 Jan '10  
GeneralHi Pinmembercaesten9:02 28 May '09  
GeneralI am having "ISO C++ forbids declaration of `operator=' with no type " PinmemberMustafanabulsi22:07 12 Sep '08  
GeneralRe: I am having "ISO C++ forbids declaration of `operator=' with no type " [modified] PinmemberAbsalomx9:34 19 Apr '09  
Generalhelp with an clear example,, please Pinmemberjones19:17 16 Mar '08  
QuestionHow to find "mysql.h" Pinmemberdivide_and_conquer4:38 14 Sep '07  
AnswerRe: How to find "mysql.h" PinmemberMaikel8323:34 20 Sep '07  
QuestionCan not locate mysql.h in win32 distribution Pinmembersansweb4:43 19 Jul '07  
I can not locate mysql.h in the win32 distribution. Is it available in mysql 5? Is there a special package that contains the lib?
 
*very sad*
AnswerRe: Can not locate mysql.h in win32 distribution PinmemberEjdesgaard2:12 9 Aug '07  
GeneralMySQL with TEXT type column PinmemberAlexEvans12:56 6 Jul '07  
Generalmysql connection problem Pinmembermongol khvv23:56 4 Jul '07  
QuestionBug? Pinmemberschwarzi8123:29 18 Apr '07  
Questionhey hey hey What about *nix??? PinmemberMaxJoa17:25 30 Jan '07  
QuestionHow to get row value? Pinmember"kavin"0:48 21 Sep '06  
AnswerRe: How to get row value? Pinmembercrsreid23:00 26 Oct '07  
AnswerRe: How to get row value? Pinmembercrsreid0:38 27 Oct '07  
GeneralDon't work with MYSQL 5.0 PinmemberCHEICKNA TRAORE4:01 20 Jul '06  
GeneralRe: Don't work with MYSQL 5.0 Pinmemberr4d4r4:53 29 Aug '06  
GeneralWow! PinmemberRolando E. Cruz-Marshall8:20 11 Jul '06  
GeneralSome fixes PinmemberFreelanc3r0:19 28 Jun '06  
GeneralLinker Error PinmemberA.T5:25 27 Jun '06  
GeneralRe: Linker Error Pinmemberruying17:02 19 May '08  
GeneralBorland C++ Builder 6.0 Pinmemberwinsth0:13 10 May '06  
GeneralI Donnow .... PinmemberSPrutnik22:08 1 Apr '06  
Generalnewbie - error C2065: 'mysql_connect' : Pinmemberdoctorrie12:55 19 Mar '06  

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.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120529.1 | Last Updated 5 May 2003
Article Copyright 2003 by Kensho
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid