return implode( $glue, $sqls );
}
+ public function unixTimestamp( $field ) {
+ return $field;
+ }
+
function wasDeadlock() {
return $this->lastErrno() == 5; // SQLITE_BUSY
}
}
}
- function quote_ident( $s ) {
- return $s;
- }
-
function buildLike() {
$params = func_get_args();
if ( count( $params ) > 0 && is_array( $params[0] ) ) {
$sql = preg_replace( '/\b' . preg_quote( $oldName ) . '\b/', $newName, $sql, 1 );
return $this->query( $sql, $fname );
}
+
+
+ /**
+ * List all tables on the database
+ *
+ * @param $prefix Only show tables with this prefix, e.g. mw_
+ * @param $fname String: calling function name
+ */
+ function listTables( $prefix = null, $fname = 'DatabaseSqlite::listTables' ) {
+ $result = $this->select(
+ 'sqlite_master',
+ 'name',
+ "type='table'"
+ );
+
+ $endArray = array();
+
+ foreach( $result as $table ) {
+ $vars = get_object_vars($table);
+ $table = array_pop( $vars );
+
+ if( !$prefix || strpos( $table, $prefix ) === 0 ) {
+ if ( strpos( $table, 'sqlite_' ) !== 0 ) {
+ $endArray[] = $table;
+ }
+
+ }
+ }
+
+ return $endArray;
+ }
} // end DatabaseSqlite class
/**
* @ingroup Database
*/
-class SQLiteField {
+class SQLiteField implements Field {
private $info, $tableName;
function __construct( $info, $tableName ) {
$this->info = $info;
return $this->info->dflt_value;
}
- function maxLength() {
- return -1;
+ function isNullable() {
+ return !$this->info->notnull;
}
- function nullable() {
- // SQLite dynamic types are always nullable
- return true;
- }
-
- # isKey(), isMultipleKey() not implemented, MySQL-specific concept.
- # Suggest removal from base class [TS]
-
function type() {
return $this->info->type;
}