23 lines
646 B
C++
23 lines
646 B
C++
#include "PgSequence.h"
|
|
#include "PgDatabaseCatalog.h"
|
|
#include "PgTypeContainer.h"
|
|
#include <QStringBuilder>
|
|
|
|
QString PgSequence::createSql() const
|
|
{
|
|
QString sql;
|
|
sql = "CREATE";
|
|
// [ TEMPORARY | TEMP ]
|
|
sql += " SEQUENCE " % fullyQualifiedQuotedObjectName();
|
|
if (catalog().serverVersion() >= 100000)
|
|
sql += "\n AS " % catalog().types()->getByKey(typid)->objectName();
|
|
sql += QString("\n INCREMENT %1\n MINVALUE %2"
|
|
" MAXVALUE %3\n START %4 CACHE %5")
|
|
.arg(increment).arg(min).arg(max).arg(start).arg(cache);
|
|
if (cycled)
|
|
sql += "\n CYCLE";
|
|
|
|
// [ OWNED BY { table_name.column_name | NONE } ]
|
|
sql += ";";
|
|
return sql;
|
|
}
|