Re: oci8.php huge bug
| From: | Tomas V.V.Cox | Date: | Thu, 09 May 2002 12:45:04 +0000 |
| Subject: | Re: oci8.php huge bug | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6018@lists.php.net to get a copy of this message | ||
El jue, 09-05-2002 a las 14:03, Roko Roic escribió:
> Hi
>
> Very Strange Behavior (read: bug) in DB/oci8.php:
It's not a bug it's a feature. Improves the way the sequences are used
(no need to remember the name of the sequence, just the name of the
table).
$id = $db->nextID('mytable');
$res = $db->query("INSERT INTO mytable (id,text) VALUES ($id,'foo')");
instead of:
$id = $db->nextID('mysequence_for_mytable');
$res = $db->query("INSERT INTO mytable (id,text) VALUES ($id,'foo')");
> DB::nextID($sequence_name) method is supposed to return nextval of a
> sequence $sequence_name.
>
> After a nerverwrecking day of checking my own code, I ckecked oci8.php and
> found the source of my troubles:
>
> --[oci.php]
> $result = $this->query("SELECT ${sqn}_seq.nextval FROM dual");
> --[/oci.php]
>
> Why does this code insist that my sequence names end in _seq????
While you inspected the code you could found the "seqname_format"
option:
$options = array('persistent' => true, 'seqname_format' =>
'%s');
// by default 'seq_format' is '%s_seq'
$db = DB::connect($dns, $options);
Tomas V.V.Cox