MySQL Forums
Forum List  »  Perl

Re: automatic creation of table
Posted by: Rick James
Date: August 18, 2010 09:40PM

Seems like a dumb thing to do, unless it is a TEMPORARY TABLE.

Are you using DBI? DWIW?

With DBIx::DWIW, it would be something like:

$db->Execute(qq{CREATE TABLE foo$date (...)});
die $@ if $@;

With DBI, it is similar, but more verbose. That is, execute() the CREATE the same way you would execute() an INSERT.

Some ways to get a string with the current time:
my $date = scalar(localtime); # not good because of the spaces, etc
my $date = time(); # just a long number

Another choice for a reasonably unique string:
my $date = $$;
$$ is the operating system's process id (5-digit number?) of the script you are running.

Search Cpan for other Date:: packages that might do what you want.

Options: ReplyQuote


Subject
Written By
Posted
August 17, 2010 01:14PM
Re: automatic creation of table
August 18, 2010 09:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.