summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-07-02 20:57:23 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-07-02 20:57:23 +0200
commit2be09e2ce40e60a452d865fbec6cd969c29ea42a (patch)
tree36b086e57ee52b810980261cea2e22859d6db7a6
parentc60aeb4bb9e4381182ed0c30793ea6612ceaa283 (diff)
downloadcruncher-2be09e2ce40e60a452d865fbec6cd969c29ea42a.tar.gz
cruncher-2be09e2ce40e60a452d865fbec6cd969c29ea42a.zip
fix table name via env var -> sql error
-rw-r--r--crunch_global.sql18
-rw-r--r--worker.js4
2 files changed, 12 insertions, 10 deletions
diff --git a/crunch_global.sql b/crunch_global.sql
index 6fbf212..1205dfc 100644
--- a/crunch_global.sql
+++ b/crunch_global.sql
@@ -1,4 +1,4 @@
-insert low_priority into :crunch_table
+insert low_priority into `global_point`
select
null,
now(),
@@ -45,13 +45,15 @@ join build b on (( -- only per patch global
st.name = 'all' and
reg.name = 'all' and
- (b.item_1 is null or p_s.item_grants RLIKE concat(:build_regex_start, b.item_1, ';', b.item_1_count, :build_regex_end)) and
- (b.item_2 is null or p_s.item_grants RLIKE concat(:build_regex_start, b.item_2, ';', b.item_2_count, :build_regex_end)) and
- (b.item_3 is null or p_s.item_grants RLIKE concat(:build_regex_start, b.item_3, ';', b.item_3_count, :build_regex_end)) and
- (b.item_4 is null or p_s.item_grants RLIKE concat(:build_regex_start, b.item_4, ';', b.item_4_count, :build_regex_end)) and
- (b.item_5 is null or p_s.item_grants RLIKE concat(:build_regex_start, b.item_5, ';', b.item_5_count, :build_regex_end)) and
- (b.item_6 is null or p_s.item_grants RLIKE concat(:build_regex_start, b.item_6, ';', b.item_6_count, :build_regex_end)) and
- b.dimension_on = 'global'
+ (
+ (b.item_1 is null or p_s.item_grants rlike concat(:build_regex_start, b.item_1, ';', b.item_1_count, :build_regex_end)) and
+ (b.item_2 is null or p_s.item_grants rlike concat(:build_regex_start, b.item_2, ';', b.item_2_count, :build_regex_end)) and
+ (b.item_3 is null or p_s.item_grants rlike concat(:build_regex_start, b.item_3, ';', b.item_3_count, :build_regex_end)) and
+ (b.item_4 is null or p_s.item_grants rlike concat(:build_regex_start, b.item_4, ';', b.item_4_count, :build_regex_end)) and
+ (b.item_5 is null or p_s.item_grants rlike concat(:build_regex_start, b.item_5, ';', b.item_5_count, :build_regex_end)) and
+ (b.item_6 is null or p_s.item_grants rlike concat(:build_regex_start, b.item_6, ';', b.item_6_count, :build_regex_end)) and
+ b.dimension_on = 'global'
+ )
) or b.name = 'all')
where p.api_id in (:participant_api_ids)
diff --git a/worker.js b/worker.js
index d84544c..81d1959 100644
--- a/worker.js
+++ b/worker.js
@@ -74,7 +74,8 @@ if (LOGGLY_TOKEN)
// for the `participant_api_id` array
const player_script = fs.readFileSync("crunch_player.sql", "utf8"),
team_script = fs.readFileSync("crunch_team.sql", "utf8"),
- global_script = fs.readFileSync("crunch_global.sql", "utf8");
+ global_script = fs.readFileSync("crunch_global.sql", "utf8")
+ .replace("`global_point`", CRUNCH_TABLE);
// fill a buffer and execute an SQL on a bigger (> 1o) batch
const participants_player = new Set(),
@@ -126,7 +127,6 @@ if (LOGGLY_TOKEN)
replacements: {
build_regex_start: '^([[:digit:]]+;[[:digit:]]+,)*(',
build_regex_end: ')+(,[[:digit:]]+;[[:digit:]]+)*$',
- crunch_table: CRUNCH_TABLE,
participant_api_ids: api_ids_global
},
type: seq.QueryTypes.UPSERT