On 10/24/07 11:03 AM, Peter Karman wrote:
> The RDBO docs claim that:
> 
>     CREATE TABLE mytable
>     (
>       id   INTEGER PRIMARY KEY AUTOINCREMENT,
>       ...
>     );
> 
> is the supported syntax for auto-detecting a serial column in SQLite. The test
> case below fails to prove this out however.
> 
> I'd love to know if the test is wrong, or something is amiss with
> Rose::DBx::TestDB, or the sqlite version, or if this really is a bug. Or...

As t/db-object-loader.t and other similar tests demonstrate, objects of the
resulting class will behave as you'd expect, giving you the auto-incremented
id after you save.  For example:

$o = MyRDBO->new(name => 'abc')->save;
print $o->id; # prints 1 or whatever the next auto-incremented id was

What it doesn't do, as you noticed, is set the column type to "serial".
Instead, it uses "integer."  Technically, this is a more accurate reflection
of the SQLite data type.  Functionally, it does not prevent the column from
working as expected.

I can see how the documentation might lead you to believe that the Loader
would create a column of type "serial" when presented with the db definition
above.  (What it actually says is the opposite: make a column of type serial
in your class manually.)

Anyway, I can't decide if this is a bug or not.  You tell me :)  What's more
appropriate for the loader to produce for an "integer auto-increment" db
column definition?  An "integer" column that behaves auto-increment-y (the
current behavior) or a "serial" column that also behaves that way?

-John



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to