1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

LibSQL: Added 'nullable' and 'default value' option to ColumnDef

These are standard SQL concepts which columns should be aware of.
This commit is contained in:
Jan de Visser 2021-07-17 07:04:13 -04:00 committed by Andreas Kling
parent b74721e604
commit 230118c4b2
2 changed files with 14 additions and 0 deletions

View file

@ -46,6 +46,7 @@ ColumnDef::ColumnDef(Relation* parent, size_t column_number, String name, SQLTyp
: Relation(move(name), parent)
, m_index(column_number)
, m_type(sql_type)
, m_default(Value(sql_type))
{
}
@ -59,6 +60,12 @@ Key ColumnDef::key() const
return key;
}
void ColumnDef::set_default_value(const Value& default_value)
{
VERIFY(default_value.type() == type());
m_default = default_value;
}
Key ColumnDef::make_key(TableDef const& table_def)
{
Key key(index_def());