WebCab Probability and Statistics for .NET v3.3 Demo

ADOMediator.OneSelect Method (String, String, String, Object, Boolean)

Invokes method methodName once using values from running one SELECT statement and writes the result(s) back to the database running one INSERT/UPDATE statement.

public void OneSelect(
   string methodName,
   string inputQuery,
   string outputQuery,
   object resultParameters,
   bool storedProcedure
);

Parameters

methodName
The name of the method from the UnderlyingInstance you wish to call.
inputQuery
The SELECT statement which returns the values of the parameters being sent to the methodName method.
outputQuery
The INSERT/UPDATE statement to run in order to populate the values returned by the methodName method to the database.
resultParameters
Named parameters to assign the results of methodName to. If only one result is expected, pass in a String - the name of the named parameter. If more than one value is supposed to be returned by methodName, pass in a String array representing the names of the IN parameters of the output query. If your driver does not support named parameters, the values of the array returned by methodName will be added in the order of their appearance inside the output query.
storedProcedure
If true, the output query is run as a stored procedure, if falsethe output query will be invoked as a regular SQL statement.

Remarks

The parameters of the underlying method can be primitives (e.g. numbers), one-dimensional arrays, but at most one of them can be a two-dimensional array.

The inputQuery parameter of this method specifies the SELECT statement to use in invoking the underlying method. The columns of the result set returned by the SELECT statement correspond to the values of the parameters being sent to the underlying method as described below.

Calling Methods with Primitive Parameters

If methodName takes only non-array parameters, the method will be evaluated only for the first row in the SELECT result-set. The parameters will match their corresponding column in the same order -- first column value goes to the first parameter, second column value goes to the second parameter etc. The number of columns returned must be equal to or greater than the number of parameters in methodName's declaration.

Calling Methods with One-Dimensional Arrays and Primitive Parameters

If methodName takes both non-array and one-dimensional array parameters, the method will be evaluated only for the first row in the SELECT result-set for the non-array parameters, and for the entire column values for the one-dimensional array parameters. The parameters will match their corresponding column in the same order -- first column values go to the first parameter, second column values go to the second parameter etc. The number of columns returned must be equal to or greater than the number of parameters in methodName's declaration.

Calling Methods with a Two-Dimensional Array Parameter

If methodName takes (besides non-array and one-dimensional array parameters) one two-dimensional array parameter, the values being sent to the two-dimensional array parameter stretch between the last of the first columns (corresponding to the first primitive and/or array parameters) and the first of the last columns (corresponding to the last primitive and/or array parameters). In this case, this method will assume that all values returned by the SELECT statement are being used. Also note that every column represents a one-dimensional array element in the two-dimensional array value.

Consider the following example for a fictive underlying method with the following signature:

                double BicubicSplinePointwiseEvaluation(
                                   double[] tabulationPointsInFirstVariable
                                   double[] tabulationPointsInSecondVariable,
                                   double[][] function,
                                   double interpolationPointFirstCoordinate,
                                   double interpolationPointSecondCoordinate)
            

First two parameters will be assigned to the first two columns returned by the SELECT statement and the last two parameters will be assigned to the last two columns. The third parameter, which is a two-dimensional array will be assigned to the remaining columns.

The double value returned by the method will be set as the first IN parameter (specified by the resultParameters parameter) of the output statement. For example, the following output query:

    INSERT INTO TABLE (COLUMN) VALUES (@PARAMETER)

will be run as:

    INSERT INTO TABLE (COLUMN) VALUES (double value)

where double value is the value returned by methodName, and the value of the resultParameters parameter is "@PARAMETER".

See Also

ADOMediator Class | WebCab.Libraries.Statistics.Correlation.ADO Namespace | ADOMediator.OneSelect Overload List