Subject | Re: [firebird-support] What programming languages and toolkits do you use to access Firebird? |
---|---|
Author | Daniel Albuschat |
Post date | 2008-10-02T10:16:43Z |
2008/10/1 Fulvio Senore <mailing@...>:
one to select the primary key(s) and one to select the data.
The library then sets as many parameters as primary keys have been
selected to the data-statement and executes it. It's quite easy to use
and was easy to implement, because parsing SQL is nothing you
should really try to do.
s.rdb$field_name
from
rdb$relations r
left join
rdb$relation_constraints c
on
c.rdb$relation_name=r.rdb$relation_name and
c.rdb$constraint_type='PRIMARY KEY'
left join
rdb$index_segments s
on
s.rdb$index_name=c.rdb$index_name
where
r.rdb$relation_name=YOUR TABLE NAME
order by
s.rdb$field_position
Regards,
Daniel Albuschat
--
eat(this); // delicious suicide
> Daniel Albuschat ha scritto:Well, I made my life easy here. You provide two distinct statements,
>
>> There's an important thing to know
>> here: I'm fetching
>> only the primary keys from a result set to know how many rows there
>> are and which
>> primary key the row at the temporary "index" in my table has.
> This is very interesting, since I thought that it would have been a
> difficult task.
> If your rows come from a join a single primary key is not enough: to
> identify a row you need the primary key of all the table used in the join.
> So it looks like your software needs to parse the SQL statement and to
> automatically identify all the needed primary keys. At a second time,
> when you need to retrieve the full row, you need to recreate if from the
> primary keys.
one to select the primary key(s) and one to select the data.
The library then sets as many parameters as primary keys have been
selected to the data-statement and executes it. It's quite easy to use
and was easy to implement, because parsing SQL is nothing you
should really try to do.
> I am not a Firebird expert, and I have written my own data access layerselect
> on top of IBPP to satisfy my needs. It works well enough, but when I
> create an editable rowset from a single table I pass the name of the
> primary key as a parameter because I had no idea of hot to determine it
> automatically.
> It is not a big problem, but it would be nice to have the software
> determine the primary key. Do know hot it can be done?
s.rdb$field_name
from
rdb$relations r
left join
rdb$relation_constraints c
on
c.rdb$relation_name=r.rdb$relation_name and
c.rdb$constraint_type='PRIMARY KEY'
left join
rdb$index_segments s
on
s.rdb$index_name=c.rdb$index_name
where
r.rdb$relation_name=YOUR TABLE NAME
order by
s.rdb$field_position
Regards,
Daniel Albuschat
--
eat(this); // delicious suicide