示例#1
0
function getSQLResults($sql = '')
{
    global $application;
    $dbprefix = $application->getAppIni('DB_TABLE_PREFIX');
    if ($sql) {
        $sql = str_replace('{dbprefix}', $dbprefix, $sql);
        $m = new DB_MySQL();
        $m->QueryResult = $m->DB_Query($sql);
        $m->DB_Result(QUERY_RESULT_ASSOC);
        $result = $m->ResultArray;
        unset($m);
        return $result;
    } else {
        return array();
    }
}
示例#2
0
 /**
  * An alias of mysql_list_tables.
  *
  * @return array returns the table list, specified in the database
  * @param string $db_name - the database name
  * @param resource $link - the connection id
  */
 function DB_List_Tables($db_name)
 {
     if (!isset(self::$table_list_cache) || self::$table_list_cache == null) {
         self::$table_list_cache = array();
         $tables = DB_MySQL::DB_Query("SHOW TABLES FROM `{$db_name}`");
         while ($table = DB_MySQL::DB_Fetch_Array($tables, QUERY_RESULT_NUM)) {
             self::$table_list_cache[$table[0]] = true;
         }
     }
     return self::$table_list_cache;
 }