A voir également:
- Qt sqlite3
- Qt sdk - Télécharger - Langages
- Qt tab bar - Télécharger - Personnalisation
- Qt ✓ - Forum Programmation
- Qt sync - Télécharger - Lecture
- Documentation qt en français pdf - Forum C++
2 réponses
jisisv
Messages postés
3645
Date d'inscription
dimanche 18 mars 2001
Statut
Modérateur
Dernière intervention
15 janvier 2017
934
Modifié par jisisv le 26/12/2011 à 23:06
Modifié par jisisv le 26/12/2011 à 23:06
Quel est le rapport avec Qt?
Regarde ici:
https://www.sqlite.org/cintro.html
https://www.sqlite.org/quickstart.html
Exemple:
Gates gave ^H sold you the windows.
GNU gave us the whole house.(Alexandrin)
Regarde ici:
https://www.sqlite.org/cintro.html
https://www.sqlite.org/quickstart.html
Exemple:
johand@osiris: ~/src/CCM/C $ cat sqlite-test.c #include <stdlib.h> #include <stdio.h> #include <sqlite3.h> static int callback(void *NotUsed, int argc, char **argv, char **azColName) { int i; for(i=0; i<argc; i++){ printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL"); } printf("\n"); return 0; } int main(int argc, char *argv[]) { sqlite3 *sqldb; int res, rc; char *zErrMsg; res = sqlite3_open_v2(argv[1], &sqldb, SQLITE_OPEN_READONLY, NULL); printf("res is %d\n", res); rc = sqlite3_exec(sqldb, "select * from atable;", callback, 0, &zErrMsg); if( rc != SQLITE_OK ){ fprintf(stderr, "SQL error: %s\n", zErrMsg); sqlite3_free(zErrMsg); } sqlite3_close(sqldb); return EXIT_SUCCESS; } johand@osiris: ~/src/CCM/C $ gcc -Wall -o sqlite-test -lsqlite3 sqlite-test.c johand@osiris: ~/src/CCM/C $ ./sqlite-test test.sqlite res is 0 name = toto birth = 2000-12-26 name = anatole birth = 2002-12-27
Gates gave ^H sold you the windows.
GNU gave us the whole house.(Alexandrin)
SQLite fourni une api en C, mais il existe des wrapper pour d'autres langages ou framework , ce qui est notamment le cas pour la lib Qt qui fournit un connecteur Sqlite compatible avec sa librairie de manipulation de base de données :
On trouve facilement des tutos sur comment utiliser un connecteur sqlite sous Qt :
http://qt.onmaze.com/tutorials/comment-utiliser-le-module-sql-de-qt/
http://developer.qt.nokia.com/doc/qt-4.8/qsqldatabase.html
A priori une ligne suffit à déclarer l'usage du connecteur :
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
On trouve facilement des tutos sur comment utiliser un connecteur sqlite sous Qt :
http://qt.onmaze.com/tutorials/comment-utiliser-le-module-sql-de-qt/
http://developer.qt.nokia.com/doc/qt-4.8/qsqldatabase.html
A priori une ligne suffit à déclarer l'usage du connecteur :
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");