Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
PostgreSQL Database Driver
  • Once upon a time, a system administrator was informed by an intern that this new MVC framework came out and uses the latest of PHP 5.3. The systems administrator liked it and started playing with it. Before him was a problem, a postgresql admin and a really cool framework without native support (PDO is ugly.) So some new code was born (out of the code for the MySQL driver.) This is a very early start to a native PostgreSQL driver. So far I've been able to run a select! It works exactly the same as the MySQL database driver and uses the same framework. This is a patch to the FuelPHP core. It is two added classes and two extra lines in the bootstrap.php. This adds the "pgsql" database type and takes the same arguments as the MySQL database. I've loaded up what I have so far to LaunchPad, but it has a little ways to go. Types still have to be updated. Also there is a slight issue with the differences between MySQL and PostgreSQL. PG supports multiple auto-incremented columns and primary keys, where MySQL doesn't so "returned" ids on inserted rows will sometimes be arrays. This needs to be changed to completely accommodate FuelPHP's design. Code is here: https://launchpad.net/fuel-native-pgsql At the time of this post, this is very bleeding edge. I haven't tested half a dozen things but so far it can select from a single table. (I know, I know, it's not a lot but it is a a start.) Also, does fuel require that this code be under a particular license since it is in the core? If it doesn't matter I'm thinking GNU GPL v3. Example config/db.php
    Fuel::DEVELOPMENT => array(
            'type'          => 'pgsql',
            'connection'    => array(
                'hostname'  => 'localhost',
                'database'  => 'foo_bar_com',
                'username'  => 'superfoo',
                'password'  => 'superbar',
                'persistent'=> true,
            ),
            'table_prefix'  => 'fb_',
            'charset'       => 'utf8',
            'caching'       => false,
            'profiling'     => false,
        ),
    
    Cheers,
    Jon
  • After further consideration, I have merged this into a fork of the latest version of FuelPHP on github rather than using Launchpad and Bazaar. (I put this code up early in the morning without thinking of where it really should go.) I pushed this into the latest 1.0.1 of FuelPHP in my own branch: https://github.com/jrdoane/core Please experiment with it and let me know of any bugs. I suspect the most issues will be with the DDL sql wrappers.
  • If you want this to be usable for other Fuel users, you'll have to make it a package. You should (nay must) not hack in the core code. Make the package part of the core (see Auth on how to do that), and make sure you follow the same path structure in classes as for the core DB classes. Once you've done that, the driver can be activated by simply enabling the package.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion