tina4ruby 3.13.126 → 3.13.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f56bea80e9f63a3326a77f8903721890f45a2db216f39c24fe51c1363e0514b9
4
- data.tar.gz: 61dd38932bcfb406abb603232dd584889223408888d3ca7aaa469775243727b7
3
+ metadata.gz: 0765c0228c99d3b8d5e26124c0afe5079ccc9ac675a3f067fc38e2e829bded7f
4
+ data.tar.gz: 6134c34d7f1ea98ea558862e1f98dbb0532b2d6fb3156b8bad5b9e129e362475
5
5
  SHA512:
6
- metadata.gz: d6ca97a0dcb6adf6776f89be49871d814b678a3d499d8ec740a6b87516af474f04d1e78d2c8746a113aa8877c2b3fcceec4ebd2f9d3cc02b2f4fd0accc63d095
7
- data.tar.gz: 5c86231d8853e00c5cbbdf22a6ea02d477eed2fe045306c498ed1b82eff9ba5bc9c1e301b53f99a394f82731001c56503615206d566e2266b6e4208c2d64aecb
6
+ metadata.gz: '0979843fa3654d0c48c62c19bbc8e5615a7b4b582286e14b3c517b76f3d9a50eb3246feb125b365b071c2c76adf7cdcbf93f802a576d75e5959d337cd19543c0'
7
+ data.tar.gz: f5ba6720f96dee12b2b7d751282fba8835771a11b368afafd64bf311c9ca1d8bf8501fd3b28493dd42126dfb0b4159a4c50a407422d5b8f63b680b7b67dbe038
@@ -230,18 +230,24 @@ module Tina4
230
230
  rows.map { |row| decode_blobs(symbolize_keys(row)) }
231
231
  end
232
232
 
233
- def execute(sql, params = [])
234
- # Translate SQLite-canonical DDL to Firebird at APPLY time, mirroring the
235
- # Python master's firebird.py _translate_sql: strip AUTOINCREMENT (Firebird
236
- # uses generators), then rewrite the types Firebird rejects -- TEXT ->
237
- # BLOB SUB_TYPE TEXT (-607), REAL -> DOUBLE PRECISION -- and drop
238
- # CREATE TABLE IF NOT EXISTS. Both helpers only touch DDL keywords
239
- # (AUTOINCREMENT / CREATE TABLE / ALTER TABLE), so a plain
240
- # INSERT/UPDATE/DELETE/SELECT is returned untouched. This is what lets a
241
- # REALLY-generated migration (id INTEGER PRIMARY KEY AUTOINCREMENT,
242
- # bio TEXT, price REAL) apply on Firebird instead of raising -607/-104.
233
+ # Translate SQLite-canonical SQL to Firebird at APPLY time, mirroring the
234
+ # Python master's firebird.py _translate_sql: strip AUTOINCREMENT (Firebird
235
+ # uses generators), bare TRUE/FALSE -> 1/0 (Firebird has no boolean type; a
236
+ # TRUE/FALSE INSIDE a string literal is data and is left untouched), rewrite
237
+ # the types Firebird rejects -- TEXT -> BLOB SUB_TYPE TEXT (-607), REAL ->
238
+ # DOUBLE PRECISION -- and drop CREATE TABLE IF NOT EXISTS. Every helper only
239
+ # touches DDL keywords or bare boolean tokens, so a plain
240
+ # INSERT/UPDATE/DELETE/SELECT is returned untouched. This is what lets a
241
+ # REALLY-generated migration (id INTEGER PRIMARY KEY AUTOINCREMENT,
242
+ # bio TEXT, price REAL) apply on Firebird instead of raising -607/-104.
243
+ def translate_sql(sql)
243
244
  sql = Tina4::SQLTranslator.auto_increment_syntax(sql, "firebird")
244
- sql = Tina4::SQLTranslator.ddl_types(sql, "firebird")
245
+ sql = Tina4::SQLTranslator.boolean_to_int(sql)
246
+ Tina4::SQLTranslator.ddl_types(sql, "firebird")
247
+ end
248
+
249
+ def execute(sql, params = [])
250
+ sql = translate_sql(sql)
245
251
  result = with_reconnect do
246
252
  if params.empty?
247
253
  @connection.execute(sql)
@@ -58,15 +58,21 @@ module Tina4
58
58
  rows
59
59
  end
60
60
 
61
- def execute(sql, params = [])
62
- # Translate SQLite-canonical DDL to T-SQL at APPLY time, mirroring the
63
- # Python master's mssql.py _translate_sql: AUTOINCREMENT -> IDENTITY(1,1),
64
- # then strip CREATE TABLE IF NOT EXISTS (not T-SQL) and map TIMESTAMP ->
65
- # DATETIME2 (MSSQL's TIMESTAMP is a rowversion, not a datetime). Both
66
- # helpers only touch DDL keywords, so DML is returned untouched -- this is
67
- # what lets a REALLY-generated migration apply on MSSQL.
61
+ # Translate SQLite-canonical SQL to T-SQL at APPLY time, mirroring the
62
+ # Python master's mssql.py _translate_sql: AUTOINCREMENT -> IDENTITY(1,1),
63
+ # bare TRUE/FALSE -> 1/0 (MSSQL has BIT, not a boolean type; a TRUE/FALSE
64
+ # INSIDE a string literal is data and is left untouched), strip CREATE TABLE
65
+ # IF NOT EXISTS (not T-SQL) and map TIMESTAMP -> DATETIME2 (MSSQL's TIMESTAMP
66
+ # is a rowversion). Every helper only touches DDL keywords or bare boolean
67
+ # tokens, so a plain INSERT/UPDATE/DELETE/SELECT is returned untouched.
68
+ def translate_sql(sql)
68
69
  sql = Tina4::SQLTranslator.auto_increment_syntax(sql, "mssql")
69
- sql = Tina4::SQLTranslator.ddl_types(sql, "mssql")
70
+ sql = Tina4::SQLTranslator.boolean_to_int(sql)
71
+ Tina4::SQLTranslator.ddl_types(sql, "mssql")
72
+ end
73
+
74
+ def execute(sql, params = [])
75
+ sql = translate_sql(sql)
70
76
  effective_sql = interpolate_params(sql, params)
71
77
 
72
78
  # Capture the generated IDENTITY AT WRITE TIME — mirror of the Python
data/lib/tina4/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tina4
4
- VERSION = "3.13.126"
4
+ VERSION = "3.13.127"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tina4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.13.126
4
+ version: 3.13.127
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tina4 Team