Skip to content
Snippets Groups Projects
Verified Commit 0debb5ee authored by Timm Fitschen's avatar Timm Fitschen
Browse files

FIX initSubEntity (for like patterns)

parent d3f611aa
Branches
Tags
No related merge requests found
...@@ -50,7 +50,7 @@ delimiter // ...@@ -50,7 +50,7 @@ delimiter //
CREATE PROCEDURE db_2_0.updateLinCon(in sig_from BIGINT, in sig_to BIGINT, in new_a DECIMAL(65,30), in new_b_dividend BIGINT, in new_b_divisor BIGINT, in new_c DECIMAL(65,30)) CREATE PROCEDURE db_2_0.updateLinCon(in sig_from BIGINT, in sig_to BIGINT, in new_a DECIMAL(65,30), in new_b_dividend BIGINT, in new_b_divisor BIGINT, in new_c DECIMAL(65,30))
BEGIN BEGIN
UPDATE units_ling_con SET signature_to=sig_to, a=new_a, b_dividend=new_b_dividend, b_divisor=new_b_divisor, c=new_c where signature_from=sig_from; UPDATE units_lin_con SET signature_to=sig_to, a=new_a, b_dividend=new_b_dividend, b_divisor=new_b_divisor, c=new_c where signature_from=sig_from;
END; END;
// //
......
...@@ -29,8 +29,20 @@ DELIMITER // ...@@ -29,8 +29,20 @@ DELIMITER //
CREATE PROCEDURE db_2_0.initSubEntity(in e_id INT UNSIGNED, in ename VARCHAR(255), in tableName VARCHAR(255)) CREATE PROCEDURE db_2_0.initSubEntity(in e_id INT UNSIGNED, in ename VARCHAR(255), in tableName VARCHAR(255))
BEGIN BEGIN
DECLARE ecount INT DEFAULT 0; DECLARE ecount INT DEFAULT 0;
DECLARE op VARCHAR(255) DEFAULT '=';
IF LOCATE("%", ename) > 0 THEN
SET op = "LIKE";
END IF;
SET @stmtStr = CONCAT('INSERT IGNORE INTO `',
tableName,
'` (id) SELECT id FROM entities WHERE name ',
op,
' ? UNION ALL SELECT entity_id FROM name_data WHERE value ',
op,
' ? AND domain_id=0;');
SET @stmtStr = CONCAT('INSERT IGNORE INTO `', tableName, '` (id) SELECT id FROM entities WHERE name = ? UNION ALL SELECT entity_id FROM name_data WHERE value=? AND domain_id=0;');
PREPARE stmt FROM @stmtStr; PREPARE stmt FROM @stmtStr;
SET @ename = ename; SET @ename = ename;
EXECUTE stmt USING @ename, @ename; EXECUTE stmt USING @ename, @ename;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment