[Kexi] IDENTITY issues in Sybase

Sharan Rao sharanrao at gmail.com
Mon Dec 31 22:07:40 CET 2007


On Jan 1, 2008 1:41 AM, Sharan Rao <sharanrao at gmail.com> wrote:
> On Monday 24 Dec 2007 5:15:12 pm Jarosław Staniek wrote:
> >
> > We may want to add empty virtual methods
> > Connection::drv_beforeUpdateRow(), Connection::drv_afterUpdateRow()
> > Connection::drv_beforeInsertRow(), Connection::drv_afterInsertRow()
> > and call them directly before/after executeSQL(m_sql) line.
> >
>
> Hi,
>
>  I've attached the modification of kexidb API and Sybase driver adjustments
> for fixing the IDENTITY issues discussed. ( Although I've attached even the
> sybase specific diffs, the focus ,of course, curently is on connection.h/cpp
> API )
>
> > These methods would have similar parameters as updateRow()/insertRow(), so
> > you can implement the forementioned drv_* methods for the Sybase driver and
> > check in 'QuerySchema &query' and 'RowEditBuffer& buf' whether your
> > identity column(s) have to be altered.
> >
>
> The API differs from the above namely because, `Inserting` into a row takes
> place from more places in KexiDB that Conenction::insertRow(). There are some
> variants of Connection::insertRecord() to take care of too.
> Hence I've changed the signature to   `tablename` and `fieldlist` ( to which
> any QuerySchema and TableSchema can be passed ,of course, but is more general
> for Sybase's requirements).  Sybase as such only wants to know the tablename
> and the AutoIncrement fields that are being modified. Hence the signature I
> specifed seems to do the job.
>
> Any suggestions as to how I can make the API more general ?
>
> Cheers and Happy New Year to all !!
>  Sharan Rao
>


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()

But I guess the interface will be less redundant ?
Suggestions ?

Cheers!
 Sharan Rao


More information about the Kexi mailing list