Qore MysqlSqlUtil Module Reference  1.3.1
MysqlSqlUtil::MysqlTable Class Reference

provides the MySQL-specific implementation of the AbstractTable interface More...

Inheritance diagram for MysqlSqlUtil::MysqlTable:

Public Member Methods

string getColumnDdlSqlName (string col)
 returns the column name for use in SQL strings in DDL More...
 
string getColumnSqlName (string col)
 returns the column name for use in SQL strings; subclasses can return a special string in case the column name is a reserved word
 
list getColumnSqlNames (softlist cols)
 returns a list of column names for use in SQL strings; subclasses can process the argument list in case a column name is a reserved word
 
string getSqlName ()
 returns the name of the table to be used in SQL (with a possible qualifiers for schema, etc)
 
bool hasArrayBind ()
 returns False because the mysql driver does not support array binds / bulk DML operations
 
bool hasReturningImpl ()
 returns True if the current database driver supports the "returning" clause in insert statements, False if not
 

Static Public Member Methods

static *string getSqlValue (auto v)
 returns a string for use in SQL queries representing the DB-specific value of the argument More...
 

Public Attributes

const MysqlColumnDescOptions
 extends SqlUtil::AbstractTable::ColumnDescOptions with MySQL-specific values More...
 
const MysqlCopMap
 column operator specializations for MySQL
 
const MysqlTableDescriptionHashOptions
 extends SqlUtil::AbstractTable::TableDescriptionHashOptions with "engine" for the DB engine behind the table (default: innodb)
 
const MysqlTruncDate
 Map SqlUtil::cop_trunc_date() constants to PostgreSQL internal masks.
 
const MysqlTypeMap
 maps mysql type names to type configurations
 
const QoreTypeMap
 maps qore type names to postgresql type names
 

Private Member Methods

bool asteriskRequiresPrefix ()
 returns True if the database requires a wildcard "*" to be prefixed with the table name when it appears with other column arguments in a select statement
 
bool constraintsLinkedToIndexesImpl ()
 returns True if the database links constraints to indexes (ie dropping the constraint drops the index, etc)
 
 copyImpl (AbstractTable old)
 db-specific copy actions
 
 doSelectLimitOnlyUnlockedImpl (reference< string > sql, reference< list > args, *hash qh)
 processes a string for use in SQL select statements when there is a "limit" argument, but no "orderby" or "offset" arguments
 
 doSelectOrderByWithOffsetSqlUnlockedImpl (reference< string > sql, reference< list > args, *hash qh, *hash jch, *hash ch, *hash psch, list coll)
 processes a string for use in SQL select statements when there is an "order by" and "offset" argument
 
hash getColumnOperatorMapImpl ()
 returns the column operator map for this object
 
*string getSqlValueImpl (auto v)
 returns a string for use in SQL queries representing the DB-specific value of the argument; returns NOTHING if the type cannot be converted to an SQL string
 
bool supportsTablespacesImpl ()
 returns True if the database support tablespaces
 
bool uniqueIndexCreatesConstraintImpl ()
 returns True if the database automatically creates a unique constraint when a unique index is created (ex: mysql)
 

Static Private Member Methods

static *string getSqlValueIntern (auto v)
 returns a string for use in SQL queries representing the DB-specific value of the argument; returns NOTHING if the type cannot be converted to an SQL string
 

Detailed Description

provides the MySQL-specific implementation of the AbstractTable interface

Member Function Documentation

◆ getColumnDdlSqlName()

string MysqlSqlUtil::MysqlTable::getColumnDdlSqlName ( string  col)

returns the column name for use in SQL strings in DDL

MySQL/MariaDB etc require column names to be enclosed in backticks instead of double quotes

◆ getSqlValue()

static *string MysqlSqlUtil::MysqlTable::getSqlValue ( auto  v)
static

returns a string for use in SQL queries representing the DB-specific value of the argument

Example:
my string $str = $table.getSqlValue($date);
Parameters
vthe value to convert to an SQL value
Returns
a string representing the value usable in SQL strings for the given database driver
Exceptions
VALUE-ERRORthe given value cannot be converted to an SQL string (missing rules for value)

Member Data Documentation

◆ MysqlColumnDescOptions

const MysqlSqlUtil::MysqlTable::MysqlColumnDescOptions
Initial value:
= AbstractTable::ColumnDescOptions + (
"unsigned": Type::Boolean,
"auto_increment": Type::Boolean,
)

extends SqlUtil::AbstractTable::ColumnDescOptions with MySQL-specific values

the new keys are as follows:

  • "unsigned": only valid with numeric/integer/floating-point types
  • "auto_increment": only valid with integer/floating-point types
  • "pk": only valid with "auto_increment"