This repository has been archived by the owner on Sep 20, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
112 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Wikibase\Database; | ||
|
||
/** | ||
* @since 0.2 | ||
* | ||
* @licence GNU GPL v2+ | ||
* @author Jeroen De Dauw < jeroendedauw@gmail.com > | ||
*/ | ||
interface IdentifierEscaper { | ||
|
||
/** | ||
* @param mixed $identifier | ||
* | ||
* @return string The escaped identifier | ||
*/ | ||
public function getEscapedIdentifier( $identifier ); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Wikibase\Database\Standalone; | ||
|
||
use DatabaseBase; | ||
use Wikibase\Database\Escaper; | ||
|
||
/** | ||
* Service for escaping values and identifiers. | ||
* | ||
* @since 0.2 | ||
* @licence GNU GPL v2+ | ||
* @author Jeroen De Dauw < jeroendedauw@gmail.com > | ||
*/ | ||
class DatabaseEscaper implements Escaper { | ||
|
||
protected $dbConnection; | ||
|
||
public function __construct( DatabaseBase $dbConnection ) { | ||
$this->dbConnection = $dbConnection; | ||
} | ||
|
||
/** | ||
* @see Escaper::getEscapedValue | ||
* | ||
* @param mixed $value | ||
* | ||
* @return string The escaped value | ||
*/ | ||
public function getEscapedValue( $value ) { | ||
return $this->dbConnection->addQuotes( $value ); | ||
} | ||
|
||
/** | ||
* @see Escaper::getEscapedIdentifier | ||
* | ||
* @param mixed $identifier | ||
* | ||
* @return string The escaped identifier | ||
*/ | ||
public function getEscapedIdentifier( $identifier ) { | ||
return $this->dbConnection->addIdentifierQuotes( $identifier ); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Wikibase\Database; | ||
|
||
/** | ||
* @since 0.2 | ||
* | ||
* @licence GNU GPL v2+ | ||
* @author Jeroen De Dauw < jeroendedauw@gmail.com > | ||
*/ | ||
interface ValueEscaper { | ||
|
||
/** | ||
* @param mixed $value | ||
* | ||
* @return string The escaped value | ||
*/ | ||
public function getEscapedValue( $value ); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.