Subject RE: [IBO] Escape characters break generated SQL
Author Jason Wharton
Looks like a definite bug. If text is escaped then whatever is referencing
that text should process it to remove the escaping. Should be an easy fix.
I added more characters to be escaped and its bringing to light areas where
escaping is being done that I am reading data without de-escaping things.
Likely that's due to the assumption that any character valid for an
identifier used to not be escaped. I either need to remove escaping for
characters valid to include in identifiers or fix the inconsistencies.

It would accelerate things for me if you sent me a sample app with the
problem.

Jason

> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
> Behalf Of mspencewasunavailable
> Sent: Tuesday, December 12, 2006 2:09 PM
> To: IBObjects@yahoogroups.com
> Subject: [IBO] Escape characters break generated SQL
>
>
> Between beta 7 and beta 11, you evidently introduced some sort of
> character escaping which is interfering with things that were ok in
> beta 7:
>
> var
> tblInvoice : TIBOTable;
>
> refers to a table that is defined like this:
>
> CREATE TABLE "ARINV"(
> "Acc ID" INTEGER NOT NULL,
> "Invoice #" VARCHAR(25) NOT NULL,
> "Date" DATE NOT NULL,
> "Sub Total" NUMERIC(12,2),
> "Tax" NUMERIC(12,2),
> "Freight" NUMERIC(12,2),
> "Total" NUMERIC(12,2),
> "Due Date" DATE,
> (..and so forth, fields clipped for brevity)
>
> With a primary key:
>
> ALTER TABLE "ARINV"
> ADD CONSTRAINT "PK_ARINV"
> PRIMARY KEY ("Acc ID","Invoice #","Date");
>
> When I do this:
>
> tblInvoice.FindNearest([ID, nil, nil]);
>
> The table used to get positioned to the first invoice for that
> account, but now I get an SQL error:
>
> ISC ERROR CODE:335544569
>
> ISC ERROR MESSAGE:
> Dynamic SQL Error
> SQL error code = -206
> Column unknown
> Invoice \#
> At line 6, column 73
>
> STATEMENT:
> TIB_LocateCursor: "<TDBCustomer>.<TIBOTable>.<TIBOInternalDataset>.<T
> IB_LocateCursor>." stHandle=88 (ERROR)
>
>
> STATEMENT:
> TIBOInternalDataset: "<TDBCustomer>.
>
> SQL ERROR CODE:-206
>
> SQL ERROR MESSAGE:
> Column does not belong to referenced table
>
> SELECT ARINV."Acc ID", ARINV."Invoice #", ARINV."Date"
> FROM ARINV
> WHERE (
> ARINV."Acc ID" = ? /* ID */
> )
> AND ((("Acc ID" > ? /* LOC_0 */ ) OR (("Acc ID" = ? /* LOC_0 */ )
> AND (("Invoice \#" > ? /* LOC_1 */ ) OR (("Invoice \#" = ? /* LOC_1
> */ ) AND (("Date" >= ? /* LOC_2 */ )))))))
> ORDER BY "Acc ID" ASC
> , "Invoice \#" ASC
> , "Date" ASC
>
>
> The field named "Invoice #" is now "Invoice \#" in the generated
> SQL. If I plug in values for all of the params, then FlameRobin
> gives the same error. If I remove the backslashes as well, the
> query works.
>
> Michael D. Spence
> Mockingbird Data Systems, Inc.