[prev in list] [next in list] [prev in thread] [next in thread]
List: kexi
Subject: Re: [Kexi] IDENTITY issues in Sybase
From: Jarosław_Staniek <js () iidea ! pl>
Date: 2008-01-01 14:18:11
Message-ID: 477A4BA3.5070501 () iidea ! pl
[Download RAW message or body]
Sharan Rao said the following, On 2007-12-31 22:07:
> Reviewing the code again, is passing only FieldList object enough ?
> The tablename can be obtained from one of the fields in the FieldList.
> But this would also lead to calculation of the tableName from the
> FieldList object three times in most insertRecord() functions.
> 1. Normal calculation in insertRecord()
> 2. in drv_beforeInsert()
> 3. in drv_afterInsert()
Sharan, thanks for the patch; it's mostly OK.
First note, could you please change spaces to tabs in the indentation?
(even if we plan to switch to spaces soon I hope)
* Move Connection::drv_beforeInsert(), etc. to the header file for efficiency.
You'll need to put Q_UNUSED(table);, etc. there to avoid warnings about
unused args.
* Check results of calling these methods, i.e.
if (!drv_beforeInsert(...))
return false;
* commit cursor.cpp change (removal of my commentout) as a separate checkin.
* In SybaseConnection::drv_beforeInsert() you could put instead:
+bool KexiDB::SybaseConnection::drv_beforeInsert( const QString& table,
FieldList& fields )
+{
+
+ if ( fields.autoIncrementFields()->isEmpty() )
+ return true;
// explicit insertion into IDENTITY fields !!
return drv_executeSQL( QString::fromLatin1( "SET IDENTITY_INSERT %1 ON"
).arg( table ) );
+}
Same for other 3 methods.
BTW, don't we need escape the table name?
--
regards / pozdrawiam, Jaroslaw Staniek
Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
KDE Libraries for MS Windows (http://windows.kde.org)
_______________________________________________
Kexi mailing list
Kexi@kde.org
https://mail.kde.org/mailman/listinfo/kexi
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic