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

List:       kde-commits
Subject:    kdenonbeta/keximdb
From:       Martin Ellis <martin.ellis () kdemail ! net>
Date:       2006-01-18 22:03:46
Message-ID: 1137621826.581070.14195.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 499860 by martin:

Portability fixes: 
 * make optimisation disabling work with automake.
 * dumb down strftime parameter for old C libraries.
Use QDateTime instead of QDate for importing dates and times.
Remove dodgy and slow date parsing code.


 M  +4 -2      configure.in.in  
 M  +1 -0      src/keximdb/Makefile.am  
 M  +7 -35     src/keximdb/mdbmigrate.cpp  
 M  +3 -11     src/keximdb/mdbmigrate.h  
 M  +1 -1      src/mdbtools/libmdb/Makefile.am  


--- trunk/kdenonbeta/keximdb/configure.in.in #499859:499860
@@ -46,9 +46,11 @@
   DO_NOT_COMPILE="$DO_NOT_COMPILE keximdb"
 fi
 
-CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS"
-CFLAGS="$CFLAGS $GLIB_CFLAGS"
+# Build without optimisation.  Anything higher than -O0 here causes
+# a crash in mdb_read_indices on Northwind.
+CFLAGS=`echo "$CFLAGS" | sed 's/ -O2 / -O0 /g'`
 
+
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBADD)
 AC_SUBST(GLIB_LDFLAGS)
--- trunk/kdenonbeta/keximdb/src/keximdb/Makefile.am #499859:499860
@@ -7,6 +7,7 @@
   -I$(top_srcdir)/keximdb/src/mdbtools/include \
   -I$(KEXIDB_INC) -I$(KEXIDB_INC)/kexidb \
   $(GLIB_CFLAGS) $(all_includes)
+
 keximigrate_mdb_la_METASOURCES = AUTO
 
 keximigrate_mdb_la_LIBADD = \
--- trunk/kdenonbeta/keximdb/src/keximdb/mdbmigrate.cpp #499859:499860
@@ -1,5 +1,5 @@
 /* This file is part of the KDE project
-   Copyright (C) 2005 Martin Ellis <martin.ellis@kdemail.net>
+   Copyright (C) 2005,2006 Martin Ellis <martin.ellis@kdemail.net>
    Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
  
    This program is free software; you can redistribute it and/or
@@ -61,9 +61,11 @@
 void MDBMigrate::initBackend() {
   mdb_init();
 
-  // Date format associated with Qt::ISODate: YYY-MM-DDTHH:MM:SS
-  // (where T is a literal).  See strftime documentation for more info.
-  mdb_set_date_fmt("%FT%T");
+  // Date format associated with Qt::ISODate: YYYY-MM-DDTHH:MM:SS
+  // (where T is a literal).  The following is equivalent to %FT%T, but
+  // backards compatible with old/Windows C libraries.
+  // See strftime documentation for more info.
+  mdb_set_date_fmt("%Y-%m-%dT%H:%M%:%S");
 }
 void MDBMigrate::releaseBackend() {
   mdb_exit();
@@ -218,42 +220,12 @@
   return true;
 }
 
-#if 0
-// Superceded by using mdb_set_date_fmt to get time in ISO format
-
-QVariant MDBMigrate::toDateTime(const char* data) {
-  // Need to convert "DD/MM/YY HH:MM:SS" to "YYYY/MM/DDTHH:MM:SS"
-  QRegExp rx = QRegExp("^([0-9]{1,2})/([0-9]{1,2})/([0-9]{1,4}) "
-                       "([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})");
-  QString date = QString(data);
-  QStringList values = QStringList();
-  rx.search(date, 0);
-  int matchedLen = rx.matchedLength();
-
-  if (matchedLen != -1) {
-    int yearInt = rx.cap(3).toInt();
-    //date data between 1/1/30 and 12/31/99 is assumed to fall 
-    //between Jan 1, 1930 and Dec 31, 1999
-    if (yearInt >= 30 && yearInt < 100)
-      yearInt += 1900;
-    else if (yearInt < 30)
-      yearInt += 2000;
-    
-    return QDateTime(QDate(yearInt, rx.cap(1).toInt(), rx.cap(2).toInt()),
-        QTime(rx.cap(4).toInt(), rx.cap(5).toInt(), rx.cap(6).toInt()));
-  } else {
-    kdDebug() << "MDBMigrate::toDateTime: Didn't understand " << data << endl;
-    return QVariant();
-  }
-}
-#endif
-
 QVariant MDBMigrate::toQVariant(const char* data, unsigned int len, int type) {
   if(len == 0) {
     // Null ptr => null value
     return QVariant();
   } else if (type == MDB_SDATETIME ) {
-    return QDate::fromString(data, Qt::ISODate);
+    return QDateTime::fromString(data, Qt::ISODate);
   } else {
     return QVariant(QString::fromUtf8(data, len));
   }
--- trunk/kdenonbeta/keximdb/src/keximdb/mdbmigrate.h #499859:499860
@@ -1,5 +1,5 @@
 /* This file is part of the KDE project
-   Copyright (C) 2005 Martin Ellis <martin.ellis@kdemail.net>
+   Copyright (C) 2005,2006 Martin Ellis <martin.ellis@kdemail.net>
    Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
 
    This program is free software; you can redistribute it and/or
@@ -42,14 +42,10 @@
 			KexiDB::Field::Type type(int type);
 			MdbTableDef* getTableDef(const QString& tableName);
 			QVariant toQVariant(const char* data, unsigned int len, int type);
-//			QVariant toDateTime(const char* data);
 			bool getPrimaryKey(KexiDB::TableSchema* table, MdbTableDef* tableDef);
-/*			
-			void MySQLMigrate::getConstraints(int mysqlConstraints, KexiDB::Field* fld);
-			void MySQLMigrate::getOptions(int flags, KexiDB::Field* fld);
-*/
+
 			//! Reimplemented to add support for "sourceDatabaseHasNonUnicodeEncoding" property
-//! @todo this in fact should be in Connection class but Migration framework has no such yet!
+			//! @todo this should be in Connection class but Migration framework has no such yet!
 			virtual QVariant propertyValue( const QCString& propName );
 
 		protected:
@@ -68,10 +64,6 @@
 			                           KexiDB::Connection *destConn,
 			                           KexiDB::TableSchema* dstTable);
 
-//TODO: move this somewhere to low level class (MIGRATION?)
-//			virtual bool drv_getTablesList( QStringList &list );
-//TODO: move this somewhere to low level class (MIGRATION?)
-//			virtual bool drv_containsTable( const QString &tableName );
 			virtual bool drv_progressSupported() { return true; }
 			virtual bool drv_getTableSize(const QString& table, Q_ULLONG& size);
 
--- trunk/kdenonbeta/keximdb/src/mdbtools/libmdb/Makefile.am #499859:499860
@@ -8,7 +8,7 @@
 
 # Build without optimisation.  Anything higher than -O0 here causes
 # a crash in mdb_read_indices on Northwind.
-CFLAGS=-O0
 
 AM_CFLAGS = -DMETHOD= -DMDB_NO_BACKENDS -DMDB_NO_STATS \
+ $(GLIB_CFLAGS) \
  -I${srcdir}/../include
[prev in list] [next in list] [prev in thread] [next in thread] 

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