[storm] Fwd: need help with result.get_insert_identity(), please.

Vernon Cole vernondcole at gmail.com
Fri Oct 10 15:57:11 BST 2008


Dear storm gurus:
   I am trying to write a database front end for adodbapi on windows
platforms to access Microsoft SQL server tables. So far the effort has gone
surprisingly well. I am starting out by trying to make the tutorial run, but
I have hit a sticking point.
  When storm flushes 'joe' for the first time, store.py calls
result.get_insert_identity() to obtain a "where" clause to find the id value
assigned by the database engine.  I cannot figure out how I might be able to
structure such a "where" statement. (perhaps a weird embedded SELECT of some
type?)

  SQL server will return the value I need as the result of the SQL function
"SCOPE_IDENTITY()". So in T-SQL I would write something like:

> INSERT INTO person (name) VALUES ('Joe Jones')

SELECT SCOPE_IDENTITY()
>
and the result of the select will by my ID value.

So is there a way to mangle a WHERE statement to get what I want? Or is the
correct answer to change the code in store.py in the area of:

> where = result.get_insert_identity(cls_info.primary_key,primary_vars)
> result = self._connection.execute(Select(missing_columns, where))
>
?
  I await your wisdom.
--
Vernon Cole
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/storm/attachments/20081010/67c07da7/attachment.htm 


More information about the storm mailing list