當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。