Skip to content

Commit

Permalink
Revert "Handle comments in the beginning of the query"
Browse files Browse the repository at this point in the history
This reverts commit 55a2d06.

Signed-off-by: Marc Delisle <marc@infomarc.info>
  • Loading branch information
lem9 committed Aug 8, 2015
1 parent 78a6214 commit 89296f4
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions libraries/plugins/import/ImportSql.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ private function _findDelimiterPosition()
{
$this->_firstSearchChar = null;
$firstSqlDelimiter = null;
$commentStartPosition = null;
$matches = null;

/* while not at end of line */
Expand All @@ -273,45 +272,27 @@ private function _findDelimiterPosition()
"\n",
$this->_delimiterPosition
);
//Set _queryBeginPosition if comment is at the beginning of the query
if ($commentStartPosition === 0) {
if (false === $posClosingComment) {
$this->_queryBeginPosition = $this->_stringFctToUse['strlen']($this->_data);
} else {
$this->_queryBeginPosition = $posClosingComment + 1;
}
}
if (false === $posClosingComment) {
return false;
}
//Move after the end of the line.
$this->_delimiterPosition = $posClosingComment + 1;
$this->_isInComment = false;
$this->_openingComment = null;
$commentStartPosition = null;
} elseif ('/*' === $this->_openingComment) {
//Search for closing comment
$posClosingComment = $this->_stringFctToUse['strpos'](
$this->_data,
'*/',
$this->_delimiterPosition
);
//Set _queryBeginPosition if comment is at the beginning of the query
if ($commentStartPosition === 0) {
if (false === $posClosingComment) {
$this->_queryBeginPosition = $this->_stringFctToUse['strlen']($this->_data);
} else {
$this->_queryBeginPosition = $posClosingComment + 2;
}
}
if (false === $posClosingComment) {
return false;
}
//Move after closing comment.
$this->_delimiterPosition = $posClosingComment + 2;
$this->_isInComment = false;
$this->_openingComment = null;
$commentStartPosition = null;
} else {
//We shouldn't be able to come here.
//throw new Exception('Unknown case.');
Expand Down Expand Up @@ -380,7 +361,6 @@ private function _findDelimiterPosition()
if (in_array($specialChars, array('#', '-- ', '/*'))) {
$this->_isInComment = true;
$this->_openingComment = $specialChars;
$commentStartPosition = $this->_firstSearchChar;
//Move before comment opening.
$this->_delimiterPosition = $this->_firstSearchChar
+ $this->_stringFctToUse['strlen']($specialChars);
Expand Down

0 comments on commit 89296f4

Please sign in to comment.