aboutsummaryrefslogtreecommitdiffstats
path: root/includes/libs/rdbms/field/SQLiteField.php
diff options
context:
space:
mode:
authorAaron Schulz <aschulz@wikimedia.org>2016-09-14 03:11:41 -0700
committerAaron Schulz <aschulz@wikimedia.org>2016-09-14 20:40:12 -0700
commit0bbba6e0d4a99a63c020acb402b6e57baa4863b0 (patch)
tree7ed49580c8a337a9238acce07304fc4058b35edc /includes/libs/rdbms/field/SQLiteField.php
parentc1c68c92f27969fd763a63300142e1aba4b0f164 (diff)
downloadmediawikicore-0bbba6e0d4a99a63c020acb402b6e57baa4863b0.tar.gz
mediawikicore-0bbba6e0d4a99a63c020acb402b6e57baa4863b0.zip
Move various DB helper classes to /libs/rdbms
Change-Id: I0724f1acce4f6c43b1f0983fa119e628e7c53ba5
Diffstat (limited to 'includes/libs/rdbms/field/SQLiteField.php')
-rw-r--r--includes/libs/rdbms/field/SQLiteField.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/includes/libs/rdbms/field/SQLiteField.php b/includes/libs/rdbms/field/SQLiteField.php
new file mode 100644
index 000000000000..0a2389bfb0a7
--- /dev/null
+++ b/includes/libs/rdbms/field/SQLiteField.php
@@ -0,0 +1,39 @@
+<?php
+class SQLiteField implements Field {
+ private $info, $tableName;
+
+ function __construct( $info, $tableName ) {
+ $this->info = $info;
+ $this->tableName = $tableName;
+ }
+
+ function name() {
+ return $this->info->name;
+ }
+
+ function tableName() {
+ return $this->tableName;
+ }
+
+ function defaultValue() {
+ if ( is_string( $this->info->dflt_value ) ) {
+ // Typically quoted
+ if ( preg_match( '/^\'(.*)\'$', $this->info->dflt_value ) ) {
+ return str_replace( "''", "'", $this->info->dflt_value );
+ }
+ }
+
+ return $this->info->dflt_value;
+ }
+
+ /**
+ * @return bool
+ */
+ function isNullable() {
+ return !$this->info->notnull;
+ }
+
+ function type() {
+ return $this->info->type;
+ }
+}