// Author:
// Tim Coleman (tim@timcoleman.com)
// Veerapuram Varadhan (vvaradhan@novell.com)
+//
// Copyright (C) 2002 Tim Coleman
// Copyright (C) 2008,2009 Novell Inc.
//
protected override byte[] ClientVersion {
get { return new byte[] {0x00, 0x0, 0x0, 0x71};}
}
+ protected override byte Precision {
+ get { return 38; }
+ }
+
#endregion // Properties
#region Methods
public override bool Connect (TdsConnectionParameters connectionParameters)
{
+ //Console.WriteLine ("Tds80::Connect");
return base.Connect (connectionParameters);
}
- protected override TdsDataColumnCollection ProcessColumnInfo ()
+ protected override void ProcessColumnInfo ()
{
+ // We are connected to a Sql 7.0 server
+ if (TdsVersion < TdsVersion.tds80) {
+ base.ProcessColumnInfo ();
+ return;
+ }
+
// VARADHAN: TDS 8 Debugging
//Console.WriteLine ("Tds80.cs: In ProcessColumnInfo... entry");
- TdsDataColumnCollection result = new TdsDataColumnCollection ();
int numColumns = Comm.GetTdsShort ();
//Console.WriteLine ("Column count={0}", numColumns); TDS 8 Debugging
for (int i = 0; i < numColumns; i += 1) {
int columnSize;
string tableName = null;
byte[] collation = null;
+ int lcid = 0, sortId = 0;
if (IsBlobType (columnType)) {
columnSize = Comm.GetTdsInt ();
xColumnType == TdsColumnType.NText) {
// Read collation for SqlServer 2000 and beyond
collation = Comm.GetBytes (5, true);
+ lcid = TdsCollation.LCID (collation);
+ sortId = TdsCollation.SortId (collation);
}
if (IsBlobType (columnType)) {
string columnName = Comm.GetString (Comm.GetByte ());
TdsDataColumn col = new TdsDataColumn ();
- result.Add (col);
+ Columns.Add (col);
#if NET_2_0
col.ColumnType = columnType;
col.ColumnName = columnName;
col.IsReadOnly = !writable;
col.AllowDBNull = nullable;
col.BaseTableName = tableName;
+ col.LCID = lcid;
+ col.SortOrder = sortId;
#else
col ["ColumnType"] = columnType;
col ["ColumnName"] = columnName;
col ["IsReadOnly"] = !writable;
col ["AllowDBNull"] = nullable;
col ["BaseTableName"] = tableName;
+ col ["LCID"] = lcid;
+ col ["SortOrder"] = sortId;
#endif
}
//Console.WriteLine ("Tds80.cs: In ProcessColumnInfo... exit"); TDS 8 Debugging
- return result;
}
protected override void ProcessOutputParam ()
{
+ // We are connected to a Sql 7.0 server
+ if (TdsVersion < TdsVersion.tds80) {
+ base.ProcessOutputParam ();
+ return;
+ }
+
GetSubPacketLength ();
Comm.Skip ((Comm.GetByte () & 0xff) <<1); // Parameter name
OutputParameters.Add (value);
}
+ public override void Execute (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
+ {
+ // We are connected to a Sql 7.0 server
+ if (TdsVersion < TdsVersion.tds80) {
+ base.Execute (commandText, parameters, timeout, wantResults);
+ return;
+ }
+
+ 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);
+ }
+ }
+
+ 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
}
}