Class JSchemaChangeitem
Each object represents one query, which is one line from a DDL SQL query.
This class is used to check the site's database to see if the DDL query has been
run. If not, it provides the ability to fix the database by re-running the DDL
query. The queries are parsed from the update files in the folder
administrator/components/com_admin/sql/updates/<database>
.
These updates are run automatically if the site was updated using com_installer.
However, it is possible that the program files could be updated without udpating
the database (for example, if a user just copies the new files over the top of
an existing installation).
This is an abstract class. We need to extend it for each database and add a buildCheckQuery() method that creates the query to check that a DDL query has been run.
Direct known subclasses
JSchemaChangeitemMysql
,
JSchemaChangeitemPostgresql
,
JSchemaChangeitemSqlsrv
Package: Joomla\Libraries\Schema
Copyright: Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
License: General Public License version 2 or later; see LICENSE.txt
Since: 2.5
Located at cms/schema/changeitem.php
Methods summary
public
|
#
__construct(
Constructor: builds check query and message from $updateQuery |
public static
|
#
getInstance(
Returns a reference to the JSchemaChangeitem object. |
abstract protected
|
#
buildCheckQuery( )
Checks a DDL query to see if it is a known type If yes, build a check query to see if the DDL has been run on the database. If successful, the $msgElements, $queryType, $checkStatus and $checkQuery fields are populated. The $msgElements contains the text to create the user message. The $checkQuery contains the SQL query to check whether the schema change has been run against the current database. The $queryType contains the type of DDL query that was run (for example, CREATE_TABLE, ADD_COLUMN, CHANGE_COLUMN_TYPE, ADD_INDEX). The $checkStatus field is set to zero if the query is created |
public
boolean
|
|
public
|
Magic methods summary
Properties summary
public
string
|
$file |
#
Update file: full path file name where query was found |
public
string
|
$updateQuery |
#
Update query: query used to change the db schema (one line from the file) |
public
string
|
$checkQuery |
#
Check query: query used to check the db schema |
public
string
|
$checkQueryExpected |
#
Check query result: expected result of check query if database is up to date |
public
|
$db |
#
JDatabaseDriver object |
public
string
|
$queryType |
#
Query type: To be used in building a language key for a message to tell user what was checked / changed Possible values: ADD_TABLE, ADD_COLUMN, CHANGE_COLUMN_TYPE, ADD_INDEX |
public
array
|
$msgElements |
#
Array with values for use in a JText::sprintf statment indicating what was checked |
public
integer
|
$checkStatus |
#
Checked status |
public
integer
|
$rerunStatus |
#
Rerun status |