本文整理汇总了C#中FirebirdSql.Data.FirebirdClient.FbCommand.CreateParameter方法的典型用法代码示例。如果您正苦于以下问题:C# FbCommand.CreateParameter方法的具体用法?C# FbCommand.CreateParameter怎么用?C# FbCommand.CreateParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FirebirdSql.Data.FirebirdClient.FbCommand
的用法示例。
在下文中一共展示了FbCommand.CreateParameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDataRecords
public void AddDataRecords(IEnumerable<DataRecord> data, out int newData, out int NewTags)
{
newData = 0;
NewTags = 0;
lock (_conw)
{
if (cts.IsCancellationRequested) return;
StoppedEvent.Reset();
if (_conw.State != System.Data.ConnectionState.Open)
_conw.Open();
try
{
var ttTc = Helpers.TickCount;
long diTc = 0, mTc = 0, tTc = 0, tiTc = 0, tc = 0;
bool failed = false;
using (var tr = _conw.BeginTransaction(_writeTransactionOptions))
{
//var removed = new List<long>();
try
{
var md5 = new Dictionary<int, long>();
using (FbCommand cmd = new FbCommand(string.Empty, _conw, tr)/*, cmd1_5 = new FbCommand(string.Empty, _con, tr)*/)
{
long mc = cmd.GetGeneratorValue("GEN_MD5_INDEX");
List<string> tgs = new List<string>();
var mlMD5 = cmd.CreateParameter();
var mlRating = cmd.CreateParameter();
var mlMD5Id = cmd.CreateParameter();
mlMD5Id.Direction = System.Data.ParameterDirection.Output;
cmd.Parameters.AddRange(new FbParameter[] { mlMD5, mlRating, mlMD5Id });
cmd.CommandText = "update or insert into MD5_LIST (MD5, RATING) values (?,?) MATCHING (MD5) returning MD5_ID";
using (
FbCommand cmd2 = new FbCommand("update or insert into SERVERS_LIST (SERVER_NAME, SERVER_GROUP_ID) values (?,?) matching (SERVER_NAME) returning SERVER_ID", _conw, tr),
cmd3 = new FbCommand("update or insert into DATA_INFO (DATA_MD5_ID, DATA_SERVER_ID, DATA_POST_NUMBER, DATA_EXT_ID, DATA_SIZE, AUTOR_ID, CHILD_POST, PARENT_POST) values (?,?,?,?,?,?,?,?) matching (DATA_MD5_ID, DATA_SERVER_ID)", _conw, tr),
cmd4 = new FbCommand("update or insert into EXT_LIST (EXT) values (?) matching (EXT) returning EXT_ID", _conw, tr),
cmd5 = new FbCommand("update or insert into AUTORS (AUTOR) values (?) matching (AUTOR) returning AUTOR_ID", _conw, tr)
)
{
#region parameters
#region SERVERS_LIST
var slServerName = cmd2.CreateParameter();
var slServerGroup = cmd2.CreateParameter();
var slServerId = cmd2.CreateParameter();
slServerId.Direction = System.Data.ParameterDirection.Output;
cmd2.Parameters.AddRange(new[] { slServerName, slServerGroup, slServerId });
#endregion
#region DATA_INFO
var diMD5Id = cmd3.CreateParameter();
var diServerId = cmd3.CreateParameter();
var diPost = cmd3.CreateParameter();
var diExtId = cmd3.CreateParameter();
var diFileSize = cmd3.CreateParameter();
var diAutorId = cmd3.CreateParameter();
var diParentPost = cmd3.CreateParameter();
var diChildPost = cmd3.CreateParameter();
cmd3.Parameters.AddRange(new[] { diMD5Id, diServerId, diPost, diExtId, diFileSize, diAutorId, diChildPost, diParentPost });
#endregion
#region EXT_LIST
var elExt = cmd4.CreateParameter();
var elExtId = cmd4.CreateParameter();
elExtId.Direction = System.Data.ParameterDirection.Output;
cmd4.Parameters.AddRange(new[] { elExt, elExtId });
#endregion
#region AUTORS
var aAutor = cmd5.CreateParameter();
var aAutorId = cmd5.CreateParameter();
aAutorId.Direction = System.Data.ParameterDirection.Output;
cmd5.Parameters.AddRange(new[] { aAutor, aAutorId });
#endregion
#endregion
var autors = new Dictionary<string, int>();
var exts = new Dictionary<string, int>();
var servers = new Dictionary<string, int>();
int i = 0;
foreach (var d in data)
if (!string.IsNullOrWhiteSpace(d.MD5) && d.Servers != null)
{
i++;
mlMD5.Value = d.MD5;
mlRating.Value = (Char)d.Rating;
tc = Helpers.TickCount;
if (cmd.ExecuteNonQuery() > 0)
{
mTc += Helpers.TickCount - tc;
long id = md5[i] = (long)mlMD5Id.Value;
diMD5Id.Value = id;
if (mc < id)
newData++;
int indx = 0;
#region preparing tags list
if (d.Tags != null)
//.........这里部分代码省略.........