This commit is contained in:
parent
3cf5555612
commit
1133750629
|
@ -6,7 +6,9 @@ BEGIN
|
||||||
* dejando únicamente los días de retención configurados.
|
* dejando únicamente los días de retención configurados.
|
||||||
*/
|
*/
|
||||||
DECLARE vSchemaName VARCHAR(65);
|
DECLARE vSchemaName VARCHAR(65);
|
||||||
|
DECLARE vSchemaNameQuoted VARCHAR(65);
|
||||||
DECLARE vTableName VARCHAR(65);
|
DECLARE vTableName VARCHAR(65);
|
||||||
|
DECLARE vTableNameQuoted VARCHAR(65);
|
||||||
DECLARE vRetentionDays INT;
|
DECLARE vRetentionDays INT;
|
||||||
DECLARE vStarted DATETIME;
|
DECLARE vStarted DATETIME;
|
||||||
DECLARE vDated DATE;
|
DECLARE vDated DATE;
|
||||||
|
@ -30,13 +32,15 @@ BEGIN
|
||||||
|
|
||||||
IF vRetentionDays THEN
|
IF vRetentionDays THEN
|
||||||
SET vStarted = util.VN_NOW();
|
SET vStarted = util.VN_NOW();
|
||||||
|
SET vSchemaNameQuoted = util.quoteIdentifier(vSchemaName);
|
||||||
|
SET vTableNameQuoted = util.quoteIdentifier(vTableName);
|
||||||
SET vDated = VN_CURDATE() - INTERVAL vRetentionDays DAY;
|
SET vDated = VN_CURDATE() - INTERVAL vRetentionDays DAY;
|
||||||
|
|
||||||
CALL util.exec(CONCAT(
|
EXECUTE IMMEDIATE CONCAT(
|
||||||
'DELETE FROM ', util.quoteIdentifier(vSchemaName),
|
'DELETE FROM ', vSchemaNameQuoted,
|
||||||
'.', util.quoteIdentifier(vTableName),
|
'.', vTableNameQuoted,
|
||||||
" WHERE creationDate < '", vDated, "'"
|
" WHERE creationDate < '", vDated, "'"
|
||||||
));
|
);
|
||||||
|
|
||||||
UPDATE logCleanMultiConfig
|
UPDATE logCleanMultiConfig
|
||||||
SET `started` = vStarted,
|
SET `started` = vStarted,
|
||||||
|
|
Loading…
Reference in New Issue