Changeset 43

Show
Ignore:
Timestamp:
01/05/07 16:55:19 (2 years ago)
Author:
brad
Message:

SQLite updates for toCString/toDString

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dbi/sqlite/SqliteDatabase.d

    r40 r43  
    88module dbi.sqlite.SqliteDatabase; 
    99 
    10 version (Ares) { 
    11     private import util.string : asString = toString; 
     10version (Tango) { 
     11    private import tango.stdc.stringz : toDString = fromUtf8z; 
     12    private import tango.stdc.stringz : toCString = toUtf8z; 
    1213    debug (UnitTest) private import std.io.Console; 
    1314} else { 
    14     private import std.string : asString = toString; 
     15    private import std.string : toDString = toString; 
     16    private import std.string : toCString = toStringz; 
    1517    debug (UnitTest) private import std.stdio; 
    1618} 
     
    6163     */ 
    6264    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) { 
    6466            throw new DBIException("Could not open or create " ~ params, errorCode, specificToGeneral(errorCode)); 
    6567        } 
     
    7274        if (database !is null) { 
    7375            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)); 
    7577            } 
    7678            database = null; 
     
    9092        char** errorMessage; 
    9193        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)); 
    9496        } 
    9597    } 
     
    111113        sqlite3_stmt* stmt; 
    112114        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)); 
    115117        } 
    116118        return new SqliteResult(stmt); 
     
    142144     */ 
    143145    deprecated override char[] getErrorMessage () { 
    144         return asString(sqlite3_errmsg(database)); 
     146        return toDString(sqlite3_errmsg(database)); 
    145147    } 
    146148