Configure postgres

Stimulsoft Reports.PHP discussion
tony.tomov
Posts: 72
Joined: Mon Jun 07, 2010 2:39 am

Configure postgres

Post by tony.tomov »

Hello Vladimir,
Here is the fix for my convertPgSqlType
More info here:

http://www.php.net/manual/en/function.pg-field-type.php

Code: Select all

function convertPgSqlType($type)
    {
        switch (strtolower($type))
        {
            case "varchar":
            case "bpchar":
            case "macaddr":
            case "inet":
            case "money":
            case "text":
            case "interval":
            case "bit":
            case "varbit":
            case "bytea":
                return "System.String";

            case "bool":
                return "System.Boolean";

            case "int8":
            case "int4":
            case "int2":
                return "System.Int32";

            case "date":
            case "time":
            case "timetz":
            case "timestamp":
            case "timestamptz":
                return "System.DateTime";
            default:
                return "System.Decimal";
        }

        return $type;
    }

I hope that this is a better solution.

Regards
Tony
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Configure postgres

Post by Vladimir »

Hello, Tony

We have corrected our code considering your improvements.

Thank you very much!
Post Reply