Class::DBI::mysql create_table BUG ?

[prev] [thread] [next] [Date index for 2005/01/19]

From: Daniel Wijnands
Subject: Class::DBI::mysql create_table BUG ?
Date: 20:00 on 19 Jan 2005
Hi, 

I'm trying to create my tables automatic if they don't exist, see
following package : 

2 package Database::Group;
      3 use base 'Database::DBI';
      4 use strict;
      5
      6 __PACKAGE__->create_table(q{
      7   grpId INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
      8   grpName CHAR(30) NULL,
      9   grpDescription TEXT NULL,
     10   PRIMARY KEY(grpId)
     11      });
     12
     13 __PACKAGE__->set_up_table('group_2');
     14
__PACKAGE__->has_many(modulemoderules=>['Database::ModuleModeRule'=>'grpId']);
     15
     16


Running this code gives the following error : 

aniel@dell:/usr/data/www/cms.ios/HTML/Core$ perl -e 'use
Database::Group';
DBD::mysql::st execute failed: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near 'group (
  grpId INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  grpName CHAR(30)' at line 1 [for Statement "CREATE TABLE IF NOT EXISTS
group (
  grpId INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  grpName CHAR(30) NULL,
  grpDescription TEXT NULL,
  PRIMARY KEY(grpId)
     )"] at /usr/local/lib/perl5/site_perl/5.8.5/DBIx/ContextualFetch.pm
line 51.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
daniel@dell:/usr/data/www/cms.ios/HTML/Core$


create table uses the following syntax : 

 __PACKAGE__->set_sql(
    146 | create_table => 'CREATE TABLE IF NOT EXISTS __TABLE__ (%s)');

But the tablename = group_2 and nog group, so the conversion from
__TABLE__ is in error 


Is this a bug of de code or a bug of mine :) 

Kind regards daniel

Class::DBI::mysql create_table BUG ?
Daniel Wijnands 20:00 on 19 Jan 2005

Re: Class::DBI::mysql create_table BUG ?
Sean Davis 20:12 on 19 Jan 2005

Re: Class::DBI::mysql create_table BUG ?
Daniel Wijnands 21:02 on 19 Jan 2005

Re: Class::DBI::mysql create_table BUG ?
Kingsley Kerce 21:09 on 19 Jan 2005

Re: Class::DBI::mysql create_table BUG ?
Daniel Wijnands 21:45 on 19 Jan 2005

Generated at 17:42 on 27 Jan 2005 by mariachi v0.52