[Nitro] OG connect and exec_statement: unexpected behaviors (Critical -> Trivial)

Mark Van De Vyver mvyver at gmail.com
Mon Sep 3 04:24:45 EDT 2007


> **SHOW STOPPER**
...

Ignore that - my stale Ruby at fault of this one.

....

> **trivial**
> 3) Og#connect seems to make two selects from a table that has just
> been created.  I haven't dug in to see why, but thought I give a
> 'heads-up' in case they shouldn't be there.  The queries I refer to
> are issued from within OG#connect, the attached files should print
> out:
>
>  INFO: Og uses the Mysql store.
> DEBUG: Og manageable classes: [Member]
> DEBUG: CREATE TABLE `ogmember` (`first_name` text, `last_name` text,
> `address1` text, `city` text, `state` text, `email` text, `oid`
> integer AUTO_INCREMENT PRIMARY KEY)
> DEBUG: SELECT * FROM `ogmember` LIMIT 1
> DEBUG: SELECT * FROM `ogmember` LIMIT 1

This I've tracked down to:
[./og/lib/sql.rb]
Line 290
Line 291

In line sql.rb:290 SQLEnchantMixin#og_create_scheme is called, which
in turn calls SQLStore#create_field_map.

In line sql.rb:290 SQLStore#create_field_map is called again.

Hence the duplicated queries to the database whenever a table is created.

I'm not sure how to fix this, but hope this helps someone.
I'm happy to help test if needed.

Mark

> Using the Sqlite adapter I see something slightly different, but still
> the duplicate `'SELECT':
>
>  INFO: Og uses the Sqlite store.
> DEBUG: Og manageable classes: [Member]
> DEBUG: CREATE TABLE ogmember (first_name text, last_name text,
> address1 text, city text, state text, email text, oid integer PRIMARY
> KEY)
>  INFO: Created table ogmember.
> DEBUG: SELECT * FROM ogmember LIMIT 1
> DEBUG: SELECT * FROM ogmember LIMIT 1
>
>
> HTH
> Mark
>
>


More information about the Nitro-general mailing list