Solved

Can MIDAS strcture support dynamically generated SQL

Posted on 1998-10-16
7
248 Views
Last Modified: 2010-04-06
I would like to use MIDAS structure, but our query SQL is generated at runtime, and I can't find whether client/provider can support that.

Could any one tell me? If it cannot support, who can give me some suggestion on how to do that using Multi-tier structure?
0
Comment
Question by:dwwang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1343183
The TQuery object lets you use any run-time generated SQL statement supported by the database you are connected to. You just construct a string containing the SQL statement and add it to the SQL property (a string list).
0
 
LVL 4

Author Comment

by:dwwang
ID: 1343184
Sorry, I'm talking about using MIDAS architecture, for which one can only use TClientDataset/TProvider, and the SQL statements can only be staored in the query at server-side, which is not controlled by client programm. What I want to do is to using dynamic generated SQL in the client programme.
0
 
LVL 1

Accepted Solution

by:
ghjm earned 100 total points
ID: 1343185
Well, I haven't actually tried it, but I'd try something like this (as a method of your remote datamodule on the server side):

function CreateNewQuery(const SQL: string): TProvider;

var
  qry: TQuery;

begin
  qry := TQuery.Create(Application);
  qry.DatabaseName := 'mydb';
  qry.SQL.Add(SQL);
  result := qry.Provider;
end;

Export this in your type library, then call it and assign the result to the Data property of a ClientDataSet. Ought to work. You might have to hack a bit. And I'm not sure how you would handle the problem of disposing the query objects once you were finished with them. But it's a start, anyway.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Author Comment

by:dwwang
ID: 1343186
Sorry, but where should I put and how can I call this function? At server side, how can I call it from client side? At client side, is there any use since the provider is also at client side ?
0
 
LVL 1

Expert Comment

by:ghjm
ID: 1343187
You would implement this function as a method of the data module on the server side. Then, on the client side, you would do something like:

ClientDataSet1.Data := DCOMConnection1.AppServer.NewQuery('select * from mytable');
0
 
LVL 4

Author Comment

by:dwwang
ID: 1343188
Thanks, I don't know D4 already had such kind of capability, I will have a try ASAP, and of course accept the answer after that.
0
 

Expert Comment

by:karthi_v
ID: 2866505
Hi Dwwang,

to pass the sql statment from client side you can use TClientDataset.DataRequest(sql statement) method. The parameter is an OLE Varient. so you can pass the SQL stament (type string).

with regards,
Karthi
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi inherited method 6 88
CheckListBox usage 3 97
Delphi: making a BW image transparent 10 137
Delphi android app hide keyboard 3 82
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question