From f01bc7a5db83aebb91853ba0669a9eaf9598a8e3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 19 Apr 2011 17:56:32 +0200 Subject: Document new enum mapping --- doc/manual.xhtml | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/manual.xhtml b/doc/manual.xhtml index b56e21e..97dc8b7 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -6620,6 +6620,32 @@ aCC +W2161 ... to VARCHAR(255) NOT NULL MySQL type. Otherwise, it is mapped to TEXT NOT NULL.

+

Additionally, by default, C++ enumerations are automatically + mapped to a suitable MySQL type. Contiguous enumerations with + the zero first enumerator are mapped to the MySQL ENUM NOT + NULL type. All other enumerations are mapped to INT + NOT NULL or INT UNSIGNED NOT NULL. For example:

+ +
+enum color {red, green, blue};
+enum taste
+{
+  bitter = 1, // Non-zero first enumerator.
+  sweet,
+  sour = 4,   // Non-contiguous.
+  salty
+};
+
+#pragma object
+class object
+{
+  ...
+
+  color color_; // Mapped to ENUM ('red', 'green', 'blue') NOT NULL.
+  taste taste_; // Mapped to INT UNSIGNED NOT NULL.
+};
+  
+

10.2 MySQL Database Class

The MySQL database class has the following @@ -7082,7 +7108,10 @@ namespace odb -

Note that SQLite only operates with signed integers and the largest +

Additionally, by default, C++ enumerations are automatically mapped to + the SQLite INTEGER NOT NULL type.

+ +

Note also that SQLite only operates with signed integers and the largest value that an SQLite database can store is a signed 64-bit integer. As a result, greater unsigned long long values will be represented in the database as negative values.

-- cgit v1.1