Thanks to Rick for updating a very useful plugin. Much to my surprise,
the required changes were indeed minimal.

Thanks to Blake and Rick for correcting my knowledge.

On Sep 17, 7:14 pm, Blake Johnson <[EMAIL PROTECTED]> wrote:
> > This snippet from the wonderful (and now broken) monthly archives
> > plugin illustrates the point beautifully
>
> > $q= 'SELECT YEAR( p.pubdate ) AS year, MONTH( p.pubdate ) AS month,
> > COUNT( p.id ) AS cnt
> >        FROM ' . DB::table( 'posts' ) . ' p
> >        WHERE p.content_type = ? AND p.status = ?
> >        GROUP BY year, month
> >        ORDER BY p.pubdate DESC ' . $limit
>
> > Self-documenting, captures all the semantics in five lines, portable
> > to all database platforms.
>
> I'd just like to point out that YEAR() and MONTH() are MySQL specific
> funcitons. So, this query is not portable to all platforms. It
> happened to work, previously, because we provided translations for
> SQLite and PostgreSQL.
>
> I will also mention that you don't have to write your own query to do
> this. It is provided by the API with:
> $counts = Posts::get( array( 'month_cts' => 1, 'status' =>
> Post::status( 'published' ) ) );
>
> If plugins use our API which abstracts DB details, upgrades will be
> much less painful.
>
> --Blake
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/habari-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to