[rt-devel] let DBI handle it

Jesse jesse at fsck.com
Wed Apr 12 21:02:26 EDT 2000

On Wed, Apr 12, 2000 at 06:02:02PM -0600, Aryeh Cody Sherr wrote:
> Another really great solution that also markably improves efficiency is to
> use bind parameters. You don't need to quote things at all:
Well, you'll want to look  at the DBIx::EasySearch and DBIx::Record and DBIx::Handle as RT uses them for _all_ it's DB interaction. they're cvs module DBIx
in fsck.com's CVS. The way I'm dynamically generating queries in EasySearch may make this hard. though it should be easy to do in Record.
> my $sql = "SELECT foo FROM table WHERE col=?"; #? is a placeholder
> my $sth = $dbh->prepare($sql);
> $sth->bind_param( 1, $col_data"); #col_data can contain anything
> $sth->execute;
> Oracle supports bind parameters with ":names" instead of ?, but it is not
> portable. ODBC also uses ?s.
> Another easy fix for cross database portability is $DBI::err and
> $DBI::errstr. $DBI::err will get set if there is an error, $DBI::errstr
> will contain the error. You don't have to use $Mysql::db_errstr.
> just my .02 upon looking at some of the code too.
> $::cody
> On Wed, 12 Apr 2000, Dylan Vanderhoof wrote:
> >Hello All,
> >	I just started to take a look at the new rt files, and have some
> >interesting issues that will need to be dealt with if we're going to port to
> >Oracle/DB2/other enterprise DBs.  Looking at the schema.mysql file, it looks
> >like we shouldn't have a problem making a similar file for the other DBs.
> >MY question is, how abstract is the RT DBI code itself?  I was looking at
> >the files in lib/rt/database, and while it's close to being able to work
> >with these DBs, there is one real important thing missing off the bat.
> >Schema.
> >	MySQL doesn't require the schema to be in there (As a matter of
> >fact, I think it all falles under a 'mysql.' schema) but the larger DBs do.
> >Is that something that there is a planned workaround for, or will we need to
> >re-write the lib files as well?
> >	The only other thing I can see, and I don't know how Oracle handles
> >this, is that DB2 will puke if you attempt to call a CHAR or VARCHAR column
> >without enclosing the values in 's.  Likewise, INT and similar numeric
> >columns will puke if you DO enclose them with anything.  If I recall
> >correctly, MySQL has no such restraints.  
> >	I'll keep searching through it and see what else I can see.
> >
> >Cheers,
> >Dylan C. Vanderhoof
> >Internal Software Developer
> >Semaphore Corporation
> >
> >
> >_______________________________________________
> >Rt-devel mailing list
> >Rt-devel at lists.fsck.com
> >http://lists.fsck.com/mailman/listinfo/rt-devel
> >
> _______________________________________________
> Rt-devel mailing list
> Rt-devel at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-devel

jesse reed vincent -- jrvincent at wesleyan.edu -- jesse at fsck.com 
pgp keyprint:  50 41 9C 03 D0 BC BC C8 2C B9 77 26 6F E1 EB 91
There are no supercomputer applications that are solvable that cannot be solved
in finite time using a fucking TRS-80 with approprite disk/tape drives.  Zero.

More information about the Rt-devel mailing list