Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SecureADODB] Needs an IDbParameter abstraction #3

Open
retailcoder opened this issue Apr 22, 2020 · 0 comments
Open

[SecureADODB] Needs an IDbParameter abstraction #3

retailcoder opened this issue Apr 22, 2020 · 0 comments

Comments

@retailcoder
Copy link
Member

retailcoder commented Apr 22, 2020

Having an IDbParameter interface, and tweaking IDbCommand.Execute methods' ParamArray handling to accept it, would allow providing named and output parameters inline, without needing to deal with ADODB.Parameter directly.

The interface should expose the ADODB.Parameter object (much like DbConnection exposes the ADODB.Connection object) - this should fit the bill:

'@Interface
'@ModuleDescription("An object representing a command parameter.")
Option Explicit

Public Property Get Parameter() As ADODB.Parameter
End Property

Public Property Get ParameterName() As String
End Property

Public Property Get ParameterValue() As Variant
End Property

Public Property Get ParameterType() As ADODB.DataTypeEnum
End Property

Public Property Get ParameterDirection() As ADODB.ParameterDirectionEnum
End Property

Public Property Get ParameterSize() As Long

Public Property Get IsNamedParameter() As Boolean
End Property

Needs a StubDbParameter implementation for unit tests, and the DbParameter class needs to property-inject the properties through a number of factory methods:

  • Create should take in all dependencies
  • FromValue should take in a value (and an optional name, direction, and size)
  • NullValue should take in a data type (and an optional name, direction, and size)

The IsNamedParameter get-only property should return True if a name was supplied. Unit tests should validate that a command doesn't accept mixed named & ordinal parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant