Re: [CDBI] Sequence failure using Class::DBI::Sweet

"Edward J. Sabol" <sabol-2oVx0MVsMgiP/[email protected]> Tue, 4 Dec 2007 13:28:28 -0500
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
Victor Churchill wrote:
> I have an Oracle table 'readings' which has a PK generated with a
> sequence and a mandatory 'insert_date' timestamp. My program can
> insert rows into the table when it uses Class::DBI::Oracle but fails
> when it uses Class::DBI::Sweet.
>
> The Oracle error is 'ORA-00923: FROM keyword not found where
> expected'. I put on a TraceLevel=>3 and at the time of insertion
> where Class::DBI::Oracle shows
> prepare_cached for DBD::Oracle::db
> (DBIx::ContextualFetch::db=HASH(0x......)~0x......'SELECT
> rea_seq.NEXTVAL from DUAL
>
> the corresponding trace for Class::DBI::Sweet is
> prepare_cached for DBD::Oracle::db
> (DBIx::ContextualFetch::db=HASH(0x......)~0x......SELECT NEXTVAL
> ('rea_seq') [... yes that's all ...]

I've never used Class::DBI::Sweet and I'm not an Oracle person, but I suspect
you just need to add the following (which I gleaned from perusing the
Class::DBI::Oracle source code) to your QG::QGDB base class:

__PACKAGE__->set_sql('Nextval', <<'');
SELECT %s.NEXTVAL from DUAL

Hope this helps,
Ed