Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Foellmann <foellmann@foe-services.de>2015-01-05 22:07:18 +0300
committerChristian Foellmann <foellmann@foe-services.de>2015-01-05 22:07:18 +0300
commit170cb05f4eec4322303658108f9eea6e55163e50 (patch)
treee9b7e9a7e287270392077d1099fe0b5dc54eeba1 /libraries/plugins
parentf3a2bbe4d8241664dbb92def1b413b616bfab1fd (diff)
UPDATE 4.3.54.3.5
Diffstat (limited to 'libraries/plugins')
-rw-r--r--libraries/plugins/import/ImportSql.class.php73
1 files changed, 22 insertions, 51 deletions
diff --git a/libraries/plugins/import/ImportSql.class.php b/libraries/plugins/import/ImportSql.class.php
index 8fa36a9d59..05727d65a3 100644
--- a/libraries/plugins/import/ImportSql.class.php
+++ b/libraries/plugins/import/ImportSql.class.php
@@ -41,11 +41,6 @@ class ImportSql extends ImportPlugin
private $_delimiterPosition = false;
/**
- * @var string Query to execute
- */
- private $_query = null;
-
- /**
* @var int Query start position
*/
private $_queryBeginPosition = 0;
@@ -217,10 +212,7 @@ class ImportSql extends ImportPlugin
{
//Search for closing quote
$posClosingString = $this->_stringFctToUse['strpos'](
- $this->_data, $this->_quote,
- $this->_delimiterPosition + $this->_stringFctToUse['strlen'](
- $this->_quote
- )
+ $this->_data, $this->_quote, $this->_delimiterPosition
);
if (false === $posClosingString) {
@@ -276,53 +268,45 @@ class ImportSql extends ImportPlugin
$posClosingComment = $this->_stringFctToUse['strpos'](
$this->_data,
"\n",
- $this->_delimiterPosition + $this->_stringFctToUse['strlen'](
- $this->_openingComment
- )
+ $this->_delimiterPosition
);
if (false === $posClosingComment) {
return false;
}
//Move after the end of the line.
$this->_delimiterPosition = $posClosingComment + 1;
+ $this->_isInComment = false;
+ $this->_openingComment = null;
} elseif ('/*' === $this->_openingComment) {
//Search for closing comment
$posClosingComment = $this->_stringFctToUse['strpos'](
$this->_data,
'*/',
- $this->_delimiterPosition + $this->_stringFctToUse['strlen'](
- $this->_openingComment
- )
+ $this->_delimiterPosition
);
if (false === $posClosingComment) {
return false;
}
//Move after closing comment.
$this->_delimiterPosition = $posClosingComment + 2;
+ $this->_isInComment = false;
+ $this->_openingComment = null;
} else {
//We shouldn't be able to come here.
//throw new Exception('Unknown case.');
break;
}
- $this->_queryBeginPosition = $this->_delimiterPosition;
- $this->_isInComment = false;
- $this->_openingComment = null;
-
continue;
}
if ($this->_isInDelimiter) {
- $posAfterKeyword = $this->_delimiterPosition
- + $this->_stringFctToUse['strlen'](
- $this->_delimiterKeyword
- );
//Search for new line.
if (!preg_match(
"/^(.*)\n/",
$this->_stringFctToUse['substr'](
$this->_data,
- $posAfterKeyword
+ $this->_delimiterPosition
),
$matches,
PREG_OFFSET_CAPTURE
@@ -332,8 +316,8 @@ class ImportSql extends ImportPlugin
$this->_setDelimiter($matches[1][0]);
//Start after delimiter and new line.
- $this->_queryBeginPosition = $posAfterKeyword + $matches[1][1]
- + $this->_delimiterLength + 1;
+ $this->_queryBeginPosition = $this->_delimiterPosition
+ + $matches[1][1] + $this->_delimiterLength + 1;
$this->_delimiterPosition = $this->_queryBeginPosition;
$this->_isInDelimiter = false;
$firstSqlDelimiter = null;
@@ -355,7 +339,6 @@ class ImportSql extends ImportPlugin
&& $firstSqlDelimiter < $this->_firstSearchChar)
) {
$this->_delimiterPosition = $firstSqlDelimiter;
- $this->_fillQuery();
return true;
}
@@ -367,8 +350,8 @@ class ImportSql extends ImportPlugin
if (in_array($specialChars, array('\'', '"', '`'))) {
$this->_isInString = true;
$this->_quote = $specialChars;
- //Move after quote.
- $this->_delimiterPosition = $this->_firstSearchChar;
+ //Move before quote.
+ $this->_delimiterPosition = $this->_firstSearchChar + 1;
continue;
}
@@ -376,16 +359,17 @@ class ImportSql extends ImportPlugin
if (in_array($specialChars, array('#', '-- ', '/*'))) {
$this->_isInComment = true;
$this->_openingComment = $specialChars;
- //Move after comment opening.
- $this->_delimiterPosition = $this->_firstSearchChar;
- $this->_fillQuery();
+ //Move before comment opening.
+ $this->_delimiterPosition = $this->_firstSearchChar
+ + $this->_stringFctToUse['strlen']($specialChars);
continue;
}
//If DELIMITER is found.
if ($specialChars === $this->_delimiterKeyword) {
$this->_isInDelimiter = true;
- $this->_delimiterPosition = $this->_firstSearchChar;
+ $this->_delimiterPosition = $this->_firstSearchChar
+ + $this->_stringFctToUse['strlen']($specialChars);
continue;
}
}
@@ -459,7 +443,11 @@ class ImportSql extends ImportPlugin
}
PMA_importRunQuery(
- $this->_query, //Query to execute
+ $this->_stringFctToUse['substr'](
+ $this->_data,
+ $this->_queryBeginPosition,
+ $this->_delimiterPosition - $this->_queryBeginPosition
+ ), //Query to execute
$this->_stringFctToUse['substr'](
$this->_data,
0,
@@ -468,7 +456,6 @@ class ImportSql extends ImportPlugin
false,
$sql_data
);
- $this->_query = null;
$this->_setData(
$this->_stringFctToUse['substr'](
@@ -625,20 +612,4 @@ class ImportSql extends ImportPlugin
return $this->_dataLength;
}
-
- /**
- * Fill current query from indexes
- *
- * @return string Current query
- */
- private function _fillQuery()
- {
- $this->_query .= $this->_stringFctToUse['substr'](
- $this->_data,
- $this->_queryBeginPosition,
- $this->_delimiterPosition - $this->_queryBeginPosition
- );
-
- return $this->_query;
- }
}