Bonjour,
Je suis le tuto suivant : http://mestressat.developpez.com/tut...-sqlite3-apis/
et je ne comprends pas ce qui se passe avec l'instruction suivante :
Code:
1
2
3
4
5
6
7
8
9
10 sqlite3_prepare_v2( DB, //Handle base de donnée PChar(sSQL), //Requête -1, //Longueur chaine SQL (-1 : autodetect) Stmt, //Handle requête IgnoreNextStmt); //Préparation prochaine requête // le prototype de la DLL est le suivant: // function sqlite3_prepare_v2(sqlite3:pointer;sql:pchar;nBytes:integer;var stmt:pointer;var ztail:pchar):integer; cdecl; external 'sqlite3.dll';
du bloc suivant que j'ai encapsulé dans une procedure pour reutilisation
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 procedure FS_IO_sqlite_db_query (sqlite_db_path : string; sql_str_query : string); var DB : pointer; // Data base Handle Stmt : pointer; // SQL Query Handle IgnoreNextStmt : pointer; // SQL Query Handle begin sqlite3_open(PChar(sqlite_db_path),DB); // Data base opening sqlite3_prepare_v2( // Query preparation DB, // Data Base Handle PChar(sql_str_query), // Query -1, // Length string SQL (-1 : autodetect) Stmt, // Query Handle IgnoreNextStmt); // Preparation next query sqlite3_step(Stmt); // Query execution sqlite3_finalize(Stmt); // Query validation sqlite3_close(DB); // Data base closing end; // FS_IO_sqlite_db_query
Quand je compile j'ai une erreur de type non conforme. Je connais mal PChar, est-ce que l'erreur vient de la??Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 // Juste pour mémoire, ceci est le code de la requête. // Elle est en principe OK, car je l'ai testée aver sqlite manager str_sql := 'CREATE TABLE flight_schedule_table ([ID] INTEGER PRIMARY KEY NOT NULL UNIQUE, ' + '[FLIGHT_ID] INTEGER NOT NULL, ' + '[FLIGHT_CD] VARCHAR NOT NULL, ' + '[AIRPORT_DEPARTURE] VARCHAR NOT NULL, ' + '[AIRPORT_ARRIVAL] VARCHAR NOT NULL, ' + '[LOCAL_TIME_DEPARTURE] INTEGER NOT NULL, ' + '[LOCAL_TIME_ARRIVAL] INTEGER NOT NULL, ' + '[UTC_DIFF_DEPARTURE] INTEGER NOT NULL, ' + '[UTC_DIFF_ARRIVAL] INTEGER NOT NULL, ' + '[UTC_TIME_DEPARTURE] INTEGER NOT NULL, ' + '[UTC_TIME_ARRIVAL] INTEGER NOT NULL, ' + '[AIRCRAFT_TYPE] VARCHAR NOT NULL, ' + '[IS_DATED_FLIGHT] BOOL NOT NULL, ' + '[FLIGHT_DATE] INTEGER NOT NULL);';
Je ne comprends pas non plus le ;var ztail:pchar) de la liste des arguments du prototype. Ça ne correspond pas aux arguments décrit.
Merci de votre aide