Required Property

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
robbe
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 09.11.2005, 13:08

Required Property

Post 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
niztor
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 04.11.2005, 19:05

Post 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.-
Post Reply