Defcon Kekekekekakl (blog)

5Mar/070

I am utterly in AWE

I had no IDEA it was possible to write this kind of code in a production software framework!! Just look at this snippet from "xoops 2.0":

     /**
     * perform a query
     *
     * This method is empty and does nothing! It should therefore only be
     * used if nothing is exactly what you want done! ;-)
         *
     * @param string $sql a valid MySQL query
     * @param int $limit number of records to return
     * @param int $start offset of first record to return
     *
     * @abstract
         */
         function query($sql, $limit=0, $start=0)
         {
         }

This code is from the file xoops2jp/html/class/database/mysqldatabase.php
and is just one of many very interresting elements in the code of said
software product. Here's another interresting piece of code, from the same file:

     /**
     * generate an ID for a new row
     *
     * This is for compatibility only. Will always return 0, because MySQL supports
     * autoincrement for primary keys.
     *
     * @param string $sequence name of the sequence from which to get the next ID
     * @return int always 0, because mysql has support for autoincrement
     */
        function genId($sequence)
        {
                return 0; // will use auto_increment
        }

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.