File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -3790,6 +3790,8 @@ private function translate( $node ): ?string {
37903790 return 'TEXT ' ;
37913791 case WP_MySQL_Lexer::SIGNED_SYMBOL :
37923792 case WP_MySQL_Lexer::UNSIGNED_SYMBOL :
3793+ // @TODO: Emulate UNSIGNED semantics. MySQL wraps negative
3794+ // values, but SQLite has no unsigned integer type.
37933795 return 'INTEGER ' ;
37943796 case WP_MySQL_Lexer::DECIMAL_SYMBOL :
37953797 case WP_MySQL_Lexer::FLOAT_SYMBOL :
@@ -4234,6 +4236,7 @@ private function translate_simple_expr_body( WP_Parser_Node $node ): string {
42344236
42354237 if ( null !== $ cast_type ) {
42364238 // CONVERT(expr, type): Translate to cast expression.
4239+ // TODO: Emulate UNSIGNED cast. SQLite has no unsigned integer type.
42374240 return sprintf ( 'CAST(%s AS %s) ' , $ expr , $ this ->translate ( $ cast_type ) );
42384241 } else {
42394242 // CONVERT(expr USING charset): Keep "expr" as is (no SQLite support).
Original file line number Diff line number Diff line change @@ -9971,7 +9971,8 @@ public function testCastExpression(): void {
99719971 'expr_5 ' => 'abc ' ,
99729972 'expr_6 ' => 'abc ' , // 'ab' In MySQL
99739973 'expr_7 ' => '-10 ' ,
9974- 'expr_8 ' => '-10 ' , // 18446744073709551606 in MySQL
9974+ // @TODO: Emulate UNSIGNED cast. MySQL returns 18446744073709551606 (2^64 - 10).
9975+ 'expr_8 ' => '-10 ' ,
99759976 'expr_9 ' => '2025-10-05 14:05:28 ' , // 2025-10-05 in MySQL
99769977 'expr_10 ' => '2025-10-05 14:05:28 ' , // 14:05:28 in MySQL
99779978 'expr_11 ' => '2025-10-05 14:05:28 ' ,
@@ -10005,6 +10006,7 @@ public function testConvertExpression(): void {
1000510006 'expr_1 ' => 'abc ' ,
1000610007 'expr_2 ' => 'abc ' ,
1000710008 'expr_3 ' => '-10 ' ,
10009+ // @TODO: Emulate UNSIGNED cast. MySQL returns 18446744073709551606 (2^64 - 10).
1000810010 'expr_4 ' => '-10 ' ,
1000910011 'expr_5 ' => '123.456 ' ,
1001010012 'expr_6 ' => '2025-10-05 ' ,
You can’t perform that action at this time.
0 commit comments