php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22026 OCIBindByName trailing spaces
Submitted: 2003-02-03 03:05 UTC Modified: 2003-02-03 05:53 UTC
From: jens dot reibiger at rp dot vaw dot com Assigned:
Status: Not a bug Package: OCI8 related
PHP Version: 4.3.0 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jens dot reibiger at rp dot vaw dot com
New email:
PHP Version: OS:

 

 [2003-02-03 03:05 UTC] jens dot reibiger at rp dot vaw dot com
I guess I have a problem similar th ewone described in 14013.

When I use the OciBindByName, this function throw away the trailing spaces which should be tranmitted via the bind variable. (When I'am using the old Ora_Bind function it works like I expect).

For testing I minimized the problem to a "select from dual" to get it as easy as possible.

I do four select-statement in each combination: the OCI- versus the old Ora-functions and a bind-based versus a direct SQL-statement.

the php-code:

<?php
  $conn = OciLogon ("X","Y","Z");
  $val = " X X ";

  $stm1 = OciParse($conn, "select '".$val."' from dual");
  OciExecute($stm1);
  OciFetch($stm1);
  echo "<b>", OciResult($stm1, 1), "</b><br>\n";

  $stm2 = OciParse($conn, "select :input from dual");
  OciBindByName($stm2, ":input", &$val, 10);
  OciExecute($stm2);
  OciFetch($stm2);
  echo "<b>", OciResult($stm2, 1), "</b><br>\n";
  OciLogoff($conn);



  $Conn = Ora_Logon ("X@Z","Y");
  $val = " X X ";
  $Cursor = Ora_Open($Conn);
  Ora_Parse($Cursor, "select '".$val."' from dual");
  Ora_Exec($Cursor);
  Ora_Fetch($Cursor);
  echo "<b>", Ora_getColumn($Cursor, 0), "</b><br>\n";

  Ora_Parse($Cursor, "select :input from dual");
  Ora_Bind($Cursor, "val", ":input", 10);
  Ora_Exec($Cursor);
  Ora_Fetch($Cursor);
  echo "<b>", Ora_GetColumn($Cursor, 0), "</b><br>\n";

  Ora_Logoff($Conn);
?>


The output is:

<html>
<body>

<b> X X </b><br>
<b> X X</b><br>
<b> X X </b><br>
<b> X X </b><br>

</body></html>


And the second (5th) line (OCIBindByName) in the output is the one I will not accept, because the tailing blank is away.

Best wishes,
Jens Reibiger


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-03 05:53 UTC] maxim@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.


Indeed this is the duplicated report. Please follow up (as you have also previousely done) on: http://bugs.php.net/14013

Secondly, this is an expected behavior, as Thies mentioned, Oracle trims off the spaces. Not sure whether it is configurable somehow from your side.

Maxim Maletsky
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 15:01:31 2024 UTC