You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.1 KiB

  1. /*
  2. Copyright (c) 2007 MySQL AB, 2009 Sun Microsystems, Inc.
  3. Use is subject to license terms.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; version 2 of the License.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  14. */
  15. #include <my_global.h>
  16. #include <my_sys.h>
  17. #include <mysql.h>
  18. #include <m_string.h>
  19. #include <assert.h>
  20. int main (int argc, char **argv)
  21. {
  22. MYSQL conn;
  23. int OK;
  24. const char* query4= "INSERT INTO federated.t1 SET Value=54";
  25. const char* query5= "INSERT INTO federated.t1 SET Value=55";
  26. MY_INIT(argv[0]);
  27. if (argc != 2 || !strcmp(argv[1], "--help"))
  28. {
  29. fprintf(stderr, "This program is a part of the MySQL test suite. "
  30. "It is not intended to be executed directly by a user.\n");
  31. return -1;
  32. }
  33. mysql_init(&conn);
  34. if (!mysql_real_connect(
  35. &conn,
  36. "127.0.0.1",
  37. "root",
  38. "",
  39. "test",
  40. atoi(argv[1]),
  41. NULL,
  42. CLIENT_FOUND_ROWS))
  43. {
  44. fprintf(stderr, "Failed to connect to database: Error: %s\n",
  45. mysql_error(&conn));
  46. return 1;
  47. } else {
  48. printf("%s\n", mysql_error(&conn));
  49. }
  50. OK = mysql_real_query (&conn, query4, (uint) strlen(query4));
  51. assert(0 == OK);
  52. printf("%ld inserted\n",
  53. (long) mysql_insert_id(&conn));
  54. OK = mysql_real_query (&conn, query5, (uint) strlen(query5));
  55. assert(0 == OK);
  56. printf("%ld inserted\n",
  57. (long) mysql_insert_id(&conn));
  58. mysql_close(&conn);
  59. my_end(0);
  60. return 0;
  61. }