firfuorida 0.0.1
Qt based database migration library
Loading...
Searching...
No Matches
Firfuorida::Table Class Reference

Contains information about a single table, either to create or to modify. More...

#include <Firfuorida/Table>

Inheritance diagram for Firfuorida::Table:

Public Member Functions

 ~Table () override
 Deconstructs the Table object.
ColumnbigIncrements (const QString &columnName=QStringLiteral("id"))
 Creates/modifies an unsigned big integer primary key column that auto increments with given columnName and returns a pointer to the Column object.
ColumnbigInteger (const QString &columnName, uint displayWidth=0)
 Creates/modifies a signed big integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.
Columnbinary (const QString &columnName, uint length=255)
 Creates/modifies a binary column with given columnName and length and returns a pointer to the Column object.
Columnbit (const QString &columnName, uint length)
 Creates/modifies a bit column with given columnName and length and returns a pointer to the Column object.
Columnblob (const QString &columnName)
 Creates/modifies a blob column with given columnName and returns a pointer to the Column object.
Columnboolean (const QString &columnName)
 Creates/modifies a boolean column with given columnName and returns a pointer to the Column object.
ColumncharCol (const QString &columnName, uint length=255)
 Creates/modifies a char column with given columnName and length and returns a pointer to the Column object.
Columndate (const QString &columnName)
 Creates/modifies a date column with given columnName and returns a pointer to the Column object.
ColumndateTime (const QString &columnName)
 Creates/modifies a datetime column with given columnName and returns a pointer to the Column object.
Columndecimal (const QString &columnName, uint precision, uint scale)
 Creates/modifies a signed decimal column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.
ColumndoubleCol (const QString &columnName, uint precision, uint scale)
 Creates/modifies a signed double column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.
void dropColumn (const QString &columnName)
 Drops the column identfied by columnName from the table.
ColumnenumCol (const QString &columnName, const QStringList &enums)
 Creates/modifies an enum column with given columnName and enums and returns a pointer to the Column object.
ColumnfloatCol (const QString &columnName, uint precision, uint scale)
 Creates/modifies a signed float column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.
ColumnforeignKey (const QString &foreignKeyCol, const QString &referenceTable, const QString &referenceCol, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a foreign key constraint for foreignKey that references the referenceCol at referenceTable and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. Use Column:onDelete() and/or Column::onUpdate() on the returned Column object to set reference behavior.
ColumnforeignKey (const QStringList &foreignKeys, const QString &referenceTable, const QStringList &referenceCols, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a foreign key constraint for foreignKeys that references the referenceCols at referenceTable and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. Use Column:onDelete() and/or Column::onUpdate() on the returned Column object to set reference behavior.
Columnincrements (const QString &columnName=QStringLiteral("id"))
 Creates/modifies an unsigned integer primary key column that auto increments with given columnName and returns a pointer to the Column object.
Columnindex (const QString &col, const QString &indexName=QString())
 Creates/modifies an index for col named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.
Columnindex (const QStringList &cols, const QString &indexName=QString())
 Creates/modifies an index over the columns cols named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.
Columninteger (const QString &columnName, uint displayWidth=0)
 Creates/modifies a signed integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.
Columnjson (const QString &columnName)
 Creates/modifies a JSON column with given columnName and returns a pointer to the Column object.
Columnkey (const QString &col, const QString &indexName=QString())
 Creates/modifies a key index for col named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.
Columnkey (const QStringList &cols, const QString &indexName=QString())
 Creates/modifies a key index over the columns cols named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.
ColumnlongBlob (const QString &columnName)
 Creates/modifies a long blob column with given columnName and returns a pointer to the Column object.
ColumnlongText (const QString &columnName)
 Creates/modifies a long text column with given columnName and returns a pointer to the Column object.
ColumnmediumBlob (const QString &columnName)
 Creates/modifies a medium blob column with given columnName and returns a pointer to the Column object.
ColumnmediumIncrements (const QString &columnName=QStringLiteral("id"))
 Creates/modifies an unsigned medium integer primary key column that auto increments with given columnName and returns a pointer to the Column object.
ColumnmediumInteger (const QString &columnName, uint displayWidth=0)
 Creates/modifies a signed medium integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.
ColumnmediumText (const QString &columnName)
 Creates/modifies a medium text column with given columnName and returns a pointer to the Column object.
Columnnumeric (const QString &columnName, uint precision, uint scale)
 Creates/modifies a signed numeric column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.
ColumnprimaryKey (const QString &col, const QString &constraintSymbol=QString())
 Creates/modifies a primary key index for col named constraintSymbol and returns a pointer to the Column object. The constraintSymbol is optional but helps to identify the index in the future.
ColumnprimaryKey (const QStringList &cols, const QString &constraintSymbol=QString())
 Creates/modifies a primary key index over the columns cols named constraintSymbol and returns a pointer to the Column object. The constraintSymbol is optional but helps to identify the index in the future.
Columnset (const QString &columnName, const QStringList &setList)
 Creates/modifies a set column with given columnName and setList and returns a pointer to the Column object.
void setCharset (const QString &charset)
 Set the default charset when creating a new table or change it for an existing table.
void setCollation (const QString &collation)
 Set the collation when creating a new table or change it for an existing table.
void setComment (const QString &comment)
 Sets a comment when creating a new table of change it for an existing table.
void setEngine (const QString &engine)
 Set the used engine when creating a new table or change it for an existing table.
void setIsTemporary (bool isTemporary=true)
 Marks the table as temporary if isTemporary is set to true.
ColumnsmallIncrements (const QString &columnName=QStringLiteral("id"))
 Creates/modifies an unsigned small integer primary key column that auto increments with given columnName and returns a pointer to the Column object.
ColumnsmallInteger (const QString &columnName, uint displayWidth=0)
 Creates/modifies a signed small integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.
Columntext (const QString &columnName)
 Creates/modifies a text column with given columnName and returns a pointer to the Column object.
Columntime (const QString &columnName)
 Creates/modifies a time column with given columnName and returns a pointer to the Column object.
Columntimestamp (const QString &columnName)
 Creates/modifies a timestamp column with given columnName and returns a pointer to the Column object.
ColumntinyBlob (const QString &columnName)
 Creates/modifies a tiny blob column with given columnName and returns a pointer to the Column object.
ColumntinyIncrements (const QString &columnName=QStringLiteral("id"))
 Creates/modifies an unsigned tiny integer primary key column that auto increments with given columnName and returns a pointer to the Column object.
ColumntinyInteger (const QString &columnName, uint displayWidth=0)
 Creates/modifies a signed tiny integer column with given columnName and displayWidth displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.
ColumntinyText (const QString &columnName)
 Creates/modifies a tiny text column with given columnName and returns a pointer to the Column object.
ColumnuniqueIndex (const QString &col, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a unique index for col with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.
ColumnuniqueIndex (const QStringList &cols, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a unique index over the columns cols with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.
ColumnuniqueKey (const QString &col, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a unique key index for col with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.
ColumnuniqueKey (const QStringList &cols, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a unique key index over the columns cols with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.
ColumnvarBinary (const QString &columnName, uint length=255)
 Creates/modifies a varbinary column with given columnName and length and returns a pointer to the Column object.
ColumnvarChar (const QString &columnName, uint length=255)
 Creates/modifies a varchar column with given columnName and length and returns a pointer to the Column object.
Columnyear (const QString &columnName)
 Creates/modifies a year column with given columnName and returns a pointer to the Column object.

Detailed Description

Contains information about a single table, either to create or to modify.

The Table object can only be created by functions of the Migration class.

Example

example.h

/*
* SPDX-FileCopyrightText: (C) 2019-2022 Matthias Fehring <https://www.huessenbergnetz.de>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
#include <Firfuorida/Migration>
class M20190121T174100_Example : public Firfuorida::Migration
{
public:
explicit M20190121T174100_Example(Firfuorida::Migrator *parent);
~M20190121T174100_Example() override;
protected:
void up() override;
void down() override;
}
Contains a single migration instance.
Definition migration.h:46
virtual void up()=0
Reimplement this function to perform database operations when performing migrations.
virtual void down()=0
Reimplement this function to perform database operations when performing migration rollback.
Manages multiple migrations.
Definition migrator.h:40
Q_OBJECTQ_OBJECT
QObject * parent() const const

example.cpp

/*
* SPDX-FileCopyrightText: (C) 2019-2022 Matthias Fehring <https://www.huessenbergnetz.de>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
#include "example.h"
M20190121T174100_Example::M20190121T174100_Example(Firfuorida::Migrator *parent) :
Firefuorida::Migration(parent)
{
}
M20190121T174100_Example::~M20190121T174100_Example()
{
}
{
// create a new table named "ExampleTable" if it not already exists
auto t = createTableIfNotExists(QStringLiteral("ExampleTable"));
// create a new unsigned tiny integer column on that table with the
// default name "id" and auto incrementation enabled
t->tinyIncrements();
// create a new signed tiny integer column on that table with the
// name "tinyIntCol" and UNIQUE KEY index.
t->tinyInteger(QStringLiteral("tinyIntCol"))->unique();
// create a new nullable tiny blob column on that table with the name
// "tinyBlobCol"
t->tinyBlob(QStringLiteral("tinyBlobCol"))->nullable();
// create a new tiny text column on that table with the name "tinyTextCol"
// and the default value "foobar"
t->tinyText(QStringLiteral("tinyTextCol"))->defaultValue(QStringLiteral("foobar"));
}
{
// drop the table named "ExampleTable" if it exists
dropIfExists(QStringLiteral("ExampleTable"));
}
void dropIfExists(const QString &tableName)
Drops the table identified by tableName if it exists.
Definition migration.cpp:150
Table * createTableIfNotExists(const QString &tableName)
Creates a new table with the given tableName if it not exists already.
Definition migration.cpp:124

Constructor & Destructor Documentation

◆ ~Table()

Table::~Table ( )
override

Deconstructs the Table object.

Member Function Documentation

◆ bigIncrements()

Column * Table::bigIncrements ( const QString & columnName = QStringLiteral("id"))

Creates/modifies an unsigned big integer primary key column that auto increments with given columnName and returns a pointer to the Column object.

MySQL statement
columnName BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY

◆ bigInteger()

Column * Table::bigInteger ( const QString & columnName,
uint displayWidth = 0 )

Creates/modifies a signed big integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName BIGINT(displayWidth}

◆ binary()

Column * Table::binary ( const QString & columnName,
uint length = 255 )

Creates/modifies a binary column with given columnName and length and returns a pointer to the Column object.

MySQL statement
columnName BINARY(\a length)

◆ bit()

Column * Table::bit ( const QString & columnName,
uint length )

Creates/modifies a bit column with given columnName and length and returns a pointer to the Column object.

MySQL statement
columnName BIT

◆ blob()

Column * Table::blob ( const QString & columnName)

Creates/modifies a blob column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName BLOB

◆ boolean()

Column * Table::boolean ( const QString & columnName)

Creates/modifies a boolean column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TINYINT(1)

◆ charCol()

Column * Table::charCol ( const QString & columnName,
uint length = 255 )

Creates/modifies a char column with given columnName and length and returns a pointer to the Column object.

MySQL statement
columnName CHAR(length)

◆ date()

Column * Table::date ( const QString & columnName)

Creates/modifies a date column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName DATE

◆ dateTime()

Column * Table::dateTime ( const QString & columnName)

Creates/modifies a datetime column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName DATETIME

◆ decimal()

Column * Table::decimal ( const QString & columnName,
uint precision,
uint scale )

Creates/modifies a signed decimal column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName DECIMAL(precision, scale)

◆ doubleCol()

Column * Table::doubleCol ( const QString & columnName,
uint precision,
uint scale )

Creates/modifies a signed double column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName DOUBLE(precision, scale)

◆ dropColumn()

void Table::dropColumn ( const QString & columnName)

Drops the column identfied by columnName from the table.

◆ enumCol()

Column * Table::enumCol ( const QString & columnName,
const QStringList & enums )

Creates/modifies an enum column with given columnName and enums and returns a pointer to the Column object.

MySQL statement
columnName ENUM('enum1', 'enum2')

◆ floatCol()

Column * Table::floatCol ( const QString & columnName,
uint precision,
uint scale )

Creates/modifies a signed float column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName FLOAT(precision, scale)

◆ foreignKey() [1/2]

Column * Table::foreignKey ( const QString & foreignKeyCol,
const QString & referenceTable,
const QString & referenceCol,
const QString & constraintSymbol = QString(),
const QString & indexName = QString() )

Creates/modifies a foreign key constraint for foreignKey that references the referenceCol at referenceTable and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. Use Column:onDelete() and/or Column::onUpdate() on the returned Column object to set reference behavior.

Example
table->foreignKey(QStringLiteral("col"), QStringLiteral("referenceTable"), QStringLiteral("refCol"))->onDelete(QStringLiteral("CASCADE"))->onUpdate(QStringLiteral("CASCADE"));
MySQL statement
[CONSTRAINT constraintSymbol] FOREIGN KEY [indexName] (col) REFERENCES referenceTable (refCol) ON DELETE CASCADE ON UPDATE CASCADE

◆ foreignKey() [2/2]

Column * Table::foreignKey ( const QStringList & foreignKeys,
const QString & referenceTable,
const QStringList & referenceCols,
const QString & constraintSymbol = QString(),
const QString & indexName = QString() )

Creates/modifies a foreign key constraint for foreignKeys that references the referenceCols at referenceTable and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. Use Column:onDelete() and/or Column::onUpdate() on the returned Column object to set reference behavior.

Example
table->foreignKey(QStringList({"col1","col2"}), QStringLiteral("referenceTable"), QStringList({"refCol1","refCol2"}))->onDelete(QStringLiteral("CASCADE"))->onUpdate(QStringLiteral("CASCADE"));
MySQL statement
[CONSTRAINT constraintSymbol] FOREIGN KEY [indexName] (col1,col2) REFERENCES referenceTable (refCol1,refCol2) ON DELETE CASCADE ON UPDATE CASCADE

◆ increments()

Column * Table::increments ( const QString & columnName = QStringLiteral("id"))

Creates/modifies an unsigned integer primary key column that auto increments with given columnName and returns a pointer to the Column object.

MySQL statement
columnName INT UNSIGNED AUTO_INCREMENT PRIMARY KEY

◆ index() [1/2]

Column * Table::index ( const QString & col,
const QString & indexName = QString() )

Creates/modifies an index for col named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.

MySQL statement
KEY [indexName] (col)

◆ index() [2/2]

Column * Table::index ( const QStringList & cols,
const QString & indexName = QString() )

Creates/modifies an index over the columns cols named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.

MySQL statement
KEY [indexName] (col1,col2)

◆ integer()

Column * Table::integer ( const QString & columnName,
uint displayWidth = 0 )

Creates/modifies a signed integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName INT(displayWidth}

◆ json()

Column * Table::json ( const QString & columnName)

Creates/modifies a JSON column with given columnName and returns a pointer to the Column object.

Note
On some RDBMS like MariaDB and SQLite, the JSON data type is an alias for a text type.
MySQL statement
columnName JSON

◆ key() [1/2]

Column * Table::key ( const QString & col,
const QString & indexName = QString() )

Creates/modifies a key index for col named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.

MySQL statement
KEY [indexName] (col)

◆ key() [2/2]

Column * Table::key ( const QStringList & cols,
const QString & indexName = QString() )

Creates/modifies a key index over the columns cols named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.

MySQL statement
KEY [indexName] (col1,col2)

◆ longBlob()

Column * Table::longBlob ( const QString & columnName)

Creates/modifies a long blob column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName LONGBLOB

◆ longText()

Column * Table::longText ( const QString & columnName)

Creates/modifies a long text column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName LONGTEXT

◆ mediumBlob()

Column * Table::mediumBlob ( const QString & columnName)

Creates/modifies a medium blob column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName MEDIUMBLOB

◆ mediumIncrements()

Column * Table::mediumIncrements ( const QString & columnName = QStringLiteral("id"))

Creates/modifies an unsigned medium integer primary key column that auto increments with given columnName and returns a pointer to the Column object.

MySQL statement
columnName MEDIUMINT UNSIGNED AUTO_INCREMENT PRIMARY KEY

◆ mediumInteger()

Column * Table::mediumInteger ( const QString & columnName,
uint displayWidth = 0 )

Creates/modifies a signed medium integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName MEDIUMINT(displayWidth}

◆ mediumText()

Column * Table::mediumText ( const QString & columnName)

Creates/modifies a medium text column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName MEDIUMTEXT

◆ numeric()

Column * Table::numeric ( const QString & columnName,
uint precision,
uint scale )

Creates/modifies a signed numeric column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName NUMERIC(precision, scale)

◆ primaryKey() [1/2]

Column * Table::primaryKey ( const QString & col,
const QString & constraintSymbol = QString() )

Creates/modifies a primary key index for col named constraintSymbol and returns a pointer to the Column object. The constraintSymbol is optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] PRIMARY KEY (col)

◆ primaryKey() [2/2]

Column * Table::primaryKey ( const QStringList & cols,
const QString & constraintSymbol = QString() )

Creates/modifies a primary key index over the columns cols named constraintSymbol and returns a pointer to the Column object. The constraintSymbol is optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] PRIMARY KEY (col1,col2)

◆ set()

Column * Table::set ( const QString & columnName,
const QStringList & setList )

Creates/modifies a set column with given columnName and setList and returns a pointer to the Column object.

MySQL statement
columnName SET('entry1', 'entry2')

◆ setCharset()

void Table::setCharset ( const QString & charset)

Set the default charset when creating a new table or change it for an existing table.

◆ setCollation()

void Table::setCollation ( const QString & collation)

Set the collation when creating a new table or change it for an existing table.

◆ setComment()

void Table::setComment ( const QString & comment)

Sets a comment when creating a new table of change it for an existing table.

Note
The maximum size for a column comment on MySQL/MariaDB is 2048 characters.

◆ setEngine()

void Table::setEngine ( const QString & engine)

Set the used engine when creating a new table or change it for an existing table.

◆ setIsTemporary()

void Table::setIsTemporary ( bool isTemporary = true)

Marks the table as temporary if isTemporary is set to true.

◆ smallIncrements()

Column * Table::smallIncrements ( const QString & columnName = QStringLiteral("id"))

Creates/modifies an unsigned small integer primary key column that auto increments with given columnName and returns a pointer to the Column object.

MySQL statement
columnName SMALLINT UNSIGNED AUTO_INCREMENT PRIMARY KEY

◆ smallInteger()

Column * Table::smallInteger ( const QString & columnName,
uint displayWidth = 0 )

Creates/modifies a signed small integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName SMALLINT(displayWidth}

◆ text()

Column * Table::text ( const QString & columnName)

Creates/modifies a text column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TEXT

◆ time()

Column * Table::time ( const QString & columnName)

Creates/modifies a time column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TIME

◆ timestamp()

Column * Table::timestamp ( const QString & columnName)

Creates/modifies a timestamp column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TIMESTAMP

◆ tinyBlob()

Column * Table::tinyBlob ( const QString & columnName)

Creates/modifies a tiny blob column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TINYBLOB

◆ tinyIncrements()

Column * Table::tinyIncrements ( const QString & columnName = QStringLiteral("id"))

Creates/modifies an unsigned tiny integer primary key column that auto increments with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY

◆ tinyInteger()

Column * Table::tinyInteger ( const QString & columnName,
uint displayWidth = 0 )

Creates/modifies a signed tiny integer column with given columnName and displayWidth displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName TINYINT(displayWidth}

◆ tinyText()

Column * Table::tinyText ( const QString & columnName)

Creates/modifies a tiny text column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TINYTEXT

◆ uniqueIndex() [1/2]

Column * Table::uniqueIndex ( const QString & col,
const QString & constraintSymbol = QString(),
const QString & indexName = QString() )

Creates/modifies a unique index for col with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] UNIQUE KEY [indexName] (col)

◆ uniqueIndex() [2/2]

Column * Table::uniqueIndex ( const QStringList & cols,
const QString & constraintSymbol = QString(),
const QString & indexName = QString() )

Creates/modifies a unique index over the columns cols with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] UNIQUE KEY [indexName] (col1,col2)

◆ uniqueKey() [1/2]

Column * Table::uniqueKey ( const QString & col,
const QString & constraintSymbol = QString(),
const QString & indexName = QString() )

Creates/modifies a unique key index for col with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] UNIQUE KEY [indexName] (col)

◆ uniqueKey() [2/2]

Column * Table::uniqueKey ( const QStringList & cols,
const QString & constraintSymbol = QString(),
const QString & indexName = QString() )

Creates/modifies a unique key index over the columns cols with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] UNIQUE KEY [indexName] (col1,col2)

◆ varBinary()

Column * Table::varBinary ( const QString & columnName,
uint length = 255 )

Creates/modifies a varbinary column with given columnName and length and returns a pointer to the Column object.

MySQL statement
columnName VARBINARY(length)

◆ varChar()

Column * Table::varChar ( const QString & columnName,
uint length = 255 )

Creates/modifies a varchar column with given columnName and length and returns a pointer to the Column object.

MySQL statement
columnName VARCHAR(length)

◆ year()

Column * Table::year ( const QString & columnName)

Creates/modifies a year column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName YEAR