DBKit v2.2b1 is now available

You can find desktop and web versions in the Examples: Databases > DBKit - Current Beta.

DBKit 2.2 Beta 1 Release Notes

The DBKit SDK is now documented. Alongside this release, the documentation includes an SDK overview and a reference page for each SDK interface, covering what a custom control needs in order to work with a layout and its rows.

New

  • The Where property on layouts (Window, Page, Container) can now carry its own bound values, in the format clause;value;value: the clause contains ? placeholders, and the values follow, separated by semicolons (for example, state=?;CA). Values are passed to the database as bound parameters, never substituted into the SQL. A Where with no semicolons and no placeholders behaves exactly as before.
  • DBKit.Table has a Where property in the same clause;value;value format. It applies when the table shows rows from a different database table than its layout’s; for related rows it is ANDed with the relationship constraint. Searches against the table start from it as well.
  • DBKit.Table and the layouts (Window, Page, Container) have a parameterless Query method that re-runs the query, honoring the Where property.
  • A SQLite table with no primary key of its own now works in DBKit. Its rowid is used as the primary key for loading, editing and deleting rows. The rowid is used for row identity only; it does not become a column that can be shown in a layout or used in relationships.
  • Layouts can now receive their database in code instead of through a connection item, on desktop and on the web. Assign the database in a subclass constructor after Super.Constructor, or after construction before the layout is shown or opened; the layout then sets itself up and loads as it does with a design-time database.
  • For custom controls, DBKit.SDK.Layout has two new methods, IsValidColumnName and PrimaryKeyColumnNameForTable, so a control can ask its layout whether a column name is valid for a table and what a table’s primary key column is. DBKit.SDK.RowsListControl has the same two methods, plus RemoveLayoutAt, which a layout calls when it closes to release its association with a row of the control.

Changed

  • A search on a layout now starts from the layout’s Where and ANDs the typed conditions onto it. Previously the layout’s Where was included in a search only when the SearchField’s SearchInSelection property was True; otherwise the search ignored it. This is a behavior change for existing projects.
  • The DBKit properties of a layout now appear in a consistent order in the Inspector. Layouts created in earlier versions keep the order they already have.
  • The Rating example control now updates the current row when it is clicked, like the built-in controls, so an edited rating no longer reverts to the row’s previous value when focus moves to another control. It also uses the new layout schema methods instead of reaching through the layout’s engine.

Deprecated

  • DBKit.Table.Refresh is deprecated in favor of setting the table’s Where property and calling Query. It keeps its signature and behavior for existing code.

Removed

  • DBKit.SearchField.SearchInSelection has been removed. The property existed to opt into including the layout’s Where in a search; searches now always honor the layout’s Where, so the property controlled nothing.
  • DBKit.SDK.RowsListControl.GetSchemaInfo and its tag info accessors have been removed. They served DBKit.Table’s own implementation; custom controls should use IsValidColumnName and PrimaryKeyColumnNameForTable instead.

Bug Fixes

  • Fixed invalid SQL being generated for a table whose primary key column name was blank, which the database rejected with a syntax error. A blank column name is no longer treated as valid, and the primary key column is no longer appended to the select list when its name is blank.
  • Fixed detail controls staying empty at first open when a layout’s database was assigned in code and a DBKit.Table on the layout loaded before those controls were ready. The current row’s values are now delivered to controls that become ready after the load.
  • Fixed a NilObjectException in DBKit.PopupMenu and DBKit.RadioGroup when a layout opened before its database was assigned. The controls now stay empty until a database exists, and populate when the first row loads.
  • Fixed a NilObjectException that could occur while a web page, container or dialog was being constructed when its database was not yet available.
  • Fixed a NilObjectException when opening a layout whose table is empty and which has a toolbar. The toolbar’s Edit button and the Edit, Delete, Undo and New buttons read the current row even though an empty table has none.
  • Fixed a layout that opens on an empty table leaving its controls in the wrong states: the data controls stayed enabled and the toolbar’s New button stayed disabled, so the first row could not be created. The data controls are now disabled and cleared, and New is enabled.

Known Issues

  • Opening a layout can occasionally take about a minute before data appears. This has only been seen on layouts that include a DBKit.ImageViewer, only with MySQL and PostgreSQL databases, and only infrequently. It is still being investigated.
2 Likes