1 /********************************************************************/ 2 /* */ 3 /* sql_drv.h Prototypes for database access functions. */ 4 /* Copyright (C) 1989 - 2014 Thomas Mertes */ 5 /* */ 6 /* This file is part of the Seed7 Runtime Library. */ 7 /* */ 8 /* The Seed7 Runtime Library is free software; you can */ 9 /* redistribute it and/or modify it under the terms of the GNU */ 10 /* Lesser General Public License as published by the Free Software */ 11 /* Foundation; either version 2.1 of the License, or (at your */ 12 /* option) any later version. */ 13 /* */ 14 /* The Seed7 Runtime Library is distributed in the hope that it */ 15 /* will be useful, but WITHOUT ANY WARRANTY; without even the */ 16 /* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */ 17 /* PURPOSE. See the GNU Lesser General Public License for more */ 18 /* details. */ 19 /* */ 20 /* You should have received a copy of the GNU Lesser General */ 21 /* Public License along with this program; if not, write to the */ 22 /* Free Software Foundation, Inc., 51 Franklin Street, */ 23 /* Fifth Floor, Boston, MA 02110-1301, USA. */ 24 /* */ 25 /* Module: Seed7 Runtime Library */ 26 /* File: seed7/src/sql_drv.h */ 27 /* Changes: 2013, 2014 Thomas Mertes */ 28 /* Content: Prototypes for database access functions. */ 29 /* */ 30 /********************************************************************/ 31 32 typedef struct { 33 void (*freeDatabase) (databaseType database); 34 void (*freePreparedStmt) (sqlStmtType sqlStatement); 35 void (*sqlBindBigInt) (sqlStmtType sqlStatement, intType pos, 36 const const_bigIntType value); 37 void (*sqlBindBigRat) (sqlStmtType sqlStatement, intType pos, 38 const const_bigIntType numerator, 39 const const_bigIntType denominator); 40 void (*sqlBindBool) (sqlStmtType sqlStatement, intType pos, boolType value); 41 void (*sqlBindBStri) (sqlStmtType sqlStatement, intType pos, 42 const const_bstriType bstri); 43 void (*sqlBindDuration) (sqlStmtType sqlStatement, intType pos, 44 intType year, intType month, intType day, intType hour, 45 intType minute, intType second, intType micro_second); 46 void (*sqlBindFloat) (sqlStmtType sqlStatement, intType pos, floatType value); 47 void (*sqlBindInt) (sqlStmtType sqlStatement, intType pos, intType value); 48 void (*sqlBindNull) (sqlStmtType sqlStatement, intType pos); 49 void (*sqlBindStri) (sqlStmtType sqlStatement, intType pos, 50 const const_striType stri); 51 void (*sqlBindTime) (sqlStmtType sqlStatement, intType pos, 52 intType year, intType month, intType day, intType hour, 53 intType min, intType sec, intType micro_sec, 54 intType time_zone); 55 void (*sqlClose) (databaseType database); 56 bigIntType (*sqlColumnBigInt) (sqlStmtType sqlStatement, intType column); 57 void (*sqlColumnBigRat) (sqlStmtType sqlStatement, intType column, 58 bigIntType *numerator, bigIntType *denominator); 59 boolType (*sqlColumnBool) (sqlStmtType sqlStatement, intType column); 60 bstriType (*sqlColumnBStri) (sqlStmtType sqlStatement, intType column); 61 void (*sqlColumnDuration) (sqlStmtType sqlStatement, intType column, 62 intType *year, intType *month, intType *day, intType *hour, 63 intType *minute, intType *second, intType *micro_second); 64 floatType (*sqlColumnFloat) (sqlStmtType sqlStatement, intType column); 65 intType (*sqlColumnInt) (sqlStmtType sqlStatement, intType column); 66 striType (*sqlColumnStri) (sqlStmtType sqlStatement, intType column); 67 void (*sqlColumnTime) (sqlStmtType sqlStatement, intType column, 68 intType *year, intType *month, intType *day, intType *hour, 69 intType *minute, intType *second, intType *micro_second, 70 intType *time_zone, boolType *is_dst); 71 void (*sqlCommit) (databaseType database); 72 void (*sqlExecute) (sqlStmtType sqlStatement); 73 boolType (*sqlFetch) (sqlStmtType sqlStatement); 74 boolType (*sqlGetAutoCommit) (databaseType database); 75 boolType (*sqlIsNull) (sqlStmtType sqlStatement, intType column); 76 sqlStmtType (*sqlPrepare) (databaseType database, 77 const const_striType sqlStatementStri); 78 void (*sqlRollback) (databaseType database); 79 void (*sqlSetAutoCommit) (databaseType database, boolType autoCommit); 80 intType (*sqlStmtColumnCount) (sqlStmtType sqlStatement); 81 striType (*sqlStmtColumnName) (sqlStmtType sqlStatement, intType column); 82 } sqlFuncRecord, *sqlFuncType; 83 84 #define DB_CATEGORY_MYSQL 1 85 #define DB_CATEGORY_SQLITE 2 86 #define DB_CATEGORY_POSTGRESQL 3 87 #define DB_CATEGORY_OCI 4 88 #define DB_CATEGORY_ODBC 5 89 #define DB_CATEGORY_FIREBIRD 6 90 #define DB_CATEGORY_DB2 7 91 #define DB_CATEGORY_SQL_SERVER 8 92 #define DB_CATEGORY_TDS 9 93 94 95 databaseType sqlOpenDb2 (const const_striType host, intType port, 96 const const_striType dbName, const const_striType user, 97 const const_striType password); 98 databaseType sqlOpenFire (const const_striType host, intType port, 99 const const_striType dbName, const const_striType user, 100 const const_striType password); 101 databaseType sqlOpenLite (const const_striType host, intType port, 102 const const_striType dbName, const const_striType user, 103 const const_striType password); 104 databaseType sqlOpenMy (const const_striType host, intType port, 105 const const_striType dbName, const const_striType user, 106 const const_striType password); 107 databaseType sqlOpenOci (const const_striType host, intType port, 108 const const_striType dbName, const const_striType user, 109 const const_striType password); 110 databaseType sqlOpenOdbc (const const_striType driver, 111 const const_striType server, const const_striType dbName, 112 const const_striType user, const const_striType password); 113 databaseType sqlOpenPost (const const_striType host, intType port, 114 const const_striType dbName, const const_striType user, 115 const const_striType password); 116 databaseType sqlOpenSqlServer (const const_striType host, intType port, 117 const const_striType dbName, const const_striType user, 118 const const_striType password); 119 databaseType sqlOpenTds (const const_striType host, intType port, 120 const const_striType dbName, const const_striType user, 121 const const_striType password); 122