Re: DBIx::Class and Sybase
"Jason L. Froebe" <[email protected]> Mon, 14 Apr 2008 09:06:50 -0700 (PDT)
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase |
|---|---|
| Message-ID | <[email protected]> |
Hi Emmanuel, Have you been using DBIx::Class::Schema::Loader atall or are you creating the schemas by hand? I ask because I've beenrunning into problems with DBIx::Class::Schema::Loader and ASE 15. Specifically with SQL UDFs and stored procedures. Jason L. Froebe WebBlog http://jfroebe.livejournal.com Tech log http://www.froebe.net/blog Froebe Fibers http://www.froebe-fibers.com The opinions expressed within are the sole rantings of a raving lunatic and in no way reflect the rantings, fits, tantrums, errors, corrections, allocutions, or aimless thoughts of Sybase or its employees or of TeamSybase or ISUG. Any resemblence to reasonable thought, or any official or published opinion of Sybase, TeamSybase or ISUG is merely coincidental, and should be totally ignored. ----- Original Message ---- From: Emmanuel Quevillon <[email protected]> To: [email protected] Cc: [email protected] Sent: Monday, April 14, 2008 10:14:32 AM Subject: Re: DBIx::Class and Sybase [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 -------------------------