'INSERT IGNORE INTO `',keepTabl,'` (id, _iversion) SELECT entity_id AS id, _iversion FROM ',data,
' as data',IF(propertiesTableISNULL,'',CONCAT(
...
...
@@ -299,7 +319,15 @@ POV_LABEL: BEGIN
DEALLOCATEPREPAREstmtPOVkeepTbl;
ELSE
#-- generate statement from statement parts
SET@stmtPOVkeepTblStr=CONCAT('INSERT IGNORE INTO `',keepTabl,'` (id) SELECT DISTINCT entity_id AS id FROM ',data,' as data',IF(propertiesTableISNULL,'',CONCAT(' WHERE EXISTS (Select 1 from `',propertiesTable,'` AS prop WHERE prop.id = data.property_id AND (prop.id2=data.entity_id OR prop.id2=0))')));
#-- (unversioned section)
SET@stmtPOVkeepTblStr=CONCAT('INSERT IGNORE INTO `',keepTabl,'` (id)
SELECT DISTINCT entity_id AS id FROM ',data,' as data',
IF(propertiesTableISNULL,
'',
/* restrict to properties with one of the appropriate ids
* and where the domain (???) equals the entity*/
CONCAT(' WHERE EXISTS (Select 1 from `',propertiesTable,'` AS prop
WHERE prop.id = data.property_id AND (prop.id2=data.entity_id OR prop.id2=0))')));
SET@initPOVPropertiesTableStmt1=CONCAT('INSERT IGNORE INTO `',propertiesTable,'` (id, id2, domain) SELECT property_id, entity_id, domain_id from name_overrides WHERE name = ? UNION ALL SELECT entity_id, domain_id, 0 FROM name_data WHERE value = ?;');