1 | <?php |
||
33 | class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection |
||
34 | { |
||
35 | /** |
||
36 | * @var boolean |
||
37 | */ |
||
38 | private $isEnabled = true; |
||
39 | |||
40 | /** |
||
41 | * @var Typo3Service |
||
42 | */ |
||
43 | private $typo3Service; |
||
44 | |||
45 | /** |
||
46 | * Enables the sequencer. |
||
47 | * |
||
48 | * @return void |
||
49 | */ |
||
50 | public function enable() |
||
54 | |||
55 | /** |
||
56 | * Disables the sequencer. |
||
57 | * |
||
58 | * @return void |
||
59 | */ |
||
60 | public function disable() |
||
64 | |||
65 | /** |
||
66 | * Creates and executes an INSERT SQL-statement for $table from the array with field/value pairs $fields_values. |
||
67 | * Using this function specifically allows us to handle BLOB and CLOB fields depending on DB |
||
68 | * |
||
69 | * @param string $table Table name |
||
70 | * @param array $fields_values Field values as key=>value pairs. Values will be escaped internally. Typically you would fill an array like "$insertFields" with 'fieldname'=>'value' and pass it to this function as argument. |
||
71 | * @param string /array $no_quote_fields See fullQuoteArray() |
||
72 | * @return string|NULL Full SQL query for INSERT, NULL if $fields_values is empty |
||
73 | */ |
||
74 | function INSERTquery($table, $fields_values, $no_quote_fields = false) |
||
81 | |||
82 | /** |
||
83 | * Creates an INSERT SQL-statement for $table with multiple rows. |
||
84 | * |
||
85 | * @param string $table Table name |
||
86 | * @param array $fields Field names |
||
87 | * @param array $rows Table rows. Each row should be an array with field values mapping to $fields |
||
88 | * @param bool|array|string $no_quote_fields See fullQuoteArray() |
||
89 | * @return string Full SQL query for INSERT (unless $rows does not contain any elements in which case it will be false) |
||
90 | */ |
||
91 | public function INSERTmultipleRows($table, array $fields, array $rows, $no_quote_fields = false) |
||
100 | |||
101 | /** |
||
102 | * Creates an UPDATE SQL-statement for $table where $where-clause (typ. 'uid=...') from the array with field/value pairs $fields_values. |
||
103 | * |
||
104 | * @param string $table See exec_UPDATEquery() |
||
105 | * @param string $where See exec_UPDATEquery() |
||
106 | * @param array $fields_values See exec_UPDATEquery() |
||
107 | * @param boolean $no_quote_fields See fullQuoteArray() |
||
108 | * @return string Full SQL query for UPDATE (unless $fields_values does not contain any elements in which case it will be false) |
||
109 | */ |
||
110 | public function UPDATEquery($table, $where, $fields_values, $no_quote_fields = false) |
||
117 | |||
118 | /** |
||
119 | * Creates and executes a DELETE SQL-statement for $table where $where-clause |
||
120 | * |
||
121 | * @param string $table Database tablename |
||
122 | * @param string $where WHERE clause, eg. "uid=1". NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself! |
||
123 | * @return boolean|\mysqli_result|object MySQLi result object / DBAL object |
||
124 | */ |
||
125 | public function exec_DELETEquery($table, $where) |
||
130 | |||
131 | /** |
||
132 | * Open a (persistent) connection to a MySQL server |
||
133 | * |
||
134 | * @param string $host Deprecated since 6.1, will be removed in two versions. Database host IP/domain[:port] |
||
135 | * @param string $username Deprecated since 6.1, will be removed in two versions. Username to connect with. |
||
136 | * @param string $password Deprecated since 6.1, will be removed in two versions. Password to connect with. |
||
137 | * @return \mysqli|NULL Returns current database handle |
||
138 | */ |
||
139 | function sql_pconnect($host = null, $username = null, $password = null) |
||
145 | |||
146 | /** |
||
147 | * create instance of Typo3Service by lazy-loading |
||
148 | * |
||
149 | * Why we do this? |
||
150 | * Because some unittests backup the variable $GLOBALS (and so, also the variable $GLOBALS['TYPO3_DB']), which means, that this |
||
151 | * object/class will be serialized/unserialized, so the instance of Typo3Service will be null after unserialization! |
||
152 | * |
||
153 | * @return Typo3Service |
||
154 | */ |
||
155 | protected function getTypo3Service() |
||
162 | } |
||
163 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.