SchemaAlias improvement

git-svn-id: svn://ultimatepp.org/upp/trunk@1852 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
rylek 2009-12-29 07:33:49 +00:00
parent de2d1b68d4
commit e527abb455

View file

@ -569,12 +569,15 @@ SqlVal Alias(const SqlVal& value, const SqlVal& alias)
SqlVal SchemaAlias(const SqlVal& table, const SqlVal& alias)
{
return SqlCol(~SchemaTable(table) + SqlCase(MSSQL, " as ")(" ") + ~alias);
SqlVal st = SchemaTable(table);
if(~st == ~alias)
return st;
return Alias(st, alias);
}
SqlVal SchemaAlias(const SqlVal& table)
{
return SqlCol(~SchemaTable(table) + SqlCase(MSSQL, " as ")(" ") + ~table);
return SchemaAlias(table, table);
}
SqlId SchemaId(SqlId table_id)