Hello!
Maybe I did not search everywhere or not in the right place (but I looked
and tried very long) to get a solution to the following problem. And I also
have to admit that I am a total beginner with perl-dbi.
do ("CREATE TABLE ... ) does not work for more than about 2500 columns:
"DBD::mysql:: db do failed: Too many columns at program.pl ..."
Of course I could do the create table-assignment by a call of
"system(mysql -e etc.)" but another problem is that some of my data
contains quotes and other critical characters, which I thought to handle by
dbi->quote.
I attach a reduced and simplified version of the program and am grateful for
any hints and advice,
Petra Steiner
use DBI;
use DBD::mysql;
my($i,
$table_name,
$DB,
$dbh,
@fields,
);
$DB = "petra";
$dbh = DBI->connect("dbi:mysql:$DB", "root", "");
if (!$dbh) {print "$DBI::errstr ";}
@fields = ();
for ($i = 1; $i <= 4000; $i++)
{
push @fields, "n$i"; }# spaltennamen ; colnames
print "@fields ";
$table_name = "tabelle";
$dbh -> do("DROP TABLE if EXISTS $table_name");
$dbh -> do("CREATE TABLE $table_name (" .
join (", ", map {"$_ TINYTEXT"} @fields) . "
)");
$dbh -> disconnect;
exit(0);
-
---------------------------------------------------
Petra Steiner
Arbeitsbereich Linguistik
Universitaet Muenster
Huefferstrasse 27
48149 Muenster
Tel: 0251 / 83 39442
[EMAIL PROTECTED]