Re: DBIx::Class and Sybase
Emmanuel Quevillon <[email protected]> Mon, 14 Apr 2008 17:14:32 +0200
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase |
|---|---|
| Organization | Institut Pasteur |
| Message-ID | <[email protected]> |
[email protected] wrote: > Grettings. > > Ok, so nobody laugh. Has anyone actually successfully implemented a > DBIx::Class in Sybase? Would anyone be up for sharing an example or > pointing me in the direction? > > Thanks, > Todd Rinaldo Hi Todd, Yes, I am actually working a lot with Sybase and DBIx::Class. As a good point you can have a look at the Manual on CPAN for DBIx::Class. There are a lot of good examples. A problem I am facing very often is the support of columns type. It looks like DBD::Sybase does not do the difference between VARCHAR, INT, etc.. thus it lead often to error from sybase about it when querying or inserting data into database. What I meant is that using DBIx::Class as showed in example does not always work as expected like in the example. It looks like DBIx::Class always quote values in SQL query. So I don't really know if it is because of DBD::Sybase or DBIx::Class itself. So be carefull with that. So here is an example of a connection and query to Sybase with DBIx::Class my $schema = MyDB->connect("dbi:Sybase:database=$dbname;server=$server", $dbuser, $password, { AutoCommit => 1 }); my $dbh = $schema->storage()->dbh(); my $orgset = $schema->resultset('MyDB::Organism')->search({id => $id}); while(my $o = $orgset->next()){ print "ID=",$o->id(),"\n"; print "Name=",$o->name(),"\n"; ... } Each column as its own method with DBIx::Class which is very useful. Hope this little help will help to start. Regards Emmanuel -- ------------------------- Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr -------------------------