[Kexi] IDENTITY issues in Sybase

Sharan Rao sharanrao at gmail.com
Mon Dec 24 21:00:24 CET 2007


On Monday 24 Dec 2007 5:15:12 pm Jarosław Staniek wrote:
> > 2. I need to set/unset the options, `identity_insert` and
> > `identity_update`, before Inserting / Updating respectively, and turn
> > them off immediately after the respective query. ( these options need to
> > be set per table).
>
> Related question: can we analyze where do we have to perform explicit
> inserts/updates touching identity columns?
> I hope we should not have them almost at all for kexi__* system tables. Of
> course in case of user tables wee need the hack you have mentioned.
>

   hmm, a quick search gave me one in Connection::storeObjectSchemaData(..)
  My copy of the file is not the same as the svn version, hence can't give the 
exact line number :(.
 Anyway, my tests failed because of one such query in tables_test.h :)

> My idea is that we could handle this at higher level, in a delayed - while
> building SQL statement that's then transferred to the backend. Note that as
> we have no parser for updates/inserts, 
     
   oh ok :) ( anyway it was more of a hackish idea , so good riddens :P )

>
> bool Connection::updateRow()
> bool Connection::insertRow()
>
> 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.
>
 
  yes, obviously a better idea :)

> 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.
>
> (I guess bool Connection::deleteRow() does not require this kind of
> approach?)
>

  Not yet !!! But I can never be sure what killer Sybase feature I'll find 
next !! :P ;) 
 
> Merry Christmas, Sharan and everyone!

Cheers!
 Sharan Rao





More information about the Kexi mailing list