Click here to Skip to main content
6,631,889 members and growing! (17,767 online)
Email Password   helpLost your password?
Database » Database » General     Intermediate

MySQL C++ Wrapper

By Kensho

A set of C++ classes for working with the MySQL library.
SQL, VC6, VC7, Windows, SQL Server, Visual Studio, MySQL, DBA, Dev
Posted:4 May 2003
Views:133,324
Bookmarked:41 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
56 votes for this article.
Popularity: 3.46 Rating: 1.98 out of 5
32 votes, 57.1%
1
5 votes, 8.9%
2
4 votes, 7.1%
3
4 votes, 7.1%
4
11 votes, 19.6%
5

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


Member

Occupation: Software Developer (Senior)
Location: Portugal Portugal

Other popular Database articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 59 (Total in Forum: 59) (Refresh)FirstPrevNext
GeneralHi Pinmembercaesten10:02 28 May '09  
GeneralI am having "ISO C++ forbids declaration of `operator=' with no type " PinmemberMustafanabulsi23:07 12 Sep '08  
GeneralRe: I am having "ISO C++ forbids declaration of `operator=' with no type " [modified] PinmemberAbsalomx10:34 19 Apr '09  
Generalhelp with an clear example,, please Pinmemberjones20:17 16 Mar '08  
QuestionHow to find "mysql.h" Pinmemberdivide_and_conquer5:38 14 Sep '07  
AnswerRe: How to find "mysql.h" PinmemberMaikel830:34 21 Sep '07  
QuestionCan not locate mysql.h in win32 distribution Pinmembersansweb5:43 19 Jul '07  
AnswerRe: Can not locate mysql.h in win32 distribution PinmemberEjdesgaard3:12 9 Aug '07  
GeneralMySQL with TEXT type column PinmemberAlexEvans13:56 6 Jul '07  
Generalmysql connection problem Pinmembermongol khvv0:56 5 Jul '07  
QuestionBug? Pinmemberschwarzi810:29 19 Apr '07  
Questionhey hey hey What about *nix??? PinmemberMaxJoa18:25 30 Jan '07  
GeneralHow to get row value? Pinmember"kavin"1:48 21 Sep '06  
QuestionRe: How to get row value? Pinmembercrsreid0:00 27 Oct '07  
AnswerRe: How to get row value? Pinmembercrsreid1:38 27 Oct '07  
GeneralDon't work with MYSQL 5.0 PinmemberCHEICKNA TRAORE5:01 20 Jul '06  
GeneralRe: Don't work with MYSQL 5.0 Pinmemberr4d4r5:53 29 Aug '06  
GeneralWow! PinmemberRolando E. Cruz-Marshall9:20 11 Jul '06  
GeneralSome fixes PinmemberFreelanc3r1:19 28 Jun '06  
GeneralLinker Error PinmemberA.T6:25 27 Jun '06  
GeneralRe: Linker Error Pinmemberruying18:02 19 May '08  
GeneralBorland C++ Builder 6.0 Pinmemberwinsth1:13 10 May '06  
GeneralI Donnow .... PinmemberSPrutnik23:08 1 Apr '06  
Generalnewbie - error C2065: 'mysql_connect' : Pinmemberdoctorrie13:55 19 Mar '06  
GeneralRe: newbie - error C2065: 'mysql_connect' : Pinmemberfsdfdfg3:40 29 Sep '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 4 May 2003
Editor: Smitha Vijayan
Copyright 2003 by Kensho
Everything else Copyright © CodeProject, 1999-2009
Web19 | Advertise on the Code Project