Database creation

Dave Wilson davemw at yahoo.com
Sat Mar 30 09:55:41 CST 2002


Lying half-unconcious, Russell giggled: 
> On Sat, Mar 30, 2002 at 01:30:45PM +0000, Stray Toaster wrote:
> > On Sat, Mar 30, 2002 at 01:17:43PM +0000, Russell Matbouli wrote:
> > > According to the DBI FAQ, it isn't possible to create a database using
>                                                    ^^^^^^^^^^^^^^^^^
> > > push a CREATE statement into a call to the 'mysql' binary?
>            ^^^^^^^^^^^^^^^^
> 
> I think I said the wrong thing here. I mean to create a database. Can
> you do this in SQL? I've only ever done it with mysqladmin before. At
> least, as far as I can remember that's what I used...
> 

How do you think mysqladmin does it? ;)...


CREATE DATABASE installer_db;
CREATE DATABASE IF NOT EXISTS installer_db;
GRANT ...
etc.

> > my $query = qq{ CREATE blah etc etc };
> > 
> > $dbh->execute($query)
>   ^^^^
> 
> How do you get a database handle on a database that doesn't yet exist
> though?
> 
> > gazooks, when was the last time I had a query in a script? Or a query in
> > a module come to that? Long life Class::DBI!
> 
> Is there a Class::DBI way to do it? That's what I'm using :)
> -- 
> Russell Matbouli       |
> russell at futureless.org |               What if it does not work?
> PGP KeyID: 0x3CA84CF4  |


--
"The Empire Strikes Back" Sexually Tilted Lines #10:
 10. I thought that hairy beast would be the end of me!



More information about the Belfast-pm mailing list