Hi again,

I just saw that in Mysql it´s just appended to the end, so the
processLimitOffset() in Zend\Db\Sql\Platform\IbmDb2\SelectDecorator is a better 
example.

There it seems some manipulation happens, but I don´t know why it´s done that 
way.

Greetings

Marc

> -----Ursprüngliche Nachricht-----
> Von: Marc Tempelmeier [mailto:[email protected]]
> Gesendet: Donnerstag, 27. November 2014 10:37
> An: [email protected]
> Betreff: AW: [fw-general] \Zend\Db and what to do?
> 
> Hi,
> 
> thank you, I have already the adapter platform and got the limit and skip on
> the sql platform working.
> 
> But a few questions remain, in \Zend\Db\Sql\Select in processSelect the
> quantifier are processed.
> The skip and first of informix seem similar and my first apporach was to add
> another select specification with 4 arguments and do something like this:
> 
>     protected $specifications = array(
>         ...
>         self::SELECT => array(
>             'SELECT %1$s FROM %2$s' => array(
>                 array(1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '),
>                 null
>             ),
>             'SELECT %1$s %2$s FROM %3$s' => array(
>                 null,
>                 array(1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '),
>                 null
>             ),
>             'SELECT SKIP %1$s FIRST %2$s %3$s FROM %4$s' => array(
>                 null,
>                 null,
>                 array(1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '),
>                 null
>             ),
>             'SELECT %1$s' => array(
>                 array(1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '),
>             ),
>         ),
>        ...
> 
> in processSelect() I return:
>         if (!isset($table)) {
>             return array($columns);
>         } elseif (isset($quantifier)) {
>             return array($quantifier, $columns, $table);
>         } elseif (isset($this->offset) && isset($this->limit)) {
>             return array($this->offset, $this->limit, $columns, $table);
>         } else {
>             return array($columns, $table);
>         }
> 
> That worked likea charm, but is a totally other way than in Platform\MySql.
> Is there an oversight on my side why the other method is better in Mysql?
> 
> Greetings
> 
> Marc
> 
> 
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Ralf Eggert [mailto:[email protected]]
> > Gesendet: Mittwoch, 26. November 2014 17:43
> > An: [email protected]
> > Betreff: Re: [fw-general] \Zend\Db and what to do?
> >
> > Hi Marc,
> >
> > first of all, I have no idea about informix at all. But this is what I
> > would do to start informix support for ZF2.
> >
> > First, you need the driver. You must decide if you want to use PDO or
> > the native ifx extension. If you want to use PDO the driver part is
> > quite simple, because you can use the Zend\Db\Adapter\Driver\Pdo. If
> > not you need to implement the native ifx support. Please look at the
> > classes of Zend\Db\Adapter\Driver\Mysqli to get you started.
> >
> > Second, you need the platform. For example look at the MySQL
> > implementation at Zend\Db\Adapter\Platform\Mysql. The platform is
> > independent from the driver, ie. from PDO or ifx support.
> >
> > Third, you need the SQL implementation. Please look at the classes of
> > Zend\Db\Sql\Platform\Mysql for MySQL inspiration. The concrete
> > implementation for LIMIT and OFFSET can be found in the class
> > Zend\Db\Sql\Platform\Mysql\SelectDecorator.
> >
> > Please could others correct me, if I am wrong in any point?
> >
> > Marc, good luck and have fun. Although I won't need it personally, but
> > it would be nice if you could add your implementation to the framework
> > by a PR if finished or at least create a module for the informix support.
> >
> > Thanks and best regards,
> >
> > Ralf
> >
> > --
> > List: [email protected]
> > Info: http://framework.zend.com/archives
> > Unsubscribe: [email protected]
> >

Reply via email to