本文整理汇总了PHP中ADODB_Active_Record::SetDatabaseAdapter方法的典型用法代码示例。如果您正苦于以下问题:PHP ADODB_Active_Record::SetDatabaseAdapter方法的具体用法?PHP ADODB_Active_Record::SetDatabaseAdapter怎么用?PHP ADODB_Active_Record::SetDatabaseAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADODB_Active_Record
的用法示例。
在下文中一共展示了ADODB_Active_Record::SetDatabaseAdapter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($table = false, $pkeyarr = false, $db = false)
{
global $ADODB_ASSOC_CASE, $_ADODB_ACTIVE_DBS;
if ($db == false && is_object($pkeyarr)) {
$db = $pkeyarr;
$pkeyarr = false;
}
if (!$table) {
$table = $this->_pluralize(get_class($this));
}
if ($db) {
$this->_dbat = ADODB_Active_Record::SetDatabaseAdapter($db);
} else {
$this->_dbat = sizeof($_ADODB_ACTIVE_DBS) - 1;
}
if ($this->_dbat < 0) {
$this->Error("No database connection set; use ADOdb_Active_Record::SetDatabaseAdapter(\$db)", 'ADODB_Active_Record::__constructor');
}
$this->_table = $table;
$this->_tableat = $table;
# reserved for setting the assoc value to a non-table name, eg. the sql string in future
$this->UpdateActiveTable($pkeyarr);
}
示例2: __construct
function __construct($table = false, $pkeyarr = false, $db = false, $options = array())
{
global $ADODB_ASSOC_CASE, $_ADODB_ACTIVE_DBS;
if ($db == false && is_object($pkeyarr)) {
$db = $pkeyarr;
$pkeyarr = false;
}
if ($table) {
// table argument exists. It is expected to be
// already plural form.
$this->_pTable = $table;
$this->_sTable = $this->_singularize($this->_pTable);
} else {
// We will use current classname as table name.
// We need to pluralize it for the real table name.
$this->_sTable = strtolower(get_class($this));
$this->_pTable = $this->_pluralize($this->_sTable);
}
$this->_table =& $this->_pTable;
$this->foreignName = $this->_sTable;
// CFR: default foreign name (singular)
if ($db) {
$this->_dbat = ADODB_Active_Record::SetDatabaseAdapter($db);
} else {
$this->_dbat = sizeof($_ADODB_ACTIVE_DBS) - 1;
}
if ($this->_dbat < 0) {
$this->Error("No database connection set; use ADOdb_Active_Record::SetDatabaseAdapter(\$db)", 'ADODB_Active_Record::__constructor');
}
$this->_tableat = $this->_table;
# reserved for setting the assoc value to a non-table name, eg. the sql string in future
// CFR: Just added this option because UpdateActiveTable() can refresh its information
// but there was no way to ask it to do that.
$forceUpdate = isset($options['refresh']) && true === $options['refresh'];
$this->UpdateActiveTable($pkeyarr, $forceUpdate);
if (isset($options['new']) && true === $options['new']) {
$table =& $this->TableInfo();
unset($table->_hasMany);
unset($table->_belongsTo);
$table->_hasMany = array();
$table->_belongsTo = array();
}
}
示例3: __construct
function __construct($table = false, $pkeyarr=false, $db=false)
{
global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS;
if ($db == false && is_object($pkeyarr)) {
$db = $pkeyarr;
$pkeyarr = false;
}
if (!$table) {
if (!empty($this->_table)) $table = $this->_table;
else $table = $this->_pluralize(get_class($this));
}
$this->foreignName = strtolower(get_class($this)); // CFR: default foreign name
if ($db) {
$this->_dbat = ADODB_Active_Record::SetDatabaseAdapter($db);
} else if (!isset($this->_dbat)) {
if (sizeof($_ADODB_ACTIVE_DBS) == 0) $this->Error("No database connection set; use ADOdb_Active_Record::SetDatabaseAdapter(\$db)",'ADODB_Active_Record::__constructor');
end($_ADODB_ACTIVE_DBS);
$this->_dbat = key($_ADODB_ACTIVE_DBS);
}
$this->_table = $table;
$this->_tableat = $table; # reserved for setting the assoc value to a non-table name, eg. the sql string in future
$this->UpdateActiveTable($pkeyarr);
}