[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/database/src/Sqlsrv/ -> SqlsrvQuery.php (summary)

Part of the Joomla Framework Database Package

Copyright: Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
License: GNU General Public License version 2 or later; see LICENSE
File Size: 1228 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

SqlsrvQuery:: (15 methods):
  __toString()
  castAs()
  charLength()
  concatenate()
  currentTimestamp()
  length()
  group()
  groupConcat()
  rand()
  findInSet()
  fixSelectAliases()
  fixGroupColumns()
  splitSqlExpression()
  processLimit()
  union()


Class: SqlsrvQuery  - X-Ref

SQL Server Query Building Class.

__toString()   X-Ref
Magic function to convert the query to a string.

return: string  The completed query.

castAs(string $type, string $value, ?string $length = null)   X-Ref
Casts a value to a char.

Ensure that the value is properly quoted before passing to the method.

Usage:
$query->select($query->castAs('CHAR', 'a'));

param: string  $type    The type of string to cast as.
param: string  $value   The value to cast as a char.
param: string  $length  The value to cast as a char.
return: string  SQL statement to cast the value as a char type.

charLength($field, $operator = null, $condition = null)   X-Ref
Gets the function to determine the length of a character string.

param: string       $field      A value.
param: string|null  $operator   Comparison operator between charLength integer value and $condition
param: string|null  $condition  Integer value to compare charLength with.
return: string  The required char length call.

concatenate($values, $separator = null)   X-Ref
Concatenates an array of column names or values.

param: string[]     $values     An array of values to concatenate.
param: string|null  $separator  As separator to place between each value.
return: string  The concatenated values.

currentTimestamp()   X-Ref
Gets the current date and time.

return: string

length($value)   X-Ref
Get the length of a string in bytes.

param: string  $value  The string to measure.
return: integer

group($columns)   X-Ref
Add a grouping column to the GROUP clause of the query.

Usage:
$query->group('id');

param: mixed  $columns  A string or array of ordering columns.
return: SqlsrvQuery  Returns this object to allow chaining.

groupConcat($expression, $separator = ',')   X-Ref
Aggregate function to get input values concatenated into a string, separated by delimiter

Usage:
$query->groupConcat('id', ',');

param: string  $expression  The expression to apply concatenation to, this may be a column name or complex SQL statement.
param: string  $separator   The delimiter of each concatenated value
return: string  Input values concatenated into a string, separated by delimiter

rand()   X-Ref
Get the function to return a random floating-point value

Usage:
$query->rand();

return: string

findInSet($value, $set)   X-Ref
Find a value in a varchar used like a set.

Ensure that the value is an integer before passing to the method.

Usage:
$query->findInSet((int) $parent->id, 'a.assigned_cat_ids')

param: string  $value  The value to search for.
param: string  $set    The set of values.
return: string  A representation of the MySQL find_in_set() function for the driver.

fixSelectAliases()   X-Ref
Add required aliases to columns for select statement in subquery.

return: array[]  Array of columns with added missing aliases.

fixGroupColumns($selectColumns)   X-Ref
Add missing columns names to GROUP BY clause.

param: array[]  $selectColumns  Array of columns from splitSqlExpression method.
return: $this

splitSqlExpression($string)   X-Ref
Split a string of sql expression into an array of individual columns.
Single line or line end comments and multi line comments are stripped off.
Always return at least one column.

param: string  $string  Input string of sql expression like select expression.
return: array[]  The columns from the input string separated into an array.

processLimit($query, $limit, $offset = 0)   X-Ref
Method to modify a query already in string format with the needed additions to make the query limited to a particular number of
results, or start at a particular offset.

param: string   $query   The query in string format
param: integer  $limit   The limit for the result set
param: integer  $offset  The offset for the result set
return: string

union($query, $distinct = true)   X-Ref
Add a query to UNION with the current query.

Usage:
$query->union('SELECT name FROM  #__foo')
$query->union('SELECT name FROM  #__foo', true)

param: DatabaseQuery|string  $query     The DatabaseQuery object or string to union.
param: boolean               $distinct  True to only return distinct rows from the union.
return: $this



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer