| ' . "\n";
- } else {
- // o t h e r c a s e s
- $the_class = 'textfield';
- $type = $fields_type[$i];
- if ($type == 'date') {
- $the_class .= ' datefield';
- } elseif ($type == 'datetime' || substr($type, 0, 9) == 'timestamp') {
- $the_class .= ' datetimefield';
- }
- echo ' ' . "\n";
- };
- ?>
+ echo PMA_getForeignFields_Values($foreigners, $foreignData, $field, $fields_type, $i, $db, $table, $titles,$GLOBALS['cfg']['ForeignKeyMaxLimit'], '' );
+
+ ?>
+
+
+
+ do the work
*/
else {
+ echo "ZZ";
// Builds the query
$sql_query = 'SELECT ' . (isset($distinct) ? 'DISTINCT ' : '');
@@ -354,88 +255,18 @@ else {
$sql_query .= ' WHERE ' . $where;
} else {
$w = $charsets = array();
- $unary_operators = array(
- 'IS NULL' => 1,
- 'IS NOT NULL' => 1,
- "= ''" => 1,
- "!= ''" => 1
- );
$cnt_func = count($func);
reset($func);
while (list($i, $func_type) = each($func)) {
- list($charsets[$i]) = explode('_', $collations[$i]);
- if (isset($unary_operators[$func_type])) {
- $fields[$i] = '';
- $w[] = PMA_backquote($names[$i]) . ' ' . $func_type;
-
- } elseif (strncasecmp($types[$i], 'enum', 4) == 0) {
- if (!empty($fields[$i])) {
- if (! is_array($fields[$i])) {
- $fields[$i] = explode(',', $fields[$i]);
- }
- $enum_selected_count = count($fields[$i]);
- if ($func_type == '=' && $enum_selected_count > 1) {
- $func_type = $func[$i] = 'IN';
- $parens_open = '(';
- $parens_close = ')';
-
- } elseif ($func_type == '!=' && $enum_selected_count > 1) {
- $func_type = $func[$i] = 'NOT IN';
- $parens_open = '(';
- $parens_close = ')';
-
- } else {
- $parens_open = '';
- $parens_close = '';
- }
- $enum_where = '\'' . PMA_sqlAddSlashes($fields[$i][0]) . '\'';
- for ($e = 1; $e < $enum_selected_count; $e++) {
- $enum_where .= ', \'' . PMA_sqlAddSlashes($fields[$i][$e]) . '\'';
- }
-
- $w[] = PMA_backquote($names[$i]) . ' ' . $func_type . ' ' . $parens_open . $enum_where . $parens_close;
- }
-
- } elseif ($fields[$i] != '') {
- // For these types we quote the value. Even if it's another type (like INT),
- // for a LIKE we always quote the value. MySQL converts strings to numbers
- // and numbers to strings as necessary during the comparison
- if (preg_match('@char|binary|blob|text|set|date|time|year@i', $types[$i]) || strpos(' ' . $func_type, 'LIKE')) {
- $quot = '\'';
- } else {
- $quot = '';
- }
-
- // LIKE %...%
- if ($func_type == 'LIKE %...%') {
- $func_type = 'LIKE';
- $fields[$i] = '%' . $fields[$i] . '%';
- }
- if ($func_type == 'REGEXP ^...$') {
- $func_type = 'REGEXP';
- $fields[$i] = '^' . $fields[$i] . '$';
- }
-
- if ($func_type == 'IN (...)' || $func_type == 'NOT IN (...)' || $func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN') {
- $func_type = str_replace(' (...)', '', $func_type);
-
- // quote values one by one
- $values = explode(',', $fields[$i]);
- foreach ($values as &$value)
- $value = $quot . PMA_sqlAddSlashes(trim($value)) . $quot;
-
- if ($func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN')
- $w[] = PMA_backquote($names[$i]) . ' ' . $func_type . ' ' . (isset($values[0]) ? $values[0] : '') . ' AND ' . (isset($values[1]) ? $values[1] : '');
- else
- $w[] = PMA_backquote($names[$i]) . ' ' . $func_type . ' (' . implode(',', $values) . ')';
- }
- else {
- $w[] = PMA_backquote($names[$i]) . ' ' . $func_type . ' ' . $quot . PMA_sqlAddSlashes($fields[$i]) . $quot;;
- }
-
- } // end if
+
+ list($charsets[$i]) = explode('_', $collations[$i]);
+ $unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) ? true : false;
+ $whereClause = PMA_tbl_search_getWhereClause($fields[$i],$names[$i], $types[$i], $collations[$i], $func_type, $unaryFlag);
+ if($whereClause)
+ $w[] = $whereClause;
+
} // end for
-
+ //print_r($w);
if ($w) {
$sql_query .= ' WHERE ' . implode(' AND ', $w);
}
@@ -444,7 +275,6 @@ else {
if ($orderField != '--nil--') {
$sql_query .= ' ORDER BY ' . PMA_backquote($orderField) . ' ' . $order;
} // end if
-
require './sql.php';
}
diff --git a/tbl_zoom_select.php b/tbl_zoom_select.php
new file mode 100644
index 0000000000..cdb784d00b
--- /dev/null
+++ b/tbl_zoom_select.php
@@ -0,0 +1,447 @@
+ displays the selection form
+ */
+
+ // Gets some core libraries
+ require_once './libraries/tbl_common.php';
+ //$err_url = 'tbl_select.php' . $err_url;
+ $url_query .= '&goto=tbl_select.php&back=tbl_select.php';
+
+ /**
+ * Gets tables informations
+ */
+ require_once './libraries/tbl_info.inc.php';
+
+ /**
+ * Displays top menu links
+ */
+ require_once './libraries/tbl_links.inc.php';
+
+ if (! isset($goto)) {
+ $goto = $GLOBALS['cfg']['DefaultTabTable'];
+ }
+ // Defines the url to return to in case of error in the next sql statement
+ $err_url = $goto . '?' . PMA_generate_common_url($db, $table);
+
+ // Gets the list and number of fields
+
+ list($fields_list, $fields_type, $fields_collation, $fields_null) = PMA_tbl_getFields($table,$db);
+ $fields_cnt = count($fields_list);
+
+ // retrieve keys into foreign fields, if any
+ // check also foreigners even if relwork is FALSE (to get
+ // foreign keys from innodb)
+ $foreigners = PMA_getForeigners($db, $table);
+ $flag = 1;
+ $tbl_fields_type = $tbl_fields_collation = $tbl_fields_null = array();
+ if(!isset($zoom_submit) && !isset($inputs))
+ $dataLabel = PMA_getDisplayField($db,$table);
+
+ ?>
+
+
+
+
+
+
+
|