real_data_tests 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a75133368f84b08bf44ad4f2ee73ed4eaf5636a7f19dbafdc5e6c47478055d8
4
- data.tar.gz: 7693fa53c25af6c928ce61cb33e14667bf580fb18a32182452917932ca539bf2
3
+ metadata.gz: 35d81ac18056a163df010e92d75c5bd36896836d070f8c74041048ab98918cdf
4
+ data.tar.gz: 50d5df4a36a88f58b6dbc76494db155bc68b5b9ca1cf8cbd45b22a4bd8cd6166
5
5
  SHA512:
6
- metadata.gz: 366de9d95f5d8582c83cebcb89e20af819a6516dc6a1a30e3e560b3ba6de5e300404a781a08fc6b1063b562dd2519ce83ce80a0976844dfd09e0ce94551641ca
7
- data.tar.gz: be867e1b473e90ea4bcb9041704fe6e4edac3d4e371c283dda8ac6c32b2903cd2d5b81a326f4aaa6bcb36859c2125ec995d6d115b594441bb6f23b1cbc019e5b
6
+ metadata.gz: fb2bf7729c1b3a0c86a073924b8c50b0a2005885d93acb7bdd419f12db87e858801222235c6a1c437144b53f57b9375ee56e76c467e6b1d4e643a403131153c9
7
+ data.tar.gz: ff37ab1ab9d6c2b33efb657905bb682c4d99cd22a7533e8b19db95d9949f11e621f0d750fbb829f8d61c377faa64d008c66bcdd703a072fae349d4d80c369ab2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.5] - 2025-01-14
4
+ ### Fixed
5
+ - Enhanced SQL statement handling in native loader
6
+ - Added proper UUID value quoting in VALUES clauses
7
+ - Fixed string value formatting in SQL statements
8
+ - Improved error reporting with detailed SQL statement context
9
+ - Added robust SQL statement cleaning and normalization
10
+
3
11
  ## [0.3.4] - 2025-01-14
4
12
  ### Added
5
13
  - Alternative native SQL loading method for CI environments
@@ -39,9 +39,12 @@ module RealDataTests
39
39
  statements.each do |statement|
40
40
  next if statement.strip.empty?
41
41
  begin
42
- connection.execute(statement)
42
+ # Clean up any formatting issues that might cause syntax errors
43
+ cleaned_statement = clean_sql_statement(statement)
44
+ connection.execute(cleaned_statement)
43
45
  rescue ActiveRecord::StatementInvalid => e
44
- raise Error, "Failed to execute SQL statement: #{e.message}"
46
+ # Provide detailed error information
47
+ raise Error, "Failed to execute SQL statement: #{e.message}\nStatement: #{cleaned_statement}"
45
48
  end
46
49
  end
47
50
  ensure
@@ -99,5 +102,24 @@ module RealDataTests
99
102
 
100
103
  statements
101
104
  end
105
+
106
+ def clean_sql_statement(statement)
107
+ # Handle VALUES clause formatting
108
+ if statement.include?('VALUES')
109
+ # Split into pre-VALUES and VALUES parts
110
+ parts = statement.split(/VALUES\s*\(/i, 2)
111
+ if parts.length == 2
112
+ # Properly quote UUIDs and strings in the VALUES part
113
+ values_part = parts[1]
114
+ values_part = values_part.gsub(/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?=[,\s)])/i, "'\\1'")
115
+ # Quote unquoted string values
116
+ values_part = values_part.gsub(/,\s*([^',\s][^,\s]*)(?=[,\s)])/, ", '\\1'")
117
+ # Reassemble the statement
118
+ statement = parts[0] + 'VALUES (' + values_part
119
+ end
120
+ end
121
+
122
+ statement
123
+ end
102
124
  end
103
125
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RealDataTests
4
- VERSION = "0.3.4"
4
+ VERSION = "0.3.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: real_data_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Dias