function _query($sql,$inputarr)
	{
		if (is_array($sql)) { // is prepared sql
			$stmt = $sql[1];

			// we try to bind to permanent array, so that OCIBindByName is persistent
			// and carried out once only - note that max array element size is 4000 chars
			if (is_array($inputarr)) {
				$bindpos = $sql[3];
				if (isset($this->_bind[$bindpos])) {
				// all tied up already
					$bindarr = $this->_bind[$bindpos];
				} else {
				// one statement to bind them all
					$bindarr = array();
					foreach($inputarr as $k => $v) {
						$bindarr[$k] = $v;
						OCIBindByName($stmt,":$k",$bindarr[$k],is_string($v) && strlen($v)>4000 ? -1 : 4000);
					}
					$this->_bind[$bindpos] = $bindarr;
				}
			}
		} else {
			$stmt=OCIParse($this->_connectionID,$sql);
		}

		$this->_stmt = $stmt;
		if (!$stmt) return false;

		if (defined('ADODB_PREFETCH_ROWS')) @OCISetPrefetch($stmt,ADODB_PREFETCH_ROWS);

		if (is_array($inputarr)) {
			foreach($inputarr as $k => $v) {
				if (is_array($v)) {
					if (sizeof($v) == 2) // suggested by g.giunta@libero.
						OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1]);
					else
						OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]);

					if ($this->debug==99) {
						if (is_object($v[0]))
							echo "name=:$k",' len='.$v[1],' type='.$v[2],'<br>';
						else
							echo "name=:$k",' var='.$inputarr[$k][0],' len='.$v[1],' type='.$v[2],'<br>';

					}
				} else {
					$len = -1;
					if ($v === ' ') $len = 1;
					if (isset($bindarr)) {	// is prepared sql, so no need to ocibindbyname again
						$bindarr[$k] = $v;
					} else { 				// dynamic sql, so rebind every time
						OCIBindByName($stmt,":$k",$inputarr[$k],$len);
					}
				}
			}
		}

        $this->_errorMsg = false;
		$this->_errorCode = false;
		if (OCIExecute($stmt,$this->_commit)) {
//OCIInternalDebug(1);
			if (count($this -> _refLOBs) > 0) {

				foreach ($this -> _refLOBs as $key => $value) {
					if ($this -> _refLOBs[$key]['TYPE'] == true) {
						$tmp = $this -> _refLOBs[$key]['LOB'] -> load();
						if ($this -> debug) {
							ADOConnection::outp("<b>OUT LOB</b>: LOB has been loaded. <br>");
						}
						//$_GLOBALS[$this -> _refLOBs[$key]['VAR']] = $tmp;
						$this -> _refLOBs[$key]['VAR'] = $tmp;
					} else {
                        $this->_refLOBs[$key]['LOB']->save($this->_refLOBs[$key]['VAR']);
						$this -> _refLOBs[$key]['LOB']->free();
						unset($this -> _refLOBs[$key]);
                        if ($this->debug) {
							ADOConnection::outp("<b>IN LOB</b>: LOB has been saved. <br>");
						}
                    }
				}
			}

            switch (@OCIStatementType($stmt)) {
                case "SELECT":
					return $stmt;

				case 'DECLARE':
                case "BEGIN":
                    if (is_array($sql) && !empty($sql[4])) {
						$cursor = $sql[4];
						if (is_resource($cursor)) {
							$ok = OCIExecute($cursor);
	                        return $cursor;
						}
						return $stmt;
                    } else {
						if (is_resource($stmt)) {
							OCIFreeStatement($stmt);
							return true;
						}
                        return $stmt;
                    }
                    break;
                default :
					// ociclose -- no because it could be used in a LOB?
                    return true;
            }
		}
		return false;
	}
 function _query($sql, $inputarr)
 {
     if (is_array($sql)) {
         // is prepared sql
         $stmt = $sql[1];
         // we try to bind to permanent array, so that OCIBindByName is persistent
         // and carried out once only - note that max array element size is 4000 chars
         if (is_array($inputarr)) {
             $bindpos = $sql[3];
             if (isset($this->_bind[$bindpos])) {
                 // all tied up already
                 $bindarr =& $this->_bind[$bindpos];
             } else {
                 // one statement to bind them all
                 $bindarr = array();
                 foreach ($inputarr as $k => $v) {
                     $bindarr[$k] = $v;
                     OCIBindByName($stmt, ":{$k}", $bindarr[$k], 4000);
                 }
                 $this->_bind[$bindpos] =& $bindarr;
             }
         }
     } else {
         $stmt = OCIParse($this->_connectionID, $sql);
     }
     $this->_stmt = $stmt;
     if (!$stmt) {
         return false;
     }
     if (defined('ADODB_PREFETCH_ROWS')) {
         @OCISetPrefetch($stmt, ADODB_PREFETCH_ROWS);
     }
     if (is_array($inputarr)) {
         foreach ($inputarr as $k => $v) {
             if (is_array($v)) {
                 if (sizeof($v) == 2) {
                     // suggested by g.giunta@libero.
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k][0], $v[1]);
                 } else {
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k][0], $v[1], $v[2]);
                 }
                 if ($this->debug == 99) {
                     echo "name=:{$k}", ' var=' . $inputarr[$k][0], ' len=' . $v[1], ' type=' . $v[2], '<br>';
                 }
             } else {
                 $len = -1;
                 if ($v === ' ') {
                     $len = 1;
                 }
                 if (isset($bindarr)) {
                     // is prepared sql, so no need to ocibindbyname again
                     $bindarr[$k] = $v;
                 } else {
                     // dynamic sql, so rebind every time
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k], $len);
                 }
             }
         }
     }
     $this->_errorMsg = false;
     $this->_errorCode = false;
     if (OCIExecute($stmt, $this->_commit)) {
         switch (@OCIStatementType($stmt)) {
             case "SELECT":
                 return $stmt;
             case "BEGIN":
                 if (is_array($sql) && !empty($sql[4])) {
                     $cursor = $sql[4];
                     if (is_resource($cursor)) {
                         $ok = OCIExecute($cursor);
                         return $cursor;
                     }
                     return $stmt;
                 } else {
                     if (is_resource($stmt)) {
                         OCIFreeStatement($stmt);
                         return true;
                     }
                     return $stmt;
                 }
                 break;
             default:
                 // ociclose -- no because it could be used in a LOB?
                 return true;
         }
     }
     return false;
 }
示例#3
0
 /**
  * all the RDBMS specific things needed close a DB connection
  * 
  * @access private
  */
 function _doQuery($query, $first = 0, $limit = 0, $prepared_query = 0)
 {
     $lobs = 0;
     $success = MDB_OK;
     $result = 0;
     $descriptors = array();
     if ($prepared_query) {
         $columns = '';
         $variables = '';
         for (reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, next($this->clobs[$prepared_query])) {
             $position = key($this->clobs[$prepared_query]);
             if (gettype($descriptors[$position] = @OCINewDescriptor($this->connection, OCI_D_LOB)) != 'object') {
                 $success = $this->raiseError(MDB_ERROR, NULL, NULL, 'Do query: Could not create descriptor for clob parameter');
                 break;
             }
             $columns .= ($lobs == 0 ? ' RETURNING ' : ',') . $this->prepared_queries[$prepared_query - 1]['Fields'][$position - 1];
             $variables .= ($lobs == 0 ? ' INTO ' : ',') . ':clob' . $position;
             $lobs++;
         }
         if (!MDB::isError($success)) {
             for (reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, next($this->blobs[$prepared_query])) {
                 $position = key($this->blobs[$prepared_query]);
                 if (gettype($descriptors[$position] = @OCINewDescriptor($this->connection, OCI_D_LOB)) != 'object') {
                     $success = $this->raiseError(MDB_ERROR, NULL, NULL, 'Do query: Could not create descriptor for blob parameter');
                     break;
                 }
                 $columns .= ($lobs == 0 ? ' RETURNING ' : ',') . $this->prepared_queries[$prepared_query - 1]['Fields'][$position - 1];
                 $variables .= ($lobs == 0 ? ' INTO ' : ',') . ':blob' . $position;
                 $lobs++;
             }
             $query .= $columns . $variables;
         }
     }
     if (!MDB::isError($success)) {
         if ($statement = @OCIParse($this->connection, $query)) {
             if ($lobs) {
                 for (reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, next($this->clobs[$prepared_query])) {
                     $position = key($this->clobs[$prepared_query]);
                     if (!@OCIBindByName($statement, ':clob' . $position, $descriptors[$position], -1, OCI_B_CLOB)) {
                         $success = $this->oci8RaiseError(NULL, 'Do query: Could not bind clob upload descriptor');
                         break;
                     }
                 }
                 if (!MDB::isError($success)) {
                     for (reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, next($this->blobs[$prepared_query])) {
                         $position = key($this->blobs[$prepared_query]);
                         if (!@OCIBindByName($statement, ':blob' . $position, $descriptors[$position], -1, OCI_B_BLOB)) {
                             $success = $this->oci8RaiseError(NULL, 'Do query: Could not bind blob upload descriptor');
                             break;
                         }
                     }
                 }
             }
             if (!MDB::isError($success)) {
                 if ($result = @OCIExecute($statement, $lobs == 0 && $this->auto_commit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT)) {
                     if ($lobs) {
                         for (reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, next($this->clobs[$prepared_query])) {
                             $position = key($this->clobs[$prepared_query]);
                             $clob_stream = $this->prepared_queries[$prepared_query - 1]['Values'][$position - 1];
                             for ($value = ''; !$this->endOfLOB($clob_stream);) {
                                 if ($this->readLOB($clob_stream, $data, $this->getOption('lob_buffer_length')) < 0) {
                                     $success = $this->raiseError();
                                     break;
                                 }
                                 $value .= $data;
                             }
                             if (!MDB::isError($success) && !$descriptors[$position]->save($value)) {
                                 $success = $this->oci8RaiseError(NULL, 'Do query: Could not upload clob data');
                             }
                         }
                         if (!MDB::isError($success)) {
                             for (reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, next($this->blobs[$prepared_query])) {
                                 $position = key($this->blobs[$prepared_query]);
                                 $blob_stream = $this->prepared_queries[$prepared_query - 1]['Values'][$position - 1];
                                 for ($value = ''; !$this->endOfLOB($blob_stream);) {
                                     if ($this->readLOB($blob_stream, $data, $this->getOption('lob_buffer_length')) < 0) {
                                         $success = $this->raiseError();
                                         break;
                                     }
                                     $value .= $data;
                                 }
                                 if (!MDB::isError($success) && !$descriptors[$position]->save($value)) {
                                     $success = $this->oci8RaiseError(NULL, 'Do query: Could not upload blob data');
                                 }
                             }
                         }
                     }
                     if ($this->auto_commit) {
                         if ($lobs) {
                             if (MDB::isError($success)) {
                                 if (!@OCIRollback($this->connection)) {
                                     $success = $this->oci8RaiseError(NULL, 'Do query: ' . $success->getUserinfo() . ' and then could not rollback LOB updating transaction');
                                 }
                             } else {
                                 if (!@OCICommit($this->connection)) {
                                     $success = $this->oci8RaiseError(NULL, 'Do query: Could not commit pending LOB updating transaction');
                                 }
                             }
                         }
                     } else {
                         $this->uncommitedqueries++;
                     }
                     if (!MDB::isError($success)) {
                         switch (@OCIStatementType($statement)) {
                             case 'SELECT':
                                 $result_value = intval($statement);
                                 $this->current_row[$result_value] = -1;
                                 if ($limit > 0) {
                                     $this->limits[$result_value] = array($first, $limit, 0);
                                 }
                                 $this->highest_fetched_row[$result_value] = -1;
                                 break;
                             default:
                                 $this->affected_rows = @OCIRowCount($statement);
                                 @OCIFreeCursor($statement);
                                 break;
                         }
                         $result = $statement;
                     }
                 } else {
                     return $this->oci8RaiseError($statement, 'Do query: Could not execute query');
                 }
             }
         } else {
             return $this->oci8RaiseError(NULL, 'Do query: Could not parse query');
         }
     }
     for (reset($descriptors), $descriptor = 0; $descriptor < count($descriptors); $descriptor++, next($descriptors)) {
         @OCIFreeDesc($descriptors[key($descriptors)]);
     }
     return $result;
 }
示例#4
0
 function _query($sql, $inputarr)
 {
     if (is_array($sql)) {
         // is prepared sql
         $stmt = $sql[1];
         // we try to bind to permanent array, so that OCIBindByName is persistent
         // and carried out once only - note that max array element size is 4000 chars
         if (is_array($inputarr)) {
             $bindpos = $sql[3];
             if (isset($this->_bind[$bindpos])) {
                 // all tied up already
                 $bindarr =& $this->_bind[$bindpos];
             } else {
                 // one statement to bind them all
                 $bindarr = array();
                 foreach ($inputarr as $k => $v) {
                     $bindarr[$k] = $v;
                     OCIBindByName($stmt, ":{$k}", $bindarr[$k], 4000);
                 }
                 $this->_bind[$bindpos] =& $bindarr;
             }
         }
     } else {
         $stmt = @OCIParse($this->_connectionID, $sql);
     }
     $this->_stmt = $stmt;
     if (!$stmt) {
         return false;
     }
     if (defined('ADODB_PREFETCH_ROWS')) {
         @OCISetPrefetch($stmt, ADODB_PREFETCH_ROWS);
     }
     if (is_array($inputarr)) {
         foreach ($inputarr as $k => $v) {
             if (is_array($v)) {
                 if (sizeof($v) == 2) {
                     // suggested by g.giunta@libero.
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k][0], $v[1]);
                 } else {
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k][0], $v[1], $v[2]);
                 }
             } else {
                 $len = -1;
                 if ($v === ' ') {
                     $len = 1;
                 }
                 if (isset($bindarr)) {
                     // is prepared sql, so no need to ocibindbyname again
                     $bindarr[$k] = $v;
                 } else {
                     // dynamic sql, so rebind every time
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k], $len);
                 }
             }
         }
     }
     if (OCIExecute($stmt, $this->_commit)) {
         switch (@OCIStatementType($stmt)) {
             case "SELECT":
                 return $stmt;
             case "BEGIN":
                 if (isset($sql[4])) {
                     // jlim
                     $cursor = $sql[4];
                     // jlim
                     OCIExecute($cursor);
                     return $cursor;
                 } else {
                     return $stmt;
                 }
                 break;
             default:
                 return true;
         }
         /* Now this could be an Update/Insert or Delete */
         //if (@OCIStatementType($stmt) != 'SELECT') return true;
         //return $stmt;
     }
     return false;
 }
示例#5
0
 function DoQuery($query, $first = 0, $limit = 0, $prepared_query = 0)
 {
     $lobs = 0;
     $success = 1;
     $result = 0;
     $descriptors = array();
     if ($prepared_query) {
         $columns = "";
         $variables = "";
         for (Reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, Next($this->clobs[$prepared_query])) {
             $position = Key($this->clobs[$prepared_query]);
             if (GetType($descriptors[$position] = OCINewDescriptor($this->connection, OCI_D_LOB)) != "object") {
                 $this->SetError("Do query", "Could not create descriptor for clob parameter");
                 $success = 0;
                 break;
             }
             $columns .= ($lobs == 0 ? " RETURNING " : ",") . $this->prepared_queries[$prepared_query - 1]["Fields"][$position - 1];
             $variables .= ($lobs == 0 ? " INTO " : ",") . ":clob" . $position;
             $lobs++;
         }
         if ($success) {
             for (Reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, Next($this->blobs[$prepared_query])) {
                 $position = Key($this->blobs[$prepared_query]);
                 if (GetType($descriptors[$position] = OCINewDescriptor($this->connection, OCI_D_LOB)) != "object") {
                     $this->SetError("Do query", "Could not create descriptor for blob parameter");
                     $success = 0;
                     break;
                 }
                 $columns .= ($lobs == 0 ? " RETURNING " : ",") . $this->prepared_queries[$prepared_query - 1]["Fields"][$position - 1];
                 $variables .= ($lobs == 0 ? " INTO " : ",") . ":blob" . $position;
                 $lobs++;
             }
             $query .= $columns . $variables;
         }
     }
     if ($success) {
         if ($statement = OCIParse($this->connection, $query)) {
             if ($lobs) {
                 for (Reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, Next($this->clobs[$prepared_query])) {
                     $position = Key($this->clobs[$prepared_query]);
                     if (!OCIBindByName($statement, ":clob" . $position, $descriptors[$position], -1, OCI_B_CLOB)) {
                         $this->SetOCIError("Do query", "Could not bind clob upload descriptor", OCIError($statement));
                         $success = 0;
                         break;
                     }
                 }
                 if ($success) {
                     for (Reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, Next($this->blobs[$prepared_query])) {
                         $position = Key($this->blobs[$prepared_query]);
                         if (!OCIBindByName($statement, ":blob" . $position, $descriptors[$position], -1, OCI_B_BLOB)) {
                             $this->SetOCIError("Do query", "Could not bind blob upload descriptor", OCIError($statement));
                             $success = 0;
                             break;
                         }
                     }
                 }
             }
             if ($success) {
                 if ($result = @OCIExecute($statement, $lobs == 0 && $this->auto_commit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT)) {
                     if ($lobs) {
                         for (Reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, Next($this->clobs[$prepared_query])) {
                             $position = Key($this->clobs[$prepared_query]);
                             $clob_stream = $this->prepared_queries[$prepared_query - 1]["Values"][$position - 1];
                             for ($value = ""; !MetabaseEndOfLOB($clob_stream);) {
                                 if (MetabaseReadLOB($clob_stream, $data, $this->lob_buffer_length) < 0) {
                                     $this->SetError("Do query", MetabaseLOBError($clob));
                                     $success = 0;
                                     break;
                                 }
                                 $value .= $data;
                             }
                             if ($success && !$descriptors[$position]->save($value)) {
                                 $this->SetOCIError("Do query", "Could not upload clob data", OCIError($statement));
                                 $success = 0;
                             }
                         }
                         if ($success) {
                             for (Reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, Next($this->blobs[$prepared_query])) {
                                 $position = Key($this->blobs[$prepared_query]);
                                 $blob_stream = $this->prepared_queries[$prepared_query - 1]["Values"][$position - 1];
                                 for ($value = ""; !MetabaseEndOfLOB($blob_stream);) {
                                     if (MetabaseReadLOB($blob_stream, $data, $this->lob_buffer_length) < 0) {
                                         $this->SetError("Do query", MetabaseLOBError($blob));
                                         $success = 0;
                                         break;
                                     }
                                     $value .= $data;
                                 }
                                 if ($success && !$descriptors[$position]->save($value)) {
                                     $this->SetOCIError("Do query", "Could not upload blob data", OCIError($statement));
                                     $success = 0;
                                 }
                             }
                         }
                     }
                     if ($this->auto_commit) {
                         if ($lobs) {
                             if ($success) {
                                 if (!OCICommit($this->connection)) {
                                     $this->SetOCIError("Do query", "Could not commit pending LOB updating transaction", OCIError());
                                     $success = 0;
                                 }
                             } else {
                                 if (!OCIRollback($this->connection)) {
                                     $this->SetOCIError("Do query", $this->Error() . " and then could not rollback LOB updating transaction", OCIError());
                                 }
                             }
                         }
                     } else {
                         $this->uncommitedqueries++;
                     }
                     if ($success) {
                         switch (OCIStatementType($statement)) {
                             case "SELECT":
                                 $result_value = intval($statement);
                                 $this->current_row[$result_value] = -1;
                                 if ($limit > 0) {
                                     $this->limits[$result_value] = array($first, $limit, 0);
                                 }
                                 $this->highest_fetched_row[$result_value] = -1;
                                 break;
                             default:
                                 $this->affected_rows = OCIRowCount($statement);
                                 OCIFreeCursor($statement);
                                 break;
                         }
                         $result = $statement;
                     }
                 } else {
                     $this->SetOCIError("Do query", "Could not execute query", OCIError($statement));
                 }
             }
         } else {
             $this->SetOCIError("Do query", "Could not parse query", OCIError($statement));
         }
     }
     for (Reset($descriptors), $descriptor = 0; $descriptor < count($descriptors); $descriptor++, Next($descriptors)) {
         @OCIFreeDesc($descriptors[Key($descriptors)]);
     }
     return $result;
 }
示例#6
0
 function execute_request($value_query, $value_config, $Param)
 {
     global $debug;
     //Constitution de la requete finale
     $requete = $value_query['code_sql'];
     if (!is_array($Param)) {
         eko("pb d'argument pour requete {$requete}");
     }
     while (list($key, $val) = each($Param)) {
         $searched_str = "\$" . $key;
         $requete = str_replace($searched_str, $val, $requete);
     }
     // echo $requete;
     // On place les colonnes à ramener dans un tableau $tab_cols
     if ($value_query['colonnes'] != '*' & $value_query['colonnes'] != '') {
         $tab_cols = split(",", $value_query['colonnes']);
     }
     switch ($value_config['type']) {
         case "MySQL":
             // Connexion au serveur Mysql & Execution de la requete
             // eko ( $value_config ) ;
             $conn = @mysql_connect($value_config['host'], $value_config['login'], $value_config['password']);
             if (!$conn) {
                 global $errs;
                 if ($errs) {
                     $errs->addErreur("La connexion au serveur MySQL \"" . $value_config['host'] . "\" avec l'utilisateur \"" . $value_config['login'] . "\" et le mot de passe \"*******\" a échoué.");
                 }
             }
             // eko ( "connexion : ".$value_config[login]."/".$value_config[password]."@". $value_config[host] ) ;
             $INDIC_SVC[0] = mysql_errno();
             $INDIC_SVC[1] = mysql_error();
             // pas de problème de connexion
             if (!$INDIC_SVC[0]) {
                 // execution de la raquete
                 if (!$this->forceBase) {
                     $result = @mysql_select_db($value_config['db']);
                 } else {
                     $result = @mysql_select_db($this->forceBase);
                 }
                 $result = @mysql_query($requete);
                 //echo "<h1>REQUETE : $requete</h1>";
                 $INDIC_SVC[0] = mysql_errno();
                 $INDIC_SVC[1] = mysql_error();
                 // pas de problème à l'execution de la requete
                 if (!$INDIC_SVC[0]) {
                     // Analyse du type de requete
                     if (DEBUGSQL and function_exists('eko')) {
                         eko($requete);
                     }
                     $qry_type = explode(" ", $requete);
                     switch (strtoupper($qry_type[0])) {
                         case "SELECT":
                             $nrows = mysql_num_rows($result);
                             if ($nrows) {
                                 // le nom des colonnes a ramener est *
                                 if (!isset($tab_cols)) {
                                     for ($i = 0; $i < mysql_num_fields($result); $i++) {
                                         $tab_cols[] = mysql_field_name($result, $i);
                                     }
                                 }
                                 // Maintenant On connait $tab_cols
                                 while ($record = mysql_fetch_array($result)) {
                                     // affectation dans les tableau de colonnes
                                     //jeton de debugage quand même colones
                                     unset($jeton);
                                     while (list($key, $val) = each($tab_cols)) {
                                         if (!isset($jeton[$val])) {
                                             $jeton[$val] = true;
                                         } else {
                                             $jeton[$val] = false;
                                         }
                                         if (isset(${$val})) {
                                             if ($jeton[$val]) {
                                                 ${$val} .= $record[$val] . "§";
                                                 //if ($debug) eko($val."-".$$val);
                                             }
                                         } else {
                                             ${$val} = $record[$val] . "§";
                                         }
                                     }
                                     reset($tab_cols);
                                 }
                                 //Construction des tableaux de colonnes
                                 unset($jeton);
                                 //print "********************* Tableau **********************<br>".affTab ( $tab_cols ) ;
                                 while (list($key, $val) = each($tab_cols)) {
                                     //print "/////////////////// Case ////////////////////<br>".affTab ( $jeton[$val] ) ;
                                     if (!isset($jeton[$val])) {
                                         $jeton[$val] = true;
                                     } else {
                                         $jeton[$val] = false;
                                     }
                                     if ($jeton[$val]) {
                                         // on retire le dernier |
                                         //print "<br>dollardollarval : ".$$val ;
                                         ${$val} = substr(${$val}, 0, strlen(${$val}) - 1);
                                         $resultats[$val] = explode("§", ${$val});
                                     }
                                     //if ($debug) eko($resultats[$val]);
                                 }
                             }
                             $INDIC_SVC[2] = $nrows;
                             break;
                         case "INSERT":
                             $INDIC_SVC[2] = mysql_affected_rows();
                             $INDIC_SVC[3] = mysql_insert_id();
                             break;
                         case "UPDATE":
                         case "DELETE":
                             $INDIC_SVC[2] = mysql_affected_rows();
                             break;
                     }
                 }
             }
             //mysql_close ( $conn ) ;
             break;
         case "MSSQL":
             // Connexion au serveur Mssql & Execution de la requete
             //print affTab ( $value_config ) ;
             //mssql_connect('galileo.ch-brignoles.fr','user_dim' ,'') || die ( 'hop' ) ;
             //mssql_connect("galileo","user_dim","") ||die ("Connexion impossible au serveur!");
             $conn = mssql_pconnect($value_config['host'], $value_config['login'], $value_config['password']);
             if (!$conn) {
                 global $errs;
                 if ($errs) {
                     $errs->addErreur("La connexion au serveur MsSQL \"" . $value_config['host'] . "\" avec l'utilisateur \"" . $value_config['login'] . "\" et le mot de passe \"*******\" a échoué.");
                 }
             }
             // eko ( "connexion : ".$value_config[login]."/".$value_config[password]."@". $value_config[host] ) ;
             //$INDIC_SVC[0] = mssql_get_last_message ( ) ;
             //$INDIC_SVC[1] = mssql_get_last_message ( ) ;
             // pas de problème de connexion
             if (!$INDIC_SVC[0]) {
                 // execution de la raquete
                 $result = mssql_select_db($value_config['db']);
                 $result = mssql_query($requete);
                 //echo "<h1>REQUETE : $requete</h1>";
                 //$INDIC_SVC[0] = mssql_get_last_message ( ) ;
                 //$INDIC_SVC[1] = mssql_get_last_message ( ) ;
                 // pas de problème à l'execution de la requete
                 if (!$INDIC_SVC[0]) {
                     // Analyse du type de requete
                     if (DEBUGSQL and function_exists('eko')) {
                         eko($requete);
                     }
                     $qry_type = explode(" ", $requete);
                     switch (strtoupper($qry_type[0])) {
                         case "SELECT":
                             $nrows = mssql_num_rows($result);
                             //eko ( "nombre de lignes : $nrows" ) ;
                             if ($nrows) {
                                 // le nom des colonnes a ramener est *
                                 if (!isset($tab_cols)) {
                                     for ($i = 0; $i < mssql_num_fields($result); $i++) {
                                         $tab_cols[] = mssql_field_name($result, $i);
                                     }
                                 }
                                 // Maintenant On connait $tab_cols
                                 while ($record = mssql_fetch_array($result)) {
                                     // affectation dans les tableau de colonnes
                                     //jeton de debugage quand même colones
                                     unset($jeton);
                                     while (list($key, $val) = each($tab_cols)) {
                                         if (!isset($jeton[$val])) {
                                             $jeton[$val] = true;
                                         } else {
                                             $jeton[$val] = false;
                                         }
                                         if (isset(${$val})) {
                                             if ($jeton[$val]) {
                                                 ${$val} .= $record[$val] . "§";
                                                 // eko ( $record[$val] ) ;
                                                 //if ($debug) eko($val."-".$$val);
                                             }
                                         } else {
                                             ${$val} = $record[$val] . "§";
                                         }
                                     }
                                     reset($tab_cols);
                                 }
                                 // Construction des tableaux de colonnes
                                 unset($jeton);
                                 while (list($key, $val) = each($tab_cols)) {
                                     if (!isset($jeton[$val])) {
                                         $jeton[$val] = true;
                                     } else {
                                         $jeton[$val] = false;
                                     }
                                     if ($jeton[$val]) {
                                         // on retire le dernier |
                                         //print "<br>dollardollarval : ".$$val ;
                                         ${$val} = substr(${$val}, 0, strlen(${$val}) - 1);
                                         $resultats[$val] = explode("§", ${$val});
                                     }
                                     //if ($debug) eko($resultats[$val]);
                                 }
                             }
                             $INDIC_SVC[2] = $nrows;
                             break;
                         case "INSERT":
                             //$INDIC_SVC[2] = mssql_affected_rows ( ) ;
                             //$INDIC_SVC[3] = mssql_insert_id ( ) ;
                             break;
                         case "UPDATE":
                         case "DELETE":
                             //$INDIC_SVC[2] = mssql_affected_rows ( ) ;
                             break;
                     }
                 }
             }
             mssql_close($conn);
             break;
         case "ORACLE":
             //echo "oracle";
             // Connexion
             // eko ($value_config);
             //      $conn = @OCILogon ( $value_config['login'], $value_config['password'], $value_config['db'] ) ;
             $conn = @oci_pconnect($value_config['login'], $value_config['password'], $value_config['db']);
             //global $conn ;
             $conn_error = ocierror();
             // Problème à la connexion
             if ($conn_error) {
                 $INDIC_SVC[0] = $conn_error['code'];
                 $INDIC_SVC[1] = $conn_error['message'];
                 // pas de problème de connexion
             } else {
                 // print $requete;
                 // execution de la raquete
                 $stmt = OCIParse($conn, $requete);
                 // print ( $requete ) ;
                 if (DEBUGSQL and function_exists('eko')) {
                     eko($requete);
                 }
                 OCIExecute($stmt);
                 $INDIC_SVC[0] = $conn_error['code'];
                 $INDIC_SVC[1] = $conn_error['message'];
                 // pas de problème à l'execution de la requete
                 if (!$INDIC_SVC[0]) {
                     // Analyse du type de requete
                     $qry_type = OCIStatementType($stmt);
                     switch ($qry_type) {
                         case "SELECT":
                             $nrows = OCIFetchStatement($stmt, $results);
                             // eko ( "<P>There are $nrows records containing your criteria. ($requete)</P>" ) ;
                             if ($nrows) {
                                 // le nom des colonnes a ramener n'a pas été spécifié ou est *
                                 if (!isset($tab_cols)) {
                                     $ncols = OCINumCols($stmt);
                                     for ($k = 1; $k <= $ncols; $k++) {
                                         $tab_cols[] = OCIColumnName($stmt, $k);
                                     }
                                 }
                                 for ($j = 0; $j < $nrows; $j++) {
                                     if (isset($tab_cols) and is_array($tab_cols)) {
                                         while (list($key, $val) = each($tab_cols)) {
                                             if (isset(${$val})) {
                                                 ${$val} .= $results[$val][$j] . "§";
                                             } else {
                                                 ${$val} = $results[$val][$j] . "§";
                                             }
                                         }
                                     }
                                     reset($tab_cols);
                                 }
                             }
                             //Construction des tableaux de colonnes
                             if (isset($tab_cols) and is_array($tab_cols)) {
                                 while (list($key, $val) = each($tab_cols)) {
                                     // on retire le dernier |
                                     ${$val} = substr(${$val}, 0, strlen(${$val}) - 1);
                                     $resultats[$val] = explode("§", ${$val});
                                 }
                             }
                             $INDIC_SVC[2] = $nrows;
                             break;
                         case "INSERT":
                             $nrows = OCIRowCount($stmt);
                             $INDIC_SVC[2] = $nrows;
                             break;
                         case "UPDATE":
                         case "DELETE":
                             $nrows = OCIRowCount($stmt);
                             $INDIC_SVC[2] = $nrows;
                             break;
                     }
                 }
             }
             oci_close($conn);
             break;
         case "LDAP":
             // Connexion au serveur LDAP
             $ds = @ldap_connect($value_config['host']);
             $bind = @ldap_bind($ds);
             if ($ds) {
                 // On eclate les instructions LDAP dans un tableau
                 $instructions_ldap = explode("##", $requete);
                 $chemin = $instructions_ldap[0];
                 $filtre = $instructions_ldap[1];
                 // Fin de gestion du code sql
                 // Execution de la requete
                 $sr = ldap_search($ds, $chemin, $filtre);
                 // le nom des colonnes a ramener n'a pas été spécifié ou est *
                 if (!isset($tab_cols)) {
                     $entry = ldap_first_entry($ds, $sr);
                     $attrs = ldap_get_attributes($ds, $entry);
                     for ($l = 0; $l < sizeof($attrs); $l++) {
                         $tab_cols[] = $attrs[$l];
                     }
                 }
                 $result = ldap_get_entries($ds, $sr);
                 for ($i = 0; $i < $result["count"]; $i++) {
                     // test des attributs multivalués
                     while (list($key, $val) = each($tab_cols)) {
                         for ($v = 0; $v < sizeof($result[$i][$val]); $v++) {
                             if ($result[$i][$val][$v] != "") {
                                 if ($v == 0) {
                                     $separateur = "";
                                 } else {
                                     $separateur = "##";
                                 }
                                 $valeur_brut = explode(",", $result[$i][$val][$v]);
                                 if ($valeur_brut[1]) {
                                     $valeur_pure = explode("cn=", $valeur_brut[0]);
                                 } else {
                                     $valeur_pure[1] = $result[$i][$val][$v];
                                 }
                                 ${$val} .= $separateur . $valeur_pure[1];
                             }
                         }
                         ${$val} .= ",";
                     }
                     reset($tab_cols);
                 }
                 // Construction des tableaux de colonnes
                 while (list($key, $val) = each($tab_cols)) {
                     // on retire la dernière virgule
                     ${$val} = substr(${$val}, 0, strlen(${$val}) - 1);
                     $resultats[$val] = explode(",", ${$val});
                 }
             }
             $INDIC_SVC[0] = ldap_errno($ds);
             $INDIC_SVC[1] = ldap_error($ds);
             $INDIC_SVC[2] = $result["count"];
             break;
     }
     $INDIC_SVC[15] = $requete;
     if (isset($Param['RIFIFI'])) {
         echo "indicsvc[0]:{$INDIC_SVC['0']}<br>indicsvc[1]:{$INDIC_SVC['1']}<br>indicsvc[2]:{$INDIC_SVC['2']}<br>indicsvc[3]:{$INDIC_SVC['3']}<br>indicsvc[15]:{$INDIC_SVC['15']}<br>\n";
     }
     $resultats['INDIC_SVC'] = $INDIC_SVC;
     return $resultats;
 }