Subject | RE: [firebird-support] Re: Interbase to Firebird conversion, Delphi |
---|---|
Author | Svein Erling Tysvær |
Post date | 2008-11-03T12:25:49Z |
I have never used ibx components and have no clue about your problem, but a shot in the dark could be to change to:
select
kd.kaart_detail_id,
cf.displayname_a,
cf.displayname_e,
cf.displayfield,
cf.tablename,
cf.lookuptable,
cf.lookupfield,
kd.card_caption,
cf.card_group,
cf.idfield,
cf.idvalue
from
cardfields cf
join kaart_detail kd on cf.cardfields_id = kd.cardlookup_id
join karate k on kd.kaarte_id = k.kaarte_id
where k.kaarte_id = :kaarte_id
order by kd.kaart_detail_id
The difference between the above select and what you have used, is changing from SQL-89 implicit join to SQL-92, using aliases rather than table names, and adding alias to the ORDER BY clause (in trying to prevent ambiguous SQL statements, I think one version of Firebird may have gone a bit too far and prevented some SQL that weren't ambiguous - still, I find this better than InterBase which (at least IB 6.0) tries to guess rather than give an error message).
Noticing that you've just answered Helen, my guess is that your error doesn't come from this query at all, but from whatever query you run where you specify SKAAP.FAMILIE_ID as one of the columns to select. Your error message specifically says 'column unknown' so it is not a 'value' that creates this error - it is complaining that FAMILIE_ID is not a column in SKAAP or that you have a query where you refer to SKAAP. FAMILIE_ID without actually including SKAAP in your select(e.g. SELECT SKAAP.FAMILIE_ID FROM CARDFIELDS)
HTH,
Set
-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of ulrickebester
Sent: 3. november 2008 12:56
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: Interbase to Firebird conversion, Delphi
--- In firebird-support@yahoogroups.com, "ulrickebester"
<umeinhof@...> wrote:
select
KAART_DETAIL.KAART_DETAIL_ID,
cardfields.displayname_a,
cardfields.displayname_e,
cardfields.displayfield,
cardfields.tablename,
cardfields.lookuptable,
cardfields.lookupfield,
KAART_DETAIL.CARD_CAPTION,
cardfields.card_group,
cardfields.idfield,
cardfields.idvalue
FROM
cardfields,KAART_DETAIL,KAARTE
WHERE
((cardfields.cardfields_id = KAART_DETAIL.CARDLOOKUP_ID)
AND
(KAART_DETAIL.KAARTE_ID = KAARTE.KAARTE_ID)
AND
(KAARTE.KAARTE_ID = :KAARTE_ID))
ORDER BY KAART_DETAIL_ID
table cardfields
CREATE TABLE CARDFIELDS (
CARDFIELDS_ID INTEGER NOT NULL,
DISPLAYNAME_E VARCHAR(50) CHARACTER SET NONE,
DISPLAYNAME_A VARCHAR(50) CHARACTER SET NONE,
DISPLAYFIELD VARCHAR(50) CHARACTER SET NONE,
TABLENAME VARCHAR(50) CHARACTER SET NONE,
LOOKUPTABLE VARCHAR(50) CHARACTER SET NONE,
LOOKUPFIELD VARCHAR(50) CHARACTER SET NONE,
IDFIELD VARCHAR(50) CHARACTER SET NONE,
IDVALUE VARCHAR(50) CHARACTER SET NONE,
CARD_GROUP VARCHAR(50) CHARACTER SET NONE,
FIELDTYPE CHAR(1) CHARACTER SET NONE
);
Kaart Detail:
CREATE TABLE KAART_DETAIL (
KAART_DETAIL_ID INTEGER NOT NULL,
KAARTE_ID INTEGER NOT NULL,
CARDLOOKUP_ID INTEGER NOT NULL,
CARD_CAPTION VARCHAR(50) CHARACTER SET NONE
);
Kaarte:
CREATE TABLE KAARTE (
KAARTE_ID INTEGER NOT NULL,
NAAM VARCHAR(20) CHARACTER SET NONE
);
in which the fields are stored where to extract the data from
and I use
GetValueList(QGetCard.FieldByName
('TABLENAME').AsString,QGetCard.FieldByName
('DISPLAYFIELD').AsString,QGetCard.FieldByName
('LOOKUPTABLE').AsString,QGetCard.FieldByName
('LOOKUPFIELD').AsString,QGetCard.FieldByName
('IDFIELD').AsString,QGetCard.FieldByName
('IDVALUE').AsString,QGetCard.FieldByName
('DISPLAYNAME_E').AsString,grid,col,Filter,bCreateFilter);
to get the data
When I run the sql directly in the sql editor it works fine..
select
kd.kaart_detail_id,
cf.displayname_a,
cf.displayname_e,
cf.displayfield,
cf.tablename,
cf.lookuptable,
cf.lookupfield,
kd.card_caption,
cf.card_group,
cf.idfield,
cf.idvalue
from
cardfields cf
join kaart_detail kd on cf.cardfields_id = kd.cardlookup_id
join karate k on kd.kaarte_id = k.kaarte_id
where k.kaarte_id = :kaarte_id
order by kd.kaart_detail_id
The difference between the above select and what you have used, is changing from SQL-89 implicit join to SQL-92, using aliases rather than table names, and adding alias to the ORDER BY clause (in trying to prevent ambiguous SQL statements, I think one version of Firebird may have gone a bit too far and prevented some SQL that weren't ambiguous - still, I find this better than InterBase which (at least IB 6.0) tries to guess rather than give an error message).
Noticing that you've just answered Helen, my guess is that your error doesn't come from this query at all, but from whatever query you run where you specify SKAAP.FAMILIE_ID as one of the columns to select. Your error message specifically says 'column unknown' so it is not a 'value' that creates this error - it is complaining that FAMILIE_ID is not a column in SKAAP or that you have a query where you refer to SKAAP. FAMILIE_ID without actually including SKAAP in your select(e.g. SELECT SKAAP.FAMILIE_ID FROM CARDFIELDS)
HTH,
Set
-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of ulrickebester
Sent: 3. november 2008 12:56
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: Interbase to Firebird conversion, Delphi
--- In firebird-support@yahoogroups.com, "ulrickebester"
<umeinhof@...> wrote:
>is
> --- In firebird-support@yahoogroups.com, Helen Borrie <helebor@>
> wrote:
> >
> > At 07:51 PM 3/11/2008, you wrote:
> > >If anyone has done any Interbase to Firebird conversions, here
> aInterbase.
> > >question for you..please help!
> > >
> > >I converted from Interbase 6 to Firebird Embedded
> > >I kept the original ibx components and everything seemed to work
> fine
> > >until I got
> > >
> > >Dynamic SQL Error
> > >
> > >SQL error code = -206
> > >
> > >Column unknown
> > >
> > >SKAAP.FAMILIE_ID
> > >
> > >At line 1, column 86.
> > >
> > >I get this on a number of queries and it worked fine on
> > >The fields are in the table, I checked the queries too. Theweird
> > >thing is that some fields are found and others not. All in themix
> same
> > >table! No quotes were used.
> >
> > The most likely thing is that your problem queries are using a
> of table identifiers and relation aliases to qualify the columnnames
> (or some qualified and some not). From Fb 2-forward, this isthe
> invalid. Use either all table identifiers or all aliases and don't
> omit any.
> >
> > ./heLen
> >
>
> Thanx heLen!
> I checked quickly, but there aren't any aliases. Could I provide
> code that I'm using, maybe you see something I don't?qgetcards:
>:
select
KAART_DETAIL.KAART_DETAIL_ID,
cardfields.displayname_a,
cardfields.displayname_e,
cardfields.displayfield,
cardfields.tablename,
cardfields.lookuptable,
cardfields.lookupfield,
KAART_DETAIL.CARD_CAPTION,
cardfields.card_group,
cardfields.idfield,
cardfields.idvalue
FROM
cardfields,KAART_DETAIL,KAARTE
WHERE
((cardfields.cardfields_id = KAART_DETAIL.CARDLOOKUP_ID)
AND
(KAART_DETAIL.KAARTE_ID = KAARTE.KAARTE_ID)
AND
(KAARTE.KAARTE_ID = :KAARTE_ID))
ORDER BY KAART_DETAIL_ID
table cardfields
CREATE TABLE CARDFIELDS (
CARDFIELDS_ID INTEGER NOT NULL,
DISPLAYNAME_E VARCHAR(50) CHARACTER SET NONE,
DISPLAYNAME_A VARCHAR(50) CHARACTER SET NONE,
DISPLAYFIELD VARCHAR(50) CHARACTER SET NONE,
TABLENAME VARCHAR(50) CHARACTER SET NONE,
LOOKUPTABLE VARCHAR(50) CHARACTER SET NONE,
LOOKUPFIELD VARCHAR(50) CHARACTER SET NONE,
IDFIELD VARCHAR(50) CHARACTER SET NONE,
IDVALUE VARCHAR(50) CHARACTER SET NONE,
CARD_GROUP VARCHAR(50) CHARACTER SET NONE,
FIELDTYPE CHAR(1) CHARACTER SET NONE
);
Kaart Detail:
CREATE TABLE KAART_DETAIL (
KAART_DETAIL_ID INTEGER NOT NULL,
KAARTE_ID INTEGER NOT NULL,
CARDLOOKUP_ID INTEGER NOT NULL,
CARD_CAPTION VARCHAR(50) CHARACTER SET NONE
);
Kaarte:
CREATE TABLE KAARTE (
KAARTE_ID INTEGER NOT NULL,
NAAM VARCHAR(20) CHARACTER SET NONE
);
in which the fields are stored where to extract the data from
and I use
GetValueList(QGetCard.FieldByName
('TABLENAME').AsString,QGetCard.FieldByName
('DISPLAYFIELD').AsString,QGetCard.FieldByName
('LOOKUPTABLE').AsString,QGetCard.FieldByName
('LOOKUPFIELD').AsString,QGetCard.FieldByName
('IDFIELD').AsString,QGetCard.FieldByName
('IDVALUE').AsString,QGetCard.FieldByName
('DISPLAYNAME_E').AsString,grid,col,Filter,bCreateFilter);
to get the data
When I run the sql directly in the sql editor it works fine..