satauros
10/13/2023, 10:04 AMaliaspooryorik
satauros
10/13/2023, 10:55 AMbeanFactory.getBean( "factoriedObject" ).withArguments( ... )
instead of registering it with static arguments in a load listener?aliaspooryorik
satauros
10/13/2023, 11:15 AMcreate
function on that factory object in the beanFactory.satauros
10/13/2023, 1:01 PMqb
?aliaspooryorik
satauros
10/13/2023, 1:29 PMupsert
method for updating / inserting some values - using MSSQL btw - but it seems to complain about an auto-increment fieldsatauros
10/13/2023, 1:30 PMvalues = [ { "id": 1, "name": "foo" }, { "id": 2, "name": "bar" } ];
qb.table( "lorem" ).upsert( values = values, target = "id" );
aliaspooryorik
satauros
10/13/2023, 1:31 PMaliaspooryorik
satauros
10/13/2023, 1:33 PMMERGE [dbo].[table] AS [qb_target] USING (
VALUES
(
(param 1),
(param 2),
(param 3),
(param 4),
(param 5)
)
) AS [qb_src] (
[a],
[b],
[c],
[id],
[d]
) ON [qb_target].[id] = [qb_src].[id]
WHEN MATCHED THEN
UPDATE
SET
[a] = [qb_src].[a],
[b] = [qb_src].[b],
[c] = [qb_src].[c],
[id] = [qb_src].[id],
[d] = [qb_src].[d]
WHEN NOT MATCHED BY TARGET THEN
INSERT
(
[a],
[b],
[c],
[id],
[d]
)
VALUES
(
[a],
[b],
[c],
[id],
[d]
);
satauros
10/13/2023, 1:33 PMtarget
parameter to define whether or not to insert / update the recordsatauros
10/13/2023, 1:34 PMupdate
for the upsert
clause, the id
column disappears from the UPDATE statement, but it remains in the INSERT statementaliaspooryorik
update
parameter with the keys as an array solves the issue?satauros
10/13/2023, 1:38 PMsatauros
10/13/2023, 1:38 PMaliaspooryorik
aliaspooryorik
satauros
10/13/2023, 1:40 PMaliaspooryorik
satauros
10/13/2023, 1:41 PMsatauros
10/13/2023, 1:41 PMsatauros
10/13/2023, 1:41 PMaliaspooryorik
aliaspooryorik
source
option which accepts a closure - never used it thoughsatauros
10/13/2023, 1:46 PMsatauros
10/13/2023, 1:47 PMaliaspooryorik