Configure postgres

Stimulsoft Reports.PHP discussion
esr
Posts: 3
Joined: Sun Jul 18, 2010 12:47 pm
Location: Chile

Configure postgres

Post by esr »

Hello.
Currently developing applications with Delphi for PHP and PostgreSQL. How I have to configure "Stimulsoft Reports.Fx for PHP" for use with postgres?.
When I try to configure the connection Dictionary-> New Connection-> only appears: "XML Data" and "MySQL Connection".

Thank you very much.

ESR.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Configure postgres

Post by Vladimir »

Hello,

Support for PostgreSQL data sources has already been finished, the new version of Stimulsoft Reports.Fx for PHP will be available tomorrow.

Thank you.
esr
Posts: 3
Joined: Sun Jul 18, 2010 12:47 pm
Location: Chile

Configure postgres

Post by esr »

Hello.
Today I downloaded the latest version available for php, and still shows no connection to postgres or through ODBC.
ESR
Attachments
504.Doc1.pdf
(205.38 KiB) Downloaded 722 times
Edmund Andersson
Posts: 35
Joined: Thu May 20, 2010 11:26 am
Location: Sweden

Configure postgres

Post by Edmund Andersson »

Beta 2 is the "old" Beta Version, a new version is still not released.

/Edmund Andersson
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Configure postgres

Post by Jan »

Hello,

New version will be available at 24 July. At this moment we at final stage of testing.

Thank you.
Andrew
Posts: 4107
Joined: Fri Jun 09, 2006 3:58 am

Configure postgres

Post by Andrew »

Hello,

Sorry for the delay with response. Our new Beta 3 version is published.

Thank you.
esr
Posts: 3
Joined: Sun Jul 18, 2010 12:47 pm
Location: Chile

Configure postgres

Post by esr »

Hello.
I have tried to connect, but I could not. I am using the following parameters:
Server=localhost;Port=5432;Database=DEMO;UserId=postgres;Password=123456;

Could help to correctly configure postgres connection?
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Configure postgres

Post by Vladimir »

Hello,

We checked the connection to PostgreSQL database and found an error on the server side script. We send you a corrected PHP script, please see the attacher archive.

Thank you.
Attachments
509.php_script_beta3.zip
(3.26 KiB) Downloaded 365 times
tony.tomov
Posts: 72
Joined: Mon Jun 07, 2010 2:39 am

Configure postgres

Post by tony.tomov »

Hello Vladimir,

I think that PostgreSQL driver has a lot of bugs.

1. It seems like the PosgreSQL driver uses parseMySqlConnectionString to configure connection.
This is wrong since the default port of PostgreSQL is 5432 and not 3306 (MySQL)
In order to fix I think that a separate parsePgSqlConnectionString function should be created with the following default settings.

Code: Select all

	function parsePgSqlConnectionString($connectionString)
	{
		class connectionInfo {
			var $host;
			var $port = "5432";
			var $database;
			var $userId;
			var $password;
		}
...
2. The function getPostgreSQLDatabaseColumns uses a wrong convertMySqlType function to get the field types.
In order to fix I have created convertPgSqlType which replaces convertMySqlType in getPostgreSQLDatabaseColumns function.
The function look like this (It can be refined)

Code: Select all

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

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

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

			case "float4":
			case "float8":
			case "numeric":
				return "System.Decimal";

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

		return $type;
	}
Hope this help ;-)

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

Configure postgres

Post by Vladimir »

Hello, Tony

Thank you for you excellent help, we will include these corrections in the next version of Reports.Fx for PHP.

Thanks.
Post Reply