RAD Studio VCL Reference
|
Locates the parameters in an SQL statement and replaces them with question marks.
function ParseSQL(SQL: string; DoCreate: Boolean): string;
__fastcall AnsiString ParseSQL(AnsiString SQL, Boolean DoCreate);
Call ParseSQL to replace all the parameters in the SQL statement passed as SQL with question marks (?). ParseSQL recognizes parameters by a preceding colon (:). Double colons (::) or colons contained in quoted strings are parsed as literals, and the immediately following name is not replaced with a question mark. The converted SQL statement is returned.
If the DoCreate parameter is true, all parameters in the Items property are replaced with a set of TParam objects whose names are the same as the strings removed from the SQL statement.
For example, given the SQL string
SELECT * FROM EMPLOYEES
WHERE (ID = :EMP_ID) AND (NAME = :EMP_NAME)
ParseSQL returns the string
SELECT *
FROM EMPLOYEES
WHERE (ID = ?) AND (NAME = ?)
and, if DoCreate is true, the Items property contains two TParam objects with the names EMP_ID and EMP_NAME.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|