Changeset 43
- Timestamp:
- 01/05/07 16:55:19 (2 years ago)
- Files:
-
- trunk/dbi/sqlite/SqliteDatabase.d (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dbi/sqlite/SqliteDatabase.d
r40 r43 8 8 module dbi.sqlite.SqliteDatabase; 9 9 10 version (Ares) { 11 private import util.string : asString = toString; 10 version (Tango) { 11 private import tango.stdc.stringz : toDString = fromUtf8z; 12 private import tango.stdc.stringz : toCString = toUtf8z; 12 13 debug (UnitTest) private import std.io.Console; 13 14 } else { 14 private import std.string : asString = toString; 15 private import std.string : toDString = toString; 16 private import std.string : toCString = toStringz; 15 17 debug (UnitTest) private import std.stdio; 16 18 } … … 61 63 */ 62 64 override void connect (char[] params, char[] username = null, char[] password = null) { 63 if ((errorCode = sqlite3_open( params, &database)) != SQLITE_OK) {65 if ((errorCode = sqlite3_open(toCString(params), &database)) != SQLITE_OK) { 64 66 throw new DBIException("Could not open or create " ~ params, errorCode, specificToGeneral(errorCode)); 65 67 } … … 72 74 if (database !is null) { 73 75 if ((errorCode = sqlite3_close(database)) != SQLITE_OK) { 74 throw new DBIException( asString(sqlite3_errmsg(database)), sql, errorCode, specificToGeneral(errorCode));76 throw new DBIException(toDString(sqlite3_errmsg(database)), sql, errorCode, specificToGeneral(errorCode)); 75 77 } 76 78 database = null; … … 90 92 char** errorMessage; 91 93 this.sql = sql; 92 if ((errorCode = sqlite3_exec(database, sql, null, null, errorMessage)) != SQLITE_OK) {93 throw new DBIException( asString(sqlite3_errmsg(database)), sql, errorCode, specificToGeneral(errorCode));94 if ((errorCode = sqlite3_exec(database, toCString(sql), null, null, errorMessage)) != SQLITE_OK) { 95 throw new DBIException(toDString(sqlite3_errmsg(database)), sql, errorCode, specificToGeneral(errorCode)); 94 96 } 95 97 } … … 111 113 sqlite3_stmt* stmt; 112 114 this.sql = sql; 113 if ((errorCode = sqlite3_prepare(database, sql, sql.length, &stmt, errorMessage)) != SQLITE_OK) {114 throw new DBIException( asString(sqlite3_errmsg(database)), sql, errorCode, specificToGeneral(errorCode));115 if ((errorCode = sqlite3_prepare(database, toCString(sql), sql.length, &stmt, errorMessage)) != SQLITE_OK) { 116 throw new DBIException(toDString(sqlite3_errmsg(database)), sql, errorCode, specificToGeneral(errorCode)); 115 117 } 116 118 return new SqliteResult(stmt); … … 142 144 */ 143 145 deprecated override char[] getErrorMessage () { 144 return asString(sqlite3_errmsg(database));146 return toDString(sqlite3_errmsg(database)); 145 147 } 146 148
