本文整理汇总了C#中ITable.GetResolvedColumnName方法的典型用法代码示例。如果您正苦于以下问题:C# ITable.GetResolvedColumnName方法的具体用法?C# ITable.GetResolvedColumnName怎么用?C# ITable.GetResolvedColumnName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITable
的用法示例。
在下文中一共展示了ITable.GetResolvedColumnName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindTrigger
private ITable FindTrigger(ITable table, string schema, string name)
{
// Find all the trigger entries with this name
var schemaColumn = table.GetResolvedColumnName(0);
var nameColumn = table.GetResolvedColumnName(1);
using (var context = new SystemQueryContext(transaction, SystemSchema.Name)) {
var t = table.SimpleSelect(context, nameColumn, SqlExpressionType.Equal,
SqlExpression.Constant(DataObject.String(name)));
return t.ExhaustiveSelect(context,
SqlExpression.Equal(SqlExpression.Reference(schemaColumn), SqlExpression.Constant(DataObject.String(schema))));
}
}
示例2: QueryPrivileges
private static Privileges QueryPrivileges(IQuery queryContext, ITable grantTable, string grantee,
DbObjectType objectType, ObjectName objectName, bool withOption, bool withPublic)
{
var objectCol = grantTable.GetResolvedColumnName(1);
var paramCol = grantTable.GetResolvedColumnName(2);
var granteeCol = grantTable.GetResolvedColumnName(3);
var grantOptionCol = grantTable.GetResolvedColumnName(4);
var granterCol = grantTable.GetResolvedColumnName(5);
ITable t1 = grantTable;
// All that match the given object parameter
// It's most likely this will reduce the search by the most so we do
// it first.
t1 = t1.SimpleSelect(queryContext, paramCol, SqlExpressionType.Equal,
SqlExpression.Constant(Field.String(objectName.FullName)));
// The next is a single exhaustive select through the remaining records.
// It finds all grants that match either public or the grantee is the
// user or role, and that match the object type.
// Expression: ("grantee_col" = grantee OR "grantee_col" = 'public')
var granteeCheck = SqlExpression.Equal(SqlExpression.Reference(granteeCol),
SqlExpression.Constant(Field.String(grantee)));
if (withPublic) {
granteeCheck = SqlExpression.Or(granteeCheck, SqlExpression.Equal(SqlExpression.Reference(granteeCol),
SqlExpression.Constant(Field.String(User.PublicName))));
}
// Expression: ("object_col" = object AND
// ("grantee_col" = grantee OR "grantee_col" = 'public'))
// All that match the given grantee or public and given object
var expr = SqlExpression.And(SqlExpression.Equal(SqlExpression.Reference(objectCol),
SqlExpression.Constant(Field.BigInt((int) objectType))), granteeCheck);
// Are we only searching for grant options?
if (withOption) {
var grantOptionCheck = SqlExpression.Equal(SqlExpression.Reference(grantOptionCol),
SqlExpression.Constant(Field.BooleanTrue));
expr = SqlExpression.And(expr, grantOptionCheck);
}
t1 = t1.ExhaustiveSelect(queryContext, expr);
// For each grant, merge with the resultant priv object
Privileges privs = Privileges.None;
foreach (var row in t1) {
var priv = (int) row.GetValue(0).AsBigInt();
privs |= (Privileges) priv;
}
return privs;
}
示例3: CopyFrom
public void CopyFrom(ITable table, int row)
{
NewRow();
var columnNames = new ObjectName[table.ColumnCount()];
for (int i = 0; i < columnNames.Length; ++i) {
columnNames[i] = table.GetResolvedColumnName(i);
}
for (int i = 0; i < ColumnCount; ++i) {
var v = GetResolvedColumnName(i);
var colName = v.Name;
try {
int columnOffset = -1;
for (int n = 0; n < columnNames.Length || columnOffset == -1; ++n) {
if (columnNames[n].Name.Equals(colName)) {
columnOffset = n;
}
}
var value = table.GetValue(row, columnOffset);
SetValue(rowCount-1, i, value);
} catch (Exception e) {
throw new InvalidOperationException(e.Message, e);
}
}
}
示例4: FormColumns
private void FormColumns(ITable result)
{
// HACK: Read the contents of the first row so that we can pick up
// any errors with reading, and also to fix the 'uniquekey' bug
// that causes a new transaction to be started if 'uniquekey' is
// a column and the value is resolved later.
var columnCount = result.TableInfo.ColumnCount;
using (var rowEnum = result.GetEnumerator()) {
if (rowEnum.MoveNext()) {
int rowIndex = rowEnum.Current.RowId.RowNumber;
for (int c = 0; c < columnCount; ++c) {
result.GetValue(rowIndex, c);
}
}
// If simple enum, note it here
resultIsSimpleEnum = (rowEnum is SimpleRowEnumerator);
}
// Build 'row_index_map' if not a simple enum
if (!resultIsSimpleEnum) {
rowIndexMap = new List<int>(result.RowCount);
var en = result.GetEnumerator();
while (en.MoveNext()) {
rowIndexMap.Add(en.Current.RowId.RowNumber);
}
}
// This is a safe operation provides we are shared.
// Copy all the TableField columns from the table to our own
// QueryResultColumn array, naming each column by what is returned from
// the 'GetResolvedVariable' method.
int colCount = result.TableInfo.ColumnCount;
columns = new QueryResultColumn[colCount];
for (int i = 0; i < colCount; ++i) {
var v = result.GetResolvedColumnName(i);
string fieldName;
if (v.ParentName == null) {
// This means the column is an alias
fieldName = String.Format("@a{0}", v.Name);
} else {
// This means the column is an schema/table/column reference
fieldName = String.Format("@f{0}", v);
}
columns[i] = new QueryResultColumn(fieldName, result.TableInfo[i]);
}
}