tonyday has asked for the wisdom of the Perl Monks concerning the following question:
...and it's gotten very messy. I am playing around with putting all the sql statements in a text file and parsing them in to a hash. After parsing and some double interpolation of $things like $table in the above example I can just say...(my $sql = <<SQLCREATE) =~ s/^\s+//gm; CREATE TABLE $table (id INTEGER NOT NULL AUTO_INCREMENT, name CHAR(40) NOT NULL, address CHAR(40) PRIMARY KEY (id) ) SQLCREATE $sql =~ s/\s+$//gm;
and my code is more manageable.$sth = $dbh->dosql($sqls{CreateNameTable});
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to manage sql statements
by VSarkiss (Monsignor) on Jul 13, 2001 at 07:10 UTC | |
|
Re: How to manage sql statements
by adamsj (Chaplain) on Jul 13, 2001 at 07:35 UTC | |
by tonyday (Scribe) on Jul 13, 2001 at 10:16 UTC | |
|
Re: How to manage sql statements
by Masem (Monsignor) on Jul 13, 2001 at 15:03 UTC | |
|
Re: How to manage sql statements
by AidanLee (Chaplain) on Jul 13, 2001 at 08:29 UTC | |
|
Re: How to manage sql statements
by agoth (Chaplain) on Jul 13, 2001 at 15:15 UTC |