• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DatabaseObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了DatabaseObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: setDatabaseObject

 public function setDatabaseObject(DatabaseObject $object)
 {
     $this->_dbObject = $object;
     $this->_db = $object->getDb();
     $this->_table = $object->getTable();
     return $this;
 }
开发者ID:sandin,项目名称:iMemo,代码行数:7,代码来源:DoubleDatabase.php


示例2: populate

 /**
  * Populates the given DatabaseObject with dummy data
  *
  * @param DatabaseObject $obj
  * @return void
  */
 protected function populate(DatabaseObject &$obj)
 {
     $meta = $obj->meta();
     $key = $meta->getKey();
     $fields = $meta->getColumnMap();
     foreach ($fields as $property => $field) {
         if ($field == $key && isset($obj->{$property})) {
             continue;
         }
         $def = $meta->getColumnDefinition($field);
         $type = strtolower(Params::generic($def, 'native_type'));
         switch ($type) {
             case 'int':
             case 'integer':
             case 'float':
             case 'currency':
             case 'decimal':
             case 'double':
             case 'real':
             case 'tinyint':
             case 'short':
             case 'long':
                 $obj->{$property} = mt_rand(0, 100);
                 break;
             case 'date':
             case 'datetime':
             case 'timestamp':
                 // Fuzz two weeks around now
                 $window = 1209600;
                 // 14 days * 24 hours * 60 minutes * 60 seconds
                 $time = time() - $window / 2 + mt_rand(0, $window);
                 if ($type == 'date') {
                     $lt = localtime($time, true);
                     $time = mktime(0, 0, 0, $lt['tm_mday'], $lt['tm_mon'] + 1, $lt['tm_year'] + 1900);
                     $lt = null;
                 }
                 $obj->{$property} = $time;
                 break;
             case 'time':
                 // range is +- 838:59:59, but since this populate thing
                 // isn't really all it could be anyhow, let's just do
                 // positive values
                 $obj->{$property} = mt_rand(1, 839 * 60 * 60 - 1);
                 break;
             case 'var_string':
                 $obj->{$property} = 'dummy string content ' . uniqid();
                 break;
             default:
                 $obj->{$property} = uniqid();
                 break;
         }
     }
 }
开发者ID:jcorbinredtree,项目名称:framework,代码行数:59,代码来源:FrameworkTestCase.php


示例3: joinObject

 public function joinObject(DatabaseObject $dboA, DatabaseObject $dboB, $keyA = null, $keyB = null)
 {
     $metaA = $dboA->meta();
     $metaB = $dboB->meta();
     $tableA = $metaA->getTable();
     $tableB = $metaB->getTable();
     if (!$keyA) {
         $keyA = $metaA->getKey();
     }
     if (!$keyB) {
         $keyB = $keyA;
     }
     $sql = "INNER JOIN `{$tableB}` ON `{$tableB}`.`{$keyB}` = `{$tableA}`.`{$keyA}`";
     array_push($this->joins, $sql);
 }
开发者ID:jcorbinredtree,项目名称:framework,代码行数:15,代码来源:QueryBuilder.php


示例4: handleData

 /**
  * @see DatabaseObject::handleData()
  */
 protected function handleData($data)
 {
     parent::handleData($data);
     if (!$this->serverID) {
         $this->data['serverID'] = 0;
     }
 }
开发者ID:Evil-Co-Legacy,项目名称:Bash-Database,代码行数:10,代码来源:Server.class.php


示例5: handleData

 /**
  * @see DatabaseObject::handleData()
  */
 protected function handleData($data)
 {
     parent::handleData($data);
     if (!$this->moduleID) {
         $this->data['moduleID'] = 0;
     }
 }
开发者ID:Evil-Co-Legacy,项目名称:Evil-Co.de-CMS,代码行数:10,代码来源:DynamicPageModuleTemplate.class.php


示例6: handleData

 /**
  * @see DatabaseObject::handleData()
  */
 protected function handleData($data)
 {
     parent::handleData($data);
     if (!$this->entryID) {
         $this->data['entryID'] = 0;
     }
 }
开发者ID:Evil-Co-Legacy,项目名称:Bash-Database,代码行数:10,代码来源:BashEntry.class.php


示例7: EvaluationObjectDB

 /**
  * Constructor
  * @access   public
  */
 function EvaluationObjectDB()
 {
     /* Set default values -------------------------------------------------- */
     parent::DatabaseObject();
     $this->instanceof = INSTANCEOF_EVALDBOBJECT;
     /* --------------------------------------------------------------------- */
 }
开发者ID:ratbird,项目名称:hope,代码行数:11,代码来源:EvaluationObjectDB.class.php


示例8: form

	function form ($form) {
		$db =& DB::get();

		$purchasetable = DatabaseObject::tablename(Purchase::$table);
		$next = $db->query("SELECT auto_increment as id FROM information_schema.tables WHERE table_schema=database() AND table_name='$purchasetable' LIMIT 1");

		$Order = $this->Order;
		$Order->_2COcart_order_id = date('mdy').'-'.date('His').'-'.$next->id;

		// Build the transaction
		$_ = array();

		// Required
		$_['sid']				= $this->settings['sid'];
		$_['total']				= number_format($Order->Cart->Totals->total,$this->precision);
		$_['cart_order_id']		= $Order->_2COcart_order_id;
		$_['vendor_order_id']	= $this->session;
		$_['id_type']			= 1;

		// Extras
		if ($this->settings['testmode'] == "on")
			$_['demo']			= "Y";

		$_['fixed'] 			= "Y";
		$_['skip_landing'] 		= "1";

		$_['x_Receipt_Link_URL'] = $this->settings['returnurl'];

		// Line Items
		foreach($this->Order->Cart->contents as $i => $Item) {
			// $description[] = $Item->quantity."x ".$Item->name.((!empty($Item->optionlabel))?' '.$Item->optionlabel:'');
			$id = $i+1;
			$_['c_prod_'.$id]			= 'ecart_pid-'.$Item->product.','.$Item->quantity;
			$_['c_name_'.$id]			= $Item->name;
			$_['c_description_'.$id]	= !empty($Item->option->label)?$Item->$Item->option->label:'';
			$_['c_price_'.$id]			= number_format($Item->unitprice,$this->precision);

		}

		$_['card_holder_name'] 		= $Order->Customer->firstname.' '.$Order->Customer->lastname;
		$_['street_address'] 		= $Order->Billing->address;
		$_['street_address2'] 		= $Order->Billing->xaddress;
		$_['city'] 					= $Order->Billing->city;
		$_['state'] 				= $Order->Billing->state;
		$_['zip'] 					= $Order->Billing->postcode;
		$_['country'] 				= $Order->Billing->country;
		$_['email'] 				= $Order->Customer->email;
		$_['phone'] 				= $Order->Customer->phone;

		$_['ship_name'] 			= $Order->Customer->firstname.' '.$Order->Customer->lastname;
		$_['ship_street_address'] 	= $Order->Shipping->address;
		$_['ship_street_address2'] 	= $Order->Shipping->xaddress;
		$_['ship_city'] 			= $Order->Shipping->city;
		$_['ship_state'] 			= $Order->Shipping->state;
		$_['ship_zip'] 				= $Order->Shipping->postcode;
		$_['ship_country'] 			= $Order->Shipping->country;

		return $form.$this->format($_);
	}
开发者ID:robbiespire,项目名称:paQui,代码行数:59,代码来源:2Checkout.php


示例9: IssuePublish

 /**
  * This table delays an issue's publish time to a later date.
  *
  * @param int $p_id
  */
 public function IssuePublish($p_id = null)
 {
     parent::DatabaseObject($this->m_columnNames);
     $this->m_data['id'] = $p_id;
     if ($this->keyValuesExist()) {
         $this->fetch();
     }
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:13,代码来源:IssuePublish.php


示例10: create

 /**
  * Create a translation of a phrase.  If the phrase ID is set in the
  * constructor, we assume that the phrase already exists and we are
  * just creating a translation, and not a new phrase.
  *
  * @param string $p_text
  * 		Optional. The translation text.
  * @return boolean
  */
 public function create($p_text = null)
 {
     if (!isset($this->m_data['phrase_id'])) {
         $this->m_data['phrase_id'] = Translation::__GeneratePhraseId();
     }
     return parent::create(array("translation_text" => $p_text));
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:16,代码来源:Translation.php


示例11: __construct

 public function __construct()
 {
     // This is required or this constructor will override the
     // database object
     parent::__construct();
     $this->plans = new CustomerPlan();
 }
开发者ID:carriercomm,项目名称:Sipen-CMS,代码行数:7,代码来源:customer.class.php


示例12: __construct

 public function __construct($db)
 {
     parent::__construct($db, 'lds0019_notes_order', 'order_id');
     $this->add('note_id');
     $this->add('fronthand');
     $this->add('backhand');
 }
开发者ID:sandin,项目名称:iMemo,代码行数:7,代码来源:NotesOrder.php


示例13: getInstance

 public static function getInstance()
 {
     if (!self::$m_instance) {
         self::$m_instance = new self();
     }
     return self::$m_instance;
 }
开发者ID:troycaeser,项目名称:WheresMyWallet,代码行数:7,代码来源:database.php


示例14: __construct

 /**
  * Creates a new object.
  *
  * @param	integer		$id
  * @param 	array<mixed>	$row
  */
 public function __construct($id, $row = null)
 {
     if ($id !== null) {
         throw new SystemException('not implemented');
     }
     parent::__construct($row);
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:13,代码来源:ContestCouponParticipant.class.php


示例15: delete

    public function delete()
    {
        if (!$this->exists()) {
            return false;
        }
        // Deleting the from from disk path is the most common place for
        // something to go wrong, so we do that first.
        $file = $this->getStorageLocation();
        if (file_exists($file) && is_file($file)) {
            unlink($file);
        }

        // Delete all the references to this image.
        ArticleAttachment::OnAttachmentDelete($this->m_data['id']);

        // Delete the description
        Translation::deletePhrase($this->m_data['fk_description_id']);

        $tmpData = $this->m_data;

        // Delete the record in the database
        $success = parent::delete();

        $logtext = getGS('File #$1 "$2" deleted.', $tmpData['id'], $tmpData['file_name']);
        Log::Message($logtext, null, 39);
        return $success;
    } // fn delete
开发者ID:nistormihai,项目名称:Newscoop,代码行数:27,代码来源:Attachment.php


示例16: fetch

	/**
	 * Fetch a single record from the database for the given key.
	 *
	 * @param array $p_arg
	 *		If the record has already been fetched and we just need to
	 * 		assign the data to the object's internal member variable.
	 *
	 * @return boolean
	 *		TRUE on success, FALSE on failure
	 */
    public function fetch($arg = null)
    {
    	global $g_ado_db;

        if (is_array($arg)) {
        	return parent::fetch($arg);
        }

        if (!$this->keyValuesExist()) {
        	return false;
        }
        if ($this->readFromCache() !== false) {
        	return true;
        }

        $queryStr = 'SELECT *, X(poi_location) as latitude, Y(poi_location) as longitude
                FROM ' . self::TABLE . '
                WHERE id = ' . $this->getId();
        $this->m_data = $g_ado_db->GetRow($queryStr);
        $this->m_exists = count($this->m_data) > 0;

        if ($this->m_exists) {
		    // Write the object to cache
		    $this->writeCache();
		}

        return $this->m_exists;
    }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:38,代码来源:GeoLocation.php


示例17: delete

 public function delete()
 {
     $deleted = parent::delete();
     $CampCache = CampCache::singleton();
     $CampCache->clear('user');
     return $deleted;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:7,代码来源:Soundcloud.php


示例18: __construct

 public function __construct()
 {
     // This is required or this constructor will override the
     // database object
     parent::__construct();
     $this->loadSettings();
 }
开发者ID:carriercomm,项目名称:Sipen-CMS,代码行数:7,代码来源:setting.class.php


示例19: __construct

 public function __construct()
 {
     // This is required or this constructor will override the
     // database object
     parent::__construct();
     $this->orderby = "planid";
 }
开发者ID:carriercomm,项目名称:Sipen-CMS,代码行数:7,代码来源:planvariable.class.php


示例20: __construct

 public function __construct($db, $table)
 {
     parent::__construct($db, $table, 'id');
     $this->add('name_of_set');
     $this->add('uploader_id');
     $this->add('ts_created', time(), self::TYPE_TIMESTAMP);
 }
开发者ID:vinnivinsachi,项目名称:Vincent-DR,代码行数:7,代码来源:CustomAttribute.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DatabaseOperation类代码示例发布时间:2022-05-23
下一篇:
PHP DatabaseManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap