internal static ObjectNameResolver[] GetSyntaxPatterns(AbstractDBConnection connection)
            {
                ArrayList collection = new ArrayList();

                collection.Add(new ObjectNameResolver(NameOrder));

                ObjectNameResolversCollection basic = (ObjectNameResolversCollection)ConfigurationSettings.GetConfig("Mainsoft.Data.Configuration/objectnameresolution");

                java.sql.DatabaseMetaData metaData = connection.JdbcConnection.getMetaData();
                string productName = metaData.getDatabaseProductName();

                foreach (ObjectNameResolver nameResolver in basic)
                {
                    if (productName.IndexOf(nameResolver.DbName) != -1)
                    {
                        collection.Add(nameResolver);
                    }
                }

                //defaults
                if (metaData.isCatalogAtStart())
                {
                    collection.Add(new ObjectNameResolver(SchemaNameOrder));
                    collection.Add(new ObjectNameResolver(CatalogNameOrder));
                    collection.Add(new ObjectNameResolver(CatalogSchemaNameOrder));
                    collection.Add(new ObjectNameResolver(SchemaCatalogNameOrder));
                }
                else
                {
                    collection.Add(new ObjectNameResolver(CatalogNameOrder));
                    collection.Add(new ObjectNameResolver(SchemaNameOrder));
                    collection.Add(new ObjectNameResolver(SchemaCatalogNameOrder));
                    collection.Add(new ObjectNameResolver(CatalogSchemaNameOrder));
                }

                return((ObjectNameResolver[])collection.ToArray(typeof(ObjectNameResolver)));
            }
        internal ArrayList GetProcedureColumns(String procedureString, AbstractDbCommand command)
        {
            ArrayList col = new ArrayList();

            try
            {
                ObjectNameResolver[] nameResolvers = SyntaxPatterns;
                java.sql.ResultSet   res           = null;
                string catalog = null;
                string schema  = null;
                string spname  = null;

                java.sql.DatabaseMetaData metadata = JdbcConnection.getMetaData();
                bool storesUpperCaseIdentifiers    = false;
                bool storesLowerCaseIdentifiers    = false;
                try
                {
                    storesUpperCaseIdentifiers = metadata.storesUpperCaseIdentifiers();
                    storesLowerCaseIdentifiers = metadata.storesLowerCaseIdentifiers();
                }
                catch (SQLException e)
                {
                    // suppress
                }

                for (int i = 0; i < nameResolvers.Length; i++)
                {
                    ObjectNameResolver nameResolver = nameResolvers[i];
                    Match match = nameResolver.Match(procedureString);

                    if (match.Success)
                    {
                        spname  = ObjectNameResolver.GetName(match);
                        schema  = ObjectNameResolver.GetSchema(match);
                        catalog = ObjectNameResolver.GetCatalog(match);

                        // make all identifiers uppercase or lowercase according to database metadata
                        if (storesUpperCaseIdentifiers)
                        {
                            spname  = (spname.Length > 0) ? spname.ToUpper() : null;
                            schema  = (schema.Length > 0) ? schema.ToUpper() : null;
                            catalog = (catalog.Length > 0) ? catalog.ToUpper() : null;
                        }
                        else if (storesLowerCaseIdentifiers)
                        {
                            spname  = (spname.Length > 0) ? spname.ToLower() : null;
                            schema  = (schema.Length > 0) ? schema.ToLower() : null;
                            catalog = (catalog.Length > 0) ? catalog.ToLower() : null;
                        }
                        else
                        {
                            spname  = (spname.Length > 0) ? spname : null;
                            schema  = (schema.Length > 0) ? schema : null;
                            catalog = (catalog.Length > 0) ? catalog : null;
                        }

                        // catalog from db is always in correct caps
                        if (catalog == null)
                        {
                            catalog = JdbcConnection.getCatalog();
                        }

                        try
                        {
                            // always get the first procedure that db returns
                            res = metadata.getProcedures(catalog, schema, spname);
                            if (res.next())
                            {
                                catalog = res.getString(1);
                                schema  = res.getString(2);
                                spname  = res.getString(3);
                                break;
                            }

                            spname = null;
                        }
                        catch // suppress exception
                        {
                            return(null);
                        }
                        finally
                        {
                            if (res != null)
                            {
                                res.close();
                            }
                        }
                    }
                }

                if (spname == null || spname.Length == 0)
                {
                    return(null);
                }

                try
                {
                    // get procedure columns based o  procedure metadata
                    res = metadata.getProcedureColumns(catalog, schema, spname, null);
                    while (res.next())
                    {
                        // since there is still a possibility that some of the parameters to getProcedureColumn were nulls,
                        // we need to filter the results with strict matching
                        if ((res.getString(1) != catalog) || (res.getString(2) != schema) || (res.getString(3) != spname))
                        {
                            continue;
                        }

                        AbstractDbParameter parameter = (AbstractDbParameter)command.CreateParameter();

                        parameter.SetParameterName(res);
                        parameter.SetParameterDbType(res);
                        parameter.SetSpecialFeatures(res);

                        //get parameter direction
                        short direction = res.getShort("COLUMN_TYPE");
                        if (direction == 1) //DatabaseMetaData.procedureColumnIn
                        {
                            parameter.Direction = ParameterDirection.Input;
                        }
                        else if (direction == 2) //DatabaseMetaData.procedureColumnInOut
                        {
                            parameter.Direction = ParameterDirection.InputOutput;
                        }
                        else if (direction == 4) //DatabaseMetaData.procedureColumnOut
                        {
                            parameter.Direction = ParameterDirection.Output;
                        }
                        else if (direction == 5) //DatabaseMetaData.procedureColumnReturn
                        {
                            parameter.Direction = ParameterDirection.ReturnValue;
                        }

                        //get parameter precision and scale
                        parameter.SetParameterPrecisionAndScale(res);

                        parameter.SetParameterSize(res);
                        parameter.SetParameterIsNullable(res);

                        col.Add(parameter);
                    }
                }
                finally
                {
                    if (res != null)
                    {
                        res.close();
                    }
                }
            }
            catch (Exception e)
            {
                //supress
#if DEBUG
                Console.WriteLine("Exception catched at AbstractDBConnection.GetProcedureColumns() : {0}\n{1}\n{2}", e.GetType().FullName, e.Message, e.StackTrace);
#endif
            }
            return(col);
        }