The table control in SqlControl.Control has a hard wired limit of 40 columns in BB 1.6.
For serious work this is way too small. Therefore the limit is removed in this issue
and the internally used arrays for the column attributes are allocated dynamically,
which avoids any hard coded limit at all.
For the issue see http://redmine.blackboxframework.org/issues/50.
For the changes see http://redmine.blackboxframework.org/pr ... aa030749d1.
For the user there is no observable difference and no incompatibility.
- Josef
issue-#50 unlimited number of columns in SqlControls.Control
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue-#50 unlimited number of columns in SqlControls.Con
Hello Josef,
you are doing a great job.
I add your improvements about the subsystem Sql to the CPC edition RC6 built 43 (not published yet).
During my comparison I find out that one topic is missing.
See Displaying SQLite table via "Sql Table Control" inside Form
at http://community.blackboxframework.org/ ... ?f=19&t=81
The solution there there adds an if block into the procedure Restore.
Without this change the sample there produce a trap.
Sorry that I didn't write a note earlier.
you are doing a great job.
I add your improvements about the subsystem Sql to the CPC edition RC6 built 43 (not published yet).
During my comparison I find out that one topic is missing.
See Displaying SQLite table via "Sql Table Control" inside Form
at http://community.blackboxframework.org/ ... ?f=19&t=81
The solution there there adds an if block into the procedure Restore.
Code: Select all
PROCEDURE (t: Table) Restore (f: Views.Frame; l, t1, r, b: INTEGER);
VAR row, col, x, y, w: INTEGER; data: SqlDB.Row; font: Fonts.Font;
width, mode: POINTER TO ARRAY OF INTEGER;
BEGIN
IF (t.table # NIL) & t.table.Available() & (t.table.columns > 0) THEN
IF t.table.columns > t.columns THEN (* resize dynamic arrays *)
width := t.width; NEW(t.width, t.table.columns);
mode := t.mode; NEW(t.mode, t.table.columns);
IF (width # NIL) & (mode # NIL) THEN
CopyArray(width, t.width);
CopyArray(mode, t.mode)
END;
FillArray(t.width, t.columns, t.table.columns - t.columns, defColW);
FillArray(t.mode, t.columns, t.table.columns - t.columns, center);
t.columns := t.table.columns
END;
DEC(t.rowH, t.rowH MOD f.unit);
Sorry that I didn't write a note earlier.
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue-#50 unlimited number of columns in SqlControls.Con
Good point. The arrays may need to be resized in Restore because the table could have been changed
by executing a different SELECT statement.
However, resizing is the same as in FormatOps.Do. So I will refactor it a bit
instead of replicating the code.
When reading the mentioned forum discussion I found another hint to a potential problem.
Loading a table with zero columns leads to a TRAP because NEW cannot allocate an array with 0 elements.
I thought that this can never happen, but it can.
So I also have to add an "IF columns = 0 ..." in Internalize.
- Josef
by executing a different SELECT statement.
However, resizing is the same as in FormatOps.Do. So I will refactor it a bit
instead of replicating the code.
When reading the mentioned forum discussion I found another hint to a potential problem.
Loading a table with zero columns leads to a TRAP because NEW cannot allocate an array with 0 elements.
I thought that this can never happen, but it can.
So I also have to add an "IF columns = 0 ..." in Internalize.
- Josef
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue-#50 unlimited number of columns in SqlControls.Con
topic branch issue-#50 contains the fixes.
Helmut, can you please review and test them?
For the diffs see: http://redmine.blackboxframework.org/pr ... aa030749d1.
The test version can be found under http://blackboxframework.org/unstable/issue-%2350/.
Build number 177.
- Josef
Helmut, can you please review and test them?
For the diffs see: http://redmine.blackboxframework.org/pr ... aa030749d1.
The test version can be found under http://blackboxframework.org/unstable/issue-%2350/.
Build number 177.
- Josef
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue-#50 unlimited number of columns in SqlControls.Con
I have found and fixed 2 bugs in SqlControls.CheckPos.
- Josef
- Josef