1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
mysql>CREATE TABLE federated_table ( id INT (20) NOT NULL auto_increment, name VARCHAR(32) NOT NULL DEFAULT '',
nom VARCHAR (32) NOT NULL default'', other INT(20) NOT NULL DEFAULT '0',
autres INT (20) NOT NULL default '0 ', PRIMARY KEY (id) ) ENGINE=FEDERATED
CONNECTION='mysql://repl:LEPASSWORD@ADRESSEIP:LE_PORT/test/test_table';
Query OK, 0 rows affected (0.01 sec)
mysql> create trigger test_trigger after insert on toto for each row begin
insert into federated_table values ('','trig','y',1,2);
end; //
Query OK, 0 rows affected (0.00 sec)
mysql> delimiter ;
mysql> desc toto ;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| i | int(11) | YES | | NULL | |
| t | text | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> insert into toto values (1,'ZZZZ') ;
Query OK, 1 row affected, 1 warning (0.06 sec)
mysql> select * from federated_table ;
+----+------+------+-------+--------+
| id | name | nom | other | autres |
+----+------+------+-------+--------+
| 1 | toto | titi | 1 | 1 |
| 2 | tutu | tata | 2 | 2 |
| 3 | trig | y | 1 | 2 |
+----+------+------+-------+--------+
3 rows in set (0.00 sec) |