Merge pull request #1163 from AerisG222/more_mvc_fixes
[mono.git] / mcs / class / Mono.Data.Tds / Mono.Data.Tds.Protocol / Tds80.cs
index 5b541a026e83fadf28fd13d129c18cc647410fca..8d26453ecf6dc8c007c9f37625f5a71c6b56b3a7 100644 (file)
@@ -44,13 +44,25 @@ namespace Mono.Data.Tds.Protocol {
 
                #region Constructors
 
+               [Obsolete ("Use the constructor that receives a lifetime parameter")]
                public Tds80 (string server, int port)
-                       : this (server, port, 512, 15)
+                       : this (server, port, 512, 15, 0)
                {
                }
 
+               [Obsolete ("Use the constructor that receives a lifetime parameter")]
                public Tds80 (string server, int port, int packetSize, int timeout)
-                       : base (server, port, packetSize, timeout, Version)
+                       : base (server, port, packetSize, timeout, 0, Version)
+               {
+               }
+
+               public Tds80 (string server, int port, int lifetime)
+                       : this (server, port, 512, 15, lifetime)
+               {
+               }
+
+               public Tds80 (string server, int port, int packetSize, int timeout, int lifeTime)
+                       : base (server, port, packetSize, timeout, lifeTime, Version)
                {
                }
 
@@ -61,6 +73,10 @@ namespace Mono.Data.Tds.Protocol {
                protected override byte[] ClientVersion {
                        get { return new byte[] {0x00, 0x0, 0x0, 0x71};}
                }
+               protected override byte Precision {
+                       get { return 38; }
+               }
+               
                #endregion // Properties
                
                #region Methods
@@ -229,6 +245,23 @@ namespace Mono.Data.Tds.Protocol {
                                ExecuteQuery (sql, timeout, wantResults);
                        }
                }
+               
+               public override void ExecPrepared (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
+               {
+                       Parameters = parameters;
+                       // We are connected to a Sql 7.0 server
+                       if (TdsVersion < TdsVersion.tds80 || 
+                           Parameters == null || Parameters.Count < 1) {
+                               base.ExecPrepared (commandText, parameters, timeout, wantResults);
+                               return;
+                       }
+                       TdsMetaParameterCollection parms = new TdsMetaParameterCollection ();
+                       parms.Add (new TdsMetaParameter ("@Handle", "int", Int32.Parse (commandText)));
+                       foreach (TdsMetaParameter parm in Parameters)
+                               parms.Add (parm);
+                       
+                       ExecRPC ("sp_execute", parms, timeout, wantResults);                    
+               }
 
                #endregion // Methods
        }