Changeset 42

Show
Ignore:
Timestamp:
01/05/07 16:28:01 (2 years ago)
Author:
brad
Message:
  • [41] ended up with way more updates than I had intended, including
    • toCString and toDString, which help with implicit conversions of char[] to pointers, which has been removed from the compiler.
    • PgResult had a bounds problem
    • pg.all now includes PgError?
    • version (Posix) makes an appearance for the pragma(lib)
    • begin converting Ares to Tango
  • This changeset is cryogen's patch for MySQL and includes changes for toCString and toDString as noted above.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dbi/mysql/MysqlDatabase.d

    r40 r42  
    1010version (Ares) { 
    1111    private static import std.regexp; 
    12     private import util.string : asString = toString; 
     12    private import util.string : toDString = toString; 
     13    private import util.string : toCString = toStringz; 
    1314    debug (UnitTest) private import std.io.Console; 
    1415} else { 
    1516    private static import std.string; 
    16     alias std.string.toString asString; 
     17    alias std.string.toString toDString; 
     18  alias std.string.toStringz toCString; 
    1719    debug (UnitTest) private import std.stdio; 
    1820} 
     
    8082        char[] host = "localhost"; 
    8183        char[] dbname = "test"; 
    82         char[] sock = "/tmp/mysql.sock"
     84        char[] sock = null
    8385        uint port = 0; 
    8486 
     
    113115        } 
    114116 
    115         mysql_real_connect(connection, host, username, password, dbname, port, sock, 0); 
     117        mysql_real_connect(connection, toCString(host), toCString(username),  
     118        toCString(password), toCString(dbname), port,  
     119        sock ? toCString(sock) : null, 0); 
    116120        if (uint error = mysql_errno(connection)) { 
    117121            throw new DBIException("Unable to connect to the MySQL database.", error, dbi.mysql.MysqlError.specificToGeneral(error)); 
     
    142146     */ 
    143147    override void execute (char[] sql) { 
    144         int error = mysql_real_query(connection, sql, sql.length); 
     148        int error = mysql_real_query(connection, toCString(sql), sql.length); 
    145149        if (error) { 
    146150            throw new DBIException("Unable to execute a command on the MySQL database.", sql, error, dbi.mysql.MysqlError.specificToGeneral(error)); 
     
    161165     */ 
    162166    override MysqlResult query (char[] sql) { 
    163         mysql_real_query(connection, sql, sql.length); 
     167        mysql_real_query(connection, toCString(sql), sql.length); 
    164168        MYSQL_RES* results = mysql_store_result(connection); 
    165169        //if (results is null) { 
     
    195199     */ 
    196200    deprecated override char[] getErrorMessage () { 
    197         return asString(mysql_error(connection)); 
     201        return toDString(mysql_error(connection)); 
    198202    } 
    199203