398 Commits
Author SHA1 Message Date
Gert Driesen 82dd9fc53c * TdsConnectionPool.cs: Added TdsConnectionPoolManager.GetConnection
overload that can be used to retrieve an existing connection pool.
Modified ResetConnectionPool () to skip free slots in the pool and to
close pooled connections that are not in use. Pooled connections that
are in use are now marked as non-pooled so that they are no longer
returned to the pool when they are closed. Fixes bug #443131.
* SqlConnection.cs: In Close, also remove reference to pool. In Open,
set TdsConnection.Pooling to false for a non-pooled connection.
Fixed ClearAllPools to no longer create a new connection for each
pool. In ClearPool, perform a lookup of the pool to clear using
the connectionstring as the pool field may refer to another pool
(as the connectionstring may have changed).
* SqlConnectionTest.cs: Added tests for ClearPool and ClearAllPools.

svn path=/trunk/mcs/; revision=118308
2008-11-09 13:36:37 +00:00
Veerapuram Varadhan efe5bd6fb8 * SqlDataReader.cs (GetSqlXml): Handle the scenario when Sql Server 2005
returns Xml column type as NTEXT when called from clients that use <
  TDS 8.0 protocol.


svn path=/trunk/mcs/; revision=114482
2008-09-30 14:01:22 +00:00
Veerapuram Varadhan efb49f7684 Simplification of if-else part
svn path=/trunk/mcs/; revision=113639
2008-09-20 18:54:17 +00:00
Veerapuram Varadhan 866542814b Handle no brackets scenario
svn path=/trunk/mcs/; revision=113637
2008-09-20 18:08:20 +00:00
Veerapuram Varadhan ad382304b1 Escape/trim schema/procedure names before passing them as parameter
values in DeriveParameters.


svn path=/trunk/mcs/; revision=113327
2008-09-17 16:53:59 +00:00
Atsushi Eno d89ecdf8a2 2008-09-13 Atsushi Enomoto <[email protected]>
* SqlDependency.cs : wrong namespace.


svn path=/trunk/mcs/; revision=112931
2008-09-13 12:37:21 +00:00
Marek Safar 02e9af391d Warnings cleanup
svn path=/trunk/mcs/; revision=111855
2008-08-28 19:08:55 +00:00
Daniel Morgan 2066f021be 2008-08-27 Daniel Morgan <[email protected]>
* System.Data.SqlClient/SqlConnectionStringBuilder.cs: modified -
	add missing connection options, correct case of some connection options,
	added dictionary for mapping
	defaults, for Item this indexer needs to return a default
	for a valid keyword if it does not exist in the dictionary,
	must override the Keys and Values collection to return all keys
	and values whether or not they exist in the dictionary and if
	they do not then return a default value for Values

svn path=/trunk/mcs/; revision=111781
2008-08-28 02:27:59 +00:00
Gert Driesen 9fb7f7aad0 * SqlConnection.cs: Use constants for min/max values. When value is
zero-length string, then fallback to default value for boolean and
integer backed properties. Throw ArgumentException when min pool size
exceeds max pool size. Check whether value for 'MARS' is a bool.
The 'user instance' property is 2.0 only.
* SqlConnectionTest.cs: Enabled connection string related tests that
previously failed. Added/improved connection string tests.

svn path=/trunk/mcs/; revision=110471
2008-08-14 11:12:49 +00:00
Gert Driesen 1f9160fe78 * SqlConnection.cs: Convert keywords to lowercase instead of uppercase
to avoid further case changes in exception messages.

svn path=/trunk/mcs/; revision=110468
2008-08-14 11:02:54 +00:00
Gert Driesen ce5f523da5 * SqlCommandTest.cs: Enabled test for bug #412569.
* SqlCommand.cs (ExecuteReader): When behavior includes SingleRow,
then only return a single result. Fixes bug #412569.

svn path=/trunk/mcs/; revision=109065
2008-07-28 19:01:02 +00:00
Gert Driesen e5b3cc5096 * SqlCommand.cs: Fixed order of arguments for ArgumentException in
CommandTimeout. 
* SqlConnection.cs (ChangePassword): Do not allow empty connection
string. Updated exception messages.
* SqlConnectionTest.cs: Enabled tests for ChangePassword argument
checks.

svn path=/trunk/mcs/; revision=109060
2008-07-28 18:37:07 +00:00
Gert Driesen f5f8d8daba * SqlCommand.cs: Fixed param name in ArgumentException for negative
CommandTimeout to match MS. On 2.0 profile, throw NRE in Prepare
when connection is NULL. In Prepare, return immediately after
connection check (2.0 only) for stored procedures, or when no
parameters are added. Added check to see if transaction is
associated with same connection as the command and updated
exception messages.
* SqlCommandTest.cs: Enabled CommandTimeout test. Enabled test for
Prepare with NULL connection. Enabled test for bug #412586.
* SqlCommandTest.cs: Enabled and improved tests for pending transaction
and transaction that is not associated with connection. Added tests for
Prepare.

svn path=/trunk/mcs/; revision=109058
2008-07-28 18:15:17 +00:00
Gert Driesen ebf1361ab6 * SqlCommand.cs: Added bool argument to ValidateCommand to specify
whether an async method is being executed. Minor changes to exception
messages to match MS.
* SqlCommandTest.cs: Enabled and improved tests for Execute* with closed
connection.
* SqlCommandTest.cs: Enabled and improved tests for Execute* with only a
transaction set.

svn path=/trunk/mcs/; revision=109043
2008-07-28 16:17:55 +00:00
Gert Driesen 3dfa81f709 * SqlCommand.cs: Avoid NRE in CloseDataReader when connection is NULL.
Fixes bug #412584. Removed unused moreResults eargument from
CloseDataReader. Removed behavior argument from Execute, and have it
use the behavior field instead. In ValidateCommand, throw
InvalidOperationException instead of NRE when Connection is NULL.
* SqlDataReader.cs: Sync with SqlCommand's CloseDataReader signature
change.
* SqlCommandTest.cs: Enabled test for bug #412584.

svn path=/trunk/mcs/; revision=109033
2008-07-28 15:44:30 +00:00
Gert Driesen b1e8819b84 * SqlCommand.cs: (Transaction): On the 1.0 profile, do not allow
Transaction to be set when a reader is open for the current connection.
Fixes bug #412579.
* SqlCommandTest.cs: Enabled test for bug #412579.

svn path=/trunk/mcs/; revision=109021
2008-07-28 15:15:54 +00:00
Gert Driesen 8185146fb8 * SqlCommand.cs (Connection): Do not throw InvalidOperationException
if transaction is in progress. Fixes bug #412576. On 1.0 profile, throw
InvalidOperationException when a reader is open for the current
connection. Do not set transaction to NULL when changing connection,
instead set it to null in Transaction when transaction is no longer
open.
* SqlCommandTest.cs: Enabled and improved test for bug #412576.
Enabled test for changing Connection while reader is open.

svn path=/trunk/mcs/; revision=109018
2008-07-28 15:07:45 +00:00
Gert Driesen 4c4ae3f815 * SqlConnection.cs: Use null as default value for connectionString
field. Remove Init method, as initialization is done in
SetDefaultConnectionParameters. Initialize parms in
SetDefaultConnectionParameters to avoid calling Reset on newly
initialized collection. In Dispose (bool), also invoke base.Dispose if 
SqlConnection was already disposed. Fixes bug #412571.
* SqlConnectionTest.cs: Enabled and improved test for bug #412571.

svn path=/trunk/mcs/; revision=109013
2008-07-28 14:46:55 +00:00
Gert Driesen 92118b9c32 Flush
svn path=/trunk/mcs/; revision=109010
2008-07-28 13:55:24 +00:00
Gert Driesen 8485db3629 * SqlConnection.cs(ChangeState): Return immediately when new state
equals original state. Fixes bug #412574. Removed extra whitespace.
* SqlConnectionTest.cs: Enabled test for bug #412574.

svn path=/trunk/mcs/; revision=109009
2008-07-28 13:53:56 +00:00
Veerapuram Varadhan 6a3b2f700a Memory leak fix
svn path=/trunk/mcs/; revision=108546
2008-07-23 12:59:01 +00:00
Veerapuram Varadhan b5701b169e On demand schemaTable generation - improves performance
svn path=/trunk/mcs/; revision=108544
2008-07-23 12:44:37 +00:00
Veerapuram Varadhan 57e4a0605f Fixes #326182
svn path=/trunk/mcs/; revision=107667
2008-07-10 16:46:48 +00:00
Gert Driesen 0d75ebc8f8 * SqlException.cs: Modified HResult/ErrorCode to match MS. Removed
unused FromTdsInternalException overload. Removed unnecessary check
for Errors.Count. Minor code formatting.

svn path=/trunk/mcs/; revision=107347
2008-07-06 18:18:34 +00:00
Rodrigo Kumpera d786469a74 In .:
2008-07-03  Rodrigo Kumpera  <[email protected]>

	* SqlConnection.cs: Remove connStringParameters as nobody uses it.
	

svn path=/trunk/mcs/; revision=107193
2008-07-03 21:23:20 +00:00
Rodrigo Kumpera 31ca181b00 2008-07-01 Rodrigo Kumpera <[email protected]>
* SqlDataReader.cs: Do all column accesses with int indexes.	



svn path=/trunk/mcs/; revision=107028
2008-07-02 03:03:15 +00:00
Rodrigo Kumpera d284243898 2008-07-01 Rodrigo Kumpera <[email protected]>
* SqlDataReader.cs (GetSchemaTable): All column index are constants,
	extract them.



svn path=/trunk/mcs/; revision=107018
2008-07-01 23:30:48 +00:00
Rodrigo Kumpera 72ad6f00e3 In System.Data.SqlClient:
2008-07-01  Rodrigo Kumpera  <[email protected]>

	* SqlDataReader.cs (GetSchemaTable): Calculate column indexes
	outside of the row loop.


svn path=/trunk/mcs/; revision=107011
2008-07-01 22:15:09 +00:00
Marek Habersack 2e293e0ab2 2008-07-01 Marek Habersack <[email protected]>
* SqlDataReader.cs: use named properties in TdsDataColumn for the
        2.0 profile.

svn path=/trunk/mcs/; revision=106976
2008-07-01 12:33:47 +00:00
Marek Safar 80b829f536 2008-07-01 Marek Safar <[email protected]>
* SqlDataReader.cs: Schema key is always a string.


svn path=/trunk/mcs/; revision=106971
2008-07-01 11:46:30 +00:00
Zoltan Varga 4a507937bf 2008-06-30 Zoltan Varga <[email protected]>
* SqlDataReader.cs: Allocate 'schemaTable' lazily. 
	(GetSchemaValue): Avoid some hash table lookups

svn path=/trunk/mcs/; revision=106932
2008-06-30 22:04:14 +00:00
Zoltan Varga d666890bf6 2008-06-27 Zoltan Varga <[email protected]>
* SqlDataReader.cs (ConstructSchemaTable): Avoid unneccessary reflection calls.

svn path=/trunk/mcs/; revision=106724
2008-06-27 05:05:38 +00:00
Veerapuram Varadhan 497c5478a8 New file
svn path=/trunk/mcs/; revision=106471
2008-06-23 23:06:43 +00:00
Veerapuram Varadhan 6d0bb3d133 SqlDependency - New stub added
svn path=/trunk/mcs/; revision=106470
2008-06-23 23:05:49 +00:00
Veerapuram Varadhan 9191732ff0 Do not call tds.Reset () as it is already done in the connection pool.
svn path=/trunk/mcs/; revision=105719
2008-06-12 19:01:03 +00:00
Marek Habersack 5d0f03654d 2008-06-12 Marek Habersack <[email protected]>
* SqlParameterCollection.cs: this [int] must check the range and
	throw an exception if necessary.
	
	* SqlCommand.cs: throw IOEX when stored procedure is not found in
	DeriveParameters. All procedures in MS SQL will report at least
	one parameter - the return value.

svn path=/trunk/mcs/; revision=105657
2008-06-11 22:23:39 +00:00
Veerapuram Varadhan 33b4b7433b Update according to the new return type of
TdsConnectionPool.GetConnectionPool()

svn path=/trunk/mcs/; revision=105432
2008-06-10 14:00:02 +00:00
Marek Habersack d1ee1bfd9c 2008-06-09 Ankit Jain <[email protected]>
* Mono.Data.SybaseClient/SybaseCommand.cs: Use Tds instead of ITds now.
        * Mono.Data.SybaseClient/SybaseConnection.cs: Likewise.

2008-06-09  Ankit Jain  <[email protected]>

        * ITds.cs: Removed.
        * Mono.Data.Tds.dll.sources: Update.

2008-06-09  Ankit Jain  <[email protected]>

        * TdsCommand.cs, TdsConnection.cs: Use Tds instead of ITds now.

2008-06-09  Ankit Jain  <[email protected]>

        * SqlCommand.cs: Use Tds instead of ITds now.
        * SqlConnection.cs:  Likewise.


svn path=/trunk/mcs/; revision=105402
2008-06-10 10:22:11 +00:00
Gert Driesen a323b7331e * SqlConnection.cs: Added support for '.' as alias for localhost.
Improve exception message when TCP/IP protocol is not enabled.

svn path=/trunk/mcs/; revision=104196
2008-05-27 20:13:00 +00:00
Gert Driesen 57ddcb10f1 * SqlDataReader.cs (GetInt64): Removed workaround for TDS 7.0 handling
of bigint column type as this is handled in Mono.Data.Tds.

svn path=/trunk/mcs/; revision=103404
2008-05-17 21:06:01 +00:00
Marek Habersack 6e3497df0d 2008-05-14 Marek Habersack <[email protected]>
* SqlConnection.cs: added support for USER INSTANCE keyword in the
	connection string.

svn path=/trunk/mcs/; revision=103209
2008-05-14 18:04:46 +00:00
Veerapuram Varadhan 4f724ba9eb ** Fixes Bug#381151
* SqlCommand.cs: Handle exceptions sanely and do not close
        connection on TdsTimeoutException.


svn path=/trunk/mcs/; revision=101411
2008-04-22 11:09:32 +00:00
Gert Driesen 3aeddf81e9 * SqlBulkCopyColumnMappingCollection.cs: Changed argument names to
match MS. Code formatting.
* SqlCommand.cs: Changed argument names to match MS. Code formatting.
Do not include explicit IDbCommand implementation on 2.0 profile.
* SqlCommandBuilder.cs: Changed argument names to match MS. Code
formatting.
* SqlDataReader.cs: Changed argument names to match MS. Code
formatting.
* SqlParameterCollection.cs: Do not include IList, ICollection and
IDataParameterCollection explicit interface implementation on 2.0
profile. Code formatting.
* SqlConnection.cs: Changed argument names to match MS.
* SqlDataAdapter.cs: Changed argument names to match MS.
* SqlTransaction.cs: Do not include explicit interface implementation
of IDbTransaction.Connection on 2.0 profile. Code formatting.

svn path=/trunk/mcs/; revision=101355
2008-04-21 18:59:17 +00:00
Robert Jordan 18741a1e23 In Test/System.Data.SqlClient:
2008-04-19  Robert Jordan  <[email protected]>

	* SqlCommandTest.cs: Add test case for bug #381100.

In System.Data.SqlClient:
2008-04-19  Robert Jordan  <[email protected]>

	* SqlParameterCollection.cs (AddRange(SqlParameter[])):
	Fix endless recursion.


svn path=/trunk/mcs/; revision=101212
2008-04-19 15:14:40 +00:00
Marek Habersack e3eefaf541 2008-04-08 Marek Habersack <[email protected]>
* SqlConnection.cs: TCP port discovery via UDP port 1434 should
	honor the timeout specified in the connection string (or the
	default one). In some environments 100 microseconds might not be
	enough to discover the port.

svn path=/trunk/mcs/; revision=100077
2008-04-08 00:51:19 +00:00
Marek Habersack f69bd85724 2008-04-01 Marek Habersack <[email protected]>
* SqlParameter.cs: ConvertToFrameworkType must handle empty
	strings gracefully - a DBNull.Value must be returned in this
	case.

	* SqlCommand.cs: DeriveParameters should split the stored
	procedure name into the schema name and procedure name before
	querying its parameters.

svn path=/trunk/mcs/; revision=99553
2008-04-01 17:33:08 +00:00
Ankit Jain 8a986b5f97 In class/System.Data:
* System.Data.dll.sources: Add new OleDbMetaDataCollectionNames.cs
	* System.Data_test.dll.sources: Add the new OdbcMetaDataColumnNamesTest,
	OleDbMetaDataCollectionNamesTest and SqlClientMetaDataCollectionNamesTest.

In class/System.Data/System.Data.Odbc:

	* OdbcMetaDataCollectionNames.cs: Set the field values.

In class/System.Data/System.Data.OleDb:

	* OleDbMetaDataCollectionNames.cs: New.

In class/System.Data/System.Data.SqlClient:

	* SqlClientMetaDataCollectionNames.cs: Set the field values.

In class/System.Data/Test/System.Data.Odbc:

	* OdbcMetaDataCollectionNamesTest.cs: New.

In class/System.Data/Test/System.Data.OleDb:

	* OleDbMetaDataCollectionNamesTest.cs: New.

In class/System.Data/Test/System.Data.SqlClient:

	* SqlClientMetaDataCollectionNamesTest.cs: New.

svn path=/trunk/mcs/; revision=97175
2008-03-03 08:04:56 +00:00
Gert Driesen c231373769 * DataColumn.cs: Fixed ParamName of ArgumentNullException. Modified
exception message for invalid DateTimeMode value to match MS. Code
formatting.
* DbDataPermissionAttribute.cs: In KeyRestrictionBehavior, reuse
ExceptionHelper.CheckEnumValue.   
* ExceptionHelper.cs: Use same exception message for both 1.0 and 2.0.
* Index.cs: Fixed compiler warnings. Code formatting.
* SqlCommand.cs: Use ExceptionHelper.CheckEnumValue for enum checks.
* OleDbCommand.cs: Use ExceptionHelper.CheckEnumValue for enum checks.
* DBDataPermissionAttributeTest.cs: Improved test for invalid
KeyRestrictionBehavior. Fixed line endings.
* DataColumnTest.cs: No longer derive from deprecated Assertion class.
Code formatting. Added test for DateTimeMode.

svn path=/trunk/mcs/; revision=87866
2007-10-21 13:26:43 +00:00
Gert Driesen 3930b4b9cf * System.Data_test.dll.sources: Added DbDataAdapterTest.cs,
OdbcCommandTest.cs, OdbcConnectionTest.cs, OdbcDataAdapterTest.cs, 
OleDbCommandTest.cs, OleDbConnectionTest.cs, OleDbDataAdapterTest.cs, 
SqlDataAdapterTest.cs.
* DbDataAdapter.cs: Implemented UpdateBatchSize setter.
* DataAdapter.cs: In FillLoadOption setter, ensure value is valid.
Modified MissingMappingAction and MissingSchemaAction setters to use
ExceptionHelper.CheckEnumValue to validate value. Spaces to tabs and
code formatting.
* ExceptionHelper.cs: Added CheckEnumValue method and modified
InvalidEnumValueException method to return AORE on 2.0 profile. Added
ConnectionClosed method that returns an InvalidOperationException.
* OleDbDataAdapter.cs: In default ctor, set SelectCommand to null.
Only initialize SelectCommand in ctors. Use direct assignment in
IDbDataAdapter implementation.
* OleDbCommand.cs: Added constant for default CommandTimeout, instead
of using a magic number. Avoid unnecessary initialization. Fixed
default value for DesignTimeVisible. Return zero-length string if
CommandText is null. Added implementation for UpdatedRowSource.
* OleDbConnection.cs: Moved initialization of gda to Open ().
Avoid unnecessary initialization. Return zero-length string if
ConnectionString is null. If getters to Database, DataSource and
Provider return zero-length string if the connection is closed.
In ServerVersion, BeginTransaction and GetSchema, throw an
InvalidOperationException if connection is closed.
* OdbcCommand.cs: Added constant for default CommandTimeout, instead
of using a magic number. Avoid unnecessary initialization. Fixed
default value for DesignTimeVisible. Return zero-length string if
CommandText is null. Spaces to tabs and code formatting.
* OdbcError.cs: Fixed typo in exception message.
* OdbcConnection.cs: Return zero-length string if ConnectionString is
null. In getters for Database, DataSource and Driver return a
zero-length string if connection is closed. In BeginTransaction and
GetSchema throw InvalidOperationException if connection is closed.
Added override for GetSchema (string, string []). Use string.Empty
instead of "".
* OdbcDataAdapter.cs: Avoid unnecessary initializations. Use direct
assignment in IDbDataAdapter implementation. In default ctor, set
SelectCommand to null.
* SqlCommand.cs: Added constant for default CommandTimeout, instead
of using a magic number. Avoid unnecessary initialization. Fixed
default value for DesignTimeVisible. Return zero-length string if
CommandText is null. Use ExceptionHelper.InvalidEnumValueException
to avoid code duplication. Spaces to tabs and code formatting.
* SqlConnection.cs: Use different default package size on 2.0 profile.
Added constants for default values, instead of using magic numbers.
Avoid unnecessary initialization. In PacketSize, return default or
configured packet size when connection is not open. Use 
ExceptionHelper.ConnectionClosed instead of local method. Removed   
use of some hardcoded values in SetDefaultConnectionParameters, and
use Environment.MachineName as default WorkstationId instead of 
DNS host name. Code formatting.
* SqlDataAdapter.cs: In default ctor, set SelectCommand to null.
Avoid unnecessary initializations. Use direct assignment in   
IDbDataAdapter implementation. Fixed exception message for negative
UpdateBatchSize. In Dispose override, make sure to invoke base
method.
* DbDataAdapterTest.cs: Added test for UpdateBatchSize.
* DataAdapterTest.cs: Added tests for AcceptChangesDuringFile,   
AcceptChangesDuringUpdate, ContinueUpdateOnError, FillLoadOption,
MissingMappingAction, MissingSchemaAction and                      
ReturnProviderSpecificTypes.
* OdbcDataAdapterTest.cs: Added tests for ctors, DeleteCommand,
InsertCommand, SelectCommand, UpdateCommand and Dispose.
* OdbcDataReaderTest.cs: fixed line endings.
* OdbcCommandTest.cs: Added tests for ctors and CommantText.
* OdbcConnectionTest.cs: Removed original test that relied on MySQL.
Added ctor tests. Added tests for BeginTransaction, GetSchema and 
ServerVersion with connection that is closed.
* OleDbDataAdapterTest.cs: Added tests for ctors, DeleteCommand, 
InsertCommand, SelectCommand, UpdateCommand and Dispose.
* OleDbCommandTest.cs: Added tests for ctors and CommandText.
* OleDbConnectionTest.cs: Added tests for ctors and ConnectionString. 
Added tests for BeginTransaction, GetSchema and ServerVersion with connection that is closed.
* SqlCommandTest.cs: Added tests for ctors and CommantText. 
* SqlConnectionTest.cs: Added tests for ctors, ConnectionString and 
ServerVersion.
* SqlDataAdapterTest.cs: Added tests for ctors, DeleteCommand,
InsertCommand, SelectCommand, UpdateCommand, UpdateBatchSize and 
Dispose.

svn path=/trunk/mcs/; revision=87859
2007-10-20 23:16:52 +00:00
Gert Driesen 843e73dcd2 * OdbcTransaction.cs: Clear connection in Commit and Rollback.
In IsolationLevel, throw IOE if transaction is no longer open.
* SqlTransaction.cs: Clear connection in commit. In IsolationLevel,
throw IOE if transaction is no longer open.
* OleDbTransaction.cs: Clear connection in Commit and Rollback. In
IsolationLevel and Begin overloads, throw IOE if transaction is no
longer open.

svn path=/trunk/mcs/; revision=87836
2007-10-19 17:12:55 +00:00