aboutsummaryrefslogtreecommitdiff
path: root/sqlite/types/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-01-24 15:10:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-01-24 15:10:22 +0200
commit89de275db2b77d0abf9fa1ec066ef11e262c88af (patch)
tree06cb2272c5e791946dc58421ed3f2d03b7c8122e /sqlite/types/driver.cxx
parent539c92147e8d58c49f350c4070051a6ddf6b2354 (diff)
Add support for mapping char[N] to CHAR/VARCHAR database types
Also improve query support for arrays (decaying).
Diffstat (limited to 'sqlite/types/driver.cxx')
-rw-r--r--sqlite/types/driver.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/sqlite/types/driver.cxx b/sqlite/types/driver.cxx
index 69e8473..4e619fb 100644
--- a/sqlite/types/driver.cxx
+++ b/sqlite/types/driver.cxx
@@ -69,6 +69,40 @@ main (int argc, char* argv[])
t.commit ();
}
#endif
+
+ // Test char/wchar_t arrays
+ //
+ {
+#ifndef _WIN32
+ char_array o1 (1, "");
+ char_array o2 (2, "1234567890");
+ char_array o3 (3, "12345678901234567");
+#else
+ char_array o1 (1, "", L"");
+ char_array o2 (2, "1234567890", L"123456789\x00C8");
+ char_array o3 (3, "12345678901234567", L"1234567890123456\x00C8");
+#endif
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<char_array> p1 (db->load<char_array> (1));
+ auto_ptr<char_array> p2 (db->load<char_array> (2));
+ auto_ptr<char_array> p3 (db->load<char_array> (3));
+ t.commit ();
+
+ assert (o1 == *p1);
+ assert (o2 == *p2);
+ assert (o3 == *p3);
+ }
+ }
}
catch (const odb::exception& e)
{