[Nitro] [PATCH] og-psql-refactoring

Reid Thompson reid.thompson at ateb.com
Sun Apr 9 12:36:11 EDT 2006


Bryan Soto wrote:
> The attached bundle contains one patch that has some rather drastic
> changes to the postgres sql store. It passes the test suite except for
> one failure addressed in a different email. Could someone that has an
> existing app in postgres _please_ test this? I don't have a Postgres
> app, so I can verify that it's backwards compatible. I can check
> against Mysql and Sqlite, but not Postgres.
>
> I'd really appreciate if someone could give this a try. I'd rather
> throw away the last patch if it isn't backward compatible.
>
> Thanks for your help.
>
> Bryan
>
> ~~~~~
> Patch modifies the way Postgres accesses join table info to match other stores.
> ~
> Makes PsqlStore#eval_og_allocate use the same logic as
> SqlStore#eval_og_allocate when determining if a class is STI.
> ~
> Modifies the query used for Tag selection. Uses subqueries. Passes
> tests on Mysql, Postgres and Sqlite.
> ~
> In PGResult, makes next and each row match the interface used by the
> other stores so that SqlStore works properly when calling these
> methods for PsqlStore.
>
> Removes read_prop, eval_og_insert, eval_og_allocate and read_row
> methods from psql.rb in favor of the methods defined in the superclass
> SqlStore.
>
> Postgres doesn't appear to support autoincrement, so added a new
> method to SqlStore, generate_key. Postgres uses this to generate the
> oid value to be inserted. SqlStore defines this method as returning
> NULL which allows the other stores to autoincrement. This can possibly
> be extended to allow custom key generation for all the stores.
>
> --
> "Never tell people how to do things. Tell them what to do and they
> will surprise you with their ingenuity." —General George S. Patton
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
Perhaps i'm misunderstanding this comment
' Postgres doesn't appear to support autoincrement, so added a new 
method to SqlStore, generate_key.'

But if by autoincrement you mean a db generated sequence, then Postgres does support this.

http://www.postgresql.org/docs/8.1/static/datatype.html#DATATYPE-SERIAL

Am I misunderstanding...





More information about the Nitro-general mailing list