On Sun, 02 Jan 2011 18:07:13 +0000, "Martin J. Evans"
<martin.ev...@easysoft.com> wrote:

> Sorry if this turns out to be gibberish but I'm been battling with a 
> host of unicode problems today and I am quickly losing track.
> 
> I can't make ChopBlanks work properly in DBD::ODBC. It works if I use:
> 
> $dbh->{ChopBlanks} = 1;
> $sth = $dbh->prepare(q/select * from sometable/);
> 
> and does not work if I use:
> 
> $sth = $dbh->prepare(q/select * from sometable/);
> $sth->{ChopBlanks} = 1;

The above completely meets my expectation. Once the sth is created, and
all attributes are set (either directly or derived/inherited from dbh),
they should *not* change when dbh changes it on a higher level.

> and it seems "ChopBlanks = DBIc_has(imp_sth, DBIcf_ChopBlanks);" is not 
> true in DBD::ODBC's dbdimp.c.
> 
> Various DBD's use DBIc_has (DBD::ODBC, DBD::Pg, DBD::Oracle) or DBIc_is 
> (DBD::mysql).

DBD::Unify uses DBIc_has ()
DBD::CSV (through DBD::File) use s DBIc_is ()

In fact they are the same:

DBIXS.h:#define DBIc_has(imp,flag) DBIc_is(imp, flag) /* alias for DBIc_is */

> The DBI::DBD documentation says (for XS):
> 
> "Note that you can also obtain standard attributes such as /AutoCommit/ 
> and /ChopBlanks/ from the attributes parameter, using 
> |DBD_ATTRIB_GET_IV| for integer attributes."
> 
> and
> 
> "The dbd_db_STORE_attrib method
> You do not handle all attributes; on the contrary, you should not handle 
> DBI attributes here: leave this to DBI. (There are two exceptions, 
> /AutoCommit/ and /ChopBlanks/, which you should care about.)"
> 
> I presumed a DBD should "care" about ChopBlanks as DBI is not going to 
> remove the trailing blanks not that DBI is not going to store the 
> ChopBlanks value and yet when I call DBIc_has(imp_sth, DBIcf_ChopBlanks) 
> on a sth it returns false even though I set $sth->{ChopBlanks} = 1.

Before or after the sth was created?

> DBD::ODBC (like all the other DBDs I've checked) does not handle 
> ChopBlanks in the STORE or FETCH routines.
> 
> Any ideas what is wrong?

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.3 and 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/

Reply via email to