當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AccessibleObjectInterface::INSERTmultipleRows方法代碼示例

本文整理匯總了PHP中TYPO3\CMS\Core\Tests\AccessibleObjectInterface::INSERTmultipleRows方法的典型用法代碼示例。如果您正苦於以下問題:PHP AccessibleObjectInterface::INSERTmultipleRows方法的具體用法?PHP AccessibleObjectInterface::INSERTmultipleRows怎麽用?PHP AccessibleObjectInterface::INSERTmultipleRows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TYPO3\CMS\Core\Tests\AccessibleObjectInterface的用法示例。


在下文中一共展示了AccessibleObjectInterface::INSERTmultipleRows方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sqlForInsertWithMultipleRowsIsValid

 /**
  * @test
  */
 public function sqlForInsertWithMultipleRowsIsValid()
 {
     $fields = array('uid', 'pid', 'title', 'body');
     $rows = array(array('1', '2', 'Title #1', 'Content #1'), array('3', '4', 'Title #2', 'Content #2'), array('5', '6', 'Title #3', 'Content #3'));
     $result = $this->subject->INSERTmultipleRows('tt_content', $fields, $rows);
     $expected = 'INSERT INTO tt_content (uid, pid, title, body) VALUES ';
     $expected .= '(\'1\', \'2\', \'Title #1\', \'Content #1\'), ';
     $expected .= '(\'3\', \'4\', \'Title #2\', \'Content #2\'), ';
     $expected .= '(\'5\', \'6\', \'Title #3\', \'Content #3\')';
     $this->assertEquals($expected, $this->cleanSql($result));
 }
開發者ID:KarlDennisMatthaei1923,項目名稱:PierraaDesign,代碼行數:14,代碼來源:DatabaseConnectionTest.php

示例2: sqlForInsertWithMultipleRowsIsValid

 /**
  * @test
  */
 public function sqlForInsertWithMultipleRowsIsValid()
 {
     $fields = array('uid', 'pid', 'title', 'body');
     $rows = array(array('1', '2', 'Title #1', 'Content #1'), array('3', '4', 'Title #2', 'Content #2'), array('5', '6', 'Title #3', 'Content #3'));
     $result = $this->subject->INSERTmultipleRows('tt_content', $fields, $rows);
     $expected[0] = 'INSERT INTO "tt_content" ( "uid", "pid", "title", "body" ) VALUES ( \'1\', \'2\', \'Title #1\', \'Content #1\' )';
     $expected[1] = 'INSERT INTO "tt_content" ( "uid", "pid", "title", "body" ) VALUES ( \'3\', \'4\', \'Title #2\', \'Content #2\' )';
     $expected[2] = 'INSERT INTO "tt_content" ( "uid", "pid", "title", "body" ) VALUES ( \'5\', \'6\', \'Title #3\', \'Content #3\' )';
     $this->assertEquals(count($expected), count($result));
     for ($i = 0; $i < count($result); $i++) {
         $this->assertTrue(is_array($result[$i]), 'Expected array: ' . $result[$i]);
         $this->assertEquals(1, count($result[$i]));
         $this->assertEquals($expected[$i], $this->cleanSql($result[$i][0]));
     }
 }
開發者ID:khanhdeux,項目名稱:typo3test,代碼行數:18,代碼來源:DatabaseConnectionOracleTest.php


注:本文中的TYPO3\CMS\Core\Tests\AccessibleObjectInterface::INSERTmultipleRows方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。