Saturday, February 25, 2012

Can someone tell me what this means?

Rc = SQL_Query(
"SELECT TerminalOptions, RRDays, InstallerId, IcePakPhone, Snak,
ScreenSetID, TerminalConfiguration, MaskOptions "
"FROM Terminal "
"WHERE (CustomerID=?) AND (TerminalID=?)",
SQL_C_LONG, &lMerchatIdenity, sizeof(long),
SQL_C_CHAR, Field[F_TERMID], strlen(Field[F_TERMID]),
SQL_INTO,
SQL_C_CHAR, LicOpt, 9,
SQL_C_CHAR, RRDays, 3,
SQL_C_CHAR, InstallerId, 7,
SQL_C_CHAR, IcePhone, 17,
SQL_C_CHAR, Snak,17,
SQL_C_CHAR, ScrId,12,
SQL_C_CHAR, TermCfg, 9,
SQL_C_CHAR, MaskOpt, 9 ,
SQL_TYPE_NULL );
I can undesrtand up to ' "WHERE (CustomerID=?) AND (TerminalID=?)",
'
whatever follows after that gets me lost ...
Can someone tell me what exaclly th erest means?
Thanks"CTG" wrote:
<snip code: repeated below>

> I can undesrtand up to ' "WHERE (CustomerID=?) AND (TerminalID=?)",
> '
> whatever follows after that gets me lost ...
> Can someone tell me what exaclly th erest means?
> Thanks
I'm not familiar with a function named SQL_Query (perhaps it's internal to
your app or part of a library you purchased?), but it appears to me that...

> SQL_C_LONG, &lMerchatIdenity, sizeof(long),
> SQL_C_CHAR, Field[F_TERMID], strlen(Field[F_TERMID]),
> SQL_INTO,
This is providing information about the variables used to fill in parameters
in the query (the question marks in the WHERE clause). Each query parameter
is given as 3 arguments passed to SQL_Query: data type, address of the
information, and length of the data pointed to by the address. SQL_INTO
marks the end of the query parameters and denotes the beginning of...

> SQL_C_CHAR, LicOpt, 9,
> SQL_C_CHAR, RRDays, 3,
> SQL_C_CHAR, InstallerId, 7,
> SQL_C_CHAR, IcePhone, 17,
> SQL_C_CHAR, Snak,17,
> SQL_C_CHAR, ScrId,12,
> SQL_C_CHAR, TermCfg, 9,
> SQL_C_CHAR, MaskOpt, 9 ,
> SQL_TYPE_NULL );
This is telling SQL_Query where to place the results of the query:
TerminalOptions will be stored in LicOpt, RRDays in RRDays, etc. It appears
to use the same pattern as above: type, location, length. SQL_TYPE_NULL is
the marker that tells SQL_Query that the list is finished.
Now, how you handle multiple records, how you insure that you don't corrupt
memory, and what the return code (stored in Rc) means is impossible to
determine from the code here.
Craig|||Thanks Craige;
I did not write this code.
I guess the prev author ASSuMEd that there is only one record and always
found and we know what happens when we ASS U ME.
Thanks for reply
"Craig Kelly" wrote:

> "CTG" wrote:
> <snip code: repeated below>
>
> I'm not familiar with a function named SQL_Query (perhaps it's internal to
> your app or part of a library you purchased?), but it appears to me that..
.
>
> This is providing information about the variables used to fill in paramete
rs
> in the query (the question marks in the WHERE clause). Each query paramet
er
> is given as 3 arguments passed to SQL_Query: data type, address of the
> information, and length of the data pointed to by the address. SQL_INTO
> marks the end of the query parameters and denotes the beginning of...
>
> This is telling SQL_Query where to place the results of the query:
> TerminalOptions will be stored in LicOpt, RRDays in RRDays, etc. It appea
rs
> to use the same pattern as above: type, location, length. SQL_TYPE_NULL i
s
> the marker that tells SQL_Query that the list is finished.
> Now, how you handle multiple records, how you insure that you don't corrup
t
> memory, and what the return code (stored in Rc) means is impossible to
> determine from the code here.
> Craig
>
>

No comments:

Post a Comment