-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample_config_caseman.js
48 lines (47 loc) · 2.2 KB
/
sample_config_caseman.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
module.exports = {
getSequenceSqlFunction: function(id,variableName) {
/**
* Returns the next number for the secondary primary key for a given table.
* Yes. I know tables shouldn't have a secondary primary key. Good luck telling
* Donor Direct that. Maybe the next database they design will have a measure
* of sanity after you talk to them.
*
* @param strTableName string name of the table you want to get the next number for.
* @return promise that resolves with an integer ID
*/
/**
* Returns the rather cryptic "NextNumber" ID code name
*
* @param strTableName string name of table you want to know the next number ID
* code name for
*/
var getNextNumberIdNameByTableName = function(strTableName,varName) {
var ref = {
'Q03_ImportMaster' : 'ECOMMIMPID'
,'Q04_ImportDetails' : 'ECOMMIDTID'
,'A03_AddressMaster' : 'ADDRESSID'
,'A10_AccountPledges' : 'PLEDGEID'
,'A01_AccountMaster' : 'ACCTNBR'
,'T07_TransactionResponseMaster' : 'RESPONSEID'
,'T16_RecurringTransactionHeaders' : 'RECTRANSID'
};
if(typeof ref[strTableName] == 'undefined') {
console.log(strTableName + ' is not a nextNumber enabled table.');
return false;
}
return ref[strTableName];
};
return function() {
var strType = getNextNumberIdNameByTableName(id);
var strSql = "EXEC [dbo].[X31_NextNumberBusinessDataSingleValueByType] @strType=N'"+strType+"',@iNextNumber=@"+variableName+" OUTPUT\n";
return strSql;
};
},
mssql: {
user : process.env.ROUNDSQL_USER
,password : process.env.ROUNDSQL_PASS
,server : process.env.ROUNDSQL_HOST
,database : process.env.ROUNDSQL_DBNAME
,port : process.env.ROUNDSQL_PORT
}
};