SqlUpdate::SqlUpdate(Fields f) {
    UpdateFieldOperator ufo;
    ufo.update = this;
    f(ufo);
    table = ufo.table;
    sel.Set(SqlSet(SqlId("X")));
}
Exemple #2
0
NAMESPACE_UPP

SqlSet operator|(const SqlSet& s1, const SqlSet& s2) {
	if(s1.IsEmpty()) return s2;
	if(s2.IsEmpty()) return s1;
	return SqlSet(s1(SqlSet::SET, ~SQLITE3) + " union " + s2(SqlSet::SET, ~SQLITE3), SqlSet::SETOP);
}
SqlSet SqlSelect::AsTable(const SqlId& tab) const
{
    StringBuffer t;
    t << SqlCode(MSSQL|PGSQL, "")("(")
      << "(" << text << ") as \t" << tab.ToString() << '\t'
      << SqlCode(MSSQL|PGSQL, "")(")");
    return SqlSet(String(t), SqlSet::HIGH);
}
SqlUpdate::SqlUpdate(const SqlId& table)
    :	table(table)
{
    sel.Set(SqlSet(SqlId("X")));
}
SqlInsert& SqlInsert::From(const SqlId& from) {
    return From(SqlSet(from));
}
Exemple #6
0
/*
#define E__SCat(I)       sCat(set, p##I)

#define E__QSelectF(I) \
SqlSelect SelectHint(const char *hint, __List##I(E__SqlVal)) { \
	SqlSet set; \
	__List##I(E__SCat); \
	return SelectHint(hint, set); \
}
__Expand(E__QSelectF);
*/
SqlSet DeleteHint(const char *hint, const SqlVal& table)
{
    return SqlSet(String().Cat() << "delete /*+ " << hint << " */ from " << ~table, SqlSet::SETOP);
}
Exemple #7
0
SqlSet operator-(const SqlSet& s1, const SqlSet& s2) {
	if(s1.IsEmpty() || s2.IsEmpty())
		return s1;
	return SqlSet(s1(SqlSet::SET) + SqlCode(MSSQL|PGSQL|SQLITE3, " except ")(" minus ") + s2(SqlSet::SET), SqlSet::SETOP);
}
Exemple #8
0
SqlSet operator&(const SqlSet& s1, const SqlSet& s2) {
	if(s1.IsEmpty()) return s2;
	if(s2.IsEmpty()) return s1;
	return SqlSet(s1(SqlSet::SET, ~SQLITE3) + " intersect " + s2(SqlSet::SET, ~SQLITE3), SqlSet::SETOP);
}
Exemple #9
0
SqlSet operator+(const SqlSet& s1, const SqlSet& s2)
{
	if(s1.IsEmpty()) return s2;
	if(s2.IsEmpty()) return s1;
	return SqlSet(s1(SqlSet::SET, ~SQLITE3) + " union all " + s2(SqlSet::SET, ~SQLITE3), SqlSet::SETOP);
}