示例#1
0
        internal static Collection<PgFunction> GetFunctions(DataTable table)
        {
            Collection<PgFunction> procedures = new Collection<PgFunction>();

            if (table.Rows.Count > 0)
            {
                foreach (DataRow row in table.Rows)
                {
                    PgFunction function = new PgFunction
                    {
                        FunctionOid = Conversion.TryCastString(row["oid"]),
                        FunctionDefinition = Conversion.TryCastString(row["definition"]),
                        RowNumber = Conversion.TryCastLong(row["row_number"]),
                        Name = Conversion.TryCastString(row["function_name"]),
                        SchemaName = Conversion.TryCastString(row["object_schema"]),
                        Arguments = Conversion.TryCastString(row["arguments"]),
                        ResultType = Conversion.TryCastString(row["result_type"]),
                        FunctionType = Conversion.TryCastString(row["function_type"]),
                        Owner = Conversion.TryCastString(row["owner"]),
                        Description = Conversion.TryCastString(row["description"])
                    };

                    procedures.Add(function);
                }
            }

            return procedures;
        }
示例#2
0
        private static void BuildDocumentation(string content, PgFunction function)
        {
            content = content.Replace("[DBName]", Program.Database.ToUpperInvariant());

            content = Parsers.FunctionParser.Parse(content, function);

            string targetPath = System.IO.Path.Combine (OutputPath, function.SchemaName, function.Name + "-" + function.FunctionOid + ".html");

            FileHelper.WriteFile(content, targetPath);
        }
示例#3
0
        internal static string Parse(string content, PgFunction procedure)
        {
            StringBuilder items = new StringBuilder();

            items.Append(content.Replace("[Name]", procedure.Name)
                .Replace("[TriggerSchema]", procedure.SchemaName)
                .Replace("[FunctionSchema]", procedure.SchemaName)
                .Replace("[Arguments]", procedure.Arguments)
                .Replace("[RowNumber]", procedure.RowNumber.ToString())
                .Replace("[Owner]", procedure.Owner)
                .Replace("[ResultType]", procedure.ResultType)
                .Replace("[FunctionType]", procedure.FunctionType)
                .Replace("[FunctionOid]", procedure.FunctionOid)
                .Replace("[Definition]", procedure.FunctionDefinition)
                .Replace("[Description]", procedure.Description));

            content = content.Replace(content, items.ToString());

            return content;
        }
示例#4
0
        internal static void Run(PgFunction function)
        {
            string content = FileHelper.ReadResource(TemplatePath);

            BuildDocumentation(content, function);
        }