From 8d420dca526a0c684c47076469cccaec06118d16 Mon Sep 17 00:00:00 2001 From: Matthew Bucci Date: Wed, 21 Feb 2024 20:08:57 -0800 Subject: [PATCH] replace calls to seq by adding a RETURNING * to all insert statements --- pg4wp/driver_pgsql.php | 42 ++++++++++++++++++++++++--- pg4wp/rewriters/InsertSQLRewriter.php | 37 +++++++++++++++++++++++ tests/rewriteTest.php | 27 +++++++++++++++++ tests/stubs/insert-int_1698679874.txt | 2 +- tests/stubs/insert-int_1698679877.txt | 2 +- tests/stubs/insert-int_1698679878.txt | 2 +- tests/stubs/insert-int_1698679884.txt | 2 +- tests/stubs/insert-int_1698679897.txt | 2 +- tests/stubs/insert-int_1698679908.txt | 2 +- tests/stubs/insert-int_1698679917.txt | 2 +- tests/stubs/insert-int_1698679920.txt | 2 +- tests/stubs/insert-int_1698679923.txt | 2 +- tests/stubs/insert-int_1698679936.txt | 2 +- tests/stubs/insert-int_1698679954.txt | 2 +- tests/stubs/insert-int_1698679955.txt | 2 +- tests/stubs/insert-int_1698679965.txt | 2 +- tests/stubs/insert-int_1698679972.txt | 2 +- 17 files changed, 116 insertions(+), 18 deletions(-) diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index cea215a..184609f 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -16,6 +16,7 @@ $GLOBALS['pg4wp_numrows_query'] = ''; $GLOBALS['pg4wp_ins_table'] = ''; $GLOBALS['pg4wp_ins_field'] = ''; +$GLOBALS['pg4wp_ins_id'] = ''; $GLOBALS['pg4wp_last_insert'] = ''; $GLOBALS['pg4wp_connstr'] = ''; $GLOBALS['pg4wp_conn'] = false; @@ -465,6 +466,23 @@ function wpsqli_rollback(&$connection, $flags = 0, $name = null) pg_query($connection, "ROLLBACK"); } +function get_primary_key_for_table(&$connection, $table) +{ + $query = <<get_primary_key_for_table($connection, $tableName); + $row = pg_fetch_assoc($result); + + $GLOBALS['pg4wp_ins_id'] = $row[$primaryKey]; + } + } + return $result; } @@ -1077,9 +1108,8 @@ function wpsqli_get_primary_sequence_for_table(&$connection, $table) } } - // Fallback to default if we don't find a sequence - // Note: this will probably fail - return $table . '_seq'; + // we didn't find a sequence for this table. + return null; } /** @@ -1115,8 +1145,12 @@ function wpsqli_insert_id(&$connection = null) // PostgreSQL: Setting the value of the sequence based on the latest inserted ID. $GLOBALS['pg4wp_queued_query'] = "SELECT SETVAL('$seq',(SELECT MAX(\"ID\") FROM $table)+1);"; + } elseif($GLOBALS['pg4wp_ins_id']) { + return $GLOBALS['pg4wp_ins_id']; + } elseif(empty($sql)) { + $sql = 'NO QUERY'; + $data = 0; } else { - // PostgreSQL: Using CURRVAL() to get the current value of the sequence. // Double quoting is needed to prevent seq from being lowercased automatically $sql = "SELECT CURRVAL('\"$seq\"')"; $res = pg_query($connection, $sql); diff --git a/pg4wp/rewriters/InsertSQLRewriter.php b/pg4wp/rewriters/InsertSQLRewriter.php index fe753c7..e8461c0 100644 --- a/pg4wp/rewriters/InsertSQLRewriter.php +++ b/pg4wp/rewriters/InsertSQLRewriter.php @@ -119,6 +119,43 @@ public function rewrite(): string $sql = utf8_encode($sql); } + if(false === strpos($sql, 'RETURNING')) { + $end_of_statement = $this->findSemicolon($sql); + if ($end_of_statement !== false) { + // Create the substrings up to and after the semicolon + $sql_before_semicolon = substr($sql, 0, $end_of_statement); + $sql_after_semicolon = substr($sql, $end_of_statement, strlen($sql)); + + // Splice the SQL string together with 'RETURNING *' + $sql = $sql_before_semicolon . ' RETURNING *' . $sql_after_semicolon; + + } else { + $sql = $sql .=" RETURNING *"; + } + } + return $sql; } + + // finds semicolons that aren't in variables + private function findSemicolon($sql) { + $quoteOpened = false; + $parenthesisDepth = 0; + + $sqlAsArray = str_split($sql); + for($i=0; $iassertSame(trim($expected), trim($postgresql)); } + public function test_it_will_append_returning_id_to_insert_statements() + { + $sql = <<assertSame(trim($expected), trim($postgresql)); + } + + protected function setUp(): void diff --git a/tests/stubs/insert-int_1698679874.txt b/tests/stubs/insert-int_1698679874.txt index 7a515f5..73338c1 100644 --- a/tests/stubs/insert-int_1698679874.txt +++ b/tests/stubs/insert-int_1698679874.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_postmeta` (`post_id`, `meta_key`, `meta_value`) VALUES (55, '_edit_lock', '1698679874:1')","postgresql":"INSERT INTO wp_postmeta (post_id, meta_key, meta_value) VALUES (55, '_edit_lock', '1698679874:1')"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_postmeta` (`post_id`, `meta_key`, `meta_value`) VALUES (55, '_edit_lock', '1698679874:1')","postgresql":"INSERT INTO wp_postmeta (post_id, meta_key, meta_value) VALUES (55, '_edit_lock', '1698679874:1') RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679877.txt b/tests/stubs/insert-int_1698679877.txt index 8b47562..37e1114 100644 --- a/tests/stubs/insert-int_1698679877.txt +++ b/tests/stubs/insert-int_1698679877.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_sitemeta` (`site_id`, `meta_key`, `meta_value`) VALUES (1, '_site_transient_wp_remote_block_patterns_03fe7d7ccb043466cdff46c6061da4a5', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')","postgresql":"INSERT INTO wp_sitemeta (site_id, meta_key, meta_value) VALUES ('1', '_site_transient_wp_remote_block_patterns_03fe7d7ccb043466cdff46c6061da4a5', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_sitemeta` (`site_id`, `meta_key`, `meta_value`) VALUES (1, '_site_transient_wp_remote_block_patterns_03fe7d7ccb043466cdff46c6061da4a5', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')","postgresql":"INSERT INTO wp_sitemeta (site_id, meta_key, meta_value) VALUES ('1', '_site_transient_wp_remote_block_patterns_03fe7d7ccb043466cdff46c6061da4a5', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"') RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679878.txt b/tests/stubs/insert-int_1698679878.txt index 2140419..1118067 100644 --- a/tests/stubs/insert-int_1698679878.txt +++ b/tests/stubs/insert-int_1698679878.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_sitemeta` (`site_id`, `meta_key`, `meta_value`) VALUES (1, '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')","postgresql":"INSERT INTO wp_sitemeta (site_id, meta_key, meta_value) VALUES ('1', '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_sitemeta` (`site_id`, `meta_key`, `meta_value`) VALUES (1, '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')","postgresql":"INSERT INTO wp_sitemeta (site_id, meta_key, meta_value) VALUES ('1', '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"') RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679884.txt b/tests/stubs/insert-int_1698679884.txt index bd5934e..4cd3bb1 100644 --- a/tests/stubs/insert-int_1698679884.txt +++ b/tests/stubs/insert-int_1698679884.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_posts` (`post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_content_filtered`, `post_title`, `post_excerpt`, `post_status`, `post_type`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_parent`, `menu_order`, `post_mime_type`, `guid`) VALUES (1, '2023-10-30 15:31:24', '2023-10-30 15:31:24', '', '', 'New Post 123', '', 'inherit', 'revision', 'closed', 'closed', '', '55-revision-v1', '', '', '2023-10-30 15:31:24', '2023-10-30 15:31:24', 55, 0, '', '')","postgresql":"INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES ('1', '2023-10-30 15:31:24', '2023-10-30 15:31:24', '', '', 'New Post 123', '', 'inherit', 'revision', 'closed', 'closed', '', '55-revision-v1', '', '', '2023-10-30 15:31:24', '2023-10-30 15:31:24', 55, 0, '', '')"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_posts` (`post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_content_filtered`, `post_title`, `post_excerpt`, `post_status`, `post_type`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_parent`, `menu_order`, `post_mime_type`, `guid`) VALUES (1, '2023-10-30 15:31:24', '2023-10-30 15:31:24', '', '', 'New Post 123', '', 'inherit', 'revision', 'closed', 'closed', '', '55-revision-v1', '', '', '2023-10-30 15:31:24', '2023-10-30 15:31:24', 55, 0, '', '')","postgresql":"INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES ('1', '2023-10-30 15:31:24', '2023-10-30 15:31:24', '', '', 'New Post 123', '', 'inherit', 'revision', 'closed', 'closed', '', '55-revision-v1', '', '', '2023-10-30 15:31:24', '2023-10-30 15:31:24', 55, 0, '', '') RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679897.txt b/tests/stubs/insert-int_1698679897.txt index f066184..f871348 100644 --- a/tests/stubs/insert-int_1698679897.txt +++ b/tests/stubs/insert-int_1698679897.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('category_children', 'a:0:{}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)","postgresql":"INSERT INTO \"wp_options\" (\"option_name\", \"option_value\", \"autoload\") VALUES ('category_children', 'a:0:{}', 'yes') ON CONFLICT (\"option_name\") DO UPDATE SET \"option_name\" = EXCLUDED.\"option_name\", \"option_value\" = EXCLUDED.\"option_value\", \"autoload\" = EXCLUDED.\"autoload\""} \ No newline at end of file +{"mysql":"INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('category_children', 'a:0:{}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)","postgresql":"INSERT INTO \"wp_options\" (\"option_name\", \"option_value\", \"autoload\") VALUES ('category_children', 'a:0:{}', 'yes') ON CONFLICT (\"option_name\") DO UPDATE SET \"option_name\" = EXCLUDED.\"option_name\", \"option_value\" = EXCLUDED.\"option_value\", \"autoload\" = EXCLUDED.\"autoload\" RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679908.txt b/tests/stubs/insert-int_1698679908.txt index 4bb9eff..6218958 100644 --- a/tests/stubs/insert-int_1698679908.txt +++ b/tests/stubs/insert-int_1698679908.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_term_taxonomy` (`term_id`, `taxonomy`, `description`, `parent`, `count`) VALUES (3, 'post_tag', 'tag', 0, 0)","postgresql":"INSERT INTO wp_term_taxonomy (term_id, taxonomy, description, parent, count) VALUES (3, 'post_tag', 'tag', 0, 0)"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_term_taxonomy` (`term_id`, `taxonomy`, `description`, `parent`, `count`) VALUES (3, 'post_tag', 'tag', 0, 0)","postgresql":"INSERT INTO wp_term_taxonomy (term_id, taxonomy, description, parent, count) VALUES (3, 'post_tag', 'tag', 0, 0) RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679917.txt b/tests/stubs/insert-int_1698679917.txt index b250265..825287d 100644 --- a/tests/stubs/insert-int_1698679917.txt +++ b/tests/stubs/insert-int_1698679917.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_postmeta` (`post_id`, `meta_key`, `meta_value`) VALUES (57, '_edit_lock', '1698679917:1')","postgresql":"INSERT INTO wp_postmeta (post_id, meta_key, meta_value) VALUES (57, '_edit_lock', '1698679917:1')"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_postmeta` (`post_id`, `meta_key`, `meta_value`) VALUES (57, '_edit_lock', '1698679917:1')","postgresql":"INSERT INTO wp_postmeta (post_id, meta_key, meta_value) VALUES (57, '_edit_lock', '1698679917:1') RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679920.txt b/tests/stubs/insert-int_1698679920.txt index 2140419..1118067 100644 --- a/tests/stubs/insert-int_1698679920.txt +++ b/tests/stubs/insert-int_1698679920.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_sitemeta` (`site_id`, `meta_key`, `meta_value`) VALUES (1, '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')","postgresql":"INSERT INTO wp_sitemeta (site_id, meta_key, meta_value) VALUES ('1', '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_sitemeta` (`site_id`, `meta_key`, `meta_value`) VALUES (1, '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')","postgresql":"INSERT INTO wp_sitemeta (site_id, meta_key, meta_value) VALUES ('1', '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"') RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679923.txt b/tests/stubs/insert-int_1698679923.txt index 2c70785..3d6228e 100644 --- a/tests/stubs/insert-int_1698679923.txt +++ b/tests/stubs/insert-int_1698679923.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_posts` (`post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_content_filtered`, `post_title`, `post_excerpt`, `post_status`, `post_type`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_parent`, `menu_order`, `post_mime_type`, `guid`) VALUES (1, '2023-10-30 15:32:03', '2023-10-30 15:32:03', '', '', 'Test Page', '', 'inherit', 'revision', 'closed', 'closed', '', '57-revision-v1', '', '', '2023-10-30 15:32:03', '2023-10-30 15:32:03', 57, 0, '', '')","postgresql":"INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES ('1', '2023-10-30 15:32:03', '2023-10-30 15:32:03', '', '', 'Test Page', '', 'inherit', 'revision', 'closed', 'closed', '', '57-revision-v1', '', '', '2023-10-30 15:32:03', '2023-10-30 15:32:03', 57, 0, '', '')"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_posts` (`post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_content_filtered`, `post_title`, `post_excerpt`, `post_status`, `post_type`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_parent`, `menu_order`, `post_mime_type`, `guid`) VALUES (1, '2023-10-30 15:32:03', '2023-10-30 15:32:03', '', '', 'Test Page', '', 'inherit', 'revision', 'closed', 'closed', '', '57-revision-v1', '', '', '2023-10-30 15:32:03', '2023-10-30 15:32:03', 57, 0, '', '')","postgresql":"INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES ('1', '2023-10-30 15:32:03', '2023-10-30 15:32:03', '', '', 'Test Page', '', 'inherit', 'revision', 'closed', 'closed', '', '57-revision-v1', '', '', '2023-10-30 15:32:03', '2023-10-30 15:32:03', 57, 0, '', '') RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679936.txt b/tests/stubs/insert-int_1698679936.txt index bfaed78..9f48d02 100644 --- a/tests/stubs/insert-int_1698679936.txt +++ b/tests/stubs/insert-int_1698679936.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_comments` (`comment_post_ID`, `comment_author_IP`, `comment_author`, `comment_author_email`, `comment_author_url`, `comment_date`, `comment_date_gmt`, `comment_content`, `comment_karma`, `comment_approved`, `comment_agent`, `comment_type`, `comment_parent`, `user_id`) VALUES (55, '10.42.0.8', 'root', 'root@example.localhost', 'http:\/\/example.com\/site', '2023-10-30 15:32:16', '2023-10-30 15:32:16', 'This is a comment', 0, '1', 'Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/118.0.0.0 Safari\/537.36', 'comment', 0, 1)","postgresql":"INSERT INTO wp_comments (\"comment_post_ID\" , comment_author_IP, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content, comment_karma, comment_approved, comment_agent, comment_type, comment_parent, user_id) VALUES (55, '10.42.0.8', 'root', 'root@example.localhost', 'http:\/\/example.com\/site', '2023-10-30 15:32:16', '2023-10-30 15:32:16', 'This is a comment', 0, '1', 'Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/118.0.0.0 Safari\/537.36', 'comment', 0, 1)"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_comments` (`comment_post_ID`, `comment_author_IP`, `comment_author`, `comment_author_email`, `comment_author_url`, `comment_date`, `comment_date_gmt`, `comment_content`, `comment_karma`, `comment_approved`, `comment_agent`, `comment_type`, `comment_parent`, `user_id`) VALUES (55, '10.42.0.8', 'root', 'root@example.localhost', 'http:\/\/example.com\/site', '2023-10-30 15:32:16', '2023-10-30 15:32:16', 'This is a comment', 0, '1', 'Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/118.0.0.0 Safari\/537.36', 'comment', 0, 1)","postgresql":"INSERT INTO wp_comments (\"comment_post_ID\" , comment_author_IP, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content, comment_karma, comment_approved, comment_agent, comment_type, comment_parent, user_id) VALUES (55, '10.42.0.8', 'root', 'root@example.localhost', 'http:\/\/example.com\/site', '2023-10-30 15:32:16', '2023-10-30 15:32:16', 'This is a comment', 0, '1', 'Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/118.0.0.0 Safari\/537.36', 'comment', 0, 1) RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679954.txt b/tests/stubs/insert-int_1698679954.txt index 8b47562..37e1114 100644 --- a/tests/stubs/insert-int_1698679954.txt +++ b/tests/stubs/insert-int_1698679954.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_sitemeta` (`site_id`, `meta_key`, `meta_value`) VALUES (1, '_site_transient_wp_remote_block_patterns_03fe7d7ccb043466cdff46c6061da4a5', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')","postgresql":"INSERT INTO wp_sitemeta (site_id, meta_key, meta_value) VALUES ('1', '_site_transient_wp_remote_block_patterns_03fe7d7ccb043466cdff46c6061da4a5', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_sitemeta` (`site_id`, `meta_key`, `meta_value`) VALUES (1, '_site_transient_wp_remote_block_patterns_03fe7d7ccb043466cdff46c6061da4a5', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')","postgresql":"INSERT INTO wp_sitemeta (site_id, meta_key, meta_value) VALUES ('1', '_site_transient_wp_remote_block_patterns_03fe7d7ccb043466cdff46c6061da4a5', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"') RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679955.txt b/tests/stubs/insert-int_1698679955.txt index 2140419..1118067 100644 --- a/tests/stubs/insert-int_1698679955.txt +++ b/tests/stubs/insert-int_1698679955.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_sitemeta` (`site_id`, `meta_key`, `meta_value`) VALUES (1, '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')","postgresql":"INSERT INTO wp_sitemeta (site_id, meta_key, meta_value) VALUES ('1', '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_sitemeta` (`site_id`, `meta_key`, `meta_value`) VALUES (1, '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"')","postgresql":"INSERT INTO wp_sitemeta (site_id, meta_key, meta_value) VALUES ('1', '_site_transient_wp_remote_block_patterns_0dc4db57500f00dee60778de7fb84b69', 'O:8:\"WP_Error\":3:{s:6:\"errors\";a:1:{s:19:\"http_request_failed\";a:1:{i:0;s:95:\"cURL error 35: OpenSSL\/3.1.4: error:0A000152:SSL routines::unsafe legacy renegotiation disabled\";}}s:10:\"error_data\";a:0:{}s:18:\"') RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679965.txt b/tests/stubs/insert-int_1698679965.txt index aa99108..fe89cc3 100644 --- a/tests/stubs/insert-int_1698679965.txt +++ b/tests/stubs/insert-int_1698679965.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_posts` (`post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_content_filtered`, `post_title`, `post_excerpt`, `post_status`, `post_type`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_parent`, `menu_order`, `post_mime_type`, `guid`) VALUES (1, '2023-10-30 15:32:45', '2023-10-30 15:32:45', '\n\n\n
\n

Welcome to Our site, We''ve got only the best content for you<\/h1>\n\n\n\n
\n\n\n\n\n\n\n\n\n\n
<\/div>\n\n\n\n\n\n\n\n<\/div>\n\n\n\n
<\/div>\n\n\n\n
\n
\n

Got any recommendations? <\/p>\n\n\n\n

\n
\n\t\t\t\tGet In Touch\t\t\t\t<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n
\n
\n<\/div>\n<\/div>\n<\/main>\n\n\n', '', 'Blog Home', 'Displays the latest posts as either the site homepage or as the \"Posts page\" as defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the homepage.', 'inherit', 'revision', 'closed', 'closed', '', '21-revision-v1', '', '', '2023-10-30 15:32:45', '2023-10-30 15:32:45', 21, 0, '', '')","postgresql":"INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES ('1', '2023-10-30 15:32:45', '2023-10-30 15:32:45', '\n\n\n
\n

Welcome to Our site, We''ve got only the best content for you<\/h1>\n\n\n\n
\n\n\n\n\n\n\n\n\n\n
<\/div>\n\n\n\n\n\n\n\n<\/div>\n\n\n\n
<\/div>\n\n\n\n
\n
\n

Got any recommendations? <\/p>\n\n\n\n

\n
\n\t\t\t\tGet In Touch\t\t\t\t<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n
\n
\n<\/div>\n<\/div>\n<\/main>\n\n\n', '', 'Blog Home', 'Displays the latest posts as either the site homepage or as the \"Posts page\" as defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the homepage.', 'inherit', 'revision', 'closed', 'closed', '', '21-revision-v1', '', '', '2023-10-30 15:32:45', '2023-10-30 15:32:45', 21, 0, '', '')"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_posts` (`post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_content_filtered`, `post_title`, `post_excerpt`, `post_status`, `post_type`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_parent`, `menu_order`, `post_mime_type`, `guid`) VALUES (1, '2023-10-30 15:32:45', '2023-10-30 15:32:45', '\n\n\n
\n

Welcome to Our site, We''ve got only the best content for you<\/h1>\n\n\n\n
\n\n\n\n\n\n\n\n\n\n
<\/div>\n\n\n\n\n\n\n\n<\/div>\n\n\n\n
<\/div>\n\n\n\n
\n
\n

Got any recommendations? <\/p>\n\n\n\n

\n
\n\t\t\t\tGet In Touch\t\t\t\t<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n
\n
\n<\/div>\n<\/div>\n<\/main>\n\n\n', '', 'Blog Home', 'Displays the latest posts as either the site homepage or as the \"Posts page\" as defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the homepage.', 'inherit', 'revision', 'closed', 'closed', '', '21-revision-v1', '', '', '2023-10-30 15:32:45', '2023-10-30 15:32:45', 21, 0, '', '')","postgresql":"INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES ('1', '2023-10-30 15:32:45', '2023-10-30 15:32:45', '\n\n\n
\n

Welcome to Our site, We''ve got only the best content for you<\/h1>\n\n\n\n
\n\n\n\n\n\n\n\n\n\n
<\/div>\n\n\n\n\n\n\n\n<\/div>\n\n\n\n
<\/div>\n\n\n\n
\n
\n

Got any recommendations? <\/p>\n\n\n\n

\n
\n\t\t\t\tGet In Touch\t\t\t\t<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n
\n
\n<\/div>\n<\/div>\n<\/main>\n\n\n', '', 'Blog Home', 'Displays the latest posts as either the site homepage or as the \"Posts page\" as defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the homepage.', 'inherit', 'revision', 'closed', 'closed', '', '21-revision-v1', '', '', '2023-10-30 15:32:45', '2023-10-30 15:32:45', 21, 0, '', '') RETURNING *"} \ No newline at end of file diff --git a/tests/stubs/insert-int_1698679972.txt b/tests/stubs/insert-int_1698679972.txt index c16011f..84593cb 100644 --- a/tests/stubs/insert-int_1698679972.txt +++ b/tests/stubs/insert-int_1698679972.txt @@ -1 +1 @@ -{"mysql":"INSERT INTO `wp_posts` (`post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_content_filtered`, `post_title`, `post_excerpt`, `post_status`, `post_type`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_parent`, `menu_order`, `post_mime_type`, `guid`) VALUES (1, '2023-10-30 15:32:52', '2023-10-30 15:32:52', '\n\n\n
\n

Welcome to Our site, We''ve got only the best content for you<\/h1>\n\n\n\n
\n\n\n\n\n\n\n\n\n\n
<\/div>\n\n\n\n\n\n\n\n<\/div>\n\n\n\n
<\/div>\n\n\n\n
\n
\n

Got any content? <\/p>\n\n\n\n

\n
\n\t\t\t\tGet In Touch\t\t\t\t<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n
\n
\n<\/div>\n<\/div>\n<\/main>\n\n\n', '', 'Blog Home', 'Displays the latest posts as either the site homepage or as the \"Posts page\" as defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the homepage.', 'inherit', 'revision', 'closed', 'closed', '', '21-revision-v1', '', '', '2023-10-30 15:32:52', '2023-10-30 15:32:52', 21, 0, '', '')","postgresql":"INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES ('1', '2023-10-30 15:32:52', '2023-10-30 15:32:52', '\n\n\n
\n

Welcome to Our site, We''ve got only the best content for you<\/h1>\n\n\n\n
\n\n\n\n\n\n\n\n\n\n
<\/div>\n\n\n\n\n\n\n\n<\/div>\n\n\n\n
<\/div>\n\n\n\n
\n
\n

Got any content? <\/p>\n\n\n\n

\n
\n\t\t\t\tGet In Touch\t\t\t\t<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n
\n
\n<\/div>\n<\/div>\n<\/main>\n\n\n', '', 'Blog Home', 'Displays the latest posts as either the site homepage or as the \"Posts page\" as defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the homepage.', 'inherit', 'revision', 'closed', 'closed', '', '21-revision-v1', '', '', '2023-10-30 15:32:52', '2023-10-30 15:32:52', 21, 0, '', '')"} \ No newline at end of file +{"mysql":"INSERT INTO `wp_posts` (`post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_content_filtered`, `post_title`, `post_excerpt`, `post_status`, `post_type`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_parent`, `menu_order`, `post_mime_type`, `guid`) VALUES (1, '2023-10-30 15:32:52', '2023-10-30 15:32:52', '\n\n\n
\n

Welcome to Our site, We''ve got only the best content for you<\/h1>\n\n\n\n
\n\n\n\n\n\n\n\n\n\n
<\/div>\n\n\n\n\n\n\n\n<\/div>\n\n\n\n
<\/div>\n\n\n\n
\n
\n

Got any content? <\/p>\n\n\n\n

\n
\n\t\t\t\tGet In Touch\t\t\t\t<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n