Skip to content

Commit 78f650d

Browse files
committed
Merge branch 'develop' into pdo-api
2 parents 72c05d3 + 9334343 commit 78f650d

File tree

3 files changed

+58
-11
lines changed

3 files changed

+58
-11
lines changed

.github/workflows/wp-tests-phpunit-run.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ const expectedFailures = [
4444
'Tests_DB_Charset::test_get_column_charset_non_mysql with data set #5',
4545
'Tests_DB_Charset::test_get_column_charset_non_mysql with data set #6',
4646
'Tests_DB_Charset::test_get_column_charset_non_mysql with data set #7',
47-
'Tests_DB_Charset::test_get_table_charset with data set #1',
48-
'Tests_DB_Charset::test_get_table_charset with data set #4',
49-
'Tests_DB_Charset::test_get_table_charset with data set #5',
50-
'Tests_DB_Charset::test_get_table_charset with data set #6',
51-
'Tests_DB_Charset::test_get_table_charset with data set #7',
5247
'Tests_DB_Charset::test_process_field_charsets_on_nonexistent_table',
5348
'Tests_DB_Charset::test_strip_invalid_text with data set #21',
5449
'Tests_DB_Charset::test_strip_invalid_text with data set #22',
@@ -70,9 +65,6 @@ const expectedFailures = [
7065
'Tests_DB_Charset::test_strip_invalid_text with data set #40',
7166
'Tests_DB_Charset::test_strip_invalid_text with data set #41',
7267
'Tests_DB_Charset::test_strip_invalid_text_for_column_bails_if_ascii_input_too_long',
73-
'Tests_DB_Charset::test_strip_invalid_text_from_query with data set "utf8 + utf8mb4"',
74-
'Tests_DB_Charset::test_table_collation_check with data set "utf8_bin + big5_chinese_ci"',
75-
'Tests_DB_Charset::test_table_collation_check with data set "utf8_unicode_ci"',
7668
'Tests_DB_dbDelta::test_spatial_indices',
7769
'Tests_DB::test_charset_switched_to_utf8mb4',
7870
'Tests_DB::test_close',

tests/WP_SQLite_Driver_Metadata_Tests.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,38 @@ public function testShowTableStatus() {
628628
);
629629
}
630630

631+
public function testShowFullColumns(): void {
632+
$this->assertQuery( "CREATE TABLE t (id INT COMMENT 'Comment ID', name TEXT COMMENT 'Comment Name')" );
633+
$result = $this->assertQuery( 'SHOW FULL COLUMNS FROM t' );
634+
$this->assertEquals(
635+
array(
636+
(object) array(
637+
'Field' => 'id',
638+
'Type' => 'int',
639+
'Collation' => null,
640+
'Null' => 'YES',
641+
'Key' => '',
642+
'Default' => null,
643+
'Extra' => '',
644+
'Privileges' => 'select,insert,update,references',
645+
'Comment' => 'Comment ID',
646+
),
647+
(object) array(
648+
'Field' => 'name',
649+
'Type' => 'text',
650+
'Collation' => 'utf8mb4_0900_ai_ci',
651+
'Null' => 'YES',
652+
'Key' => '',
653+
'Default' => null,
654+
'Extra' => '',
655+
'Privileges' => 'select,insert,update,references',
656+
'Comment' => 'Comment Name',
657+
),
658+
),
659+
$result
660+
);
661+
}
662+
631663
public function testShowColumnsLike(): void {
632664
$this->assertQuery( 'CREATE TABLE t (id INT, val1 INT, val2 INT, name TEXT)' );
633665
$result = $this->assertQuery( "SHOW COLUMNS FROM t LIKE 'val%'" );

wp-includes/sqlite-ast/class-wp-pdo-mysql-on-sqlite.php

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3073,23 +3073,46 @@ private function execute_show_columns_statement( WP_Parser_Node $node ): void {
30733073
$condition = $this->translate_show_like_or_where_condition( $like_or_where, 'column_name' );
30743074
}
30753075

3076+
// Handle the FULL keyword.
3077+
$command_type = $node->get_first_child_node( 'showCommandType' );
3078+
$is_full = $command_type && $command_type->has_child_token( WP_MySQL_Lexer::FULL_SYMBOL );
3079+
30763080
// Fetch column information.
30773081
$columns_table = $this->information_schema_builder->get_table_name( $table_is_temporary, 'columns' );
3078-
$query = sprintf(
3079-
'SELECT
3082+
3083+
if ( $is_full ) {
3084+
$fields = '
3085+
column_name AS `Field`,
3086+
column_type AS `Type`,
3087+
collation_name AS `Collation`,
3088+
is_nullable AS `Null`,
3089+
column_key AS `Key`,
3090+
column_default AS `Default`,
3091+
extra AS `Extra`,
3092+
privileges AS `Privileges`,
3093+
column_comment AS `Comment`
3094+
';
3095+
} else {
3096+
$fields = '
30803097
column_name AS `Field`,
30813098
column_type AS `Type`,
30823099
is_nullable AS `Null`,
30833100
column_key AS `Key`,
30843101
column_default AS `Default`,
30853102
extra AS `Extra`
3103+
';
3104+
}
3105+
3106+
$query = sprintf(
3107+
'SELECT %s
30863108
FROM %s
30873109
WHERE table_schema = ? AND table_name = ? %s
30883110
ORDER BY ordinal_position',
3111+
$fields,
30893112
$this->quote_sqlite_identifier( $columns_table ),
30903113
$condition ?? ''
30913114
);
3092-
$params = array(
3115+
$params = array(
30933116
$this->get_saved_db_name( $database ),
30943117
$table_name,
30953118
);

0 commit comments

Comments
 (0)