Overview

Namespaces

  • None
  • Xmf
    • Database
    • Module
      • Helper
    • Template
  • Xoops
    • Auth
    • Core
      • Cache
      • Database
        • Logging
        • Schema
      • Exception
      • Handler
        • Scheme
      • Kernel
        • Dtype
        • Handlers
        • Model
      • Lists
      • Locale
        • Punic
      • Service
        • Contract
      • Session
      • Text
        • Sanitizer
          • Extensions
      • Theme
        • Plugins
    • Form
    • Html
    • Locale
    • Module
      • Helper
      • Plugin

Classes

  • Connection
  • Factory
  • QueryBuilder
  • Overview
  • Namespace
  • Class
  • Tree

Class Connection

Connection wrapper for Doctrine DBAL Connection

Doctrine\DBAL\Connection
Extended by Xoops\Core\Database\Connection
Namespace: Xoops\Core\Database
Package: Connection
Category: Xoops\Core\Database\Connection
Copyright: 2013-2015 XOOPS Project (http://xoops.org)
License: GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
Author: readheadedrod redheadedrod@hotmail.com
Author: Richard Griffith richard@geekwright.com
Version: Release: 2.6
Since: 2.6.0
Link: http://xoops.org
Located at oops_lib/Xoops/Core/Database/Connection.php
Methods summary
public static
# setSafe( boolean $safe = true )

this is a public setter for the safe variable

this is a public setter for the safe variable

Parameters

$safe
set safe to true if safe to write data to database
public static boolean
# getSafe( )

this is a public getter for the safe variable

this is a public getter for the safe variable

Returns

boolean
public static
# setForce( boolean $force = false )

this is a public setter for the $force variable

this is a public setter for the $force variable

Parameters

$force
when true will force a write to database when safe is false.
public static boolean
# getForce( )

this is a public getter for the $force variable

this is a public getter for the $force variable

Returns

boolean
public
# __construct( array $params, Doctrine\DBAL\Driver $driver, Doctrine\DBAL\Configuration $config = null, Doctrine\Common\EventManager $eventManager = null )

Initializes a new instance of the Connection class.

Initializes a new instance of the Connection class.

This sets up necessary variables before calling parent constructor

Parameters

$params
Parameters for the driver
$driver
The driver to use
$config
The connection configuration
$eventManager
Event manager to use
public static string
# prefix( string $tablename = '' )

Prepend the prefix.'_' to the given tablename If tablename is empty, just return the prefix.

Prepend the prefix.'_' to the given tablename If tablename is empty, just return the prefix.

Parameters

$tablename
tablename

Returns

string
prefixed tablename, or prefix if tablename is empty
public integer
# insertPrefix( string $tableName, array $data, array $types = array() )

Inserts a table row with specified data.

Inserts a table row with specified data.

Adds prefix to the name of the table then passes to normal function.

Parameters

$tableName
The name of the table to insert data into.
$data
An associative array containing column-value pairs.
$types
Types of the inserted data.

Returns

integer
The number of affected rows.
public integer
# updatePrefix( string $tableName, array $data, array $identifier, array $types = array() )

Executes an SQL UPDATE statement on a table.

Executes an SQL UPDATE statement on a table.

Adds prefix to the name of the table then passes to normal function.

Parameters

$tableName
The name of the table to update.
$data
The data to update
$identifier

The update criteria. An associative array containing column-value pairs.

$types

Types of the merged $data and $identifier arrays in that order.

Returns

integer
The number of affected rows.
public integer
# deletePrefix( string $tableName, array $identifier )

Executes an SQL DELETE statement on a table.

Executes an SQL DELETE statement on a table.

Adds prefix to the name of the table then passes to delete function.

Parameters

$tableName
The name of the table on which to delete.
$identifier

The deletion criteria. An associative array containing column-value pairs.

Returns

integer
The number of affected rows.
public Doctrine\DBAL\Driver\Statement
# executeQuery( string $query, array $params = array(), array $types = array(), Doctrine\DBAL\Cache\QueryCacheProfile $qcp = null )

Executes an, optionally parametrized, SQL query.

Executes an, optionally parametrized, SQL query.

If the query is parametrized, a prepared statement is used. If an SQLLogger is configured, the execution is logged.

Parameters

$query
The SQL query to execute.
$params
The parameters to bind to the query, if any.
$types
The types the previous parameters are in.
$qcp
The query Cache profile

Returns

Doctrine\DBAL\Driver\Statement
The executed statement.
public integer
# executeUpdate( string $query, array $params = array(), array $types = array() )

Executes an SQL INSERT/UPDATE/DELETE query with the given parameters and returns the number of affected rows.

Executes an SQL INSERT/UPDATE/DELETE query with the given parameters and returns the number of affected rows.

This method supports PDO binding types as well as DBAL mapping types.

This over ridding process checks to make sure it is safe to do these. If force is active then it will over ride the safe setting.

Parameters

$query
The SQL query.
$params
The query parameters.
$types
The parameter types.

Returns

integer
The number of affected rows.
public
# beginTransaction( )

Starts a transaction by suspending auto-commit mode.

Starts a transaction by suspending auto-commit mode.

public
# commit( )

Commits the current transaction.

Commits the current transaction.

public
# rollBack( )

rolls back the current transaction.

rolls back the current transaction.

public mixed
# query( )

perform a safe query if allowed can receive variable number of arguments

perform a safe query if allowed can receive variable number of arguments

Returns

mixed
returns the value received or null if nothing received.
public boolean
# queryFromFile( string $file )

perform queries from SQL dump file in a batch

perform queries from SQL dump file in a batch

Parameters

$file
file path to an SQL dump file

Returns

boolean

FALSE if failed reading SQL file or TRUE if the file has been read and queries executed

public mixed
# quoteSlash( string $input )

Duplicates original xoops quote. Name changed to not confuse normal usage of quote.

Duplicates original xoops quote. Name changed to not confuse normal usage of quote.

Parameters

$input
test to convert

Returns

mixed
converted text
public Xoops\Core\Database\QueryBuilder
# createXoopsQueryBuilder( )

Create a new instance of a SQL query builder.

Create a new instance of a SQL query builder.

Returns

Xoops\Core\Database\QueryBuilder
Properties summary
protected static boolean $safe

$safe true means it is safe to write to database removed allowedWebChanges as unnecessary. Using this instead.

$safe true means it is safe to write to database removed allowedWebChanges as unnecessary. Using this instead.

#
protected static boolean $force

$force true means force writing to database even if safe is not true.

$force true means force writing to database even if safe is not true.

#
protected static boolean $transactionActive

$transactionActive true means a transaction is in process.

$transactionActive true means a transaction is in process.

#
API documentation generated by ApiGen