Greetings!
The following big command should be excuted:
Code:
CREATE TABLE inode( found_at DOUBLE, extent_offs DOUBLE, di_inostamp DOUBLE, di_fileset DOUBLE, di_otimetv_sec DOUBLE, di_number DOUBLE, di_gen DOUBLE, di_ixpxdlen DOUBLE, di_ixpxdaddr1 DOUBLE, di_ixpxdaddr2 DOUBLE, di_ixpxdaddress DOUBLE, di_size DOUBLE, di_nblocks DOUBLE, di_nlink DOUBLE, di_uid DOUBLE, di_gid DOUBLE, di_mode DOUBLE, di_atimetv_sec DOUBLE, di_ctimetv_sec DOUBLE, di_next_index DOUBLE, di_mtimetv_sec DOUBLE )
I could only get a new table, if I choped it to the first three fields or by typing it as string directly in the prepare command like this:
Code:
$sth = $dbh->prepare("CREATE TABLE inode( found_at DOUBLE, extent_offs DOUBLE, di_inostamp DOUBLE, di_fileset DOUBLE, di_otimetv_sec [...] )");
$sth->execute; #this worked but is not what i need
$sth->finish;
But the hole point in using Perl here, is to be able to create various tables at runtime. To accomplish that, the string $tabdef needs to be autogenerated and should then be used as follows:
Code:
for ($j=0; $j<=3; $j++) { #larger then 3 and it fails
$tabdef = $tabdef." $column[$j] DOUBLE,";
}
$tabdef =~ s/,$//;
$tabdef =~ s/\.//g; #no dots!
$tabdef = "CREATE TABLE inode(".$tabdef." )";
$dbh->do("DROP TABLE inode");
$sth = $dbh->prepare($tabdef) or die "Can't prepare $tabdef: $dbh->errstrn";
$sth->execute or die "Can't execute: $dbh->errstrn";
$sth->finish;
And this wont work. I have no idea why. The syntax is correct, bcoz when using it with only 3 fields its ok, otherwise I get the error message:
Code:
Can't execute: DBI::db=HASH(0x82bb848)->errstrn at ./tabulator.pl line 89.
Im new to dbi and quite new to perl. Please point me to my error
squark