jade-sql 0.5.1 → 0.5.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 +4 -4
- data/lib/jade-sql/sql/mutation.jd +27 -1
- data/lib/jade-sql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a368ab6b8f06dd2f2d97c0ac2ffab207f15a548375ea7b64f2857ea41e51aef
|
|
4
|
+
data.tar.gz: b95392270986453c3429503b84631ef26c2fac9626df0a540e7fac499277fe1f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e9c58d0015a7c767a536c4b8b750a744c9dc40ef39a3fb8fcb34e7cdba816050dead56229bdbe55359f7d42699de71ec6faaa68f03409ce640b2f0275f64220
|
|
7
|
+
data.tar.gz: c64658fd2ae9eb7e10b847be092098c1688fbf7f311a53894f06912fc97665a057e30f192faf5d6f1c54cd3c9c72d295c7dcc7e06b277dde6d3fde99d68a1a13
|
|
@@ -260,7 +260,31 @@ end
|
|
|
260
260
|
|
|
261
261
|
|
|
262
262
|
def render_update(m: Mutation(ret, c)) -> (String, List(Value))
|
|
263
|
-
|
|
263
|
+
sets = set_sqls_for(m.rows)
|
|
264
|
+
|
|
265
|
+
List.empty?(sets) ? render_no_op_update(m) : render_update_set(m, sets)
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def render_no_op_update(m: Mutation(ret, c)) -> (String, List(Value))
|
|
270
|
+
where = strip_table_alias(where_sql(m.wheres), m.table.alias_)
|
|
271
|
+
cols = List.empty?(m.returning_selector.columns_sql)
|
|
272
|
+
? "1"
|
|
273
|
+
: strip_table_alias(
|
|
274
|
+
String.join(m.returning_selector.columns_sql, ", "),
|
|
275
|
+
m.table.alias_,
|
|
276
|
+
)
|
|
277
|
+
sql = "SELECT " ++ cols ++ " FROM " ++ m.table.name ++ where
|
|
278
|
+
|
|
279
|
+
Tuple.Tuple2(sql, m.returning_selector.params ++ where_params(m.wheres))
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def render_update_set(
|
|
284
|
+
m: Mutation(ret, c),
|
|
285
|
+
sets: List(String),
|
|
286
|
+
) -> (String, List(Value))
|
|
287
|
+
set_clause = "SET " ++ String.join(sets, ", ")
|
|
264
288
|
where = strip_table_alias(where_sql(m.wheres), m.table.alias_)
|
|
265
289
|
returning_ = strip_table_alias(returning_clause(m.returning_selector), m.table.alias_)
|
|
266
290
|
sql = "UPDATE "
|
|
@@ -277,6 +301,8 @@ def render_update(m: Mutation(ret, c)) -> (String, List(Value))
|
|
|
277
301
|
end
|
|
278
302
|
|
|
279
303
|
|
|
304
|
+
|
|
305
|
+
|
|
280
306
|
def render_delete(m: Mutation(ret, c)) -> (String, List(Value))
|
|
281
307
|
where = strip_table_alias(where_sql(m.wheres), m.table.alias_)
|
|
282
308
|
returning_ = strip_table_alias(returning_clause(m.returning_selector), m.table.alias_)
|
data/lib/jade-sql/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jade-sql
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- agustin
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-08-01 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: jade-lang
|