bookmarksengine/bookmarksserver/src/bookmarkserver.cpp
changeset 2 016bf4557e2f
parent 0 fa475d6462b2
--- a/bookmarksengine/bookmarksserver/src/bookmarkserver.cpp	Tue May 04 12:39:38 2010 +0300
+++ b/bookmarksengine/bookmarksserver/src/bookmarkserver.cpp	Fri Jun 11 13:48:52 2010 +0300
@@ -1,21 +1,24 @@
 /*
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License for more details.
 *
-* Contributors:
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program.  If not, 
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
 *
-* Description: 
+* Description:
 *
 */
 
-
 #include<bookmarkserver.h>
 #include<QSqlDatabase>
 #include<QSqlQuery>
@@ -308,11 +311,11 @@
     db.setDatabaseName(dbLocation);
 
     if (!db.open())
-        return -1;
+        return -1; 
 
-    QFileInfo dbFile(dbLocation);
-    if (dbFile.exists() && dbFile.size() == 0)
-        {
+    //Check if the table exists
+    QStringList tablelist = db.tables(QSql::Tables);
+    if (tablelist.count() == 0) {
         QSqlQuery query(db);
         query.exec(
                 "CREATE TABLE BookMarkTable (title VARCHAR(40) NOT NULL,url VARCHAR(100),adate VARCHAR(40),tags VARCHAR(40),CONSTRAINT pk_BookMarkTable PRIMARY KEY(title))");