SQL Stored Procedures as Front End?

  • Thread starter Thread starter WWGD
  • Start date Start date
  • Tags Tags
    sql
AI Thread Summary
Using SQL stored procedures as a front end can be feasible, allowing for easier querying tailored to specific application needs. Stored procedures offer several advantages, including improved performance due to server-side compilation, enhanced security against SQL injection, encapsulation of business logic, and code reuse. However, their implementation can be cumbersome for simple queries, as application code is needed to call them and manage parameters.In contrast, Object Relational Mapping (ORM) is often preferred for its ability to simplify database interactions, particularly for CRUD operations. ORMs automatically generate parameterized queries, leading to rapid application development, less code, and better maintainability while adhering to the N-Tier architecture. Despite some drawbacks, such as potentially lower performance and increased overhead, ORMs are generally favored in modern development environments. Stored procedures may still be used for specific scenarios, such as handling large data sets, legacy systems, or complex queries. Ultimately, the choice between stored procedures and ORM depends on the specific context and requirements of the application.
WWGD
Science Advisor
Homework Helper
Messages
7,700
Reaction score
12,730
Hi,
Just curious: is it possible/feasible to use SQL stored procedures as a front end? I mean, couldn't we
design stored procedures to allow for easier querying if we knew the general type of queries that would be used for the application (of course, the application for which we designed the back-end SQL) ?
 
Technology news on Phys.org
I believe that you can do that but it's been a while since I've done it. I'll have to dig around for an example if you want one.
 
  • Like
Likes WWGD
Borg said:
I believe that you can do that but it's been a while since I've done it. I'll have to dig around for an example if you want one.
Thanks^5000 (for previous) Borg. How does this compare to an Access front end in general?
 
  • Like
Likes Borg
WWGD said:
Thanks^5000 (for previous) Borg. How does this compare to an Access front end in general?
I don't know about Access. I remember seeing a trick like this in an Oracle database about four years ago. If I remember correctly, it's an Oracle View.
 
  • Like
Likes WWGD
You can use stored procedures - I've used them a lot, to talk in my own experience, as they have four crucial benefits: performance - the compilation is done on database server, so subsequent requests have performance gain, security - stored procedures are database objects, so you can take security measures and prevent some nasty things to happen, like SQL injection attacks, encapsulation - talking essentially about business logic in one place and of course last but not least, code reuse. However, stored procedures design and implementation is waste of time if simple queries is the case. That's because code must be written in the application to call the stored procedure, pass the parameters it should, check the result and return data.
A more preferred way is Object Relational Mapping, as ORM essentially creates a representation of the data model. So effectively you can access your database without SQL code or constructs. Especially for CRUD operations that represent a very high percentage of total operations to be executed, ORMs create parameterized queries automatically.
In general, ORMs have more benefits in many cases than stored procedures, like rapid app development, less code to be written, good maintainability, performance and they don't break the N-Tier model - something that stored procedures do.
Of course there are counter - arguments for them too, as lower performance than stored procedures, much overhead, less security and others, which in most cases are of minimum impact.
In my opinion the situation at hand is the best judge about what to use and how. In my experience, after ORM became widespread, I tend to use it more and use stored procedures for more "special" reasons. Such reasons include: big number of records pushed in a single statement, legacy applications (that you can't but use them), some complex query situations and data aggregation.
 
  • Like
Likes WWGD
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Thread 'Project Documentation'
Trying to package up a small bank account manager project that I have been tempering on for a while. One that is certainly worth something to me. Although I have created methods to whip up quick documents with all fields and properties. I would like something better to reference in order to express the mechanical functions. It is unclear to me about any standardized format for code documentation that exists. I have tried object orientated diagrams with shapes to try and express the...
Back
Top