|
[include order at your source codes] #include "mysql.h" #include "qDecoder.h"
Not documented yet, please refer below sample codes.
Q_DB *db = NULL; Q_DBRESULT *result = NULL; db = qDb("MYSQL", "dbhost.qdecoder.org", 3306, "test", "secret", "sampledb", true); if (db == NULL) { printf("ERROR: Not supported database type.\n"); return -1; } // try to connect if (db->open(db) == false) { printf("WARNING: Can't connect to database.\n"); return -1; } // get results result = db->executeQuery(db, "SELECT name, population FROM City"); if (result != NULL) { printf("COLS : %d , ROWS : %d\n", result->getCols(result), result->getRows(result)); while (result->getNext(result) == true) { char *pszName = result->getStr(result, "name"); int nPopulation = result->getInt(result, "population"); printf("Country : %s , Population : %d\n", pszName, nPopulation); } result->free(result); } // close connection db->close(db); // free db object db->free(db);
| [Home] [About] [Examples] [Changes] [Download] [SVN Repository] [Install] [Reference] |