Re: DBD::Oracle, Support binding of integers so they are returned as IVs
"H.Merijn Brand" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sat, 28 Nov 2009 00:43:48 +0000, Tim Bunce <[email protected]> wrote: > On Fri, Nov 27, 2009 at 06:03:29PM -0000, Greg Sabino Mullane wrote: > > > > > I'm mostly settled on DBIstcf_STRICT _not_ being the default. > > > So 'loosely typed' will be the default and people who want an error > > > if the type can't be cast safely will need to use StrictlyTyped => 1. > > > > > > I'm (slightly) open to persuasion, but that seems to fit the general > > > philosophy of perl and the DBI better. It also makes transition easier > > > for anyone who happens to have code that calls bind_column with an SQL type. > > > > I'd opine that since we're dealing with databases holding Important Things, > > the default should be to throw an error and make people flip a switch > > to get lax mode. > > Umm, if the database holds Important Things one could opine that perl > should trust the Important Things that are already in the database. > We can argue it either way. > > A compromise might be to default to strict (for SQL_INTEGER and > SQL_DOUBLE) but make SQL_NUMERIC immune from strict. > > > > o Although my primary impetus for doing this is I need it in DBD::Oracle > > > I would plan to do something similar in DBD::ODBC once this stuff is > > > committed. > > > > Does anyone know if there are other databases that have mapping issues with > > integers and Perlish integers other than Oracle? Just curious, as I only > > personally know how a handful deal with ints internally. > > DBD::SQLite returns only strings, along with most of the pure-perl > drivers, like DBD::CSV. The plan is still in my head to convert PV("1"\0) to IV(1) if the field type is numeric on fetch. Low priority though. Probably needs some work in DBD::File > Which makes me wonder if $sth->_set_fbav(\@row), which is used by most > pure-perl drivers to store each row, should call sql_type_cast() > automatically. > > Tim. -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00, 11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3. http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/