Qore MysqlSqlUtil Module Reference  1.4.3
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

MysqlSqlUtil v1.3.2

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

MysqlSqlUtil v1.3

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

MysqlSqlUtil v1.0

  • initial release