Skip to content

Commit

Permalink
add postgresql uuid data type support - issue #24
Browse files Browse the repository at this point in the history
  • Loading branch information
buggins committed Sep 21, 2016
1 parent b1e5030 commit 634ba41
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/pgsql_test/source/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,18 @@ int main(string[] argv)
ubyte[] res = rs2.getUbytes(2);
assert(res == bin_data);
}

stmt.executeUpdate("DROP TABLE IF EXISTS guidtest");
stmt.executeUpdate("CREATE TABLE guidtest (guid uuid not null primary key, name text)");
stmt.executeUpdate("INSERT INTO guidtest (guid, name) VALUES ('cd3c7ffd-7919-f6c5-999d-5586d9f3b261', 'vasia')");
struct Guidtest {
string guid;
string name;
}
Guidtest[] guidrows;
foreach(e; stmt.select!Guidtest)
guidrows ~= e;
writeln(guidrows);

return 0;
}
3 changes: 3 additions & 0 deletions source/ddbc/drivers/pgsqlddbc.d
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,9 @@ version(USE_PGSQL) {
case DATEOID:
v[col] = parseDateoid(s);
break;
case UUIDOID:
v[col] = s;
break;
default:
throw new SQLException("Unsupported column type " ~ to!string(t));
}
Expand Down

0 comments on commit 634ba41

Please sign in to comment.