Changeset 41
- Timestamp:
- 01/05/07 15:35:54 (2 years ago)
- Files:
-
- trunk/buildme.d (modified) (3 diffs)
- trunk/dbi/pg/PgDatabase.d (modified) (5 diffs)
- trunk/dbi/pg/PgResult.d (modified) (1 diff)
- trunk/dbi/pg/all.d (modified) (1 diff)
- trunk/dbi/pg/imp.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/buildme.d
r40 r41 77 77 switchesCompiler["-ofdbi.lib"] = true; 78 78 } else { 79 switchesCompiler["-o flibdbi.a"] = true;79 switchesCompiler["-odlibddbi.a"] = true; 80 80 } 81 81 version (Ares) { … … 95 95 switchesCompiler["-o dbi.lib"] = true; 96 96 } else { 97 switchesCompiler["-o libd bi.a"] = true;97 switchesCompiler["-o libddbi.a"] = true; 98 98 } 99 99 version (Ares) { … … 121 121 chdir("dbi"); 122 122 foreach (char[] dir; listdir(getcwd())) { 123 if (isdir(dir) ) {123 if (isdir(dir) && dir != ".svn") { 124 124 allList[dir] = true; 125 125 } trunk/dbi/pg/PgDatabase.d
r40 r41 8 8 module dbi.pg.PgDatabase; 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 } … … 103 105 params ~= " password=" ~ password ~ ""; 104 106 } 105 connection = PQconnectdb( params);107 connection = PQconnectdb(toCString(params)); 106 108 m_errorCode = cast(int)PQstatus(connection); 107 109 if (m_errorCode != ConnStatusType.CONNECTION_OK && m_errorCode) { 108 throw new DBIException( asString(PQerrorMessage(connection)), m_errorCode);110 throw new DBIException(toDString(PQerrorMessage(connection)), m_errorCode); 109 111 } 110 112 } … … 130 132 */ 131 133 override void execute (char[] sql) { 132 PGresult* res = PQexec(connection, sql.dup);134 PGresult* res = PQexec(connection, toCString(sql.dup)); 133 135 scope(exit) PQclear(res); 134 136 m_errorCode = cast(int)PQresultStatus(res); 135 137 if (m_errorCode != ExecStatusType.PGRES_COMMAND_OK && m_errorCode != ExecStatusType.PGRES_TUPLES_OK) { 136 throw new DBIException( asString(PQerrorMessage(connection)), m_errorCode, specificToGeneral(PQresultErrorField(res, PG_DIAG_SQLSTATE)));138 throw new DBIException(toDString(PQerrorMessage(connection)), m_errorCode, specificToGeneral(PQresultErrorField(res, PG_DIAG_SQLSTATE))); 137 139 } 138 140 } … … 151 153 */ 152 154 override PgResult query (char[] sql) { 153 PGresult* res = PQexec(connection, sql.dup);155 PGresult* res = PQexec(connection, toCString(sql.dup)); 154 156 ExecStatusType status = PQresultStatus(res); 155 157 m_errorCode = cast(int)PQresultStatus(res); 156 158 if (m_errorCode != ExecStatusType.PGRES_COMMAND_OK && m_errorCode != ExecStatusType.PGRES_TUPLES_OK) { 157 throw new DBIException( asString(PQerrorMessage(connection)), m_errorCode, specificToGeneral(PQresultErrorField(res, PG_DIAG_SQLSTATE)));159 throw new DBIException(toDString(PQerrorMessage(connection)), m_errorCode, specificToGeneral(PQresultErrorField(res, PG_DIAG_SQLSTATE))); 158 160 } 159 161 return new PgResult(res); … … 195 197 196 198 unittest { 197 version ( Ares) {199 version (Tango) { 198 200 void s1 (char[] s) { 199 201 Cout("" ~ s ~ "\n"); trunk/dbi/pg/PgResult.d
r40 r41 44 44 } 45 45 46 if (index > numRows) {46 if (index >= numRows) { 47 47 return null; 48 48 } trunk/dbi/pg/all.d
r40 r41 14 14 public import dbi.pg.PgDatabase, 15 15 dbi.pg.PgResult, 16 dbi.pg.PgError, 16 17 dbi.all; trunk/dbi/pg/imp.d
r40 r41 20 20 pragma (lib, "libpq.lib"); 21 21 } else version (linux) { 22 pragma (lib, "libpq.a"); 23 } else version (Posix) { 22 24 pragma (lib, "libpq.a"); 23 25 } else version (darwin) {
