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


PHP DBManager::emptyValue方法代码示例

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


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

示例1: vardefProvider

 public function vardefProvider()
 {
     $GLOBALS['log']->info('DBManagerTest.vardefProvider: _db = ' . print_r($this->_db));
     $this->setUp();
     // Just in case the DB driver is not created yet.
     $emptydate = $this->_db->emptyValue("date");
     $emptytime = $this->_db->emptyValue("time");
     $emptydatetime = $this->_db->emptyValue("datetime");
     return array(array("testid", array('id' => array('name' => 'id', 'type' => 'varchar', 'required' => true)), array("id" => "test123"), array("id" => "'test123'")), array("testtext", array('text1' => array('name' => 'text1', 'type' => 'varchar', 'required' => true), 'text2' => array('name' => 'text2', 'type' => 'varchar')), array(), array("text1" => "''"), array()), array("testtext2", array('text1' => array('name' => 'text1', 'type' => 'varchar', 'required' => true), 'text2' => array('name' => 'text2', 'type' => 'varchar')), array('text1' => 'foo', 'text2' => 'bar'), array("text1" => "'foo'", 'text2' => "'bar'")), array("testreq", array('id' => array('name' => 'id', 'type' => 'varchar', 'required' => true), 'intval' => array('name' => 'intval', 'type' => 'int', 'required' => true), 'floatval' => array('name' => 'floatval', 'type' => 'decimal', 'required' => true), 'money' => array('name' => 'money', 'type' => 'currency', 'required' => true), 'test_dtm' => array('name' => 'test_dtm', 'type' => 'datetime', 'required' => true), 'test_dtm2' => array('name' => 'test_dtm2', 'type' => 'datetimecombo', 'required' => true), 'test_dt' => array('name' => 'test_dt', 'type' => 'date', 'required' => true), 'test_tm' => array('name' => 'test_tm', 'type' => 'time', 'required' => true)), array("id" => "test123", 'intval' => 42, 'floatval' => 42.24, 'money' => 56.78, 'test_dtm' => '2002-01-02 12:34:56', 'test_dtm2' => '2011-10-08 01:02:03', 'test_dt' => '1998-10-04', 'test_tm' => '03:04:05'), array("id" => "'test123'", 'intval' => 42, 'floatval' => 42.24, 'money' => 56.78, 'test_dtm' => $this->_db->convert('\'2002-01-02 12:34:56\'', "datetime"), 'test_dtm2' => $this->_db->convert('\'2011-10-08 01:02:03\'', 'datetime'), 'test_dt' => $this->_db->convert('\'1998-10-04\'', 'date'), 'test_tm' => $this->_db->convert('\'03:04:05\'', 'time'))), array("testreqnull", array('id' => array('name' => 'id', 'type' => 'varchar', 'required' => true), 'intval' => array('name' => 'intval', 'type' => 'int', 'required' => true), 'floatval' => array('name' => 'floatval', 'type' => 'decimal', 'required' => true), 'money' => array('name' => 'money', 'type' => 'currency', 'required' => true), 'test_dtm' => array('name' => 'test_dtm', 'type' => 'datetime', 'required' => true), 'test_dtm2' => array('name' => 'test_dtm2', 'type' => 'datetimecombo', 'required' => true), 'test_dt' => array('name' => 'test_dt', 'type' => 'date', 'required' => true), 'test_tm' => array('name' => 'test_tm', 'type' => 'time', 'required' => true)), array(), array("id" => "''", 'intval' => 0, 'floatval' => 0, 'money' => 0, 'test_dtm' => "{$emptydatetime}", 'test_dtm2' => "{$emptydatetime}", 'test_dt' => "{$emptydate}", 'test_tm' => "{$emptytime}"), array()), array("testnull", array('id' => array('name' => 'id', 'type' => 'varchar'), 'intval' => array('name' => 'intval', 'type' => 'int'), 'floatval' => array('name' => 'floatval', 'type' => 'decimal'), 'money' => array('name' => 'money', 'type' => 'currency'), 'test_dtm' => array('name' => 'test_dtm', 'type' => 'datetime'), 'test_dtm2' => array('name' => 'test_dtm2', 'type' => 'datetimecombo'), 'test_dt' => array('name' => 'test_dt', 'type' => 'date'), 'test_tm' => array('name' => 'test_tm', 'type' => 'time')), array("id" => 123), array("id" => "'123'"), array()), array("testempty", array('id' => array('name' => 'id', 'type' => 'varchar'), 'intval' => array('name' => 'intval', 'type' => 'int'), 'floatval' => array('name' => 'floatval', 'type' => 'decimal'), 'money' => array('name' => 'money', 'type' => 'currency'), 'test_dtm' => array('name' => 'test_dtm', 'type' => 'datetime'), 'test_dtm2' => array('name' => 'test_dtm2', 'type' => 'datetimecombo'), 'test_dt' => array('name' => 'test_dt', 'type' => 'date'), 'test_tm' => array('name' => 'test_tm', 'type' => 'time'), 'text_txt' => array('name' => 'test_txt', 'type' => 'varchar')), array("id" => "", 'intval' => '', 'floatval' => '', 'money' => '', 'test_dtm' => '', 'test_dtm2' => '', 'test_dt' => '', 'test_tm' => '', 'text_txt' => null), array("id" => "''", 'intval' => 0, 'floatval' => 0, 'money' => 0, 'test_dtm' => "NULL", 'test_dtm2' => "NULL", 'test_dt' => "NULL", 'test_tm' => 'NULL'), array('intval' => 'NULL', 'floatval' => 'NULL', 'money' => 'NULL', 'test_dtm' => 'NULL', 'test_dtm2' => 'NULL', 'test_dt' => 'NULL', 'test_tm' => 'NULL')));
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:10,代码来源:DBManagerTest.php

示例2: emptyValue

 /**
  * Return representation of an empty value depending on type
  * @param string $type
  */
 public function emptyValue($type)
 {
     $ctype = $this->getColumnType($type);
     if ($ctype == "datetime") {
         return $this->convert($this->quoted("1970-01-01 00:00:00"), "datetime");
     }
     if ($ctype == "date") {
         return $this->convert($this->quoted("1970-01-01"), "datetime");
     }
     if ($ctype == "time") {
         return $this->convert($this->quoted("00:00:00"), "time");
     }
     return parent::emptyValue($type);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:18,代码来源:MssqlManager.php

示例3: emptyValue

 public function emptyValue($type)
 {
     // http://www.devx.com/dbzone/Article/28713
     // http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=/com.ibm.db2.luw.sql.ref.doc/doc/r0008474.html
     $ctype = $this->getColumnType($type);
     if ($ctype == "datetime" || $ctype == "timestamp") {
         return $this->convert($this->quoted("0001-01-01 00:00:00"), "datetime");
     }
     if ($ctype == "date") {
         return $this->convert($this->quoted("0001-01-01"), "date");
     }
     if ($ctype == "time") {
         return $this->convert($this->quoted("00:00:00"), "time");
     }
     return parent::emptyValue($type);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:16,代码来源:IBMDB2Manager.php

示例4: emptyValue

 public function emptyValue($type, $forPrepared = false)
 {
     $ctype = $this->getColumnType($type);
     if ($ctype == "datetime") {
         return $forPrepared ? "1970-01-01 00:00:00" : $this->convert($this->quoted("1970-01-01 00:00:00"), "datetime");
     }
     if ($ctype == "date") {
         return $forPrepared ? "1970-01-01" : $this->convert($this->quoted("1970-01-01"), "date");
     }
     if ($ctype == "time") {
         return $forPrepared ? "00:00:00" : $this->convert($this->quoted("00:00:00"), "time");
     }
     if ($ctype == "clob") {
         return "EMPTY_CLOB()";
     }
     if ($ctype == "blob") {
         return "EMPTY_BLOB()";
     }
     return parent::emptyValue($type, $forPrepared);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:20,代码来源:OracleManager.php


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