Commit Graph
366 Commits
Author SHA1 Message Date
Veerapuram Varadhan f71d07b3df Properly handle TDS 8 BigInt type
Proper handling of TDS 8 BigInt type

svn path=/trunk/mcs/; revision=130081
2009-03-23 19:33:59 +00:00
Veerapuram Varadhan e62e0f62e5 TDS 8 changes
svn path=/trunk/mcs/; revision=125321
2009-02-02 09:13:24 +00:00
Gonzalo Paniagua Javier c0ac3b7e2d Improved TDS connection pooling
svn path=/trunk/mcs/; revision=124408
2009-01-24 05:55:52 +00:00
Gert Driesen 0a1a4828a1 * SqlParameter.cs: Renamed isDirty to typeChanged; it is now now only
used to indicate whether the type of the parameter has been updated.
Changed signature of 'updated' argument in GetFrameworkValue to ref
to match delegate in Mono.Data.Tds, and convert value if either the
type has been changed or if the 'updated' argument is true (which -
for now - means the value or size changed in TdsMetaParameter).
Various fixes for derived parameters:
- parameter_type 2 means InputOutput parameter, while 3 means Output;
- Only set precision and scale is type is decimal.
- When type has variable size, then also set Size.

svn path=/trunk/mcs/; revision=123705
2009-01-17 20:12:24 +00:00
Gert Driesen e3c0d4579c * SqlDataReader.cs: Added GetSchemaRowDbType overload for
getting sql type of a given column (identified using its
ordinal). Modified GetBytes to throw SqlNullValueException
(2.0 profile) or return 0 (1.0 profile) when reading bytes
sequentially. Added support for non-sequentially reading
text and ntext columns using GetBytes. Modified GetChar
to throw a NotSupportedException to match MS.

svn path=/trunk/mcs/; revision=122396
2009-01-04 21:38:09 +00:00
Gert Driesen e9afd5d74d * SqlCommandBuilder.cs (RefreshSchema): Clear commands.
svn path=/trunk/mcs/; revision=122395
2009-01-04 20:55:09 +00:00
Gert Driesen 1e50a2325f * SqlDataReader.cs: Removed unused dataTypeNames, and
unnecessary initializations. Added missing reader state
and row state checks. Fixed implementation of HasRows.
Modified type of DataType to object on 1.0 profile for
compatibility with .NET 1.x. Do not mark (Big)VarBinary
or ((Big)Binary as long, as unit tests show that IsLong
is for wide (unicode) data types. Fixed type data for
SmallDateTime and SmallMoney data types. Improved support
for bigint data type (using TDS 7.0).

svn path=/trunk/mcs/; revision=122381
2009-01-03 23:07:06 +00:00
Gert Driesen 55a3f19733 * SqlCommand.cs: Moved connection reset before the throw.
Improved exception message.

svn path=/trunk/mcs/; revision=122380
2009-01-03 22:59:29 +00:00
Gert Driesen 9ec8751239 * SqlCommandBuilder.cs: Only set SourceColumn for null check
parameters on the 2.0 profile, and set SourceVersion to
Current on 1.0 profile. Changed accessibility of RefreshSchema
to public, and do not immediately create commands. Removed
CWL.

svn path=/trunk/mcs/; revision=122379
2009-01-03 22:55:09 +00:00
Gert Driesen 83cff6650f * SqlParameter.cs: When setting ParameterName or sourceName to
null, use a zero-length string instead. On 1.0 profile, only
infer type from value if value is not null or DBNull. Store
raw value in TdsMetadataParameter, and use delegate to convert
it to framework type (when necessary). Improve implementation
of SqlValue (still needs lots of work).

svn path=/trunk/mcs/; revision=122376
2009-01-03 22:40:34 +00:00
Gert Driesen 13b9781926 * System.Data_test.dll.sources: Added SqlCommandBuilderTest.cs
and SqlParameterTest.cs.
* DbCommandBuilder.cs (QuoteIdentifier): Throw NotSupportedException.
* DbDataAdapter.cs (Update): Add row causing concurrency violation
to DBConcurrencyException.
* OdbcCommandBuilder.cs (QuoteIdentifier): Escape QuoteSuffix
character(s) in unquoted identifier.
* SqlCommandBuilder.cs: Added missing checks for QuotePrefix and
QuoteSuffix on 2.0 profile, and return a zero-length string if
not set (or set to null) on 1.0 profile. Do not allow the value
of CatalogSeparator and SchemaSeparator to be changed from '.'.
Modified generated SQL to match MS. Added implementation for
QuoteIdenfifier. Modified parameters to match MS.
* SqlParameter.cs (SqlValue): Keep Value in sync.
* DbCommandBuilderTest.cs: Added test for QuoteIdentifier.
* OdbcCommandBuilderTest.cs: Enabled test for QuoteIdentifier.
* SqlCommandBuilderTest.cs: Added tests for CatalogLocation,
CatalogSeparator, ConflictOption, QuoteIdentifier, QuotePrefix,
QuoteSuffix  and SchemaSeparator.
* SqlParameterTest.cs: Moved existing tests from ProviderTests
to increase their visibility. Added tests for type inference.

svn path=/trunk/mcs/; revision=122361
2009-01-03 14:24:15 +00:00
Gonzalo Paniagua Javier 55bbc22620 Use IndexOf (char)
svn path=/trunk/mcs/; revision=122121
2008-12-25 07:46:26 +00:00
Gonzalo Paniagua Javier 366a8838ab 2008-12-20 Gonzalo Paniagua Javier <[email protected]>
* SqlParameter.cs: I removed these 2 lines I added 2 patches ago in
	the previous patch...



svn path=/trunk/mcs/; revision=121937
2008-12-20 20:47:47 +00:00
Gonzalo Paniagua Javier 1bced9acdb 2008-12-20 Gonzalo Paniagua Javier <[email protected]>
* SqlConnection.cs: close the connection on error.


svn path=/trunk/mcs/; revision=121920
2008-12-20 08:53:16 +00:00
Gonzalo Paniagua Javier 8c8c3c6bec 2008-12-16 Gonzalo Paniagua Javier <[email protected]>
* SqlParameter.cs: don't allocate error strings until the error
	actually happens. Compare types instead of strings. Use a Hashtable
	for type mappings.


svn path=/trunk/mcs/; revision=121605
2008-12-16 15:43:29 +00:00
Gonzalo Paniagua Javier c8ebfe25f1 2008-12-12 Gonzalo Paniagua Javier <[email protected]>
* SqlParameter.cs: use the underlying type when inferring the type for
	enumerations.


svn path=/trunk/mcs/; revision=121485
2008-12-13 01:51:41 +00:00
Veerapuram Varadhan 004f5ad90c Reset the connection on timeout exception before reusing it
svn path=/trunk/mcs/; revision=118727
2008-11-13 17:01:23 +00:00
Gert Driesen cd1071406b * SqlConnection.cs (ClearPool): Added null check.
* SqlConnectionTest.cs: Added test for null check in ClearPool.

svn path=/trunk/mcs/; revision=118309
2008-11-09 14:01:56 +00:00
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