Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Bind variable use in C++ SQL Calls

Bind variable use in C++ SQL Calls

From: Karen Morton <oracledba_at_morton-consulting.com>
Date: Fri, 21 Mar 2003 13:14:24 -0500
Message-Id: <24738.322724@fatcity.com>


All,

I've got an application that does not use bind variables. The code is written in Microsoft Visual C++. I have no background with C++ and need some help in telling the developers how to use bind variables in their code (they don't know and aren't sure how to find out). I pulled the following examples out of the code for different ways they execute SQL. If anyone can assist with specific examples on how to rewrite this to use bind variables, it would be immensely helpful.

Thanks,
Karen Morton

Samples



Mystring.Format("SELECT AVA_SERIAL FROM avamas \
    WHERE  ava_tabname = 'sys_node' \
    AND    ava_nodeid  =  %-d  \
    AND    ava_wkday   =  %-d  \
    AND    ava_sdate   =  %s \
    AND    ava_stime   = '%-s'",

    cAvalObject->cItemSerial, m_weekday, ConvertDateToODBCStr (pDatabase, m_sdatetime), m_schartime);

    rSpanRecord.Open (CRecordset::forwardOnly, cSpanSelect);

    if (rSpanRecord.IsEOF () == 0)
    { rSpanRecord.GetFieldValue ("AVA_SERIAL", vCDBVariant);

        m_serial = atol (ObjectConvert (&vCDBVariant));

        vCDBVariant.Clear ();
    }

    rSpanRecord.Close ();



CSysNumSet SysnumSet(pDatabase);
SysnumSet.m_TableParam = strFile;
SysnumSet.m_strFilter = "myid = 1234 and yourmom = 'NICE'"         

SysnumSet.Open();         

if (SysnumSet.IsOpen())

   lNewSysNo = SysnumSet.m_file_identity; else

   lNewSysNo = 0;


strSQL.Format("UPDATE sys_file WITH (ROWLOCK) SET file_identity = file_identity + 1 WHERE file_table = '%s' ", strFile);                  Received on Fri Mar 21 2003 - 12:14:24 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US