execute it, else display the headers
*/
if (isset($_REQUEST['submit_sql']) && ! empty($sql_query)) {
$goto = 'db_sql.php';
$zero_rows = htmlspecialchars($GLOBALS['strSuccess']);
require './sql.php';
exit;
} else {
$sub_part = '_qbe';
require './libraries/db_common.inc.php';
$url_query .= '&goto=db_qbe.php';
$url_params['goto'] = 'db_qbe.php';
require './libraries/db_info.inc.php';
}
if (isset($_REQUEST['submit_sql'])
&& ! preg_match('@^SELECT@i', $sql_query)) {
PMA_Message::warning('strHaveToShow')->display();
}
/**
* Initialize some variables
*/
$col_cnt = PMA_ifSetOr($_REQUEST['col_cnt'], 3, 'numeric');
$add_col = PMA_ifSetOr($_REQUEST['add_col'], 0, 'numeric');
$add_row = PMA_ifSetOr($_REQUEST['add_row'], 0, 'numeric');
$rows = PMA_ifSetOr($_REQUEST['rows'], 0, 'numeric');
$ins_col = PMA_ifSetOr($_REQUEST['ins_col'], null, 'array');
$del_col = PMA_ifSetOr($_REQUEST['del_col'], null, 'array');
$prev_criteria = isset($_REQUEST['prev_criteria'])
? $_REQUEST['prev_criteria']
: array();
$criteria = isset($_REQUEST['criteria'])
? $_REQUEST['criteria']
: array_fill(0, $col_cnt, '');
$ins_row = isset($_REQUEST['ins_row'])
? $_REQUEST['ins_row']
: array_fill(0, $col_cnt, '');
$del_row = isset($_REQUEST['del_row'])
? $_REQUEST['del_row']
: array_fill(0, $col_cnt, '');
$and_or_row = isset($_REQUEST['and_or_row'])
? $_REQUEST['and_or_row']
: array_fill(0, $col_cnt, '');
$and_or_col = isset($_REQUEST['and_or_col'])
? $_REQUEST['and_or_col']
: array_fill(0, $col_cnt, '');
// minimum width
$form_column_width = 12;
$col = max($col_cnt + $add_col, 0);
$row = max($rows + $add_row, 0);
// The tables list sent by a previously submitted form
if (PMA_isValid($_REQUEST['TableList'], 'array')) {
foreach ($_REQUEST['TableList'] as $each_table) {
$tbl_names[$each_table] = ' selected="selected"';
}
} // end if
// this was a work in progress, deactivated for now
//$columns = PMA_DBI_get_columns_full($GLOBALS['db']);
//$tables = PMA_DBI_get_columns_full($GLOBALS['db']);
/**
* Prepares the form
*/
$tbl_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
$tbl_result_cnt = PMA_DBI_num_rows($tbl_result);
if (0 == $tbl_result_cnt) {
PMA_Message::error('strNoTablesFound')->display();
require_once './libraries/footer.inc.php';
exit;
}
// The tables list gets from MySQL
while (list($tbl) = PMA_DBI_fetch_row($tbl_result)) {
$fld_results = PMA_DBI_get_fields($db, $tbl);
if (empty($tbl_names[$tbl]) && !empty($_REQUEST['TableList'])) {
$tbl_names[$tbl] = '';
} else {
$tbl_names[$tbl] = ' selected="selected"';
} // end if
// The fields list per selected tables
if ($tbl_names[$tbl] == ' selected="selected"') {
$each_table = PMA_backquote($tbl);
$fld[] = $each_table . '.*';
foreach ($fld_results as $each_field) {
$each_field = $each_table . '.' . PMA_backquote($each_field['Field']);
$fld[] = $each_field;
// increase the width if necessary
$form_column_width = max(strlen($each_field), $form_column_width);
} // end foreach
} // end if
} // end while
PMA_DBI_free_result($tbl_result);
// largest width found
$realwidth = $form_column_width . 'ex';
/**
* Displays the Query by example form
*/
/**
* Enter description here...
*
* @param array $columns
* @param numeric $column_number
* @param string $selected
*/
function showColumnSelectCell($columns, $column_number, $selected = '')
{
?>
|
|
|
|