Yep - seems that with ora_ph_type => 5, you MUST null terminate every
string, eg (with ora_ph_type => 5) changing the inserts in my original
example to:

$sth->execute('1',"a\0");
$sth->execute("3\0"," \0");

produced:

undef, 'a'
'3', ' '

so the first string which was not null terminated ended up as a null, but
all the others were ok.  With ora_ph_type => 96, it seems to work the same
as ora_ph_type => 5, but without the need to null terminate.  

On reflection, I guess this is what the documentation was saying,

Thanks to all

-----Original Message-----
From: Sterin, Ilya [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 10:38 AM
To: ''Fox, Michael ' '; [EMAIL PROTECTED]
Subject: RE: Oracle behaviour when inserting strings containing only
blanks


Guess you gotta use ' \0' if you use ora_ph_type => 5

Try it, let us know.

Ilya Sterin

-----Original Message-----
From: Michael A. Chase [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 01, 2001 12:06 PM
To: Sterin, Ilya; ''Fox, Michael ' '; [EMAIL PROTECTED]
Subject: Re: Oracle behaviour when inserting strings containing only
blanks


Either 5 or 96 should do the trick.  I tend to prefer to not limit myself to
not having \0 in a string though I haven't seen a case when it was useful.

5 was the default behavior in older DBD::Oracles (pre 1.00 I or so); 1 is
the current default.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
----- Original Message -----
From: "Sterin, Ilya" <[EMAIL PROTECTED]>
To: "'Michael A. Chase '" <[EMAIL PROTECTED]>; "''Fox, Michael ' '"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, May 01, 2001 8:16 AM
Subject: RE: Oracle behaviour when inserting strings containing only blanks


> Right, but shouldn't
> ora_ph_type => 5 which Michael used too, should behave same as
> ora_ph_type => 96 and not strip the trailing spaces, at leaset that is
what
> is mentioned in Changes.
>
> 5=> STRING, doesn't strip trailing spaces, embedded \0 ends string
> 96=> CHAR,   doesn't strip trailing spaces, embedded \0 okay
>
> -----Original Message-----
> From: Michael A. Chase
> To: Sterin, Ilya; 'Fox, Michael '; [EMAIL PROTECTED]
> Sent: 05/01/2001 8:38 AM
> Subject: Re: Oracle behaviour when inserting strings containing only
blanks
>
> What's needed is a documentation patch.  Attribute ora_ph_type already
> handles this situation.  If I recall, it can be either an attribute in
> bind_param() or a database handle attribute.
>
> I think what Michael needs would be handled by either of these, but I
> haven't tried them myself:
>
> $dbh->{ora_ph_type} = 96;
> $sth->bind_param( 1, $val, { ora_ph_type => 96 } );
>
> The possible values are listed in DBD-Oracle-1.06/Changes.
CAUTION

This e-mail and any files transmitted with it are privileged and confidential 
information intended for the use of the addressee. The confidentiality and/or 
privilege in this e-mail is not waived, lost or destroyed if it has been transmitted 
to you in error. If you have received this e-mail in error you must (a) not 
disseminate, copy or take any action in reliance on it; (b) please notify Australia 
Post immediately by return e-mail to the sender; and (c) please delete the original 
e-mail.

Reply via email to