本文整理汇总了PHP中ADOConnection类的典型用法代码示例。如果您正苦于以下问题:PHP ADOConnection类的具体用法?PHP ADOConnection怎么用?PHP ADOConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ADOConnection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: doquote
/**
* Override the default `doquote` method to better sanitize numeric values.
*
* @param ADOConnection $db
* @param mixed $value
* @param string $type
* @return mixed
*/
public function doquote(&$db, $value, $type)
{
switch ($type) {
case 'L':
case 'I':
case 'I1':
case 'I2':
case 'I4':
case 'I8':
case 'F':
case 'N':
if (!is_numeric($value)) {
if (is_null($value)) {
return null;
}
if ($value === true) {
return 1;
}
if ($value === false) {
return 0;
}
$db->outp_throw('Numeric field type "' . $type . '" requires numeric value.', 'DOQUOTE');
return 0;
}
default:
return parent::doquote($db, $value, $type);
}
}
开发者ID:Zyqsempai,项目名称:amanet,代码行数:36,代码来源:model.php
示例2: __construct
/**
* Constructor
*
* @param ADOConnection $db An instance of ADOConnection.
*
* @throws XML_Query2XML_DBException If the ADOConnection instance passed as
* argument was not connected to the database server.
*/
public function __construct(ADOConnection $db)
{
if (!$db->IsConnected()) {
throw new XML_Query2XML_DBException('ADOConnection instance was not connected');
}
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$this->_db = $db;
}
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:16,代码来源:ADOdb.php
示例3: __construct
function __construct($type, $host, $user, $pass, $db, $debug)
{
$this->_adoConnection = NewADOConnection($type);
$this->_adoConnection->debug = $debug;
$status = $this->_adoConnection->Connect($host, $user, $pass, $db);
if (!$status) {
throw new Exception("Không kết nối được CSDL");
}
$this->_adoConnection->SetCharSet('utf8');
$this->_adoConnection->SetFetchMode(ADODB_FETCH_ASSOC);
}
开发者ID:hopitio,项目名称:framework,代码行数:11,代码来源:DB.php
示例4: DropColumnSQL
function DropColumnSQL($tabname, $flds)
{
if ($this->debug) {
ADOConnection::outp("DropColumnSQL not supported");
}
return array();
}
开发者ID:honj51,项目名称:taobaocrm,代码行数:7,代码来源:datadict-informix.inc.php
示例5: DropColumnSQL
public function DropColumnSQL($tabname, $flds, $tableflds = '', $tableoptions = '')
{
if ($this->debug) {
ADOConnection::outp("DropColumnSQL not supported");
}
return array();
}
开发者ID:bermi,项目名称:akelos,代码行数:7,代码来源:datadict-generic.inc.php
示例6: BindTimeStamp
function BindTimeStamp($d)
{
$d = ADOConnection::DBTimeStamp($d);
if (strncmp($d,"'",1)) return $d;
return substr($d,1,strlen($d)-2);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:7,代码来源:adodb-oracle.inc.php
示例7:
function &SelectLimit($sql, $nrows = -1, $offset = -1, $inputarr = false, $arg3 = false, $secs2cache = 0)
{
if (!preg_match('/ORDER[ \\t\\r\\n]+BY/is', $sql)) {
$sql .= ' ORDER BY 1';
}
return ADOConnection::SelectLimit($sql, $nrows, $offset, $inputarr, $arg3, $secs2cache);
}
开发者ID:katopenzz,项目名称:openemr,代码行数:7,代码来源:adodb-vfp.inc.php
示例8: queryDb
/**
* Sends the sql to the database and returns the results.
*
* @internal Switches between ADOConnection::Execute() and
* ADOConnection::SelectLimit() depending on the $query parameter's
* $solutionModifier "limit" and "offset" settings.
* Uses $query variable.
*
* @param array $arSql Array that gets a SQL query string once imploded
*
* @return mixed Anything ADOConnection::Execute() may return
* @throws Exception If Database query does not work
*/
function queryDb($arSql, $nOffset, $nLimit)
{
$strSql = SparqlEngineDb_SqlMerger::getSelect($this->query, $arSql);
if ($strSql == '()') {
return new ADORecordSet(false);
}
// I want associative arrays.
$oldmode = $this->dbConn->SetFetchMode(ADODB_FETCH_ASSOC);
if (isset($GLOBALS['debugSparql']) && $GLOBALS['debugSparql']) {
echo 'SQL query: ' . $strSql . "\n";
}
if ($nLimit === null && $nOffset == 0) {
$ret = $this->dbConn->execute($strSql);
} else {
if ($nLimit === null) {
$ret = $this->dbConn->SelectLimit($strSql, -1, $nOffset);
} else {
$ret = $this->dbConn->SelectLimit($strSql, $nLimit, $nOffset);
}
}
//... but others maybe not
$this->dbConn->SetFetchMode($oldmode);
if (!$ret) {
//Error occured
throw new Exception('ADOdb error: ' . $this->dbConn->ErrorMsg() . "\n" . $strSql);
}
return $ret;
}
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:41,代码来源:SparqlEngineDb.php
示例9: PrepareSP
public function PrepareSP($sql)
{
if (!$this->_has_mssql_init) {
ADOConnection::outp( "PrepareSP: mssql_init only available since PHP 4.1.0");
return $sql;
}
if (is_string($sql)) $sql = str_replace('||','+',$sql);
$stmt = mssql_init($sql,$this->_connectionID);
if (!$stmt) return $sql;
return array($sql,$stmt);
}
开发者ID:joeymetal,项目名称:v1,代码行数:11,代码来源:adodb-mssqlpo.inc.php
示例10: next
/**
* Fonction static permettant d'obtenir la séquence suivante
*
* @name DbSequence::next()
*
* @access public
* @static
* @param ADOConnection $conn Connexion valide à une base de données
* @param string $table Table sur laquelle on doit obtenir la sequence suivante
* @param string $column Nom de la colonne Primary Key de type numerique
*
* @return int Numero de séquence suivante
*/
public static function next(ADOConnection $conn, $table, $column)
{
try {
$sql = "SELECT {$column} FROM {$table} ORDER BY 1 DESC";
$rs = $conn->SelectLimit($sql, 1);
// Si il n'y a aucun enregistrement : insertion du premier
if ($rs->RecordCount() == 0) {
$id = 1;
} else {
while (!$rs->EOF) {
$id = $rs->fields[0];
break;
}
$id++;
}
} catch (exception $e) {
return null;
}
return $id;
}
开发者ID:pixxid,项目名称:xengine,代码行数:33,代码来源:DbSequence.class.php
示例11: MetaTables
function MetaTables($ttype = false, $showSchema = false, $mask = false)
{
if ($mask) {
$save = $this->metaTablesSQL;
$mask = $this->qstr(strtoupper($mask));
$this->metaTablesSQL .= " AND table_name like {$mask}";
}
$ret = ADOConnection::MetaTables($ttype, $showSchema);
if ($mask) {
$this->metaTablesSQL = $save;
}
return $ret;
}
开发者ID:jnugh,项目名称:Paradise-Bird-Project,代码行数:13,代码来源:adodb-pdo_oci.inc.php
示例12:
function &MetaTables($ttype = false, $showSchema = false, $mask = false)
{
if ($mask) {
$save = $this->metaTablesSQL;
$mask = $this->qstr($mask);
$this->metaTablesSQL .= " like {$mask}";
}
$ret =& ADOConnection::MetaTables($ttype, $showSchema);
if ($mask) {
$this->metaTablesSQL = $save;
}
return $ret;
}
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:13,代码来源:adodb-mysql.inc.php
示例13: MetaTables
function MetaTables($ttype = false, $showSchema = false, $mask = false)
{
$save = $this->metaTablesSQL;
if ($showSchema && is_string($showSchema)) {
$this->metaTablesSQL .= " from {$showSchema}";
}
if ($mask) {
$mask = $this->qstr($mask);
$this->metaTablesSQL .= " like {$mask}";
}
$ret = ADOConnection::MetaTables($ttype, $showSchema);
$this->metaTablesSQL = $save;
return $ret;
}
开发者ID:swapnilphalak,项目名称:crawl-anywhere,代码行数:14,代码来源:adodb-pdo_mysql.inc.php
示例14: ServerInfo
function ServerInfo()
{
$arr['dialect'] = $this->dialect;
switch($arr['dialect']) {
case '':
case '1': $s = 'Firebird Dialect 1'; break;
case '2': $s = 'Firebird Dialect 2'; break;
default:
case '3': $s = 'Firebird Dialect 3'; break;
}
$arr['version'] = ADOConnection::_findvers($s);
$arr['description'] = $s;
return $arr;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:14,代码来源:adodb-firebird.inc.php
示例15: MetaTables
function MetaTables($ttype = false, $showSchema = false, $mask = false)
{
$save = $this->metaTablesSQL;
if ($showSchema && is_string($showSchema)) {
$this->metaTablesSQL .= $this->qstr($showSchema);
} else {
$this->metaTablesSQL .= "schema()";
}
if ($mask) {
$mask = $this->qstr($mask);
$this->metaTablesSQL .= " AND table_name LIKE {$mask}";
}
$ret = ADOConnection::MetaTables($ttype, $showSchema);
$this->metaTablesSQL = $save;
return $ret;
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:16,代码来源:adodb-pdo_mysql.inc.php
示例16: ErrorNo
function ErrorNo()
{
if ($this->_haserrorfunctions) {
if (empty($this->_connectionID)) {
$e = @odbc_error();
} else {
$e = @odbc_error($this->_connectionID);
}
// bug in 4.0.6, error number can be corrupted string (should be 6 digits)
// so we check and patch
if (strlen($e) <= 2) {
return 0;
}
return $e;
} else {
return ADOConnection::ErrorNo();
}
}
开发者ID:qoire,项目名称:portal,代码行数:18,代码来源:adodb-odbc.inc.php
示例17: _connect
function _connect($host, $username, $password, $ldapbase)
{
global $LDAP_CONNECT_OPTIONS;
if (!function_exists('ldap_connect')) {
return null;
}
if (strpos($host, 'ldap://') === 0 || strpos($host, 'ldaps://') === 0) {
$this->_connectionID = @ldap_connect($host);
} else {
$conn_info = array($host, $this->port);
if (strstr($host, ':')) {
$conn_info = explode(':', $host);
}
$this->_connectionID = @ldap_connect($conn_info[0], $conn_info[1]);
}
if (!$this->_connectionID) {
$e = 'Could not connect to ' . $conn_info[0];
$this->_errorMsg = $e;
if ($this->debug) {
ADOConnection::outp($e);
}
return false;
}
if (count($LDAP_CONNECT_OPTIONS) > 0) {
$this->_inject_bind_options($LDAP_CONNECT_OPTIONS);
}
if ($username) {
$bind = @ldap_bind($this->_connectionID, $username, $password);
} else {
$username = 'anonymous';
$bind = @ldap_bind($this->_connectionID);
}
if (!$bind) {
$e = sprintf($this->_bind_errmsg, ldap_error($this->_connectionID));
$this->_errorMsg = $e;
if ($this->debug) {
ADOConnection::outp($e);
}
return false;
}
$this->_errorMsg = '';
$this->database = $ldapbase;
return $this->_connectionID;
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:44,代码来源:adodb-ldap.inc.php
示例18: SelectLimit
function SelectLimit($sql, $nrows = -1, $offset = -1, $inputarr = false, $secs2cache = 0)
{
// seems that oracle only supports 1 hint comment in 8i
if (strpos($sql, '/*+') !== false) {
$sql = str_replace('/*+ ', '/*+FIRST_ROWS ', $sql);
} else {
$sql = preg_replace('/^[ \\t\\n]*select/i', 'SELECT /*+FIRST_ROWS*/', $sql);
}
/*
The following is only available from 8.1.5 because order by in inline views not
available before then...
http://www.jlcomp.demon.co.uk/faq/top_sql.html
if ($nrows > 0) {
if ($offset > 0) $nrows += $offset;
$sql = "select * from ($sql) where rownum <= $nrows";
$nrows = -1;
}
*/
return ADOConnection::SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
}
开发者ID:swapnilphalak,项目名称:crawl-anywhere,代码行数:20,代码来源:adodb-oci805.inc.php
示例19: _connect
public function _connect( $host, $username, $password, $ldapbase)
{
global $LDAP_CONNECT_OPTIONS;
if ( !function_exists( 'ldap_connect' ) ) return null;
$conn_info = array( $host,$this->port);
if ( strstr( $host, ':' ) ) {
$conn_info = split( ':', $host );
}
$this->_connectionID = ldap_connect( $conn_info[0], $conn_info[1] );
if (!$this->_connectionID) {
$e = 'Could not connect to ' . $conn_info[0];
$this->_errorMsg = $e;
if ($this->debug) ADOConnection::outp($e);
return false;
}
if( count( $LDAP_CONNECT_OPTIONS ) > 0 ) {
$this->_inject_bind_options( $LDAP_CONNECT_OPTIONS );
}
if ($username) {
$bind = ldap_bind( $this->_connectionID, $username, $password );
} else {
$username = 'anonymous';
$bind = ldap_bind( $this->_connectionID );
}
if (!$bind) {
$e = 'Could not bind to ' . $conn_info[0] . " as ".$username;
$this->_errorMsg = $e;
if ($this->debug) ADOConnection::outp($e);
return false;
}
$this->_errorMsg = '';
$this->database = $ldapbase;
return $this->_connectionID;
}
开发者ID:joeymetal,项目名称:v1,代码行数:40,代码来源:adodb-ldap.inc.php
示例20: getConnection
/**
* Метод получения коннекта к БД
*
* @return ADOConnection
*/
protected final function getConnection()
{
if ($this->CONNECTION != null) {
return $this->CONNECTION;
//---
}
if (!$this->isConfigured()) {
PsUtil::raise('Cannot get DB connection, {} is not configured.', get_called_class());
}
$this->LOGGER->info();
$this->LOGGER->info('? Connection for [{}] is requested', $this->CONNECTION_PARAMS);
$URL = $this->CONNECTION_PARAMS->url();
//Посмотрим, есть ли у нас нужный коннект
if (array_key_exists($URL, $this->CONNECTIONS)) {
$this->LOGGER->info('< Fast returned from cache');
return $this->CONNECTION = $this->CONNECTIONS[$URL];
}
//Отлогируем
$this->LOGGER->info('+ Establishing connection {}', $this->CONNECTION_PARAMS);
//Подключаем adodb
PsLibs::inst()->AdoDb();
//Подключаемся
$this->CONNECTION = ADONewConnection($URL);
if (!is_object($this->CONNECTION)) {
PsUtil::raise("Unable to connect to [{}]", $this->CONNECTION_PARAMS);
}
//Зададим некоторые настройки
$this->CONNECTION->debug = ADODB_DEBUG;
$this->CONNECTION->SetFetchMode(ADODB_FETCH_ASSOC);
$this->CONNECTION->query("SET NAMES 'utf8'");
$this->CONNECTION->query("SET CHARACTER SET 'utf8'");
//Положим соединение в пул
if (array_key_exists($URL, $this->CONNECTIONS)) {
raise_error('Double trying to register db connection');
}
$this->LOGGER->info('< Established connection returned');
return $this->CONNECTIONS[$URL] = $this->CONNECTION;
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:43,代码来源:PsConnectionPoolEngine.php
注:本文中的ADOConnection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论