Skip to content

0.2

Pre-release
Pre-release
Compare
Choose a tag to compare
@Screenfeed Screenfeed released this 04 Aug 14:11
07b3f9b

Main changes:

  • DBUtilities:

    • Improved methods a bit, like wrapping table names into quotes in the queries.
    • New methods: delete_table(), reinit_table(), empty_table(), clone_table(), copy_table(), count_table_rows(), and sanitize_table_name(). This is inspired by what BerlinDB does.
  • New class Table: this class basically combines TableDefinitionInterface and DBUtilities, to be easier to work with.

  • CRUD classes:

    • Renamed get_table() into get_table_definition() to prevent confusion between the classes Table and the interface TableDefinitionInterface.
    • AbstractCRUD: the property table_definition is now private. Use get_table_definition() in sub-classes instead.
  • AbstractTableDefinition:

    • get_table_name() now uses DBUtilities::sanitize_table_name().
    • New method jsonSerialize() (from the interface JsonSerializable): returns an array containing the method results. The array keys are table_version, table_short_name, table_name, table_is_global, primary_key, column_placeholders, column_defaults, and table_schema. json_encode() can be used directly on the class instance now.
    • New magic method __toString(): this will simply json_encode() the class.
  • TableUpgrader:

    • Signature change: a Table object must be used as first argument instead of TableDefinitionInterface.
    • New methods table_is_allowed_to_upgrade() and delete_table().
    • The table version is not deleted from the DB anymore if the table upgrade failed.