+2005-08-26 Sureshkumar T <tsureshkumar@novell.com>
+
+ * Tds70.cs (ExecProc): if no parameters, execute via RPC. parameter
+ support has to be added.
+
+ * Tds.cs (ExecRPC): added virtual method to execute via RPC.
+
+ This fixes bug #68978 by enabling execution of sp_reset_connection.
+
2005-08-24 Sureshkumar T <tsureshkumar@novell.com>
* Tds.cs: ProcessColumnDetail (): expression columns don't have
#region Public Methods
+ internal protected void InitExec ()
+ {
+ // clean up
+ moreResults = true;
+ doneProc = false;
+ messages.Clear ();
+ outputParameters.Clear ();
+ }
+
public void Cancel ()
{
if (queryInProgress) {
protected void ExecuteQuery (string sql, int timeout, bool wantResults)
{
- moreResults = true;
- doneProc = false;
- messages.Clear ();
- outputParameters.Clear ();
+ InitExec ();
Comm.StartPacket (TdsPacketType.Query);
Comm.Append (sql);
SkipToEnd ();
}
+ 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);
+
+ Comm.SendPacket ();
+ CheckForData (timeout);
+ if (!wantResults)
+ SkipToEnd ();
+ }
+
public bool NextResult ()
{
if (!moreResults)
protected IAsyncResult BeginExecuteQueryInternal (string sql, bool wantResults,
AsyncCallback callback, object state)
{
- moreResults = true;
- doneProc = false;
- messages.Clear ();
- outputParameters.Clear ();
+ InitExec ();
TdsAsyncResult ar = new TdsAsyncResult (callback, state);
ar.TdsAsyncState.WantResults = wantResults;
public override void ExecProc (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
{
- Parameters = parameters;
- ExecuteQuery (BuildProcedureCall (commandText), timeout, wantResults);
+ if (parameters != null && parameters.Count > 0) {
+ Parameters = parameters;
+ ExecuteQuery (BuildProcedureCall (commandText), timeout, wantResults);
+ } else {
+ ExecRPC (commandText, parameters, timeout, wantResults);
+ }
+ }
+
+ 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
+
+ // FIXME : support parameters here
+
+ Comm.SendPacket ();
+ CheckForData (timeout);
+ if (!wantResults)
+ SkipToEnd ();
+
}
public override void Execute (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
}
internal Encoding Encoder {
+ get { return encoder; }
set { encoder = value; }
}
Logon70 = 0x10,
SspAuth = 0x11,
Logoff = 0x71,
- Normal = 0x0f
+ Normal = 0x0f,
+ DBRPC = 0xe6,
+ RPC = 0x3
}
}
+2005-08-26 Sureshkumar T <tsureshkumar@novell.com>
+
+ * SqlConnection.cs (Open): enable sp_reset_connection.
+
2005-08-25 Sureshkumar T <tsureshkumar@novell.com>
* SqlCommandBuilder.cs: BuildInformation (): continue on columns
pool.ReleaseConnection (tds);
throw;
}
+ } else if (connectionReset) {
+ tds.Reset ();
}
- /* Not sure ebout removing these 2 lines.
- * The command that gets to the sql server is just
- * 'sp_reset_connection' and it fails.
- * Either remove them definitely or fix it
- else if (connectionReset)
- tds.ExecProc ("sp_reset_connection");
- */
disposed = false; // reset this, so using () would call Close ().
ChangeState (ConnectionState.Open);
}