本文整理汇总了PHP中ADODB_Active_Record类的典型用法代码示例。如果您正苦于以下问题:PHP ADODB_Active_Record类的具体用法?PHP ADODB_Active_Record怎么用?PHP ADODB_Active_Record使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ADODB_Active_Record类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: importAdditionalData
protected function importAdditionalData($b, $blockNode)
{
if (isset($blockNode->data)) {
foreach ($blockNode->data as $data) {
if ($data['table'] != $this->getBlockTypeDatabaseTable()) {
$table = (string) $data['table'];
if (isset($data->record)) {
foreach ($data->record as $record) {
$aar = new ADODB_Active_Record($table);
$aar->bID = $b->getBlockID();
foreach ($record->children() as $node) {
$nodeName = $node->getName();
$aar->{$nodeName} = (string) $node;
}
if ($table == 'btFormQuestions') {
$db = Loader::db();
$aar->questionSetId = $db->GetOne('select questionSetId from btForm where bID = ?', array($b->getBlockID()));
$aar->qID = null;
}
$aar->Save();
}
}
}
}
}
}
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:26,代码来源:form.php
示例2: __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);
}
开发者ID:tavo1981,项目名称:phpbar,代码行数:23,代码来源:adodb-active-record.inc.php
示例3: belongsTo
function belongsTo($foreignRef, $foreignKey = false, $parentKey = '')
{
global $inflector;
$ar = new ADODB_Active_Record($this->_pluralize($foreignRef));
$ar->foreignName = $foreignRef;
$ar->parentKey = $parentKey;
$ar->UpdateActiveTable();
$ar->foreignKey = $foreignKey ? $foreignKey : $foreignRef . ADODB_Active_Record::$_foreignSuffix;
$table =& $this->TableInfo();
$table->_belongsTo[$foreignRef] = $ar;
# $this->$foreignRef = $this->_belongsTo[$foreignRef];
}
开发者ID:edmondscommerce,项目名称:XAMPP-Magento-Demo-Site,代码行数:12,代码来源:adodb-active-record.inc.php
示例4: duplicate
/**
* Duplicates an attribute key
*/
public function duplicate($args = array())
{
$ar = new ADODB_Active_Record('AttributeKeys');
$ar->Load('akID=?', array($this->akID));
$ar2 = clone $ar;
$ar2->akID = null;
foreach ($args as $key => $value) {
$ar2->{$key} = $value;
}
$ar2->Insert();
$db = Loader::db();
$ak = new AttributeKey();
$ak->load($db->Insert_ID());
// now we duplicate the specific category fields
$this->getController()->duplicateKey($ak);
return $ak;
}
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:20,代码来源:key.php
示例5: ADONewConnection
<?php
// using ActiveRecord to load and change record
include "adodb/adodb.inc.php";
include 'adodb/adodb-active-record.inc.php';
$conn = ADONewConnection('mysql');
$conn->connect("localhost", "user", "password", "test");
ADODB_Active_Record::setDatabaseAdapter($conn);
class User extends ADODB_Active_Record
{
}
$user = new User();
$user->load("id=10");
//load the record where the id is 10
echo $user->name;
$user->name = "Afif Mohiuddin";
//now update
$user->save();
//and save the previously loaded record
开发者ID:KB-WEB-DEVELOPMENT,项目名称:Kami_Barut_PHP_projects,代码行数:19,代码来源:ADODOB+ActiveRecord+example.php
示例6: importAdditionalData
protected function importAdditionalData($b, $blockNode)
{
if (isset($blockNode->data)) {
foreach ($blockNode->data as $data) {
if (strtoupper($data['table']) != strtoupper($this->getBlockTypeDatabaseTable())) {
$table = (string) $data['table'];
if (isset($data->record)) {
foreach ($data->record as $record) {
$aar = new ADODB_Active_Record($table);
$aar->bID = $b->getBlockID();
foreach ($record->children() as $node) {
$nodeName = $node->getName();
$aar->{$nodeName} = ContentImporter::getValue((string) $node);
}
$aar->Save();
}
}
}
}
}
}
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:21,代码来源:block_controller.php
示例7: Save
* Class for mt_blog (website)
*/
class Website extends Blog
{
function Save()
{
if (empty($this->blog_class)) {
$this->blog_class = 'website';
}
return parent::Save();
}
function blogs()
{
$where = "blog_parent_id = " . $this->id;
require_once 'class.mt_blog.php';
$blog = new Blog();
$blogs = $blog->Find($where);
return $blogs;
}
function site_path()
{
return $this->blog_site_path;
}
function site_url()
{
return $this->blog_site_url;
}
}
// Relations
ADODB_Active_Record::ClassHasMany('Website', 'mt_blog_meta', 'blog_meta_blog_id');
开发者ID:benvanstaveren,项目名称:movabletype,代码行数:30,代码来源:class.mt_website.php
示例8: Type
# Movable Type (r) (C) 2001-2015 Six Apart, Ltd. All Rights Reserved.
# This code cannot be redistributed without permission from www.sixapart.com.
# For more information, consult your Movable Type license.
#
# $Id$
require_once "class.baseobject.php";
/***
* Class for mt_tbping
*/
class TBPing extends BaseObject
{
public $_table = 'mt_tbping';
protected $_prefix = "tbping_";
protected $_has_meta = true;
public function trackback()
{
$col_name = "tbping_tb_id";
${$tb} = null;
if (isset($this->{$col_name}) && is_numeric($this->{$col_name})) {
$tb_id = $this->{$col_name};
require_once 'class.mt_trackback.php';
$tb = new Trackback();
$tb->Load("trackback_id = {$tb_id}");
}
return $tb;
}
}
// Relations
ADODB_Active_Record::ClassHasMany('TBPing', 'mt_tbping_meta', 'tbping_meta_tbping_id');
开发者ID:benvanstaveren,项目名称:movabletype,代码行数:29,代码来源:class.mt_tbping.php
示例9: createdCallback
<?php
class Document extends ADOdb_Active_Record
{
//
// Callback function hook for when document gets a 'created' status from document_callback.php
//
function createdCallback($http_body)
{
error_log("Document {$this->id} created");
$xml = simplexml_load_string($http_body);
}
//
// Callback function hook for when document gets a 'viewed' status from document_callback.php
//
function viewedCallback($http_body)
{
error_log("Document {$this->id} viewed");
$xml = simplexml_load_string($http_body);
}
//
// Callback function hook for when document gets a 'signed' status from document_callback.php
//
function completedCallback($http_body)
{
error_log("Document {$this->id} completed");
$xml = simplexml_load_string($http_body);
}
}
ADODB_Active_Record::ClassBelongsTo('document', 'user', 'user_id', 'id');
开发者ID:Buuntu,项目名称:RS-PHP-Embedded-Sample,代码行数:30,代码来源:document.php
示例10: TableKeyHasMany
static function TableKeyHasMany($table, $tablePKey, $foreignRef, $foreignKey = false, $foreignClass = 'ADODB_Active_Record')
{
if (!is_array($tablePKey)) {
$tablePKey = array($tablePKey);
}
$ar = new ADODB_Active_Record($table, $tablePKey);
$ar->hasMany($foreignRef, $foreignKey, $foreignClass);
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:8,代码来源:adodb-active-record.inc.php
示例11:
<?php
class Template extends ADOdb_Active_Record
{
}
ADODB_Active_Record::ClassHasMany('template', 'templates', 'user_id');
开发者ID:Buuntu,项目名称:RS-PHP-Embedded-Sample,代码行数:6,代码来源:template.php
示例12: person
$person->favorite_color = 'lavender';
$person->save();
// this save will perform an INSERT successfully
$person2 = new person();
$person2->Load('id=1');
$c = $person2->children;
if (is_array($c) && sizeof($c) == 3 && $c[0]->name_first == 'Jill' && $c[1]->name_first == 'Joan' && $c[2]->name_first == 'JAMIE') {
echo "OK Loaded HasMany</br>";
} else {
var_dump($c);
echo "error loading hasMany should have 3 array elements Jill Joan Jamie<br>";
}
class child extends ADOdb_Active_Record
{
}
ADODB_Active_Record::TableBelongsTo('children', 'person', 'person_id', 'id');
$ch = new Child('children', array('id'));
$ch->Load('id=1');
if ($ch->name_first !== 'Jill') {
echo "error in Loading Child<br>";
}
$p = $ch->person;
if (!$p || $p->name_first != 'John') {
echo "Error loading belongsTo<br>";
} else {
echo "OK loading BelongTo<br>";
}
if ($p) {
#$p->HasMany('children','person_id'); ## this is affects all other instances of Person
$p->LoadRelations('children', 'order by id', 1, 2);
if (sizeof($p->children) == 2 && $p->children[1]->name_first == 'JAMIE') {
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:test-active-relations.php
示例13: Trackback
}
require_once 'class.mt_trackback.php';
$trackback = new Trackback();
$loaded = $trackback->Load("trackback_entry_id = " . $this->entry_id);
if (!$loaded) {
$trackback = null;
}
return $trackback;
}
public function pings()
{
$pings = array();
$tb = $this->trackback();
if (!empty($tb)) {
require_once 'class.mt_tbping.php';
$tbping = new TBPing();
$pings = $tbping->Find("tbping_tb_id = " . $tb->id);
}
return $pings;
}
function Save()
{
if (empty($this->entry_class)) {
$this->class = 'entry';
}
return parent::Save();
}
}
// Relations
ADODB_Active_Record::ClassHasMany('Entry', 'mt_entry_meta', 'entry_meta_entry_id');
开发者ID:benvanstaveren,项目名称:movabletype,代码行数:30,代码来源:class.mt_entry.php
示例14: duplicate
public function duplicate() {
$dh = Loader::helper('date');
$db = Loader::db();
$date = $dh->getSystemDateTime();
$far = new ADODB_Active_Record('Files');
$far->Load('fID=?', array($this->fID));
$far2 = clone $far;
$far2->fID = null;
$far2->fDateAdded = $date;
$far2->Insert();
$fIDNew = $db->Insert_ID();
$fvIDs = $db->GetCol('select fvID from FileVersions where fID = ?', $this->fID);
foreach($fvIDs as $fvID) {
$farv = new ADODB_Active_Record('FileVersions');
$farv->Load('fID=? and fvID = ?', array($this->fID, $fvID));
$farv2 = clone $farv;
$farv2->fID = $fIDNew;
$farv2->fvActivateDatetime = $date;
$farv2->fvDateAdded = $date;
$farv2->Insert();
}
$r = $db->Execute('select fvID, akID, avID from FileAttributeValues where fID = ?', array($this->getFileID()));
while ($row = $r->fetchRow()) {
$db->Execute("insert into FileAttributeValues (fID, fvID, akID, avID) values (?, ?, ?, ?)", array(
$fIDNew,
$row['fvID'],
$row['akID'],
$row['avID']
));
}
// return the new file object
return File::getByID($fIDNew);
}
开发者ID:notzen,项目名称:concrete5,代码行数:40,代码来源:file.php
示例15: TBPing
if (!empty($tb)) {
require_once 'class.mt_tbping.php';
$tbping = new TBPing();
$pings = $tbping->Find("tbping_tb_id = " . $tb->id);
}
return $pings;
}
public function Save()
{
if (empty($this->category_class)) {
$this->class = 'category';
}
parent::Save();
}
public function entry_count()
{
$child_class = $this->class === 'category' ? 'entry' : 'page';
$blog_id = $this->blog_id;
$cat_id = $this->id;
$where = "entry_status = 2\n and entry_class = '{$child_class}'\n and entry_blog_id = {$blog_id}";
$join = array();
$join['mt_placement'] = array('condition' => "placement_entry_id = entry_id and placement_category_id = {$cat_id}");
require_once 'class.mt_entry.php';
$entry = new Entry();
$cnt = $entry->count(array('where' => $where, 'join' => $join));
return $cnt;
}
}
// Relations
ADODB_Active_Record::ClassHasMany('Category', 'mt_category_meta', 'category_meta_category_id');
开发者ID:OCMO,项目名称:movabletype,代码行数:30,代码来源:class.mt_category.php
示例16: Type
# Movable Type (r) (C) 2001-2014 Six Apart, Ltd. All Rights Reserved.
# This code cannot be redistributed without permission from www.sixapart.com.
# For more information, consult your Movable Type license.
#
# $Id$
require_once "class.baseobject.php";
/***
* Class for mt_comment
*/
class Comment extends BaseObject
{
public $_table = 'mt_comment';
protected $_prefix = "comment_";
protected $_has_meta = true;
public function commenter()
{
$commenter_id = $this->comment_commenter_id;
if (empty($commenter_id) || !is_numeric($commenter_id)) {
return;
}
require_once 'class.mt_author.php';
$author = new Author();
if ($author->Load("author_id = {$commenter_id}")) {
return $author;
}
return null;
}
}
// Relations
ADODB_Active_Record::ClassHasMany('Comment', 'mt_comment_meta', 'comment_meta_comment_id');
开发者ID:OCMO,项目名称:movabletype,代码行数:30,代码来源:class.mt_comment.php
示例17: Type
<?php
# Movable Type (r) (C) 2001-2015 Six Apart, Ltd. All Rights Reserved.
# This code cannot be redistributed without permission from www.sixapart.com.
# For more information, consult your Movable Type license.
#
# $Id$
require_once "class.baseobject.php";
/***
* Class for mt_asset
*/
class Asset extends BaseObject
{
public $_table = 'mt_asset';
protected $_prefix = "asset_";
protected $_has_meta = true;
}
// Relations
ADODB_Active_Record::ClassHasMany('Asset', 'mt_asset_meta', 'asset_meta_asset_id');
开发者ID:benvanstaveren,项目名称:movabletype,代码行数:19,代码来源:class.mt_asset.php
示例18: NewADOConnection
$db = NewADOConnection('postgres');
$db->Connect("localhost", "tester", "test", "test");
} else {
$db = NewADOConnection('oci8://scott:natsoft@/');
}
}
$arr = $db->ServerInfo();
echo "<h3>{$db->dataProvider}: {$arr['description']}</h3>";
$arr = $db->GetActiveRecords('products', ' productid<10');
adodb_pr($arr);
ADOdb_Active_Record::SetDatabaseAdapter($db);
if (!$db) {
die('failed');
}
$rec = new ADODB_Active_Record('photos');
$rec = new ADODB_Active_Record('products');
adodb_pr($rec->getAttributeNames());
echo "<hr>";
$rec->load('productid=2');
adodb_pr($rec);
$db->debug = 1;
$rec->productname = 'Changie Chan' . rand();
$rec->insert();
$rec->update();
$rec->productname = 'Changie Chan 99';
$rec->replace();
$rec2 = new ADODB_Active_Record('products');
$rec->load('productid=3');
$rec->save();
$rec = new ADODB_Active_record('products');
$rec->productname = 'John ActiveRec';
开发者ID:jnugh,项目名称:Paradise-Bird-Project,代码行数:31,代码来源:test-active-recs2.php
示例19: belongsTo
/**
* ar->foreignName will contain the name of the tables associated with this table because
* this table's rows may also be referenced by those tables using thistable_id or the provided
* foreign keys (this index name is stored in ar->foreignKey)
*
* this-table.other-table_id = other-table.id
*/
function belongsTo($foreignRef, $foreignKey = false)
{
global $inflector;
$ar = new ADODB_Active_Record($this->_pluralize($foreignRef));
$ar->foreignName = $foreignRef;
$ar->UpdateActiveTable();
$ar->foreignKey = $foreignKey ? $foreignKey : $ar->foreignName . self::$_foreignSuffix;
$table =& $this->TableInfo();
if (!isset($table->_belongsTo[$foreignRef])) {
$table->_belongsTo[$foreignRef] = $ar;
$table->updateColsCount();
}
$this->{$foreignRef} = $table->_belongsTo[$foreignRef];
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:21,代码来源:adodb-active-recordx.inc.php
示例20: Save
public function Save()
{
parent::Save();
if ($this->supporting_docs_links != null) {
$this->supporting_docs_links->Save();
}
}
开发者ID:GeraldScott,项目名称:OpenEvSys,代码行数:7,代码来源:SupportingDocsLinks.php
注:本文中的ADODB_Active_Record类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论