Please Help

RudeDatabase™ Open Source C++ Database Library

Version 4.1.0

Basic Usage Example


#include <rude/database.h>
#include <iostream>

using namespace std;
using namespace rude;

void doStuff(void)
{

 // Access the database anywhere in your program as a global object
 // It will automatically connect to a given context the first time you access it
 //
 Database *database = Database::instance("mycontext");
 
 // Perform a Query 
 //
 if(database->executeQuery("DELETE FROM tbl_contacts WHERE contact_id=34"))
 {
 	cout << "Successful Deletion!!\n";
 }
 else
 {
 	cout << database->getError() << "\n";
 }

}


int main(void)
{
 // At the beginning of your application,
 // Configure all databases you will use
 //
 Database::addContext("mycontext", "test", "username", "password", "localhost", 3306);
 Database::addContext("othercontext", "test", "superuser", "superpass", "localhost", 3306);
 	
 // Do whatever you application does
 //
 doStuff();
 
 //  At the end of your application, call finish to close all open connections
 // 
 Database::finish(); 
 return 0; 

 }