Subject | Re: [IBO] two ParamEdit & SQL search |
---|---|
Author | Gediminas |
Post date | 2003-11-06T17:02:04Z |
Helen, I ain't familiar with the internal DB work & sometimes there are
difficulties to understand some things.
On the form I have placed TIB_Query qrySQL (SQL query: select
"Sokejo_ID" , "Vardas" , "Pavarde" from SOKEJAI where "Vardas" starting
with :Vardas and "Pavarde" starting with :Pavarde; RefreshOnParamChange -
true ), 2 TIB_ParamEdit - VardasPE & PavardePE, which are linked to :Vardas
& :Pavarde params
On execution, qrySQL->Prepare(), then qrySQL->Open(). All left work is done
by the IBO. Now, if Vardas='I' & Pavarde='K', there is one record selected;
if Vardas='I' & Pavarde='' (empty, but not null), there is an empty
dataset, however if I manually set Vardas='I' & Pavarde='' in sql query,
there are several selected records (including one when were Vardas='I' &
Pavarde='K'). Why is there difference?
One more point:
if I first enter char in VardasPE (not touching PavardePE), then such
params were used:
PARAMS = [ Version 1 SQLd 2 SQLn 2
[VARDAS] = 'I'
[PAVARDE] = <n> '' ]
if I first enter char in PavardePE (not touching VardasPE):
PARAMS = [ Version 1 SQLd 2 SQLn 2
[VARDAS] = ''
[PAVARDE] = 'K' ]
Difference is, that in first case [PAVARDE] = <n> '', in the second -
[VARDAS] = ''
I think, that in both cases params must have the same initial value or I
don't understand the meaning of <n> ''
Hope, that there would be an answer in the group :)
At 2003-11-05 23:21, you wrote:
The Truth Is Out There
difficulties to understand some things.
On the form I have placed TIB_Query qrySQL (SQL query: select
"Sokejo_ID" , "Vardas" , "Pavarde" from SOKEJAI where "Vardas" starting
with :Vardas and "Pavarde" starting with :Pavarde; RefreshOnParamChange -
true ), 2 TIB_ParamEdit - VardasPE & PavardePE, which are linked to :Vardas
& :Pavarde params
On execution, qrySQL->Prepare(), then qrySQL->Open(). All left work is done
by the IBO. Now, if Vardas='I' & Pavarde='K', there is one record selected;
if Vardas='I' & Pavarde='' (empty, but not null), there is an empty
dataset, however if I manually set Vardas='I' & Pavarde='' in sql query,
there are several selected records (including one when were Vardas='I' &
Pavarde='K'). Why is there difference?
One more point:
if I first enter char in VardasPE (not touching PavardePE), then such
params were used:
PARAMS = [ Version 1 SQLd 2 SQLn 2
[VARDAS] = 'I'
[PAVARDE] = <n> '' ]
if I first enter char in PavardePE (not touching VardasPE):
PARAMS = [ Version 1 SQLd 2 SQLn 2
[VARDAS] = ''
[PAVARDE] = 'K' ]
Difference is, that in first case [PAVARDE] = <n> '', in the second -
[VARDAS] = ''
I think, that in both cases params must have the same initial value or I
don't understand the meaning of <n> ''
Hope, that there would be an answer in the group :)
At 2003-11-05 23:21, you wrote:
>Don't expect parameters to work with an unprepared statement. The sequence--/ Gediminas /--
>should be
>
>connect to database
>....
>....
>start transaction
>prepare statement
>while prepared, iterate:
> apply parameters
> execute statement
>
>In the prepare phase, null parameters are passed. This is what you are
>seeing (eventually, after all the noise). Prepare is actually a "null
>query": it validates the statement and passes the metadata image back to
>the transaction. You shouldn't force the query to be prepared every time
>it is executed.
>
>Start things up in the right order, you will get this happening:
>
>connect to database
> start transaction (IBO does this)
> query and cache metadata (IBO does this)
> commit transaction (IBO does this)
><ready>
>
>If you want to start with a searching interface, don't call Open on your
>datasets.
The Truth Is Out There