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


PHP Facade::getColumns方法代码示例

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


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

示例1: testSpecialDataTypes

 /**
  * Test special data types.
  *
  * @return void
  */
 public function testSpecialDataTypes()
 {
     testpack('Special data types');
     $bean = R::dispense('bean');
     $bean->date = 'someday';
     R::store($bean);
     $cols = R::getColumns('bean');
     asrt($cols['date'], 'TEXT');
     $bean = R::dispense('bean');
     $bean->date = '2011-10-10';
     R::nuke();
     $bean = R::dispense('bean');
     $bean->date = '2011-10-10';
     R::store($bean);
     $cols = R::getColumns('bean');
     asrt($cols['date'], 'NUMERIC');
 }
开发者ID:cesium147,项目名称:redbean,代码行数:22,代码来源:Writer.php

示例2: testTypesStrings

 /**
  * Test types of strings.
  *
  * @return void
  */
 public function testTypesStrings()
 {
     $bean = R::dispense('bean');
     $bean->data = 'abcdefghijk';
     R::store($bean);
     $cols = R::getColumns('bean');
     asrt($cols['data'], 'text');
     $bean = R::load('bean', $bean->id);
     asrt($bean->data, 'abcdefghijk');
     $bean->data = '(1,2)';
     R::store($bean);
     $cols = R::getColumns('bean');
     asrt($cols['data'], 'text');
     $bean->data = '[(1.2,1.4),(2.2,34)]';
     R::store($bean);
     $cols = R::getColumns('bean');
     asrt($cols['data'], 'text');
     $bean->data = '<(9.2,1.2),7.9>';
     R::store($bean);
     $cols = R::getColumns('bean');
     asrt($cols['data'], 'text');
     $bean->data = '$25';
     R::store($bean);
     $cols = R::getColumns('bean');
     asrt($cols['data'], 'text');
     $bean->data = '2012-10-10 10:00:00';
     R::store($bean);
     $cols = R::getColumns('bean');
     asrt($cols['data'], 'text');
 }
开发者ID:AntonyAntonio,项目名称:phpback,代码行数:35,代码来源:Writer.php

示例3: testTypesDateTimes

 /**
  * Date-time
  *
  * @return void
  */
 public function testTypesDateTimes()
 {
     $bean = R::dispense('bean');
     $bean->date = '2011-10-10 10:00:00';
     R::store($bean);
     $cols = R::getColumns('bean');
     asrt($cols['date'], 'datetime');
     $bean = R::dispense('bean');
     try {
         $bean = R::dispense('bean');
         $bean->title = 123;
         $bean->setMeta('cast.title', 'invalid');
         R::store($bean);
         fail();
     } catch (RedException $e) {
         pass();
     } catch (\Exception $e) {
         fail();
     }
     $bean = R::dispense('bean');
     $bean->title = 123;
     $bean->setMeta('cast.title', 'text');
     R::store($bean);
     $cols = R::getColumns('bean');
     asrt($cols['title'], 'text');
     R::nuke();
     $bean = R::dispense('bean');
     $bean->title = 123;
     $bean->setMeta('cast.title', 'string');
     R::store($bean);
     $cols = R::getColumns('bean');
     asrt($cols['title'], 'varchar(191)');
 }
开发者ID:AntonyAntonio,项目名称:phpback,代码行数:38,代码来源:Writer.php

示例4: testWideningColumnForConstraint

 /**
  * Test widen for constraint.
  *
  * @return void
  */
 public function testWideningColumnForConstraint()
 {
     testpack('widening column for constraint');
     $bean1 = R::dispense('project');
     $bean2 = R::dispense('invoice');
     $bean3 = R::getRedBean()->dispense('invoice_project');
     $bean3->project_id = false;
     $bean3->invoice_id = true;
     R::store($bean3);
     $cols = R::getColumns('invoice_project');
     asrt($cols['project_id'], "int(11) unsigned");
     asrt($cols['invoice_id'], "int(11) unsigned");
 }
开发者ID:diego-vieira,项目名称:redbean,代码行数:18,代码来源:Foreignkeys.php

示例5: testScenarios


//.........这里部分代码省略.........
     asrt($page1->book->title, 'def');
     $b2 = R::load('book', $id);
     asrt(count($b2->ownPage), 2);
     // Remove the other way around - single bean
     unset($page1->book);
     R::store($page1);
     $b2 = R::load('book', $book2->id);
     asrt(count($b2->ownPage), 1);
     //does not work
     $page1->book = NULL;
     R::store($page1);
     $b2 = R::load('book', $book2->id);
     asrt(count($b2->ownPage), 0);
     //works
     // Re-add the page
     $b2->ownPage[] = $page1;
     R::store($b2);
     $b2 = R::load('book', $book2->id);
     asrt(count($b2->ownPage), 1);
     // Different, less elegant way to remove
     $page1 = reset($b2->ownPage);
     $page1->book_id = NULL;
     R::store($page1);
     $b2 = R::load('book', $book2->id);
     asrt(count($b2->ownPage), 0);
     // Re-add the page
     $b2->ownPage[] = $page1;
     R::store($b2);
     $b2 = R::load('book', $book2->id);
     asrt(count($b2->ownPage), 1);
     // Another less elegant way to remove
     $page1->book = NULL;
     R::store($page1);
     $cols = R::getColumns('page');
     asrt(isset($cols['book']), FALSE);
     $b2 = R::load('book', $book2->id);
     asrt(count($b2->ownPage), 0);
     // Re-add the page
     $b2->ownPage[] = $page1;
     R::store($b2);
     $b2 = R::load('book', $book2->id);
     asrt(count($b2->ownPage), 1);
     // Another less elegant... just plain ugly... way to remove
     $page1->book = FALSE;
     R::store($page1);
     $cols = R::getColumns('page');
     asrt(isset($cols['book']), FALSE);
     $b2 = R::load('book', $book2->id);
     asrt(count($b2->ownPage), 0);
     // Re-add the page
     $b2->ownPage[] = $page1;
     R::store($b2);
     $b2 = R::load('book', $book2->id);
     asrt(count($b2->ownPage), 1);
     // You are not allowed to re-use the field for something else
     foreach (array(1, -2.1, array(), TRUE, 'NULL', new \stdClass(), 'just a string', array('a' => 1), 0) as $value) {
         try {
             $page1->book = $value;
             fail();
         } catch (RedException $e) {
             pass();
         }
     }
     // Test fk, not allowed to set to 0
     $page1 = reset($b2->ownPage);
     $page1->book_id = 0;
开发者ID:AntonyAntonio,项目名称:phpback,代码行数:67,代码来源:Relations.php


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