[storm] queries made to look for something storm already has

Gabriel Rossetti gabriel.rossetti at arimaz.com
Wed Aug 6 12:25:39 BST 2008


James Henstridge wrote:
> On Wed, Jul 30, 2008 at 7:02 PM, James Henstridge <james at jamesh.id.au> wrote:
>   
>> On Mon, Jul 28, 2008 at 4:17 PM, Gabriel Rossetti
>> <gabriel.rossetti at arimaz.com> wrote:
>>     
>>> Hello everyone,
>>>
>>> I turned on the debugging and I'm seeing queries like these :
>>>
>>> INSERT INTO `language` (name) VALUES (%s) (u'ENGLISH',)
>>> SELECT `language`.language_id FROM `language` WHERE
>>> `language`.language_id = 1 ()
>>> INSERT INTO `language` (name) VALUES (%s) (u'FRENCH',)
>>> SELECT `language`.language_id FROM `language` WHERE
>>> `language`.language_id = 2 ()
>>>
>>> Why is a query made for `language`.language_id if we already have it
>>> (it's used in the WHERE statement)?
>>>       
>> This looks like a bug in the mysql backend.  The use of
>> cursor.lastrowid could probably be used to fill in the primary
>> variables in MySQLConnection.execute(), similar to what we do in the
>> PostgreSQL backend.
>>
>> Filling them in at that point should be just as reliable as using them
>> to construct the where clause in get_insert_identity().
>>     
>
> I've uploaded a branch here that should help with this problem:
>
> https://code.launchpad.net/~jamesh/storm/mysql-insert-id
>
> Could you try it out to see if it helps for you?  I believe I've got
> the correct semantics for handling the insert identity.
>
> James.
>   
Thanks James, I tried it and so far it seams fine, I'll use your branch 
for my development so I an test it more thoroughly.

Gabriel



More information about the storm mailing list