Exemplo n.º 1
0
$scripts->addFile('makegrid.js');
// Needed for generation of Inline Edit anchors
$scripts->addFile('sql.js');
$scripts->addFile('indexes.js');
$scripts->addFile('gis_data_editor.js');
// check whether insert row mode, if so include tbl_change.php
PMA_isInsertRow();
$after_insert_actions = array('new_insert', 'same_insert', 'edit_next');
if (isset($_REQUEST['after_insert']) && in_array($_REQUEST['after_insert'], $after_insert_actions)) {
    $url_params['after_insert'] = $_REQUEST['after_insert'];
    if (isset($_REQUEST['where_clause'])) {
        foreach ($_REQUEST['where_clause'] as $one_where_clause) {
            if ($_REQUEST['after_insert'] == 'same_insert') {
                $url_params['where_clause'][] = $one_where_clause;
            } elseif ($_REQUEST['after_insert'] == 'edit_next') {
                PMA_setSessionForEditNext($one_where_clause);
            }
        }
    }
}
//get $goto_include for different cases
$goto_include = PMA_getGotoInclude($goto_include);
// Defines the url to return in case of failure of the query
$err_url = PMA_getErrorUrl($url_params);
/**
 * Prepares the update/insert of a row
 */
list($loop_array, $using_key, $is_insert, $is_insertignore) = PMA_getParamsForUpdateOrInsert();
$query = array();
$value_sets = array();
$func_no_param = array('CONNECTION_ID', 'CURRENT_USER', 'CURDATE', 'CURTIME', 'CURRENT_DATE', 'CURRENT_TIME', 'DATABASE', 'LAST_INSERT_ID', 'NOW', 'PI', 'RAND', 'SYSDATE', 'UNIX_TIMESTAMP', 'USER', 'UTC_DATE', 'UTC_TIME', 'UTC_TIMESTAMP', 'UUID', 'UUID_SHORT', 'VERSION');
 /**
  * Test for PMA_setSessionForEditNext
  *
  * @return void
  */
 public function testSetSessionForEditNext()
 {
     $temp = new stdClass();
     $temp->orgname = 'orgname';
     $temp->table = 'table';
     $temp->type = 'real';
     $temp->primary_key = 1;
     $meta_arr = array($temp);
     $row = array('1' => 1);
     $res = 'foobar';
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->at(0))->method('query')->with('SELECT * FROM `db`.`table` WHERE `a` > 2 LIMIT 1;')->will($this->returnValue($res));
     $dbi->expects($this->at(1))->method('fetchRow')->with($res)->will($this->returnValue($row));
     $dbi->expects($this->at(2))->method('getFieldsMeta')->with($res)->will($this->returnValue($meta_arr));
     $GLOBALS['dbi'] = $dbi;
     $GLOBALS['db'] = 'db';
     $GLOBALS['table'] = 'table';
     PMA_setSessionForEditNext('`a` = 2');
     $this->assertEquals('CONCAT(`table`.`orgname`) IS NULL', $_SESSION['edit_next']);
 }