From f7d161f3292af52229faa391d6c906917c0f2abf Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Fri, 29 Dec 2023 08:56:12 -0800 Subject: [PATCH] Add nocov markings around unused code only kept for backwards compatibility This methods are no longer used, but remain in case an external adapter is using them. They will be removed in Sequel 6. --- lib/sequel/adapters/shared/postgres.rb | 4 ++++ lib/sequel/dataset/features.rb | 4 ++++ lib/sequel/dataset/sql.rb | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/lib/sequel/adapters/shared/postgres.rb b/lib/sequel/adapters/shared/postgres.rb index 3300f9a7f..a8d7f2c52 100644 --- a/lib/sequel/adapters/shared/postgres.rb +++ b/lib/sequel/adapters/shared/postgres.rb @@ -2150,10 +2150,14 @@ def supports_skip_locked? server_version >= 90500 end + # :nocov: + # PostgreSQL supports timezones in literal timestamps def supports_timestamp_timezones? + # SEQUEL6: Remove true end + # :nocov: # PostgreSQL 8.4+ supports WINDOW clause. def supports_window_clause? diff --git a/lib/sequel/dataset/features.rb b/lib/sequel/dataset/features.rb index f7c79638a..be35d713e 100644 --- a/lib/sequel/dataset/features.rb +++ b/lib/sequel/dataset/features.rb @@ -188,10 +188,14 @@ def supports_select_all_and_column? true end + # :nocov: + # Whether the dataset supports timezones in literal timestamps, false by default. def supports_timestamp_timezones? + # SEQUEL6: Remove false end + # :nocov: # Whether the dataset supports fractional seconds in literal timestamps, true by default. def supports_timestamp_usecs? diff --git a/lib/sequel/dataset/sql.rb b/lib/sequel/dataset/sql.rb index dadc1ca6f..6b9a95d7c 100644 --- a/lib/sequel/dataset/sql.rb +++ b/lib/sequel/dataset/sql.rb @@ -1206,14 +1206,18 @@ def format_timestamp(v) db.from_application_timestamp(v).strftime(default_timestamp_format) end + # :nocov: + # Return the SQL timestamp fragment to use for the fractional time part. # Should start with the decimal point. Uses 6 decimal places by default. def format_timestamp_usec(usec, ts=timestamp_precision) + # SEQUEL6: Remove unless ts == 6 usec = usec/(10 ** (6 - ts)) end sprintf(".%0#{ts}d", usec) end + # :nocov: # Append literalization of identifier to SQL string, considering regular strings # as SQL identifiers instead of SQL strings.