Qore MysqlSqlUtil Module Reference 1.0

- Main Page
- Related Pages
- Namespaces
- Classes

All Classes Namespaces Functions Variables Groups Pages
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 | Oracle 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.