> Just want to add that accessing a blank string's elements will also cause
> EAccessViolation, as in the code:
> 
> s: string;
> begin
>   s := '';
>   s[1]; // EAccessViolation

> This is because the 32-bit strings are handles as pointers to data and a
> blank string is a Nil poiunter.

Yes for those interested in differences with Delphi and Java this is a difference
that shows up ORACLEs non ANSI compliance. Char(n) fields are stored as
null so that

CREATE TABLE TEST ( ID NUMBER, NAME CHAR(30) );
INSERT INTO TEST (ID,NAME) VALUES (1,'');
SELECT ID,NAME FROM TEST WHERE NAME IS NOT NULL;

Returns no rows whereas it should under SQL92 compliance return (1,'')

Delphi has the same situation where testing for assignment by testing against
nil for Strings is not valid.  Since Java uses a String object this problem does
not arise...

Note that ORACLE warns that testing a string against null when you mean '' is
not necessarily going to continue as ORACLE would like to correct this non-
compliance as they then can better provide a mapping to Java inside the database.

Do MS-SQL, Interbase, Postgress, etc suffer the same limitation.

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to