2018-12-28 08:51:02 +01:00
|
|
|
|
#ifndef PGSEQUENCE_H
|
|
|
|
|
|
#define PGSEQUENCE_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "catalog/PgClass.h"
|
|
|
|
|
|
|
|
|
|
|
|
class PgSequence: public PgClass {
|
|
|
|
|
|
public:
|
2022-09-06 11:17:18 +00:00
|
|
|
|
enum Direction {
|
|
|
|
|
|
Ascending,
|
|
|
|
|
|
Descending
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// values that define the trigger
|
|
|
|
|
|
// in recent versions from the catalog
|
2018-12-28 08:51:02 +01:00
|
|
|
|
Oid typid = InvalidOid;
|
|
|
|
|
|
int64_t start = 0;
|
|
|
|
|
|
int64_t increment = 0;
|
|
|
|
|
|
int64_t max = 0;
|
|
|
|
|
|
int64_t min = 0;
|
|
|
|
|
|
int64_t cache = 0;
|
|
|
|
|
|
bool cycled = false;
|
|
|
|
|
|
|
2019-08-10 18:12:26 +02:00
|
|
|
|
bool priv_usage = false;
|
|
|
|
|
|
bool priv_select = false;
|
|
|
|
|
|
bool priv_update = false;
|
|
|
|
|
|
|
2022-09-06 11:17:18 +00:00
|
|
|
|
// Sequence state data, retrieved by SELECTing the sequence
|
|
|
|
|
|
int64_t last = 0;
|
|
|
|
|
|
int64_t log = 0; // shows how many fetches are left before new wal log
|
|
|
|
|
|
bool called = false;
|
|
|
|
|
|
|
2018-12-28 08:51:02 +01:00
|
|
|
|
using PgClass::PgClass;
|
|
|
|
|
|
QString createSql() const;
|
2022-09-06 11:17:18 +00:00
|
|
|
|
|
|
|
|
|
|
Direction direction() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return increment < 0 ? Descending : Ascending;
|
|
|
|
|
|
}
|
|
|
|
|
|
int64_t defaultMin() const;
|
|
|
|
|
|
int64_t defaultMax() const;
|
|
|
|
|
|
int64_t defaultStart() const;
|
|
|
|
|
|
int64_t defaultIncrement() const;
|
|
|
|
|
|
int64_t defaultCache() const;
|
|
|
|
|
|
// other option defaults are 1
|
|
|
|
|
|
QString nonDefaultOptionsString() const;
|
2018-12-28 08:51:02 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // PGSEQUENCE_H
|