[yunqa.de] Re: QutedStr function problem

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Fri, 07 Mar 2008 21:21:14 +0100

Radovan Antloga wrote:

>I was not aware of this until today when I had problem in program (customer 
>call me). I was expecting single quote as function SysUtils.QuotedStr works.
>In same unit I have changed uses units and added DISQLite3Api unit. Now all
>QuotedStr was double quoted strings (not expected).

As I see it now I must agree that the duplicate QuotedStr function name is a 
little unfortunate. I am sorry that it has caused you trouble.

>I think this is not good practice to have same function names. I know I can 
>prefix all functions with unit but I must be very careful not to miss someone 
>and I have to change (fix) current code.

You do not have to prefix all unqualified function names. Instead, you can 
change the order of units listed in the units clause. Delphi always chooses the 
function from the unit which appears last in the uses list.

This order will use DISQLite3Api.QuotedStr for unspecified QuotedStr:

  uses
    SysUtils, DISQLite3Api;

And this will use SysUtils.QuotedStr:

  uses
    DISQLite3Api, SysUtils;
  
>I would suggest to change it to QuotedStr8 as it is Sql8 and SQL16. Then it 
>would be QuotedStr8, QuotedStr16. I think this would not break some code but 
>would not conflict with already written code.

I am reluctant to change the function name because doing so would break 
backward compatability: Quotation mark escapes would change to apostrophe 
escapes whereever the SysUtils follows DISQLite3Api on the uses list. Also, 
there have not been any problem reports about the function name until now.

Any thoughts, anybody?

Ralf 

_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: