insert() 공개 정적인 메소드

Method to insert a new record in the database
public static insert ( string $jarr, string $use = null ) : array
$jarr string SQL insertion in JSON/ARRAY format
$use string OPTIONAL Name of the database defined as a new connection instance
리턴 array Returns an array with the number of rows affected by insert operation
예제 #1
0
 public function testMultipleInsertInArrayFormat()
 {
     $array['query'] = array(array('table' => 'users', 'values' => array('firstname' => "John", 'lastname' => "Lennon")), array('table' => 'users', 'values' => array('firstname' => "Paul", 'lastname' => "McCartney")));
     // Executes the SQL and stores the result
     $result = test::insert($array);
     $this->assertEquals(2, self::getNumRowsAffected($result), 'Test with Insert method');
 }