Page 1 of 1

Required Property

Posted: 13.12.2005, 14:52
by robbe
In The latest Release from 13.10.2005 Zeos test the notNull property of an Field.

Problem
In my Table was the Defaultvalue of any Fields set by the Default Value from the Postgresql Fieldproperty or by an Sequence.

Zeos handle an Exception if there is no Value in any of this Fields. The Fieldvalue is Set by the Database.

Why is that so ?
Can I disable this way ?


Thanks
Jörg Nissen

Posted: 04.01.2006, 01:02
by niztor
I had the same problem on fields with default values.
Zeos does not permit a field to be 'nullable' if it's defined as not null.
So i did a nasty patch in ZDbcPostgresSqlMetadata, to allow fields with
default values (and not null defined) be nullables.

ZDbcPostgreSQLMetadata.pas

function TZPostgreSQLDatabaseMetadata.GetColumns(Catalog: string;
SchemaPattern: string; TableNamePattern: string;
ColumnNamePattern: string): IZResultSet;

scope

Code: Select all

        Result.UpdateNull(8);
        if GetBooleanByName('attnotnull') then 
        begin
          Result.UpdateString(18, 'NO');
          Result.UpdateInt(11, Ord(ntNoNulls)); 
        end
        else  
        begin
          Result.UpdateString(18, 'YES');
          Result.UpdateInt(11, Ord(ntNullable));
        end;
change:

Code: Select all

        if GetBooleanByName('attnotnull') and (GetStringByName('adsrc') = '') 
then
        begin
sorry my english.


Niztor.-