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


PHP ADODB_Active_Record类代码示例

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


在下文中一共展示了ADODB_Active_Record类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Save

 public function Save()
 {
     parent::Save();
     if ($this->supporting_docs_links != null) {
         $this->supporting_docs_links->Save();
     }
 }
开发者ID:GeraldScott,项目名称:OpenEvSys,代码行数:7,代码来源:SupportingDocsLinks.php

示例15: Save

 function Save()
 {
     // Agregar el generador a la llave primaria en insercion
     // el generador debe llamarse GEN_(Campo PK)
     if (App::$base->driver == 'firebird') {
         $ids = $this->DB()->MetaPrimaryKeys($this->_table);
         // PK
         $id = count($ids) > 0 ? $ids[0] : '';
         if (!$this->_saved && $id != '') {
             $id = strtolower($id);
             $gen = 'GEN_' . strtoupper($id);
             $this->{$id} = $this->DB()->GenID($gen);
         }
     }
     if (App::$base->driver == 'postgres' || App::$base->driver == 'postgres8') {
         $ids = $this->DB()->MetaPrimaryKeys($this->_table);
         // PK
         $id = count($ids) > 0 ? $ids[0] : '';
         if (!$this->_saved && $id != '') {
             $gen = $this->_table . '_' . $id . '_seq';
             //formato: tbl_nombretabla_id_campoid_seq
             $gen = strtolower($gen);
             $this->{$id} = $this->DB()->GenID($gen);
         }
     }
     parent::Save();
     return $this;
 }
开发者ID:hectorjairmontero,项目名称:Turismo,代码行数:28,代码来源:active_table.php


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