mysql_schema.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #ifndef TEST_MYSQL_SCHEMA_H
  15. #define TEST_MYSQL_SCHEMA_H
  16. #include <config.h>
  17. #include <string>
  18. namespace isc {
  19. namespace dhcp {
  20. namespace test {
  21. extern const char* VALID_TYPE;
  22. extern const char* INVALID_TYPE;
  23. extern const char* VALID_NAME;
  24. extern const char* INVALID_NAME;
  25. extern const char* VALID_HOST;
  26. extern const char* INVALID_HOST;
  27. extern const char* VALID_USER;
  28. extern const char* INVALID_USER;
  29. extern const char* VALID_PASSWORD;
  30. extern const char* INVALID_PASSWORD;
  31. /// @brief Create the Schema
  32. ///
  33. /// Creates all the tables in what is assumed to be an empty database.
  34. ///
  35. /// There is no error checking in this code: if it fails, one of the tests
  36. /// will fall over.
  37. void createMySQLSchema();
  38. /// @brief Clear everything from the database
  39. ///
  40. /// There is no error checking in this code: if something fails, one of the
  41. /// tests will (should) fall over.
  42. void destroyMySQLSchema();
  43. /// Return valid connection string
  44. ///
  45. /// @return valid MySQL connection string.
  46. std::string validMySQLConnectionString();
  47. /// @brief Given a combination of strings above, produce a connection string.
  48. ///
  49. /// @param type type of the database
  50. /// @param name name of the database to connect to
  51. /// @param host hostname
  52. /// @param user username used to authendicate during connection attempt
  53. /// @param password password used to authendicate during connection attempt
  54. /// @return string containing all specified parameters
  55. std::string connectionString(const char* type, const char* name, const char* host,
  56. const char* user, const char* password);
  57. };
  58. };
  59. };
  60. #endif