This guarantees that we will not encounter a 'table already exists'
type error.
We also define the character set and the collation; this ensures that our table is
UTF-8-compatible. Obviously, we only do this in the S???L file for UTF-8-compatible
MySQL severs. For more information about the differences between UTF-8-
compatible and non-UTF-8 compatible MySQL servers, refer to Chapter 3. We
only need one uninstall file because it will not be any different whether it is UTF-8
compatible or not. This is an example of the uninstall S???L file:
DROP TABLE IF EXISTS `#__some_table`;
You must copy the S???L files into the root of your component's backend
as well as defining them in install and uninstall tags.
Chapter 4
[ 111 ]
Alternatively, you can embed the queries inside the XML manifest file in query tags.
DROP TABLE IF EXISTS `#__ myextension_foobars`;
CREATE TABLE `#__myextension_foobars` (
`id` INTEGER UNSIGNED NOT NULL DEFAULT NULL AUTO_INCREMENT,
`content` TEXT NOT NULL DEFAULT '',
`checked_out` INTEGER UNSIGNED NOT NULL DEFAULT 0,
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00
00:00:00',
`params` TEXT NOT NULL DEFAULT '',
`ordering` INTEGER UNSIGNED NOT NULL DEFAULT 0,
`hits` INTEGER UNSIGNED NOT NULL DEFAULT 0,
`published` INTEGER UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY(`id`)
) CHARACTER SET `utf8` COLLATE `utf8_general_ci`;
Install and Uninstall Files
During the install and uninstall phases we can optionally execute install and
uninstall files.
Pages:
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162