aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-09-10 12:12:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-09-10 12:12:06 +0200
commit3ac67fb63eec3534046fe2eb72bc2d37aca1cd98 (patch)
tree8d5938b6666fc5387286effa905562f11124220b
parent275245dfefd73f5e4e81e46637ade03315408fb6 (diff)
Add support for alternative UTF-16 image for TEXT in SQLite
Use it to handle QString and support std::wstring on Windows.
-rw-r--r--NEWS9
-rw-r--r--doc/manual.xhtml14
-rw-r--r--odb/relational/sqlite/context.cxx3
-rw-r--r--odb/relational/sqlite/source.cxx4
4 files changed, 20 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index e33c5a0..47e165e 100644
--- a/NEWS
+++ b/NEWS
@@ -53,10 +53,11 @@ Version 2.1.0
more information, refer to Section 20.1, "Basic Types" in the ODB manual
as well as the 'qt' example in the odb-examples package.
- * SQLite improvements: Ability to specify the virtual filesystem (vfs)
- module in the database constructor (Section 14.2, "SQLite Database
- Class"). Ability to pass database name as std::wstring on Windows
- (Section 14.2, "SQLite Database Class").
+ * SQLite improvements: Persistence support for std::wstring on Windows
+ (Section 14.1, "SQLite Type Mapping"). Ability to pass the database
+ name as std::wstring on Windows (Section 14.2, "SQLite Database Class").
+ Ability to specify the virtual filesystem (vfs) module in the database
+ constructor (Section 14.2, "SQLite Database Class").
* The id() pragma that was used to declare a persistent class without an
object id has been renamed to no_id.
diff --git a/doc/manual.xhtml b/doc/manual.xhtml
index a9be249..8438ff8 100644
--- a/doc/manual.xhtml
+++ b/doc/manual.xhtml
@@ -13901,6 +13901,12 @@ class object
<td><code>TEXT</code></td>
<td><code>NOT NULL</code></td>
</tr>
+
+ <tr>
+ <td><code>std::wstring (Windows only)</code></td>
+ <td><code>TEXT</code></td>
+ <td><code>NOT NULL</code></td>
+ </tr>
</table>
<p>SQLite represents the <code>NaN</code> <code>FLOAT</code> value
@@ -14030,8 +14036,8 @@ namespace odb
header file to make this class available in your application.</p>
<p>The first constructor opens the specified SQLite database. The
- <code>name</code> argument is the database file
- name to open. If this argument is empty, then a temporary,
+ <code>name</code> argument is the database file name to open in
+ the UTF-8 encoding. If this argument is empty, then a temporary,
on-disk database is created. If this argument is the
<code>:memory:</code> special value, then a temporary, in-memory
database is created. The <code>flags</code> argument allows us to
@@ -14058,8 +14064,8 @@ auto_ptr&lt;odb::database> db (
</pre>
<p>The second constructor is the same as the first except that the database
- name is passes as <code>std::wstring</code>. This constructor is only
- available when compiling for Windows.</p>
+ name is passes as <code>std::wstring</code> in the UTF-16 encoding. This
+ constructor is only available when compiling for Windows.</p>
<p>The third constructor extracts the database parameters from the
command line. The following options are recognized:</p>
diff --git a/odb/relational/sqlite/context.cxx b/odb/relational/sqlite/context.cxx
index 52c7751..5dc3fa8 100644
--- a/odb/relational/sqlite/context.cxx
+++ b/odb/relational/sqlite/context.cxx
@@ -53,7 +53,8 @@ namespace relational
{"float", "REAL", 0, true},
{"double", "REAL", 0, true},
- {"::std::string", "TEXT", 0, false}
+ {"::std::string", "TEXT", 0, false},
+ {"::std::wstring", "TEXT", 0, false}
};
}
diff --git a/odb/relational/sqlite/source.cxx b/odb/relational/sqlite/source.cxx
index 1e93568..7d29c1e 100644
--- a/odb/relational/sqlite/source.cxx
+++ b/odb/relational/sqlite/source.cxx
@@ -51,7 +51,9 @@ namespace relational
virtual void
traverse_text (member_info& mi)
{
- os << b << ".type = sqlite::bind::text;"
+ os << b << ".type = sqlite::image_traits<" << endl
+ << " " << mi.fq_type () << "," << endl
+ << " sqlite::id_text>::bind_value;"
<< b << ".buffer = " << arg << "." << mi.var << "value.data ();"
<< b << ".size = &" << arg << "." << mi.var << "size;"
<< b << ".capacity = " << arg << "." << mi.var <<