Subject Re: [IBO] Invalid Insert Statement: No columns
Author mspencewasunavailable
--- In IBObjects@yahoogroups.com, "Jason Wharton" <supportlist@...>
wrote:
>
> There is a global variable in TIB_Session.pas as follows:
>
> {: This global variable serves as a flag to tell if you want to
make sure
> and
> check for reserved tokens automatically. Leaving this to false
improves
> performance. If you use reserved tokens and manually put quotes
around them
> it should still be fine to leave this set to false.}
> CheckForReservedTokens: boolean = false;
>
>
> The reason this is an issue is because of how identifiers are
stored and
> returned in the SQLVAR structures. I am not told if it is quoted
or not,
> I'm just told what it actually is. Therefore, IBO has to figure
out whether
> quotes are appropriate given the content of the identifier name.
Reserved
> words pose a challenge in this.
>
> Jason

Similar code works fine in similar situations elsewhere in the app.
I think it's more than just reserved words. In addition to the
reserved word "Date", DESCRIPTION won't match "Description" nor
CODE, "Code".

I guess what I'm really asking is if it's true that the stuff in the
log is actually what is being used to send to Firebird? In other
words, if the log text is separately generated and the field name
quoting is broken at that point, that's a shame, but no big deal and
the problem I'm having may be due to something else in my code. If,
on the other hand, the field name that's in the log text is actually
what Firebird sees, that's a problem.

I found by stepping into the IBObjects code that the fields in the
internal dataset have no data at all. I'll see if I can figure out
just why this particular piece of code is different from the many
similar ones in other parts of the application.

Michael D. Spence
Mockingbird Data Systems, Inc.



>
> > -----Original Message-----
> > From: IBObjects@yahoogroups.com
[mailto:IBObjects@yahoogroups.com]On
> > Behalf Of mspencewasunavailable
> > Sent: Tuesday, December 12, 2006 9:49 AM
> > To: IBObjects@yahoogroups.com
> > Subject: [IBO] Invalid Insert Statement: No columns
> >
> >
> > Using IBObjects 4.7 beta 11, I'm trying to insert rows into a
> > TIBOTable. The table is set into append mode and the new
record's
> > fields are updated using statements like this:
> >
> > with tblEditInv do
> > begin
> > FieldByName('Date').AsDateTime :=
> > t.FieldByName('Date').AsDateTime;
> > FieldByName('Code').AsInteger :=
> > t.FieldByName('Code').AsInteger;
> > FieldByName('Serv ID').AsInteger :=
> > t.FieldByName('Serv ID').AsInteger;
> > FieldByName('Description').AsString :=
> > t.FieldByName('Description').AsString;
> >
> > (and so forth)
> >
> >
> > where t is another table with fields I want to present using
> > tblEditInv. When tblEditInv.Post is called I get the error
> > message "Invalid Insert Statement: No Columns".
> >
> > When I searched the archives, the only conversation I could find
> > about this was one that suggested that field name quoting might
be
> > an issue. I'm saddled with a database with many, many field
names
> > that need quoting, and there does seem to be something awry.
> >
> > Here's my table definition:
> >
> > CREATE TABLE "EDITINV"(
> > "Date" DATE,
> > "Code" SMALLINT,
> > "Serv ID" INTEGER,
> > "Description" VARCHAR(45),
> > "Qty" NUMERIC(12,2),
> > "Amount" NUMERIC(14,4),
> > "Base Price" NUMERIC(12,2),
> > "Tax Code" SMALLINT,
> > "Tax" NUMERIC(12,2),
> > "Extended" NUMERIC(12,2),
> > "Crew" SMALLINT,
> > "Zone" SMALLINT,
> > "Route" SMALLINT,
> > "Cost" NUMERIC(12,2),
> > "Scheduled" VARCHAR(1),
> > "Qty Used" NUMERIC(12,2),
> > "Man Hours" NUMERIC(12,2),
> > "Old Date" DATE,
> > "Old Code" SMALLINT,
> > "Old Serv ID" INTEGER,
> > "Old Qty" NUMERIC(12,2),
> > "Old Amount" NUMERIC(14,4),
> > "Old Base Price" NUMERIC(12,2),
> > "Old Tax Code" SMALLINT,
> > "Old Tax" NUMERIC(12,2),
> > "Old Qty Used" NUMERIC(12,2),
> > "Old Man Hours" NUMERIC(12,2),
> > "INSTANCE_ID" INTEGER NOT NULL,
> > "SESSION_ID" INTEGER NOT NULL);
> >
> > ALTER TABLE "EDITINV" ADD CONSTRAINT "PK_EDITINV" PRIMARY KEY
> > (SESSION_ID, INSTANCE_ID);
> >
> >
> >
> > Here's an excerpt from the log when the table goes active:
> >
> > SELECT ALL EDITINV.*
> > FROM EDITINV
> > WHERE SESSION_ID = 6
> > ORDER BY EDITINV.SESSION_ID ASC
> > , EDITINV.INSTANCE_ID
ASC
> >
> > PLAN (EDITINV ORDER PK_EDITINV
> > INDEX (PK_EDITINV))
> >
> > FIELDS = [ Version 1 SQLd 29
SQLn
> > 64
> > EDITINV.DATE = <NIL>
> > EDITINV.CODE = <NIL>
> > EDITINV."Serv ID" = <NIL>
> > EDITINV.DESCRIPTION = <NIL>
> > EDITINV.QTY = <NIL>
> > EDITINV.AMOUNT = <NIL>
> > EDITINV."Base Price" = <NIL>
> > EDITINV."Tax Code" = <NIL>
> > EDITINV.TAX = <NIL>
> > EDITINV.EXTENDED = <NIL>
> > EDITINV.CREW = <NIL>
> > EDITINV.ZONE = <NIL>
> > EDITINV.ROUTE = <NIL>
> > EDITINV.COST = <NIL>
> > EDITINV.SCHEDULED = <NIL>
> > EDITINV."Qty Used" = <NIL>
> > EDITINV."Man Hours" = <NIL>
> > EDITINV."Old Date" = <NIL>
> > EDITINV."Old Code" = <NIL>
> > EDITINV."Old Serv ID" = <NIL>
> > EDITINV."Old Qty" = <NIL>
> > EDITINV."Old Amount" = <NIL>
> > EDITINV."Old Base Price" =
<NIL>
> > EDITINV."Old Tax Code" =
<NIL>
> > EDITINV."Old Tax" = <NIL>
> > EDITINV."Old Qty Used" =
<NIL>
> > EDITINV."Old Man Hours" =
<NIL>
> > EDITINV.INSTANCE_ID = <NIL>
> > EDITINV.SESSION_ID = <NIL> ]
> >
> > I don't know if this is sigificant, but fields such
> > as "Date", "Qty", "Description" and other one-token names are all
> > shown in the log as upper case, whereas fields like "Qty Used" is
> > properly quoted.
> >
> > Does this ring any bells with anyone?
> >
> > Michael D. Spence
> > Mockingbird Data Systems, Inc.
>