本文整理汇总了C#中Tiraggo.Interfaces.tgDataResponse类的典型用法代码示例。如果您正苦于以下问题:C# tgDataResponse类的具体用法?C# tgDataResponse怎么用?C# tgDataResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
tgDataResponse类属于Tiraggo.Interfaces命名空间,在下文中一共展示了tgDataResponse类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LoadDataTableFromText
private static tgDataResponse LoadDataTableFromText(tgDataRequest request)
{
tgDataResponse response = new tgDataResponse();
NpgsqlCommand cmd = null;
try
{
DataTable dataTable = new DataTable(request.ProviderMetadata.Destination);
cmd = new NpgsqlCommand();
cmd.CommandType = CommandType.Text;
if (request.CommandTimeout != null) cmd.CommandTimeout = request.CommandTimeout.Value;
if (request.Parameters != null) Shared.AddParameters(cmd, request);
NpgsqlDataAdapter da = new NpgsqlDataAdapter();
cmd.CommandText = request.QueryText;
da.SelectCommand = cmd;
try
{
tgTransactionScope.Enlist(da.SelectCommand, request.ConnectionString, CreateIDbConnectionDelegate);
#region Profiling
if (sTraceHandler != null)
{
using (esTraceArguments esTrace = new esTraceArguments(request, cmd, "LoadFromText", System.Environment.StackTrace))
{
try
{
da.Fill(dataTable);
}
catch (Exception ex)
{
esTrace.Exception = ex.Message;
throw;
}
}
}
else
#endregion Profiling
{
da.Fill(dataTable);
}
}
finally
{
tgTransactionScope.DeEnlist(da.SelectCommand);
}
response.Table = dataTable;
if (request.Parameters != null)
{
Shared.GatherReturnParameters(cmd, request, response);
}
}
catch (Exception ex)
{
CleanupCommand(cmd);
throw ex;
}
finally
{
}
return response;
}
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:70,代码来源:DataProvider.cs
示例2: LoadManyToMany
private static tgDataResponse LoadManyToMany(tgDataRequest request)
{
tgDataResponse response = new tgDataResponse();
NpgsqlCommand cmd = null;
try
{
DataTable dataTable = new DataTable(request.ProviderMetadata.Destination);
cmd = new NpgsqlCommand();
cmd.CommandType = CommandType.Text;
if (request.CommandTimeout != null) cmd.CommandTimeout = request.CommandTimeout.Value;
string mmQuery = request.QueryText;
string[] sections = mmQuery.Split('|');
string[] tables = sections[0].Split(',');
string[] columns = sections[1].Split(',');
string prefix = String.Empty;
if (request.Catalog != null || request.ProviderMetadata.Catalog != null)
{
prefix += Delimiters.TableOpen;
prefix += request.Catalog != null ? request.Catalog : request.ProviderMetadata.Catalog;
prefix += Delimiters.TableClose + ".";
}
if (request.Schema != null || request.ProviderMetadata.Schema != null)
{
prefix += Delimiters.TableOpen;
prefix += request.Schema != null ? request.Schema : request.ProviderMetadata.Schema;
prefix += Delimiters.TableClose + ".";
}
string table0 = prefix + Delimiters.TableOpen + tables[0] + Delimiters.TableClose;
string table1 = prefix + Delimiters.TableOpen + tables[1] + Delimiters.TableClose;
string sql = "SELECT * FROM " + table0 + " JOIN " + table1 + " ON " + table0 + ".\"" + columns[0] + "\" = ";
sql += table1 + ".\"" + columns[1] + "\" WHERE " + table1 + ".\"" + sections[2] + "\" = @";
if (request.Parameters != null)
{
foreach (tgParameter esParam in request.Parameters)
{
sql += esParam.Name;
}
Shared.AddParameters(cmd, request);
}
NpgsqlDataAdapter da = new NpgsqlDataAdapter();
cmd.CommandText = sql;
da.SelectCommand = cmd;
try
{
tgTransactionScope.Enlist(da.SelectCommand, request.ConnectionString, CreateIDbConnectionDelegate);
#region Profiling
if (sTraceHandler != null)
{
using (esTraceArguments esTrace = new esTraceArguments(request, cmd, "LoadManyToMany", System.Environment.StackTrace))
{
try
{
da.Fill(dataTable);
}
catch (Exception ex)
{
esTrace.Exception = ex.Message;
throw;
}
}
}
else
#endregion Profiling
{
da.Fill(dataTable);
}
}
finally
{
tgTransactionScope.DeEnlist(da.SelectCommand);
}
response.Table = dataTable;
}
catch (Exception ex)
{
CleanupCommand(cmd);
throw ex;
}
finally
{
}
//.........这里部分代码省略.........
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:101,代码来源:DataProvider.cs
示例3: tgDataResponse
tgDataResponse IDataProvider.FillDataTable(tgDataRequest request)
{
tgDataResponse response = new tgDataResponse();
try
{
switch (request.QueryType)
{
case tgQueryType.StoredProcedure:
response = LoadDataTableFromStoredProcedure(request);
break;
case tgQueryType.Text:
response = LoadDataTableFromText(request);
break;
default:
break;
}
}
catch (Exception ex)
{
response.Exception = ex;
}
return response;
}
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:29,代码来源:DataProvider.cs
示例4: LoadDataTableFromDynamicQuery
// This is used only to execute the Dynamic Query API
private static void LoadDataTableFromDynamicQuery(tgDataRequest request, tgDataResponse response, NpgsqlCommand cmd)
{
try
{
response.LastQuery = cmd.CommandText;
if (request.CommandTimeout != null) cmd.CommandTimeout = request.CommandTimeout.Value;
DataTable dataTable = new DataTable(request.ProviderMetadata.Destination);
NpgsqlDataAdapter da = new NpgsqlDataAdapter();
da.SelectCommand = cmd;
try
{
tgTransactionScope.Enlist(da.SelectCommand, request.ConnectionString, CreateIDbConnectionDelegate);
#region Profiling
if (sTraceHandler != null)
{
using (esTraceArguments esTrace = new esTraceArguments(request, cmd, "LoadFromDynamicQuery", System.Environment.StackTrace))
{
try
{
da.Fill(dataTable);
}
catch (Exception ex)
{
esTrace.Exception = ex.Message;
throw;
}
}
}
else
#endregion Profiling
{
da.Fill(dataTable);
}
}
finally
{
tgTransactionScope.DeEnlist(da.SelectCommand);
}
response.Table = dataTable;
}
catch (Exception ex)
{
CleanupCommand(cmd);
throw ex;
}
finally
{
}
}
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:59,代码来源:DataProvider.cs
示例5: tgDataResponse
tgDataResponse IDataProvider.ExecuteNonQuery(tgDataRequest request)
{
tgDataResponse response = new tgDataResponse();
OleDbCommand cmd = null;
try
{
cmd = new OleDbCommand();
if(request.CommandTimeout != null) cmd.CommandTimeout = request.CommandTimeout.Value;
if(request.Parameters != null) AddParameters(cmd, request);
cmd.CommandText = request.QueryText;
switch (request.QueryType)
{
case tgQueryType.TableDirect:
cmd.CommandType = CommandType.TableDirect;
break;
case tgQueryType.StoredProcedure:
cmd.CommandType = CommandType.StoredProcedure;
break;
case tgQueryType.Text:
cmd.CommandType = CommandType.Text;
break;
}
try
{
tgTransactionScope.Enlist(cmd, request.ConnectionString, CreateIDbConnectionDelegate);
#region Profiling
if (sTraceHandler != null)
{
using (esTraceArguments esTrace = new esTraceArguments(request, cmd, "ExecuteNonQuery", System.Environment.StackTrace))
{
try
{
response.RowsEffected = cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
esTrace.Exception = ex.Message;
throw;
}
}
}
else
#endregion
{
response.RowsEffected = cmd.ExecuteNonQuery();
}
}
finally
{
tgTransactionScope.DeEnlist(cmd);
}
}
catch (Exception ex)
{
CleanupCommand(cmd);
response.Exception = ex;
}
return response;
}
开发者ID:HoosierMike,项目名称:Tiraggo,代码行数:68,代码来源:DataProvider.cs
示例6: LoadDataSetFromStoredProcedure
private static tgDataResponse LoadDataSetFromStoredProcedure(tgDataRequest request)
{
tgDataResponse response = new tgDataResponse();
SQLiteCommand cmd = null;
try
{
DataSet dataSet = new DataSet();
cmd = new SQLiteCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = Shared.CreateFullName(request);
if (request.CommandTimeout != null) cmd.CommandTimeout = request.CommandTimeout.Value;
if (request.Parameters != null) Shared.AddParameters(cmd, request);
SQLiteDataAdapter da = new SQLiteDataAdapter();
da.SelectCommand = cmd;
try
{
tgTransactionScope.Enlist(da.SelectCommand, request.ConnectionString, CreateIDbConnectionDelegate);
#region Profiling
if (sTraceHandler != null)
{
using (esTraceArguments esTrace = new esTraceArguments(request, cmd, "LoadFromStoredProcedure", System.Environment.StackTrace))
{
try
{
da.Fill(dataSet);
}
catch (Exception ex)
{
esTrace.Exception = ex.Message;
throw;
}
}
}
else
#endregion Profiling
{
da.Fill(dataSet);
}
}
finally
{
tgTransactionScope.DeEnlist(da.SelectCommand);
}
response.DataSet = dataSet;
if (request.Parameters != null)
{
Shared.GatherReturnParameters(cmd, request, response);
}
}
catch (Exception ex)
{
CleanupCommand(cmd);
throw ex;
}
finally
{
}
return response;
}
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:71,代码来源:DataProvider.cs
示例7: GatherReturnParameters
public static void GatherReturnParameters(MySqlCommand cmd, tgDataRequest request, tgDataResponse response)
{
if (cmd.Parameters.Count > 0)
{
if (request.Parameters != null && request.Parameters.Count > 0)
{
string paramPrefix = request.ProviderMetadata.spLoadByPrimaryKey == cmd.CommandText ? Delimiters.Param + "p" : Delimiters.Param;
response.Parameters = new tgParameters();
foreach (tgParameter esParam in request.Parameters)
{
if (esParam.Direction != tgParameterDirection.Input)
{
response.Parameters.Add(esParam);
MySqlParameter p = cmd.Parameters[paramPrefix + esParam.Name];
esParam.Value = p.Value;
}
}
}
}
}
开发者ID:HoosierMike,项目名称:Tiraggo,代码行数:22,代码来源:Shared.cs
示例8: LoadDataTableFromStoredProcedure
private static tgDataResponse LoadDataTableFromStoredProcedure(tgDataRequest request)
{
tgDataResponse response = new tgDataResponse();
OracleCommand cmd = null;
try
{
DataTable dataTable = new DataTable(request.ProviderMetadata.Destination);
cmd = new OracleCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = Shared.CreateFullName(request);
if (request.CommandTimeout != null) cmd.CommandTimeout = request.CommandTimeout.Value;
if (request.Parameters != null) Shared.AddParameters(cmd, request);
OracleParameter p = new OracleParameter("outCursor", OracleType.Cursor);
p.Direction = ParameterDirection.Output;
cmd.Parameters.Add(p);
OracleDataAdapter da = new OracleDataAdapter();
da.SelectCommand = cmd;
try
{
tgTransactionScope.Enlist(da.SelectCommand, request.ConnectionString, CreateIDbConnectionDelegate);
#region Profiling
if (sTraceHandler != null)
{
using (esTraceArguments esTrace = new esTraceArguments(request, cmd, "LoadFromStoredProcedure", System.Environment.StackTrace))
{
try
{
da.Fill(dataTable);
}
catch (Exception ex)
{
esTrace.Exception = ex.Message;
throw;
}
}
}
else
#endregion
{
da.Fill(dataTable);
}
}
finally
{
tgTransactionScope.DeEnlist(da.SelectCommand);
}
response.Table = dataTable;
if (request.Parameters != null)
{
Shared.GatherReturnParameters(cmd, request, response);
}
}
catch (Exception)
{
CleanupCommand(cmd);
throw;
}
finally
{
}
return response;
}
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:72,代码来源:DataProvider.cs
示例9: GatherReturnParameters
public static void GatherReturnParameters(OracleCommand cmd, tgDataRequest request, tgDataResponse response)
{
if (cmd.Parameters.Count > 0)
{
if (request.Parameters != null && request.Parameters.Count > 0)
{
string paramPrefix = request.QueryType == tgQueryType.StoredProcedure ? String.Empty : Delimiters.Param;
paramPrefix = request.ProviderMetadata.spLoadByPrimaryKey == request.QueryText ? "p" : paramPrefix;
response.Parameters = new tgParameters();
foreach (tgParameter esParam in request.Parameters)
{
if (esParam.Direction != tgParameterDirection.Input)
{
response.Parameters.Add(esParam);
OracleParameter p = cmd.Parameters[paramPrefix + esParam.Name];
esParam.Value = p.Value;
}
}
}
}
}
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:23,代码来源:Shared.cs
注:本文中的Tiraggo.Interfaces.tgDataResponse类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论