I am currently utilizing an HTA page that is coded in JavaScript to monitor various Oracle tables.
My goal is to optimize the Oracle query caching by using bind variables, similar to how I implemented it in a PHP environment with this code:
$sql = "select m1_master from CEDWORK.hd_anag where account = :utente";
$s = OCIParse($c, $sql);
ocibindbyname($s, ":utente", $utente);
if ( OCIExecute($s, OCI_DEFAULT) == false ){
gsterr($sql, "record not found");
}
while (ocifetch($s)) {
$codmec = OCIResult($s, "M1_MASTER");
}
For the JavaScript in the HTA file, I used the following code snippet:
function test1(idUtente){
var adOpenDynamic = 2
var adLockOptimistic = 3
var conn_str = "Provider=OraOLEDB.Oracle;Password=xxxx;Persist Security Info=True;User ID=xxxx;Data Source=sgo01";
var conn = new ActiveXObject("ADODB.Connection")
conn.open(conn_str)
var rsPass = new ActiveXObject("ADODB.Recordset");
var arrPass = new Array();
var rs2arr = new Array();
var SQLpass = "SELECT cod_operatore, a.cognome, a.nome, a.account, m1_master ";
SQLpass += "from cedwork.hd_operatori a, cedwork.hd_anag b " ;
SQLpass += "where a.account = b.account " ;
SQLpass += "and a.account = '" + idUtente + "'" ;
rsPass.open(SQLpass, conn, adOpenDynamic, adLockOptimistic);
alert(rsPass.fields("m1_master").value);
rsPass.close();
}
I am looking to replace the "idUtente" variable with a bind variable in JavaScript, but I have been unable to find the correct syntax for doing so.
Thank you for any assistance, Marco