:: DEVELOPER ZONE
When you create a FEDERATED table, the server
creates a table definition file in the database directory. The file
begins with the table name and has an .frm
extension. No other files are created, because the actual data is in
a remote database. This differs from the way that storage engines
for local tables work.
For local database tables, data files are local. For example, if you
create a MyISAM table named
users, the MyISAM handler
creates a data file named users.MYD. A handler
for local tables reads, inserts, deletes, and updates data in local
data files, and records are stored in a format particular to the
handler. To read records, the handler must parse data into columns.
To write records, column values must be converted to the row format
used by the handler and written to the local data file.
With the MySQL FEDERATED storage engine, there
are no local data files for a table (for example, there is no
.MYD file). Instead, a remote database stores
the data that normally would be in the table. This necessitates the
use of the MySQL client API to read, delete, update, and insert
data. Data retrieval is initiated via a SELECT * FROM
SQL statement. To read
the result, rows are fetched one at a time by using the
tbl_namemysql_fetch_row() C API function, and then
converted from the columns in the SELECT result
set to the format that the FEDERATED handler
expects.
The basic flow is as follows:
SQL calls issued locally
MySQL handler API (data in handler format)
MySQL client API (data converted to SQL calls)
Remote database -> MySQL client API
Convert result sets (if any) to handler format
Handler API -> Result rows or rows-affected count to local
© 1995-2005 MySQL AB. All rights reserved.

User Comments
Warning: query failed: Unknown column 'user.firstname' in 'field list' in /data0/sites/live/web-main/lib/mysql-cxn.php on line 69
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /data0/sites/live/web-main/lib/docbook.php on line 245
Add your own comment.