[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/akonadi/server
From:       Volker Krause <vkrause () kde ! org>
Date:       2010-07-15 8:14:28
Message-ID: 20100715081428.30636AC73A () svn ! kde ! org
[Download RAW message or body]

SVN commit 1150155 by vkrause:

Fix sqlite table creation as well.


 M  +11 -9     src/storage/dbinitializer_p.cpp  
 M  +1 -1      tests/unittest/dbinitializertest_data/sqlite_ct_collection  
 M  +1 -1      tests/unittest/dbinitializertest_data/sqlite_ct_collectionattribute  
 M  +2 -2      tests/unittest/dbinitializertest_data/sqlite_ct_flag  
 M  +2 -2      tests/unittest/dbinitializertest_data/sqlite_ct_mimetype  
 M  +1 -1      tests/unittest/dbinitializertest_data/sqlite_ct_part  
 M  +1 -1      tests/unittest/dbinitializertest_data/sqlite_ct_pimitem  
 M  +2 -2      tests/unittest/dbinitializertest_data/sqlite_ct_resource  


--- trunk/kdesupport/akonadi/server/src/storage/dbinitializer_p.cpp #1150154:1150155
@@ -135,22 +135,24 @@
 
 QString DbInitializerSqlite::buildColumnStatement( const ColumnDescription \
&columnDescription ) const  {
-  QString column = columnDescription.name;
+  QString column = columnDescription.name + QLatin1Char( ' ' );
 
-  column += QLatin1Char( ' ' ) + sqlType( columnDescription.type );
+  if ( columnDescription.isAutoIncrement )
+    column += QLatin1String( "INTEGER" );
+  else
+    column += sqlType( columnDescription.type );
 
-  if ( !columnDescription.allowNull )
-    column += QLatin1String( " NOT NULL" );
+  if ( columnDescription.isPrimaryKey )
+    column += QLatin1String( " PRIMARY KEY" );
+  else if ( columnDescription.isUnique )
+    column += QLatin1String( " UNIQUE" );
 
   if ( columnDescription.isAutoIncrement )
     column += QLatin1String( " AUTOINCREMENT" );
 
-  if ( columnDescription.isPrimaryKey )
-    column += QLatin1String( " INTEGER PRIMARY KEY" );
+  if ( !columnDescription.allowNull )
+    column += QLatin1String( " NOT NULL" );
 
-  if ( columnDescription.isUnique )
-    column += QLatin1String( " UNIQUE" );
-
   if ( !columnDescription.defaultValue.isEmpty() ) {
     const QString defaultValue = sqlValue( columnDescription.type, \
columnDescription.defaultValue );  
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/sqlite_ct_collection \
#1150154:1150155 @@ -1,4 +1,4 @@
-CREATE TABLE CollectionTable (id BIGINT NOT NULL AUTOINCREMENT INTEGER PRIMARY KEY,
+CREATE TABLE CollectionTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
                               remoteId TEXT,
                               remoteRevision TEXT,
                               name TEXT NOT NULL,
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/sqlite_ct_collectionattribute \
#1150154:1150155 @@ -1,4 +1,4 @@
-CREATE TABLE CollectionAttributeTable (id BIGINT NOT NULL AUTOINCREMENT INTEGER \
PRIMARY KEY, +CREATE TABLE CollectionAttributeTable (id INTEGER PRIMARY KEY \
AUTOINCREMENT NOT NULL,  collectionId BIGINT NOT NULL,
                                        type LONGBLOB NOT NULL,
                                        value LONGBLOB)
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/sqlite_ct_flag \
#1150154:1150155 @@ -1,2 +1,2 @@
-CREATE TABLE FlagTable (id BIGINT NOT NULL AUTOINCREMENT INTEGER PRIMARY KEY,
-                        name TEXT NOT NULL UNIQUE)
+CREATE TABLE FlagTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+                        name TEXT UNIQUE NOT NULL)
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/sqlite_ct_mimetype \
#1150154:1150155 @@ -1,2 +1,2 @@
-CREATE TABLE MimeTypeTable (id BIGINT NOT NULL AUTOINCREMENT INTEGER PRIMARY KEY,
-                            name TEXT NOT NULL UNIQUE)
+CREATE TABLE MimeTypeTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+                            name TEXT UNIQUE NOT NULL)
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/sqlite_ct_part \
#1150154:1150155 @@ -1,4 +1,4 @@
-CREATE TABLE PartTable (id BIGINT NOT NULL AUTOINCREMENT INTEGER PRIMARY KEY,
+CREATE TABLE PartTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
                         pimItemId BIGINT NOT NULL,
                         name TEXT NOT NULL,
                         data LONGBLOB,
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/sqlite_ct_pimitem \
#1150154:1150155 @@ -1,4 +1,4 @@
-CREATE TABLE PimItemTable (id BIGINT NOT NULL AUTOINCREMENT INTEGER PRIMARY KEY,
+CREATE TABLE PimItemTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
                            rev INTEGER NOT NULL DEFAULT 0,
                            remoteId TEXT,
                            remoteRevision TEXT,
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/sqlite_ct_resource \
#1150154:1150155 @@ -1,3 +1,3 @@
-CREATE TABLE ResourceTable (id BIGINT NOT NULL AUTOINCREMENT INTEGER PRIMARY KEY,
-                            name TEXT NOT NULL UNIQUE,
+CREATE TABLE ResourceTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+                            name TEXT UNIQUE NOT NULL,
                             isVirtual BOOL DEFAULT false)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic