70 lines
1.1 KiB
C++
70 lines
1.1 KiB
C++
#include "PgConstraint.h"
|
|
|
|
void operator<<(ConstraintType &s, const Pgsql::Value &v)
|
|
{
|
|
const char *c = v.c_str();
|
|
switch (*c) {
|
|
case 'c':
|
|
s = ConstraintType::Check;
|
|
break;
|
|
case 'f':
|
|
s = ConstraintType::ForeignKey;
|
|
break;
|
|
case 'p':
|
|
s = ConstraintType::PrimaryKey;
|
|
break;
|
|
case 'u':
|
|
s = ConstraintType::Unique;
|
|
break;
|
|
case 't':
|
|
s = ConstraintType::ConstraintTrigger;
|
|
break;
|
|
case 'x':
|
|
s = ConstraintType::ExclusionConstraint;
|
|
break;
|
|
}
|
|
}
|
|
|
|
void operator<<(ForeignKeyAction &s, const Pgsql::Value &v)
|
|
{
|
|
const char *c = v.c_str();
|
|
switch (*c) {
|
|
case 'a':
|
|
s = ForeignKeyAction::NoAction;
|
|
break;
|
|
case 'r':
|
|
s = ForeignKeyAction::Restrict;
|
|
break;
|
|
case 'c':
|
|
s = ForeignKeyAction::Cascade;
|
|
break;
|
|
case 'n':
|
|
s = ForeignKeyAction::SetNull;
|
|
break;
|
|
case 'd':
|
|
s = ForeignKeyAction::SetDefault;
|
|
break;
|
|
}
|
|
}
|
|
|
|
void operator<<(ForeignKeyMatch &s, const Pgsql::Value &v)
|
|
{
|
|
const char *c = v.c_str();
|
|
switch (*c) {
|
|
case 'f':
|
|
s = ForeignKeyMatch::Full;
|
|
break;
|
|
case 'p':
|
|
s = ForeignKeyMatch::Partial;
|
|
break;
|
|
case 's':
|
|
s = ForeignKeyMatch::Simple;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
PgConstraint::PgConstraint()
|
|
{
|
|
|
|
}
|