Board index » cppbuilder » writing own query-component
writing own query-component
2003-07-03 03:24:25 PM
I have 2 questions concerning writing a query-component:
I would like to write my own Query, for using SQLite into Builder.
My component should be able to work with TParams as a TQuery. I am
able to do this, and internally, the SQL statement is changed like
in this example (this is the same way as TQuery works I think):
the statement entered in the SQL property:
select * from table where column1 = :column1 and column2 = :column2
internally this is changed like this
select * from table where column1 = ? and column2 = ?
Now is my question: before executing, the question marks should be
replaced off course. But in case of an integer, this should be replaced
by the number converted to a string, and in case of a string, this shoud be
replaced by the string between quotes. So depending on the datatype,
a different 'translation' should happen.
Is there allready code provided for doing so, or do I need to write this
code completely myself? . In both cases, if somebody could help me a bit, I
would by very gratefull.
I just found out that if the datatype of a parameter is for example an
Integer, and then you execute following code:
Query->ParamByName("theparam")->AsString = 12345;
then the DataType is changed from Integer to String. If you will execute
the query, will the parameter be replaced by 12345 or by '12345'?