[Dbix-class] Is populate borked in -current?

Christopher H. Laco claco at chrislaco.com
Thu Sep 28 18:48:34 CEST 2006


Some evil is afoot. The problem appears to be that the new bulk insert
(or SQLite) does not honor the columns specified in populate.

Taking from populate.t:

This:

> $schema->populate('Artist', [
> [ qw/artistid name/ ],
> [ 4, "b" ],
> [ 5, "c" ],
> [ 6, "d" ],
> [ 7, "e" ],


and this:

> $schema->populate('Artist', [
> [ qw/name artistid/ ],
> [ 4, "b" ],
> [ 5, "c" ],
> [ 6, "d" ],
> [ 7, "e" ],



both yield the same thing in the database:

artistid, name
4, b
5, c
6, d
7, e

Or to put it another way, the names and order of columns/data given to
populate are totally ignored, and the data inserted is assumed to be in
the order in which the fields appear in the database itself.

Depending on whether you create the database from a sql schema, or from
the DBIC Source classes using deploy, this could be a problem.

Another symptom that has cropped up is this type of thing:

> $schema->populate('Artist', [
> [ qw/artistid/ ],
> [ 4 ],
> [ 5 ],
> [ 6 ],
> [ 7 ],
> :db prepare_cached failed: table artist has 2 columns but 1 values were supplied(1) at dbdimp.c line 269 at lib/DBIx/Cl
> ss/Storage/DBI.pm line 960.

If a table have 10 fields, but I only need to add 5 of them to fulfill
any NOT NULL or FK requirements, I can't.

-=Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060928/6b76d955/attachment.pgp 


More information about the Dbix-class mailing list