real_data_tests 0.3.7 → 0.3.8
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 +14 -11
- 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: 573f1753777e04a6168a09385b8332cedbb4d521d11f1807012a25b8b846013c
|
4
|
+
data.tar.gz: b884098abbc9134a22479d5e9211a2d8bb153622022ba9116acb0057419cbe4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d4bcb84f7d3ab3ee0901ae46763c912f3c86935930cc17607d500ae7a2e26649f8c6ff629e8215437d8f08ae93d482870e253b294e84e720971c9bf681c7b50
|
7
|
+
data.tar.gz: 67cad3bda841d3e1de61d61dd30121ef3b6ddfc96a3162438a2b25f904185e6e4c59206d2626e6b40d44a72d123ed123e4073a4fdfe10d04fea807a8702bf689
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.3.8] - 2025-01-14
|
4
|
+
### Fixed
|
5
|
+
- Enhanced SQL statement parsing in native loader
|
6
|
+
- Improved handling of complex ON CONFLICT clauses with multiple closing parentheses
|
7
|
+
- Fixed spacing issues between VALUES and ON CONFLICT clauses
|
8
|
+
- Enhanced regex pattern for more precise conflict clause extraction
|
9
|
+
- Added proper statement reassembly for complex SQL structures
|
10
|
+
|
3
11
|
## [0.3.7] - 2025-01-14
|
4
12
|
### Fixed
|
5
13
|
- Corrected SQL value handling in native loader
|
@@ -103,6 +103,15 @@ module RealDataTests
|
|
103
103
|
statements
|
104
104
|
end
|
105
105
|
|
106
|
+
def extract_conflict_clause(statement)
|
107
|
+
# Use a more precise regex that handles multiple closing parentheses
|
108
|
+
if statement =~ /(.+?\))\s*(ON\s+CONFLICT\s+.*?)(?:;?\s*$)/i
|
109
|
+
[$1, $2.strip]
|
110
|
+
else
|
111
|
+
[statement.sub(/;?\s*$/, ''), nil]
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
106
115
|
def clean_sql_statement(statement)
|
107
116
|
# Extract the ON CONFLICT clause if it exists
|
108
117
|
statement, conflict_clause = extract_conflict_clause(statement)
|
@@ -115,24 +124,18 @@ module RealDataTests
|
|
115
124
|
# Clean and process the values
|
116
125
|
values = clean_values(parts[1].split(/\)\s*$/)[0])
|
117
126
|
|
118
|
-
#
|
127
|
+
# Make sure we properly close the VALUES parentheses
|
119
128
|
statement = "#{parts[0]}VALUES (#{values})"
|
120
129
|
end
|
121
130
|
end
|
122
131
|
|
123
132
|
# Add back the conflict clause if it existed
|
124
|
-
statement
|
125
|
-
statement += ";"
|
133
|
+
statement = "#{statement}#{conflict_clause ? ' ' + conflict_clause : ''}"
|
126
134
|
|
127
|
-
statement
|
128
|
-
|
135
|
+
# Ensure the statement ends with a semicolon
|
136
|
+
statement += ";" unless statement.end_with?(';')
|
129
137
|
|
130
|
-
|
131
|
-
if statement =~ /(.+?)(\s+ON\s+CONFLICT\s+.*?)(?:;?\s*$)/i
|
132
|
-
[$1, $2.strip]
|
133
|
-
else
|
134
|
-
[statement.sub(/;?\s*$/, ''), nil]
|
135
|
-
end
|
138
|
+
statement
|
136
139
|
end
|
137
140
|
|
138
141
|
def clean_values(values_str)
|