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
No related branches found
No related tags found
No related merge requests found
......@@ -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))
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;
//
......
......@@ -28,27 +28,39 @@ DELIMITER //
CREATE PROCEDURE db_2_0.initSubEntity(in e_id INT UNSIGNED, in ename VARCHAR(255), in tableName VARCHAR(255))
BEGIN
DECLARE ecount INT DEFAULT 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;');
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;');
PREPARE stmt FROM @stmtStr;
SET @ename = ename;
SET @ename = ename;
EXECUTE stmt USING @ename, @ename;
SET ecount = ROW_COUNT();
DEALLOCATE PREPARE stmt;
DEALLOCATE PREPARE stmt;
IF e_id IS NOT NULL THEN
SET @stmtStr = CONCAT('INSERT IGNORE INTO `', tableName, '` (id) VALUES (', e_id, ')');
PREPARE stmt FROM @stmtStr;
EXECUTE stmt;
SET ecount = ecount + ROW_COUNT();
DEALLOCATE PREPARE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF ecount > 0 THEN
call getChildren(tableName);
END IF;
END;
//
//
DELIMITER ;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment