1 /* 2 Copyright (c) 2018 MariaDB Corporation AB 3 4 The MySQL Connector/C is licensed under the terms of the GPLv2 5 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most 6 MySQL Connectors. There are special exceptions to the terms and 7 conditions of the GPLv2 as it is applied to this software, see the 8 FLOSS License Exception 9 <http://www.mysql.com/about/legal/licensing/foss-exception.html>. 10 11 This program is free software; you can redistribute it and/or modify 12 it under the terms of the GNU General Public License as published 13 by the Free Software Foundation; version 2 of the License. 14 15 This program is distributed in the hope that it will be useful, but 16 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 17 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18 for more details. 19 20 You should have received a copy of the GNU General Public License along 21 with this program; if not, write to the Free Software Foundation, Inc., 22 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 */ 24 /** 25 Some basic tests of the client API. 26 */ 27 28 #include "my_test.h" 29 #include "mariadb_rpl.h" 30 31 static int test_rpl_01(MYSQL *mysql) 32 { 33 MARIADB_RPL_EVENT *event= NULL; 34 MARIADB_RPL *rpl= mariadb_rpl_init(mysql); 35 mysql_query(mysql, "SET @mariadb_slave_capability=4"); 36 mysql_query(mysql, "SET NAMES latin1"); 37 mysql_query(mysql, "SET @slave_gtid_strict_mode=1"); 38 mysql_query(mysql, "SET @slave_gtid_ignore_duplicates=1"); 39 mysql_query(mysql, "SET NAMES utf8"); 40 mysql_query(mysql, "SET @master_binlog_checksum= @@global.binlog_checksum"); 41 rpl->server_id= 12; 42 rpl->start_position= 4; 43 rpl->flags= MARIADB_RPL_BINLOG_SEND_ANNOTATE_ROWS; 44 45 if (mariadb_rpl_open(rpl)) 46 return FAIL; 47 48 while((event= mariadb_rpl_fetch(rpl, event))) 49 { 50 diag("event: %d\n", event->event_type); 51 } 52 mariadb_free_rpl_event(event); 53 mariadb_rpl_close(rpl); 54 return OK; 55 } 56 57 58 struct my_tests_st my_tests[] = { 59 {"test_rpl_01", test_rpl_01, TEST_CONNECTION_DEFAULT, 0, NULL, NULL}, 60 {NULL, NULL, 0, 0, NULL, NULL} 61 }; 62 63 64 int main(int argc, char **argv) 65 { 66 if (argc > 1) 67 get_options(argc, argv); 68 69 get_envvars(); 70 71 run_tests(my_tests); 72 73 return(exit_status()); 74 } 75