Page 1 of 1

query interface

Posted: Mon Jun 25, 2007 12:28 am
by zyklone
I want to create my own query abstraction. is it best way to do:

Code: Select all

interface Sql
{
     public function query($sql) {}
     public function fetch_array($result) {}
     ... etc ...
}

class Mysql implements Sql
{
   public function query($sql)
   {
        ... implementation...
    }

    public function fetch_array($result)
    {
         ... implementation... 
    }
}

class Mssql implements SQL
{
    ....etc....
}
is that the best way to to?

Posted: Mon Jun 25, 2007 1:15 am
by Christopher
There is another thread looking into creating a similar class:

viewtopic.php?t=69653&highlight=

You might want to combine efforts and find the past threads that have covered this topic.