Пример #1
0
bool
QuasarDB::validate(const Split& split)
{
    for (unsigned int i = 0; i < split.allocations().size(); ++i) {
	const AllocLine& line = split.allocations()[i];

	Store store;
	if (!lookup(line.store_id, store))
	    return error("Store doesn't exist");
    }

    return validate((Gltx&)split);
}
Пример #2
0
bool
QuasarDB::sqlCreateLines(const Split& split)
{
    QString cmd = insertText("split_alloc", "split_id", "seq_num,store_id,"
			     "amount");
    Statement stmt(connection(), cmd);

    const vector<AllocLine>& lines = split.allocations();
    for (unsigned int line = 0; line < lines.size(); ++line) {
	Id store_id = lines[line].store_id;
	fixed amount = lines[line].amount;

	stmtSetId(stmt, split.id());
    	stmtSetInt(stmt, line);
	stmtSetId(stmt, store_id);
	stmtSetFixed(stmt, amount);
	if (!execute(stmt)) return false;
    }

    return true;
}