Subject Re: [IBO] Params
Author Jason Wharton
> As I stepped through the code, I noticed that active becomes false when I
> clear the SQL list. Is that as it should be?

Yes, in fact it becomes not only closed but unprepared. As a result, you
only want to do this sparingly. It doesn't make any sense to tweak the SQL
directly and then use an input parameter. You set your SQL once, prepare it
and then leave it alone while you close it, plug in a parameter, and open
it repeatedly.

> Heres what Im trying to do.. BTW, "ANI" is simply and acronym for "Caller
> ID" or "Automatic Number Identification"
>
>
> This is the default query that is coded into the app.
> " SELECT * FROM ANIS WHERE CUSTID = :CUSTID ORDER BY ANI "
> It has a relation set to datasource customer via "CUSTID" This works
fine..
>
> Then when a new "ANI" record is to be added,
> I disable the Datasource and dataaware source.
>
> I try to validate it by...
>
> ANISDB.SQL.CLEAR;
> ANISDB.SQL.ADD('SELECT * FROM ANI WHERE ANI = :ANI');
> anisdb.ParamByName('ANI').asstring := aniedit.text;
> ANISDB.OPEN;
>
> I never get past this point..
>
> Then I intend to look to see if EOF, if its not found, then I create a new
> record etc. No problem here.
> Then when the entire operation is done.. I go back to my original query
and
> reset my relationship to the parent table, sources etc.

You are better off dong the extra stuff in a dedicated query and then
refreshing the original ones.

> The big issue is how the heck to I pass data parms to my SQL statement? It
> looks pretty painless, but Im obviously missing something..
> I either get and exception that says that I can't operate on a closed
> dataset or that the parameter doesnt exist.
> BTW, checkParams is set to true..

What are you doing when the can't operate on a closed dataset error happens?

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Gordon Hamm" <vds@...>
To: <IBObjects@yahoogroups.com>
Sent: Wednesday, July 18, 2001 7:52 PM
Subject: Re: [IBO] Params


>
> Gordon Hamm
>
> ----- Original Message -----
> From: "Jason Wharton" <jwharton@...>
> To: <IBObjects@yahoogroups.com>
> Sent: Wednesday, July 18, 2001 8:29 PM
> Subject: Re: [IBO] Params
>
>
> > The code you put here looks perfectly reasonable.
> > There is for sure something else going on here.
> > You haven't tinkered with the CheckParams property have you?
> > Make sure it is true for this type of usage.
> >
> > Jason Wharton
> > CPS - Mesa AZ
> > http://www.ibobjects.com
> >
> >
> > ----- Original Message -----
> > From: "Gordon Hamm" <vds@...>
> > To: <IBObjects@yahoogroups.com>
> > Sent: Wednesday, July 18, 2001 7:07 PM
> > Subject: Re: [IBO] Params
> >
> >
> > > Ok, that helps alot.. Im still having trouble with params.. Its like
> they
> > > arent there at all..I keep putting them in, they keep dispearing.
> > > I didnt understand Jasons comment about Params only being available
> after
> > a
> > > post, or something like that..
> > > Im just trying to do a simple..
> > >
> > > ANISDB.SQL.CLEAR;
> > > ANISDB.SQL.ADD('SELECT * FROM ANI WHERE ANI = :ANI');
> > > anisdb.ParamByName('ANI').asstring := aniedit.text;
> > > ANISDB.OPEN;
> > >
> > > It always says the parameter doesnt exist. I am able to make a literal
> > > string, and my queries work fine. You guys prob think Im a real dope,
> but
> > > honest , Im reading everything I can get my hands on including Jasons
> > > primer.
> > >
> > > Gordon Hamm
> > >
> > >
> > > ----- Original Message -----
> > > From: "Geoff Worboys" <geoff@...>
> > > To: <IBObjects@yahoogroups.com>
> > > Sent: Wednesday, July 18, 2001 7:12 PM
> > > Subject: Re: [IBO] Params
> > >
> > >
> > > > > If I use the RequestLive, Everything seems to work fine. I was
> > > > > under the impression that you shouldnt use RequestLive to be
> > > > > true client server compliant, so Ive been trying to write the
> > > > > app to work with RequestLive:=False. Maybe this is part of my
> > > > > trouble? I just noticed that the contact manager demo has
> > > > > RequestLive set to true..
> > > >
> > > > If you were using the API directly you would be correct. The "FOR
> > > > UPDATE" clause of the SQL is not normally good for performance.
> > > > However IBO takes care of this for you. If you use the "FOR UPDATE"
> > > > clause in your SQL it automatically sets RequestLive=true (or you
can
> > > > forget the FOR UPDATE clause and just just RequestLive=true
directly).
> > > >
> > > > The point being that when RequestLive is true, IBO will normally
take
> > > > care of the details for you. It removes the "FOR UPDATE" clause
from
> > > > the SQL it sends to the server to ensure good performance and then
> > > > creates the additional SQL required to insert/update/delete as
though
> > > > you had a live update cursor.
> > > >
> > > > If you have a complicated query (using joins or stored procedures)
it
> > > > may be necessary to create your own insert/update/delete SQL to make
> > > > the dataset truly "live". But much of the time you can avoid such
> > > > complications by splitting your query into multiple datasets with
> > > > appropriate master/detail configuration.
> > > >
> > > > HTH
> > > >
> > > > Geoff Worboys
> > > > Telesis Computing
> > > >
> > > >
> > > >
> > > >
> > > > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> > >
> > >
> >
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>