Recent

Author Topic: TIBExtract double quotes  (Read 1641 times)

RedOctober

  • Sr. Member
  • ****
  • Posts: 452
TIBExtract double quotes
« on: March 06, 2018, 07:13:18 pm »
I'm using SynEdit with SQL highlighter (Interbase 6 or Standard) on a full database extraction using TIBExtract.

At the moment, I get all the table names and fields double quoted.  I don't want that.  I only want double quotes when necessary, or, not at all.

I cannot find a setting within TIBExtract, nor TSynEdit to shut off all the double quotes.  Must I resort to using a StringReplace() to get rid of them all, or is there a setting I'm not seeing?

CREATE TABLE "BUGABOO"   // <--- bad
CREATE TABLE BUGABOO   // <--- good

Platform:  Lazarus 1.8.1, FPC 3.0.5



dsiders

  • Hero Member
  • *****
  • Posts: 1052
Re: TIBExtract double quotes
« Reply #1 on: March 06, 2018, 09:22:54 pm »
I'm using SynEdit with SQL highlighter (Interbase 6 or Standard) on a full database extraction using TIBExtract.

At the moment, I get all the table names and fields double quoted.  I don't want that.  I only want double quotes when necessary, or, not at all.

I cannot find a setting within TIBExtract, nor TSynEdit to shut off all the double quotes.  Must I resort to using a StringReplace() to get rid of them all, or is there a setting I'm not seeing?

CREATE TABLE "BUGABOO"   // <--- bad
CREATE TABLE BUGABOO   // <--- good

Platform:  Lazarus 1.8.1, FPC 3.0.5

The double quotes are coming from TIBExtract and not SynEdit, and they are hard-coded into the output for the metadata for table and column names.

I understand why; the table name could contain a reserved word (I've been guilty of this) or a name with embedded space(s) (this is pure evil lol). So TIBExtract is doing the safe thing and wrapping all of them - just in case.

But you are correct, if you're using TIBExtract to reverse engineer or backup a schema. The table name is case insensitive until it gets quoted. Then "BUGABOO", "BugABoo", and "bugaboo" are different table names and require the quotes just to make it work.

I would report this issue to the website (https://www.mwasoftware.co.uk/contact-us). I'm sure they'll take a look at it.

--
Don
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

tonyw

  • Sr. Member
  • ****
  • Posts: 319
    • MWA Software
Re: TIBExtract double quotes
« Reply #2 on: March 07, 2018, 12:58:17 am »
I'm using SynEdit with SQL highlighter (Interbase 6 or Standard) on a full database extraction using TIBExtract.

At the moment, I get all the table names and fields double quoted.  I don't want that.  I only want double quotes when necessary, or, not at all.

I cannot find a setting within TIBExtract, nor TSynEdit to shut off all the double quotes.  Must I resort to using a StringReplace() to get rid of them all, or is there a setting I'm not seeing?

CREATE TABLE "BUGABOO"   // <--- bad
CREATE TABLE BUGABOO   // <--- good

Platform:  Lazarus 1.8.1, FPC 3.0.5

I did also notice this "feature" when checking out the final release of 2.2.0 - but never did anything about it :(

It is potentially easy to fix, by doing a search and replace all on the IBExtract.pas unit replacing all calls to

"QuoteIdentifier" with "QuoteIdentifierIfNeeded"

Both functions take the same parameters and give the same result. They are also both members of IBUtils.pas and so they should be interchangeable. As the names suggest, the first always puts the identifiers in double quotes while the latter only does this if they are a reserved word, are not a valid SQL Identifier or include lower case characters.

You're the second person to ask this question today - so may be I do need to update TIBExtract.

 

TinyPortal © 2005-2018