perl with mysql which takes a file as a input that contains the info to create the tables



hi all

i am creating a perl script which takes the input from the file to
create tables, inserting values into the database. As you all know the
only procedure for taking input from a file (using perl script) into
MySQL database is through (?) place holders.
for example ,

$sth=$dbh->prepare
("INSERT INTO checkin (firstname, lastname, destination)
VALUES
(? , ? , ? )");

$rows=0;
open FILE, "passlist.txt" or die $!;
while (<FILE>) {
chomp;
($firstname, $lastname, $destination) = split(/:/);
$sth->execute($firstname, $lastname, $destination)
|| die "Couldn't insert record : $DBI::errstr";

$rows+=$sth->rows();
}

Where the passlist.txt hav the data in the format

Tim:Briggs:Glasgow
Simon:Cozens:Japan
Richard:Collins:Japan
Daniel:Maharry:Glasgow
Emma:Batch:Thailand

Now it is perfect that v can take input from a file...

P.S. : But i wanted to take INPUT that contains the info to create the
tables
Where
CREATE TABLE checkin (
id INTEGER AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(32) NOT NULL,
lastname VARCHAR(32) NOT NULL,
checkedin INTEGER,
numberofbags INTEGER,
destination VARCHAR(32) NOT NULL)

NOW I WANTED TO KNOW THE PROCEDURE FOR TAKING THE CODE AS INPUT FROM A
TEXT FILE & CREATE THE SPECIFIED TABLE

awaiting ur reply

Regards
prady

.



Relevant Pages

  • Re: perl with mysql which takes a file as a input that contains the info to create the tables
    ... inserting values into the database. ... the only procedure for taking input from a file (using perl script) ... what happens if I claim my destination is ...
    (perl.beginners)
  • Re: Error 3011
    ... Is the Destination database the same version as the source. ... That might make it more palatable to the ObjectType ... For Each frm in CurrentProject..AllForms ...
    (microsoft.public.access.modulesdaovba)
  • Re: Setting up destination database using dynamic properties task/global variable
    ... Normally I need to change the database but the table name stays the same, so I just manually remove the database qualifier from the object name through Disconnected Edit, and that way I only need to manage the ... destination database server, database name, user id and password. ... added a dynamic properties task and have assigned the global variables ... Say I have created the package with destintaion as Northwind1 and I have ...
    (microsoft.public.sqlserver.dts)
  • Re: moving oracle database 9 from another computer to another one
    ... Installing Oracle 9.2.0.4 on the destination machine ... Creating a controlfile script by issuing the 'alter database backup ...
    (comp.databases.oracle.server)
  • Re: Mail-merging with Word, MySQL... and Perl?
    ... Alt+F9 to toggle off their display. ... connection to my MySQL database on my Linux box. ... Or if a couple has its anniversary listed, I'll want to format ... the Perl script directly (which would be written to generate that data in ...
    (microsoft.public.word.mailmerge.fields)