add setter and a datatype list

This commit is contained in:
Peinthor Rene
2013-03-03 22:12:16 +01:00
parent 9394caffa9
commit 2920697894
2 changed files with 26 additions and 1 deletions

View File

@@ -2,6 +2,8 @@
namespace sqlb {
QStringList Field::Datatypes = QStringList() << "INTEGER" << "TEXT" << "BLOB" << "REAL" << "NUMERIC";
QString Field::toString(const QString& indent, const QString& sep) const
{
QString str = indent + m_name + sep + m_type;
@@ -43,12 +45,18 @@ bool Field::isInteger() const
|| norm == "int8";
}
Table::~Table()
void Table::clear()
{
foreach(Field* f, m_fields) {
delete f;
}
m_fields.clear();
m_primarykey.clear();
}
Table::~Table()
{
clear();
}
void Table::addField(Field *f)
@@ -56,6 +64,13 @@ void Table::addField(Field *f)
m_fields.append(f);
}
void Table::setFields(const FieldList &fields)
{
m_primarykey.clear();
clear();
m_fields = fields;
}
bool Table::setPrimaryKey(const FieldList& pk)
{
foreach(Field* f, pk) {