本文整理汇总了C#中TdsMetaParameterCollection类的典型用法代码示例。如果您正苦于以下问题:C# TdsMetaParameterCollection类的具体用法?C# TdsMetaParameterCollection怎么用?C# TdsMetaParameterCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TdsMetaParameterCollection类属于命名空间,在下文中一共展示了TdsMetaParameterCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BulkCopyStart
public bool BulkCopyStart (TdsMetaParameterCollection parameters)
{
tds.Comm.StartPacket (TdsPacketType.Bulk);
tds.Comm.Append ((byte) TdsPacketSubType.ColumnMetadata);
short count = 0;
foreach (TdsMetaParameter param in parameters) {
if (param.Value != null)
continue;
count++;
}
tds.Comm.Append (count);
if (parameters != null) {
foreach (TdsMetaParameter param in parameters) {
if (param.Value != null)
continue;
tds.Comm.Append ((short) 0x00);
if (param.IsNullable) {
// fNullable = true
// usUpdateable = Unused/Unkown
tds.Comm.Append ((short) 0x09);
} else {
// usUpdateable = Unused/Unkown
tds.Comm.Append ((short) 0x08);
}
WriteParameterInfo (param);
tds.Comm.Append ((byte) param.ParameterName.Length);
tds.Comm.Append (param.ParameterName);
}
}
return true;
}
示例2: BulkCopyStart
public bool BulkCopyStart (TdsMetaParameterCollection parameters)
{
tds.Comm.StartPacket (TdsPacketType.Bulk);
tds.Comm.Append ((byte) TdsPacketSubType.ColumnMetadata);
short count = 0;
foreach (TdsMetaParameter param in parameters) {
if (param.Value != null)
continue;
count++;
}
tds.Comm.Append (count);
if (parameters != null) {
foreach (TdsMetaParameter param in parameters) {
if (param.Value != null)
continue;
tds.Comm.Append ((short) 0x00);
tds.Comm.Append ((short) 0x0a);
WriteParameterInfo (param);
tds.Comm.Append ((byte) param.ParameterName.Length);
tds.Comm.Append (param.ParameterName);
}
}
return true;
}
示例3: WriteRpcParameterInfo
private void WriteRpcParameterInfo (TdsMetaParameterCollection parameters)
{
if (parameters != null) {
foreach (TdsMetaParameter param in parameters) {
if (param.Direction == TdsParameterDirection.ReturnValue)
continue;
string pname = param.ParameterName;
if (pname != null && pname.Length > 0 && pname [0] == '@') {
Comm.Append ( (byte) pname.Length);
Comm.Append (pname);
} else {
Comm.Append ( (byte) (pname.Length + 1));
Comm.Append ("@" + pname);
}
short status = 0; // unused
if (param.Direction != TdsParameterDirection.Input)
status |= 0x01; // output
Comm.Append ( (byte) status);
WriteParameterInfo (param);
}
}
}
示例4: ExecPrepared
public override void ExecPrepared (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
{
Parameters = parameters;
if (Parameters != null && Parameters.Count > 0)
ExecRPC (TdsRpcProcId.ExecuteSql, commandText, parameters, timeout, wantResults);
else
ExecuteQuery (BuildPreparedQuery (commandText), timeout, wantResults);
}
示例5: ExecProc
public override void ExecProc (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
{
Parameters = parameters;
ExecRPC (commandText, parameters, timeout, wantResults);
}
示例6: Execute
public virtual void Execute (string sql, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
{
ExecuteQuery (sql, timeout, wantResults);
}
示例7: BeginExecuteProcedure
public override IAsyncResult BeginExecuteProcedure (string prolog,
string epilog,
string cmdText,
bool IsNonQuery,
TdsMetaParameterCollection parameters,
AsyncCallback callback,
object state)
{
Parameters = parameters;
string pcall = BuildProcedureCall (cmdText);
string sql = String.Format ("{0};{1};{2};", prolog, pcall, epilog);
IAsyncResult ar = BeginExecuteQueryInternal (sql, !IsNonQuery, callback, state);
return ar;
}
示例8: ExecRPC
protected override void ExecRPC (string rpcName, TdsMetaParameterCollection parameters,
int timeout, bool wantResults)
{
// clean up
InitExec ();
Comm.StartPacket (TdsPacketType.RPC);
Comm.Append ( (short) rpcName.Length);
Comm.Append (rpcName);
Comm.Append ( (short) 0); //no meta data
WriteRpcParameterInfo (parameters);
Comm.SendPacket ();
CheckForData (timeout);
if (!wantResults)
SkipToEnd ();
}
示例9: Prepare
public override string Prepare (string commandText, TdsMetaParameterCollection parameters)
{
Parameters = parameters;
TdsMetaParameterCollection parms = new TdsMetaParameterCollection ();
TdsMetaParameter parm = new TdsMetaParameter ("@Handle", "int", null);
parm.Direction = TdsParameterDirection.Output;
parms.Add (parm);
parms.Add (new TdsMetaParameter ("@VarDecl", "nvarchar", BuildPreparedParameters ()));
parms.Add (new TdsMetaParameter ("@Query", "nvarchar", commandText));
ExecProc ("sp_prepare", parms, 0, true);
SkipToEnd ();
return OutputParameters[0].ToString () ;
//if (ColumnValues == null || ColumnValues [0] == null || ColumnValues [0] == DBNull.Value)
// throw new TdsInternalException ();
//return string.Empty;
//return ColumnValues [0].ToString ();
}
示例10: ExecPrepared
public override void ExecPrepared (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
{
Parameters = parameters;
ExecuteQuery (BuildPreparedQuery (commandText), timeout, wantResults);
}
示例11: Execute
public override void Execute (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
{
Parameters = parameters;
string sql = commandText;
if (wantResults || (Parameters != null && Parameters.Count > 0))
sql = BuildExec (commandText);
ExecuteQuery (sql, timeout, wantResults);
}
示例12: Prepare
public virtual string Prepare (string sql, TdsMetaParameterCollection parameters)
{
throw new NotSupportedException ();
}
示例13: ExecRPC
protected void ExecRPC (TdsRpcProcId rpcId, string sql,
TdsMetaParameterCollection parameters,
int timeout, bool wantResults)
{
// clean up
InitExec ();
Comm.StartPacket (TdsPacketType.RPC);
Comm.Append ((ushort) 0xFFFF);
Comm.Append ((ushort) rpcId);
Comm.Append ((short) 0x02); // no meta data
Comm.Append ((byte) 0x00); // no param meta data name
Comm.Append ((byte) 0x00); // no status flags
// Convert BigNVarChar values larger than 4000 chars to nvarchar(max)
// Need to do this here so WritePreparedParameterInfo emit the
// correct data type
foreach (TdsMetaParameter param2 in parameters) {
var colType = param2.GetMetaType ();
if (colType == TdsColumnType.BigNVarChar) {
int size = param2.GetActualSize ();
if ((size >> 1) > 4000)
param2.Size = -1;
}
}
// Write sql as a parameter value - UCS2
TdsMetaParameter param = new TdsMetaParameter ("sql",
sql.Length > 4000 ? "ntext":"nvarchar",
sql);
WriteParameterInfo (param);
// Write Parameter infos - name and type
WritePreparedParameterInfo (parameters);
// Write parameter/value info
WriteRpcParameterInfo (parameters);
Comm.SendPacket ();
CheckForData (timeout);
if (!wantResults)
SkipToEnd ();
}
示例14: ExecRPC
protected virtual void ExecRPC (string rpcName, TdsMetaParameterCollection parameters,
int timeout, bool wantResults)
{
Comm.StartPacket (TdsPacketType.DBRPC);
byte [] rpcNameBytes = Comm.Encoder.GetBytes (rpcName);
byte rpcNameLength = (byte) rpcNameBytes.Length;
ushort mask = 0x0000;
ushort packetLength = (ushort) (sizeof (byte) + rpcNameLength +
sizeof (ushort));
Comm.Append (packetLength);
Comm.Append (rpcNameLength);
Comm.Append (rpcNameBytes);
Comm.Append (mask);
try {
Comm.SendPacket ();
CheckForData (timeout);
if (!wantResults)
SkipToEnd ();
} catch (IOException ex) {
connected = false;
throw new TdsInternalException ("Server closed the connection.", ex);
}
}
示例15: ExecPrepared
public virtual void ExecPrepared (string sql, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
{
throw new NotSupportedException ();
}