Databases Reference
In-Depth Information
•
Export type
: The choices are
INSERT
,
UPDATE
, and
REPLACE
. The most
well-known of these types is the default
INSERT—
using
INSERT
statements
to import back our data. At import time, however, we could be in a situation
where a table already exists and contains valuable data, and we just want
to update the fields that are in the current table we are exporting.
UPDATE
generates statements like
UPDATE
'author'
SET
'id'
=
1,
'name'
=
'John
Smith',
'phone'
=
'111-1111'
WHERE
'id'
=
'1';
updating a row when
the same primary or unique key is found. The third possibility,
REPLACE
,
produces statements like
REPLACE
INTO
'author'
VALUES
(1,
'John
Smith',
'111-1111');
which act like an
INSERT
statement for new rows
and updates existing rows, based on primary or unique keys.
The Save as file Sub-Panel
In the previous examples, the results of the export operation were displayed
on-screen, and of course, no compression was made on the data. We can choose to
transmit the export file via HTTP by checking the
Save as file
checkbox. This triggers
a
Save
dialog into the browser, which ultimately saves the file on our local station:
File Name Template
The name of the proposed file will obey the
File name template
. In this template, we
can use the special __
SERVER__, __DB__ and __TABLE__
placeholders, which will
be replaced by the current server, database or table name (for a single-table export).
Note that there are
two
underscore characters before and after the words. We can
also use any special character from the PHP
strftime
function; this is useful for
generating an export file based on the current date or hour. Finally, we can put any
other string of characters (not part of the
strftime
special characters), which will be
used literally. The file extension is generated according to the type of export. In this
case, it will be
.sql
. Here are some examples for the template:
•
•
__DB__
would generate
marc_book.sql
__DB__-%Y%m%d
gives
marc_book-20071206.sql
Search WWH ::
Custom Search