Skip to content

Commit 22746fa

Browse files
committed
Support for isc_dpb_parallel_workers (for connections) (#832).
1 parent 4acb11b commit 22746fa

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/FirebirdSql.Data.FirebirdClient/Common/ConnectionString.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ internal sealed class ConnectionString
5757
internal const FbWireCrypt DefaultValueWireCrypt = FbWireCrypt.Enabled;
5858
internal const string DefaultValueApplicationName = "";
5959
internal const int DefaultValueCommandTimeout = 0;
60+
internal const int DefaultValueParallelWorkers = 0;
6061

6162
internal const string DefaultKeyUserId = "user id";
6263
internal const string DefaultKeyPortNumber = "port number";
@@ -86,6 +87,7 @@ internal sealed class ConnectionString
8687
internal const string DefaultKeyWireCrypt = "wire crypt";
8788
internal const string DefaultKeyApplicationName = "application name";
8889
internal const string DefaultKeyCommandTimeout = "command timeout";
90+
internal const string DefaultKeyParallelWorkers = "parallel workers";
8991
#endregion
9092

9193
#region Static Fields
@@ -158,6 +160,9 @@ internal sealed class ConnectionString
158160
{ "app", DefaultKeyApplicationName },
159161
{ DefaultKeyCommandTimeout, DefaultKeyCommandTimeout },
160162
{ "commandtimeout", DefaultKeyCommandTimeout },
163+
{ DefaultKeyParallelWorkers, DefaultKeyParallelWorkers },
164+
{ "parallelworkers", DefaultKeyParallelWorkers },
165+
{ "parallel", DefaultKeyParallelWorkers },
161166
};
162167

163168
internal static readonly IDictionary<string, object> DefaultValues = new Dictionary<string, object>(StringComparer.Ordinal)
@@ -190,6 +195,7 @@ internal sealed class ConnectionString
190195
{ DefaultKeyWireCrypt, DefaultValueWireCrypt },
191196
{ DefaultKeyApplicationName, DefaultValueApplicationName },
192197
{ DefaultKeyCommandTimeout, DefaultValueCommandTimeout },
198+
{ DefaultKeyParallelWorkers, DefaultValueParallelWorkers },
193199
};
194200

195201
#endregion
@@ -230,6 +236,7 @@ internal sealed class ConnectionString
230236
public FbWireCrypt WireCrypt => GetWireCrypt(DefaultKeyWireCrypt, _options.TryGetValue);
231237
public string ApplicationName => GetString(DefaultKeyApplicationName, _options.TryGetValue);
232238
public int CommandTimeout => GetInt32(DefaultKeyCommandTimeout, _options.TryGetValue);
239+
public int ParallelWorkers => GetInt32(DefaultKeyParallelWorkers, _options.TryGetValue);
233240

234241
#endregion
235242

@@ -291,6 +298,10 @@ public void Validate()
291298
{
292299
throw new ArgumentException("Cannot use Pooling and NoDatabaseTriggers together.");
293300
}
301+
if (ParallelWorkers < 0)
302+
{
303+
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "'Parallel Workers' value of {0} is not valid.{1}The value should be an integer >= 0.", ParallelWorkers, Environment.NewLine));
304+
}
294305
}
295306

296307
#endregion

src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnectionInternal.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,10 @@ private static DatabaseParameterBufferBase BuildDpb(DatabaseBase db, ConnectionS
651651
{
652652
dpb.Append(IscCodes.isc_dpb_no_garbage_collect, (byte)0);
653653
}
654+
if (options.ParallelWorkers > 0)
655+
{
656+
dpb.Append(IscCodes.isc_dpb_parallel_workers, options.ParallelWorkers);
657+
}
654658

655659
return dpb;
656660
}

0 commit comments

Comments
 (0)