[CDBI] Can't insert a null record?

Eduardo Grosclaude eduardo.grosclaude at gmail.com
Fri Jul 28 19:03:11 BST 2006

Dear Gentlemen,

I am using CDBI from CGI::Application callback routines. My table "Dictado"
has been created with:
        CREATE TABLE dictado (
            mid integer,

Upon returning from edition/insertion page, I want to have the following

    if(defined $q->param('submit')) {
        my $d;
        if($q->param('did') == 0) {
            $d = Ctl::Dictado->create({});
        } else {
            $d = Ctl::Dictado->find_or_create(did => $q->param('did'));
        foreach my $f (qw/... names of fields ... /) {

As you can see, when did==0, I want to create a blank object and then
populate fields with values coming from $q query object. There may be other
ways to do the trick, but this particular one USED TO WORK. However, now I

Error executing run mode 'dic': Can't insert new Ctl::Dictado:
DBD::SQLite::db prepare_cached failed: near ")": syntax error(1) at
dbdimp.cline 269 [for Statement "INSERT INTO dictado ()
"] at /usr/lib/perl5/site_perl/5.8.6/Ima/DBI.pm line 381.
 at /var/www/html/linux/admin/admin.pl line 256
 at /usr/lib/perl5/site_perl/5.8.6/CGI/Application.pm line 160
    CGI::Application::run('Admin=HASH(0x9650de8)') called at
/var/www/html/linux/admin/admin.pl line 517

I understand CDBI has undergone some change as I can no longer find any
reference to the create() function in the docs. However, insert() does
exist, which I had not known of before.

I have tried insert(), insert({}), find_or_create(did => 0), but every time
some kind of error creeps up. Can I have any way to insert a null record so
as to keep the logic presented above? Or, is the above logic hopelessly

Thank you in advance


       Tue May 16 17:35:17 2006: "Module" DBD::SQLite
       ·   "installed into: /usr/lib/perl5/site_perl/5.8.6"
       ·   "LINKTYPE: dynamic"
       ·   "VERSION: 1.12"
       ·   "EXE_FILES: "
       Tue May 16 17:48:31 2006: "Module" Class::DBI
       ·   "installed into: /usr/lib/perl5/site_perl/5.8.6"
       ·   "LINKTYPE: dynamic"
       ·   "VERSION: v3.0.14"
       ·   "EXE_FILES: "

Eduardo Grosclaude
Universidad Nacional del Comahue
Neuquen, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digitalcraftsmen.net/pipermail/classdbi/attachments/20060728/249a08cf/attachment.html

More information about the ClassDBI mailing list