本文整理汇总了PHP中ADOConnection类的典型用法代码示例。如果您正苦于以下问题:PHP ADOConnection类的具体用法?PHP ADOConnection怎么用?PHP ADOConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ADOConnection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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;
}
示例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);
}
示例4: DropColumnSQL
function DropColumnSQL($tabname, $flds)
{
if ($this->debug) {
ADOConnection::outp("DropColumnSQL not supported");
}
return array();
}
示例5: DropColumnSQL
public function DropColumnSQL($tabname, $flds, $tableflds = '', $tableoptions = '')
{
if ($this->debug) {
ADOConnection::outp("DropColumnSQL not supported");
}
return array();
}
示例6: BindTimeStamp
function BindTimeStamp($d)
{
$d = ADOConnection::DBTimeStamp($d);
if (strncmp($d,"'",1)) return $d;
return substr($d,1,strlen($d)-2);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}