From StephenJ at web.co.nz Mon Aug 19 20:59:08 2002 From: StephenJ at web.co.nz (Stephen Judd) Date: Thu Aug 5 00:24:13 2004 Subject: Wellington Perlmongers Message-ID: <5FA042F680739D44951B00FED8BE1A7D06208D@dasher.webdom1.web.co.nz> Don Jones wrote: > I was wondering if the Wellington Perlmongers group is still > active, the > content on the site looks a little bit dated. Are there > likely to be meetings > in the future? Erm - it has been in, ah, abeyance for some months, owing to lack of interest in meetings. However, the recent return of Grant McLean strikes me as an excellent opportunity to revive meetings. Takers, anyone? stephen From StephenJ at web.co.nz Wed Aug 21 20:37:51 2002 From: StephenJ at web.co.nz (Stephen Judd) Date: Thu Aug 5 00:24:13 2004 Subject: DBI stuff Message-ID: <5FA042F680739D44951B00FED8BE1A7D0620A8@dasher.webdom1.web.co.nz> > use DBI; > > my $dbh = > DBI->connect("DBI:mysql:database=db_name;host=hostname.co.nz", > $dbusername, > $dbpassword); > > how would I connect to a mSQL db and would i need any other modules? I think the one you're using for MySQL will work. MySQL is supposed to be compatible with mSQL at a binary level. If you're going to do more with DBI, invest in this: http://www.oreilly.com/catalog/perldbi/ Well worth it. Dymocks or Capital Books probably have a copy in stock. > or how about this one: > > I need to run 3 bits of sql on a mySQL db would this work? > > > my $SQL1 = ''; > my $SQL2 = ''; > my $SQL3 = ''; > my @queries = ($SQL1, $SQL2, $SQL3); > my $dbh = > DBI->connect("DBI:mysql:database=bd_name;host=hostname.co.nz", > $dbusername, > $dbpassword); > foreach my $query (@queries) { > my $sth = $dbh->prepare($query); > $sth->execute(); > $sth->finish(); > } > $dbh->disconnect(); Yes, that should work Just Fine. It's been a while, but I think you can reuse your statement handle too: my $sth; foreach my $query (@queries) { $sth = $dbh->prepare($query); $sth->execute(); } $sth->finish(); which might speed things up in a nested loop more than somewhat. Stephen