SqlDrivers.Table, new method ReadLong
Posted: Tue Nov 17, 2015 1:42 pm
I would like to propose the addition of a new method ReadLong to the type SqlDrivers.Table.
It is necessary to being able to read an integer database column of size 64 bits.
I do not need it nowadays, but maybe in the future, and I think it is ok for the sake of completeness of the Sql subsystem.
Caution:
The new method ReadLong will invalidate the modules SqlOdbc, SqlOdbc3 and SqlObxDriv, which must now implement that new method.
Sugested changes:
Module SqlDrivers
Module SqlDB
----------
As an additional benefit of the new method ReadLong, the second problem mentioned in http://community.blackboxframework.org/ ... ?f=16&t=97 is solved:
Manuel
It is necessary to being able to read an integer database column of size 64 bits.
I do not need it nowadays, but maybe in the future, and I think it is ok for the sake of completeness of the Sql subsystem.
Caution:
The new method ReadLong will invalidate the modules SqlOdbc, SqlOdbc3 and SqlObxDriv, which must now implement that new method.
Sugested changes:
Module SqlDrivers
Code: Select all
PROCEDURE (t: Table) ReadLong* (row, column: INTEGER; OUT val: LONGINT), NEW, ABSTRACT;
Code: Select all
PROCEDURE ReadItem (item: Meta.Item; t: StdTable; row: INTEGER; VAR col: INTEGER);
VAR ... long: LONGINT; ...
...
CASE item.typ OF
...
| Meta.longTyp:
tab.ReadLong(row, col, long);
item.PutLongVal(long); INC(col)
...
END ReadItem;
PROCEDURE ClearItem (item: Meta.Item);
...
CASE item.typ OF
...
| Meta.longTyp:
item.PutLongVal(0)
...
END ClearItem;
As an additional benefit of the new method ReadLong, the second problem mentioned in http://community.blackboxframework.org/ ... ?f=16&t=97 is solved:
Regards,Reading all rows via While loop:
r := 0; table.Read(r, rec);
WHILE table.res # SqlDB.noData DO
...
INC(r); table.Read(r, rec);
END
But if destination record rec has a field of type Dialog.Currency, the last call to table.Read(r, rec) is made with r >= table.rows, and will return SqlDB.noData, but before, all fields of the record rec are cleared, but Dialog.Currency has a subfield of type LONGINT that NOW is well expected in procedure SqlDB.ClearItem.
Manuel