Comparing the Three Approaches
In this section, we briefly compare the three approaches for database
programming and discuss the advantages and disadvantages of each approach.
Embedded SQL Approach. The main advantage of this approach is that the query text is part of the program source code itself, and hence
can be checked for syntax errors and validated against the database schema at
com-pile time. This also makes the program quite readable, as the queries are
readily visible in the source code. The main disadvantages are the loss of
flexibility in changing the query at runtime, and the fact that all changes to
queries must go through the whole recompilation process. In addition, because
the queries are known beforehand, the choice of program variables to hold the
query results is a simple task, and so the programming of the application is
generally easier. However, for complex applications where queries have to be
generated at runtime, the function call approach will be more suitable.
Library of Function Calls Approach. This
approach provides more flexibility in that queries can be generated at runtime
if needed. However, this leads to more complex programming, as program
variables that match the columns in the query result may not be known in
advance. Because queries are passed as statement strings within the function
calls, no checking can be done at compile time. All syntax checking and query
validation has to be done at runtime, and the programmer must check and account
for possible additional runtime errors within the program code.
Database Programming Language Approach. This approach does not suffer from the impedance mismatch problem, as
the programming language data types are the same as the database data types.
However, programmers must learn a new programming language rather than use a
language they are already familiar with. In addition, some database programming
languages are vendor-specific, whereas general-purpose programming languages
can easily work with systems from multiple vendors.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.