Index: phpdoc/it/functions/oci8.xml diff -u phpdoc/it/functions/oci8.xml:1.5 phpdoc/it/functions/oci8.xml:1.6 --- phpdoc/it/functions/oci8.xml:1.5 Tue Oct 31 00:11:07 2000 +++ phpdoc/it/functions/oci8.xml Mon Mar 26 08:10:54 2001 @@ -1,79 +1,182 @@ - Oracle 8 functions + Funzioni Oracle 8 OCI8 - - These functions allow you to access Oracle8 and Oracle7 databases. It - uses the Oracle8 Call-Interface (OCI8). You will need the Oracle8 client - libraries to use this extension. - - This extension is more flexible than the standard Oracle - extension. It supports binding of global and local PHP variables - to Oracle placeholders, has full LOB, FILE and ROWID support - and allows you to use user-supplied define variables. + + Queste funzioni permettono di accedere ai database Oracle8 e Oracle7. + Usano la Call-Interface di Oracle8 (OCI8). Occorre avere installate le librerie client + di Oracle8 per utilizzare questa estensione. + + + Questa estensione e' piu' flessibile della estensione standard di Oracle. + Supporta il binding di variabili PHP locali e globali + ai segnaposto Oracle, ha pieno supporto di LOB, FILE e ROWID + e permette di utilizzare variabili di definizione personalizzabili. + + + Prima di usare questa estensione, occorre sicerarsi di aver impostato + le variabili d'ambiente per l'utente Oracle, come pure + per l'utente del server web. Le variabili che potrebbero necessitare l'impostazione sono + le seguenti: + + + + ORACLE_HOME + + + + + ORACLE_SID + + + + + LD_PRELOAD + + + + + LD_LIBRARY_PATH + + + + + NLS_LANG + + + + + ORA_NLS33 + + + + + + Dopo aver impostato le variabili d'ambiente per l'utente del server web, + occorre sicerarsi di aver aggiunto anche l'utente stesso (nobody, www) al gruppo + oracle. + + + Se il server web non parte o va in blocco + + Controllare che apache sia linkato con la libreria pthread: + + + + +# ldd /www/apache/bin/httpd + libpthread.so.0 => /lib/libpthread.so.0 (0x4001c000) + libm.so.6 => /lib/libm.so.6 (0x4002f000) + libcrypt.so.1 => /lib/libcrypt.so.1 (0x4004c000) + libdl.so.2 => /lib/libdl.so.2 (0x4007a000) + libc.so.6 => /lib/libc.so.6 (0x4007e000) + /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) + + + + + Se la libpthread non compare nell'elenco, occorre reinstallare Apache: + + + + +# cd /usr/src/apache_1.3.xx +# make clean +# LIBS=-lpthread ./config.status +# make +# make install + + + + + + + OCI Hints + +<?php +// by sergo <email protected> + +// Use option: OCI_DEFAULT for execute command to delay execution +OCIExecute($stmt, OCI_DEFAULT); + +// for retrieve data use (after fetch): + +$result = OCIResult($stmt, $n); +if (is_object ($result)) $result = $result->load(); + +// For INSERT or UPDATE statement use: + +$sql = "insert into table (field1, field2) values (field1 = 'value', + field2 = empty_clob()) returning field2 into :field2"; +OCIParse($conn, $sql); +$clob = OCINewDescriptor($conn, OCI_D_LOB); +OCIBindByName ($stmt, ":field2", &$clob, -1, OCI_B_CLOB); +OCIExecute($stmt, OCI_DEFAULT); +$clob->save ("some text"); + +?> + + + + + You can easily access stored procedures in the same way as you + would from the commands line. + + Using Stored Procedures + +<?php +// by webmaster <email protected> +$sth = OCIParse ( $dbh, "begin sp_newaddress( :address_id, '$firstname', + '$lastname', '$company', '$address1', '$address2', '$city', '$state', + '$postalcode', '$country', :error_code );end;" ); + +// This calls stored procedure sp_newaddress, with :address_id being an +// in/out variable and :error_code being an out variable. +// Then you do the binding: + + OCIBindByName ( $sth, ":address_id", $addr_id, 10 ); + OCIBindByName ( $sth, ":error_code", $errorcode, 10 ); + OCIExecute ( $sth ); + +?> + + + - - OCIDefineByName - Use a PHP variable for the define-step during a SELECT + + Utilizza una variabile PHP per la fase di definizione in un comando SELECT + - Description + Descrizione int OCIDefineByName int stmt string Column-Name - mixed &variable - int type + mixed variable + int type + - OCIDefineByName uses fetches SQL-Columns - into user-defined PHP-Variables. Be careful that Oracle user - ALL-UPPERCASE column-names, whereby in your select you can also - write lower-case. OCIDefineByName expects - the Column-Name to be in uppercase. If you - define a variable that doesn't exists in you select statement, no - error will be given! + OCIDefineByName copia i valori delle SQL-Columns + nelle variabili PHP. Attenzione: Oracle usa + nomi di colonna MAIUSCOLI, mentre nella SELECT si possono anche + scrivere minuscoli. OCIDefineByName vuole + il parametro Column-Name in caratteri maiuscoli. Se si + definisce una variabile che non esiste nel comando SELECT, non + viene dato alcun errore! - If you need to define an abstract Datatype (LOB/ROWID/BFILE) you - need to allocate it first using - OCINewDescriptor function. See also the - OCIBindByName function. + Se occorre definire un tipo di dati astratto (LOB/ROWID/BFILE) + lo si deve prima allocare usando la funzione + OCINewDescriptor. Vedere anche la + funzione OCIBindByName. OCIDefineByName @@ -87,8 +190,8 @@ /* the define MUST be done BEFORE ociexecute! */ -OCIDefineByName($stmt,"EMPNO",&$empno); -OCIDefineByName($stmt,"ENAME",&$ename); +OCIDefineByName($stmt,"EMPNO",$empno); +OCIDefineByName($stmt,"ENAME",$ename); OCIExecute($stmt); @@ -99,57 +202,60 @@ OCIFreeStatement($stmt); OCILogoff($conn); -?> - +?> + + OCIBindByName - Bind a PHP variable to an Oracle Placeholder + + Lega una variabile PHP ad un segnaposto Oracle + - Description + Descrizione int OCIBindByName int stmt string ph_name - mixed &variable + mixed &variable intlength - int type + int + type - OCIBindByName binds the PHP variable - variable to the Oracle placeholder - ph_name. Whether it will be used for - input or output will be determined run-time, and the necessary - storage space will be allocated. The - length paramter sets the maximum length - for the bind. If you set length to -1 - OCIBindByName will use the current length of - variable to set the maximum length. - - - If you need to bind an abstract Datatype (LOB/ROWID/BFILE) you - need to allocate it first using - OCINewDescriptor function. The - length is not used for abstract Datatypes - and should be set to -1. The type variable - tells oracle, what kind of descriptor we want to use. Possible - values are: OCI_B_FILE (Binary-File), OCI_B_CFILE + OCIBindByName collega la variabile PHP + variable al segnaposto Oracle + ph_name. L'utilizzo in modalita' + input o output sara' determinato a run-time, e lo spazio di memoria + necessario sara' allocato. Il parametro + length imposta la lunghezza massima + del collegamento. Se si imposta length a -1 + OCIBindByName usera' l'attuale lunghezza di + variable per impostare la lunghezza massima. + + + Se si deve collegare un Datatype astratto (LOB/ROWID/BFILE) + occorre innanzitutto allocarlo usando la funzione + OCINewDescriptor. Il parametro + length non e' usato con i Datatypes astratti + e dovrebbe essere impostato a -1. La veriabile type + informa oracle sul tipo di descrittore che si vuole usare. I valori possibili + sono: OCI_B_FILE (Binary-File), OCI_B_CFILE (Character-File), OCI_B_CLOB (Character-LOB), OCI_B_BLOB - (Binary-LOB) and OCI_B_ROWID (ROWID). + (Binary-LOB) e OCI_B_ROWID (ROWID). OCIDefineByName <?php /* OCIBindByPos example thies <email protected> (980221) - - inserts 3 resords into emp, and uses the ROWID for updating the + inserts 3 records into emp, and uses the ROWID for updating the records just after the insert. */ @@ -163,13 +269,13 @@ $rowid = OCINewDescriptor($conn,OCI_D_ROWID); -OCIBindByName($stmt,":empno",&$empno,32); -OCIBindByName($stmt,":ename",&$ename,32); -OCIBindByName($stmt,":rid",&$rowid,-1,OCI_B_ROWID); +OCIBindByName($stmt,":empno",&$empno,32); +OCIBindByName($stmt,":ename",&$ename,32); +OCIBindByName($stmt,":rid",&$rowid,-1,OCI_B_ROWID); $update = OCIParse($conn,"update emp set sal = :sal where ROWID = :rid"); -OCIBindByName($update,":rid",&$rowid,-1,OCI_B_ROWID); -OCIBindByName($update,":sal",&$sal,32); +OCIBindByName($update,":rid",&$rowid,-1,OCI_B_ROWID); +OCIBindByName($update,":sal",&$sal,32); $sal = 10000; @@ -185,7 +291,7 @@ $stmt = OCIParse($conn,"select * from emp where empno in (1111,2222,3333)"); OCIExecute($stmt); -while (OCIFetchInto($stmt,&$arr,OCI_ASSOC)) { +while (OCIFetchInto($stmt,&$arr,OCI_ASSOC)) { var_dump($arr); } OCIFreeStatement($stmt); @@ -196,41 +302,55 @@ OCIFreeStatement($stmt); OCILogoff($conn); -?> +?> + + + + + It is a bad idea to use magic quotes and + OciBindByName simultaneously as no quoting + is needed on quoted variables and any quotes magically applied + will be written into your database as + OciBindByName is not able to distinguish + magically added quotings from those added by intention. + + OCILogon - Establishes a connection to Oracle + Stabilisce una connessione a Oracle - Description + Descrizione int OCILogon string username string password - string db + string + db + - OCILogon returns an connection identifier - needed for most other OCI calls. The optional third parameter - can either contain the name of the local Oracle instance or the - name of the entry in tnsnames.ora to which you want to connect. - If the optional third parameter is not specified, PHP uses the - environment variables ORACLE_SID (Oracle instance) or TWO_TASK - (tnsnames.ora) to determine which database to connect to. + OCILogon restituisce un identificatore di connessione + necessario per la maggior parte delle altre chiamate OCI. Il terzo parametro opzionale + puo' contenere il nome della istanza Oracle locale o il nome + della voce in tnsnames.ora a cui ci si vuole connettere. + Se il terzo parametro opzionale non e' specificato, PHP usa la + variabile d'ambiente ORACLE_SID (istanza di Oracle) o TWO_TASK + (in tnsnames.ora) per determinare a quale database collegarsi. - Connections are shared at the page level when using - OCILogon. This means that commits and - rollbacks apply to all open transactions in the page, even if you - have created multiple connections. + Le connessioni sono condivise a livello di pagina quando si usa + OCILogon. Questo significa che i commit e i + rollback avvengono su tutte le transazioni aperte nella pagina, anche se sono + state create connessioni multiple. - This example demonstrates how the connections are shared. + Questo esempio dimostra come le connessioni sono condivise. OCILogon @@ -242,8 +362,7 @@ $c2 = ocilogon("scott","tiger",$db); function create_table($conn) -{ $stmt = ociparse($conn,"create table scott.hallo (test -varchar2(64))"); +{ $stmt = ociparse($conn,"create table scott.hallo (test varchar2(64))"); ociexecute($stmt); echo $conn." created table\n\n"; } @@ -255,7 +374,8 @@ } function insert_data($conn) -{ $stmt = ociparse($conn,"insert into scott.hallo values('$conn' || ' ' || to_char(sysdate,'DD-MON-YY HH24:MI:SS'))"); +{ $stmt = ociparse($conn,"insert into scott.hallo + values('$conn' || ' ' || to_char(sysdate,'DD-MON-YY HH24:MI:SS'))"); ociexecute($stmt,OCI_DEFAULT); echo $conn." inserted hallo\n\n"; } @@ -268,7 +388,7 @@ function commit($conn) { ocicommit($conn); - echo $conn." commited\n\n"; + echo $conn." committed\n\n"; } function rollback($conn) @@ -315,7 +435,7 @@ print "</PRE></HTML>"; ?> - See also OCIPLogon and + Vedere anche OCIPLogon e OCINLogon. @@ -323,69 +443,75 @@ OCIPLogon - Connect to an Oracle database and log on using a persistant connection. - Returns a new session. + Stabilisce una connessione permanente a Oracle. + Restituisce una nuova sessione. - Description + Descrizione int OCIPLogon string username string password - string db + string + db + - OCIPLogon creates a persistent connection to - an Oracle 8 database and logs on. The optional third parameter - can either contain the name of the local Oracle instance or the - name of the entry in tnsnames.ora to which you want to connect. - If the optional third parameter is not specified, PHP uses the - environment variables ORACLE_SID (Oracle instance) or TWO_TASK - (tnsnames.ora) to determine which database to connect to. + OCIPLogon crea una connessione persistente + a un database Oracle 8 e si autentica. Il terzo parametro opzionale + puo' contenere il nome della istanza Oracle locale o il nome + della voce in tnsnames.ora a cui ci si vuole connettere. + Se il terzo parametro opzionale non e' specificato, PHP usa la + variabile d'ambiente ORACLE_SID (istanza di Oracle) o TWO_TASK + (in tnsnames.ora) per determinare a quale database collegarsi. - See also OCILogon and - OCINLogon. - + Vedere anche OCILogon e + OCINLogon. + + + OCINLogon - Connect to an Oracle database and log on using a new connection. - Returns a new session. + Stabilisce, forzandola, una nuova connessione a Oracle. + Restituisce una nuova sessione. - Description + Descrizione int OCINLogon string username string password - string db + string + db + - OCINLogon creates a new connection to an - Oracle 8 database and logs on. The optional third parameter can - either contain the name of the local Oracle instance or the name - of the entry in tnsnames.ora to which you want to connect. If - the optional third parameter is not specified, PHP uses the - environment variables ORACLE_SID (Oracle instance) or TWO_TASK - (tnsnames.ora) to determine which database to connect to. + OCINLogon crea una nuova connessione + a un database Oracle 8 e si autentica. Il terzo parametro opzionale + puo' contenere il nome della istanza Oracle locale o il nome + della voce in tnsnames.ora a cui ci si vuole connettere. + Se il terzo parametro opzionale non e' specificato, PHP usa la + variabile d'ambiente ORACLE_SID (istanza di Oracle) o TWO_TASK + (in tnsnames.ora) per determinare a quale database collegarsi. - OCINLogon forces a new connection. This - should be used if you need to isolate a set of transactions. By - default, connections are shared at the page level if using - OCILogon or at the web server process level - if using OCIPLogon. If you have multiple - connections open using OCINLogon, all - commits and rollbacks apply to the specified connection only. + OCINLogon forza una nuova connessione. + Si deve usare quando si ha necessita' di isolare un insieme di transazioni. Di + default, le connessioni sono condivise a livello di pagina se si usa + OCILogon o a livello di processo del web server + se si usa OCIPLogon. Se ci sono connessioni + multiple aperte con OCINLogon, tutti i + commit e rollback avverranno solo sulla connessione specificata. - This example demonstrates how the connections are separated. + Questo esempio dimostra come le connessioni sono isolate. OCINLogon @@ -410,7 +536,8 @@ } function insert_data($conn) -{ $stmt = ociparse($conn,"insert into scott.hallo values('$conn' || ' ' || to_char(sysdate,'DD-MON-YY HH24:MI:SS'))"); +{ $stmt = ociparse($conn,"insert into scott.hallo + values('$conn' || ' ' || to_char(sysdate,'DD-MON-YY HH24:MI:SS'))"); ociexecute($stmt,OCI_DEFAULT); echo $conn." inserted hallo\n\n"; } @@ -423,7 +550,7 @@ function commit($conn) { ocicommit($conn); - echo $conn." commited\n\n"; + echo $conn." committed\n\n"; } function rollback($conn) @@ -467,19 +594,22 @@ drop_table($c1); print "</PRE></HTML>"; -?> +?> + - See also OCILogon and - OCIPLogon. - + Vedere anche OCILogon e + OCIPLogon. + + + OCILogOff - Disconnects from Oracle + Disconnette da Oracle - Description + Descrizione int OCILogOff @@ -487,7 +617,7 @@ - OCILogOff closes an Oracle connection. + OCILogOff chiude una connessione Oracle. @@ -495,23 +625,26 @@ OCIExecute - Execute a statement + Esegue un comando SQL - Description + Descrizione int OCIExecute int statement - int mode + int + mode + - OCIExecute executes a previously parsed statement. - (see OCIParse). The optional mode - allows you to specify the execution-mode (default is OCI_COMMIT_ON_SUCCESS). - If you don't want statements to be commited automaticly specify OCI_DEFAULT as - your mode. + OCIExecute esegue un comando precedentemente + analizzato. (vedere OCIParse). Il parametro optzionale + mode permette di specificare la modalita' + di esecuzione (il default e' OCI_COMMIT_ON_SUCCESS). Se non si + desidera che i comandi eseguano un commit automatico, usare OCI_DEFAULT nella + variabile mode. @@ -519,10 +652,10 @@ OCICommit - Commits outstanding transactions + Esegue le transazioni in sospeso - Description + Descrizione int OCICommit @@ -530,8 +663,8 @@ - OCICommit commits all outstanding statements for - Oracle connection connection. + OCICommit esegue tutte le transazioni in sospeso + sulla connessione Oracle connection. @@ -539,10 +672,10 @@ OCIRollback - Rolls back outstanding transactions + Annulla le transazioni in sospeso - Description + Descrizione int OCIRollback @@ -550,8 +683,8 @@ - OCIRollback rolls back all outstanding statements for - Oracle connection connection. + OCIRollback annulla tutte le transazioni in sospeso + sulla connessione Oracle connection. @@ -559,23 +692,28 @@ OCINewDescriptor - Initialize a new empty descriptor LOB/FILE (LOB is default) + + Inizializza un nuovo descrittore LOB/FILE vuoto (LOB e' il default) + - Description + Descrizione string OCINewDescriptor int connection - int type + int + type + - OCINewDescriptor Allocates storage to hold descriptors or LOB locators. - Valid values for the valid type are OCI_D_FILE, OCI_D_LOB, OCI_D_ROWID. - For LOB desriptors, the methods load, save, and savefile are associated with the descriptor, - for BFILE only the load method exists. See the second example usage hints. - + OCINewDescriptor Alloca memoria per accogliere + descrittori o locatori LOB. I valori validi per il parametro + type sono OCI_D_FILE, OCI_D_LOB, OCI_D_ROWID. + Per i descrittori LOB, i metodi load, save, e savefile sono + associati al descrittore, per i BFILE esiste solo il + metodo load. Vedere i suggerimenti nel secondo esempio. OCINewDescriptor @@ -590,12 +728,12 @@ $conn = OCILogon($user, $password); $stmt = OCIParse($conn,"select rowid from $table $where"); $rowid = OCINewDescriptor($conn,OCI_D_ROWID); - OCIDefineByName($stmt,"ROWID",&$rowid); + OCIDefineByName($stmt,"ROWID",&$rowid); OCIExecute($stmt); while ( OCIFetch($stmt) ) { $nrows = OCIRowCount($stmt); $delete = OCIParse($conn,"delete from $table where ROWID = :rid"); - OCIBindByName($delete,":rid",&$rowid,-1,OCI_B_ROWID); + OCIBindByName($delete,":rid",&$rowid,-1,OCI_B_ROWID); OCIExecute($delete); print "$nrows\n"; if ( ($nrows % $commitsize) == 0 ) { @@ -607,7 +745,8 @@ OCIFreeStatement($stmt); OCILogoff($conn); ?> - + + <?php /* This script demonstrates file upload to LOB columns * The formfield used for this example looks like this @@ -626,8 +765,9 @@ // $lob_upload contains the temporary filename of the uploaded file $conn = OCILogon($user, $password); $lob = OCINewDescriptor($conn, OCI_D_LOB); - $stmt = OCIParse($conn,"insert into $table (id, the_blob) values(my_seq.NEXTVAL, EMPTY_BLOB()) returning the_blob into :the_blob"); - OCIBindByName($stmt, ':the_blob', &$lob, -1, OCI_B_BLOB); + $stmt = OCIParse($conn,"insert into $table (id, the_blob) + values(my_seq.NEXTVAL, EMPTY_BLOB()) returning the_blob into :the_blob"); + OCIBindByName($stmt, ':the_blob', &$lob, -1, OCI_B_BLOB); OCIExecute($stmt); if($lob->savefile($lob_upload)){ OCICommit($conn); @@ -635,22 +775,23 @@ }else{ echo "Couldn't upload Blob\n"; } - OCIFreeDescriptor($lob); + OCIFreeDesc($lob); OCIFreeStatement($stmt); OCILogoff($conn); } ?> - - + + + OCIRowCount - Gets the number of affected rows + Restituisce il numero di tuple modificate - Description + Descrizione int OCIRowCount @@ -658,9 +799,9 @@ - OCIRowCounts returns the number of rows affected - for eg update-statements. This funtions will not tell you the number - of rows that a select will return! + OCIRowCounts restituisce il numero di tuple modificate, + ad esempio, da un comando update. Questa funzione non riporta il numero + di tuple restituite da una select! OCIRowCount @@ -682,18 +823,20 @@ OCIFreeStatement($stmt); OCILogOff($conn); print "</PRE></HTML>"; -?> - +?> + OCINumCols - Return the number of result columns in a statement + + Restituisce il numero di campi che risultano da un comando SQL + - Description + Descrizione int OCINumCols @@ -701,7 +844,9 @@ - OCINumCols returns the number of columns in a statement + OCINumCols restituisce il numero di campi contenuti in + un'istruzione SQL + OCINumCols @@ -713,7 +858,7 @@ while ( OCIFetch($stmt) ) { print "\n"; $ncols = OCINumCols($stmt); - for ( $i = 1; $i <= $ncols; $i++ ) { + for ( $i = 1; $i <= $ncols; $i++ ) { $column_name = OCIColumnName($stmt,$i); $column_value = OCIResult($stmt,$i); print $column_name . ': ' . $column_value . "\n"; @@ -724,18 +869,19 @@ OCILogoff($conn); print "</PRE>"; print "</HTML>\n"; -?> - +?> + + OCIResult - Returns coulumn value for fetched row + Restituisce il valore di campo della tupla estratta - Description + Descrizione mixed OCIResult @@ -744,10 +890,11 @@ - OCIResult returns the data for column - column in the current row (see - OCIFetch).OCIResult will - return everything as strings except for abstract types (ROWIDs, LOBs and FILEs). + OCIResult restituisce i dati del campo + column nella tupla corrente (vedere + OCIFetch).OCIResult restituira' + tutto come stringa, eccetto i tipi astratti (ROWIDs, + LOBs e FILEs). @@ -755,10 +902,10 @@ OCIFetch - Fetches the next row into result-buffer + Estrae la prossima tupla opnendola nel buffer di risultato. - Description + Descrizione int OCIFetch @@ -766,8 +913,8 @@ - OCIFetch fetches the next row (for SELECT statements) - into the internal result-buffer. + OCIFetch estrae la prossima tupla (nelle istruzioni SELECT) + ponendola nel buffer interno di risultato. @@ -775,62 +922,72 @@ OCIFetchInto - Fetches the next row into result-array + Estrae la prossima tupla ponendola in un array - Description + Descrizione int OCIFetchInto int stmt - array &result - int mode + array &result + int + mode + - OCIFetchInto fetches the next row (for SELECT statements) - into the result array. OCIFetchInto - will overwrite the previous content of result. By default - result will contain a one-based array of all columns - that are not NULL. + OCIFetchInto estrae la prossima tupla (nelle istruzioni + SELECT) ponendola nell'array result. + OCIFetchInto sovrascrivera' il preceente + contenuto di result. Di default + result conterra' un array (primo indice = 1) di tutti i campi + che non sono NULL. - The mode parameter allows you to change the default - behaviour. You can specify more than one flag by simply addig them up - (eg OCI_ASSOC+OCI_RETURN_NULLS). The known flags are: - + Il parametro mode permette di cambiare il comportamento + predefinito. E' possibile specificare piu' di un'opzione sommandole + (es. OCI_ASSOC+OCI_RETURN_NULLS). Le opzioni valide + sono: - OCI_ASSOC Return an associative array. - OCI_NUM Return an numbered array - starting with one. (DEFAULT) - OCI_RETURN_NULLS Return empty columns. - OCI_RETURN_LOBS Return the value of a LOB instead of the desxriptor. + + OCI_ASSOC Restituisce un array associativo. + + + OCI_NUM Restituisce un array indicizzato + (primo indice = 1). (DEFAULT) + + + OCI_RETURN_NULLS Restituisce anche i campi NULL. + + + OCI_RETURN_LOBS Restituisce il valore di un LOB + invece del descrittore. + - - - OCIFetchStatement - Fetch all rows of result data into an array. + Estrae tutte le tuple in un array. - Description + Descrizione int OCIFetchStatement int stmt - array &variable + array &variable - OCIFetchStatement fetches all the rows from a - result into a user-defined array. OCIFetchStatement - returns the number of rows fetched. + OCIFetchStatement estrae tutte le tuple da un risultato + ponendole in un array definito dall'utente. + OCIFetchStatement restituisce il numero di tuple + estratte. OCIFetchStatement @@ -870,18 +1027,19 @@ OCIFreeStatement($stmt); OCILogoff($conn); - -?> - +?> + + + OCIColumnIsNULL - test whether a result column is NULL + verifica se un campo di risultato e' NULL - Description + Descrizione int OCIColumnIsNULL @@ -890,23 +1048,82 @@ - OCIColumnIsNULL returns true if the returned - column col in the result from the - statement stmt is NULL. You can either use - the column-number (1-Based) or the column-name for the col - parameter. + OCIColumnIsNULL restituisce vero se il campo + col nel risultato dell'istruzione + stmt e' NULL. Si puo' usare il + numero del campo (primo campo=1) o il nome del campo per il + parametro col. + + + OCIColumnName + Restituisce il nome di un campo. + + + Descrizione + + + string OCIColumnName + int stmt + int col + + + + OCIColumnName restituisce il nome del campo + corrispondente alla posizione (1 = primo campo) specificata. + + + + OCIColumnName + +<?php + print "<HTML><PRE>\n"; + $conn = OCILogon("scott", "tiger"); + $stmt = OCIParse($conn,"select * from emp"); + OCIExecute($stmt); + print "<TABLE BORDER=\"1\">"; + print "<TR>"; + print "<TH>Name</TH>"; + print "<TH>Type</TH>"; + print "<TH>Length</TH>"; + print "</TR>"; + $ncols = OCINumCols($stmt); + for ( $i = 1; $i <= $ncols; $i++ ) { + $column_name = OCIColumnName($stmt,$i); + $column_type = OCIColumnType($stmt,$i); + $column_size = OCIColumnSize($stmt,$i); + print "<TR>"; + print "<TD>$column_name</TD>"; + print "<TD>$column_type</TD>"; + print "<TD>$column_size</TD>"; + print "</TR>"; + } + OCIFreeStatement($stmt); + OCILogoff($conn); + print "</PRE>"; + print "</HTML>\n"; +?> + + + + + Vedere anche OCINumCols, + OCIColumnType, + e OCIColumnSize. + + + OCIColumnSize - return result column size + restituisce la dimensione del campo - Description + Descrizione int OCIColumnSize @@ -915,10 +1132,10 @@ - OCIColumnSize returns the size of the column - as given by Oracle. You can either use - the column-number (1-Based) or the column-name for the col - parameter. + OCIColumnSize restituisce la dimensione del campo + come riportata da Oracle. Si puo' usare il + numero del campo (primo campo=1) o il nome del campo per + il parametro col. @@ -936,7 +1153,7 @@ print "<TH>Length</TH>"; print "</TR>"; $ncols = OCINumCols($stmt); - for ( $i = 1; $i <= $ncols; $i++ ) { + for ( $i = 1; $i <= $ncols; $i++ ) { $column_name = OCIColumnName($stmt,$i); $column_type = OCIColumnType($stmt,$i); $column_size = OCIColumnSize($stmt,$i); @@ -950,21 +1167,88 @@ OCIFreeStatement($stmt); OCILogoff($conn); print "</PRE>"; + print "</HTML>\n"; +?> + + + + + Vedere anche OCINumCols, + OCIColumnName, e + OCIColumnSize. + + + + + + + OCIColumnType + Restituisce il tipo di dati di un campo. + + + Descrizione + + + mixed OCIColumnType + int stmt + int col + + + + OCIColumnType restituisce il tipo del campo + corrispondente alla posizione (1 = primo campo) + specificata. + + + + OCIColumnType + +<?php + print "<HTML><PRE>\n"; + $conn = OCILogon("scott", "tiger"); + $stmt = OCIParse($conn,"select * from emp"); + OCIExecute($stmt); + print "<TABLE BORDER=\"1\">"; + print "<TR>"; + print "<TH>Name</TH>"; + print "<TH>Type</TH>"; + print "<TH>Length</TH>"; + print "</TR>"; + $ncols = OCINumCols($stmt); + for ( $i = 1; $i <= $ncols; $i++ ) { + $column_name = OCIColumnName($stmt,$i); + $column_type = OCIColumnType($stmt,$i); + $column_size = OCIColumnSize($stmt,$i); + print "<TR>"; + print "<TD>$column_name</TD>"; + print "<TD>$column_type</TD>"; + print "<TD>$column_size</TD>"; + print "</TR>"; + } + OCIFreeStatement($stmt); + OCILogoff($conn); + print "</PRE>"; print "</HTML>\n"; -?> +?> + + + - See also OCINumCols, OCIColumnName, - and OCIColumnSize. + Vedere anche OCINumCols, + OCIColumnName, + e OCIColumnSize. + OCIServerVersion - Return a string containing server version information. + Restituisce una stringa contenente informazioni sulla versione + del server. - Description + Descrizione string OCIServerVersion @@ -979,18 +1263,20 @@ $conn = OCILogon("scott","tiger"); print "Server Version: " . OCIServerVersion($conn); OCILogOff($conn); -?> - +?> + + + OCIStatementType - Return the type of an OCI statement. + Restituisce il tipo di un'istruzione OCI. - Description + Descrizione string OCIStatementType @@ -998,7 +1284,8 @@ - OCIStatementType returns on of the following values: + OCIStatementType restituisce uno dei seguenti + valori: "SELECT" "UPDATE" @@ -1028,18 +1315,21 @@ OCILogoff($conn); print "</PRE></HTML>"; ?> - - + + + OCINewCursor - return a new cursor (Statement-Handle) - use this to bind ref-cursors! + + restituisce un nuovo cursore (Statement-Handle) - usare questa per collegare un ref-cursors + - Description + Descrizione int OCINewCursor @@ -1047,8 +1337,8 @@ - OCINewCursor allocates a new statement handle on the specified - connection. + OCINewCursor alloca un nuovo identificatore di istruzione sulla connessione + specificata. @@ -1061,19 +1351,21 @@ $curs = OCINewCursor($conn); $stmt = OCIParse($conn,"begin info.output(:data); end;"); -ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR); +ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR); ociexecute($stmt); ociexecute($curs); -while (OCIFetchInto($curs,&$data)) { +while (OCIFetchInto($curs,&$data)) { var_dump($data); } OCIFreeCursor($stmt); OCIFreeStatement($curs); OCILogoff($conn); -?> - +?> + + + Using a REF CURSOR in a select statement @@ -1093,14 +1385,14 @@ print "<TH># EMPLOYEES</TH>"; print "</TR>"; -while (OCIFetchInto($stmt,&$data,OCI_ASSOC)) { +while (OCIFetchInto($stmt,&$data,OCI_ASSOC)) { print "<TR>"; $dname = $data["DNAME"]; $deptno = $data["DEPTNO"]; print "<TD>$dname</TD>"; print "<TD>$deptno</TD>"; ociexecute($data[ "EMPCNT" ]); - while (OCIFetchInto($data[ "EMPCNT" ],&$subdata,OCI_ASSOC)) { + while (OCIFetchInto($data[ "EMPCNT" ],&$subdata,OCI_ASSOC)) { $num_emps = $subdata["NUM_EMPS"]; print "<TD>$num_emps</TD>"; } @@ -1110,18 +1402,22 @@ print "</BODY></HTML>"; OCIFreeStatement($stmt); OCILogoff($conn); -?> - +?> + + + OCIFreeStatement - Free all resources associated with a statement. + + Libera tutte le risorse associate ad un'istruzione. + - Description + Descrizione int OCIFreeStatement @@ -1129,8 +1425,8 @@ - OCIFreeStatement returns true if successful, or false if - unsuccessful. + OCIFreeStatement restituisce vero in caso di successo, falso + altrimenti. @@ -1138,10 +1434,12 @@ OCIFreeCursor - Free all resources associated with a cursor. + + Libera tutte le risorse associate ad un cursore. + - Description + Descrizione int OCIFreeCursor @@ -1149,129 +1447,39 @@ - OCIFreeCursor returns true if successful, or false if - unsuccessful. + OCIFreeCursor restituisce vero in caso di successo, falso + altrimenti. - + - OCIColumnName - Returns the name of a column. + OCIFreeDesc + Cancella un descrittore di oggetto binario (LOB). - Description + Descrizione - string OCIColumnName - int stmt - int col + int OCIFreeDesc + object lob - - OCIColumnName returns the name of the column - corresponding to the column number (1-based) that is passed in. - - - OCIColumnName - -<?php - print "<HTML><PRE>\n"; - $conn = OCILogon("scott", "tiger"); - $stmt = OCIParse($conn,"select * from emp"); - OCIExecute($stmt); - print "<TABLE BORDER=\"1\">"; - print "<TR>"; - print "<TH>Name</TH>"; - print "<TH>Type</TH>"; - print "<TH>Length</TH>"; - print "</TR>"; - $ncols = OCINumCols($stmt); - for ( $i = 1; $i <= $ncols; $i++ ) { - $column_name = OCIColumnName($stmt,$i); - $column_type = OCIColumnType($stmt,$i); - $column_size = OCIColumnSize($stmt,$i); - print "<TR>"; - print "<TD>$column_name</TD>"; - print "<TD>$column_type</TD>"; - print "<TD>$column_size</TD>"; - print "</TR>"; - } - OCIFreeStatement($stmt); - OCILogoff($conn); - print "</PRE>"; - print "</HTML>\n"; -?> - - See also OCINumCols, OCIColumnType, - and OCIColumnSize. + OCIFreeDesc restituisce vero in caso di successo, + falso altrimenti. + - - - OCIColumnType - Returns the data type of a column. - - - Description - - - mixed OCIColumnName - int stmt - int col - - - - OCIColumnType returns the data type of the column - corresponding to the column number (1-based) that is passed in. - - - - OCIColumnType - -<?php - print "<HTML><PRE>\n"; - $conn = OCILogon("scott", "tiger"); - $stmt = OCIParse($conn,"select * from emp"); - OCIExecute($stmt); - print "<TABLE BORDER=\"1\">"; - print "<TR>"; - print "<TH>Name</TH>"; - print "<TH>Type</TH>"; - print "<TH>Length</TH>"; - print "</TR>"; - $ncols = OCINumCols($stmt); - for ( $i = 1; $i <= $ncols; $i++ ) { - $column_name = OCIColumnName($stmt,$i); - $column_type = OCIColumnType($stmt,$i); - $column_size = OCIColumnSize($stmt,$i); - print "<TR>"; - print "<TD>$column_name</TD>"; - print "<TD>$column_type</TD>"; - print "<TD>$column_size</TD>"; - print "</TR>"; - } - OCIFreeStatement($stmt); - OCILogoff($conn); - print "</PRE>"; - print "</HTML>\n"; -?> - - See also OCINumCols, OCIColumnName, - and OCIColumnSize. - - - OCIParse - Parse a query and return a statement + Analizza una query e restituisce un'istruzione. - Description + Descrizione int OCIParse @@ -1280,40 +1488,54 @@ - OCIParse parses the query - using conn. It returns true if the query is - valid, false if not. The query can be any valid - SQL statement. + OCIParse analizza la + query rispetto alla connessione conn. + Restituisce un identificatore di istruzione se la query e' valida, + falso altrimenti. La query puo' essere qualsiasi + comando SQL. + OCIError - Return the last error of stmt|conn|global. - If no error happened returns false. + Restituisce l'ultimo errore di stmt|conn|global. + Se non c'e' stato errire, restituisce falso. - Description + Descrizione array OCIError - int stmt|conn + int + stmt|conn|global + - OCIError returns the last error found. If the optional - stmt|conn is not provided, the last error encountered - is returned. If no error is found, OCIError returns false. + OCIError restituisce l'ultimo errore. Se + il parametro opzionale stmt|conn|global non e' + specificato, viene restituito l'ultimo errore generato. Se non ci sono + errori, OCIError restituisce + falso. OCIError restituisce l'errore in un + array associativo. In questo array, code + da' il codice d'errora oracle e message + da' la stringa d'errore. + + OCIInternalDebug - Enables or disables internal debug output. By default it is disabled + + Abilita o disabilita la visualizzazione del debug interno. Di default e' + disabilitata + - Description + Descrizione void OCIInternalDebug @@ -1321,8 +1543,10 @@ - OCIInternalDebug enables internal debug output. Set onoff - to 0 to turn debug output off, 1 to turn it on. + OCIInternalDebug abilita la visualizzazione del debug interno. + Impostare onoff a 0 per spegnere + il debug, 1 per accenderlo. + @@ -1337,7 +1561,7 @@ sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil -sgml-default-dtd-file:"../manual.ced" +sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil