Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jk2addict (4946)

jk2addict
  (email not shown publicly)
http://today.icantfocus.com/blog/
AOL IM: chrislaco (Add Buddy, Send Message)
Yahoo! ID: chrislaco@sbcglobal.net (Add User, Send Message)
Jabber: laco@scribblewerks.com

Journal of jk2addict (4946)

Saturday April 07, 2007
08:36 PM

St. Murphy, Cars, Closets and SQLite 1.13

[ #32939 ]

It's been one hell of a week. Aside from all of the server issues at work, everything at home went to shit since yesterday.

Last night, the wife backed into the nephews car when pulling out of the garage. That's bumper #2. Sigh. Then, about 20 minute later, the cloths hanger rod in the closet totally crumbles into a heaping pile of bend metal and pulled out drywall screws.

After sleeping off the frustration, I made a trip to Lowes and installed a bigger better hanger rod.

Once I got back to a computer today, I spent some time trying to help perigrin figure out why Handel tests were failing. In the end, I've managed to find a new way for DBD::SQlite 1.13 to suck ass. It appears that any statement after a PK violation on insert also fails with the same error...from a different line in the C source:

C:\Development\CPAN\Handel>perl test.pl
3DBIx::Class::ResultSet::create(): Error executing 'INSERT INTO cart (id, shopper) VALUES (?, ?)': DBD::SQLite::st execute failed: column id
is not unique(1) at dbdimp.c line 402 at C:/Development/Perl/584/site/lib/DBIx/Class/Storage/DBI.pm line 879.

DBIx::Class::ResultSet::create(): Error executing 'INSERT INTO cart (id, shopper) VALUES (?, ?)': DBD::SQLite::st execute failed: column id
is not unique(21) at dbdimp.c line 376 at C:/Development/Perl/584/site/lib/DBIx/Class/Storage/DBI.pm line 879.

Here's the DBIC code...I still need to try this with pure DBI:

#!/usr/bin/perl -w
use strict;
use warnings;
use lib 'lib';
use Handel::Cart::Schema;

my $schema = Handel::Cart::Schema->connect('dbi:SQLite:t/var/handel.db');
print $schema->resultset('Carts')->search->count;

## This id already exists in the db
eval {
    $schema->resultset('Carts')->create({
        id => '11111111-1111-1111-1111-111111111111',
        shopper => '11111111-1111-1111-1111-111111111111',
    });
};
print $@;

## This is does not exist in the db
eval {
    $schema->resultset('Carts')->create({
        id => '23411111-1111-1111-1111-111111111111',
        shopper => '11111111-1111-1111-1111-111111111111',
    });
};
print $@;

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.