本文整理汇总了C#中Result.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Result.Add方法的具体用法?C# Result.Add怎么用?C# Result.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Result
的用法示例。
在下文中一共展示了Result.Add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetResult
/// <summary>
/// Get the variable value.
/// </summary>
/// <returns></returns>
public Result GetResult()
{
Result result = new Result( 1 );
result.Add( new object[]{Value} );
return result;
}
示例2: GetListOfPeopleWithBirthDateDifference
private List<Result> GetListOfPeopleWithBirthDateDifference()
{
var results = new List<Result>();
foreach (var person in _people)
{
foreach (Person otherPerson in _people.Except(new List<Person> {person}))
{
var result = new Result();
result.Add(person);
result.Add(otherPerson);
result.BirthDateDifference = result.Person2.BirthDate - result.Person1.BirthDate;
result.BirthDateDifference = new TimeSpan(Math.Abs(result.BirthDateDifference.Ticks));
results.Add(result);
}
}
return results;
}
示例3: GetResult
//.........这里部分代码省略.........
if( !OnlyVars )
continue;
}
if (level < filter - 1)
{
level++;
continue;
}
if (eCondition == null || eCondition.Test())
{
object[] row = new object[len];
for (int i = 0; i < len; i++)
{
row[i] = eColumn[i].GetValue();
if( cChannel != null && eColumn[i].IsVarAssign )
{
cChannel.SetDeclareValue( eColumn[i].Arg.ColumnName, row[i] );
}
}
count++;
if (aggregated && !grouped)
{
UpdateAggregateRow(agg, row, len);
}
else
{
r.Add(row);
if (simple_maxrows && count >= maxrows)
{
break;
}
}
}
}
if ( aggregated && !grouped )
{
AddAggregateRow(r, agg, len, count);
}
else if ( grouped )
{
int[] order = new int[iGroupLen];
int[] way = new int[iGroupLen];
for (int i = iResultLen, j = 0; j < iGroupLen; i++, j++)
{
order[j] = i;
way[j] = 1;
}
r = SortResult(r, order, way);
Record n = r.Root;
Result x = new Result(len);
for (int i = 0; i < len; i++)
{
x.Type[i] = r.Type[i];
示例4: AddAggregateRow
private void AddAggregateRow(Result result, object[] row, int len, int count)
{
for (int i = 0; i < len; i++)
{
ExpressionType t = eColumn[i].Type;
if (t == ExpressionType.Average)
{
row[i] = Column.Avg(row[i], eColumn[i].ColumnType, count);
}
else if (t == ExpressionType.Count)
{
// this fixes the problem with count(*) on a empty table
if (row[i] == null)
{
row[i] = 0;
}
}
}
result.Add(row);
}
示例5: AddRow
private void AddRow(Result result, string sql)
{
string[] s = new string[1];
s[0] = sql;
result.Add(s);
}
示例6: ProcessUpdate
public Result ProcessUpdate()
{
string token = tTokenizer.GetString ();
cChannel.CheckReadWrite ();
cChannel.Check (token, AccessType.Update);
Table table = dDatabase.GetTable (token, cChannel);
TableFilter filter = new TableFilter (table, null, false);
tTokenizer.GetThis ("SET");
ArrayList vColumn = new ArrayList ();
ArrayList eColumn = new ArrayList ();
int len = 0;
token = null;
do {
len++;
int i = table.GetColumnNumber (tTokenizer.GetString ());
vColumn.Add (i);
tTokenizer.GetThis ("=");
Expression e = ParseExpression ();
e.Resolve (filter);
eColumn.Add (e);
token = tTokenizer.GetString ();
} while (token.Equals (","));
Expression eCondition = null;
if (token.Equals ("WHERE")) {
eCondition = ParseExpression ();
eCondition.Resolve (filter);
filter.SetCondition (eCondition);
} else {
tTokenizer.Back ();
}
// do the update
Expression[] exp = new Expression[len];
eColumn.CopyTo (exp);
int[] col = new int[len];
ColumnType[] type = new ColumnType[len];
for (int i = 0; i < len; i++) {
col [i] = ((int)vColumn [i]);
type [i] = table.GetType (col [i]);
}
int count = 0;
if (filter.FindFirst ()) {
Result del = new Result (); // don't need column count and so on
Result ins = new Result ();
int size = table.ColumnCount;
do {
if (eCondition == null || eCondition.Test ()) {
object[] nd = filter.oCurrentData;
del.Add (nd);
object[] ni = table.NewRow;
for (int i = 0; i < size; i++) {
ni [i] = nd [i];
}
for (int i = 0; i < len; i++) {
ni [col [i]] = exp [i].GetValue (type [i]);
}
ins.Add (ni);
}
} while (filter.Next ());
lock (cChannel.SyncRoot) {
cChannel.BeginNestedTransaction ();
try {
Record nd = del.Root;
while (nd != null) {
table.DeleteNoCheck (nd.Data, cChannel);
nd = nd.Next;
}
Record ni = ins.Root;
//.........这里部分代码省略.........
示例7: ProcessDelete
public Result ProcessDelete()
{
tTokenizer.GetThis ("FROM");
string token = tTokenizer.GetString ();
cChannel.CheckReadWrite ();
cChannel.Check (token, AccessType.Delete);
Table table = dDatabase.GetTable (token, cChannel);
TableFilter filter = new TableFilter (table, null, false);
token = tTokenizer.GetString ();
Expression eCondition = null;
if (token.Equals ("WHERE")) {
eCondition = ParseExpression ();
eCondition.Resolve (filter);
filter.SetCondition (eCondition);
} else {
tTokenizer.Back ();
}
int count = 0;
if (filter.FindFirst ()) {
Result del = new Result (); // don't need column count and so on
do {
if (eCondition == null || eCondition.Test ()) {
del.Add (filter.oCurrentData);
}
} while (filter.Next ());
Record n = del.Root;
while (n != null) {
table.Delete (n.Data, cChannel);
count++;
n = n.Next;
}
}
Result r = new Result ();
r.SetUpdateCount (count);
return r;
}
示例8: ProcessCall
public Result ProcessCall()
{
Expression e = ParseExpression ();
e.Resolve (null);
ColumnType type = e.ColumnType;
object o = e.GetValue ();
Result r = new Result (1);
r.Table [0] = "";
r.Type [0] = type;
r.Label [0] = "";
r.Name [0] = "";
object[] row = new object[1];
row [0] = o;
r.Add (row);
return r;
}
示例9: ProcessShow
private Result ProcessShow(Tokenizer tokenizer, Channel channel)
{
Result r = new Result(1);
string sToken = tokenizer.GetString();
if (sToken.Equals("TABLES"))
{
r.Table[0] = "SYSTEM_TABLES";
r.Label[0] = "TABLE_NAME";
System.Collections.ArrayList al = channel.Database.Tables;
//r.Label[0] = "TABLE";
r.Type[0] = ColumnType.VarChar;
for(int x=0;x<al.Count;x++)
{
Table table = (Table)al[x];
string[] tablename = new string [1];
tablename[0]=table.Name;
r.Add(tablename);
}
channel.Commit();
}
else if (sToken.Equals("DATABASES"))
{
r.Table[0] = "SYSTEM_DATABASES";
r.Label[0] = "DATABASE";
r.Type[0] = ColumnType.VarChar;
System.IO.DirectoryInfo di = new
System.IO.DirectoryInfo(System.IO.Directory.GetCurrentDirectory());
System.IO.FileInfo[] rgFiles = di.GetFiles("*.data");
foreach(System.IO.FileInfo fi in rgFiles)
{
string[] databaseName = new string [1];
databaseName[0]=fi.Name.ToUpper().Replace(".DATA","");
r.Add(databaseName);
}
channel.Commit();
}
else if (sToken.Equals("ALIAS"))
{
r = new Result(2);
r.Label[0]="NAME";
r.Type[0] = ColumnType.VarChar;
r.Label[1]="LIBRARY";
r.Type[1] = ColumnType.VarChar;
foreach( DictionaryEntry entry in _alias )
{
string[] alias = new string [2];
alias[0] = entry.Key.ToString();
alias[1] = entry.Value.ToString();
r.Add(alias);
}
channel.Commit();
}
else if (sToken.Equals("PARAMETERS"))
{
string alias = tokenizer.GetString().ToUpper();
if( !_alias.ContainsKey( alias ) )
throw TracingHelper.Error(TracingHelper.UNKNOWN_FUNCTION, alias);
string fqn = _alias[alias].ToString();
Function f = new Function( fqn, channel );
System.Reflection.MethodInfo mi = f.GetMethodInfo( fqn );
r = new Result(4);
r.Label[0]="ALIAS";
r.Type[0] = ColumnType.VarChar;
r.Label[1]="PARAMETER";
r.Type[1] = ColumnType.VarChar;
r.Label[2]="TYPE";
r.Type[2] = ColumnType.VarChar;
r.Label[3]="POSITION";
r.Type[3] = ColumnType.Integer;
System.Reflection.ParameterInfo[] parms = mi.GetParameters();
int rt = 0;
if( mi.ReturnType != null )
{
object[] p = new object[4];
p[0] = alias;
p[1] = "RETURN_VALUE";
p[2] = Column.GetColumnTypeString( Function.GetDataType( mi.ReturnType ) );
p[3] = 0;
r.Add(p);
rt = 1;
}
foreach( System.Reflection.ParameterInfo pi in parms )
{
object[] p = new object[4];
//.........这里部分代码省略.........