PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: todd dot e dot rinaldo at jpmorgan dot com
Subject: RE: DBIx::Class and Sybase
Date: Apr 15 2008 11:33AM

Thanks Emmanuel,

This brings me to my current really annoying problem. How do I ammend a static schema in DBIx::Class so that DBIC knows the datatype is numeric/int and doesn't do something silly like put quotes around numbers?

The documentation in DBIC is prolific. But prolific is only more annoying when you can't find what you're looking for. 
;)

Thanks,
Todd

-----Original Message-----
From: owner-sybperl-l@peppler.org [mailto:owner-sybperl-l@peppler.org] On Behalf Of tuco@pasteur.fr
Sent: Monday, April 14, 2008 10:15 AM
To: Todd E Rinaldo
Cc: sybperl-l@peppler.org
Subject: Re: DBIx::Class and Sybase


todd.e.rinaldo@jpmorgan.com 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
-------------------------
Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase & Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.