Subject | two ParamEdit & SQL search |
---|---|
Author | Gediminas |
Post date | 2003-11-05T15:56:32Z |
Sending again this, as there wasn't luck to handle it. What's is wrong
using ParamEdits (used to provide params to SQL query) with several SQL params?
The Truth Is Out There
using ParamEdits (used to provide params to SQL query) with several SQL params?
>Here monitor's log ( "Vardas" means Name and "Pavarde" means Surname in my--/ Gediminas /--
>language) with some notes:
>
>/*---
>CONNECT DATABASE localhost:e:\sokiudb.gdb
>DB_HANDLE = 15282840
>
>SECONDS = 0,335
>----*/
>/*---
>DATABASE INFO
>DB_HANDLE = 15282840
>----*/
>/*---
>START TRANSACTION
>DB HANDLE COUNT 1
>TR_HANDLE = 15282404
>----*/
>/*---
>PREPARE STATEMENT
>TR_HANDLE = 15282404
>STMT_HANDLE = 15282740
>
>select s."Sokejo_ID" , s."Vardas" , s."Pavarde"
>from SOKEJAI s
>where
>s."Vardas" starting with ? /* Vardas */
>and
>s."Pavarde" starting with ? /* Pavarde */
>;
>
>PLAN (S INDEX (IDX_SOKEJAI1,IDX_SOKEJAI))
>
>FIELDS = [ Version 1 SQLd 3 SQLn 30
> SOKEJAI.SOKEJO_ID = <NIL>
> SOKEJAI.VARDAS = <NIL>
> SOKEJAI.PAVARDE = <NIL> ]
>
>SECONDS = 0,056
>----*/
>/*---
>START TRANSACTION
>DB HANDLE COUNT 1
>TR_HANDLE = 15282092
>----*/
>/*---
>PREPARE STATEMENT
>TR_HANDLE = 15282092
>STMT_HANDLE = 15282188
>
>SELECT RDB$PROCEDURE_NAME
>FROM RDB$PROCEDURES
>ORDER BY RDB$PROCEDURE_NAME ASC
>
>PLAN (RDB$PROCEDURES ORDER RDB$INDEX_21)
>
>FIELDS = [ Version 1 SQLd 1 SQLn 30
> RDB$PROCEDURES.RDB$PROCEDURE_NAME = <NIL> ]
>
>SECONDS = 0,015
>----*/
>/*---
>EXECUTE STATEMENT
>TR_HANDLE = 15282092
>STMT_HANDLE = 15282188
>PARAMS = [ ]
>----*/
>/*---
>COMMIT
>TR_HANDLE = 15282092
>----*/
>/*---
>START TRANSACTION
>DB HANDLE COUNT 1
>TR_HANDLE = 15271540
>
>SECONDS = 0,010
>----*/
>/*---
>PREPARE STATEMENT
>TR_HANDLE = 15271540
>STMT_HANDLE = 15282188
>
>SELECT RDB$RELATION_NAME, RDB$FIELD_NAME, RDB$FIELD_SOURCE
>FROM RDB$RELATION_FIELDS R
>WHERE ( RDB$SYSTEM_FLAG <> 1 OR RDB$SYSTEM_FLAG IS NULL )
> AND NOT RDB$RELATION_NAME STARTING 'RDB$'
> AND NOT RDB$FIELD_NAME STARTING 'RDB$'
> AND NOT RDB$FIELD_SOURCE STARTING 'RDB$'
>ORDER BY 1 ASC
> , 2 ASC
>
>PLAN SORT ((R NATURAL))
>
>FIELDS = [ Version 1 SQLd 3 SQLn 30
> RDB$RELATION_FIELDS.RDB$RELATION_NAME = <NIL>
> RDB$RELATION_FIELDS.RDB$FIELD_NAME = <NIL>
> RDB$RELATION_FIELDS.RDB$FIELD_SOURCE = <NIL> ]
>
>SECONDS = 0,020
>----*/
>/*---
>EXECUTE STATEMENT
>TR_HANDLE = 15271540
>STMT_HANDLE = 15282188
>PARAMS = [ ]
>
>SECONDS = 0,013
>----*/
>/*---
>COMMIT
>TR_HANDLE = 15271540
>----*/
>/*---
>EXECUTE STATEMENT
>TR_HANDLE = 15282404
>STMT_HANDLE = 15282740
>PARAMS = [ Version 1 SQLd 2 SQLn 2
> [VARDAS] = ''
> [PAVARDE] = <n> '' ]
>
>/// Initial params - why VARDAS is '' and PAVARDE - NULL? in the form
>settings for these ParamEdit are the same. Jason, is it IBObject bug?
>could you clarify this issue?
>
>SECONDS = 0,010
>----*/
>/*---
>START TRANSACTION
>DB HANDLE COUNT 1
>TR_HANDLE = 15281648
>
>SECONDS = 0,013
>----*/
>/*---
>PREPARE STATEMENT
>TR_HANDLE = 15281648
>STMT_HANDLE = 15282188
>
>SELECT R.RDB$FIELD_NAME
> , R.RDB$RELATION_NAME
>FROM RDB$RELATION_FIELDS R, RDB$FIELDS F
>WHERE R.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME
> AND F.RDB$COMPUTED_SOURCE IS NOT NULL
> AND NOT R.RDB$RELATION_NAME STARTING WITH 'RDB$'
>ORDER BY 1 ASC
>
>PLAN SORT (JOIN (F NATURAL,R INDEX (RDB$INDEX_3)))
>
>FIELDS = [ Version 1 SQLd 2 SQLn 30
> RDB$RELATION_FIELDS.RDB$FIELD_NAME = <NIL>
> RDB$RELATION_FIELDS.RDB$RELATION_NAME = <NIL> ]
>
>SECONDS = 0,117
>----*/
>/*---
>EXECUTE STATEMENT
>TR_HANDLE = 15281648
>STMT_HANDLE = 15282188
>PARAMS = [ ]
>----*/
>/*---
>COMMIT
>TR_HANDLE = 15281648
>----*/
>/*---
>EXECUTE STATEMENT
>TR_HANDLE = 15282404
>STMT_HANDLE = 15282740
>PARAMS = [ Version 1 SQLd 2 SQLn 2
> [VARDAS] = 'I'
> [PAVARDE] = <n> '' ]
>
>/// In Vardas ParamEdit was entered "I" - gives an empty dataset due to
>PAVARDE - NULL
>
>----*/
>/*---
>FETCH
>STMT_HANDLE = 15282740
>FIELDS = [ Version 1 SQLd 3 SQLn 3
> SOKEJAI.SOKEJO_ID = 0
> SOKEJAI.VARDAS = ''
> SOKEJAI.PAVARDE = '' ]
>
>ERRCODE = 100
>
>/// Some kind of error - don't understand, what is the cause
>
>----*/
>/*---
>EXECUTE STATEMENT
>TR_HANDLE = 15282404
>STMT_HANDLE = 15282740
>PARAMS = [ Version 1 SQLd 2 SQLn 2
> [VARDAS] = 'I'
> [PAVARDE] = 'K' ]
>
>/// Found matching record - right
>
>----*/
>/*---
>FETCH
>STMT_HANDLE = 15282740
>FIELDS = [ Version 1 SQLd 3 SQLn 3
> SOKEJAI.SOKEJO_ID = 4
> SOKEJAI.VARDAS = 'Indrë'
> SOKEJAI.PAVARDE = 'Kazlauskaitë' ]
>----*/
>/*---
>FETCH
>STMT_HANDLE = 15282740
>FIELDS = [ Version 1 SQLd 3 SQLn 3
> SOKEJAI.SOKEJO_ID = 4
> SOKEJAI.VARDAS = 'Indrë'
> SOKEJAI.PAVARDE = 'Kazlauskaitë' ]
>
>ERRCODE = 100
>
>/// Again strange error code ....
>
>----*/
>/*---
>EXECUTE STATEMENT
>TR_HANDLE = 15282404
>STMT_HANDLE = 15282740
>PARAMS = [ Version 1 SQLd 2 SQLn 2
> [VARDAS] = 'I'
> [PAVARDE] = '' ]
>
>/// An empty string for the surname (pavarde), but IB_Grid shows an empty
>dataset. Actually, there are 2 records in the table with the name starting
>with "I"
>
>----*/
>/*---
>FETCH
>STMT_HANDLE = 15282740
>FIELDS = [ Version 1 SQLd 3 SQLn 3
> SOKEJAI.SOKEJO_ID = 4
> SOKEJAI.VARDAS = 'Indrë'
> SOKEJAI.PAVARDE = 'Kazlauskaitë' ]
>
>ERRCODE = 100
>
>/// again error code
>
>----*/
>/*---
>EXECUTE STATEMENT
>TR_HANDLE = 15282404
>STMT_HANDLE = 15282740
>PARAMS = [ Version 1 SQLd 2 SQLn 2
> [VARDAS] = ''
> [PAVARDE] = '' ]
>
>/// Should get all records from the table - however ib_grid shows an empty
>dataset
>
>----*/
>/*---
>FETCH
>STMT_HANDLE = 15282740
>FIELDS = [ Version 1 SQLd 3 SQLn 3
> SOKEJAI.SOKEJO_ID = 4
> SOKEJAI.VARDAS = 'Indrë'
> SOKEJAI.PAVARDE = 'Kazlauskaitë' ]
>
>ERRCODE = 100
>
>----*/
>/*---
>EXECUTE STATEMENT
>TR_HANDLE = 15282404
>STMT_HANDLE = 15282740
>PARAMS = [ Version 1 SQLd 2 SQLn 2
> [VARDAS] = ''
> [PAVARDE] = 'K' ]
>
>/// An empty dataset - should be 7 rows as there are such number records
>where surname (pavarde) starts with the "K"
>----*/
>/*---
>FETCH
>STMT_HANDLE = 15282740
>FIELDS = [ Version 1 SQLd 3 SQLn 3
> SOKEJAI.SOKEJO_ID = 4
> SOKEJAI.VARDAS = 'Indrë'
> SOKEJAI.PAVARDE = 'Kazlauskaitë' ]
>
>ERRCODE = 100
>
>Why this mystery happens?
The Truth Is Out There