@param bool $withTableName

@return string
192678
public function getIdColumnName(bool $withTableName = false): string
    {
        return ($withTableName) ? $this->addTableName($this->idColumnName) : $this->idColumnName;
    }
665079
public function get_display_name($item, $withpostfix = true) {
        return format_text($item->name, FORMAT_HTML, array('noclean' => true, 'para' => false)) .
                ($withpostfix ? $this->get_display_name_postfix($item) : '');
    }
1255910
private function showCreateTable($tableName)
	{
		$prefix = App::get('db')->getPrefix();

		$create = App::get('db')->getTableCreate($tableName);
		$create = $create[$tableName];
		$create = str_replace("CREATE TABLE `{$prefix}", 'CREATE TABLE `#__', $create);
		$create = str_replace("\n", "\n\t\t\t\t", $create);
		$create = preg_replace('/(AUTO_INCREMENT=)([0-9]*)/', '${1}0', $create);

		return $create;
	}
175968
public function tableExists($tablename)
  {
    $fromdb = "";

    if ($pos = strpos($tablename, "."))
    {
      $fromdb = "from `".substr($tablename, 0, $pos)."`";
      $tablename = substr($tablename, $pos+1);
    }

    $query = "show tables $fromdb like ".$this->quote($tablename);
    $result = $this->q($query);

    $exists = mysqli_num_rows($result) != 0;
    mysqli_free_result($result);
    return $exists;
  }
971425
public function fileName($filename, $withExt = true)
    {
        return $withExt ? pathinfo($filename, PATHINFO_BASENAME) : pathinfo($filename, PATHINFO_FILENAME);
    }
489293
protected function getTableVariable($table, $tableName)
    {
        $options = $this->getTableOptions($table);
        $result = sprintf("%s\$table = \$this->table(\"%s\", %s);", $this->ind2, $tableName, $options);

        return $result;
    }
108364
public function getTableSchemaId(string $tableName): string
    {
        $sql = sprintf('SHOW FULL COLUMNS FROM %s;', $this->quoter->quoteName($tableName));
        $rows = $this->db->query($sql)->fetchAll(PDO::FETCH_ASSOC);

        return sha1(json_encode($rows));
    }
422480
public function getColumnClass(bool $withOffset = false): string
    {
        $class = (string) $this->horizontalConfig['control'];

        if ($withOffset) {
            $class .= ' ' . $this->horizontalConfig['offset'];
        }

        return $class;
    }
1284535
public function getRelationTableForJoin($fullName) {
        if (!$this->tableName) {
            $class = $this->model;
            $this->tableName = $class::getTableName();
        }
        return "`" . $this->tableName . "` as  `" . ($this->tableAlias = str_replace('.', '_', $fullName)) . "`";
    }
888692
public function getTableName()
    {
        if ($this->tableName) {
            return $this->tableName;
        }

        return $this->namingStrategy->classToTableName($this->name);
    }
130156
protected function getTablenameCallback($tableName)
    {
        if (isset($GLOBALS['TL_DCA'][$tableName]['config']['tablename_callback'])
            && \is_array($GLOBALS['TL_DCA'][$tableName]['config']['tablename_callback'])
        ) {
            foreach ($GLOBALS['TL_DCA'][$tableName]['config']['tablename_callback'] as $callback) {
                $tableName = Callbacks::call($callback, $tableName, $this) ?: $tableName;
            }
        }

        return $tableName;
    }
333544
protected function buildTables($with_alias=true) {
		$tables = [];
		$params = [];
		if(!$this->tables)
			throw new \Exception('Must set tables with method from($tables) before running the query.');
		foreach($this->tables as $alias=>$table) {
			if($table instanceof static) {
				$tables[] = '('.$table->buildSQL().') '.$this->quote.$alias.$this->quote;
				$params = array_merge($params, $table->getParameters());
			}
			elseif($table instanceof Raw) {
				$tables[] = '('.$table->getSQL().') '.$this->quote.$alias.$this->quote;
				$params = array_merge($params, $table->getParameters());
			}
			elseif($alias !== $table && $with_alias)
				$tables[] = $this->quote.$table.$this->quote.' '.$this->quote.$alias.$this->quote;
			else
				$tables[] = $this->quote.$table.$this->quote;
		}
		$sql = implode(', ', $tables);
		return [$sql, $params];
	}
1251101
public function toString(bool $pretty = true, bool $isSub = false): string
    {
        $ret = '';

        if (isset($this->query['select'])) {
            $ret = $this->toQueryString('select', $pretty, $isSub);
        } elseif (isset($this->query['insert'])) {
            $ret = $this->toQueryString('insert', $pretty, $isSub);
        } elseif (isset($this->query['update'])) {
            $ret = $this->toQueryString('update', $pretty, $isSub);
        } elseif (isset($this->query['delete'])) {
            $ret = $this->toQueryString('delete', $pretty, $isSub);
        }

        $isSub = $isSub ?: $this->isSub;
        if ($ret != '' && $pretty && $isSub) {
            $ret .= "\n\t";
        }

        return $ret;
    }
166082
public function getHost(bool $withPort = true) : string
  {
      // Check for proxy first
      if ($host = $this->server('HTTP_X_FORWARDED_HOST')) {
          $host = last(explode(',', $host));
      } elseif (!$host = $this->server('HTTP_HOST')) {
          if (!$host = $this->server('HTTP_SERVER_NAME')) {
              $host = $this->server('HTTP_SERVER_ADDR');
          }
      }

      // trim and remove port number from host
      // host is lowercase as per RFC 952/2181
      $host = strtolower(preg_replace('/:\d+$/', '', trim($host)));

      if (!$withPort) {
          return $host;
      }

      // Port number
      $scheme = $this->getHttpScheme();
      $port = $this->getPort();
      
      $appendPort = ':' . $port;

      // Don't append port number if a normal port.
      if (($scheme == 'http' && $port == '80') || ($scheme == 'https' && $port == '443')) {
          $appendPort = '';
      }

      return $host . $appendPort;
  }
890081
public function getLevelColumnName(bool $withTableName = false): string
    {
        return ($withTableName) ? $this->addTableName($this->levelColumnName) : $this->levelColumnName;
    }
1058989
public function getContentQueryString( $withQuestionMark = false )
    {
        $queryString = '';
        $aParams = array();
        foreach( $this->contentVariables as $name => $value )
        {
            if( $value !== null )
                $aParams[] = $name.'='.$value;
        }

        if( !empty( $aParams ) )
        {
            $queryString  = $withQuestionMark ? '?' : '';
            $queryString .= implode( '&', $aParams );
        }
        return $queryString;
    }
502029
public function toMySQLDate($withTime = true)
    {
        if ($this->isHollow()) {
            return $withTime ? '0000-00-00 00:00:00' : '0000-00-00';
        }

        $format = $withTime ? 'Y-m-d H:i:s' : 'Y-m-d';

        return $this->format($format);
    }