AnantLabs / wwwsqldesigner

Automatically exported from code.google.com/p/wwwsqldesigner
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

PDO Contribution #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Attached files to support pdo_pgsql and pdo_mysql.

Edit index.php to fill in the config :
    public static function getConfig($id)
    {
        switch($id)
        {
            case 'saveloadlist':
                $type = 'pgsql';
                $dsn = 'pgsql:dbname=wwwsqldesigner';
                $user = 'wwwsqldesigner';
                $pass = 'xxx';
                $table = 'wwwsqldesigner';
                return array($type,$dsn,$user,$pass,$table);
            case 'import':
                $type = 'pgsql';
                $dsn = 'pgsql:dbname=wwwsqldesigner;host=localhost';
                //$type = 'mysql';
                //$dsn = 'mysql:dbname=wwwsqldesigner;host=localhost';
                $user = 'wwwsqldesigner';
                $pass = 'xxx';
                return array($type,$dsn,$user,$pass);
        }
    }

Could not fully test with mysql (since my local server talked bad to me).
With postgres it's 100% verified and shall not contain any bug.

You must enable it in the config.js
You have to enable php_pdo_mysql or php_pdo_pgsql extensions in your php 
configuration.

Original issue reported on code.google.com by geompse@gmail.com on 15 Mar 2010 at 3:48

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by ondrej.zara on 15 Mar 2010 at 5:15

GoogleCodeExporter commented 9 years ago
Added in r87, thanks!

Original comment by ondrej.zara on 16 Mar 2010 at 1:36

GoogleCodeExporter commented 9 years ago
I forgot to mention something REALLY important about this.

In the php-postgres and php-mysql backends, there is too many requests done.

 - 1 for fetching T tables
 - T for fetching C columns per table
 - C(T) for fetching R relations per column per table
 - T for fetching K keys per table
 => [ 1 + T + sum(C(T)) + T ] requests

In the php-pdo I made some caching (in RAM) with static properties :
 - 1 for fetching T tables
 - 1 for fetching sum(C(T)) columns
 - 1 for fetching sum(R(C(T))) relations
 - 1 for fetching sum(K(T)) keys
 => 4 requests

On my test site 1 request is ~200ms.
I have a large database : 111 tables, 1055 columns, 224 relations, 304 keys
 => php-pdo : 4 requests = 800ms
 => php-postgresql : 111+1055+224+304 = 1694 requests = 338.8s = 5min 38s 800ms
        [ PHP script times out ]

This behavior can also be achieved for php-mysql and php-postgres BUT the use 
of the 
"static" keyword break compatibility with PHP 4...

Original comment by geompse@gmail.com on 16 Mar 2010 at 6:31

GoogleCodeExporter commented 9 years ago
(while in case since PDO is implement with PHP 5+, it does not matter using 
this 
syntax)

Original comment by geompse@gmail.com on 16 Mar 2010 at 6:32