Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

mysql_base.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 2.59 KiB


001  <?php
002  /**
003  *
004  * This file is part of the phpBB Forum Software package.
005  *
006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
007  * @license GNU General Public License, version 2 (GPL-2.0)
008  *
009  * For full copyright and license information, please see
010  * the docs/CREDITS.txt file.
011  *
012  */
013   
014  namespace phpbb\db\driver;
015   
016  /**
017  * Abstract MySQL Database Base Abstraction Layer
018  */
019  abstract class mysql_base extends \phpbb\db\driver\driver
020  {
021      /**
022      * {@inheritDoc}
023      */
024      public function sql_concatenate($expr1, $expr2)
025      {
026          return 'CONCAT(' . $expr1 . ', ' . $expr2 . ')';
027      }
028   
029      /**
030      * Build LIMIT query
031      */
032      function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
033      {
034          $this->query_result = false;
035   
036          // if $total is set to 0 we do not want to limit the number of rows
037          if ($total == 0)
038          {
039              // MySQL 4.1+ no longer supports -1 in limit queries
040              $total = '18446744073709551615';
041          }
042   
043          $query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total);
044   
045          return $this->sql_query($query, $cache_ttl);
046      }
047   
048      /**
049      * {@inheritDoc}
050      */
051      function get_estimated_row_count($table_name)
052      {
053          $table_status = $this->get_table_status($table_name);
054   
055          if (isset($table_status['Engine']))
056          {
057              if ($table_status['Engine'] === 'MyISAM')
058              {
059                  return $table_status['Rows'];
060              }
061              else if ($table_status['Engine'] === 'InnoDB' && $table_status['Rows'] > 100000)
062              {
063                  return '~' . $table_status['Rows'];
064              }
065          }
066   
067          return parent::get_row_count($table_name);
068      }
069   
070      /**
071      * {@inheritDoc}
072      */
073      function get_row_count($table_name)
074      {
075          $table_status = $this->get_table_status($table_name);
076   
077          if (isset($table_status['Engine']) && $table_status['Engine'] === 'MyISAM')
078          {
079              return $table_status['Rows'];
080          }
081   
082          return parent::get_row_count($table_name);
083      }
084   
085      /**
086      * Gets some information about the specified table.
087      *
088      * @param string $table_name        Table name
089      *
090      * @return array
091      *
092      * @access protected
093      */
094      function get_table_status($table_name)
095      {
096          $sql = "SHOW TABLE STATUS
097              LIKE '" . $this->sql_escape($table_name) . "'";
098          $result = $this->sql_query($sql);
099          $table_status = $this->sql_fetchrow($result);
100          $this->sql_freeresult($result);
101   
102          return $table_status;
103      }
104   
105      /**
106      * Build LIKE expression
107      * @access private
108      */
109      function _sql_like_expression($expression)
110      {
111          return $expression;
112      }
113   
114      /**
115      * Build NOT LIKE expression
116      * @access private
117      */
118      function _sql_not_like_expression($expression)
119      {
120          return $expression;
121      }
122   
123      /**
124      * Build db-specific query data
125      * @access private
126      */
127      function _sql_custom_build($stage, $data)
128      {
129          switch ($stage)
130          {
131              case 'FROM':
132                  $data = '(' . $data . ')';
133              break;
134          }
135   
136          return $data;
137      }
138  }
139