<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$
 */
 
  uses('rdbms.ConnectionManager');
  
  /**
   * Class wrapper for table news
   * (Auto-generated on Sun,  2 Feb 2003 16:04:33 +0100 by thekid)
   *
   * Uses rdbms.ConnectionManager which is expected to have at least
   * one connection registered by name "caffeine".
   *
   * @purpose  Datasource accessor
   */
  class XPNews extends Object {
    var
      $news_id      = 0,
      $caption      = '',
      $link         = '',
      $body         = '',
      $created_at   = NULL,
      $lastchange   = NULL,
      $changedby    = '',
      $bz_id        = 0;

    /**
     * Gets an instance of this object by unique index "news_news_i_640032591"
     *
     * @access  static
     * @param   int news_id
     * @return  &net.xp-framework.db.caffeine.XPNews object
     * @throws  rdbms.SQLException in case an error occurs
     * @throws  rdbms.ConnectionNotRegisteredException
     */
    function &getByNews_id($news_id) {
      $cm= &ConnectionManager::getInstance();  
      $db= &$cm->getByHost('caffeine', 0);

      try(); {
        list($data)= $db->select('
          select
            news_id,
            caption,
            link,
            body,
            created_at,
            lastchange,
            changedby,
            bz_id
          from
            news 
          where
            news_id = %d
        ', $news_id);
      } if (catch('SQLException', $e)) {
        return throw($e);
      }
      
      if ($data) return new XPNews($data); else return NULL;
    }

    /**
     * Gets an array of instances of this object by bz_id
     *
     * @access  static
     * @param   int bz_id
     * @return  &net.xp-framework.db.caffeine.XPNews[] objects
     * @throws  rdbms.SQLException in case an error occurs
     * @throws  rdbms.ConnectionNotRegisteredException
     */
    function &getByBz_id($bz_id) {
      $cm= &ConnectionManager::getInstance();  
      $db= &$cm->getByHost('caffeine', 0);

      try(); {
        $q= &$db->query('
          select
            news_id,
            caption,
            link,
            body,
            created_at,
            lastchange,
            changedby,
            bz_id
          from
            news
          where
            bz_id = %d
        ', $bz_id);
        
        $n= array();
        while ($data= $q->next()) {
          $n[]= &new XPNews($data);
        }
      } if (catch('SQLException', $e)) {
        return throw($e);
      }

      return $n;
    }

    /**
     * Gets an array of instances of this object descendingly ordered by created_at
     * (newest first)
     *
     * @access  static
     * @param   int max default -1 maximum number of rows to get)
     * @return  &net.xp-framework.db.caffeine.XPNews[] objects
     * @throws  rdbms.SQLException in case an error occurs
     * @throws  rdbms.ConnectionNotRegisteredException
     */
    function &getByDateOrdered($max= -1) {
      $cm= &ConnectionManager::getInstance();  
      $db= &$cm->getByHost('caffeine', 0);

      try(); {
        if (-1 != $max) $db->query('set rowcount %d', $max);
        $q= &$db->query('
          select<commit_msg>- QA: fix @model, @access   @model is one of 'abstract', 'static'   @access is one of 'public', 'protected', 'private'<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$
 */
 
  uses('rdbms.ConnectionManager');
  
  /**
   * Class wrapper for table news
   * (Auto-generated on Sun,  2 Feb 2003 16:04:33 +0100 by thekid)
   *
   * Uses rdbms.ConnectionManager which is expected to have at least
   * one connection registered by name "caffeine".
   *
   * @purpose  Datasource accessor
   */
  class XPNews extends Object {
    var
      $news_id      = 0,
      $caption      = '',
      $link         = '',
      $body         = '',
      $created_at   = NULL,
      $lastchange   = NULL,
      $changedby    = '',
      $bz_id        = 0;

    /**
     * Gets an instance of this object by unique index "news_news_i_640032591"
     *
     * @model   static
     * @access  public
     * @param   int news_id
     * @return  &net.xp-framework.db.caffeine.XPNews object
     * @throws  rdbms.SQLException in case an error occurs
     * @throws  rdbms.ConnectionNotRegisteredException
     */
    function &getByNews_id($news_id) {
      $cm= &ConnectionManager::getInstance();  
      $db= &$cm->getByHost('caffeine', 0);

      try(); {
        list($data)= $db->select('
          select
            news_id,
            caption,
            link,
            body,
            created_at,
            lastchange,
            changedby,
            bz_id
          from
            news 
          where
            news_id = %d
        ', $news_id);
      } if (catch('SQLException', $e)) {
        return throw($e);
      }
      
      if ($data) return new XPNews($data); else return NULL;
    }

    /**
     * Gets an array of instances of this object by bz_id
     *
     * @model   static
     * @access  public
     * @param   int bz_id
     * @return  &net.xp-framework.db.caffeine.XPNews[] objects
     * @throws  rdbms.SQLException in case an error occurs
     * @throws  rdbms.ConnectionNotRegisteredException
     */
    function &getByBz_id($bz_id) {
      $cm= &ConnectionManager::getInstance();  
      $db= &$cm->getByHost('caffeine', 0);

      try(); {
        $q= &$db->query('
          select
            news_id,
            caption,
            link,
            body,
            created_at,
            lastchange,
            changedby,
            bz_id
          from
            news
          where
            bz_id = %d
        ', $bz_id);
        
        $n= array();
        while ($data= $q->next()) {
          $n[]= &new XPNews($data);
        }
      } if (catch('SQLException', $e)) {
        return throw($e);
      }

      return $n;
    }

    /**
     * Gets an array of instances of this object descendingly ordered by created_at
     * (newest first)
     *
     * @model   static
     * @access  public
     * @param   int max default -1 maximum number of rows to get)
     * @return  &net.xp-framework.db.caffeine.XPNews[] objects
     * @throws  rdbms.SQLException in case an error occurs
     * @throws  rdbms.ConnectionNotRegisteredException
     */
    function &getByDateOrdered($max= -1) {
      $cm= &ConnectionManager::getInstance();  
      $db= &$cm->getByHost('caffeine', 0);

      try(); {
        if (-1 != $max) $db->query('set rowcount %d', $max);
        $q= &$db->query('
          select
{'fraction_non_alphanumeric': 0.1217364905889496, 'fraction_numerical': 0.009714632665452338, 'mean_word_length': 1.673022312373225, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3867522', 'n_tokens_mistral': 2132, 'n_tokens_neox': 2024, 'n_words': 524}