Re: Opinions on approach, please...
- From: Robert <no@xxxxxx>
- Date: Mon, 26 May 2008 21:55:25 -0500
On Tue, 27 May 2008 11:45:57 +1200, "Pete Dashwood" <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
"Robert" <no@xxxxxx> wrote in message
news:5nvl34pdmegh0jld4fnl3t0e80phj5k5an@xxxxxxxxxx
On Tue, 27 May 2008 01:47:26 +1200, "Pete Dashwood"
<dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
I can detect which key field is being used, I can detect the relation, I
can
get the data for the condition, and I can probably handle up to 3
connected
conditions, but I still don't havea clear idea of how I'll get this into
MOST... :-)
Write the where clause manually, one time.
Do you mean in the Application?
In the data layer. Create a data layer program per table, containing all the SQL for that
table.
I REALLY don't want to do that. As stated elsewhere, I don't want ANY SQL in
the applications at all. All I want to see there is an invocation of the
MOST interface, with the original COBOL ISAM access commented out above it.
It is important for future language migration to create a data access layer
that is not embedded in COBOL.
When I suggested writing data layers in C#, you said they HAD to be in Cobol.
Obviously, I can't write specific accesses into MOST manually.
I worked at one place that had all the SQL in the database. Every operation requaired two,
one to get the SQL and a second to execute it. It was a horrible solution. That's what you
will wind up with if you refuse to write SQL in data layer code.
The real problem is how to process the data from the interface, regarding
the relation in the "condition" clause of the START statement, inside MOST.
START is the easiest case. It is almost always 'key not less than :variable'. Singleton
selects have more variation.
The where clause on UPDATEs is simple if you get in the habit of always fetching a ROWID.
It's faster too. Same for IN followed by a subselect.
I can certainly do it with dynamic SQL and MOST can build a WHERE statement
from the data in the interface, then add that to the cursor statement and
EXECUTE it. It will incur a performance hit, but I don't know how critical
that is likely to be.
Very few databases store a compiled version of embedded SQL. In most cases, it is
dynamically PREPAREd on the first execution. If you don't believe me, look in the
executable, where you'll find the original SQL as a literal with its host variables
tokenized.
Some precompilers have an option to prepare SQL at compilation time, just to check column
names. Oracle calls the option 'semantics'. If you don't use that, you first learn about
invalid SQL at execution time. Obviously, it cannot be done for dynamically created SQL
and requires access to a test database at compilation time.
Have you ever tried putting host variables into dynamic SQL? If not, do it once to see
what's involved before you go down that road. It's a pain and it is error-prone.
It really depends how much of their current
application is doing lengthy sequential processing, how often, in what
sequences, etc. I know they use READ NEXT quite a lot for building drop down
lists for their PowerCOBOL GUI, but these are typically fairly small
accesses incurred only when a form is loaded and driven from that event.
Aren't most GUI controls 'bound' to a data source? In other words, load their own data.
The other alternative is to have the process that scans the application code
for replacement with MOST invocations, statically build the WHERE clause and
insert it into the application, but I don't want to do that as it violates
my goal of having no SQL in the application. (Besides, I'd then need to put
consequent FETCHes on the cursor into the application as well, and that gets
ugly very quickly... :-))
Trying to make the conversion 100% automated is a mistake. Convert the ISAM IO to data
layer SQL, then manually tailor where clauses. Conversion is a ONE TIME process. It
doesn't have to be done every time you compile a program.
When I fnally get to solve this (it should be by the end of this week), I'll
post the code here and let the pundits pick it over... :-)
It will be too late to change by then.
.
- Follow-Ups:
- Re: Opinions on approach, please...
- From: Pete Dashwood
- Re: Opinions on approach, please...
- References:
- Opinions on approach, please...
- From: Pete Dashwood
- Re: Opinions on approach, please...
- From: Robert
- Re: Opinions on approach, please...
- From: Pete Dashwood
- Re: Opinions on approach, please...
- From: Robert
- Re: Opinions on approach, please...
- From: Pete Dashwood
- Re: Opinions on approach, please...
- From: Robert
- Re: Opinions on approach, please...
- From: Pete Dashwood
- Opinions on approach, please...
- Prev by Date: Re: Opinions on approach, please...
- Next by Date: Re: Opinions on approach, please...
- Previous by thread: Re: Opinions on approach, please...
- Next by thread: Re: Opinions on approach, please...
- Index(es):
Relevant Pages
|
|