• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TdsMetaParameterCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TdsMetaParameterCollection的典型用法代码示例。如果您正苦于以下问题:C# TdsMetaParameterCollection类的具体用法?C# TdsMetaParameterCollection怎么用?C# TdsMetaParameterCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TdsMetaParameterCollection类属于命名空间,在下文中一共展示了TdsMetaParameterCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
		}
开发者ID:Profit0004,项目名称:mono,代码行数:33,代码来源:TdsBulkCopy.cs


示例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;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:24,代码来源:TdsBulkCopy.cs


示例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);
				}
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:22,代码来源:Tds70.cs


示例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);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:8,代码来源:Tds70.cs


示例5: ExecProc

		public override void ExecProc (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
		{
			Parameters = parameters;
			ExecRPC (commandText, parameters, timeout, wantResults);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:5,代码来源:Tds70.cs


示例6: Execute

		public virtual void Execute (string sql, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
		{
			ExecuteQuery (sql, timeout, wantResults);	
		}
开发者ID:psni,项目名称:mono,代码行数:4,代码来源:Tds.cs


示例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;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:15,代码来源:Tds70.cs


示例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 ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:16,代码来源:Tds70.cs


示例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 ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:20,代码来源:Tds70.cs


示例10: ExecPrepared

		public override void ExecPrepared (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
		{
			Parameters = parameters;
			ExecuteQuery (BuildPreparedQuery (commandText), timeout, wantResults);
		}
开发者ID:bitslasher,项目名称:mono,代码行数:5,代码来源:Tds70.cs


示例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);
		}
开发者ID:bitslasher,项目名称:mono,代码行数:8,代码来源:Tds70.cs


示例12: Prepare

		public virtual string Prepare (string sql, TdsMetaParameterCollection parameters)
		{
			throw new NotSupportedException ();
		}
开发者ID:psni,项目名称:mono,代码行数:4,代码来源:Tds.cs


示例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 ();
		}
开发者ID:shana,项目名称:mono,代码行数:44,代码来源:Tds70.cs


示例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);
			}
		}
开发者ID:psni,项目名称:mono,代码行数:26,代码来源:Tds.cs


示例15: ExecPrepared

		public virtual void ExecPrepared (string sql, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
		{
			throw new NotSupportedException ();
		}
开发者ID:psni,项目名称:mono,代码行数:4,代码来源:Tds.cs


示例16: ExecProc

		public virtual void ExecProc (string sql, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
		{
			ExecuteQuery (String.Format ("exec {0}", sql), timeout, wantResults);
		}
开发者ID:psni,项目名称:mono,代码行数:4,代码来源:Tds.cs


示例17: WritePreparedParameterInfo

		private void WritePreparedParameterInfo (TdsMetaParameterCollection parameters)
		{
			if (parameters == null)
				return;
			
			string param = BuildPreparedParameters ();
			Comm.Append ((byte) 0x00); // no param meta data name
			Comm.Append ((byte) 0x00); // no status flags
			
			// Type_info - parameter info
			WriteParameterInfo (new TdsMetaParameter ("prep_params", 
			                                          param.Length > 4000 ? "ntext" : "nvarchar", 
			                                          param));
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:14,代码来源:Tds70.cs


示例18: Prepare

		public override string Prepare (string commandText, TdsMetaParameterCollection parameters)
		{
			Parameters = parameters;

			TdsMetaParameterCollection parms = new TdsMetaParameterCollection ();
			// Tested with MS SQL 2008 RC2 Express and MS SQL 2012 Express:
			// You may pass either -1 or 0, but not null as initial value of @Handle,
			// which is an output parameter.
			TdsMetaParameter parm = new TdsMetaParameter ("@Handle", "int", -1);
			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 ();
		}
开发者ID:bitslasher,项目名称:mono,代码行数:23,代码来源:Tds70.cs


示例19: BeginExecuteQuery

 public virtual IAsyncResult BeginExecuteQuery (string sql,
                                                   TdsMetaParameterCollection parameters,
                                                   AsyncCallback callback,
                                                   object state)
 {
         // abstract, kept to be backward compatiable.
         throw new NotImplementedException ("should not be called!");
 }
开发者ID:psni,项目名称:mono,代码行数:8,代码来源:Tds.cs


示例20: Execute

		public override void Execute (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
		{
			Parameters = parameters;
			string sql = commandText;

			if (Parameters != null && Parameters.Count > 0) {
				ExecRPC (TdsRpcProcId.ExecuteSql, commandText, parameters, timeout, wantResults);
			} else {
				if (wantResults)
					sql = BuildExec (commandText);
				ExecuteQuery (sql, timeout, wantResults);
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:13,代码来源:Tds70.cs



注:本文中的TdsMetaParameterCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TdsParserState类代码示例发布时间:2022-05-24
下一篇:
C# TcpListener类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap