Esempio n. 1
0
        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

            // 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();
            }
        }
Esempio n. 2
0
        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();
            }
        }
Esempio n. 3
0
		private 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
			
			// 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 ();
		}
Esempio n. 4
0
File: Tds70.cs Progetto: shana/mono
		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 ();
		}