diff --git a/config.inc.php3 b/config.inc.php3
index 41727dd60..d740430f1 100755
--- a/config.inc.php3
+++ b/config.inc.php3
@@ -232,7 +232,7 @@ $cfg['colorFunctions'] = 'red';
$cfg['colorKeywords'] = 'blue';
$cfg['colorStrings'] = 'green';
$cfg['colorColType'] = '#FF9900';
-$cfg['colorAdd'] = '#9999CC';
+$cfg['colorAdd'] = 'blue';
/**
@@ -312,6 +312,7 @@ if($cfg['UseSyntaxColoring']) {
'SELECT',
'INSERT',
'LEFT',
+ 'INNER',
'UPDATE',
'REPLACE',
'EXPLAIN',
@@ -326,7 +327,8 @@ if($cfg['UseSyntaxColoring']) {
'ORDER',
'CHANGE',
'CREATE',
- 'DELETE'
+ 'DELETE',
+ 'VALUES'
);
} // end if
if($cfg['UseSyntaxColoring']) {
diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3
index 47c7c9e94..a3ab47787 100644
--- a/libraries/common.lib.php3
+++ b/libraries/common.lib.php3
@@ -210,35 +210,41 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$_skeyw = '^' . implode('$|^', $cfg['keywords']) . '$';
$_scoltype = '^' . implode('$|^', $cfg['ColumnTypes']) . '$';
$_add = '^' . implode('$|^', $cfg['additional']) . '$';
- // first of all lets remove all newlines - we'll add our own later
+ // first of all lets remove all newlines - we'll add our own later
$sql = str_replace("\n", ' ', $sql);
// there should always be blanks around = and after , ()
$sql = str_replace('=', ' = ', $sql);
$sql = str_replace(',', ', ', $sql);
$sql = str_replace(')', ' ) ', $sql);
$sql = str_replace('(', ' ( ', $sql);
- $sql = str_replace(';', ' ; ', $sql);
+ $sql = str_replace(';', ' ; ', $sql);
// now split everything by the blanks
$_sql_parts=explode(' ',$sql);
// start a loop over the parts check each word and put them back into $sql
unset($sql);
$s_nr=0;
-
+
while (list($_num,$_word) = each($_sql_parts)) {
// we might have added to many blanks when checking for = and ,
// which might lead to empty members in the array
if(strlen($_word)==0){continue;}
+ $_is_string = FALSE;
// Anything inside quots might be more than one word
// so as we splitted by the blanks we have to try to get those parts back
// together
- if (substr($_word, 0, 1) == '\'' || substr($_word, 0, 1) == '"') {
+ if (
+ (substr($_word, 0, 1) == '\'' || substr($_word, 0, 1) == '"') &&
+ (!isset($_temp) || strlen($_temp)==0)
+ ) {
// start of a string
$_temp = $_word;
- } else {
+ $_is_string = TRUE;
+ } else {
if(isset($_temp) && strlen($_temp)>0){
// we are continuing a string
$_temp .= $_word;
+ $_is_string = TRUE;
}
}
if(substr($_word, strlen($_word)-1, 1) == '\''
@@ -246,7 +252,9 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
// End of a String
$_word = '' . $_temp . '';
$_temp = '';
- } else {
+ $_is_string = FALSE;
+ }
+ if(!isset($_is_string) || $_is_string == FALSE) {
// no String
if(eregi($_sfuncs, $_word)) {
$_word = '' . $_word . '';
@@ -257,7 +265,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
} else {
$_word = "\n" . $_word;
}
-
+
} else {
if(eregi($_scoltype, $_word)) {
$_word = '' . $_word . '';
@@ -271,6 +279,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
if($_word==')') {
if(isset($_brack_o)){
unset($_brack_o[count($_brack_o)-1]);
+ if(count($_brack_o)==0){ unset($_brack_o);}
} else {
$_brack_c[]=$s_nr;
}
@@ -299,11 +308,12 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
if(isset($_brack_c)) {
while (list($_num,$elem) = each($_brack_c)) {
$_sql_p[$elem] = '' . $_sql_p[$elem] . '';
- echo '
' . $GLOBALS['strMissingBracket'] . '
';
+ echo '
' . $GLOBALS['strMissingBracket'] . '
';
}
}
$sql = implode(' ',$_sql_p);
- return nl2br($sql);
+ $sql = ereg_replace("((\015\012)|(\015)|(\012))+", '
', $sql);
+ return $sql;
} // End of PMA_format_sql function
/**
@@ -1097,7 +1107,7 @@ if (typeof(document.getElementById) != 'undefined'
if (!empty($GLOBALS['show_as_php'])) {
$new_line = '";
' . "\n" . ' $sql .= "';
}else{
- $new_line = "\n";
+ $new_line = "
\n";
}
$query_base = htmlspecialchars($GLOBALS['sql_query']);
$query_base = ereg_replace("((\015\012)|(\015)|(\012))+", $new_line, $query_base);
diff --git a/read_dump.php3 b/read_dump.php3
index ceb3db286..512759565 100644
--- a/read_dump.php3
+++ b/read_dump.php3
@@ -355,7 +355,7 @@ if ($sql_query != '') {
$a_sql_query = $pieces[$i];
$result = mysql_query($a_sql_query);
if ($result == FALSE) { // readdump failed
- $my_die = PMA_format_sql($a_sql_query);
+ $my_die = $a_sql_query;
break;
}
if (!isset($reload) && eregi('^(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)', $a_sql_query)) {