Truncate table using DictTable object
class SqlPermissionJobCls
{
}
static void main(args _args = null)
{
DictTable dictTable = new DictTable(tablenum(TestTable));
str sqlTableName;
SqlDataDictionary sqlTable;
if (dictTable && dictTable.enabled())
{
sqlTableName = dictTable.name(DbBackend::Sql);
sqlTable = new SqlDataDictionary();
// Try to truncate only if the table does exist
// in the SQL database.
if (sqlTable.tableExist(sqlTableName))
{
new SqlDataDictionaryPermission(
methodstr(SqlDataDictionary, tableTruncate)).assert();
sqlTable.tableTruncate(tablenum(TestTable));
CodeAccessPermission::revertAssert();
}
}
}
class SqlPermissionJobCls
{
}
static void main(args _args = null)
{
DictTable dictTable = new DictTable(tablenum(TestTable));
str sqlTableName;
SqlDataDictionary sqlTable;
if (dictTable && dictTable.enabled())
{
sqlTableName = dictTable.name(DbBackend::Sql);
sqlTable = new SqlDataDictionary();
// Try to truncate only if the table does exist
// in the SQL database.
if (sqlTable.tableExist(sqlTableName))
{
new SqlDataDictionaryPermission(
methodstr(SqlDataDictionary, tableTruncate)).assert();
sqlTable.tableTruncate(tablenum(TestTable));
CodeAccessPermission::revertAssert();
}
}
}
No comments:
Post a Comment