Page 1 of 1

Bug in generic resolver

Posted: 08.02.2010, 14:53
by scheurer
Zeosdbo with access and ado has problem with autoinc fields (Flagged as
not readonly and writeable).

After patching unit ZDbcResultSetMetadata

.....
function TZAbstractResultSetMetadata.IsReadOnly(Column: Integer): Boolean;
begin
if not Loaded then LoadColumns;
Result := TZColumnInfo(FResultSet.ColumnsInfo[Column - 1]).ReadOnly
//### 08.02.2010 Scheurer autoinc fields are readonly !!!
or TZColumnInfo(FResultSet.ColumnsInfo[Column - 1]).AutoIncrement;
end;

{**
Indicates whether it is possible for a write on the designated column to succeed.
@param column the first column is 1, the second is 2, ...
@return <code>true</code> if so; <code>false</code> otherwise
}
function TZAbstractResultSetMetadata.IsWritable(Column: Integer): Boolean;
begin
if not Loaded then LoadColumns;
Result := TZColumnInfo(FResultSet.ColumnsInfo[Column - 1]).Writable and
//### 08.02.2010 Scheurer readonly and aututoinc fields are not writeable!!!
not TZColumnInfo(FResultSet.ColumnsInfo[Column - 1]).ReadOnly and
not TZColumnInfo(FResultSet.ColumnsInfo[Column - 1]).AutoIncrement
end;
...

everything worked fine.

K.Scheurer

Posted: 09.02.2010, 00:02
by mdaems
Hi,

I can't accept this patch as the behaviour you describe is not universal, so it should only be added in the ADO dbc classes. Ik now this is more difficult, but I'm afraid it's the only good solution.

Just a simple example : in mysql autoinc fields are really writable.

Mark

Posted: 10.02.2010, 13:02
by scheurer
I accept that my patch is a little simple minded. But adding the patch
to ado only does not solve the complete problem. Writing to autoinc fields is messy in a multiuser environment (unique identifier of a table record).
I think it is better to add a confiuration flag like "writeableautoinc" to
control if autoincfields allowed to be writeable.

K.Scheurer