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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f325960594ac352b4fbaae4adafb38256bde54feed249140838971e61c5fcef1
4
- data.tar.gz: d977dda68eac4fa8d13c82dc5a00bba7dd3b27e9c876ab5847a3b3b254cc7d4f
3
+ metadata.gz: 573f1753777e04a6168a09385b8332cedbb4d521d11f1807012a25b8b846013c
4
+ data.tar.gz: b884098abbc9134a22479d5e9211a2d8bb153622022ba9116acb0057419cbe4a
5
5
  SHA512:
6
- metadata.gz: 40c69c54f989318441e697487673f7c019907cddcea3d81fa9b5775964fc2a6a76994b97093465d57f26521813780292f58d28f11ed75638222b458a75e514f8
7
- data.tar.gz: bce1cd39d64e2501b222135477c7e10d38769ae26b47827c3c76efb8d2651cdffae689ad3c8e2bb9bd0bdd1315e9f2dbfcdd3dd576079589c75d3d7585c2668c
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
- # Reassemble the statement
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 += " #{conflict_clause}" if conflict_clause
125
- statement += ";"
133
+ statement = "#{statement}#{conflict_clause ? ' ' + conflict_clause : ''}"
126
134
 
127
- statement
128
- end
135
+ # Ensure the statement ends with a semicolon
136
+ statement += ";" unless statement.end_with?(';')
129
137
 
130
- def extract_conflict_clause(statement)
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RealDataTests
4
- VERSION = "0.3.7"
4
+ VERSION = "0.3.8"
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.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Dias