Nik has asked for the wisdom of the Perl Monks concerning the following question:
If the database alrady exists no problem but if it want to be creates at the time then the first db gives an error when i run make.pl and i must then manually create it through mysql statemets in console.This is some per of my make.pl Its supposed to create first time the database nikos_db or if its already there to just delete it and recreate it. $db = ($ENV{'SERVER_NAME'} ne 'nikolas.50free.net') ? DBI->connect('DBI:mysql:nikos_db', 'root', '') : DBI->connect('DBI:mysql:nikos_db:50free.net', 'nikos_db', '**** +*') or print font({-size=>5, -color=>'Lime'}, $DBI::errstr) and exit +0; $db->do( "drop database if exists nikos_db" ); $db->do( "create database nikos_db" ); $db->do( "use nikos_db" );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating a non-existing database through Perl
by gam3 (Curate) on Apr 15, 2005 at 18:13 UTC | |
| |
|
Re: Creating a non-existing database through Perl
by dragonchild (Archbishop) on Apr 15, 2005 at 18:10 UTC | |
|