Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -240,13 +240,9 @@ namespace Mono.Data.Tds.Protocol
throw new Exception ("Cannot Skip to a colindex less than the curr index");
while (colIndex != StreamColumnIndex) {
#if NET_2_0
TdsColumnType? colType = Columns[StreamColumnIndex].ColumnType;
if (colType == null)
throw new Exception ("Column type unset.");
#else
TdsColumnType colType = (TdsColumnType) Columns [StreamColumnIndex]["ColumnType"];
#endif
if (!(colType == TdsColumnType.Image ||
colType == TdsColumnType.Text ||
colType == TdsColumnType.NText)) {
@@ -273,11 +269,7 @@ namespace Mono.Data.Tds.Protocol
if (colIndex != StreamColumnIndex)
SkipToColumnIndex (colIndex);
#if NET_2_0
object o = GetColumnValue (Columns[colIndex].ColumnType, false, colIndex);
#else
object o = GetColumnValue ((TdsColumnType)Columns[colIndex]["ColumnType"], false, colIndex);
#endif
StreamColumnIndex++;
return o;
}
@@ -291,11 +283,7 @@ namespace Mono.Data.Tds.Protocol
SkipToColumnIndex (colIndex);
if (!LoadInProgress) {
#if NET_2_0
BeginLoad (Columns[colIndex].ColumnType);
#else
BeginLoad ((TdsColumnType)Columns[colIndex]["ColumnType"]);
#endif
}
if (buffer == null)
@@ -308,11 +296,7 @@ namespace Mono.Data.Tds.Protocol
}
private void BeginLoad (
#if NET_2_0
TdsColumnType? colType
#else
TdsColumnType colType
#endif
)
{
if (LoadInProgress)
@@ -320,10 +304,8 @@ namespace Mono.Data.Tds.Protocol
StreamLength = 0;
#if NET_2_0
if (colType == null)
throw new ArgumentNullException ("colType");
#endif
switch (colType) {
case TdsColumnType.Text :
@@ -757,22 +739,14 @@ namespace Mono.Data.Tds.Protocol
}
protected object GetColumnValue (
#if NET_2_0
TdsColumnType? colType,
#else
TdsColumnType colType,
#endif
bool outParam)
{
return GetColumnValue (colType, outParam, -1);
}
private object GetColumnValue (
#if NET_2_0
TdsColumnType? colType,
#else
TdsColumnType colType,
#endif
bool outParam, int ordinal)
{
int len;
@@ -780,18 +754,11 @@ namespace Mono.Data.Tds.Protocol
Encoding enc = null;
int lcid = 0, sortId = 0;
#if NET_2_0
if (colType == null)
throw new ArgumentNullException ("colType");
#endif
if (ordinal > -1 && tdsVersion > TdsVersion.tds70) {
#if NET_2_0
lcid = (int) columns[ordinal].LCID;
sortId = (int) columns[ordinal].SortOrder;
#else
lcid = (int) columns[ordinal]["LCID"];
sortId = (int) columns[ordinal]["SortOrder"];
#endif
}
switch (colType) {
@@ -897,13 +864,8 @@ namespace Mono.Data.Tds.Protocol
scale = comm.GetByte ();
}
else {
#if NET_2_0
precision = (byte) columns[ordinal].NumericPrecision;
scale = (byte) columns[ordinal].NumericScale;
#else
precision = (byte) columns[ordinal]["NumericPrecision"];
scale = (byte) columns[ordinal]["NumericScale"];
#endif
}
element = GetDecimalValue (precision, scale);
@@ -995,20 +957,14 @@ namespace Mono.Data.Tds.Protocol
}
private object GetDateTimeValue (
#if NET_2_0
TdsColumnType? type
#else
TdsColumnType type
#endif
)
{
int len = 0;
object result;
#if NET_2_0
if (type == null)
throw new ArgumentNullException ("type");
#endif
switch (type) {
case TdsColumnType.DateTime4:
len = 4;
@@ -1120,17 +1076,11 @@ namespace Mono.Data.Tds.Protocol
}
private object GetFloatValue (
#if NET_2_0
TdsColumnType? columnType
#else
TdsColumnType columnType
#endif
)
{
#if NET_2_0
if (columnType == null)
throw new ArgumentNullException ("columnType");
#endif
int columnSize = 0;
switch (columnType) {
@@ -1172,19 +1122,13 @@ namespace Mono.Data.Tds.Protocol
}
private object GetIntValue (
#if NET_2_0
TdsColumnType? type
#else
TdsColumnType type
#endif
)
{
int len;
#if NET_2_0
if (type == null)
throw new ArgumentNullException ("type");
#endif
switch (type) {
case TdsColumnType.BigInt :
len = 8;
@@ -1220,19 +1164,13 @@ namespace Mono.Data.Tds.Protocol
}
private object GetMoneyValue (
#if NET_2_0
TdsColumnType? type
#else
TdsColumnType type
#endif
)
{
int len;
#if NET_2_0
if (type == null)
throw new ArgumentNullException ("type");
#endif
switch (type) {
case TdsColumnType.SmallMoney :
case TdsColumnType.Money4 :
@@ -1273,11 +1211,7 @@ namespace Mono.Data.Tds.Protocol
}
protected object GetStringValue (
#if NET_2_0
TdsColumnType? colType,
#else
TdsColumnType colType,
#endif
bool wideChars, bool outputParam, Encoding encoder)
{
bool shortLen = false;
@@ -1416,11 +1350,7 @@ namespace Mono.Data.Tds.Protocol
int i = 0;
foreach (TdsDataColumn column in columns) {
#if NET_2_0
object o = GetColumnValue (column.ColumnType, false, i);
#else
object o = GetColumnValue ((TdsColumnType)column["ColumnType"], false, i);
#endif
currentRow.Add (o);
if (doneProc)
outputParameters.Add (o);
@@ -1514,21 +1444,12 @@ namespace Mono.Data.Tds.Protocol
bool isExpression = ((values[2] & (byte) TdsColumnStatus.IsExpression) != 0);
TdsDataColumn column = columns [index];
#if NET_2_0
column.IsHidden = ((values[2] & (byte) TdsColumnStatus.Hidden) != 0);
column.IsExpression = isExpression;
column.IsKey = ((values[2] & (byte) TdsColumnStatus.IsKey) != 0);
column.IsAliased = isAlias;
column.BaseColumnName = ((isAlias) ? baseColumnName : null);
column.BaseTableName = ((!isExpression) ? (string) tableNames [tableIndex] : null);
#else
column ["IsHidden"] = ((values [2] & (byte) TdsColumnStatus.Hidden) != 0);
column ["IsExpression"] = isExpression;
column ["IsKey"] = ((values [2] & (byte) TdsColumnStatus.IsKey) != 0);
column ["IsAliased"] = isAlias;
column ["BaseColumnName"] = ((isAlias) ? baseColumnName : null);
column ["BaseTableName"] = ((!isExpression) ? tableNames [tableIndex] : null);
#endif
}
}
@@ -1937,7 +1858,6 @@ namespace Mono.Data.Tds.Protocol
#endregion // Private Methods
#if NET_2_0
#region asynchronous methods
protected IAsyncResult BeginExecuteQueryInternal (string sql, bool wantResults,
AsyncCallback callback, object state)
@@ -2048,7 +1968,6 @@ namespace Mono.Data.Tds.Protocol
}
#endregion // asynchronous methods
#endif // NET_2_0
}

View File

@@ -273,7 +273,6 @@ namespace Mono.Data.Tds.Protocol {
TdsDataColumn col = new TdsDataColumn ();
int index = Columns.Add (col);
#if NET_2_0
col.ColumnType = columnType;
col.ColumnSize = bufLength;
col.ColumnName = ColumnNames[index] as string;
@@ -282,16 +281,6 @@ namespace Mono.Data.Tds.Protocol {
col.IsReadOnly = !writable;
col.BaseTableName = tableName;
col.AllowDBNull = nullable;
#else
col["ColumnType"] = columnType;
col["ColumnSize"] = bufLength;
col["ColumnName"] = ColumnNames[index];
col["NumericPrecision"] = precision;
col["NumericScale"] = scale;
col["IsReadOnly"] = !writable;
col["BaseTableName"] = tableName;
col["AllowDBNull"] = nullable;
#endif
}
}

View File

@@ -508,7 +508,6 @@ namespace Mono.Data.Tds.Protocol
TdsDataColumn col = new TdsDataColumn ();
Columns.Add (col);
#if NET_2_0
col.ColumnType = columnType;
col.ColumnName = columnName;
col.IsIdentity = isIdentity;
@@ -521,20 +520,6 @@ namespace Mono.Data.Tds.Protocol
col.IsKey = isKey;
col.AllowDBNull = allowDBNull;
col.IsHidden = hidden;
#else
col ["ColumnType"] = columnType;
col ["ColumnName"] = columnName;
col ["IsIdentity"] = isIdentity;
col ["IsRowVersion"] = isRowVersion;
col ["ColumnType"] = columnType;
col ["ColumnSize"] = bufLength;
col ["NumericPrecision"] = precision;
col ["NumericScale"] = scale;
col ["IsReadOnly"] = !isUpdatable;
col ["IsKey"] = isKey;
col ["AllowDBNull"] = allowDBNull;
col ["IsHidden"] = hidden;
#endif
}
}

View File

@@ -693,11 +693,7 @@ namespace Mono.Data.Tds.Protocol
CultureInfo.InvariantCulture,
"Value '{0}' is not valid for SmallMoney."
+ " Must be between {1:N4} and {2:N4}.",
#if NET_2_0
val,
#else
val.ToString (CultureInfo.CurrentCulture),
#endif
SMALLMONEY_MIN, SMALLMONEY_MAX));
int[] arr = Decimal.GetBits (val);
@@ -886,7 +882,6 @@ namespace Mono.Data.Tds.Protocol
TdsDataColumn col = new TdsDataColumn ();
Columns.Add (col);
#if NET_2_0
col.ColumnType = columnType;
col.ColumnName = columnName;
col.IsAutoIncrement = autoIncrement;
@@ -898,19 +893,6 @@ namespace Mono.Data.Tds.Protocol
col.AllowDBNull = nullable;
col.BaseTableName = tableName;
col.DataTypeName = Enum.GetName (typeof (TdsColumnType), xColumnType);
#else
col ["ColumnType"] = columnType;
col ["ColumnName"] = columnName;
col ["IsAutoIncrement"] = autoIncrement;
col ["IsIdentity"] = isIdentity;
col ["ColumnSize"] = columnSize;
col ["NumericPrecision"] = precision;
col ["NumericScale"] = scale;
col ["IsReadOnly"] = !writable;
col ["AllowDBNull"] = nullable;
col ["BaseTableName"] = tableName;
col ["DataTypeName"] = Enum.GetName (typeof (TdsColumnType), xColumnType);
#endif
}
}
@@ -1073,7 +1055,6 @@ namespace Mono.Data.Tds.Protocol
#endregion // Methods
#if NET_2_0
#region Asynchronous Methods
public override IAsyncResult BeginExecuteNonQuery (string cmdText,
@@ -1136,6 +1117,5 @@ namespace Mono.Data.Tds.Protocol
}
#endregion // Asynchronous Methods
#endif // NET_2_0
}
}

View File

@@ -175,7 +175,6 @@ namespace Mono.Data.Tds.Protocol {
TdsDataColumn col = new TdsDataColumn ();
Columns.Add (col);
#if NET_2_0
col.ColumnType = columnType;
col.ColumnName = columnName;
col.IsAutoIncrement = autoIncrement;
@@ -188,20 +187,6 @@ namespace Mono.Data.Tds.Protocol {
col.BaseTableName = tableName;
col.LCID = lcid;
col.SortOrder = sortId;
#else
col ["ColumnType"] = columnType;
col ["ColumnName"] = columnName;
col ["IsAutoIncrement"] = autoIncrement;
col ["IsIdentity"] = isIdentity;
col ["ColumnSize"] = columnSize;
col ["NumericPrecision"] = precision;
col ["NumericScale"] = scale;
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
}

View File

@@ -30,7 +30,6 @@
//
#if NET_2_0
using System;
using System.Threading;
@@ -125,4 +124,3 @@ namespace Mono.Data.Tds.Protocol
}
}
#endif // NET_2_0

View File

@@ -30,7 +30,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Net.Sockets;
@@ -60,4 +59,3 @@ namespace Mono.Data.Tds.Protocol {
}
}
#endif // NET_2_0

View File

@@ -26,7 +26,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
namespace Mono.Data.Tds.Protocol {
@@ -220,4 +219,3 @@ namespace Mono.Data.Tds.Protocol {
#endregion
}
}
#endif

View File

@@ -93,7 +93,6 @@ namespace Mono.Data.Tds.Protocol {
bool have_exception = false;
try {
#if NET_2_0
IPAddress ip;
if(IPAddress.TryParse(this.dataSource, out ip)) {
endPoint = new IPEndPoint(ip, port);
@@ -101,10 +100,6 @@ namespace Mono.Data.Tds.Protocol {
IPHostEntry hostEntry = Dns.GetHostEntry (this.dataSource);
endPoint = new IPEndPoint(hostEntry.AddressList [0], port);
}
#else
IPHostEntry hostEntry = Dns.Resolve (this.dataSource);
endPoint = new IPEndPoint (hostEntry.AddressList [0], port);
#endif
} catch (SocketException e) {
throw new TdsInternalException ("Server does not exist or connection refused.", e);
}
@@ -125,9 +120,7 @@ namespace Mono.Data.Tds.Protocol {
}
try {
#if NET_2_0
socket.NoDelay = true;
#endif
socket.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.SendTimeout, timeout_ms);
socket.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, timeout_ms);
} catch {
@@ -848,7 +841,6 @@ namespace Mono.Data.Tds.Protocol {
}
#endregion // Methods
#if NET_2_0
#region Async Methods
public IAsyncResult BeginReadPacket (AsyncCallback callback, object stateObject)
@@ -907,7 +899,6 @@ namespace Mono.Data.Tds.Protocol {
}
#endregion // Async Methods
#endif // NET_2_0
}

View File

@@ -262,7 +262,6 @@ retry:
}
}
#if NET_2_0
public void ResetConnectionPool ()
{
lock (available) {
@@ -284,7 +283,6 @@ retry:
Monitor.PulseAll (available);
}
}
#endif
#endregion // Methods
}
}

View File

@@ -38,25 +38,14 @@ namespace Mono.Data.Tds.Protocol {
public TdsDataColumn ()
{
#if NET_2_0
IsAutoIncrement = false;
IsIdentity = false;
IsRowVersion = false;
IsUnique = false;
IsHidden = false;
#else
object bool_false = false;
this ["IsAutoIncrement"] = bool_false;
this ["IsIdentity"] = bool_false;
this ["IsRowVersion"] = bool_false;
this ["IsUnique"] = bool_false;
this ["IsHidden"] = bool_false;
#endif
}
#if NET_2_0
public TdsColumnType? ColumnType {
get;
set;
@@ -176,7 +165,6 @@ namespace Mono.Data.Tds.Protocol {
get;
set;
}
#endif
// This allows the storage of arbitrary properties in addition to the predefined ones
public object this [string key] {

View File

@@ -68,11 +68,7 @@ namespace Mono.Data.Tds.Protocol {
{
int index;
index = list.Add (schema);
#if NET_2_0
schema.ColumnOrdinal = index;
#else
schema["ColumnOrdinal"] = index;
#endif
return index;
}