Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Morgan <monodanmorg@yahoo.com>2003-02-16 18:11:40 +0300
committerDaniel Morgan <monodanmorg@yahoo.com>2003-02-16 18:11:40 +0300
commit0fb926e9ed6b8cabf857866ceb146721362b535a (patch)
treead0cf1f2ecb3df84fd171bfeb7920b394747aded /mcs/class/Mono.Data.SybaseClient
parentdb73cf5f48b6339afd25da560c84f81a873275c0 (diff)
2003-02-16 Daniel Morgan <danmorg@sc.rr.com>
* SybaseConnection.cs: - parse data source for 2 possible uses: "Server=hostname", "Server=hostname,port" and open the connection based on the resulting server name and port. svn path=/trunk/mcs/; revision=11625
Diffstat (limited to 'mcs/class/Mono.Data.SybaseClient')
-rw-r--r--mcs/class/Mono.Data.SybaseClient/ChangeLog7
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs31
2 files changed, 34 insertions, 4 deletions
diff --git a/mcs/class/Mono.Data.SybaseClient/ChangeLog b/mcs/class/Mono.Data.SybaseClient/ChangeLog
index 1d23029b063..28bd41069fd 100644
--- a/mcs/class/Mono.Data.SybaseClient/ChangeLog
+++ b/mcs/class/Mono.Data.SybaseClient/ChangeLog
@@ -1,3 +1,10 @@
+2003-02-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * SybaseConnection.cs: - parse data source for 2 possible uses:
+ "Server=hostname",
+ "Server=hostname,port" and open the connection based on the
+ resulting server name and port.
+
2002-12-01 Tim Coleman <tim@timcoleman.com>
* Mono.Data.SybaseClient/SybaseDataReader.cs:
Change to reflect TdsSchemaInfo -> TdsDataColumnCollection
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs
index 08a88e73666..dfa513d7981 100644
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs
@@ -3,8 +3,10 @@
//
// Author:
// Tim Coleman (tim@timcoleman.com)
+// Daniel Morgan (danmorg@sc.rr.com)
//
-// Copyright (C) Tim Coleman, 2002
+// Copyright (C) Tim Coleman, 2002, 2003
+// Copyright (C) Daniel Morgan, 2003
//
using Mono.Data.Tds.Protocol;
@@ -16,6 +18,7 @@ using System.Data;
using System.Data.Common;
using System.EnterpriseServices;
using System.Net;
+using System.Net.Sockets;
using System.Text;
namespace Mono.Data.SybaseClient {
@@ -282,16 +285,20 @@ namespace Mono.Data.SybaseClient {
[MonoTODO ("Figure out the Sybase way to reset the connection.")]
public void Open ()
{
+ string serverName = "";
if (connectionString == null)
throw new InvalidOperationException ("Connection string has not been initialized.");
try {
- if (!pooling)
- tds = new Tds50 (DataSource, port, PacketSize, ConnectionTimeout);
+ if (!pooling) {
+ ParseDataSource (dataSource, out port, out serverName);
+ tds = new Tds50 (serverName, port, PacketSize, ConnectionTimeout);
+ }
else {
pool = (SybaseConnectionPool) SybaseConnectionPools [connectionString];
if (pool == null) {
- pool = new SybaseConnectionPool (dataSource, port, packetSize, ConnectionTimeout, minPoolSize, maxPoolSize);
+ ParseDataSource (dataSource, out port, out serverName);
+ pool = new SybaseConnectionPool (serverName, port, packetSize, ConnectionTimeout, minPoolSize, maxPoolSize);
SybaseConnectionPools [connectionString] = pool;
}
tds = pool.AllocateConnection ();
@@ -315,6 +322,22 @@ namespace Mono.Data.SybaseClient {
}
}
+ private void ParseDataSource (string theDataSource, out int thePort, out string theServerName)
+ {
+ theServerName = "";
+ thePort = 1433; // default TCP port for SQL Server
+
+ int idx = 0;
+ if ((idx = theDataSource.IndexOf (",")) > -1) {
+ theServerName = theDataSource.Substring (0, idx);
+ string p = theDataSource.Substring (idx + 1);
+ thePort = Int32.Parse (p);
+ }
+ else {
+ theServerName = theDataSource;
+ }
+ }
+
void SetConnectionString (string connectionString)
{
connectionString += ";";