+2009-02-26 Veerapuram Varadhan <vvaradhan@novell.com>
+
+ * Tds.cs (ProcessLoginAck): Set TdsVersion to the version
+ supported by the server.
+ (GetColumnValue): lcid and sortId are available only from Tds 8.
+
+ * Tds80.cs (ProcessColumnInfo, ProcessOutputParam): Call base
+ methods if the server version is less than Tds 8.
+
2009-02-19 Veerapuram Varadhan <vvaradhan@novell.com>
* Tds.cs: Tds 8 collation support
if (colType == null)
throw new ArgumentNullException ("colType");
#endif
- if (ordinal > -1) {
+ if (ordinal > -1 && tdsVersion > TdsVersion.tds70) {
#if NET_2_0
lcid = (int) columns[ordinal].LCID;
sortId = (int) columns[ordinal].SortOrder;
(colType == TdsColumnType.BigChar || colType == TdsColumnType.BigNVarChar ||
colType == TdsColumnType.BigVarChar || colType == TdsColumnType.NChar ||
colType == TdsColumnType.NVarChar)) {
- // Read collation for SqlServer 2000 and beyond
- byte[] collation;
- collation = Comm.GetBytes (5, true);
- enc = TdsCharset.GetEncoding (collation);
- //comm.Skip (5);
- shortLen = true;
+ // Read collation for SqlServer 2000 and beyond
+ byte[] collation;
+ collation = Comm.GetBytes (5, true);
+ enc = TdsCharset.GetEncoding (collation);
+ shortLen = true;
} else {
shortLen = (tdsVersion >= TdsVersion.tds70) && (wideChars || !outputParam);
}
protected void ProcessLoginAck ()
{
- //TODO: Reade the server version and process packets accordingly
+ uint srvVersion = 0;
GetSubPacketLength ();
+
+ // Valid only for a Login7 request
+ if (tdsVersion >= TdsVersion.tds70) {
+ comm.Skip (1);
+ srvVersion = (uint)comm.GetTdsInt ();
+ switch (srvVersion) {
+ case 0x07000000:
+ tdsVersion = TdsVersion.tds70;
+ break;
+ case 0x07010000:
+ tdsVersion = TdsVersion.tds80;
+ break;
+ case 0x71000001:
+ tdsVersion = TdsVersion.tds81;
+ break;
+ case 0x72090002:
+ tdsVersion = TdsVersion.tds90;
+ break;
+ }
+ }
+
if (tdsVersion >= TdsVersion.tds70) {
- comm.Skip (5);
int nameLength = comm.GetByte ();
databaseProductName = comm.GetString (nameLength);
databaseMajorVersion = comm.GetByte ();
databaseProductVersion = String.Format ("{0}.{1}.{2}", databaseMajorVersion.ToString("00"),
comm.GetByte ().ToString("00"),
(256 * comm.GetByte () + comm.GetByte ()).ToString("0000"));
- // VARADHAN: TDS 8 Debugging
- /*
- Console.WriteLine ("tdsVersion >= tds70");
- Console.WriteLine ("\t Name: {0}, version: {1}", databaseProductName, databaseProductVersion);
- */
- }
- else {
+ } else {
comm.Skip (5);
short nameLength = comm.GetByte ();
databaseProductName = comm.GetString (nameLength);
protected override TdsDataColumnCollection ProcessColumnInfo ()
{
+ // We are connected to a Sql 7.0 server
+ if (TdsVersion < TdsVersion.tds80)
+ return base.ProcessColumnInfo ();
+
// VARADHAN: TDS 8 Debugging
//Console.WriteLine ("Tds80.cs: In ProcessColumnInfo... entry");
TdsDataColumnCollection result = new TdsDataColumnCollection ();
protected override void ProcessOutputParam ()
{
+ // We are connected to a Sql 7.0 server
+ if (TdsVersion < TdsVersion.tds80)
+ base.ProcessOutputParam ();
+
GetSubPacketLength ();
Comm.Skip ((Comm.GetByte () & 0xff) <<1); // Parameter name