Skip to content

Commit 5b5a504

Browse files
Keep the instant of MySQL Time parameters whatever their UTC offset (#59)
## Summary **MySQL `Time` parameters no longer change their instant.** `quote` (bound parameters) and `csv_line` (`:copyfrom`) used to write a `Time` / `DateTime` with `strftime`, which keeps the value's own wall-clock time and drops its UTC offset. mysql2 reads `DATETIME` / `TIMESTAMP` back as wall-clock times in its `database_timezone`: the process zone, or UTC for a client created with `database_timezone: :utc`. So any value with a different offset came back as a different instant. For example, `Time.now.utc` with `TZ=America/New_York` came back 5 hours off, and nothing raised. Both paths now go through a new helper, `mysql_time(client, value)`, which first converts the value to the zone mysql2 reads in. `csv_line` now takes the client, and it formats `DateTime` like `Time`. This reverses the earlier `test_time_values_match_mysql2_prepared_statement_storage`. mysql2's own prepared statements store the wall-clock time too, so they show the same shift. That test is replaced by: - `test_time_values_keep_their_instant_whatever_their_offset`: runs with `ENV['TZ'] = 'XYZ-3'` and passes +05:30, -07:00 (`DateTime`), UTC and local values, both through a bound `:exec` and through the new `CopyMysqlBindingTimes` `:copyfrom`. - `test_time_values_follow_a_utc_database_timezone`: does the same with a client created with `database_timezone: :utc`. Both tests fail on `main` and pass with this change. The wall-clock assertions in `test_client_side_quoting_round_trips_supported_values` now compare instants. Smaller fixes from the pre-release sweep: - `timeout_exits_with_throw?` (generated for `rubyVersion` < 3.3) compares `<=>` with `== -1` instead of calling `.negative?` on an `Integer?`. Steep reported that line on 3.1 / 3.2 output. - `moduleName` can no longer reopen `Kernel`, `Object` or `BasicObject`, which would put the generated constants on every object. Covered by a unit test. - README documents the MySQL time zone behaviour, including that the server also converts `TIMESTAMP` columns with the session `time_zone`. It also notes that sqlc before 1.30 (including the pinned 1.27) reports quoted SQLite table names with their quotes, so `"Items"` gives the model `Items` there and `Item` from 1.30 on. Use `rename` or `exactTableNames` to keep the name stable. Regenerated: `examples/mysql2`, `test/fixtures/mysql2.bin` (new query), the golden files, `steep_expectations.yml` (line numbers only) and `docs/Coverage.md`. Local runs: full E2E for sqlite3, pg and mysql2 on Ruby 3.1 / 3.2 / 3.3 / 3.4 / 4.0, options E2E on 3.1 / 4.0, unit tests, `rubocop examples`, `steep check --with-expectations` and `sqlc diff`. ## Checklist - [x] `examples/` is regenerated (`rake sqlc_generate_process`) and committed - [x] Tests added or updated (`rake test`, and `rake end2end_*` when the generated code changes) - [x] The generated code stays RuboCop-clean (`rake rubocop`) and Steep-clean (`rake steep`) - [x] Labelled (`bug`, `enhancement`, `documentation`, or `breaking`) so the release notes are grouped correctly Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Doron Eli Rachman <doron050@gmail.com>
1 parent 5b6434e commit 5b5a504

40 files changed

Lines changed: 368 additions & 126 deletions

‎README.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ server; duplicate keys and invalid values raise `Mysql2::Error` instead of being
191191
(`uuid[]`, enum arrays, ...) are `Array[String]`, also for types created after the connection was opened (a
192192
migration run while the application is up). Geometric, range, full-text, `hstore`, `ltree`, `timetz`, `reg*` and
193193
composite types are `String`s; domains and unknown types are `untyped`.
194+
* MySQL: a `Time` / `DateTime` parameter (also in `:copyfrom`) keeps its instant whatever its UTC offset: it is written
195+
in the zone `mysql2` reads `DATETIME` / `TIMESTAMP` values back in, the process's local zone, or UTC for a client
196+
created with `database_timezone: :utc` (`connect(params.merge(database_timezone: :utc))`). The server also converts
197+
`TIMESTAMP` columns with the session `time_zone`, so keep that equal to the client's zone.
194198
* A `String` passed to a PostgreSQL `json` / `jsonb` parameter is JSON text (`'{"a":1}'`): pass `'"hi"'` or
195199
`'hi'.to_json` for a JSON string. Hashes, Arrays, numbers, `true` / `false` and `nil` are encoded for you.
196200
* Enums are `String`s, with constants in `models.rb` (`ExtendedBioType::MEMOIR`, `ExtendedBioType::ALL`). Values that
@@ -213,6 +217,9 @@ server; duplicate keys and invalid values raise `Mysql2::Error` instead of being
213217
* A parameter used twice is one keyword when named with `sqlc.arg`; repeated `?` / `$n` of one column become `id:`, `id_2:`.
214218
* Models may be named like Ruby or driver constants (tables `exceptions`, `data`, `threads`, `sets`, ...): the
215219
generated code and `.rbs` refer to those as `::Exception`, `::Data`, `::Thread`, ... so the models cannot shadow them.
220+
* SQLite: sqlc before 1.30 (including the pinned 1.27) reports a quoted table name with its quotes, so
221+
`CREATE TABLE "Items"` gives the model `Items` there and `Item` with sqlc 1.30 and later (PostgreSQL / MySQL give
222+
`Item` with any version). Use `rename` or `exactTableNames` to keep the name when upgrading sqlc.
216223
* A table `authors` next to a table `author` keeps its plural model name (`Authors`). Query names that would replace
217224
a generated method (`Transaction`, `Initialize`, ...) are errors.
218225

‎docs/Coverage.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ only when the behavior is rejected or decided during generation and generated co
1818
| Frozen Ruby 3.2+ `Data`, mutable older `Struct`, `with`, `to_h`, pattern matching | [`test_rows_and_embedded_models_have_supported_layout_and_pattern_matching`](../tests/end2end_pg.rb#test_rows_and_embedded_models_have_supported_layout_and_pattern_matching) | [`test_rows_and_embedded_models_have_supported_layout_and_pattern_matching`](../tests/end2end_mysql2.rb#test_rows_and_embedded_models_have_supported_layout_and_pattern_matching) | [`test_rows_and_embedded_models_have_supported_layout_and_pattern_matching`](../tests/end2end_sqlite3.rb#test_rows_and_embedded_models_have_supported_layout_and_pattern_matching) | [`test_struct_classes_are_valid_and_usable`](../test/features_test.rb#test_struct_classes_are_valid_and_usable), [`test_data_classes_are_usable`](../test/features_test.rb#test_data_classes_are_usable) |
1919
| Enums, constants (also for keyword / invalid names), database labels and MySQL `SET` | [`test_enum_column`](../tests/end2end_pg.rb#test_enum_column), [`test_enum_values_named_like_ruby_keywords_get_valid_constants`](../tests/end2end_pg.rb#test_enum_values_named_like_ruby_keywords_get_valid_constants) | [`test_enum_and_set_columns`](../tests/end2end_mysql2.rb#test_enum_and_set_columns), [`test_enum_values_named_like_ruby_keywords_get_valid_constants`](../tests/end2end_mysql2.rb#test_enum_values_named_like_ruby_keywords_get_valid_constants) | not supported by the SQLite schema | [`test_models_cover_tables_and_enums`](../test/features_test.rb#test_models_cover_tables_and_enums) |
2020
| PostgreSQL arrays, JSON/JSONB, type round trips and RBS | [`test_array_parameters`](../tests/end2end_pg.rb#test_array_parameters), [`test_remaining_postgresql_types_round_trip`](../tests/end2end_pg.rb#test_remaining_postgresql_types_round_trip), [`test_json_and_jsonb_parameters_round_trip_all_json_value_types`](../tests/end2end_pg.rb#test_json_and_jsonb_parameters_round_trip_all_json_value_types) | not PostgreSQL types | not PostgreSQL types | [`test_multi_dimensional_arrays`](../test/features_test.rb#test_multi_dimensional_arrays), [`test_more_postgres_types_composites_and_domains`](../test/features_test.rb#test_more_postgres_types_composites_and_domains) |
21-
| MySQL unsigned integers, BIT, YEAR, DATETIME/TIME, JSON, enums/SET and client quoting | not MySQL | [`test_client_side_quoting_round_trips_supported_values`](../tests/end2end_mysql2.rb#test_client_side_quoting_round_trips_supported_values), [`test_time_values_match_mysql2_prepared_statement_storage`](../tests/end2end_mysql2.rb#test_time_values_match_mysql2_prepared_statement_storage), [`test_declared_types_match_runtime_values`](../tests/end2end_mysql2.rb#test_declared_types_match_runtime_values) | not MySQL | [`test_mysql_uses_client_side_binding_and_sqlite_closes_prepared_statements`](../test/features_test.rb#test_mysql_uses_client_side_binding_and_sqlite_closes_prepared_statements) |
21+
| MySQL unsigned integers, BIT, YEAR, DATETIME/TIME (a `Time` keeps its instant in any zone, also in `:copyfrom`), JSON, enums/SET and client quoting | not MySQL | [`test_client_side_quoting_round_trips_supported_values`](../tests/end2end_mysql2.rb#test_client_side_quoting_round_trips_supported_values), [`test_time_values_keep_their_instant_whatever_their_offset`](../tests/end2end_mysql2.rb#test_time_values_keep_their_instant_whatever_their_offset), [`test_time_values_follow_a_utc_database_timezone`](../tests/end2end_mysql2.rb#test_time_values_follow_a_utc_database_timezone), [`test_declared_types_match_runtime_values`](../tests/end2end_mysql2.rb#test_declared_types_match_runtime_values) | not MySQL | [`test_mysql_uses_client_side_binding_and_sqlite_closes_prepared_statements`](../test/features_test.rb#test_mysql_uses_client_side_binding_and_sqlite_closes_prepared_statements) |
2222
| SQLite affinity, JSON/UUID, and NUMERIC integer/float results | not SQLite | not SQLite | [`test_declared_types_match_runtime_values`](../tests/end2end_sqlite3.rb#test_declared_types_match_runtime_values), [`test_declared_types_with_parameters`](../tests/end2end_sqlite3.rb#test_declared_types_with_parameters) | [`test_sqlite_declared_types_follow_type_affinity`](../test/features_test.rb#test_sqlite_declared_types_follow_type_affinity), [`test_sqlite_json_and_uuid_declarations_are_strings`](../test/features_test.rb#test_sqlite_json_and_uuid_declarations_are_strings) |
2323
| SQLite `busy_handler_timeout=` waits for another connection without blocking other threads | not SQLite | not SQLite | [`test_busy_handler_timeout_waits_for_another_connection_without_blocking_threads`](../tests/end2end_sqlite3.rb#test_busy_handler_timeout_waits_for_another_connection_without_blocking_threads) | |
2424
| Names: keywords, method collisions (also private row hooks such as `initialize`), acronyms, quoted mixed case, repeated `$n`, plural models | [`test_keyword_and_method_names_keep_distinct_row_and_argument_names`](../tests/end2end_pg.rb#test_keyword_and_method_names_keep_distinct_row_and_argument_names), [`test_repeated_column_parameters_get_distinct_names`](../tests/end2end_pg.rb#test_repeated_column_parameters_get_distinct_names) | [`test_keyword_and_method_names_keep_distinct_row_and_argument_names`](../tests/end2end_mysql2.rb#test_keyword_and_method_names_keep_distinct_row_and_argument_names), [`test_repeated_positional_parameters_get_distinct_names`](../tests/end2end_mysql2.rb#test_repeated_positional_parameters_get_distinct_names) | [`test_keyword_and_method_names_keep_distinct_row_and_argument_names`](../tests/end2end_sqlite3.rb#test_keyword_and_method_names_keep_distinct_row_and_argument_names) | [`test_snake_case_keeps_acronyms_together`](../test/features_test.rb#test_snake_case_keeps_acronyms_together), [`test_query_names_cannot_replace_generated_methods`](../test/features_test.rb#test_query_names_cannot_replace_generated_methods), [`test_tables_with_the_same_singular_get_distinct_models`](../test/features_test.rb#test_tables_with_the_same_singular_get_distinct_models), [`test_columns_named_like_row_methods_still_build_and_read_rows`](../test/features_test.rb#test_columns_named_like_row_methods_still_build_and_read_rows) |

‎examples/authors/mysql/query.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ SELECT * FROM mysql_binding_values WHERE id = sqlc.arg(id);
189189
-- name: TruncateMysqlBindingValues :exec
190190
TRUNCATE TABLE mysql_binding_values;
191191

192+
-- name: CopyMysqlBindingTimes :copyfrom
193+
INSERT INTO mysql_binding_values (id, datetime_value, datetime_2) VALUES (?, ?, ?);
194+
192195
-- name: InsertNameCase :exec
193196
INSERT INTO name_cases (id, `class`, `end`, `hash`, `method`, `count`, `camelCase`, `HTTPServer`, `initialize`)
194197
VALUES (sqlc.arg(id), sqlc.arg(class), sqlc.arg(end_), sqlc.arg(hash), sqlc.arg(method), sqlc.arg(count),

‎examples/mysql2/query_sql.rb‎

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ class GetMysqlBindingValuesRow < ::Data.define(
404404
TRUNCATE TABLE mysql_binding_values
405405
SQL
406406

407+
# rubocop:disable Naming/VariableNumber
408+
class CopyMysqlBindingTimesArgs < ::Data.define(:id, :datetime_value, :datetime_2)
409+
end
410+
# rubocop:enable Naming/VariableNumber
411+
407412
INSERT_NAME_CASE_SQL = <<~'SQL'
408413
INSERT INTO name_cases (id, `class`, `end`, `hash`, `method`, `count`, `camelCase`, `HTTPServer`, `initialize`)
409414
VALUES (?, ?, ?, ?, ?, ?,
@@ -791,7 +796,7 @@ def copy_authors(rows)
791796
with_client('copy_authors') do |client|
792797
::Tempfile.create(['copy_authors', '.csv']) do |file|
793798
rows.each do |row|
794-
file.write(csv_line([row.name, row.bio]))
799+
file.write(csv_line(client, [row.name, row.bio]))
795800
end
796801
file.flush
797802
load_data(client, "LOAD DATA LOCAL INFILE '#{client.escape(file.path)}' INTO TABLE `authors` CHARACTER SET binary FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\\\\' LINES TERMINATED BY '\\n' (`name`, `bio`)") if file.pos.positive?
@@ -944,7 +949,7 @@ def copy_regressions(rows)
944949
with_client('copy_regressions') do |client|
945950
::Tempfile.create(['copy_regressions', '.csv']) do |file|
946951
rows.each do |row|
947-
file.write(csv_line([row.order, row.note]))
952+
file.write(csv_line(client, [row.order, row.note]))
948953
end
949954
file.flush
950955
load_data(client, "LOAD DATA LOCAL INFILE '#{client.escape(file.path)}' INTO TABLE `regressions` CHARACTER SET binary FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\\\\' LINES TERMINATED BY '\\n' (`order`, `note`)") if file.pos.positive?
@@ -957,7 +962,7 @@ def copy_regression_rows(rows)
957962
with_client('copy_regression_rows') do |client|
958963
::Tempfile.create(['copy_regression_rows', '.csv']) do |file|
959964
rows.each do |row|
960-
file.write(csv_line([row.id, row.order, row.note, row.payload]))
965+
file.write(csv_line(client, [row.id, row.order, row.note, row.payload]))
961966
end
962967
file.flush
963968
load_data(client, "LOAD DATA LOCAL INFILE '#{client.escape(file.path)}' INTO TABLE `regressions` CHARACTER SET binary FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\\\\' LINES TERMINATED BY '\\n' (`id`, `order`, `note`, `payload`)") if file.pos.positive?
@@ -1029,7 +1034,7 @@ def copy_copy_types(rows)
10291034
with_client('copy_copy_types') do |client|
10301035
::Tempfile.create(['copy_copy_types', '.csv']) do |file|
10311036
rows.each do |row|
1032-
file.write(csv_line([row.id, row.code, row.doc, row.flags, row.amount]))
1037+
file.write(csv_line(client, [row.id, row.code, row.doc, row.flags, row.amount]))
10331038
end
10341039
file.flush
10351040
load_data(client, "LOAD DATA LOCAL INFILE '#{client.escape(file.path)}' INTO TABLE `copy_types` CHARACTER SET binary FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\\\\' LINES TERMINATED BY '\\n' (`id`, `code`, @sqlc_v2, `flags`, `amount`) SET `doc` = CONVERT(@sqlc_v2 USING utf8mb4)") if file.pos.positive?
@@ -1042,7 +1047,7 @@ def copy_copy_types_ignore(rows)
10421047
with_client('copy_copy_types_ignore') do |client|
10431048
::Tempfile.create(['copy_copy_types_ignore', '.csv']) do |file|
10441049
rows.each do |row|
1045-
file.write(csv_line([row.id, row.code]))
1050+
file.write(csv_line(client, [row.id, row.code]))
10461051
end
10471052
file.flush
10481053
load_data(client, "LOAD DATA LOCAL INFILE '#{client.escape(file.path)}' IGNORE INTO TABLE `copy_types` CHARACTER SET binary FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\\\\' LINES TERMINATED BY '\\n' (`id`, `code`)", strict: false) if file.pos.positive?
@@ -1055,7 +1060,7 @@ def copy_copy_types_replace(rows)
10551060
with_client('copy_copy_types_replace') do |client|
10561061
::Tempfile.create(['copy_copy_types_replace', '.csv']) do |file|
10571062
rows.each do |row|
1058-
file.write(csv_line([row.id, row.code]))
1063+
file.write(csv_line(client, [row.id, row.code]))
10591064
end
10601065
file.flush
10611066
load_data(client, "LOAD DATA LOCAL INFILE '#{client.escape(file.path)}' REPLACE INTO TABLE `copy_types` CHARACTER SET binary FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\\\\' LINES TERMINATED BY '\\n' (`id`, `code`)") if file.pos.positive?
@@ -1187,6 +1192,19 @@ def truncate_mysql_binding_values
11871192
end
11881193
end
11891194

1195+
def copy_mysql_binding_times(rows)
1196+
with_client('copy_mysql_binding_times') do |client|
1197+
::Tempfile.create(['copy_mysql_binding_times', '.csv']) do |file|
1198+
rows.each do |row|
1199+
file.write(csv_line(client, [row.id, row.datetime_value, row.datetime_2]))
1200+
end
1201+
file.flush
1202+
load_data(client, "LOAD DATA LOCAL INFILE '#{client.escape(file.path)}' INTO TABLE `mysql_binding_values` CHARACTER SET binary FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\\\\' LINES TERMINATED BY '\\n' (`id`, `datetime_value`, `datetime_2`)") if file.pos.positive?
1203+
end
1204+
nil
1205+
end
1206+
end
1207+
11901208
def insert_name_case(id:, class_:, end_:, hash:, method:, count:, camel_case:, http_server:, initialize:)
11911209
with_client('insert_name_case') do |client|
11921210
query_params = [
@@ -1275,7 +1293,7 @@ def copy_mixed_case_copies(rows)
12751293
with_client('copy_mixed_case_copies') do |client|
12761294
::Tempfile.create(['copy_mixed_case_copies', '.csv']) do |file|
12771295
rows.each do |row|
1278-
file.write(csv_line([row.id, row.somevalue]))
1296+
file.write(csv_line(client, [row.id, row.somevalue]))
12791297
end
12801298
file.flush
12811299
load_data(client, "LOAD DATA LOCAL INFILE '#{client.escape(file.path)}' INTO TABLE `MixedCaseCopies` CHARACTER SET binary FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\\\\' LINES TERMINATED BY '\\n' (`Id`, `SomeValue`)") if file.pos.positive?
@@ -1288,7 +1306,7 @@ def copy_mixed_case_copies_unquoted(rows)
12881306
with_client('copy_mixed_case_copies_unquoted') do |client|
12891307
::Tempfile.create(['copy_mixed_case_copies_unquoted', '.csv']) do |file|
12901308
rows.each do |row|
1291-
file.write(csv_line([row.somevalue, row.id]))
1309+
file.write(csv_line(client, [row.somevalue, row.id]))
12921310
end
12931311
file.flush
12941312
load_data(client, "LOAD DATA LOCAL INFILE '#{client.escape(file.path)}' INTO TABLE `MixedCaseCopies` CHARACTER SET binary FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\\\\' LINES TERMINATED BY '\\n' (`SomeValue`, `Id`)") if file.pos.positive?
@@ -1451,7 +1469,7 @@ def quote(client, value)
14511469

14521470
value.to_s('F')
14531471
when ::DateTime, ::Time
1454-
"'#{value.strftime('%Y-%m-%d %H:%M:%S.%6N')}'"
1472+
"'#{mysql_time(client, value)}'"
14551473
when ::Date
14561474
"'#{value.strftime('%Y-%m-%d')}'"
14571475
when ::String
@@ -1465,6 +1483,12 @@ def quote(client, value)
14651483
end
14661484
end
14671485

1486+
def mysql_time(client, value)
1487+
time = value.is_a?(::DateTime) ? value.to_time : value
1488+
time = client.query_options[:database_timezone] == :utc ? time.getutc : time.getlocal
1489+
time.strftime('%Y-%m-%d %H:%M:%S.%6N')
1490+
end
1491+
14681492
def bind_params(client, sql, params)
14691493
output = +''
14701494
index = 0
@@ -1520,13 +1544,13 @@ def bind_params(client, sql, params)
15201544
end
15211545

15221546
# Formats one row for LOAD DATA ... FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\'.
1523-
def csv_line(values)
1547+
def csv_line(client, values)
15241548
fields = values.map do |value|
15251549
case value
15261550
when nil then '\N'
15271551
when true then '1'
15281552
when false then '0'
1529-
when ::Time then value.strftime('%Y-%m-%d %H:%M:%S.%6N')
1553+
when ::Time, ::DateTime then mysql_time(client, value)
15301554
else %("#{value.to_s.b.gsub('\\') { '\\\\' }.gsub('"', '""').gsub("\x1A") { '\Z' }}")
15311555
end
15321556
end

‎examples/mysql2/query_sql.rbs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,13 @@ module Mysql2Codegen
442442

443443
TRUNCATE_MYSQL_BINDING_VALUES_SQL: ::String
444444

445+
class CopyMysqlBindingTimesArgs
446+
attr_reader id: ::Integer
447+
attr_reader datetime_value: ::Time?
448+
attr_reader datetime_2: ::Time?
449+
def initialize: ( ::Integer id, ::Time? datetime_value, ::Time? datetime_2) -> void
450+
end
451+
445452
INSERT_NAME_CASE_SQL: ::String
446453

447454
GET_NAME_CASE_SQL: ::String
@@ -686,6 +693,8 @@ module Mysql2Codegen
686693

687694
def truncate_mysql_binding_values: -> void
688695

696+
def copy_mysql_binding_times: (::Array[CopyMysqlBindingTimesArgs] rows) -> void
697+
689698
def insert_name_case: (id: ::Integer, class_: ::String, end_: ::String, hash: ::String, method: ::String, count: ::Integer, camel_case: ::String, http_server: ::String, initialize: ::String) -> void
690699

691700
def get_name_case: (id: ::Integer, class_: ::String, end_: ::String, hash: ::String, method: ::String, count: ::Integer, http_server: ::String, camel_case: ::String, initialize: ::String) -> GetNameCaseRow?
@@ -738,9 +747,11 @@ module Mysql2Codegen
738747

739748
def quote: (untyped client, untyped value) -> ::String
740749

750+
def mysql_time: (untyped client, ::Time | ::DateTime value) -> ::String
751+
741752
def bind_params: (untyped client, ::String sql, ::Array[untyped] params) -> ::String
742753

743-
def csv_line: (::Array[untyped] values) -> ::String
754+
def csv_line: (untyped client, ::Array[untyped] values) -> ::String
744755

745756
def load_data: (untyped client, ::String sql, ?strict: bool) -> void
746757

‎lib/sqlc_gen_ruby/drivers/base.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def table_name(identifier)
296296
TIMEOUT_EXIT_HELPER = <<~'RUBY'.chomp
297297
def timeout_exits_with_throw?
298298
!!(defined?(::Timeout::VERSION) &&
299-
(::Timeout::VERSION.split('.').map(&:to_i) <=> [0, 4]).negative?)
299+
(::Timeout::VERSION.split('.').map(&:to_i) <=> [0, 4]) == -1)
300300
end
301301
RUBY
302302
TIMEOUT_EXIT_HELPER_RBS = 'def timeout_exits_with_throw?: () -> bool'

0 commit comments

Comments
 (0)