PluginProbe
SQLite Database Integration / 3.1.0
SQLite Database Integration v3.1.0
3.1.0 3.0.2 3.0.1 trunk 2.1.13 2.1.14 2.1.15 2.1.16 2.2.0 2.2.1 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.17 2.2.18 2.2.19 2.2.2 2.2.20 2.2.21 2.2.22 2.2.23 All 33 releases
← All changes | wp-includes/database/sqlite/class-wp-sqlite-information-schema-exception.php +17 -0 2.2.23 → 3.1.0 View file →
@@ -4,8 +4,10 @@
4 4 * SQLite information schema exception.
5 5 *
6 6 * This class is used to represent errors that may occur when building
7 7 * the MySQL information schema for emulation in SQLite.
8 + *
9 + * @access private
8 10 */
9 11 class WP_SQLite_Information_Schema_Exception extends Exception {
10 12 // Information schema exception types.
11 13 const TYPE_DUPLICATE_TABLE_NAME = 'duplicate-table-name';
@@ -13,8 +15,9 @@
13 15 const TYPE_DUPLICATE_KEY_NAME = 'duplicate-key-name';
14 16 const TYPE_KEY_COLUMN_NOT_FOUND = 'key-column-not-found';
15 17 const TYPE_CONSTRAINT_DOES_NOT_EXIST = 'constraint-does-not-exist';
16 18 const TYPE_MULTIPLE_CONSTRAINTS_WITH_NAME = 'multiple-constraints-with-name';
19 + const TYPE_INVALID_DEFAULT_VALUE = 'invalid-default-value';
17 20
18 21 /**
19 22 * The exception type.
20 23 *
@@ -146,7 +149,21 @@
146 149 return new self(
147 150 self::TYPE_MULTIPLE_CONSTRAINTS_WITH_NAME,
148 151 sprintf( "Table has multiple constraints with the name '%s'. Please use constraint specific 'DROP' clause.", $name ),
149 152 array( 'name' => $name )
153 + );
154 + }
155 +
156 + /**
157 + * Create an invalid default value exception.
158 + *
159 + * @param string $column_name The name of the affected column.
160 + * @return self The exception instance.
161 + */
162 + public static function invalid_default_value( string $column_name ): WP_SQLite_Information_Schema_Exception {
163 + return new self(
164 + self::TYPE_INVALID_DEFAULT_VALUE,
165 + sprintf( "Invalid default value for '%s'.", $column_name ),
166 + array( 'column_name' => $column_name )
150 167 );
151 168 }
152 169 }