Page 2 of 2

Configure postgres

Posted: Tue Aug 03, 2010 11:04 am
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

Configure postgres

Posted: Wed Aug 04, 2010 1:46 am
by Vladimir
Hello, Tony

We have corrected our code considering your improvements.

Thank you very much!