Re: confused about DBD implementation of ChopBlanks

Tim Bunce <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
On Mon, Jan 03, 2011 at 11:52:45AM +0000, Martin J. Evans wrote:
> Ok, as I suspected, this was sort of my fault. You can indeed do:
> 
> $h = DBI->Connect;
> $s = $h->prepare(q/select * from sometable/);
> $s->{ChopBlanks} = 1;
> 
> and it chops blanks but you cannot do:
> 
> selectall_arrayref(q/select * from sometable/, {ChopBlanks => 1});
> 
> or
> 
> prepare(q/select * from sometable/, {ChopBlanks => 1});
> 
> Don't know if you should be able to do this but it seems you cannot.

Generally "method attributes" and "handle attributes" are quite
distinct. The one place they're not is the connect() methods that create
a statement handle.

It's an unfortunate historical accident that methods returning statement
handles can't also take handle attributes in the way you describe.

> I think it would be nice especially in the selectall methods as you
> do not see the sth. I tried to locate the code to do this which I
> thought was somewhere under _new_handle (probably dbih_setup_handle)
> but there is magic in there I don't get right now.

If you're interested in tackling this (for which I'd be delighted) then
we should start by defining the semantics and considering any backwards
compatibility issues.

Tim.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.