Hi Jiri

This might also help?

Thanks

Alexander Muylaert wrote: 
Otis wrote: 
As you use a non-final Firebird build, it might be you use features not
supported by the Firebird ADO.NET provider yet. The thing is, we use the
GetSchema "ProcedureParameters" call of the ADO.NET provider to obtain the
parameters. I.o.w.: the firebird ADO.NET provider you're using will provide
the meta-data for the parameters. If you're using a Firebird ado.net
provider version which isn't capable of obtaining the parameter data from
the firebird db properly, the driver of llblgen pro won't get them either. 

So, check whether the firebird ado.net provider you're using is indeed
capable of providing the proper meta-data from a v2.5RC database and if not,
upgrade to the latest version of the firebird ado.net provider (make sure
you update the llblgenpro.exe.config file with the proper factory
definition) 


I'll check with Jiri from firebird foundation, but I'm pretty sure his
driver (2.5.2) is capable of doing this. I'll come back to this.
 

This is the code we use:
Code: 

protected override void RetrieveStoredProcedureAndParameterMetaData(DBSchema
schemaToFill, IEnumerable<DBElementName> elementNames)
{
    List<DBStoredProcedure> storedProceduresToRemove = new
List<DBStoredProcedure>();

    DbConnection connection = this.DriverToUse.CreateConnection();
    try
    {
        connection.Open();

        foreach(DBElementName storedProcedureName in elementNames)
        {
            DBStoredProcedure storedProcedure = new
DBStoredProcedure(schemaToFill, storedProcedureName);
            schemaToFill.StoredProcedures.Add(storedProcedure);

            DataTable parametersInStoredProcedure =
connection.GetSchema("ProcedureParameters", new[] { null, null,
storedProcedure.Name});

            try
            {
                var parameters = from row in
parametersInStoredProcedure.AsEnumerable()
                                 let typeDefinition =
CreateTypeDefinition(row, "PARAMETER_DATA_TYPE", "PARAMETER_SIZE")
                                 select new
DBStoredProcedureParameter(row.Value<string>("PARAMETER_NAME"),
typeDefinition, row.Value<string>("DESCRIPTION"))
                                 {
                                     OrdinalPosition =
row.Value<int>("ORDINAL_POSITION")+1,
                                     Direction =
DetermineParameterDirection((ParameterDirection)row.Value<int>("PARAMETER_DI
RECTION")),
                                     ParentStoredProcedure = storedProcedure
                                 };
                    
                storedProcedure.Parameters.AddRange(p=>p.OrdinalPosition,
parameters);
            }
            catch(InvalidCastException ex)
            {
                // non fatal error, remove the stored procedure, proceed 
                schemaToFill.LogError(ex, "Stored procedure '" +
storedProcedure.Name + "' removed from list due to cast exception in
Parameter population.",
"FirebirdSchemaRetriever::RetrieveStoredProcedureAndParameterMetaData");
                storedProceduresToRemove.Add(storedProcedure);
            }
        }
    }
    finally
    {
        connection.SafeClose(true);
    }

    foreach(DBStoredProcedure proc in storedProceduresToRemove)
    {
        schemaToFill.StoredProcedures.Remove(proc);
    }
}
 


and
Code: 

/// <summary>
/// Determines the parameter direction.
/// </summary>
/// <param name="direction">The direction.</param>
/// <returns>the parameter direction</returns>
private static ParameterDirection
DetermineParameterDirection(ParameterDirection direction)
{
    ParameterDirection toReturn;

    switch(direction)
    {
        case ParameterDirection.Input:
            toReturn = ParameterDirection.Input;
            break;
        case ParameterDirection.Output:
            toReturn = ParameterDirection.Output;
            break;
        default:
            toReturn = ParameterDirection.InputOutput;
            break;
    }
    return toReturn;
}
 


The CreateTypeDefinition is not relevant in this case. 

So if you use 2.5.2 and the schema we call gives the proper parameter
definitions, they'll end up in the proc.


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to