* @file
* @ingroup Database
*/
-use Wikimedia\Rdbms\Blob;
-use Wikimedia\Rdbms\SQLiteField;
+namespace Wikimedia\Rdbms;
+
+use PDO;
+use PDOException;
+use LockManager;
+use FSLockManager;
+use InvalidArgumentException;
+use RuntimeException;
+use stdClass;
/**
* @ingroup Database
$p['dbFilePath'] = $filename;
$p['schema'] = false;
$p['tablePrefix'] = '';
+ /** @var DatabaseSqlite $db */
+ $db = Database::factory( 'sqlite', $p );
- return Database::factory( 'sqlite', $p );
+ return $db;
}
/**
/**
* @param array $options
- * @return string
+ * @return array
*/
protected function makeUpdateOptionsArray( $options ) {
$options = parent::makeUpdateOptionsArray( $options );
return "x'" . bin2hex( $s->fetch() ) . "'";
} elseif ( is_bool( $s ) ) {
return (int)$s;
- } elseif ( strpos( $s, "\0" ) !== false ) {
+ } elseif ( strpos( (string)$s, "\0" ) !== false ) {
// SQLite doesn't support \0 in strings, so use the hex representation as a workaround.
// This is a known limitation of SQLite's mprintf function which PDO
// should work around, but doesn't. I have reported this to php.net as bug #63419:
'For consistency all binary data should have been ' .
'first processed with self::encodeBlob()'
);
- return "x'" . bin2hex( $s ) . "'";
+ return "x'" . bin2hex( (string)$s ) . "'";
} else {
- return $this->mConn->quote( $s );
+ return $this->mConn->quote( (string)$s );
}
}
- /**
- * @return string
- */
- function buildLike() {
- $params = func_get_args();
- if ( count( $params ) > 0 && is_array( $params[0] ) ) {
- $params = $params[0];
- }
-
- return parent::buildLike( $params ) . "ESCAPE '\' ";
- }
-
/**
* @param string $field Field or column to cast
* @return string
return 'SQLite ' . (string)$this->mConn->getAttribute( PDO::ATTR_SERVER_VERSION );
}
}
+
+class_alias( DatabaseSqlite::class, 'DatabaseSqlite' );