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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/real_data_tests/rspec_helper.rb +24 -2
- data/lib/real_data_tests/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35d81ac18056a163df010e92d75c5bd36896836d070f8c74041048ab98918cdf
|
4
|
+
data.tar.gz: 50d5df4a36a88f58b6dbc76494db155bc68b5b9ca1cf8cbd45b22a4bd8cd6166
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|