Bug in generic resolver

Code patches written by our users to solve certain "problems" that were not solved, yet.

Moderators: gto, cipto_kh, EgonHugeist, mdaems

Post Reply
scheurer
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 23.02.2007, 12:52

Bug in generic resolver

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
scheurer
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 23.02.2007, 12:52

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