Subject | SQLWhereItems->Add - Question |
---|---|
Author | Daniel Jimenez |
Post date | 2004-10-12T07:07:58Z |
Hi,
I am trying to complete a search on a single table of a DB through the use
of a TIB_Cursor and a TIB_CursorGrid.
The TIB_Cursor SQL statement is:
SELECT *
FROM
LOGPAS
WHERE
R_CREATED_BY =:CURRENT_USER
Now, when the application user tries a default search such as "Search All" I
set the CURRENT_USER param...
if( !crsCVDBCursor->Prepared )
crsCVDBCursor->Prepare();
crsCVDBCursor->ParamByName("CURRENT_USER")->AsString = FCurrentUser;
I am also making use of:
onPrepareSQL(TIB_Statement *Sender)
{
if( !FPrivateRecords )
{
crsCVDBCursor->SQLWhereItems->Add("OR");
crsCVDBCursor->SQLWhereItems->Add("R_SHARED = 1");
}
}
The following is the SQL send to the DB, as displayed by:
IB_Monitor1MonitorOutputItem(TObject *Sender, const AnsiString NewString)
{
ShowMessage(NewString);
}
SELECT *
FROM
LOGPAS
WHERE(
(
R_CREATED_BY=?/*CURRENT-USER*/
)
AND OR
)
AND R_SHARED=1
FOR UPDATE
The question/problem is,
(1)
Why/Who is placing the (AND) immediately infront of the (OR) which I am
adding though the use of the
"...SQLWhereItems->Add.."
(2)
Why/Who is placing the (FOR UPDATE) at the end of the SQL statement.
Thank you
Daniel
____________________________
Comvision Pty. Ltd.
www.comvision.net.au
I am trying to complete a search on a single table of a DB through the use
of a TIB_Cursor and a TIB_CursorGrid.
The TIB_Cursor SQL statement is:
SELECT *
FROM
LOGPAS
WHERE
R_CREATED_BY =:CURRENT_USER
Now, when the application user tries a default search such as "Search All" I
set the CURRENT_USER param...
if( !crsCVDBCursor->Prepared )
crsCVDBCursor->Prepare();
crsCVDBCursor->ParamByName("CURRENT_USER")->AsString = FCurrentUser;
I am also making use of:
onPrepareSQL(TIB_Statement *Sender)
{
if( !FPrivateRecords )
{
crsCVDBCursor->SQLWhereItems->Add("OR");
crsCVDBCursor->SQLWhereItems->Add("R_SHARED = 1");
}
}
The following is the SQL send to the DB, as displayed by:
IB_Monitor1MonitorOutputItem(TObject *Sender, const AnsiString NewString)
{
ShowMessage(NewString);
}
SELECT *
FROM
LOGPAS
WHERE(
(
R_CREATED_BY=?/*CURRENT-USER*/
)
AND OR
)
AND R_SHARED=1
FOR UPDATE
The question/problem is,
(1)
Why/Who is placing the (AND) immediately infront of the (OR) which I am
adding though the use of the
"...SQLWhereItems->Add.."
(2)
Why/Who is placing the (FOR UPDATE) at the end of the SQL statement.
Thank you
Daniel
____________________________
Comvision Pty. Ltd.
www.comvision.net.au