Exemplo n.º 1
0
 public function testMultiQuery()
 {
     $sql = "\n    INSERT INTO " . $this->tableName . "\n      SET\n        page_template = 'lall1',\n        page_type = 'test1';\n    INSERT INTO " . $this->tableName . "\n      SET\n        page_template = 'lall2',\n        page_type = 'test2';\n    INSERT INTO " . $this->tableName . "\n      SET\n        page_template = 'lall3',\n        page_type = 'test3';\n    ";
     // multi_query - true
     $result = $this->db->multi_query($sql);
     self::assertEquals(true, $result);
     $sql = "\n    SELECT * FROM " . $this->tableName . ";\n    SELECT * FROM " . $this->tableName . ";\n    ";
     // multi_query - true
     $result = $this->db->multi_query($sql);
     self::assertEquals(true, is_array($result));
     foreach ($result as $resultForEach) {
         /* @var $resultForEach Result */
         $tmpArray = $resultForEach->fetchArray();
         self::assertEquals(true, is_array($tmpArray));
         self::assertEquals(true, count($tmpArray) > 0);
     }
     // multi_query - false
     $false = $this->db->multi_query('');
     self::assertEquals(false, $false);
 }