diff options
author | Daniel Morgan <monodanmorg@yahoo.com> | 2002-10-14 04:19:06 +0400 |
---|---|---|
committer | Daniel Morgan <monodanmorg@yahoo.com> | 2002-10-14 04:19:06 +0400 |
commit | 1810f3436a88ace8306ba3704dbd639613786ceb (patch) | |
tree | 82836f7452ac34ce22f8b79f0052d94c51434346 /mcs | |
parent | 1dd2506a4a58ff3f56564cc19f10f1fdf5910198 (diff) |
2002-10-13 Daniel Morgan <danmorg@sc.rr.com>
* System.Data/DataRow.cs: don't throw exception
if DBNull is false. Had to do comment this line
to allow a typeof(Type).
* System.Data.SqlClient/SqlCommand.cs: the "DataType"
DataColumn and DataRows in a DataTable for a schema should
be typeof Type, not string. This is to make it
compatible with MS.NET
* System.Data.SqlClient/SqlConnection.cs: the
isolation level should be set before
beginning the transaction
* Test/SqlSharpCli.cs: change string to Type for
"DataType" from a DataRow in a DataTable
that contains a schema.
svn path=/trunk/mcs/; revision=8229
Diffstat (limited to 'mcs')
9 files changed, 34 insertions, 19 deletions
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs index af2771c3fa2..92e1d1d5e63 100644 --- a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs +++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs @@ -810,7 +810,7 @@ namespace System.Data.SqlClient { dataTableSchema.Columns.Add ("BaseColumnName", typeof (string)); dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string)); dataTableSchema.Columns.Add ("BaseTableName", typeof (string)); - dataTableSchema.Columns.Add ("DataType", typeof(string)); + dataTableSchema.Columns.Add ("DataType", typeof(Type)); dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool)); dataTableSchema.Columns.Add ("ProviderType", typeof (int)); dataTableSchema.Columns.Add ("IsAliased", typeof (bool)); @@ -881,7 +881,7 @@ namespace System.Data.SqlClient { typ = PostgresHelper.DbTypeToSystemType (dbType);
string st = typ.ToString();
- schemaRow["DataType"] = st;
+ schemaRow["DataType"] = typ;
schemaRow["AllowDBNull"] = false; schemaRow["ProviderType"] = oid; diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs index 0bd37605cc6..f3c4df7be71 100644 --- a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs +++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs @@ -465,8 +465,11 @@ namespace System.Data.SqlClient { private SqlTransaction TransactionBegin (IsolationLevel il) { // FIXME: need to keep track of // transaction in-progress - TransactionBegin(); + trans = new SqlTransaction (); + // using internal methods of SqlTransaction + trans.SetConnection (this); trans.SetIsolationLevel (il); + trans.Begin(); return trans; } diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs index af2771c3fa2..92e1d1d5e63 100644 --- a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs +++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs @@ -810,7 +810,7 @@ namespace System.Data.SqlClient { dataTableSchema.Columns.Add ("BaseColumnName", typeof (string)); dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string)); dataTableSchema.Columns.Add ("BaseTableName", typeof (string)); - dataTableSchema.Columns.Add ("DataType", typeof(string)); + dataTableSchema.Columns.Add ("DataType", typeof(Type)); dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool)); dataTableSchema.Columns.Add ("ProviderType", typeof (int)); dataTableSchema.Columns.Add ("IsAliased", typeof (bool)); @@ -881,7 +881,7 @@ namespace System.Data.SqlClient { typ = PostgresHelper.DbTypeToSystemType (dbType);
string st = typ.ToString();
- schemaRow["DataType"] = st;
+ schemaRow["DataType"] = typ;
schemaRow["AllowDBNull"] = false; schemaRow["ProviderType"] = oid; diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlConnection.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlConnection.cs index 0bd37605cc6..f3c4df7be71 100644 --- a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlConnection.cs +++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlConnection.cs @@ -465,8 +465,11 @@ namespace System.Data.SqlClient { private SqlTransaction TransactionBegin (IsolationLevel il) { // FIXME: need to keep track of // transaction in-progress - TransactionBegin(); + trans = new SqlTransaction (); + // using internal methods of SqlTransaction + trans.SetConnection (this); trans.SetIsolationLevel (il); + trans.Begin(); return trans; } diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs index af2771c3fa2..92e1d1d5e63 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs @@ -810,7 +810,7 @@ namespace System.Data.SqlClient { dataTableSchema.Columns.Add ("BaseColumnName", typeof (string)); dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string)); dataTableSchema.Columns.Add ("BaseTableName", typeof (string)); - dataTableSchema.Columns.Add ("DataType", typeof(string)); + dataTableSchema.Columns.Add ("DataType", typeof(Type)); dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool)); dataTableSchema.Columns.Add ("ProviderType", typeof (int)); dataTableSchema.Columns.Add ("IsAliased", typeof (bool)); @@ -881,7 +881,7 @@ namespace System.Data.SqlClient { typ = PostgresHelper.DbTypeToSystemType (dbType);
string st = typ.ToString();
- schemaRow["DataType"] = st;
+ schemaRow["DataType"] = typ;
schemaRow["AllowDBNull"] = false; schemaRow["ProviderType"] = oid; diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs index 0bd37605cc6..f3c4df7be71 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs @@ -465,8 +465,11 @@ namespace System.Data.SqlClient { private SqlTransaction TransactionBegin (IsolationLevel il) { // FIXME: need to keep track of // transaction in-progress - TransactionBegin(); + trans = new SqlTransaction (); + // using internal methods of SqlTransaction + trans.SetConnection (this); trans.SetIsolationLevel (il); + trans.Begin(); return trans; } diff --git a/mcs/class/System.Data/System.Data/DataRow.cs b/mcs/class/System.Data/System.Data/DataRow.cs index 8f3576f02c8..f7edbb43346 100644 --- a/mcs/class/System.Data/System.Data/DataRow.cs +++ b/mcs/class/System.Data/System.Data/DataRow.cs @@ -105,8 +105,8 @@ namespace System.Data if(column.DataType != value.GetType ()) { if(objIsDBNull == true && column.AllowDBNull == false) throw new InvalidCastException (); - else if(objIsDBNull == false) - throw new InvalidCastException (); + //else if(objIsDBNull == false) + // throw new InvalidCastException (); } if (rowState == DataRowState.Deleted) throw new DeletedRowInaccessibleException (); diff --git a/mcs/class/System.Data/Test/SqlSharpCli.cs b/mcs/class/System.Data/Test/SqlSharpCli.cs index 11dab99bde3..ccbee597712 100644 --- a/mcs/class/System.Data/Test/SqlSharpCli.cs +++ b/mcs/class/System.Data/Test/SqlSharpCli.cs @@ -35,7 +35,7 @@ using System; using System.Collections; using System.Data; using System.Data.Common; -using System.Data.Odbc; +//using System.Data.Odbc; using System.Data.OleDb; using System.Data.SqlClient; using System.IO; @@ -108,6 +108,7 @@ namespace Mono.Data.SqlSharp { char underlineChar = '='; // an equal sign string dataType; // .NET Type + Type theType; string dataTypeName; // native Database type DataRow row; // schema row @@ -129,7 +130,8 @@ namespace Mono.Data.SqlSharp { // spacing columnSize = (int) schemaRow["ColumnSize"]; - dataType = (string) schemaRow["DataType"]; + theType = (Type) schemaRow["DataType"]; + dataType = theType.ToString(); dataTypeName = reader.GetDataTypeName(c); if(dataType.Equals("System.DateTime")) @@ -190,7 +192,8 @@ namespace Mono.Data.SqlSharp { colhdr = colhdr.Substring(0, 32); columnSize = (int) row["ColumnSize"]; - dataType = (string) row["DataType"]; + theType = (Type) row["DataType"]; + dataType = theType.ToString(); dataTypeName = reader.GetDataTypeName(c); if(dataType.Equals("System.DateTime")) @@ -692,7 +695,7 @@ namespace Mono.Data.SqlSharp { try { switch(provider) { case "ODBC": - conn = new OdbcConnection(); + //conn = new OdbcConnection(); break; case "OLEDB": conn = new OleDbConnection(); diff --git a/mcs/tools/SqlSharp/SqlSharpCli.cs b/mcs/tools/SqlSharp/SqlSharpCli.cs index 11dab99bde3..ccbee597712 100644 --- a/mcs/tools/SqlSharp/SqlSharpCli.cs +++ b/mcs/tools/SqlSharp/SqlSharpCli.cs @@ -35,7 +35,7 @@ using System; using System.Collections; using System.Data; using System.Data.Common; -using System.Data.Odbc; +//using System.Data.Odbc; using System.Data.OleDb; using System.Data.SqlClient; using System.IO; @@ -108,6 +108,7 @@ namespace Mono.Data.SqlSharp { char underlineChar = '='; // an equal sign string dataType; // .NET Type + Type theType; string dataTypeName; // native Database type DataRow row; // schema row @@ -129,7 +130,8 @@ namespace Mono.Data.SqlSharp { // spacing columnSize = (int) schemaRow["ColumnSize"]; - dataType = (string) schemaRow["DataType"]; + theType = (Type) schemaRow["DataType"]; + dataType = theType.ToString(); dataTypeName = reader.GetDataTypeName(c); if(dataType.Equals("System.DateTime")) @@ -190,7 +192,8 @@ namespace Mono.Data.SqlSharp { colhdr = colhdr.Substring(0, 32); columnSize = (int) row["ColumnSize"]; - dataType = (string) row["DataType"]; + theType = (Type) row["DataType"]; + dataType = theType.ToString(); dataTypeName = reader.GetDataTypeName(c); if(dataType.Equals("System.DateTime")) @@ -692,7 +695,7 @@ namespace Mono.Data.SqlSharp { try { switch(provider) { case "ODBC": - conn = new OdbcConnection(); + //conn = new OdbcConnection(); break; case "OLEDB": conn = new OleDbConnection(); |