Hi

I need implement two SQL query to retrieve different fields from
database. and use parameter to determent which SQL query to be used.

ie.
select F1,F2,F3 from eventtable ....
select F1,F2,F3,F4 from eventtable ....

I am using Sentinel SDK 2011.1r1.

The following release.js can work only in first time that collector
starting. The second query can't get the correct offset. I watch the sql
query by SQL profiler.

The first query is correct.

ie.
select top 20 F1, F2, F3 from event table where id > 12343

However, the offset will become 'true' in next query.

ie.
select top 20 F1, F2, F3 from event table where id > true

Have anything that I miss in the following code?

============
Collector.prototype.initialize = function(){
if (instance.CONFIG.params.Query_Variant == "1") {
this.CONFIG.DBQuery = new SQLQuery("sqlquery1.base");
} else {
this.CONFIG.DBQuery = new SQLQuery("sqlquery2.base");
}


this.PARSER.getOffsetData = function(input){
if (typeof input.RXMap != "undefined") {
return input.RXMap.SensorDataRowID;
}
}
this.CONFIG.DBQuery.addParser(this.PARSER.getOffse tData);

return true;
};

Connector.prototype.sendQuery = function(){
if (this.CONNECTION_STATUS == "NEED-QUERY") {
conn.send(instance.CONFIG.DBQuery);
}
return true;
};

Record.prototype.preParse = function(e){
if (this.CONNECTION_ERROR != null ) { return false; }



if (this.CONNECTION_METHOD == "DATABASE" && this.CONNECTION_MODE ==
"map") {
for (var field in this.RXMap) {
this[field] = this.RXMap[field];
}
this.strMessage = this.s_raw_message2;
}
return true;
};

Record.prototype.parse = function(e){
instance.SEND_EVENT = true;
return true;
};

Record.prototype.reply = function(e){
if (rec.CONNECTION_METHOD == "DATABASE") {
instance.CONFIG.DBQuery.setOffset();
}

return true;
};
==========

Regards,
Steven


--
steven_cjhsiao
------------------------------------------------------------------------
steven_cjhsiao's Profile: https://forums.netiq.com/member.php?userid=544
View this thread: https://forums.netiq.com/showthread.php?t=47871