MysqlSqlUtil Module

# MysqlSqlUtil Module Introduction

The MysqlSqlUtil module provides a high level API for working with MySQL database objects.

Usually this module is loaded on demand from the SqlUtil module, however to use this module directly, use `"%requires MysqlSqlUtil"` in your code.

All the public symbols in the module are defined in the MysqlSqlUtil namespace

Note
  This module requires the mysql binary module for communication with MySQL databases

# Schema Management on MySQL

## Type Mapping

Column types are mapped from Qore types as follows:

MySQL Column Type Mappings

Generic Type Name | MySQL Type Used
`float` | `double`
`number` | `decimal`
`string` | `varchar`
`date` | `datetime`
`binary` | `varbinary`
`bool` | `tinyint`
SqlUtil::BLOB | `mediumblob`
SqlUtil::CHAR | `char`
SqlUtil::CLOB | `mediumtext`
SqlUtil::NUMERIC | `decimal`
SqlUtil::VARCHAR | `varchar`

To use other types, use the `"native_type"` column description option with the native MySQL type name instead (under the `"driver"` and `"mysql"` keys for schemas supporting multiple databases).

## NOT NULL Constraints on MySQL

MySQL currently does not support firing "before insert" or "before update" triggers before constraints are checked, so in other databases where a trigger will set a default value for a column when a NULL is inserted, MySQL will raise an error if there is a NOT NULL constraint on the column.

# Release Notes

## MysqlSqlUtil v1.4.3

- allow a `VARCHAR` column to be created without a size, assume a default size (issue 4399)

## MysqlSqlUtil v1.4.2

- added APIs to enable duplicate record creation errors to be detected (issue 4308)

## MysqlSqlUtil v1.4.1

- fixed a bug generating literal date/time values for SQL queries (issue 3948)

## MysqlSqlUtil v1.4

- fixed a bug where the table collation and character set (encoding) could not be specified (issue 3752)
- fixed quoting reserved words with backticks (issue 3750)
- added support for the DataProvider module (issue 3545)

## MysqlSqlUtil v1.3.2

- updated to work also with newer versions of MySQL / MariaDB that support sequences (issue 3747)
- fixed a bug where the sequence table name was not respected in MysqlDatabase::getNextSequenceValueImpl() (issue 3641)

## MysqlSqlUtil v1.3.2

- fixed quoting of reserved words in column names in table alignment (issue 3400)

## MysqlSqlUtil v1.3

- added support for serializing and deserializing AbstractTable objects (issue 2663)

## MysqlSqlUtil v1.2.1

- implemented support for custom column operators (issue 2314)

## MysqlSqlUtil v1.2

- added support for complex types

## MysqlSqlUtil v1.1.1

- implemented the force option (i.e. cascade) for dropping code objects (issue 1314)
- implemented cop_trunc_date() operator (issue 2032)

## MysqlSqlUtil v1.1

- corrected support for the `varbinary` type (bug 403)
- corrected support for the `binary` type (bug 524)
- `schema` member incorrectly set by AbstractDatasource::getUserName() instead of AbstractDatasource::getDBName() (bug 519)
- corrected support for datatypes `binary`, `char`, `varbinary`, `varchar`
- added support for `cop_cast` operator (feature 535)

## MysqlSqlUtil v1.0

- initial release