OC_DB¶
-
class
OC_DB
¶ - This class manages the access to the database. It basically is a wrapper forDoctrine with some adaptions.
Source: lib/private/legacy/OC_DB.php#37
Methods¶
-
public static
OC_DB::
prepare
($query, $limit=\null, $offset=\null, $isManipulation=\null)¶ - Prepare a SQL query
Source: Parameters: - $query (string) Query string
- $limit (int | null)
- $offset (int | null)
- $isManipulation (bool | null)
Throws: Returns: \OC_DB_StatementWrapper prepared SQL query
Deprecated: 21.0.0 Please use \OCP\IDBConnection::getQueryBuilder() instead
SQL query via Doctrine prepare(), needs to be execute()’d!
-
public static
OC_DB::
isManipulation
($sql)¶ - tries to guess the type of statement based on the first 10 charactersthe current check allows some whitespace but does not work with IF EXISTS or other more complex statements
Source: Parameters: - $sql (string)
Returns: bool
-
public static
OC_DB::
executeAudited
($stmt, $parameters=[])¶ - execute a prepared statement, on error write log and throw exception
Source: Parameters: - $stmt (mixed) OC_DB_StatementWrapper, an array with ‘sql’ and optionally ‘limit’ and ‘offset’ keys
- $parameters (array)
Returns: Throws: Deprecated: 21.0.0 Please use \OCP\IDBConnection::getQueryBuilder() instead
-
public static
OC_DB::
raiseExceptionOnError
($result, $message=\null)¶ - check if a result is an error and throws an exception, works with \Doctrine\DBAL\Exception
Source: Parameters: - $result (mixed)
- $message (string)
Returns: void
Throws:
-
public static
OC_DB::
getErrorMessage
()¶ - returns the error code and message as a string for loggingworks with DoctrineException
Source: lib/private/legacy/OC_DB.php#174 Returns: string
-
public static
OC_DB::
tableExists
($table)¶ - Checks if a table exists in the database - the database prefix will be prepended
Source: Parameters: - $table (string)
Returns: bool
Throws: