Changeset 79
- Timestamp:
- 01/18/08 13:06:02 (11 months ago)
- Files:
-
- trunk/dbi/mysql/MysqlDatabase.d (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dbi/mysql/MysqlDatabase.d
r74 r79 1 /**1 /** 2 2 * Authors: The D DBI project 3 3 * Copyright: BSD license … … 7 7 version (dbi_mysql) { 8 8 9 version (Phobos) { 10 private static import std.conv, std.string; 11 private alias std.string.toString toDString; 12 private alias std.string.toStringz toCString; 13 debug (UnitTest) private static import std.stdio; 14 } else { 15 private import tango.stdc.stringz : toDString = fromUtf8z, toCString = toUtf8z; 16 private import tango.io.Console; 17 private static import tango.text.Util; 18 private static import tango.text.convert.Integer; 19 debug (UnitTest) private static import tango.io.Stdout; 20 } 9 private import tango.stdc.stringz : toDString = fromUtf8z, toCString = toStringz; 10 private import tango.io.Console; 11 private static import tango.text.Util; 12 private static import tango.text.convert.Integer; 13 debug (UnitTest) private static import tango.io.Stdout; 14 21 15 private import dbi.Database, dbi.DBIException, dbi.Result, dbi.Row, dbi.Statement, dbi.Registry; 22 16 private import dbi.mysql.imp, dbi.mysql.MysqlError, dbi.mysql.MysqlResult; … … 114 108 } 115 109 if ("port" in keywords) { 116 version (Phobos) { 117 port = std.conv.toInt(keywords["port"]); 118 } else { 119 port = cast(uint)tango.text.convert.Integer.parse(keywords["port"]); 120 } 121 } 122 } 123 124 version (Phobos) { 125 if (std.string.find(params, "=") != -1) { 126 parseKeywords(); 127 } else { 128 dbname = params; 129 } 130 } else { 131 if (tango.text.Util.contains(params, '=')) { 132 parseKeywords(); 133 } else { 134 dbname = params; 135 } 136 } 110 port = cast(uint)tango.text.convert.Integer.parse(keywords["port"]); 111 } 112 } 113 if (tango.text.Util.contains(params, '=')) { 114 parseKeywords(); 115 } else { 116 dbname = params; 117 } 137 118 138 119 mysql_real_connect(connection, toCString(host), toCString(username), toCString(password), toCString(dbname), port, toCString(sock), 0); … … 271 252 272 253 unittest { 273 version (Phobos) { 274 void s1 (char[] s) { 275 std.stdio.writefln("%s", s); 276 } 277 278 void s2 (char[] s) { 279 std.stdio.writefln(" ...%s", s); 280 } 281 } else { 282 void s1 (char[] s) { 283 tango.io.Stdout.Stdout(s).newline(); 284 } 285 286 void s2 (char[] s) { 287 tango.io.Stdout.Stdout(" ..." ~ s).newline(); 288 } 289 } 254 255 void s1 (char[] s) { 256 tango.io.Stdout.Stdout(s).newline(); 257 } 258 259 void s2 (char[] s) { 260 tango.io.Stdout.Stdout(" ..." ~ s).newline(); 261 } 290 262 /+ 291 263 s1("dbi.mysql.MysqlDatabase:");
