Skip to content

Commit

Permalink
readme: example update
Browse files Browse the repository at this point in the history
  • Loading branch information
denizzzka committed Feb 6, 2016
1 parent b9f2b6e commit 5088472
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void main()
// Only text query result can be obtained by this call:
auto s = conn.exec(
"SELECT now() as current_time, 'abc'::text as field_name, "
"SELECT now() as current_time, 'abc'::text as field_name, "~
"123 as field_3, 456.78 as field_4"
);
Expand Down Expand Up @@ -79,7 +79,15 @@ void main()
writeln( "3.3: ", r[0]["array_field"].asArray[2].isNull );
writeln( "3.4: ", r[0]["array_field"].asArray.isNULL(2) );
writeln( "4: ", r[0]["multi_array"].asArray.getValue(1, 2).as!PGinteger );
// It is possible to read values of unknown type using BSON:
for(auto column = 0; column < r.columnCount; column++)
{
auto cell = r[0][column];
if(!cell.isNull && !cell.isArray)
writeln("bson=", cell.toBson);
}
version(LDC) destroy(r); // before Derelict unloads its bindings (prevents SIGSEGV)
}
```
Expand All @@ -99,6 +107,8 @@ second line
3.3: true
3.4: true
4: 6
bson=-1234.56789012345
bson="first line\nsecond line"
```

TODO
Expand Down
2 changes: 1 addition & 1 deletion src/dpq2/all.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ shared static ~this()
debug
{
import std.stdio: write, writeln;
write("DerelictPQ is unloading... ");
write("DerelictPQ unloading... ");
}

import core.memory: GC;
Expand Down

0 comments on commit 5088472

Please sign in to comment.