Modified SQL-Query validation and execution.
Guess I'll have to return to end-user modified sql's theme once more.
Here is what I was intended to do:
User can enter params in the manually-edited SQL in the following way
(select * from users where id = :MyParam), where :MyParam is a parameter
that is later on is going to be replaced with some actual value. But after
user presses OK, I receive the following error: "Invalid SQL statement.
Field 'MyParam' is of unknown type". So I have 2 problems:
1. How to switch off SQL query validation (or at least to be able to do it
myself)
2. Where can I change SQL (so that parameters would be replaced with actual
values) and pass it for inner use (Template.OnLoadEnd is no good, since I
need to see changes in SQL in other tabs immediately) so that the original
one remained unchanged? For example: In the query: "select * from users
where id = :MyParam" after OK button is pressed in the DADE SQL window, I
want to replace :MyParam with value "5" and pass "select * from users where
id = 5" query for execution. For that I need to switch-off SQL validation
and pass changed SQL for execution.
Can you help me with this one?
Thanks,
MB
Here is what I was intended to do:
User can enter params in the manually-edited SQL in the following way
(select * from users where id = :MyParam), where :MyParam is a parameter
that is later on is going to be replaced with some actual value. But after
user presses OK, I receive the following error: "Invalid SQL statement.
Field 'MyParam' is of unknown type". So I have 2 problems:
1. How to switch off SQL query validation (or at least to be able to do it
myself)
2. Where can I change SQL (so that parameters would be replaced with actual
values) and pass it for inner use (Template.OnLoadEnd is no good, since I
need to see changes in SQL in other tabs immediately) so that the original
one remained unchanged? For example: In the query: "select * from users
where id = :MyParam" after OK button is pressed in the DADE SQL window, I
want to replace :MyParam with value "5" and pass "select * from users where
id = 5" query for execution. For that I need to switch-off SQL validation
and pass changed SQL for execution.
Can you help me with this one?
Thanks,
MB
This discussion has been closed.
Comments
templates where you control how to get the data. I would suggest at this
point to create custom dataview templates. You can link them at runtime
using the same theory of ordering the data and linking the pipelines similar
to what is shown in this example, which you are already aware of:
http://www.digital-metaphors.com/tips/LinkEditSQLDataviews.zip
There is an example of creating custom dataview templates in the End User
demos directory of our installation.
2. You can change this in your custom dataview template by creating an event
that you can hook into by extracting the dataviews from the TdaDatamodule
shown in the first part of this example:
http://www.digital-metaphors.com/tips/ExtractSQLObject.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com