more flexibility for queries (strore in config file)
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
"dbDriver":"mssql", "dbDriverComment":"either mssql (user/password) or mssql/msnodesqlv8 (trustedConnection)",
|
||||
"processingType": "casrpslog",
|
||||
"sourceTag": "CCERpsLog",
|
||||
"maxResultsPerMessage":100,
|
||||
"statements":{
|
||||
"poller":"'select top ' + config.maxResultsPerMessage + ' * from rpslog where pkey > \\'' + maxPKey + '\\' order by pkey'"
|
||||
},
|
||||
"serverURI": "http://localhost:2222",
|
||||
"pollIntervalIdle": 10000,
|
||||
"sqlConfig": {
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
"processingType": "casrpslog",
|
||||
"sourceTag": "CCERpsLog",
|
||||
"serverURI": "http://localhost:2222",
|
||||
"maxResultsPerMessage":100,
|
||||
"statements":{
|
||||
"poller":"'select top ' + config.maxResultsPerMessage + ' * from rpslog where pkey > \\'' + maxPKey + '\\' order by pkey'"
|
||||
},
|
||||
"pollIntervalIdle": 10000,
|
||||
"UP_sqlConfig": {
|
||||
"user": "casdbuser",
|
||||
|
||||
@@ -39,7 +39,6 @@ logger.log("info", `DBExtractor v0.1 Starting`);
|
||||
|
||||
|
||||
logger.log("debug", "Config" + JSON.stringify(config))
|
||||
const maxResultsPerMessage=100;
|
||||
let maxPKey = "";
|
||||
let maxPKeyUnsent = "";
|
||||
let allRows = [];
|
||||
@@ -52,7 +51,7 @@ try {
|
||||
logger.log("debug", "MaxPKey Loaded: " + maxPKey);
|
||||
} catch (ex) {
|
||||
if (ex.errno === -4058) {
|
||||
logger.log("info", "MaxPKey-File not existing. Will be created.");
|
||||
logger.log("info", "MaxPKey-File not existing. All data will be processed");
|
||||
} else {
|
||||
logger.log("error", "opening DBExtractor.maxPKey.dat :" + ex);
|
||||
}
|
||||
@@ -67,7 +66,7 @@ try {
|
||||
sqlRequest.stream = true;
|
||||
|
||||
function runNextPoll(){
|
||||
sqlRequest.query("select top " + maxResultsPerMessage + " * from rpslog where pkey > '" + maxPKey + "' order by pkey");
|
||||
sqlRequest.query(eval(config.statements.poller));
|
||||
}
|
||||
|
||||
runNextPoll();
|
||||
|
||||
@@ -1 +1 @@
|
||||
0010000000a87kj9
|
||||
0010000000a7l7bx
|
||||
Reference in New Issue
Block a user