get;
}
- SchemaInfo[] Schema {
+ TdsPacketColumnInfoResult Schema {
get;
}
get { return databaseProductVersion; }
}
- public SchemaInfo[] Schema {
- get { return columnInfo.Schema; }
+ public TdsPacketColumnInfoResult Schema {
+ get { return columnInfo; }
}
public TdsPacketRowResult ColumnValues {
TdsPacketRowResult result = new TdsPacketRowResult (context);
int i = 0;
- foreach (TdsColumnType type in columnInfo.ColumnTypes) {
- result.Add (GetColumnValue (type, false, i));
+ foreach (TdsSchemaInfo schema in columnInfo) {
+ result.Add (GetColumnValue (schema.ColumnType, false, i));
i += 1;
}
bytesRead += 1;
}
- int index = result.Add (new SchemaInfo ());
- result[index].DataTypeName = columnType.ToString ();
+ int index = result.Add (new TdsSchemaInfo ());
result[index].NumericPrecision = precision;
result[index].NumericScale = scale;
result[index].ColumnSize = bufLength;
result[index].ColumnName = ColumnNames[index];
+ result[index].ColumnType = columnType;
result[index].TableName = tableName;
- result[index].Nullable = nullable;
- result[index].Writable = writable;
-
- result.Add (columnType);
+ result[index].AllowDBNull = nullable;
+ result[index].IsReadOnly = !writable;
}
//int skipLength = totalLength - bytesRead;
bytesRead += 1;
}
- int index = result.Add (new SchemaInfo ());
- result[index].DataTypeName = columnType.ToString ();
+ int index = result.Add (new TdsSchemaInfo ());
result[index].NumericPrecision = precision;
result[index].NumericScale = scale;
result[index].ColumnSize = bufLength;
result[index].ColumnName = ColumnNames[index];
result[index].TableName = tableName;
- result[index].Nullable = nullable;
- result[index].Writable = writable;
-
- result.Add (columnType);
+ result[index].AllowDBNull = nullable;
+ result[index].IsReadOnly = !writable;
+ result[index].ColumnType = columnType;
}
//int skipLength = totalLength - bytesRead;
bool caseSensitive = (flagData[2] & 0x02) > 0;
bool writable = (flagData[2] & 0x0c) > 0;
bool autoIncrement = (flagData[2] & 0x10) > 0;
+ bool isIdentity = (flagData[2] & 0x10) > 0;
TdsColumnType columnType = (TdsColumnType) (Comm.GetByte () & 0xff);
if ((byte) columnType == 0xef)
//int dispSize = -1;
int bufLength;
- string tableName = "";
+ string tableName = null;
if (IsBlobType (columnType)) {
bufLength = Comm.GetTdsInt ();
int colNameLength = Comm.GetByte ();
string columnName = Comm.GetString (colNameLength);
- int index = result.Add (new SchemaInfo ());
- result[index].DataTypeName = columnType.ToString ();
+ int index = result.Add (new TdsSchemaInfo ());
+ result[index].AllowDBNull = nullable;
+ result[index].ColumnName = columnName;
+ result[index].ColumnSize = bufLength;
+ result[index].ColumnType = columnType;
+ result[index].IsIdentity = isIdentity;
+ result[index].IsReadOnly = !writable;
result[index].NumericPrecision = precision;
result[index].NumericScale = scale;
- result[index].ColumnSize = bufLength;
- result[index].ColumnName = columnName;
result[index].TableName = tableName;
- result[index].Nullable = nullable;
- result[index].Writable = writable;
-
- result.Add (columnType);
}
return result;
#region Fields
ArrayList list;
- ArrayList columnTypes;
#endregion // Fields
: base (TdsPacketSubType.ColumnNameToken)
{
list = new ArrayList ();
- columnTypes = new ArrayList ();
}
#endregion // Constructors
#region Properties
- public SchemaInfo[] Schema {
- get { return (SchemaInfo[]) list.ToArray (typeof (SchemaInfo)); }
- }
-
- public SchemaInfo this [int index] {
- get { return (SchemaInfo) list[index]; }
+ public TdsSchemaInfo this [int index] {
+ get { return (TdsSchemaInfo) list[index]; }
set { list[index] = value; }
}
- public ArrayList ColumnTypes {
- get { return columnTypes; }
- }
-
#endregion // Properties
#region Methods
- public int Add (SchemaInfo schema)
+ public int Add (TdsSchemaInfo schema)
{
int index;
index = list.Add (schema);
return list.GetEnumerator ();
}
- public int Add (TdsColumnType columnType)
- {
- return columnTypes.Add (columnType);
- }
-
#endregion // Methods
}
}
--- /dev/null
+//
+// System.Data.Common.TdsSchemaInfo.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace Mono.Data.TdsClient.Internal {
+ internal class TdsSchemaInfo
+ {
+ #region Fields
+
+ string columnName;
+ string tableName;
+ TdsColumnType columnType;
+ object value;
+ bool nullable;
+ bool isReadOnly;
+ bool isIdentity = false;
+ bool isKey;
+ int ordinal;
+ int size;
+ byte precision;
+ byte scale;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsSchemaInfo ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool AllowDBNull {
+ get { return nullable; }
+ set { nullable = value; }
+ }
+
+ public int ColumnOrdinal {
+ get { return ordinal; }
+ set { ordinal = value; }
+ }
+
+ public string ColumnName {
+ get { return columnName; }
+ set { columnName = value; }
+ }
+
+ public int ColumnSize {
+ get { return size; }
+ set { size = value; }
+ }
+
+ public TdsColumnType ColumnType {
+ get { return columnType; }
+ set { columnType = value; }
+ }
+
+ public bool IsIdentity {
+ get { return isIdentity; }
+ set { isIdentity = value; }
+ }
+
+ public bool IsKey {
+ get { return isKey; }
+ set { isKey = value; }
+ }
+
+ public bool IsReadOnly {
+ get { return isReadOnly; }
+ set { isReadOnly = value; }
+ }
+
+ public byte NumericPrecision {
+ get { return precision; }
+ set { precision = value; }
+ }
+
+ public byte NumericScale {
+ get { return scale; }
+ set { scale = value; }
+ }
+
+ public string TableName {
+ get { return tableName; }
+ set { tableName = value; }
+ }
+
+ #endregion // Properties
+
+ }
+}
get;
}
- SchemaInfo[] Schema {
+ TdsPacketColumnInfoResult Schema {
get;
}
get { return databaseProductVersion; }
}
- public SchemaInfo[] Schema {
- get { return columnInfo.Schema; }
+ public TdsPacketColumnInfoResult Schema {
+ get { return columnInfo; }
}
public TdsPacketRowResult ColumnValues {
TdsPacketRowResult result = new TdsPacketRowResult (context);
int i = 0;
- foreach (TdsColumnType type in columnInfo.ColumnTypes) {
- result.Add (GetColumnValue (type, false, i));
+ foreach (TdsSchemaInfo schema in columnInfo) {
+ result.Add (GetColumnValue (schema.ColumnType, false, i));
i += 1;
}
bytesRead += 1;
}
- int index = result.Add (new SchemaInfo ());
- result[index].DataTypeName = columnType.ToString ();
+ int index = result.Add (new TdsSchemaInfo ());
result[index].NumericPrecision = precision;
result[index].NumericScale = scale;
result[index].ColumnSize = bufLength;
result[index].ColumnName = ColumnNames[index];
+ result[index].ColumnType = columnType;
result[index].TableName = tableName;
- result[index].Nullable = nullable;
- result[index].Writable = writable;
-
- result.Add (columnType);
+ result[index].AllowDBNull = nullable;
+ result[index].IsReadOnly = !writable;
}
//int skipLength = totalLength - bytesRead;
bytesRead += 1;
}
- int index = result.Add (new SchemaInfo ());
- result[index].DataTypeName = columnType.ToString ();
+ int index = result.Add (new TdsSchemaInfo ());
result[index].NumericPrecision = precision;
result[index].NumericScale = scale;
result[index].ColumnSize = bufLength;
result[index].ColumnName = ColumnNames[index];
result[index].TableName = tableName;
- result[index].Nullable = nullable;
- result[index].Writable = writable;
-
- result.Add (columnType);
+ result[index].AllowDBNull = nullable;
+ result[index].IsReadOnly = !writable;
+ result[index].ColumnType = columnType;
}
//int skipLength = totalLength - bytesRead;
bool caseSensitive = (flagData[2] & 0x02) > 0;
bool writable = (flagData[2] & 0x0c) > 0;
bool autoIncrement = (flagData[2] & 0x10) > 0;
+ bool isIdentity = (flagData[2] & 0x10) > 0;
TdsColumnType columnType = (TdsColumnType) (Comm.GetByte () & 0xff);
if ((byte) columnType == 0xef)
//int dispSize = -1;
int bufLength;
- string tableName = "";
+ string tableName = null;
if (IsBlobType (columnType)) {
bufLength = Comm.GetTdsInt ();
int colNameLength = Comm.GetByte ();
string columnName = Comm.GetString (colNameLength);
- int index = result.Add (new SchemaInfo ());
- result[index].DataTypeName = columnType.ToString ();
+ int index = result.Add (new TdsSchemaInfo ());
+ result[index].AllowDBNull = nullable;
+ result[index].ColumnName = columnName;
+ result[index].ColumnSize = bufLength;
+ result[index].ColumnType = columnType;
+ result[index].IsIdentity = isIdentity;
+ result[index].IsReadOnly = !writable;
result[index].NumericPrecision = precision;
result[index].NumericScale = scale;
- result[index].ColumnSize = bufLength;
- result[index].ColumnName = columnName;
result[index].TableName = tableName;
- result[index].Nullable = nullable;
- result[index].Writable = writable;
-
- result.Add (columnType);
}
return result;
#region Fields
ArrayList list;
- ArrayList columnTypes;
#endregion // Fields
: base (TdsPacketSubType.ColumnNameToken)
{
list = new ArrayList ();
- columnTypes = new ArrayList ();
}
#endregion // Constructors
#region Properties
- public SchemaInfo[] Schema {
- get { return (SchemaInfo[]) list.ToArray (typeof (SchemaInfo)); }
- }
-
- public SchemaInfo this [int index] {
- get { return (SchemaInfo) list[index]; }
+ public TdsSchemaInfo this [int index] {
+ get { return (TdsSchemaInfo) list[index]; }
set { list[index] = value; }
}
- public ArrayList ColumnTypes {
- get { return columnTypes; }
- }
-
#endregion // Properties
#region Methods
- public int Add (SchemaInfo schema)
+ public int Add (TdsSchemaInfo schema)
{
int index;
index = list.Add (schema);
return list.GetEnumerator ();
}
- public int Add (TdsColumnType columnType)
- {
- return columnTypes.Add (columnType);
- }
-
#endregion // Methods
}
}
--- /dev/null
+//
+// System.Data.Common.TdsSchemaInfo.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace Mono.Data.TdsClient.Internal {
+ internal class TdsSchemaInfo
+ {
+ #region Fields
+
+ string columnName;
+ string tableName;
+ TdsColumnType columnType;
+ object value;
+ bool nullable;
+ bool isReadOnly;
+ bool isIdentity = false;
+ bool isKey;
+ int ordinal;
+ int size;
+ byte precision;
+ byte scale;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsSchemaInfo ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool AllowDBNull {
+ get { return nullable; }
+ set { nullable = value; }
+ }
+
+ public int ColumnOrdinal {
+ get { return ordinal; }
+ set { ordinal = value; }
+ }
+
+ public string ColumnName {
+ get { return columnName; }
+ set { columnName = value; }
+ }
+
+ public int ColumnSize {
+ get { return size; }
+ set { size = value; }
+ }
+
+ public TdsColumnType ColumnType {
+ get { return columnType; }
+ set { columnType = value; }
+ }
+
+ public bool IsIdentity {
+ get { return isIdentity; }
+ set { isIdentity = value; }
+ }
+
+ public bool IsKey {
+ get { return isKey; }
+ set { isKey = value; }
+ }
+
+ public bool IsReadOnly {
+ get { return isReadOnly; }
+ set { isReadOnly = value; }
+ }
+
+ public byte NumericPrecision {
+ get { return precision; }
+ set { precision = value; }
+ }
+
+ public byte NumericScale {
+ get { return scale; }
+ set { scale = value; }
+ }
+
+ public string TableName {
+ get { return tableName; }
+ set { tableName = value; }
+ }
+
+ #endregion // Properties
+
+ }
+}