activerecord-libsql 0.1.0 → 0.1.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a2e0290b309de0e7c29a936ede00a24b7aef1b6c79a648eb2ff5e593b5ee973
|
|
4
|
+
data.tar.gz: d4b0be5e49b7a3b52bee275016a9dd7145346404691d5918079193b5e44e4cd7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e7d1a814f4be1669eb69a31df52aa316f66e200ad014c7ced335b71cfddf377e782da639cfa709eac01cccaae9b8ff4366ee153394288476d28447920a977b06
|
|
7
|
+
data.tar.gz: bde5a707c097e7f35b71ab8a49d720402829b6f869812886d47dbd00912ca7407a7bcb833a4d635f564df8903699f3cce61460760db4dab7d2b69fc7426e9847
|
|
@@ -41,6 +41,18 @@ module ActiveRecord
|
|
|
41
41
|
)
|
|
42
42
|
private_constant :READ_QUERY
|
|
43
43
|
|
|
44
|
+
# AR 8.1 で Column.new のシグネチャが変わったため、ロード時に一度だけ決定する
|
|
45
|
+
# AR <= 8.0: Column.new(name, default, sql_type_metadata, null)
|
|
46
|
+
# AR >= 8.1: Column.new(name, cast_type, default, sql_type_metadata, null)
|
|
47
|
+
COLUMN_BUILDER =
|
|
48
|
+
if ActiveRecord::VERSION::MAJOR > 8 ||
|
|
49
|
+
(ActiveRecord::VERSION::MAJOR == 8 && ActiveRecord::VERSION::MINOR >= 1)
|
|
50
|
+
->(name, cast_type, default, sql_type_md, null) { Column.new(name, cast_type, default, sql_type_md, null) }
|
|
51
|
+
else
|
|
52
|
+
->(name, _cast_type, default, sql_type_md, null) { Column.new(name, default, sql_type_md, null) }
|
|
53
|
+
end
|
|
54
|
+
private_constant :COLUMN_BUILDER
|
|
55
|
+
|
|
44
56
|
# -----------------------------------------------------------------------
|
|
45
57
|
# Adapter 識別
|
|
46
58
|
# -----------------------------------------------------------------------
|
|
@@ -142,8 +154,9 @@ module ActiveRecord
|
|
|
142
154
|
build_result(rows)
|
|
143
155
|
else
|
|
144
156
|
affected = raw_connection.execute(expanded_sql)
|
|
145
|
-
|
|
146
|
-
|
|
157
|
+
@last_affected_rows = affected.to_i
|
|
158
|
+
notification_payload[:row_count] = @last_affected_rows if notification_payload
|
|
159
|
+
ActiveRecord::Result.empty
|
|
147
160
|
end
|
|
148
161
|
rescue RuntimeError => e
|
|
149
162
|
raise translate_exception(e, message: e.message, sql: expanded_sql, binds: [])
|
|
@@ -154,8 +167,8 @@ module ActiveRecord
|
|
|
154
167
|
raw_result
|
|
155
168
|
end
|
|
156
169
|
|
|
157
|
-
def affected_rows(
|
|
158
|
-
|
|
170
|
+
def affected_rows(_raw_result)
|
|
171
|
+
@last_affected_rows || 0
|
|
159
172
|
end
|
|
160
173
|
|
|
161
174
|
# -----------------------------------------------------------------------
|
|
@@ -208,14 +221,8 @@ module ActiveRecord
|
|
|
208
221
|
sql_type = row['type'].to_s
|
|
209
222
|
cast_type = type_map.lookup(sql_type) || Type::Value.new
|
|
210
223
|
sql_type_md = fetch_type_metadata(sql_type)
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
row['name'],
|
|
214
|
-
cast_type,
|
|
215
|
-
row['dflt_value'],
|
|
216
|
-
sql_type_md,
|
|
217
|
-
row['notnull'].to_i.zero?
|
|
218
|
-
)
|
|
224
|
+
null = row['notnull'].to_i.zero?
|
|
225
|
+
COLUMN_BUILDER.call(row['name'], cast_type, row['dflt_value'], sql_type_md, null)
|
|
219
226
|
end
|
|
220
227
|
end
|
|
221
228
|
|