Identify where the queries are coming from in your code, then run them in Management Studio and take it from there. Right-clicking in the query pane and selecting 'Display Estimated Execution Plan' may be of help in identifying where your problem lies.
Is it take more time than expected?
I can't tell you that - it's your database and code, so only you can know.
all the queries having Select * will replaced with only needed Column name.
That's a good idea - you should always do that anyway because it reduces network traffic, but your problem here is the time of execution, not the time of retrieval.
I have been looking for a component for Delphi 7 (enterprise edition), which will allow me to do the following:
1) Decrypt specific encrypted nodes in an XML file to a stream.
2) Validate specific nodes against specific schemas (typically this will be the decrypted nodes, which will have their contents described in a encrypted schema)
3) Parse large XML files (several hundreds MB's).
Unfortunately, I have not found any components that are capable of this.
Does anyone know of a component which will allow me to do the above?
I think you'll struggle to find a single component to do all that for you.
When it comes to de/encryption in Delphi, it's hard to beat dcpcrypt
As for your xml documents, just use the classes and interfaces available to you in the XMLDoc, XMLIntf, XMLDOM units. They give you TXMLDocument and IXMLNode, which is all you really need to load up a file and parse its nodes.
Decrypt specific encrypted nodes in an XML file to a stream.
There is no real way of getting around this, however if I am not mistaken this class allows for events to fire when reading a node/attribute.
Validate specific nodes against specific schemas (typically this will be the decrypted nodes, which will have their contents described in a encrypted schema)
I haven't needed to use this feature for the component in question, but I suppose fiddling around with that shouldn't be too much of a problem, even if you have to do your manipulation via the component, then use the XML DOM to load the schema.
Parse large XML files (several hundreds MB's).
This would probably be more a case of the machine that the application will be running on and the efficiency of the XML traversal algorithm that the component uses. However, you must remember that traversing XML documents in itself tends to take longer based on the depth of the nodes. Expect delays in the region of something like:
I have a source code for a program in a format of *.cpp ,*.dfm ,*.h
files.There is no project file,and about 60 files (20 each).
I need help to make it as a project so i can modify the source code and recompiling as i need it
I have very Little experience in programming,but i can follow instructions very carefully.
If some one can help me please send me a mail at
Hi. I think you may have a mixture of things there: *.cpp and *.h suggests you have a C++ project. *.dfm does indeed suggest Delphi form files, but without any *.pas (i.e. pascal) files, it's very unlikely that what you have is a Delphi proect.
I have no project file ,just the source code.I thing it's a C++builder project.
I was try to recover the project by building the forms and then copy all the files to the same directory using CodeGear RAD Studio 2009 Delphi & C++Builder.I can view the forms but i can't build them,i get error's.
Can someone please help me on how to compile the project??
Please mail me at
and i will send you the source code
Thank you very much
If you don't have a project file then you have no choice but to make one. I suggest dumping all the files you have into one directory, creating a new project, adding all of your various *cpp/*h files to it, electing the most likely-looking form to be the 'main' form (i.e. the one created when the program starts) and taking it from there. If you have little experience of dealing with projects then this is not going to be an easy task.
Member 3862339 wrote:
and i will send you the source code
No thanks! I have quite enough to do already, but I'm happy to give advice.
I need to develop an ActiveX library which consists of an Indy HTTP server object (TidHTTPServer). In this the server object will listen to a particular port and will log the incoming requests to a file.
I am using RAD 2010 as IDE and trying in a way as follows..
1. Created an AciveX library project, Added a new Active Form, Added the TiDHTTPServer control to this form
2. Set the DefaultPort property, Added custom methods StartListen() and WriteLog()
3. In StartListen(), just makes the 'ACTIVE' property of HTTP server object to 'TRUE' and writes some log.
4. Built it and registered the OCX
5. Now, created a new windows forms project (tester) and imported this ocx component. Then added this control from the toolbar to the form. and called the StartListen().
It is throwing Access Violation error while running this tester application. If I comment the HTTP Server dependent code by keeping only the write log code, it works and writes the log also.
Java and Delphi use very different libraries. That means, most Java framework classes don't have an ideal complement class in VCL. Some things that are classes in Java (like String) are primitive types in Delphi.
Delphi has a little built-in tool that handles internationalization. But it´s really basic.
You also got a couple of commercial localization tools that support Delphi applications: Multilizer (http://www2.multilizer.com/) and Sisulizer (http://www.sisulizer.com/), and an open-source tool based on GetText: http://dxgettext.po.dk/
You can rename the computer using windows API calls (I can't remember them offhand, but I'll see if I can dig them up somewhere). I stand to be corrected on this, but as far as I know you cannot change the serial numbers of motherboards and/or hard disk drives.
"You cannot code for stupidity"
There is no problem at all. I only asked what people think about memory usage and performance.
I made a test with
- a DataModule with a TQuery and
- a simple class that creates the TQuery on the fly
both containing the same method.
Strangley, the method ran a few milliseconds faster in the class without visual components. The DataModule with visual components worked a few milliseconds slower, though (in theory) the components involved should have been the same. That means, the way you create instances - by drag&drop or create/free - actually does matter.
when I place a TQuery component, on a form, it consumes memory until the application quits.
The amount of memory that your query will consume is directly related to the amount of data which you are retrieving from the database, and as such cannot be helped. What you could do is look at how many fields are being returned and reducing that amount to only those fields that you need.
Corinna John wrote:
When I create/free the TQuery everytime I actually need it, the construction/destruction consumes time.
I've found that creating/destroying the components dynamically isn't time consuming. What will take time is establishing the connection to the database and the subsequent retrieval of the data from the query.
Since I hardly every use data-aware controls, most of the time I dynamically load the data to the screen(s) by creating a data controller which will provide the functionality for retrieving/updating the data from the database. Ideally this controller will have some database connection object within it, and a query/command object to query the database with. These data objects should be created and destroyed in the controller's constructor/destructor respectively. Then, by using events, you can perform some kind of action on the resulting query which you executed.
So a controller would look something like this (I see you are using the TQuery component, and although I am using ADO, the theory is still basically the same):
// my uber-super user defined event :P
TOnRetrieveData = procedure (ASender : TObject; AResultData : TADOQuery) of object;
TDataController = class(object)
FOnRetrieveData : TOnRetrieveData;
FDBConnection : TADOConnection;
FADOCommand : TADOCommand;
constructor Create(AOnRetrieveDataEvent : TOnRetrieveData);
procedure ExecuteSQL(const ASQLString : string);
constructor TDataController.Create(AOnRetrieveDataEvent : TOnRetrieveData);
// Assign the event...
FOnRetrieveData := AOnRetrieveDataEvent;
// Initialise the connection and command components
FDBConnection := TADOConnection.Create(nil);
FADOCommand := TADOCommand(nil);
FADOCommand.CommandType := cmdText;
FADOCommand.Connection := FDBConnection;
// setup the connection
FDBConnection.ConnectionString := 'this should now be your connection string';
// ensure that you are not prompted for the server login prompt...
FDBConnection.LoginPrompt := False;
// now we can open the connection...
procedure TDataController.ExecuteSQL(const ASQLString : string);
LQuery : TADOQuery;
LQuery := TADOQuery.Create(nil);
FADOCommand.CommandText := ASQLString;
LQuery.RecordSet := FADOCommand.Execute;
if Assigned(FOnRetrieveData) then
while (LQuery.RecordSet <> nil) do
// This is just a bonus because you could get more than one result data set from the query...
LQuery.RecordSet := LQuery..NextRecordset;
So to use the controller you would do something like this:
// other uses stuff
TMyForm = class(TForm)
Button1 : TButton;
Memo1 : TMemo;
Memo2 : TMemo;
FController : TDataController;
procedure Perform_OnRetrieveData(ASender : TObject; AResultData : TADOQuery);
procedure MyButtonClick(ASender : TObject);
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
procedure TMyForm.Perform_OnRetrieveData(ASender : TObject; AResultData : TADOQuery);
LRows : Integer;
LIdx : Integer;
LLine : string;
LLine := '';
Memo2.Lines.Add('Start a data result output...');
while not(AResultData.EoF) do
for LIdx := 0 to AResultData.FieldCount-1 do
LLine := LLine+' '+AResultData.Fields[LIdx].Value;
Memo2.Lines.Add(' End a data result output...');
procedure TMyForm.MyButtonClick(ASender : TObject);
on E:Exception do
Memo2.Lines.Add('Exception occurred when trying to execute sql script. Reason:');
FController := TDataController.Create(Perform_OnRetrieveData);
Button1.OnClick := MyButtonClick;
DISCLAIMER: I have not tested this code, so if it contributes to global warming for some reason, I relinquish myself from any consequences it may have on the tragic collapse of the lifecycle of the common sea cucumber...
Hope that helps
"You cannot code for stupidity"
modified on Tuesday, December 14, 2010 7:55 AM
Last Visit: 25-Jan-20 19:39 Last Update: 25-Jan-20 19:39