Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

oci_bind_by_name binds boolean false as NULL

dregadMay 13 2014 — edited May 13 2014

Hi,

I'm trying to insert a PHP boolean variable into a column defined as number. It works fine for TRUE, but fails with ORA-01400 for FALSE.

Reason for using NUMBER(1) is for portability with other DB engines.

create table test (version varchar(10), obsolete number(1) not null);

<?php
$conn = oci_connect("user", "password", "localhost/XE");

$sql = "INSERT INTO test (version, obsolete) values (:0, :1)";
$param = array( 'test', false );

$stmt=oci_parse($conn, $sql);
oci_bind_by_name($stmt, ":0", $param[0]);
oci_bind_by_name($stmt, ":1", $param[1]);
var_dump(oci_error($conn));

var_dump(oci_execute($stmt));

$ php /tmp/test.php
bool(false)
PHP Warning:  oci_execute(): ORA-01400: cannot insert NULL into ("USER"."TEST"."OBSOLETE") in /tmp/test.php on line 12
bool(false)

If I cast to (int) prior to binding the boolean it works so I have an obvious workaround, but my expectation would be that false would be converted to 0, just like true is automatically stored as 1 (with  $param = array( 'test', true );, the execution is successful)

$ php /tmp/test.php
bool(false)
bool(true)

SQL> select * from test;

VERSION      OBSOLETE
---------- ----------
test                1

Is this a bug ? If not, can someone explain why this happens and maybe what I'm doing wrong ?

Cheers

Damien

------

PHP 5.5.9-1ubuntu4

OCI8 Version => 2.0.8
Oracle XE 11.2.0.2.0

Comments

2909966

We are having the same problem but only on some computers.  I have an iMac running Yosemite v10.10.2 and I get a coffee cup icon when I install our app through Java Web Start.  However, my friend who has a MacBook Pro also running Yosemite v10.10.2 gets the correct icon.  We are both running Java 8 Update 40.

jlanawalt

Is the JNLP for this application publicly available so we could check it against ours?

2909966

The JNLP is at:

http://services.sportsoptions.com/SO/SO-client.jnlp

Just so you know, this JNLP requests all permissions, but you can of course view the JNLP without giving it the permissions.

Does your JNLP work on some Macs?  This one installs the correct icon on Windows, Linux, and some Macs, but not on all Macs.

Vijayasri

Hi,

Did you find a solution to the issue?

I am facing the same problem on macbook pro (Yosemite 10.10.2) with JRE 8 u45. Just the desktop shortcuts are incorrect icons. At other places like Java cache viewer, desktop folder, Get Info dialog...the icons are shown correctly.

Thanks,

Vijayasri

1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 10 2014
Added on May 13 2014
1 comment
3,264 views