Пример #1
0
 /**
  * Field data
  *
  * Generates an array of objects containing field meta-data
  *
  * @return    array
  */
 public function field_data()
 {
     $retval = array();
     for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) {
         $retval[$i] = new stdClass();
         $retval[$i]->name = cubrid_field_name($this->result_id, $i);
         $retval[$i]->type = cubrid_field_type($this->result_id, $i);
         $retval[$i]->max_length = cubrid_field_len($this->result_id, $i);
         $retval[$i]->primary_key = (int) (strpos(cubrid_field_flags($this->result_id, $i), 'primary_key') !== FALSE);
     }
     return $retval;
 }
Пример #2
0
 public function columns()
 {
     if (empty($this->query)) {
         return false;
     }
     $columns = array();
     $num_fields = $this->numFields();
     for ($i = 0; $i < $num_fields; $i++) {
         $columns[] = cubrid_field_name($this->query, $i);
     }
     return $columns;
 }
Пример #3
0
 /**
  * @group arnia-wrong-parameters
  */
 public function testCubridFieldName3()
 {
     if (OUTPUT_FUNCTION_NAME == true) {
         echo "\r\nRunning: " . __FUNCTION__ . " = ";
     }
     try {
         $this->assertTrue($this->createTestTable(), "Failed to create the test table.");
         $this->sql = "SELECT * FROM test_table";
         $this->req = cubrid_execute($this->con, $this->sql);
         $val = cubrid_field_name($this->req, -1);
         $this->assertTrue(FALSE, "Expected Exception not thrown.");
     } catch (Exception $e) {
         //echo $e->getMessage()."\r\n";
         $this->assertEquals(-2006, cubrid_error_code());
         $this->assertEquals(4, cubrid_error_code_facility());
         $this->assertEquals('Invalid parameter', cubrid_error_msg());
     }
     $this->deleteTestTable();
 }