begin process at 2012 05 31 02:08:15
  Trouver un code source :
 
dans
 
Accueil > Forum > 

PHP

 > 

Base de données

 > 

MySQL

 > 

Problème lors de la mise ligne de mon site web


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Problème lors de la mise ligne de mon site web

lundi 30 mai 2011 à 16:10:36 | Problème lors de la mise ligne de mon site web

massbbc

Bonjour à tous!
j'ai réalisé un site web en php4 avec des formulaires d'enregistrement(Base de donnée Mysql) qui marche correctement en local. Cependant lorsque je le met en ligne il ya un message d'erreur qui s'affiche :
Message d'erreur:
Fatal error: Call to undefined method tNG_fields::tNG_fields() in /home/xxxx/yyyyy/includes/tng/tNG_custom.class.php on line 19
je vous met le code d'un de mes formulaire et le fichier(tNG_custom.class.php). Merci de m'aider car je planche dessus depuis une semaine mais je n'ai aucune solution.
Formulaire d’insertion :
Code PHP :
<?php
//Connection statement
require_once('../Connections/connect.php');

// Load the common classes
require_once('../includes/common/KT_common.php');

// Load the tNG classes
require_once('../includes/tng/tNG.inc.php');

// Load the KT_back class
require_once('../includes/nxt/KT_back.php');

// Make a transaction dispatcher instance
$tNGs = new tNG_dispatcher("../");

//Start Restrict Access To Page
$restrict = new tNG_RestrictAccess($connect, "../");
//Grand Levels: Level
$restrict->addLevel("1");
$restrict->addLevel("2");
$restrict->Execute();
//End Restrict Access To Page

// Start trigger
$formValidation = new tNG_FormValidation();
$formValidation->addField("date_jour", false, "date", "date", "", "", "");
$formValidation->addField("titre", false, "text", "", "", "60", "");
$formValidation->addField("resume", false, "text", "", "", "255", "");
$tNGs->prepareValidation($formValidation);
// End trigger

// Make an insert transaction instance
$ins_actualite = new tNG_multipleInsert($connect);
$tNGs->addTransaction($ins_actualite);
// Register triggers
$ins_actualite->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
$ins_actualite->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$ins_actualite->registerTrigger("END", "Trigger_Default_Redirect", 99, "../includes/nxt/back.php");
// Add columns
$ins_actualite->setTable("actualite");
$ins_actualite->addColumn("date_jour", "DATE_TYPE", "VALUE", "{now}");
$ins_actualite->addColumn("titre", "STRING_TYPE", "POST", "titre");
$ins_actualite->addColumn("resume", "STRING_TYPE", "POST", "resume");
$ins_actualite->addColumn("article", "STRING_TYPE", "POST", "article");
$ins_actualite->addColumn("auteur", "STRING_TYPE", "POST", "auteur");
$ins_actualite->addColumn("valide", "STRING_TYPE", "POST", "valide");
$ins_actualite->setPrimaryKey("id_infos", "NUMERIC_TYPE");

// Make an update transaction instance
$upd_actualite = new tNG_multipleUpdate($connect);
$tNGs->addTransaction($upd_actualite);
// Register triggers
$upd_actualite->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Update1");
$upd_actualite->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$upd_actualite->registerTrigger("END", "Trigger_Default_Redirect", 99, "../includes/nxt/back.php");
// Add columns
$upd_actualite->setTable("actualite");
$upd_actualite->addColumn("titre", "STRING_TYPE", "POST", "titre");
$upd_actualite->addColumn("resume", "STRING_TYPE", "POST", "resume");
$upd_actualite->addColumn("article", "STRING_TYPE", "POST", "article");
$upd_actualite->addColumn("auteur", "STRING_TYPE", "POST", "auteur");
$upd_actualite->addColumn("valide", "STRING_TYPE", "POST", "valide");
$upd_actualite->setPrimaryKey("id_infos", "NUMERIC_TYPE", "GET", "id_infos");

// Make an instance of the transaction object
$del_actualite = new tNG_multipleDelete($connect);
$tNGs->addTransaction($del_actualite);
// Register triggers
$del_actualite->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Delete1");
$del_actualite->registerTrigger("END", "Trigger_Default_Redirect", 99, "../includes/nxt/back.php");
// Add columns
$del_actualite->setTable("actualite");
$del_actualite->setPrimaryKey("id_infos", "NUMERIC_TYPE", "GET", "id_infos");

// Execute all the registered transactions
$tNGs->executeTransactions();

// Get the transaction recordset
$rsactualite = $tNGs->getRecordset("actualite");
$totalRows_rsactualite = $rsactualite->RecordCount();
 



 //PHP ADODB document - made with PHAkt 2.8.2?>
<html>
<head>
<title>Administration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
	margin-top: 0px;
}
-->
</style>
<link href="../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<script src="../includes/common/js/base.js" type="text/javascript"></script>
<script src="../includes/common/js/utility.js" type="text/javascript"></script>
<script src="../includes/skins/style.js" type="text/javascript"></script>
<?php echo $tNGs->displayValidationRules();?>
<script src="../includes/nxt/scripts/form.js" type="text/javascript"></script>
<script src="../includes/nxt/scripts/form.js.php" type="text/javascript"></script>
<script type="text/javascript">
$NXT_FORM_SETTINGS = {
  duplicate_buttons: false,
  show_as_grid: false,
  merge_down_value: false
}
</script>
<style type="text/css">
<!--
.Style1 {
	font-family: Tahoma;
	font-weight: bold;
	font-size: 15px;
}
-->
</style>
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="4">
  <tr>
    <td ><div align="center">
      <?php include('haut.inc.php'); ?>
    </div></td>
  </tr>
  <tr>
    <td><div align="center">      
      <table width="646" border="0" cellspacing="2">
        <tr>
          <td width="640"><div align="center" class="Style1">CREER / MODIFIER UN ARTICLE </div></td>
        </tr>
        <tr>
          <td height="474"><div align="center">
            <?php
	echo $tNGs->getErrorMsg();
?>
            <div class="KT_tng">
              <div class="KT_tngform"><form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>">
                <?php $cnt1 = 0; ?>
                  <?php
  while (!$rsactualite->EOF) { 
?>
                  <?php $cnt1++; ?>
                  <?php 
// Show IF Conditional region1 
if (@$totalRows_rsactualite > 1) {
?>
                  <h2><?php echo NXT_getResource("Record_FH"); ?> <?php echo $cnt1; ?></h2>
                  <?php } 
// endif Conditional region1
?>
                  <table cellpadding="2" cellspacing="0" class="KT_tngtable">
                    <?php 
// Show IF Conditional show_date_jour_on_insert_only 
if (@$_GET['id_infos'] == "") {
?>
                    <tr>
                      <td width="145" class="KT_th"><div align="right">Date de création:</div></td>
                      <td width="483"><?php echo KT_formatDate($rsactualite->Fields('date_jour')); ?></td>
                    </tr>
                    <?php } 
// endif Conditional show_date_jour_on_insert_only
?>
                    <tr>
                      <td class="KT_th">
                        <div align="right">
                          <label for="titre_<?php echo $cnt1; ?>">Titre:</label>
                        </div></td>
                      <td><input type="text" name="titre_<?php echo $cnt1; ?>" id="titre_<?php echo $cnt1; ?>" value="<?php echo KT_escapeAttribute($rsactualite->Fields('titre')); ?>" size="32" maxlength="100" />
                          <?php echo $tNGs->displayFieldHint("titre");?> <?php echo $tNGs->displayFieldError("actualite", "titre", $cnt1); ?> </td>
                    </tr>
                    <tr>
                      <td class="KT_th">
                        <div align="right">
                          <label for="resume_<?php echo $cnt1; ?>">Résume:</label>
                        </div></td>
                      <td><textarea name="resume_<?php echo $cnt1; ?>" id="resume_<?php echo $cnt1; ?>" cols="50" rows="5"><?php echo KT_escapeAttribute($rsactualite->Fields('resume')); ?></textarea>
                          <?php echo $tNGs->displayFieldHint("resume");?> <?php echo $tNGs->displayFieldError("actualite", "resume", $cnt1); ?> </td>
                    </tr>
                    <tr>
                      <td class="KT_th">
                        <div align="right">
                          <label for="article_<?php echo $cnt1; ?>">Article:</label>
                        </div></td>
                      <td><textarea name="article_<?php echo $cnt1; ?>" id="article_<?php echo $cnt1; ?>" cols="90" rows="15"><?php echo KT_escapeAttribute($rsactualite->Fields('article')); ?></textarea>
                          <?php echo $tNGs->displayFieldHint("article");?> <?php echo $tNGs->displayFieldError("actualite", "article", $cnt1); ?> </td>
                    </tr>
                    <tr>
                      <td class="KT_th">
                        <div align="right">
                          <label for="valide_<?php echo $cnt1; ?>_1">Valide:</label>
                        </div></td>
                      <td><div>
                          <input <?php if (!(strcmp(KT_escapeAttribute($rsactualite->Fields('valide')),"Afficher"))) {echo "CHECKED";} ?> type="radio" name="valide_<?php echo $cnt1; ?>" id="valide_<?php echo $cnt1; ?>_1" value="Afficher" />
                          <label for="valide_<?php echo $cnt1; ?>_1">Afficher</label>
                        </div>
                          <div>
                            <input name="valide_<?php echo $cnt1; ?>" type="radio" id="valide_<?php echo $cnt1; ?>_2" value="Ne Pas Afficher" checked <?php if (!(strcmp(KT_escapeAttribute($rsactualite->Fields('valide')),"Ne Pas Afficher"))) {echo "CHECKED";} ?> />
                            <label for="valide_<?php echo $cnt1; ?>_2">Ne Pas Afficher</label>
                          </div>
                          <?php echo $tNGs->displayFieldError("actualite", "valide", $cnt1); ?> </td>
                    </tr>
                  </table>
                  <input type="hidden" name="kt_pk_actualite_<?php echo $cnt1; ?>" class="id_field" value="<?php echo KT_escapeAttribute($rsactualite->Fields('kt_pk_actualite')); ?>" />
                  <input type="hidden" name="auteur_<?php echo $cnt1; ?>" id="auteur_<?php echo $cnt1; ?>" value="<?php echo KT_escapeAttribute($rsactualite->Fields('auteur')); ?>" />
                  <?php
    $rsactualite->MoveNext(); 
  }
?>
                  <div class="KT_bottombuttons">
                    <div>
                      <?php 
      // Show IF Conditional region1 
      if (@$_GET['id_infos'] == "") {
      ?>
                      <input type="submit" name="KT_Insert1" id="KT_Insert1" value="<?php echo NXT_getResource("Insert_FB"); ?>" />
                      <?php 
      // else Conditional region1
      } else { ?>
                      <input type="submit" name="KT_Update1" value="<?php echo NXT_getResource("Update_FB"); ?>" />
                      <input type="submit" name="KT_Delete1" value="<?php echo NXT_getResource("Delete_FB"); ?>" onclick="return confirm('<?php echo NXT_getResource("Are you sure?"); ?>');" />
                      <?php } 
      // endif Conditional region1
      ?>
                      <input type="button" name="KT_Cancel1" value="<?php echo NXT_getResource("Cancel_FB"); ?>" onclick="return UNI_navigateCancel(event, '../includes/nxt/back.php')" />
                    </div>
                  </div>
                </form>
              </div>
              </div>
            </div></td>
        </tr>
      </table>
      <p>&nbsp;</p>
    </div></td>
  </tr>
</table>
</body>
</html>


Fichier: tNG_custom.class.php

Code PHP :
<?php
/*
	Copyright (c) InterAKT Online 2000-2005
*/

/**
 * This class is the "custom" implementation of the tNG_fields class.
 * @access public
 */
class tNG_custom extends tNG_fields {

	/**
	 * Constructor. Sets the connection, the database name and other default values.
	 * Also sets the transaction type.
	 * @param object KT_Connection &$connection the connection object
	 * @access public
	 */
	function tNG_custom(&$connection) {
		parent::tNG_fields($connection);
		$this->transactionType = '_custom';
		$this->setTable("custom");
		$this->exportRecordset = true;
	}
	
	/**
	 * Prepares the custom SQL query to be executed
	 * @access protected
	 */
	function prepareSQL() {
		tNG_log::log('tNG_custom', 'prepareSQL', 'begin');
		parent::prepareSQL();
		$sql = KT_DynamicData($this->sql, $this, "SQL");
		$this->setSQL($sql);
		tNG_log::log('tNG_custom', 'prepareSQL', 'end');
		return null;
	}
	
	/**
	 * Get the local recordset associated to this transaction
	 * @return object resource Recordset resource
	 * @access protected
	 */
	function getLocalRecordset() {
		tNG_log::log('tNG_custom', 'getLocalRecordset');
		$fakeArr = array();
		$tmpArr = $this->columns;
		foreach($tmpArr as $colName=>$colDetails) {
			$tmpVal = KT_escapeForSql($colDetails['default'], $colDetails['type'], true);
			$fakeArr[$colName] = $tmpVal;
		}
		return $this->getFakeRecordset($fakeArr);
	}
	
	/**
	 * Adds a column to the transaction
	 * Calls the parent addColumn method then sets the default value.
	 * @param string $colName The column name
	 * @param string $type The column type (NUMERYC_TYPE, STRING_TYPE, etc)
	 * @param string $method The request method (GET, POST, FILE, COOKIE, SESSION)
	 * @param string $reference The submitted variable name (if method=GET and reference=test, value=$_GET['test'])
	 * @param string $defaultValue The default value for the current column
	 * @access public
	 */
	function addColumn($colName, $type, $method, $reference, $defaultValue = '') {
		parent::addColumn($colName, $type, $method, $reference);
		$this->columns[$colName]['default'] = $defaultValue;
	}
}
?>
lundi 30 mai 2011 à 20:41:07 | Re : Problème lors de la mise ligne de mon site web

cod57

bonjour

tNG_custom.class.php
appelle
parent::tNG_fields($connection);
y a t'il une $connection ?
quelle sont les valeurs de $connection
si c'est un array
dans
tNG_fields
surement que tu dois personnaliser des variables

a++


Bonne programmation !
mardi 31 mai 2011 à 12:51:37 | Re : Problème lors de la mise ligne de mon site web

massbbc

Effectivement j'ai un fichier de connexion. Ci-dessous le code de mon fichier servant a faire mes connexion.

[b]fichier:[/b] connect.php
Code PHP :
<?php 
	# PHP ADODB document - made with PHAkt
	# FileName="Connection_php_adodb.htm"
	# Type="ADODB"
	# HTTP="true"
	# DBTYPE="mysql"
	
	$MM_connect_HOSTNAME = "localhost";
	$MM_connect_DATABASE = "mysql:base_cpa";
	$MM_connect_DBTYPE   = preg_replace("/:.*$/", "", $MM_connect_DATABASE);
	$MM_connect_DATABASE = preg_replace("/^.*?:/", "", $MM_connect_DATABASE);
	$MM_connect_USERNAME = "root";
	$MM_connect_PASSWORD = "";
	$MM_connect_LOCALE = "Fr";
	$MM_connect_MSGLOCALE = "Fr";
	$MM_connect_CTYPE = "P";
	$KT_locale = $MM_connect_MSGLOCALE;
	$KT_dlocale = $MM_connect_LOCALE;
	$KT_serverFormat = "%Y-%m-%d %H:%M:%S";
	$QUB_Caching = "false";
	
	switch (strtoupper ($MM_connect_LOCALE)) {
		case 'EN':
				$KT_localFormat = "%d-%m-%Y %H:%M:%S";
		break;
		case 'EUS':
				$KT_localFormat = "%m-%d-%Y %H:%M:%S";
		break;
		case 'FR':
				$KT_localFormat = "%d-%m-%Y %H:%M:%S";
		break;
		case 'RO':
				$KT_localFormat = "%d-%m-%Y %H:%M:%S";
		break;
		case 'IT':
				$KT_localFormat = "%d-%m-%Y %H:%M:%S";
		break;
		case 'GE':
				$KT_localFormat = "%d.%m.%Y %H:%M:%S";
		break;
		case 'US':
				$KT_localFormat = "%Y-%m-%d %H:%M:%S";
		break;
		default :
				$KT_localFormat = "none";			
	}


	
	if (!defined('CONN_DIR')) define('CONN_DIR',dirname(__FILE__));
	require_once(CONN_DIR."/../adodb/adodb.inc.php");
	ADOLoadCode($MM_connect_DBTYPE);
	$connect=&ADONewConnection($MM_connect_DBTYPE);

	if($MM_connect_DBTYPE == "access" || $MM_connect_DBTYPE == "odbc"){
		if($MM_connect_CTYPE == "P"){
			$connect->PConnect($MM_connect_DATABASE, $MM_connect_USERNAME,$MM_connect_PASSWORD, 
			$MM_connect_LOCALE);
		} else $connect->Connect($MM_connect_DATABASE, $MM_connect_USERNAME,$MM_connect_PASSWORD, 
			$MM_connect_LOCALE);
	} else if (($MM_connect_DBTYPE == "ibase") or ($MM_connect_DBTYPE == "firebird")) {
		if($MM_connect_CTYPE == "P"){
			$connect->PConnect($MM_connect_HOSTNAME.":".$MM_connect_DATABASE,$MM_connect_USERNAME,$MM_connect_PASSWORD);
		} else $connect->Connect($MM_connect_HOSTNAME.":".$MM_connect_DATABASE,$MM_connect_USERNAME,$MM_connect_PASSWORD);
	}else {
		if($MM_connect_CTYPE == "P"){
			$connect->PConnect($MM_connect_HOSTNAME,$MM_connect_USERNAME,$MM_connect_PASSWORD,
   			$MM_connect_DATABASE,$MM_connect_LOCALE);
		} else $connect->Connect($MM_connect_HOSTNAME,$MM_connect_USERNAME,$MM_connect_PASSWORD,
   			$MM_connect_DATABASE,$MM_connect_LOCALE);
   }

	if (!function_exists("updateMagicQuotes")) {
		function updateMagicQuotes($HTTP_VARS){
			if (is_array($HTTP_VARS)) {
				foreach ($HTTP_VARS as $name=>$value) {
					if (!is_array($value)) {
						$HTTP_VARS[$name] = addslashes($value);
					} else {
						foreach ($value as $name1=>$value1) {
							if (!is_array($value1)) {
								$HTTP_VARS[$name1][$value1] = addslashes($value1);
							}
						}
						
					}
					global $$name;
					$$name = &$HTTP_VARS[$name];
				}
			}
			return $HTTP_VARS;
		}
		
		if (!get_magic_quotes_gpc()) {
			$HTTP_GET_VARS = updateMagicQuotes($HTTP_GET_VARS);
			$HTTP_POST_VARS = updateMagicQuotes($HTTP_POST_VARS);
			$HTTP_COOKIE_VARS = updateMagicQuotes($HTTP_COOKIE_VARS);
		}
	}
	if (!isset($HTTP_SERVER_VARS['REQUEST_URI'])) {
		$HTTP_SERVER_VARS['REQUEST_URI'] = $HTTP_SERVER_VARS['PHP_SELF'];
	}
?>
mardi 31 mai 2011 à 13:21:55 | Re : Problème lors de la mise ligne de mon site web

cod57

bonjour
il faut personnaliser ici
pour ton serveur distant
est il en php4 ou php5 ?
si il est en php5 un gros travail de mise à jour t'attend
sinon erreur sur erreur

$MM_connect_HOSTNAME = "localhost";/*non serveur distant*/
$MM_connect_DATABASE = "mysql:base_cpa";/*non base distante*/
$MM_connect_DBTYPE = preg_replace("/:.*$/", "", $MM_connect_DATABASE);
$MM_connect_DATABASE = preg_replace("/^.*?:/", "", $MM_connect_DATABASE);
$MM_connect_USERNAME = "root";/*login utilisateur*/
$MM_connect_PASSWORD = ""; /*mot de passe*/

a++
Bonne programmation !
mardi 31 mai 2011 à 13:36:59 | Re : Problème lors de la mise ligne de mon site web

massbbc

je ne sais pas ce que tu veux dire par personnaliser mais chez mon hébergeur voici les paramètre que j'ai mis:
Code PHP :
$MM_connect_HOSTNAME = "localhost";
	$MM_connect_DATABASE = "mysql:yyyy_dbxxx";
	$MM_connect_DBTYPE   = preg_replace("/:.*$/", "", $MM_connect_DATABASE);
	$MM_connect_DATABASE = preg_replace("/^.*?:/", "", $MM_connect_DATABASE);
	$MM_connect_USERNAME = "username";
	$MM_connect_PASSWORD = "passwd";


Est-ce qu'il faut changer le "localhost" ?
mardi 31 mai 2011 à 14:51:57 | Re : Problème lors de la mise ligne de mon site web

cod57

changer localhost ?
sans doute
faut voir qui est ton hebergeur
normalement tu as une adresse qu'il te fournit
ex chez free ex: sql.free.fr

je ferai un petit script
pour connaitre la version du serveur php
et l'état de la connection
test.php
<?php
$hostname="localhost"; /*ou ? ce que l'on t'a donné*/
$username="????"; /*ou ? ce que l'on t'a donné*/
$password="?????"; /*ou ? ce que l'on t'a donné*/
$db="ta_base"; /*ou ? ce que l'on t'a donné*/
/////////ne pas toucher plus bas//////////////////////
@$link=mysql_connect($hostname,$username,$password);
@$bdd=mysql_select_db($db,$link);

if($link){
echo 'accés serveur ok!!<br />';
}else{
echo 'accés serveur pas possible !<br />';
echo mysql_error().'<br />';
}
if($bdd){
echo 'accés base ok!!<br />';
}else{
echo 'accés base pas possible !<br />';
echo mysql_error().'<br />';
}
echo '<br />Serveur php version '.phpversion();
/*ou*/
phpinfo();
?>


Bonne programmation !
mardi 31 mai 2011 à 15:17:58 | Re : Problème lors de la mise ligne de mon site web

massbbc

J'ai fait le test sur mon serveur distant que tu m'a demandé et voici le résultat:

accés serveur ok!!
accés base ok!!
Serveur php version 5.3.1

je souligne que le localhost n'as pas été modifié je l'ai laissé com tel.
Je ne comprend donc plus ce ki se passe. J'ai demandé sur un foruùm et on m'a dis que le localhost ne change pas en général.
Merci pour ton aide
mardi 31 mai 2011 à 15:36:05 | Re : Problème lors de la mise ligne de mon site web

cod57

Réponse acceptée !

donc ta connection est ok
php 5.3
et ton script en php 4
là il y a un prob avec les variables
$http_post_var ... en php4 -> $_POST EN PHP5 ...
register_globals ... faut passer à 'on' en php5
car c'est désactivé pour des raisons de sécurité
en fait un gros travail de mise à jour

as tu
activer le rapport erreur php
en haut des fichiers à problemes
<?php
error_reporting(E_ALL);
ini_set('display_errors','On');
puis tu enleves si tout est resolu




Bonne programmation !
mardi 31 mai 2011 à 17:14:58 | Re : Problème lors de la mise ligne de mon site web

massbbc


Comment passé à "on" sur en php 5.
jai mis le bout de code dans ma page accueil(index.php) et voici les erreurs que j'obtient:
Deprecated: Assigning the return value of new by reference is deprecated in /home/xxxxx/public_html/adodb/adodb.inc.php on line 858

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxxxx/public_html/adodb/adodb.inc.php on line 864

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxxxx/public_html/adodb/adodb.inc.php on line 1171

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxxxx/public_html/adodb/adodb.inc.php on line 1971

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxxxx/public_html/adodb/adodb.inc.php on line 3033

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxxxx/public_html/adodb/adodb.inc.php on line 3597

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxxxx/public_html/adodb/adodb.inc.php on line 3671

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxxxx/public_html/adodb/adodb.inc.php on line 3690

Fatal error: Call to undefined method tNG_fields::tNG_fields() in /home/xxxxx/public_html/includes/tng/tNG_custom.class.php on line 22



mardi 31 mai 2011 à 17:16:17 | Re : Problème lors de la mise ligne de mon site web

massbbc

ci-dessous le fichier: adodb.inc.php

Code PHP :
<?php 
/*
 * Set tabs to 4 for best viewing.
 * 
 * Latest version is available at http://adodb.sourceforge.net
 * 
 * This is the main include file for ADOdb.
 * Database specific drivers are stored in the adodb/drivers/adodb-*.inc.php
 *
 * The ADOdb files are formatted so that doxygen can be used to generate documentation.
 * Doxygen is a documentation generation tool and can be downloaded from http://doxygen.org/
 */

/**
	\mainpage 	
	
	 @version V4.52 10 Aug 2004  (c) 2000-2004 John Lim (jlim\@natsoft.com.my). All rights reserved.

	Released under both BSD license and Lesser GPL library license. You can choose which license
	you prefer.
	
	PHP's database access functions are not standardised. This creates a need for a database 
	class library to hide the differences between the different database API's (encapsulate 
	the differences) so we can easily switch databases.

	We currently support MySQL, Oracle, Microsoft SQL Server, Sybase, Sybase SQL Anywhere, DB2,
	Informix, PostgreSQL, FrontBase, Interbase (Firebird and Borland variants), Foxpro, Access,
	ADO, SAP DB, SQLite and ODBC. We have had successful reports of connecting to Progress and
	other databases via ODBC. 
	 
	Latest Download at http://php.weblogs.com/adodb<br>
	Manual is at http://php.weblogs.com/adodb_manual
	  
 */
 
 if (!defined('_ADODB_LAYER')) {
 	define('_ADODB_LAYER',1);
	
	//==============================================================================================	
	// CONSTANT DEFINITIONS
	//==============================================================================================	


	/** 
	 * Set ADODB_DIR to the directory where this file resides...
	 * This constant was formerly called $ADODB_RootPath
	 */
	if (!defined('ADODB_DIR')) define('ADODB_DIR',dirname(__FILE__));
	
	//==============================================================================================	
	// GLOBAL VARIABLES
	//==============================================================================================	

	GLOBAL 
		$ADODB_vers, 		// database version
		$ADODB_COUNTRECS,	// count number of records returned - slows down query
		$ADODB_CACHE_DIR,	// directory to cache recordsets
		$ADODB_EXTENSION,   // ADODB extension installed
		$ADODB_COMPAT_FETCH, // If $ADODB_COUNTRECS and this is true, $rs->fields is available on EOF
	 	$ADODB_FETCH_MODE;	// DEFAULT, NUM, ASSOC or BOTH. Default follows native driver default...
	
	//==============================================================================================	
	// GLOBAL SETUP
	//==============================================================================================	
	
	$ADODB_EXTENSION = defined('ADODB_EXTENSION');
	
	//********************************************************//
	/*
	Controls $ADODB_FORCE_TYPE mode. Default is ADODB_FORCE_VALUE (3).
	Used in GetUpdateSql and GetInsertSql functions. Thx to Niko, nuko#mbnet.fi

 		0 = ignore empty fields. All empty fields in array are ignored.
		1 = force null. All empty, php null and string 'null' fields are changed to sql NULL values.
		2 = force empty. All empty, php null and string 'null' fields are changed to sql empty '' or 0 values.
		3 = force value. Value is left as it is. Php null and string 'null' are set to sql NULL values and empty fields '' are set to empty '' sql values.
	*/
        define('ADODB_FORCE_IGNORE',0);
        define('ADODB_FORCE_NULL',1);
        define('ADODB_FORCE_EMPTY',2);
        define('ADODB_FORCE_VALUE',3);
    //********************************************************//


	if (!$ADODB_EXTENSION || ADODB_EXTENSION < 4.0) {
		
		define('ADODB_BAD_RS','<p>Bad $rs in %s. Connection or SQL invalid. Try using $connection->debug=true;</p>');
	
	// allow [ ] @ ` " and . in table names
		define('ADODB_TABLE_REGEX','([]0-9a-z_\"\`\.\@\[-]*)');
	
	// prefetching used by oracle
		if (!defined('ADODB_PREFETCH_ROWS')) define('ADODB_PREFETCH_ROWS',10);
	
	
	/*
	Controls ADODB_FETCH_ASSOC field-name case. Default is 2, use native case-names.
	This currently works only with mssql, odbc, oci8po and ibase derived drivers.
	
 		0 = assoc lowercase field names. $rs->fields['orderid']
		1 = assoc uppercase field names. $rs->fields['ORDERID']
		2 = use native-case field names. $rs->fields['OrderID']
	*/
	
		define('ADODB_FETCH_DEFAULT',0);
		define('ADODB_FETCH_NUM',1);
		define('ADODB_FETCH_ASSOC',2);
		define('ADODB_FETCH_BOTH',3);
		
		if (!defined('TIMESTAMP_FIRST_YEAR')) define('TIMESTAMP_FIRST_YEAR',100);
	
		// PHP's version scheme makes converting to numbers difficult - workaround
		$_adodb_ver = (float) PHP_VERSION;
		if ($_adodb_ver >= 5.0) {
			define('ADODB_PHPVER',0x5000);
		} else if ($_adodb_ver > 4.299999) { # 4.3
			define('ADODB_PHPVER',0x4300);
		} else if ($_adodb_ver > 4.199999) { # 4.2
			define('ADODB_PHPVER',0x4200);
		} else if (strnatcmp(PHP_VERSION,'4.0.5')>=0) {
			define('ADODB_PHPVER',0x4050);
		} else {
			define('ADODB_PHPVER',0x4000);
		}
	}
	
	//if (!defined('ADODB_ASSOC_CASE')) define('ADODB_ASSOC_CASE',2);
	
	
	/**
	 	Accepts $src and $dest arrays, replacing string $data
	*/
	function ADODB_str_replace($src, $dest, $data)
	{
		if (ADODB_PHPVER >= 0x4050) return str_replace($src,$dest,$data);
		
		$s = reset($src);
		$d = reset($dest);
		while ($s !== false) {
			$data = str_replace($s,$d,$data);
			$s = next($src);
			$d = next($dest);
		}
		return $data;
	}
	
	function ADODB_Setup()
	{
	GLOBAL 
		$ADODB_vers, 		// database version
		$ADODB_COUNTRECS,	// count number of records returned - slows down query
		$ADODB_CACHE_DIR,	// directory to cache recordsets
	 	$ADODB_FETCH_MODE,
		$ADODB_FORCE_TYPE;
		
		$ADODB_FETCH_MODE = ADODB_FETCH_DEFAULT;
		$ADODB_FORCE_TYPE = ADODB_FORCE_VALUE;

		
		if (!isset($ADODB_CACHE_DIR)) {
			$ADODB_CACHE_DIR = '/tmp'; //(isset($_ENV['TMP'])) ? $_ENV['TMP'] : '/tmp';
		} else {
			// do not accept url based paths, eg. http:/ or ftp:/
			if (strpos($ADODB_CACHE_DIR,'://') !== false) 
				die("Illegal path http:// or ftp://");
		}
		
			
		// Initialize random number generator for randomizing cache flushes
		srand(((double)microtime())*1000000);
		
		/**
		 * ADODB version as a string.
		 */
		$ADODB_vers = 'V4.52 10 Aug 2004  (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.';
	
		/**
		 * Determines whether recordset->RecordCount() is used. 
		 * Set to false for highest performance -- RecordCount() will always return -1 then
		 * for databases that provide "virtual" recordcounts...
		 */
		if (!isset($ADODB_COUNTRECS)) $ADODB_COUNTRECS = true; 
	}
	
	
	//==============================================================================================	
	// CHANGE NOTHING BELOW UNLESS YOU ARE DESIGNING ADODB
	//==============================================================================================	
	
	ADODB_Setup();

	//==============================================================================================	
	// CLASS ADOFieldObject
	//==============================================================================================	
	/**
	 * Helper class for FetchFields -- holds info on a column
	 */
	class ADOFieldObject { 
		var $name = '';
		var $max_length=0;
		var $type="";

		// additional fields by dannym... (danny_milo@yahoo.com)
		var $not_null = false; 
		// actually, this has already been built-in in the postgres, fbsql AND mysql module? ^-^
		// so we can as well make not_null standard (leaving it at "false" does not harm anyways)

		var $has_default = false; // this one I have done only in mysql and postgres for now ... 
			// others to come (dannym)
		var $default_value; // default, if any, and supported. Check has_default first.
	}
	

	
	function ADODB_TransMonitor($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection)
	{
		//print "Errorno ($fn errno=$errno m=$errmsg) ";
		$thisConnection->_transOK = false;
		if ($thisConnection->_oldRaiseFn) {
			$fn = $thisConnection->_oldRaiseFn;
			$fn($dbms, $fn, $errno, $errmsg, $p1, $p2,$thisConnection);
		}
	}
	
	//==============================================================================================	
	// CLASS ADOConnection
	//==============================================================================================	
	
	/**
	 * Connection object. For connecting to databases, and executing queries.
	 */ 
	class ADOConnection {
	//
	// PUBLIC VARS 
	//
	var $dataProvider = 'native';
	var $databaseType = '';		/// RDBMS currently in use, eg. odbc, mysql, mssql					
	var $database = '';			/// Name of database to be used.	
	var $host = ''; 			/// The hostname of the database server	
	var $user = ''; 			/// The username which is used to connect to the database server. 
	var $password = ''; 		/// Password for the username. For security, we no longer store it.
	var $debug = false; 		/// if set to true will output sql statements
	var $maxblobsize = 256000; 	/// maximum size of blobs or large text fields -- some databases die otherwise like foxpro
	var $concat_operator = '+'; /// default concat operator -- change to || for Oracle/Interbase	
	var $substr = 'substr';		/// substring operator
	var $length = 'length';		/// string length operator
	var $random = 'rand()';		/// random function
	var $upperCase = 'upper';		/// uppercase function
	var $fmtDate = "'Y-m-d'";	/// used by DBDate() as the default date format used by the database
	var $fmtTimeStamp = "'Y-m-d, h:i:s A'"; /// used by DBTimeStamp as the default timestamp fmt.
	var $true = '1'; 			/// string that represents TRUE for a database
	var $false = '0'; 			/// string that represents FALSE for a database
	var $replaceQuote = "\\'"; 	/// string to use to replace quotes
	var $nameQuote = '"';		/// string to use to quote identifiers and names
	var $charSet=false; 		/// character set to use - only for interbase
	var $metaDatabasesSQL = '';
	var $metaTablesSQL = '';
	var $uniqueOrderBy = false; /// All order by columns have to be unique
	var $emptyDate = '&nbsp;';
	var $emptyTimeStamp = '&nbsp;';
	var $lastInsID = false;
	//--
	var $hasInsertID = false; 		/// supports autoincrement ID?
	var $hasAffectedRows = false; 	/// supports affected rows for update/delete?
	var $hasTop = false;			/// support mssql/access SELECT TOP 10 * FROM TABLE
	var $hasLimit = false;			/// support pgsql/mysql SELECT * FROM TABLE LIMIT 10
	var $readOnly = false; 			/// this is a readonly database - used by phpLens
	var $hasMoveFirst = false;  /// has ability to run MoveFirst(), scrolling backwards
	var $hasGenID = false; 		/// can generate sequences using GenID();
	var $hasTransactions = true; /// has transactions
	//--
	var $genID = 0; 			/// sequence id used by GenID();
	var $raiseErrorFn = false; 	/// error function to call
	var $isoDates = false; /// accepts dates in ISO format
	var $cacheSecs = 3600; /// cache for 1 hour
	var $sysDate = false; /// name of function that returns the current date
	var $sysTimeStamp = false; /// name of function that returns the current timestamp
	var $arrayClass = 'ADORecordSet_array'; /// name of class used to generate array recordsets, which are pre-downloaded recordsets
	
	var $noNullStrings = false; /// oracle specific stuff - if true ensures that '' is converted to ' '
	var $numCacheHits = 0; 
	var $numCacheMisses = 0;
	var $pageExecuteCountRows = true;
	var $uniqueSort = false; /// indicates that all fields in order by must be unique
	var $leftOuter = false; /// operator to use for left outer join in WHERE clause
	var $rightOuter = false; /// operator to use for right outer join in WHERE clause
	var $ansiOuter = false; /// whether ansi outer join syntax supported
	var $autoRollback = false; // autoRollback on PConnect().
	var $poorAffectedRows = false; // affectedRows not working or unreliable
	
	var $fnExecute = false;
	var $fnCacheExecute = false;
	var $blobEncodeType = false; // false=not required, 'I'=encode to integer, 'C'=encode to char
	var $rsPrefix = "ADORecordSet_";
	
	var $autoCommit = true; 	/// do not modify this yourself - actually private
	var $transOff = 0; 			/// temporarily disable transactions
	var $transCnt = 0; 			/// count of nested transactions
	
	var $fetchMode=false;
	 //
	 // PRIVATE VARS
	 //
	var $_oldRaiseFn =  false;
	var $_transOK = null;
	var $_connectionID	= false;	/// The returned link identifier whenever a successful database connection is made.	
	var $_errorMsg = false;		/// A variable which was used to keep the returned last error message.  The value will
								/// then returned by the errorMsg() function	
	var $_errorCode = false;	/// Last error code, not guaranteed to be used - only by oci8					
	var $_queryID = false;		/// This variable keeps the last created result link identifier
	
	var $_isPersistentConnection = false;	/// A boolean variable to state whether its a persistent connection or normal connection.	*/
	var $_bindInputArray = false; /// set to true if ADOConnection.Execute() permits binding of array parameters.
	var $_evalAll = false;
	var $_affected = false;
	var $_logsql = false;
	

	
	/**
	 * Constructor
	 */
	function ADOConnection()			
	{
		die('Virtual Class -- cannot instantiate');
	}
	
	function Version()
	{
	global $ADODB_vers;
	
		return (float) substr($ADODB_vers,1);
	}
	
	/**
		Get server version info...
		
		@returns An array with 2 elements: $arr['string'] is the description string, 
			and $arr[version] is the version (also a string).
	*/
	function ServerInfo()
	{
		return array('description' => '', 'version' => '');
	}
	
	function _findvers($str)
	{
		if (preg_match('/([0-9]+\.([0-9\.])+)/',$str, $arr)) return $arr[1];
		else return '';
	}
	
	/**
	* All error messages go through this bottleneck function.
	* You can define your own handler by defining the function name in ADODB_OUTP.
	*/
	function outp($msg,$newline=true)
	{
	global $HTTP_SERVER_VARS,$ADODB_FLUSH,$ADODB_OUTP;
	
		if (defined('ADODB_OUTP')) {
			$fn = ADODB_OUTP;
			$fn($msg,$newline);
			return;
		} else if (isset($ADODB_OUTP)) {
			$fn = $ADODB_OUTP;
			$fn($msg,$newline);
			return;
		}
		
		if ($newline) $msg .= "<br>\n";
		
		if (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']) || !$newline) echo $msg;
		else echo strip_tags($msg);
		
		
		if (!empty($ADODB_FLUSH) && ob_get_length() !== false) flush(); //  do not flush if output buffering enabled - useless - thx to Jesse Mullan 
		
	}
	
	function Time()
	{
		$rs =& $this->_Execute("select $this->sysTimeStamp");
		if ($rs && !$rs->EOF) return $this->UnixTimeStamp(reset($rs->fields));
		
		return false;
	}
	
	/**
	 * Connect to database
	 *
	 * @param [argHostname]		Host to connect to
	 * @param [argUsername]		Userid to login
	 * @param [argPassword]		Associated password
	 * @param [argDatabaseName]	database
	 * @param [forceNew]		force new connection
	 *
	 * @return true or false
	 */	  
	function Connect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "", $forceNew = false) 
	{
		if ($argHostname != "") $this->host = $argHostname;
		if ($argUsername != "") $this->user = $argUsername;
		if ($argPassword != "") $this->password = $argPassword; // not stored for security reasons
		if ($argDatabaseName != "") $this->database = $argDatabaseName;		
		
		$this->_isPersistentConnection = false;	
		if ($forceNew) {
			if ($this->_nconnect($this->host, $this->user, $this->password, $this->database)) return true;
		} else {
			if ($this->_connect($this->host, $this->user, $this->password, $this->database)) return true;
		}
		$err = $this->ErrorMsg();
		if (empty($err)) $err = "Connection error to server '$argHostname' with user '$argUsername'";
		if ($fn = $this->raiseErrorFn) 
		        $fn($this->databaseType,'CONNECT',$this->ErrorNo(),$err,$this->host,$this->database,$this);

		if ($this->debug) ADOConnection::outp( $this->host.': '.$err);
		return false;
	}	
	
	 function _nconnect($argHostname, $argUsername, $argPassword, $argDatabaseName)
	 {
	 	return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabaseName);
	 }
	
	
	/**
	 * Always force a new connection to database - currently only works with oracle
	 *
	 * @param [argHostname]		Host to connect to
	 * @param [argUsername]		Userid to login
	 * @param [argPassword]		Associated password
	 * @param [argDatabaseName]	database
	 *
	 * @return true or false
	 */	  
	function NConnect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "") 
	{
		return $this->Connect($argHostname, $argUsername, $argPassword, $argDatabaseName, true);
	}
	
	/**
	 * Establish persistent connect to database
	 *
	 * @param [argHostname]		Host to connect to
	 * @param [argUsername]		Userid to login
	 * @param [argPassword]		Associated password
	 * @param [argDatabaseName]	database
	 *
	 * @return return true or false
	 */	
	function PConnect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "")
	{
		if (defined('ADODB_NEVER_PERSIST')) 
			return $this->Connect($argHostname,$argUsername,$argPassword,$argDatabaseName);
		
		if ($argHostname != "") $this->host = $argHostname;
		if ($argUsername != "") $this->user = $argUsername;
		if ($argPassword != "") $this->password = $argPassword;
		if ($argDatabaseName != "") $this->database = $argDatabaseName;		
			
		$this->_isPersistentConnection = true;	
		if ($this->_pconnect($this->host, $this->user, $this->password, $this->database)) return true;
		$err = $this->ErrorMsg();
		if (empty($err)) {
                        $err = "Connection error to server '$argHostname' with user '$argUsername'";
		} 
		if ($fn = $this->raiseErrorFn) {
			$fn($this->databaseType,'PCONNECT',$this->ErrorNo(),$err,$this->host,$this->database,$this);
		}

		if ($this->debug) ADOConnection::outp( $this->host.': '.$err);
		return false;
	}

	// Format date column in sql string given an input format that understands Y M D
	function SQLDate($fmt, $col=false)
	{	
		if (!$col) $col = $this->sysDate;
		return $col; // child class implement
	}
	
	/**
	 * Should prepare the sql statement and return the stmt resource.
	 * For databases that do not support this, we return the $sql. To ensure
	 * compatibility with databases that do not support prepare:
	 *
	 *   $stmt = $db->Prepare("insert into table (id, name) values (?,?)");
	 *   $db->Execute($stmt,array(1,'Jill')) or die('insert failed');
	 *   $db->Execute($stmt,array(2,'Joe')) or die('insert failed');
	 *
	 * @param sql	SQL to send to database
	 *
	 * @return return FALSE, or the prepared statement, or the original sql if
	 * 			if the database does not support prepare.
	 *
	 */	
	function Prepare($sql)
	{
		return $sql;
	}

	/**
	 * Some databases, eg. mssql require a different function for preparing
	 * stored procedures. So we cannot use Prepare().
	 *
	 * Should prepare the stored procedure  and return the stmt resource.
	 * For databases that do not support this, we return the $sql. To ensure
	 * compatibility with databases that do not support prepare:
	 *
	 * @param sql	SQL to send to database
	 *
	 * @return return FALSE, or the prepared statement, or the original sql if
	 * 			if the database does not support prepare.
	 *
	 */	
	function PrepareSP($sql,$param=true)
	{
		return $this->Prepare($sql,$param);
	}
	
	/**
	* PEAR DB Compat
	*/
	function Quote($s)
	{
		return $this->qstr($s,false);
	}
	
	/**
	 Requested by "Karsten Dambekalns" <k.dambekalns@fishfarm.de>
	*/
	function QMagic($s)
	{
		return $this->qstr($s,get_magic_quotes_gpc());
	}

	function q(&$s)
	{
		$s = $this->qstr($s,false);
	}
	
	/**
	* PEAR DB Compat - do not use internally. 
	*/
	function ErrorNative()
	{
		return $this->ErrorNo();
	}

	
   /**
	* PEAR DB Compat - do not use internally. 
	*/
	function nextId($seq_name)
	{
		return $this->GenID($seq_name);
	}

	/**
	*	 Lock a row, will escalate and lock the table if row locking not supported
	*	will normally free the lock at the end of the transaction
	*
	*  @param $table	name of table to lock
	*  @param $where	where clause to use, eg: "WHERE row=12". If left empty, will escalate to table lock
	*/
	function RowLock($table,$where)
	{
		return false;
	}
	
	function CommitLock($table)
	{
		return $this->CommitTrans();
	}
	
	function RollbackLock($table)
	{
		return $this->RollbackTrans();
	}
	
	/**
	* PEAR DB Compat - do not use internally. 
	*
	* The fetch modes for NUMERIC and ASSOC for PEAR DB and ADODB are identical
	* 	for easy porting :-)
	*
	* @param mode	The fetchmode ADODB_FETCH_ASSOC or ADODB_FETCH_NUM
	* @returns		The previous fetch mode
	*/
	function SetFetchMode($mode)
	{	
		$old = $this->fetchMode;
		$this->fetchMode = $mode;
		
		if ($old === false) {
		global $ADODB_FETCH_MODE;
			return $ADODB_FETCH_MODE;
		}
		return $old;
	}
	

	/**
	* PEAR DB Compat - do not use internally. 
	*/
	function &Query($sql, $inputarr=false)
	{
		$rs = &$this->Execute($sql, $inputarr);
		if (!$rs && defined('ADODB_PEAR')) return ADODB_PEAR_Error();
		return $rs;
	}

	
	/**
	* PEAR DB Compat - do not use internally
	*/
	function &LimitQuery($sql, $offset, $count, $params=false)
	{
		$rs = &$this->SelectLimit($sql, $count, $offset, $params); 
		if (!$rs && defined('ADODB_PEAR')) return ADODB_PEAR_Error();
		return $rs;
	}

	
	/**
	* PEAR DB Compat - do not use internally
	*/
	function Disconnect()
	{
		return $this->Close();
	}
	
	/*
		 Returns placeholder for parameter, eg.
		 $DB->Param('a')
		 
		 will return ':a' for Oracle, and '?' for most other databases...
		 
		 For databases that require positioned params, eg $1, $2, $3 for postgresql,
		 	pass in Param(false) before setting the first parameter.
	*/
	function Param($name,$type='C')
	{
		return '?';
	}
	
	/*
		InParameter and OutParameter are self-documenting versions of Parameter().
	*/
	function InParameter(&$stmt,&$var,$name,$maxLen=4000,$type=false)
	{
		return $this->Parameter($stmt,$var,$name,false,$maxLen,$type);
	}
	
	/*
	*/
	function OutParameter(&$stmt,&$var,$name,$maxLen=4000,$type=false)
	{
		return $this->Parameter($stmt,$var,$name,true,$maxLen,$type);
	
	}
	
	/* 
	Usage in oracle
		$stmt = $db->Prepare('select * from table where id =:myid and group=:group');
		$db->Parameter($stmt,$id,'myid');
		$db->Parameter($stmt,$group,'group',64);
		$db->Execute();
		
		@param $stmt Statement returned by Prepare() or PrepareSP().
		@param $var PHP variable to bind to
		@param $name Name of stored procedure variable name to bind to.
		@param [$isOutput] Indicates direction of parameter 0/false=IN  1=OUT  2= IN/OUT. This is ignored in oci8.
		@param [$maxLen] Holds an maximum length of the variable.
		@param [$type] The data type of $var. Legal values depend on driver.

	*/
	function Parameter(&$stmt,&$var,$name,$isOutput=false,$maxLen=4000,$type=false)
	{
		return false;
	}
	
	/**
		Improved method of initiating a transaction. Used together with CompleteTrans().
		Advantages include:
		
		a. StartTrans/CompleteTrans is nestable, unlike BeginTrans/CommitTrans/RollbackTrans.
		   Only the outermost block is treated as a transaction.<br>
		b. CompleteTrans auto-detects SQL errors, and will rollback on errors, commit otherwise.<br>
		c. All BeginTrans/CommitTrans/RollbackTrans inside a StartTrans/CompleteTrans block
		   are disabled, making it backward compatible.
	*/
	function StartTrans($errfn = 'ADODB_TransMonitor')
	{
		if ($this->transOff > 0) {
			$this->transOff += 1;
			return;
		}
		
		$this->_oldRaiseFn = $this->raiseErrorFn;
		$this->raiseErrorFn = $errfn;
		$this->_transOK = true;
		
		if ($this->debug && $this->transCnt > 0) ADOConnection::outp("Bad Transaction: StartTrans called within BeginTrans");
		$this->BeginTrans();
		$this->transOff = 1;
	}
	
	
	/**
		Used together with StartTrans() to end a transaction. Monitors connection
		for sql errors, and will commit or rollback as appropriate.
		
		@autoComplete if true, monitor sql errors and commit and rollback as appropriate, 
		and if set to false force rollback even if no SQL error detected.
		@returns true on commit, false on rollback.
	*/
	function CompleteTrans($autoComplete = true)
	{
		if ($this->transOff > 1) {
			$this->transOff -= 1;
			return true;
		}
		$this->raiseErrorFn = $this->_oldRaiseFn;
		
		$this->transOff = 0;
		if ($this->_transOK && $autoComplete) {
			if (!$this->CommitTrans()) {
				$this->_transOK = false;
				if ($this->debug) ADOConnection::outp("Smart Commit failed");
			} else
				if ($this->debug) ADOConnection::outp("Smart Commit occurred");
		} else {
			$this->RollbackTrans();
			if ($this->debug) ADOCOnnection::outp("Smart Rollback occurred");
		}
		
		return $this->_transOK;
	}
	
	/*
		At the end of a StartTrans/CompleteTrans block, perform a rollback.
	*/
	function FailTrans()
	{
		if ($this->debug) 
			if ($this->transOff == 0) {
				ADOConnection::outp("FailTrans outside StartTrans/CompleteTrans");
			} else {
				ADOConnection::outp("FailTrans was called");
				adodb_backtrace();
			}
		$this->_transOK = false;
	}
	
	/**
		Check if transaction has failed, only for Smart Transactions.
	*/
	function HasFailedTrans()
	{
		if ($this->transOff > 0) return $this->_transOK == false;
		return false;
	}
	
	/**
	 * Execute SQL 
	 *
	 * @param sql		SQL statement to execute, or possibly an array holding prepared statement ($sql[0] will hold sql text)
	 * @param [inputarr]	holds the input data to bind to. Null elements will be set to null.
	 * @return 		RecordSet or false
	 */
	function &Execute($sql,$inputarr=false) 
	{
		if ($this->fnExecute) {
			$fn = $this->fnExecute;
			$ret =& $fn($this,$sql,$inputarr);
			if (isset($ret)) return $ret;
		}
		if ($inputarr) {
			if (!is_array($inputarr)) $inputarr = array($inputarr);
			
			$element0 = reset($inputarr);
			# is_object check because oci8 descriptors can be passed in
			$array_2d = is_array($element0) && !is_object(reset($element0));
			
			if (!is_array($sql) && !$this->_bindInputArray) {
				$sqlarr = explode('?',$sql);
					
				if (!$array_2d) $inputarr = array($inputarr);
				foreach($inputarr as $arr) {
					$sql = ''; $i = 0;
					foreach($arr as $v) {
						$sql .= $sqlarr[$i];
						// from Ron Baldwin <ron.baldwin@sourceprose.com>
						// Only quote string types	
						if (gettype($v) == 'string')
							$sql .= $this->qstr($v);
						else if ($v === null)
							$sql .= 'NULL';
						else
							$sql .= $v;
						$i += 1;
					}
					$sql .= $sqlarr[$i];
					
					if ($i+1 != sizeof($sqlarr))	
						ADOConnection::outp( "Input Array does not match ?: ".htmlspecialchars($sql));
		
					$ret =& $this->_Execute($sql);
					if (!$ret) return $ret;
				}	
			} else {
				if ($array_2d) {
					$stmt = $this->Prepare($sql);
					foreach($inputarr as $arr) {
						$ret =& $this->_Execute($stmt,$arr);
						if (!$ret) return $ret;
					}
				} else {
					$ret =& $this->_Execute($sql,$inputarr);
			        }
			}
		} else {
			$ret =& $this->_Execute($sql,false);
		}

		return $ret;
	}
	
	
	function& _Execute($sql,$inputarr=false)
	{
			
		if ($this->debug) {
			global $ADODB_INCLUDED_LIB;
			if (empty($ADODB_INCLUDED_LIB)) include_once(ADODB_DIR.'/adodb-lib.inc.php');
			$this->_queryID = _adodb_debug_execute($this, $sql,$inputarr);
		} else {
			$this->_queryID = @$this->_query($sql,$inputarr);
		}
		
		/************************
		// OK, query executed
		*************************/

		if ($this->_queryID === false) { // error handling if query fails
			if ($this->debug == 99) adodb_backtrace(true,5);	
			$fn = $this->raiseErrorFn;
			if ($fn) {
				$fn($this->databaseType,'EXECUTE',$this->ErrorNo(),$this->ErrorMsg(),$sql,$inputarr,$this);
			} 
				
			return false;
		} 
		
		if ($this->_queryID === true) { // return simplified recordset for inserts/updates/deletes with lower overhead
			$rs =& new ADORecordSet_empty();
			return $rs;
		}
		
		// return real recordset from select statement
		$rsclass = $this->rsPrefix.$this->databaseType;
		$rs =& new $rsclass($this->_queryID,$this->fetchMode);
		$rs->connection = &$this; // Pablo suggestion
		$rs->Init();
		if (is_array($sql)) $rs->sql = $sql[0];
		else $rs->sql = $sql;
		if ($rs->_numOfRows <= 0) {
		global $ADODB_COUNTRECS;
			if ($ADODB_COUNTRECS) {
				if (!$rs->EOF) { 
					$rs = &$this->_rs2rs($rs,-1,-1,!is_array($sql));
					$rs->_queryID = $this->_queryID;
				} else
					$rs->_numOfRows = 0;
			}
		}
		return $rs;
	}

	function CreateSequence($seqname='adodbseq',$startID=1)
	{
		if (empty($this->_genSeqSQL)) return false;
		return $this->Execute(sprintf($this->_genSeqSQL,$seqname,$startID));
	}

	function DropSequence($seqname)
	{
		if (empty($this->_dropSeqSQL)) return false;
		return $this->Execute(sprintf($this->_dropSeqSQL,$seqname));
	}

	/**
	 * Generates a sequence id and stores it in $this->genID;
	 * GenID is only available if $this->hasGenID = true;
	 *
	 * @param seqname		name of sequence to use
	 * @param startID		if sequence does not exist, start at this ID
	 * @return		0 if not supported, otherwise a sequence id
	 */
	function GenID($seqname='adodbseq',$startID=1)
	{
		if (!$this->hasGenID) {
			return 0; // formerly returns false pre 1.60
		}
		
		$getnext = sprintf($this->_genIDSQL,$seqname);
		
		$holdtransOK = $this->_transOK;
		$rs = @$this->Execute($getnext);
		if (!$rs) {
			$this->_transOK = $holdtransOK; //if the status was ok before reset
			$createseq = $this->Execute(sprintf($this->_genSeqSQL,$seqname,$startID));
			$rs = $this->Execute($getnext);
		}
		if ($rs && !$rs->EOF) $this->genID = reset($rs->fields);
		else $this->genID = 0; // false
	
		if ($rs) $rs->Close();

		return $this->genID;
	}	

	/**
	 * @return  the last inserted ID. Not all databases support this.
	 */ 
	function Insert_ID()
	{
		if ($this->_logsql && $this->lastInsID) return $this->lastInsID;
		if ($this->hasInsertID) return $this->_insertid();
		if ($this->debug) {
			ADOConnection::outp( '<p>Insert_ID error</p>');
			adodb_backtrace();
		}
		return false;
	}


	/**
	 * Portable Insert ID. Pablo Roca <pabloroca@mvps.org>
	 *
	 * @return  the last inserted ID. All databases support this. But aware possible
	 * problems in multiuser environments. Heavy test this before deploying.
	 */ 
	function PO_Insert_ID($table="", $id="") 
	{
	   if ($this->hasInsertID){
		   return $this->Insert_ID();
	   } else {
		   return $this->GetOne("SELECT MAX($id) FROM $table");
	   }
	}

	/**
	* @return # rows affected by UPDATE/DELETE
	*/ 
	function Affected_Rows()
	{
		if ($this->hasAffectedRows) {
			if ($this->fnExecute === 'adodb_log_sql') {
				if ($this->_logsql && $this->_affected !== false) return $this->_affected;
			}
			$val = $this->_affectedrows();
			return ($val < 0) ? false : $val;
		}
				  
		if ($this->debug) ADOConnection::outp( '<p>Affected_Rows error</p>',false);
		return false;
	}
	
	
	/**
	 * @return  the last error message
	 */
	function ErrorMsg()
	{
		return '!! '.strtoupper($this->dataProvider.' '.$this->databaseType).': '.$this->_errorMsg;
	}
	
	
	/**
	 * @return the last error number. Normally 0 means no error.
	 */
	function ErrorNo() 
	{
		return ($this->_errorMsg) ? -1 : 0;
	}
	
	function MetaError($err=false)
	{
		include_once(ADODB_DIR."/adodb-error.inc.php");
		if ($err === false) $err = $this->ErrorNo();
		return adodb_error($this->dataProvider,$this->databaseType,$err);
	}
	
	function MetaErrorMsg($errno)
	{
		include_once(ADODB_DIR."/adodb-error.inc.php");
		return adodb_errormsg($errno);
	}
	
	/**
	 * @returns an array with the primary key columns in it.
	 */
	function MetaPrimaryKeys($table, $owner=false)
	{
	// owner not used in base class - see oci8
		$p = array();
		$objs =& $this->MetaColumns($table);
		if ($objs) {
			foreach($objs as $v) {
				if (!empty($v->primary_key))
					$p[] = $v->name;
			}
		}
		if (sizeof($p)) return $p;
		if (function_exists('ADODB_VIEW_PRIMARYKEYS'))
			return ADODB_VIEW_PRIMARYKEYS($this->databaseType, $this->database, $table, $owner);
		return false;
	}
	
	/**
	 * @returns assoc array where keys are tables, and values are foreign keys
	 */
	function MetaForeignKeys($table, $owner=false, $upper=false)
	{
		return false;
	}
	/**
	 * Choose a database to connect to. Many databases do not support this.
	 *
	 * @param dbName 	is the name of the database to select
	 * @return 		true or false
	 */
	function SelectDB($dbName) 
	{return false;}
	
	
	/**
	* Will select, getting rows from $offset (1-based), for $nrows. 
	* This simulates the MySQL "select * from table limit $offset,$nrows" , and
	* the PostgreSQL "select * from table limit $nrows offset $offset". Note that
	* MySQL and PostgreSQL parameter ordering is the opposite of the other.
	* eg. 
	*  SelectLimit('select * from table',3); will return rows 1 to 3 (1-based)
	*  SelectLimit('select * from table',3,2); will return rows 3 to 5 (1-based)
	*
	* Uses SELECT TOP for Microsoft databases (when $this->hasTop is set)
	* BUG: Currently SelectLimit fails with $sql with LIMIT or TOP clause already set
	*
	* @param sql
	* @param [offset]	is the row to start calculations from (1-based)
	* @param [nrows]		is the number of rows to get
	* @param [inputarr]	array of bind variables
	* @param [secs2cache]		is a private parameter only used by jlim
	* @return		the recordset ($rs->databaseType == 'array')
 	*/
	function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
	{
		if ($this->hasTop && $nrows > 0) {
		// suggested by Reinhard Balling. Access requires top after distinct 
		 // Informix requires first before distinct - F Riosa
			$ismssql = (strpos($this->databaseType,'mssql') !== false);
			if ($ismssql) $isaccess = false;
			else $isaccess = (strpos($this->databaseType,'access') !== false);
			
			if ($offset <= 0) {
				
					// access includes ties in result
					if ($isaccess) {
						$sql = preg_replace(
						'/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop.' '.$nrows.' ',$sql);

						if ($secs2cache>0) {
							$ret =& $this->CacheExecute($secs2cache, $sql,$inputarr);
						} else {
							$ret =& $this->Execute($sql,$inputarr);
						}
						return $ret; // PHP5 fix
					} else if ($ismssql){
						$sql = preg_replace(
						'/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop.' '.$nrows.' ',$sql);
					} else {
						$sql = preg_replace(
						'/(^\s*select\s)/i','\\1 '.$this->hasTop.' '.$nrows.' ',$sql);
					}
			} else {
				$nn = $nrows + $offset;
				if ($isaccess || $ismssql) {
					$sql = preg_replace(
					'/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop.' '.$nn.' ',$sql);
				} else {
					$sql = preg_replace(
					'/(^\s*select\s)/i','\\1 '.$this->hasTop.' '.$nn.' ',$sql);
				}
			}
		}
		
		// if $offset>0, we want to skip rows, and $ADODB_COUNTRECS is set, we buffer  rows
		// 0 to offset-1 which will be discarded anyway. So we disable $ADODB_COUNTRECS.
		global $ADODB_COUNTRECS;
		
		$savec = $ADODB_COUNTRECS;
		$ADODB_COUNTRECS = false;
			
		if ($offset>0){
			if ($secs2cache>0) $rs = &$this->CacheExecute($secs2cache,$sql,$inputarr);
			else $rs = &$this->Execute($sql,$inputarr);
		} else {
			if ($secs2cache>0) $rs = &$this->CacheExecute($secs2cache,$sql,$inputarr);
			else $rs = &$this->Execute($sql,$inputarr);
		}
		$ADODB_COUNTRECS = $savec;
		if ($rs && !$rs->EOF) {
			$rs =& $this->_rs2rs($rs,$nrows,$offset);
		}
		//print_r($rs);
		return $rs;
	}
	
	/**
	* Create serializable recordset. Breaks rs link to connection.
	*
	* @param rs			the recordset to serialize
	*/
	function &SerializableRS(&$rs)
	{
		$rs2 =& $this->_rs2rs($rs);
		$ignore = false;
		$rs2->connection =& $ignore;
		
		return $rs2;
	}
	
	/**
	* Convert database recordset to an array recordset
	* input recordset's cursor should be at beginning, and
	* old $rs will be closed.
	*
	* @param rs			the recordset to copy
	* @param [nrows]  	number of rows to retrieve (optional)
	* @param [offset] 	offset by number of rows (optional)
	* @return 			the new recordset
	*/
	function &_rs2rs(&$rs,$nrows=-1,$offset=-1,$close=true)
	{
		if (! $rs) return false;
		
		$dbtype = $rs->databaseType;
		if (!$dbtype) {
			$rs = &$rs;  // required to prevent crashing in 4.2.1, but does not happen in 4.3.1 -- why ?
			return $rs;
		}
		if (($dbtype == 'array' || $dbtype == 'csv') && $nrows == -1 && $offset == -1) {
			$rs->MoveFirst();
			$rs = &$rs; // required to prevent crashing in 4.2.1, but does not happen in 4.3.1-- why ?
			return $rs;
		}
		$flds = array();
		for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) {
			$flds[] = $rs->FetchField($i);
		}

		$arr =& $rs->GetArrayLimit($nrows,$offset);
		//print_r($arr);
		if ($close) $rs->Close();
		
		$arrayClass = $this->arrayClass;
		
		$rs2 =& new $arrayClass();
		$rs2->connection = &$this;
		$rs2->sql = $rs->sql;
		$rs2->dataProvider = $this->dataProvider;
		$rs2->InitArrayFields($arr,$flds);
		return $rs2;
	}
	
	/*
	* Return all rows. Compat with PEAR DB
	*/
	function &GetAll($sql, $inputarr=false)
	{
		$arr =& $this->GetArray($sql,$inputarr);
		return $arr;
	}
	
	function &GetAssoc($sql, $inputarr=false,$force_array = false, $first2cols = false)
	{
		$rs =& $this->Execute($sql, $inputarr);
		if (!$rs) return false;
		
		$arr =& $rs->GetAssoc($force_array,$first2cols);
		return $arr;
	}
	
	function &CacheGetAssoc($secs2cache, $sql=false, $inputarr=false,$force_array = false, $first2cols = false)
	{
		if (!is_numeric($secs2cache)) {
			$first2cols = $force_array;
			$force_array = $inputarr;
		}
		$rs =& $this->CacheExecute($secs2cache, $sql, $inputarr);
		if (!$rs) return false;
		
		$arr =& $rs->GetAssoc($force_array,$first2cols);
		return $arr;
	}
	
	/**
	* Return first element of first row of sql statement. Recordset is disposed
	* for you.
	*
	* @param sql			SQL statement
	* @param [inputarr]		input bind array
	*/
	function GetOne($sql,$inputarr=false)
	{
	global $ADODB_COUNTRECS;
		$crecs = $ADODB_COUNTRECS;
		$ADODB_COUNTRECS = false;
		
		$ret = false;
		$rs = &$this->Execute($sql,$inputarr);
		if ($rs) {		
			if (!$rs->EOF) $ret = reset($rs->fields);
			$rs->Close();
		} 
		$ADODB_COUNTRECS = $crecs;
		return $ret;
	}
	
	function CacheGetOne($secs2cache,$sql=false,$inputarr=false)
	{
		$ret = false;
		$rs = &$this->CacheExecute($secs2cache,$sql,$inputarr);
		if ($rs) {		
			if (!$rs->EOF) $ret = reset($rs->fields);
			$rs->Close();
		} 
		
		return $ret;
	}
	
	function GetCol($sql, $inputarr = false, $trim = false)
	{
	  	$rv = false;
	  	$rs = &$this->Execute($sql, $inputarr);
	  	if ($rs) {
			$rv = array();
	   		if ($trim) {
				while (!$rs->EOF) {
					$rv[] = trim(reset($rs->fields));
					$rs->MoveNext();
		   		}
			} else {
				while (!$rs->EOF) {
					$rv[] = reset($rs->fields);
					$rs->MoveNext();
		   		}
			}
	   		$rs->Close();
	  	}
	  	return $rv;
	}
	
	function CacheGetCol($secs, $sql = false, $inputarr = false,$trim=false)
	{
	  	$rv = false;
	  	$rs = &$this->CacheExecute($secs, $sql, $inputarr);
	  	if ($rs) {
			if ($trim) {
				while (!$rs->EOF) {
					$rv[] = trim(reset($rs->fields));
					$rs->MoveNext();
		   		}
			} else {
				while (!$rs->EOF) {
					$rv[] = reset($rs->fields);
					$rs->MoveNext();
		   		}
			}
	   		$rs->Close();
	  	}
	  	return $rv;
	}
 
	/*
		Calculate the offset of a date for a particular database and generate
			appropriate SQL. Useful for calculating future/past dates and storing
			in a database.
			
		If dayFraction=1.5 means 1.5 days from now, 1.0/24 for 1 hour.
	*/
	function OffsetDate($dayFraction,$date=false)
	{		
		if (!$date) $date = $this->sysDate;
		return  '('.$date.'+'.$dayFraction.')';
	}
	
	
	/**
	*
	* @param sql			SQL statement
	* @param [inputarr]		input bind array
	*/
	function &GetArray($sql,$inputarr=false)
	{
	global $ADODB_COUNTRECS;
		
		$savec = $ADODB_COUNTRECS;
		$ADODB_COUNTRECS = false;
		$rs =& $this->Execute($sql,$inputarr);
		$ADODB_COUNTRECS = $savec;
		if (!$rs) 
			if (defined('ADODB_PEAR')) return ADODB_PEAR_Error();
			else return false;
		$arr =& $rs->GetArray();
		$rs->Close();
		return $arr;
	}
	
	function &CacheGetAll($secs2cache,$sql=false,$inputarr=false)
	{
		return $this->CacheGetArray($secs2cache,$sql,$inputarr);
	}
	
	function &CacheGetArray($secs2cache,$sql=false,$inputarr=false)
	{
	global $ADODB_COUNTRECS;
		
		$savec = $ADODB_COUNTRECS;
		$ADODB_COUNTRECS = false;
		$rs =& $this->CacheExecute($secs2cache,$sql,$inputarr);
		$ADODB_COUNTRECS = $savec;
		
		if (!$rs) 
			if (defined('ADODB_PEAR')) return ADODB_PEAR_Error();
			else return false;
		
		$arr =& $rs->GetArray();
		$rs->Close();
		return $arr;
	}
	
	
	
	/**
	* Return one row of sql statement. Recordset is disposed for you.
	*
	* @param sql			SQL statement
	* @param [inputarr]		input bind array
	*/
	function &GetRow($sql,$inputarr=false)
	{
	global $ADODB_COUNTRECS;
		$crecs = $ADODB_COUNTRECS;
		$ADODB_COUNTRECS = false;
		
		$rs =& $this->Execute($sql,$inputarr);
		
		$ADODB_COUNTRECS = $crecs;
		if ($rs) {
			if (!$rs->EOF) $arr = $rs->fields;
			else $arr = array();
			$rs->Close();
			return $arr;
		}
		
		return false;
	}
	
	function &CacheGetRow($secs2cache,$sql=false,$inputarr=false)
	{
		$rs =& $this->CacheExecute($secs2cache,$sql,$inputarr);
		if ($rs) {
			$arr = false;
			if (!$rs->EOF) $arr = $rs->fields;
			$rs->Close();
			return $arr;
		}
		return false;
	}
	
	/**
	* Insert or replace a single record. Note: this is not the same as MySQL's replace. 
	* ADOdb's Replace() uses update-insert semantics, not insert-delete-duplicates of MySQL.
	* Also note that no table locking is done currently, so it is possible that the
	* record be inserted twice by two programs...
	*
	* $this->Replace('products', array('prodname' =>"'Nails'","price" => 3.99), 'prodname');
	*
	* $table		table name
	* $fieldArray	associative array of data (you must quote strings yourself).
	* $keyCol		the primary key field name or if compound key, array of field names
	* autoQuote		set to true to use a hueristic to quote strings. Works with nulls and numbers
	*					but does not work with dates nor SQL functions.
	* has_autoinc	the primary key is an auto-inc field, so skip in insert.
	*
	* Currently blob replace not supported
	*
	* returns 0 = fail, 1 = update, 2 = insert 
	*/
	
	function Replace($table, $fieldArray, $keyCol, $autoQuote=false, $has_autoinc=false)
	{
		global $ADODB_INCLUDED_LIB;
		if (empty($ADODB_INCLUDED_LIB)) include_once(ADODB_DIR.'/adodb-lib.inc.php');
		
		return _adodb_replace($this, $table, $fieldArray, $keyCol, $autoQuote, $has_autoinc);
	}
	
	
	/**
	* Will select, getting rows from $offset (1-based), for $nrows. 
	* This simulates the MySQL "select * from table limit $offset,$nrows" , and
	* the PostgreSQL "select * from table limit $nrows offset $offset". Note that
	* MySQL and PostgreSQL parameter ordering is the opposite of the other.
	* eg. 
	*  CacheSelectLimit(15,'select * from table',3); will return rows 1 to 3 (1-based)
	*  CacheSelectLimit(15,'select * from table',3,2); will return rows 3 to 5 (1-based)
	*
	* BUG: Currently CacheSelectLimit fails with $sql with LIMIT or TOP clause already set
	*
	* @param [secs2cache]	seconds to cache data, set to 0 to force query. This is optional
	* @param sql
	* @param [offset]	is the row to start calculations from (1-based)
	* @param [nrows]	is the number of rows to get
	* @param [inputarr]	array of bind variables
	* @return		the recordset ($rs->databaseType == 'array')
 	*/
	function &CacheSelectLimit($secs2cache,$sql,$nrows=-1,$offset=-1,$inputarr=false)
	{	
		if (!is_numeric($secs2cache)) {
			if ($sql === false) $sql = -1;
			if ($offset == -1) $offset = false;
									  // sql,	nrows, offset,inputarr
			$rs =& $this->SelectLimit($secs2cache,$sql,$nrows,$offset,$this->cacheSecs);
		} else {
			if ($sql === false) ADOConnection::outp( "Warning: \$sql missing from CacheSelectLimit()");
			$rs =& $this->SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
		}
		return $rs;
	}
	
	/**
	* Flush cached recordsets that match a particular $sql statement. 
	* If $sql == false, then we purge all files in the cache.
 	*/
	function CacheFlush($sql=false,$inputarr=false)
	{
	global $ADODB_CACHE_DIR;
	
		if (strlen($ADODB_CACHE_DIR) > 1 && !$sql) {
			if (strncmp(PHP_OS,'WIN',3) === 0) {
				$cmd = 'del /s '.str_replace('/','\\',$ADODB_CACHE_DIR).'\adodb_*.cache';
			} else {
				$cmd = 'rm -rf '.$ADODB_CACHE_DIR.'/??/adodb_*.cache'; 
				// old version 'rm -f `find '.$ADODB_CACHE_DIR.' -name adodb_*.cache`';
			}
			if ($this->debug) {
				ADOConnection::outp( "CacheFlush: $cmd<br><pre>\n", system($cmd),"</pre>");
			} else {
				exec($cmd);
			}
			return;
		} 
		
		global $ADODB_INCLUDED_CSV;
		if (empty($ADODB_INCLUDED_CSV)) include_once(ADODB_DIR.'/adodb-csvlib.inc.php');
		
		$f = $this->_gencachename($sql.serialize($inputarr),false);
		adodb_write_file($f,''); // is adodb_write_file needed?
		if (!@unlink($f)) {
			if ($this->debug) ADOConnection::outp( "CacheFlush: failed for $f");
		}
	}
	
	/**
	* Private function to generate filename for caching.
	* Filename is generated based on:
	*
	*  - sql statement
	*  - database type (oci8, ibase, ifx, etc)
	*  - database name
	*  - userid
	*  - setFetchMode (adodb 4.23)
	*
	* When not in safe mode, we create 256 sub-directories in the cache directory ($ADODB_CACHE_DIR). 
	* Assuming that we can have 50,000 files per directory with good performance, 
	* then we can scale to 12.8 million unique cached recordsets. Wow!
 	*/
	function _gencachename($sql,$createdir)
	{
	global $ADODB_CACHE_DIR;
	static $notSafeMode;
		
		if ($this->fetchMode === false) { 
		global $ADODB_FETCH_MODE;
			$mode = $ADODB_FETCH_MODE;
		} else {
			$mode = $this->fetchMode;
		}
		$m = md5($sql.$this->databaseType.$this->database.$this->user.$mode);
		
		if (!isset($notSafeMode)) $notSafeMode = !ini_get('safe_mode');
		$dir = ($notSafeMode) ? $ADODB_CACHE_DIR.'/'.substr($m,0,2) : $ADODB_CACHE_DIR;
			
		if ($createdir && $notSafeMode && !file_exists($dir)) {
			$oldu = umask(0);
			if (!mkdir($dir,0771)) 
				if ($this->debug) ADOConnection::outp( "Unable to mkdir $dir for $sql");
			umask($oldu);
		}
		return $dir.'/adodb_'.$m.'.cache';
	}
	
	
	/**
	 * Execute SQL, caching recordsets.
	 *
	 * @param [secs2cache]	seconds to cache data, set to 0 to force query. 
	 *					  This is an optional parameter.
	 * @param sql		SQL statement to execute
	 * @param [inputarr]	holds the input data  to bind to
	 * @return 		RecordSet or false
	 */
	function &CacheExecute($secs2cache,$sql=false,$inputarr=false)
	{
		if (!is_numeric($secs2cache)) {
			$inputarr = $sql;
			$sql = $secs2cache;
			$secs2cache = $this->cacheSecs;
		}
		global $ADODB_INCLUDED_CSV;
		if (empty($ADODB_INCLUDED_CSV)) include_once(ADODB_DIR.'/adodb-csvlib.inc.php');
		
		if (is_array($sql)) $sql = $sql[0];
			
		$md5file = $this->_gencachename($sql.serialize($inputarr),true);
		$err = '';
		
		if ($secs2cache > 0){
			$rs = &csv2rs($md5file,$err,$secs2cache);
			$this->numCacheHits += 1;
		} else {
			$err='Timeout 1';
			$rs = false;
			$this->numCacheMisses += 1;
		}
		if (!$rs) {
		// no cached rs found
			if ($this->debug) {
				if (get_magic_quotes_runtime()) {
					ADOConnection::outp("Please disable magic_quotes_runtime - it corrupts cache files :(");
				}
				if ($this->debug !== -1) ADOConnection::outp( " $md5file cache failure: $err (see sql below)");
			}
			$rs = &$this->Execute($sql,$inputarr);
			if ($rs) {
				$eof = $rs->EOF;
				$rs = &$this->_rs2rs($rs); // read entire recordset into memory immediately
				$txt = _rs2serialize($rs,false,$sql); // serialize
		
				if (!adodb_write_file($md5file,$txt,$this->debug)) {
					if ($fn = $this->raiseErrorFn) {
						$fn($this->databaseType,'CacheExecute',-32000,"Cache write error",$md5file,$sql,$this);
					}
					if ($this->debug) ADOConnection::outp( " Cache write error");
				}
				if ($rs->EOF && !$eof) {
					$rs->MoveFirst();
					//$rs = &csv2rs($md5file,$err);		
					$rs->connection = &$this; // Pablo suggestion
				}  
				
			} else
				@unlink($md5file);
		} else {
			$this->_errorMsg = '';
			$this->_errorCode = 0;
			
			if ($this->fnCacheExecute) {
				$fn = $this->fnCacheExecute;
				$fn($this, $secs2cache, $sql, $inputarr);
			}
		// ok, set cached object found
			$rs->connection = &$this; // Pablo suggestion
			if ($this->debug){ 
			global $HTTP_SERVER_VARS;
					
				$inBrowser = isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']);
				$ttl = $rs->timeCreated + $secs2cache - time();
				$s = is_array($sql) ? $sql[0] : $sql;
				if ($inBrowser) $s = '<i>'.htmlspecialchars($s).'</i>';
				
				ADOConnection::outp( " $md5file reloaded, ttl=$ttl [ $s ]");
			}
		}
		return $rs;
	}
	
	
	/**
	 * Generates an Update Query based on an existing recordset.
	 * $arrFields is an associative array of fields with the value
	 * that should be assigned.
	 *
	 * Note: This function should only be used on a recordset
	 *	   that is run against a single table and sql should only 
	 *		 be a simple select stmt with no groupby/orderby/limit
	 *
	 * "Jonathan Younger" <jyounger@unilab.com>
  	 */
	function GetUpdateSQL(&$rs, $arrFields,$forceUpdate=false,$magicq=false,$force=null)
	{
		global $ADODB_INCLUDED_LIB;

        //********************************************************//
        //This is here to maintain compatibility
        //with older adodb versions. Sets force type to force nulls if $forcenulls is set.
		if (!isset($force)) {
				global $ADODB_FORCE_TYPE;
			    $force = $ADODB_FORCE_TYPE;
		}
		//********************************************************//

		if (empty($ADODB_INCLUDED_LIB)) include_once(ADODB_DIR.'/adodb-lib.inc.php');
		return _adodb_getupdatesql($this,$rs,$arrFields,$forceUpdate,$magicq,$force);
	}


	/**
	 * Generates an Insert Query based on an existing recordset.
	 * $arrFields is an associative array of fields with the value
	 * that should be assigned.
	 *
	 * Note: This function should only be used on a recordset
	 *	   that is run against a single table.
  	 */
	function GetInsertSQL(&$rs, $arrFields,$magicq=false,$force=null)
	{	
		global $ADODB_INCLUDED_LIB;
		if (!isset($force)) {
			global $ADODB_FORCE_TYPE;
			$force = $ADODB_FORCE_TYPE;
			
		}
		if (empty($ADODB_INCLUDED_LIB)) include_once(ADODB_DIR.'/adodb-lib.inc.php');
		return _adodb_getinsertsql($this,$rs,$arrFields,$magicq,$force);
	}
	

	/**
	* Update a blob column, given a where clause. There are more sophisticated
	* blob handling functions that we could have implemented, but all require
	* a very complex API. Instead we have chosen something that is extremely
	* simple to understand and use. 
	*
	* Note: $blobtype supports 'BLOB' and 'CLOB', default is BLOB of course.
	*
	* Usage to update a $blobvalue which has a primary key blob_id=1 into a 
	* field blobtable.blobcolumn:
	*
	*	UpdateBlob('blobtable', 'blobcolumn', $blobvalue, 'blob_id=1');
	*
	* Insert example:
	*
	*	$conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
	*	$conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');
	*/
	
	function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
	{
		return $this->Execute("UPDATE $table SET $column=? WHERE $where",array($val)) != false;
	}

	/**
	* Usage:
	*	UpdateBlob('TABLE', 'COLUMN', '/path/to/file', 'ID=1');
	*	
	*	$blobtype supports 'BLOB' and 'CLOB'
	*
	*	$conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
	*	$conn->UpdateBlob('blobtable','blobcol',$blobpath,'id=1');
	*/
	function UpdateBlobFile($table,$column,$path,$where,$blobtype='BLOB')
	{
		$fd = fopen($path,'rb');
		if ($fd === false) return false;
		$val = fread($fd,filesize($path));
		fclose($fd);
		return $this->UpdateBlob($table,$column,$val,$where,$blobtype);
	}
	
	function BlobDecode($blob)
	{
		return $blob;
	}
	
	function BlobEncode($blob)
	{
		return $blob;
	}
	
	function SetCharSet($charset)
	{
		return false;
	}
	
	function IfNull( $field, $ifNull ) 
	{
		return " CASE WHEN $field is null THEN $ifNull ELSE $field END ";
	}
	
	function LogSQL($enable=true)
	{
		include_once(ADODB_DIR.'/adodb-perf.inc.php');
		
		if ($enable) $this->fnExecute = 'adodb_log_sql';
		else $this->fnExecute = false;
		
		$old = $this->_logsql;	
		$this->_logsql = $enable;
		if ($enable && !$old) $this->_affected = false;
		return $old;
	}
	
	function GetCharSet()
	{
		return false;
	}
	
	/**
	* Usage:
	*	UpdateClob('TABLE', 'COLUMN', $var, 'ID=1', 'CLOB');
	*
	*	$conn->Execute('INSERT INTO clobtable (id, clobcol) VALUES (1, null)');
	*	$conn->UpdateClob('clobtable','clobcol',$clob,'id=1');
	*/
	function UpdateClob($table,$column,$val,$where)
	{
		return $this->UpdateBlob($table,$column,$val,$where,'CLOB');
	}
	
	
	/**
	*  Change the SQL connection locale to a specified locale.
	*  This is used to get the date formats written depending on the client locale.
	*/
	function SetDateLocale($locale = 'En')
	{
		$this->locale = $locale;
		switch ($locale)
		{
			default:
			case 'En':
				$this->fmtDate="Y-m-d";
				$this->fmtTimeStamp = "Y-m-d H:i:s";
				break;
	
			case 'Fr':
			case 'Ro':
			case 'It':
				$this->fmtDate="d-m-Y";
				$this->fmtTimeStamp = "d-m-Y H:i:s";
				break;
				
			case 'Ge':
				$this->fmtDate="d.m.Y";
				$this->fmtTimeStamp = "d.m.Y H:i:s";
				break;
		}
	}
	
	
	/**
	 *  $meta	contains the desired type, which could be...
	 *	C for character. You will have to define the precision yourself.
	 *	X for teXt. For unlimited character lengths.
	 *	B for Binary
	 *  F for floating point, with no need to define scale and precision
	 * 	N for decimal numbers, you will have to define the (scale, precision) yourself
	 *	D for date
	 *	T for timestamp
	 * 	L for logical/Boolean
	 *	I for integer
	 *	R for autoincrement counter/integer
	 *  and if you want to use double-byte, add a 2 to the end, like C2 or X2.
	 * 
	 *
	 * @return the actual type of the data or false if no such type available
	*/
 	function ActualType($meta)
	{
		switch($meta) {
		case 'C':
		case 'X':
			return 'VARCHAR';
		case 'B':
			
		case 'D':
		case 'T':
		case 'L':
		
		case 'R':
			
		case 'I':
		case 'N':
			return false;
		}
	}

	
	/**
	 * Close Connection
	 */
	function Close() 
	{
		return $this->_close();
		
		// "Simon Lee" <simon@mediaroad.com> reports that persistent connections need 
		// to be closed too!
		//if ($this->_isPersistentConnection != true) return $this->_close();
		//else return true;	
	}
	
	/**
	 * Begin a Transaction. Must be followed by CommitTrans() or RollbackTrans().
	 *
	 * @return true if succeeded or false if database does not support transactions
	 */
	function BeginTrans() {return false;}
	
	
	/**
	 * If database does not support transactions, always return true as data always commited
	 *
	 * @param $ok  set to false to rollback transaction, true to commit
	 *
	 * @return true/false.
	 */
	function CommitTrans($ok=true) 
	{ return true;}
	
	
	/**
	 * If database does not support transactions, rollbacks always fail, so return false
	 *
	 * @return true/false.
	 */




1 2

Cette discussion est classée dans : string, type, post, actualite, tng


Répondre à ce message

Sujets en rapport avec ce message

Récupérer variable d'un input type=image [ par Monico9385 ] Bonsoir tout le monde, alors la je comprend vraiment pas pourquoi ca marche pas, j'ai un formulaire avec une image de pour submit que je déclare co menu deroulant dynamique en faisant des choix [ par antillais ] slt>J'ai un formulaire de saisie....la premiere partie j'aimerais faire appelle a une table...Quand l'internaute selectionne l'arrondissement et le ty probleme menu deroulant+php mysql [ par antillais ] Dans une page de saisie j'ai 3 premiers menu deroulant : - arrondissements(les 20 de paris) - type d'etablissement(primmaire, college etc) - nom d'eta probleme menu deroulant+php mysql [ par antillais ] Dans une page de saisie j'ai 3 premiers menu deroulant : - arrondissements(les 20 de paris) - type d'etablissement(primmaire, college etc) - nom d'eta des ' et " qui se déforment en \' et \" [ par irkiouak ] J'envoie à l'aide d'un formulaire(POST), la valeur d'un champ de type texte;or cette zone texte peux contenir des caractères apostrophiques :-)  de ty statistiques [ par gabs77 ] bonjour, je cherche a faire des statistiques numériques avec un formulaire de choix des informations a évaluerdonc les statistiques se feront sur la t Form type="submit" vs type="image" [ par nariel1 ] BonjourJ'ai un petit probleme avec un formJe cherche a envoyer un mail avec un form ca marche bien quand le bouton envoyer est de type="submit" mais q ajout d'une clé étrangère en php [ par cloddy07 ] Bonjour a tous, j'ai réalisé un site internet en php, pour un office du tourisme.Dans ma partie administrateur, je rencontre quelque problème avec les enregistrement [ par album49 ] Bonjour à tous, voilà j'ai un problème :Je souhaite faire un enregistrement à partir de données saisies par un utilisateurMon code html est : <!DOCTYP plusieurs submit [ par putch ] salut à tous !voila j'ai un souci avec un formulaire avec plusieurs submitmon formulaire :           &l


Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

Photothèque

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,515 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales