You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+1
Original file line number
Diff line number
Diff line change
@@ -161,6 +161,7 @@ pull requests are welcome. Please ensure your local branch is up to date and all
161
161
The examples should also run, make sure to change to the _example_ directory and run `dub build` then make sure that the compiled executable will run with each supported database (you'll need to install relevant libs and create databases and users with relevant permissions):
Copy file name to clipboardexpand all lines: example/source/testddbc.d
+30-1
Original file line number
Diff line number
Diff line change
@@ -286,7 +286,13 @@ int main(string[] args)
286
286
break;
287
287
case"mysql": // MySQL has an underscore in 'AUTO_INCREMENT'
288
288
stmt.executeUpdate("DROP TABLE IF EXISTS ddbct1");
289
-
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ddbct1 (`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, `name` VARCHAR(250), `comment` MEDIUMTEXT, `ts` TIMESTAMP)");
289
+
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ddbct1 (
290
+
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
291
+
`name` VARCHAR(250),
292
+
`comment` MEDIUMTEXT,
293
+
`ts` TIMESTAMP NULL DEFAULT NULL
294
+
)");
295
+
290
296
stmt.executeUpdate("INSERT INTO ddbct1 (`name`, `comment`, `ts`) VALUES ('name1', 'comment for line 1', CURRENT_TIMESTAMP), ('name2','comment for line 2 - can be very long', CURRENT_TIMESTAMP)");
291
297
292
298
stmt.executeUpdate("DROP TABLE IF EXISTS employee");
@@ -380,6 +386,29 @@ int main(string[] args)
380
386
}
381
387
assert(2== i, "There should be 2 results but instead there was "~ to!string(i));
382
388
389
+
// make sure that a timestamp can handle being NULL
390
+
stmt.executeUpdate("UPDATE ddbct1 SET ts=NULL");
391
+
i = 0;
392
+
rs = stmt.executeQuery("SELECT id, name, comment, ts FROM ddbct1 WHERE ts IS NULL");
393
+
while (rs.next()) {
394
+
SysTime now = Clock.currTime();
395
+
DateTime dtNow = cast(DateTime) now;
396
+
// if the column on the table is NULL ddbc will create a DateTime using Clock.currTime()
0 commit comments