From cac4247057ce6811f920d10661fc7ca80e121e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 25 Oct 2006 12:25:01 +0000 Subject: Rename db_* files to drop useless _details part. --- db_qbe.php | 1031 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1031 insertions(+) create mode 100644 db_qbe.php (limited to 'db_qbe.php') diff --git a/db_qbe.php b/db_qbe.php new file mode 100644 index 0000000000..f57630f0b4 --- /dev/null +++ b/db_qbe.php @@ -0,0 +1,1031 @@ + execute it, else display the headers + */ +if (isset($_REQUEST['submit_sql']) + && preg_match('@^SELECT@i', $_REQUEST['encoded_sql_query'])) { + $goto = 'db_sql.php'; + $zero_rows = htmlspecialchars($GLOBALS['strSuccess']); + $sql_query = urldecode($_REQUEST['encoded_sql_query']); + 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', $_REQUEST['encoded_sql_query'])) { + echo '
' . $GLOBALS['strHaveToShow'] . '
'; +} + + +/** + * Initialize some variables + */ +$col_cnt = isset($_REQUEST['col_cnt']) ? (int) $_REQUEST['col_cnt'] : 3; +$add_col = isset($_REQUEST['add_col']) ? (int) $_REQUEST['add_col'] : 0; +$add_row = isset($_REQUEST['add_row']) ? (int) $_REQUEST['add_row'] : 0; + +$rows = isset($_REQUEST['rows']) ? (int) $_REQUEST['rows'] : 0; +$ins_col = isset($_REQUEST['ins_col']) ? $_REQUEST['ins_col'] : array(); +$del_col = isset($_REQUEST['del_col']) ? $_REQUEST['del_col'] : 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 (!empty($TableList)) { + $cnt_table_list = count($TableList); + for ($x = 0; $x < $cnt_table_list; $x++) { + $tbl_names[urldecode($TableList[$x])] = ' 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); +$i = 0; +$k = 0; + +// The tables list gets from MySQL +while ($i < $tbl_result_cnt) { + list($tbl) = PMA_DBI_fetch_row($tbl_result); + $fld_results = PMA_DBI_get_fields($db, $tbl); + $fld_results_cnt = ($fld_results) ? count($fld_results) : 0; + $j = 0; + + if (empty($tbl_names[$tbl]) && !empty($TableList)) { + $tbl_names[$tbl] = ''; + } else { + $tbl_names[$tbl] = ' selected="selected"'; + } // end if + + // The fields list per selected tables + if ($tbl_names[$tbl] == ' selected="selected"') { + $fld[$k++] = PMA_backquote($tbl) . '.*'; + while ($j < $fld_results_cnt) { + $fld[$k] = PMA_convert_display_charset($fld_results[$j]['Field']); + $fld[$k] = PMA_backquote($tbl) . '.' . PMA_backquote($fld[$k]); + + // increase the width if necessary + if (strlen($fld[$k]) > $form_column_width) { + $form_column_width = strlen($fld[$k]); + } //end if + + $k++; + $j++; + } // end while + } // end if + + $i++; +} // end if +PMA_DBI_free_result($tbl_result); + +// largest width found +$realwidth = $form_column_width . 'ex'; + + +/** + * Displays the Query by example form + */ + +function showColumnSelectCell($columns, $column_number, $selected = '') +{ + ?> + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
:
: + + + +
: + + + /> +
: + + + + +
+ + + + + + + + + + + + +
+ : + + + : + + /> +   +
+ : + + + : + + /> +   +
+
+ + + +
+ + + + + + + + + + + + +
+ : + + + : + + /> +
+ : + + + : + + /> +
+
+ + + +
: + : + /> +   : + /> +
+ + +    + +
+ : + /> +   : + /> +
+ + +    + +
+ + + +
+ + + + + + + + + +
+ : + +  : + +  
+
+ + + + + + +
+
+ + $val) { + $strTableListOptions .= ' '; + $strTableListOptions .= '' . "\n"; + $numTableListOptions++; +} +?> + +
+
+ +
+
  +
+ + + + +
+
+ +
+
+
+ -- cgit v1.2.3