Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 55eb350

Browse files
dant02Daniel Trubač
and
Daniel Trubač
authored
Add property FbCommand.NamedParameters (#1161) (#1168)
Co-authored-by: Daniel Trubač <trubacd@elektlabs.cz>
1 parent b1d6fa2 commit 55eb350

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

‎src/FirebirdSql.Data.FirebirdClient.Tests/FbCommandTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,22 @@ public async Task NamedParametersReuseTest()
187187
}
188188
}
189189

190+
[Test]
191+
public async Task NamedParametersPublicAccessor()
192+
{
193+
await using (var command = new FbCommand("select * from test where int_field >= @x1 and int_field <= @x2", Connection))
194+
{
195+
Assert.IsNotNull(command.NamedParameters, "Unexpected null reference.");
196+
Assert.IsTrue(command.NamedParameters.Count == 0, "Expected count 0 of named parameters before command prepare.");
197+
198+
await command.PrepareAsync();
199+
200+
Assert.IsTrue(command.NamedParameters.Count == 2, "Expected count 2 of named parameters after command prepare.");
201+
Assert.AreEqual(command.NamedParameters[0], "@x1");
202+
Assert.AreEqual(command.NamedParameters[1], "@x2");
203+
}
204+
}
205+
190206
[Test]
191207
public async Task ExecuteStoredProcTest()
192208
{

‎src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbBatchCommand.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,16 @@ public int BatchBufferSize
192192
}
193193
}
194194

195+
/// <summary>
196+
/// Gets collection of parameters parsed from the query text during command prepare.
197+
/// </summary>
198+
[Browsable(false)]
199+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
200+
public IReadOnlyList<string> NamedParameters
201+
{
202+
get { return _namedParameters; }
203+
}
204+
195205
#endregion
196206

197207
#region Internal Properties

‎src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbCommand.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,16 @@ public int FetchSize
198198
}
199199
}
200200

201+
/// <summary>
202+
/// Gets collection of parameters parsed from the query text during command prepare.
203+
/// </summary>
204+
[Browsable(false)]
205+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
206+
public IReadOnlyList<string> NamedParameters
207+
{
208+
get { return _namedParameters; }
209+
}
210+
201211
#endregion
202212

203213
#region Protected DbCommand Properties

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /