当前位置: 首页>>代码示例>>PHP>>正文


PHP adodb_write_file函数代码示例

本文整理汇总了PHP中adodb_write_file函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_write_file函数的具体用法?PHP adodb_write_file怎么用?PHP adodb_write_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了adodb_write_file函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: UpdateActiveTable


//.........这里部分代码省略.........
     $activetab->name = $table;
     $save = $ADODB_FETCH_MODE;
     $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
     if ($db->fetchMode !== false) {
         $savem = $db->SetFetchMode(false);
     }
     $cols = $db->MetaColumns($table);
     if (isset($savem)) {
         $db->SetFetchMode($savem);
     }
     $ADODB_FETCH_MODE = $save;
     if (!$cols) {
         $this->Error("Invalid table name: {$table}", 'UpdateActiveTable');
         return false;
     }
     $fld = reset($cols);
     if (!$pkeys) {
         if (isset($fld->primary_key)) {
             $pkeys = array();
             foreach ($cols as $name => $fld) {
                 if (!empty($fld->primary_key)) {
                     $pkeys[] = $name;
                 }
             }
         } else {
             $pkeys = $this->GetPrimaryKeys($db, $table);
         }
     }
     if (empty($pkeys)) {
         $this->Error("No primary key found for table {$table}", 'UpdateActiveTable');
         return false;
     }
     $attr = array();
     $keys = array();
     switch ($ADODB_ASSOC_CASE) {
         case 0:
             foreach ($cols as $name => $fldobj) {
                 $name = strtolower($name);
                 if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) {
                     $this->{$name} = $fldobj->default_value;
                 } else {
                     $this->{$name} = null;
                 }
                 $attr[$name] = $fldobj;
             }
             foreach ($pkeys as $k => $name) {
                 $keys[strtolower($name)] = strtolower($name);
             }
             break;
         case 1:
             foreach ($cols as $name => $fldobj) {
                 $name = strtoupper($name);
                 if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) {
                     $this->{$name} = $fldobj->default_value;
                 } else {
                     $this->{$name} = null;
                 }
                 $attr[$name] = $fldobj;
             }
             foreach ($pkeys as $k => $name) {
                 $keys[strtoupper($name)] = strtoupper($name);
             }
             break;
         default:
             foreach ($cols as $name => $fldobj) {
                 $name = $fldobj->name;
                 if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) {
                     $this->{$name} = $fldobj->default_value;
                 } else {
                     $this->{$name} = null;
                 }
                 $attr[$name] = $fldobj;
             }
             foreach ($pkeys as $k => $name) {
                 $keys[$name] = $cols[$name]->name;
             }
             break;
     }
     $activetab->keys = $keys;
     $activetab->flds = $attr;
     $activetab->updateColsCount();
     if ($ADODB_ACTIVE_CACHESECS && $ADODB_CACHE_DIR) {
         $activetab->_created = time();
         $s = serialize($activetab);
         if (!function_exists('adodb_write_file')) {
             include ADODB_DIR . '/adodb-csvlib.inc.php';
         }
         adodb_write_file($fname, $s);
     }
     if (isset($activedb->tables[$table])) {
         $oldtab = $activedb->tables[$table];
         if ($oldtab) {
             $activetab->_belongsTo = $oldtab->_belongsTo;
         }
         if ($oldtab) {
             $activetab->_hasMany = $oldtab->_hasMany;
         }
     }
     $activedb->tables[$table] = $activetab;
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:101,代码来源:adodb-active-recordx.inc.php

示例2: writecache

 function writecache($filename, $contents, $debug, $secs2cache)
 {
     return adodb_write_file($filename, $contents, $debug);
 }
开发者ID:dasatti,项目名称:dashboard,代码行数:4,代码来源:adodb.inc.php

示例3: _rs2serialize

	/**
	 * 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;
	}
开发者ID:songchin,项目名称:Cacti,代码行数:85,代码来源:adodb.inc.php

示例4: CacheExecute

 /**
  * 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;
     }
     if (is_array($sql)) {
         $sqlparam = $sql;
         $sql = $sql[0];
     } else {
         $sqlparam = $sql;
     }
     if ($this->memCache) {
         global $ADODB_INCLUDED_MEMCACHE;
         if (empty($ADODB_INCLUDED_MEMCACHE)) {
             include ADODB_DIR . '/adodb-memcache.lib.inc.php';
         }
         $md5file = $this->_gencachename($sql . serialize($inputarr), false, true);
     } else {
         global $ADODB_INCLUDED_CSV;
         if (empty($ADODB_INCLUDED_CSV)) {
             include ADODB_DIR . '/adodb-csvlib.inc.php';
         }
         $md5file = $this->_gencachename($sql . serialize($inputarr), true);
     }
     $err = '';
     if ($secs2cache > 0) {
         if ($this->memCache) {
             $rs = getmemCache($md5file, $err, $secs2cache, $this->memCacheHost, $this->memCachePort);
         } else {
             $rs = csv2rs($md5file, $err, $secs2cache, $this->arrayClass);
         }
         $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() && !$this->memCache) {
                 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($sqlparam, $inputarr);
         if ($rs && $this->memCache) {
             $rs = $this->_rs2rs($rs);
             // read entire recordset into memory immediately
             if (!putmemCache($md5file, $rs, $this->memCacheHost, $this->memCachePort, $this->memCacheCompress, $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");
                 }
             }
         } else {
             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 {
                 if (!$this->memCache) {
                     @unlink($md5file);
                 }
             }
         }
     } else {
         $this->_errorMsg = '';
         $this->_errorCode = 0;
//.........这里部分代码省略.........
开发者ID:swapnilphalak,项目名称:crawl-anywhere,代码行数:101,代码来源:adodb.inc.php

示例5: csv2rs

 /**
  * Execute SQL, caching recordsets.
  *
  * @param secs2cache	seconds to cache data, set to 0 to force query
  * @param sql		SQL statement to execute
  * @param [inputarr]	holds the input data  to bind to
  * @param [arg3]	reserved for john lim for future use
  * @return 		RecordSet or false
  */
 function &CacheExecute($secs2cache, $sql, $inputarr = false, $arg3 = false)
 {
     $md5file = $this->_gencachename($sql);
     $err = '';
     if ($secs2cache > 0) {
         $rs =& csv2rs($md5file, $err, $secs2cache);
     } else {
         $err = 'Timeout 1';
         $rs = false;
     }
     if (!$rs) {
         if ($this->debug) {
             print " {$md5file} cache failure: {$err}<br>";
         }
         $rs =& $this->Execute($sql, $inputarr, $arg3);
         if ($rs) {
             $eof = $rs->EOF;
             $rs =& $this->_rs2rs($rs);
             $txt =& rs2csv($rs, false, $sql);
             if (!adodb_write_file($md5file, $txt, $this->debug) && $this->debug) {
                 print ' Cache write error<br>';
             }
             if ($rs->EOF && !$eof) {
                 $rs =& csv2rs($md5file, $err);
             }
         } else {
             @unlink($md5file);
         }
     } else {
         if ($this->debug) {
             $ttl = $rs->timeCreated + $secs2cache - time();
             print " {$md5file} success ttl={$ttl}<br>";
         }
     }
     return $rs;
 }
开发者ID:qoire,项目名称:portal,代码行数:45,代码来源:adodb.inc.php

示例6: csv2rs

 /**
  * Execute SQL, caching recordsets.
  *
  * @param secs2cache	seconds to cache data, set to 0 to force query
  * @param sql		SQL statement to execute
  * @param [inputarr]	holds the input data  to bind to
  * @param [arg3]	reserved for john lim for future use
  * @return 		RecordSet or false
  */
 function &CacheExecute($secs2cache, $sql, $inputarr = false, $arg3 = false)
 {
     include_once ADODB_DIR . '/adodb-csvlib.inc.php';
     // cannot cache if $inputarr set
     if ($inputarr) {
         return $this->Execute($sql, $inputarr, $arg3);
     }
     $md5file = $this->_gencachename($sql);
     $err = '';
     if ($secs2cache > 0) {
         $rs =& csv2rs($md5file, $err, $secs2cache);
     } else {
         $err = 'Timeout 1';
         $rs = false;
     }
     if (!$rs) {
         // no cached rs found
         if ($this->debug) {
             print " {$md5file} cache failure: {$err}<br>";
         }
         $rs =& $this->Execute($sql, $inputarr, $arg3);
         if ($rs) {
             $eof = $rs->EOF;
             $rs =& $this->_rs2rs($rs);
             $txt =& rs2csv($rs, false, $sql);
             if (!adodb_write_file($md5file, $txt, $this->debug) && $this->debug) {
                 print ' Cache write error<br>';
             }
             if ($rs->EOF && !$eof) {
                 $rs =& csv2rs($md5file, $err);
                 $rs->connection =& $this;
                 // Pablo suggestion
             }
         } else {
             @unlink($md5file);
         }
     } else {
         // ok, set cached object found
         $rs->connection =& $this;
         // Pablo suggestion
         if ($this->debug) {
             $ttl = $rs->timeCreated + $secs2cache - time();
             print " {$md5file} success ttl={$ttl}<br>";
         }
     }
     return $rs;
 }
开发者ID:qoire,项目名称:portal,代码行数:56,代码来源:adodb.inc.php

示例7: serialize

 /**
  * 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
  * @param [arg3]    reserved for john lim for future use
  * @return      RecordSet or false
  */
 function &CacheExecute($secs2cache, $sql = false, $inputarr = false, $arg3 = false)
 {
     if (!is_numeric($secs2cache)) {
         $arg3 = $inputarr;
         $inputarr = $sql;
         $sql = $secs2cache;
         $secs2cache = $this->cacheSecs;
     }
     include_once ADODB_DIR . '/adodb-csvlib.inc.php';
     $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 :(");
             }
             ADOConnection::outp(" {$md5file} cache failure: {$err} (see sql below)");
         }
         $rs =& $this->Execute($sql, $inputarr, $arg3);
         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 {
         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;
 }
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:82,代码来源:adodb-connection.inc.php


注:本文中的adodb_write_file函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。