[Php-it] Adodb Replace
Giovanni Battista Lenoci
gianiaz at gianiaz.net
Tue May 29 13:25:27 CEST 2007
Ciao, mi trovo a dover lavorare con adodb su un progetto esistente, cosi
guardando il codice sto cercando di utilizzarlo nello stesso modo.
In pratica nel pezzo di codice (funzionante) che ho in mano vedo:
$test = new ADOdb_Active_Record('tablename');
$test ->par1 = $par1;
$test ->par2 = $par2;
$test ->par3 = $par3;
$test->Replace();
Leggendo dal man, torna 0 su errori, 1 se inserisce, 2 se fa il replace.
Il problema è che mi restituisce 0, e non riesco a capire come avere un
messaggio di errore che mi spieghi cosa c'è che non va....
Leggendo il man, sembra che non contempli questo metodo di utilizzo:
----
Replace($table, $arrFields, $keyCols,$autoQuote=false)
Try to update a record, and if the record is not found, an insert
statement is generated and executed. Returns 0 on failure, 1 if update
statement worked, 2 if no record was found and the insert was executed
successfully. This differs from MySQL's replace which deletes the record
and inserts a new record. This also means you cannot update the primary
key. The only exception to this is Interbase and its derivitives, which
uses delete and insert because of some Interbase API limitations.
The parameters are $table which is the table name, the $arrFields which
is an associative array where the keys are the field names, and $keyCols
is the name of the primary key, or an array of field names if it is a
compound key. If $autoQuote is set to true, then Replace() will quote
all values that are non-numeric; auto-quoting will not quote nulls. Note
that auto-quoting will not work if you use SQL functions or operators.
---
Sto leggendo un manuale errato o cosa?
C'è un metodo per avere il feedback per capire cosa ho sbagliato?
ciao e grazie
--
gianiaz.net
di Giovanni Battista Lenoci
P.le Bertacchi 66
23100 Sondrio
cell. +39.392.7096936
cell. +39.347.7196482
More information about the Php-it
mailing list