473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Storing SQL

Unfortunately, where I work it is forbidden to use stored procedures. I know,
I know...it's pretty stupid. But I can not change that.

Anyway, currently we have our sql stored in an embedded resx file as name
value pairs. At runtime a ResourceManager class is instantiated and a key is
passed to retrieve the sql for a given key.

A group of us were discussing this problem and the performance efficiency of
using the ResourceManger since internally a HashTable is loaded up each time
you instantiate an instance of it versus perhaps creating a class with
constants and their values to use instead. <gag>

I hate the idea of the constants, it's not object oriented at all. Therefore
my question is, does anyone have any better ideas on how to store the sql
statements with performance in mind without sacraficing object oriented
design?

Just as an aside, we also are faced with the issue of dynamic where clauses.
The stored sql will need to have where clauses added to it dynamically to
allow for filtering of data. Any suggestions here? Remember, this is an
enterprise wide issue not a mom and pop shop issue.

--
-Demetri
Feb 15 '06 #1
5 2534
Just out of curiouosity, what was the reasoning for storing the sql in
a resource file? I won't comment on how ridiculous the design
is...oops...but at this point there's no reason not to use a constants
class (or if you still want initial runtime loading, a static class).

Feb 16 '06 #2
Why did I suggest using a resource file versus reading from a text file, xml
file, constants class?

1. More elegant solution as far as object oriented design goes. Contants
file is generally frowned upon in today's object oriented approaches. Gone
are the VB Global variable days.(no complaints here).
2. Sql information is embedded in binary format in the assembly therefore
the schema information about the data is not as accessable (i.e. more secure
than a text file or xml file).
3. Resources can be deployed in satallite assemblies thus if a resource
value changes then you only make the change in the resource assembly thus no
harm to your applications main assembly.

I still think storing them in the resources file is the best thing versus
File IO with text files, xml files (especially with the expense of DOM). And,
as far as constants class goes...well I just think that is VERY bad practice
that reaks with "Im a VB hold out" all over it.

But if its performance that is the issue, which it is, I wonder what the
performance gain would be if we used a god constants class versus an embedded
resource and reading it via ResourceManager?

There has to be a better way tho.

I wish we could use stored procedures, it would make life easier and is
better for performance and is just an all around better approach. However,
the powers that be aren't allowing it. <sigh>
--
-Demetri
"sd********@gmail.com" wrote:
Just out of curiouosity, what was the reasoning for storing the sql in
a resource file? I won't comment on how ridiculous the design
is...oops...but at this point there's no reason not to use a constants
class (or if you still want initial runtime loading, a static class).

Feb 16 '06 #3
I don't understand why you consider a constants class very bad practice
and/or not object oriented. These SQL Statements are constants,
correct? It makes no sense to me when people store constants in a
dynamic manner. If something is a constant, store it as such and then
you have no worry about the performance plus the bonus of compile time
checking. As far as "updates in satellite assemblies" is concerned, put
your constants class in this assembly and it's just as easily updated.
I know you're upset about not being able to use stored procedures (I
would be too) but there's no need to add a further performance hit by
storing constants in anything but a constant/static manner.

Feb 16 '06 #4
Just curious here about why you are forbidden to use stored procedures.
What is the reasoning that you were given?

"Demetri" <De*****@discussions.microsoft.com> wrote in message
news:66**********************************@microsof t.com...
Unfortunately, where I work it is forbidden to use stored procedures. I
know,
I know...it's pretty stupid. But I can not change that.

Anyway, currently we have our sql stored in an embedded resx file as name
value pairs. At runtime a ResourceManager class is instantiated and a key
is
passed to retrieve the sql for a given key.

A group of us were discussing this problem and the performance efficiency
of
using the ResourceManger since internally a HashTable is loaded up each
time
you instantiate an instance of it versus perhaps creating a class with
constants and their values to use instead. <gag>

I hate the idea of the constants, it's not object oriented at all.
Therefore
my question is, does anyone have any better ideas on how to store the sql
statements with performance in mind without sacraficing object oriented
design?

Just as an aside, we also are faced with the issue of dynamic where
clauses.
The stored sql will need to have where clauses added to it dynamically to
allow for filtering of data. Any suggestions here? Remember, this is an
enterprise wide issue not a mom and pop shop issue.

--
-Demetri

Feb 16 '06 #5
I was told that there is not enough resources on the data side to maintain
and take ownership of the stored procedures. And there is a bit of politics
involved, which is not something I personally want to get into. I'm a
straight shooter, tell it like it is, I'm not a political person. <shrugs>

But whatever keeps them warm at night. I just have to work with what I've got.

--
-Demetri
"Jeff S" wrote:
Just curious here about why you are forbidden to use stored procedures.
What is the reasoning that you were given?

"Demetri" <De*****@discussions.microsoft.com> wrote in message
news:66**********************************@microsof t.com...
Unfortunately, where I work it is forbidden to use stored procedures. I
know,
I know...it's pretty stupid. But I can not change that.

Anyway, currently we have our sql stored in an embedded resx file as name
value pairs. At runtime a ResourceManager class is instantiated and a key
is
passed to retrieve the sql for a given key.

A group of us were discussing this problem and the performance efficiency
of
using the ResourceManger since internally a HashTable is loaded up each
time
you instantiate an instance of it versus perhaps creating a class with
constants and their values to use instead. <gag>

I hate the idea of the constants, it's not object oriented at all.
Therefore
my question is, does anyone have any better ideas on how to store the sql
statements with performance in mind without sacraficing object oriented
design?

Just as an aside, we also are faced with the issue of dynamic where
clauses.
The stored sql will need to have where clauses added to it dynamically to
allow for filtering of data. Any suggestions here? Remember, this is an
enterprise wide issue not a mom and pop shop issue.

--
-Demetri


Feb 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mark | last post by:
I have a website with an increasing amount of articles and news reports and so I am thinking of moving away from storing each article as a seperate page to having a single page and storing articles...
4
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with storing cookies with ASP? I'm trying this with two browsers: One is IE 6.0 with cookies set to 'prompt'. This has been working properly as any...
6
by: Alfonso Morra | last post by:
I have written the following code, to test the concept of storing objects in a vector. I encounter two run time errors: 1). myClass gets destructed when pushed onto the vector 2). Prog throws a...
5
by: Don Vaillancourt | last post by:
I'm building a system when one can upload a document to the website. I will be storing the document on the hard-drive for quick/easy access, but I was also thinking of storing it in an existing...
6
by: bissatch | last post by:
Hi, I am currently writing a news admin system. I would like to add the ability to add images to each article. What I have always done in the past is uploaded (using a form) the image to a...
4
by: Rednelle | last post by:
Greetings all, As a newbie, using Access 2000, I would appreciate advice on the best way to include pictures. I have developed a 'Home Inventory' database which can include jpeg thumbnails of...
2
by: Robert Hanson | last post by:
I am new to the asp.net application building and I have read the information regarding the storing of information using session vs cookies vs viewstate. I am asking for suggestions/guidance as to...
2
by: jakk | last post by:
Below is the exception that Iam getting. It says that the DataView that Iam storing in the session is not Serializable. BUt works fine if I store in the inproc session and fails if I switch to...
6
by: (PeteCresswell) | last post by:
User wants to go this route instead of storing pointers in the DB and the documents outside. Only time I tried it was with only MS Word docs - and that was a loooong time ago - and it seemed to...
2
by: Mythran | last post by:
We followed an example found on MSDN to create an encrypted FormsAuthenticationTicket and storing the ticket in a cookie. Is this the "correct" way to store the authentication ticket? We are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.