Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General Discussion » View Thread |
Messages 1 to 4 of 4 total |
Query Storage Component |
Thu, Sep 5 2013 5:29 PM | Permanent Link |
Terry Swiers | Hi All,
Does anyone know of a VCL component that will allow me to store a list of stringlists on a form and be able to access them by name? Basically I want to be able to define a number of SQL queries, store them in the component each associated with a name, and be able to read them from the component at runtime. I know that I can define all of the queries in the code, but I would rather be able to just copy and paste the queries directly from EDB Manager after testing into the component and use them without worrying about double quoting any embedded quotes each time I have to tweak a query. --------------------------------------- Terry Swiers Millennium Software, Inc. http://www.1000years.com --------------------------------------- |
Thu, Sep 5 2013 5:55 PM | Permanent Link |
Michael Riley ZilchWorks | Terry Swiers - Millennium Software, Inc. wrote:
> Hi All, > > Does anyone know of a VCL component that will allow me to store a > list of stringlists on a form and be able to access them by name? > Basically I want to be able to define a number of SQL queries, store > them in the component each associated with a name, and be able to > read them from the component at runtime. I know that I can define > all of the queries in the code, but I would rather be able to just > copy and paste the queries directly from EDB Manager after testing > into the component and use them without worrying about double quoting > any embedded quotes each time I have to tweak a query. > > --------------------------------------- > Terry Swiers > Millennium Software, Inc. > http://www.1000years.com > --------------------------------------- Terry, Why not use Stored Procedures instead queries? -- Michael Riley GySgt USMC (Ret) www.zilchworks.com |
Thu, Sep 5 2013 6:35 PM | Permanent Link |
Terry Swiers | Hi Michael,
> Why not use Stored Procedures instead queries? These are all part of a custom add on for a customer, so the queries are specific to this custom utility rather than the application or the database. Using queries prevents me from having to check to make sure that the stored procedures are part of the database structure or not, and I don't have to worry about keeping them in sync if the requirements change. --------------------------------------- Terry Swiers Millennium Software, Inc. http://www.1000years.com --------------------------------------- |
Fri, Sep 6 2013 5:24 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Terry
Have a look on Torry. I downloaded one many years ago (say around D4) it was essentially just a stringlist of stringlists. If you had to develop it yourself it would only take a couple of hours. I do something similar but only store one query in each instance of the component. My reason is to allow me to alter the query before running it say have the tablename set as $TN$ and set to the one I actually want each time. The code is below Roy Lambert [Team Elevate] unit nlhMisc; {$D-} interface uses Windows, Messages, SysUtils, Classes, DBCtrls; type TnlhStringBank = class(TComponent) private FItems: TStringList; function GetString(Index: integer): string; procedure SetString(Index: integer; const Value: string); procedure SetItems(Value: TStringList); function GetCount: integer; function GetAsText: string; procedure SetAsText(const Value: string); public property Strings[Index: Integer]: string read GetString write SetString; default; property AsText: string read GetAsText write SetAsText; constructor Create(AOwner: TComponent); override; destructor Destroy; override; published property Items: TStringList read FItems write SetItems; property Count: integer read GetCount; end; implementation constructor TnlhStringBank.Create(AOwner: TComponent); begin inherited; FItems := TStringList.Create; end; destructor TnlhStringBank.Destroy; begin FItems.Free; inherited; end; function TnlhStringBank.GetString(Index: integer): string; begin Result := FItems[Index]; end; procedure TnlhStringBank.SetString(Index: integer; const Value: string); begin FItems[Index] := Value; end; procedure TnlhStringBank.SetAsText(const Value: string); begin FItems.Text := Value; end; procedure TnlhStringBank.SetItems(Value: TStringList); begin FItems.Assign(Value); end; function TnlhStringBank.GetAsText: string; begin Result := FItems.Text; end; function TnlhStringBank.GetCount: integer; begin Result := FItems.Count; end; end. |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |