@@ -3598,4 +3598,63 @@ public function testLastInsertId(): void {
3598
3598
$ this ->assertQuery ( "INSERT INTO t (name) VALUES ('b') " );
3599
3599
$ this ->assertEquals ( 2 , $ this ->engine ->get_insert_id () );
3600
3600
}
3601
+
3602
+ public function testCharLength (): void {
3603
+ $ this ->assertQuery (
3604
+ 'CREATE TABLE t (
3605
+ ID INTEGER PRIMARY KEY AUTO_INCREMENT,
3606
+ name VARCHAR(20)
3607
+ ); '
3608
+ );
3609
+
3610
+ $ this ->assertQuery ( "INSERT INTO t (name) VALUES ('a') " );
3611
+ $ this ->assertQuery ( "INSERT INTO t (name) VALUES ('ab') " );
3612
+ $ this ->assertQuery ( "INSERT INTO t (name) VALUES ('abc') " );
3613
+
3614
+ $ this ->assertQuery ( 'SELECT CHAR_LENGTH(name) AS len FROM t ' );
3615
+ $ this ->assertEquals (
3616
+ array (
3617
+ (object ) array ( 'len ' => '1 ' ),
3618
+ (object ) array ( 'len ' => '2 ' ),
3619
+ (object ) array ( 'len ' => '3 ' ),
3620
+ ),
3621
+ $ this ->engine ->get_query_results ()
3622
+ );
3623
+ }
3624
+
3625
+ public function _testAsdf () {
3626
+ $ this ->assertQuery (
3627
+ 'CREATE TABLE t (id INT) '
3628
+ );
3629
+ $ this ->assertQuery (
3630
+ 'INSERT INTO t (id) VALUES (1) '
3631
+ );
3632
+ $ this ->assertQuery (
3633
+ 'SELECT non_existent_column FROM t LIMIT 0 '
3634
+ );
3635
+ var_dump ( $ this ->engine ->executed_sqlite_queries );
3636
+ var_dump ( $ this ->engine ->get_error_message () );
3637
+ $ this ->assertCount ( 1 , $ this ->engine ->get_query_results () );
3638
+ }
3639
+
3640
+ public function _testXyz () {
3641
+ $ this ->assertQuery (
3642
+ "INSERT INTO wp_actionscheduler_actions ( `hook`, `status`, `scheduled_date_gmt`, `scheduled_date_local`, `schedule`, `group_id`, `priority`, `args` ) SELECT 'action_scheduler/migration_hook', 'pending', '2025-01-28 15:14:01', '2025-01-28 15:14:01', 'O:30: \"ActionScheduler_SimpleSchedule \":2:{s:22: \"\0* \0scheduled_timestamp \";i:1738077241;s:41: \"\0ActionScheduler_SimpleSchedule \0timestamp \";i:1738077241;}', 2, 10, '[]' FROM DUAL WHERE ( SELECT NULL FROM DUAL ) IS NULL "
3643
+ );
3644
+ }
3645
+
3646
+ public function testAaa () {
3647
+ $ this ->assertQuery (
3648
+ '
3649
+ CREATE TABLE t (
3650
+ id int(11) unsigned NOT NULL AUTO_INCREMENT,
3651
+ name varchar(90) NOT NULL,
3652
+ type varchar(90) NOT NULL DEFAULT \'default \',
3653
+ description varchar(250) NOT NULL DEFAULT \'\',
3654
+ created_at timestamp NULL,
3655
+ updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
3656
+ )
3657
+ '
3658
+ );
3659
+ }
3601
3660
}
0 commit comments