mirror of
https://github.com/boostorg/mysql.git
synced 2025-05-12 14:11:41 +00:00
Renamed database and CMake library
This commit is contained in:
parent
a54c83ef6a
commit
1ae738c35b
@ -52,12 +52,12 @@ endif()
|
||||
|
||||
# Interface library (header-only)
|
||||
add_library(
|
||||
mysql_asio
|
||||
Boost_mysql
|
||||
INTERFACE
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
mysql_asio
|
||||
Boost_mysql
|
||||
INTERFACE
|
||||
Boost::system
|
||||
Threads::Threads
|
||||
@ -65,20 +65,20 @@ target_link_libraries(
|
||||
OpenSSL::SSL
|
||||
)
|
||||
target_include_directories(
|
||||
mysql_asio
|
||||
Boost_mysql
|
||||
INTERFACE
|
||||
include
|
||||
${date_SOURCE_DIR}/include
|
||||
)
|
||||
target_compile_features(
|
||||
mysql_asio
|
||||
Boost_mysql
|
||||
INTERFACE
|
||||
cxx_std_17
|
||||
)
|
||||
|
||||
if (BOOST_MYSQL_VALGRIND_TESTS)
|
||||
target_link_libraries(
|
||||
mysql_asio
|
||||
Boost_mysql
|
||||
INTERFACE
|
||||
Mysqlvalgrind::Mysqlvalgrind
|
||||
)
|
||||
|
@ -26,7 +26,7 @@ Download Boost.MySQL and make it available to your CMake script (we suggest you
|
||||
CMake's FetchContent module to do this), and then call add_subdirectory() on the
|
||||
Boost.MySQL root directory. This will look for all the required dependencies.
|
||||
|
||||
Finally, link your target against the **mysql_asio** interface library, and you will be done!
|
||||
Finally, link your target against the **Boost_mysql** interface library, and you will be done!
|
||||
|
||||
## Requirements
|
||||
|
||||
|
1
TODO.txt
1
TODO.txt
@ -3,7 +3,6 @@ Sanitize
|
||||
Copy operations for handshake
|
||||
Test zero dates
|
||||
Review handshake auth_plugin_data - seems like buffer overrun is possible (auth data string_lenenc?)
|
||||
Rename "awesome" database (yeah, we know it's awesome)
|
||||
include boost mysql.hpp
|
||||
Connection quit
|
||||
Better docs
|
||||
|
@ -30,7 +30,7 @@
|
||||
* CMake's FetchContent module to do this), and then call add_subdirectory() on the
|
||||
* Boost.MySQL root directory. This will look for all the required dependencies.
|
||||
*
|
||||
* Finally, link your target against the **mysql_asio** interface library, and you will be done!
|
||||
* Finally, link your target against the **Boost_mysql** interface library, and you will be done!
|
||||
*
|
||||
* \section Requirements
|
||||
*
|
||||
|
@ -16,7 +16,7 @@ function (_mysql_build_example EXECUTABLE_NAME CPPFILE)
|
||||
target_link_libraries(
|
||||
${EXECUTABLE_NAME}
|
||||
PRIVATE
|
||||
mysql_asio
|
||||
Boost_mysql
|
||||
Boost::coroutine
|
||||
)
|
||||
_mysql_common_target_settings(${EXECUTABLE_NAME})
|
||||
|
@ -9,9 +9,9 @@
|
||||
SET NAMES utf8;
|
||||
|
||||
-- Database
|
||||
DROP DATABASE IF EXISTS mysql_asio_examples;
|
||||
CREATE DATABASE mysql_asio_examples;
|
||||
USE mysql_asio_examples;
|
||||
DROP DATABASE IF EXISTS boost_mysql_examples;
|
||||
CREATE DATABASE boost_mysql_examples;
|
||||
USE boost_mysql_examples;
|
||||
|
||||
-- Tables
|
||||
CREATE TABLE company(
|
||||
@ -45,4 +45,4 @@ INSERT INTO employee (first_name, last_name, salary, company_id) VALUES
|
||||
DROP USER IF EXISTS 'example_user'@'localhost';
|
||||
CREATE USER 'example_user'@'localhost' IDENTIFIED WITH 'mysql_native_password';
|
||||
ALTER USER 'example_user'@'localhost' IDENTIFIED BY 'example_password';
|
||||
GRANT ALL PRIVILEGES ON mysql_asio_examples.* TO 'example_user'@'localhost';
|
||||
GRANT ALL PRIVILEGES ON boost_mysql_examples.* TO 'example_user'@'localhost';
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
* For this example, we will be using the 'mysql_asio_examples' database.
|
||||
* For this example, we will be using the 'boost_mysql_examples' database.
|
||||
* You can get this database by running db_setup.sql.
|
||||
* This example assumes you are connecting to a localhost MySQL server.
|
||||
*
|
||||
@ -32,7 +32,7 @@ void main_impl(int argc, char** argv)
|
||||
|
||||
// Connection params (host, port, user, password, database)
|
||||
boost::asio::ip::tcp::endpoint ep (boost::asio::ip::address_v4::loopback(), boost::mysql::default_port);
|
||||
boost::mysql::connection_params params (argv[1], argv[2], "mysql_asio_examples");
|
||||
boost::mysql::connection_params params (argv[1], argv[2], "boost_mysql_examples");
|
||||
|
||||
// TCP and MySQL level connect
|
||||
boost::asio::io_context ctx;
|
||||
@ -58,7 +58,7 @@ void main_impl(int argc, char** argv)
|
||||
assert(result.fields().size() == 2);
|
||||
|
||||
[[maybe_unused]] const boost::mysql::field_metadata& company_name = result.fields()[0];
|
||||
assert(company_name.database() == "mysql_asio_examples"); // database name
|
||||
assert(company_name.database() == "boost_mysql_examples"); // database name
|
||||
assert(company_name.table() == "comp"); // the alias we assigned to the table in the query
|
||||
assert(company_name.original_table() == "company"); // the original table name
|
||||
assert(company_name.field_name() == "company_name"); // the name of the field in the query
|
||||
@ -69,7 +69,7 @@ void main_impl(int argc, char** argv)
|
||||
assert(company_name.is_not_null()); // field may not be NULL
|
||||
|
||||
[[maybe_unused]] const boost::mysql::field_metadata& employee_id = result.fields()[1];
|
||||
assert(employee_id.database() == "mysql_asio_examples");// database name
|
||||
assert(employee_id.database() == "boost_mysql_examples"); // database name
|
||||
assert(employee_id.table() == "emp"); // the alias we assigned to the table in the query
|
||||
assert(employee_id.original_table() == "employee"); // the original table name
|
||||
assert(employee_id.field_name() == "employee_id"); // the name of the field in the query
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
* For this example, we will be using the 'mysql_asio_examples' database.
|
||||
* For this example, we will be using the 'boost_mysql_examples' database.
|
||||
* You can get this database by running db_setup.sql.
|
||||
* This example assumes you are connecting to a localhost MySQL server.
|
||||
*
|
||||
@ -38,7 +38,7 @@ void main_impl(int argc, char** argv)
|
||||
boost::mysql::connection_params params (
|
||||
argv[1], // username
|
||||
argv[2], // password
|
||||
"mysql_asio_examples" // database to use; leave empty or omit the parameter for no database
|
||||
"boost_mysql_examples" // database to use; leave empty or omit the parameter for no database
|
||||
);
|
||||
|
||||
boost::asio::io_context ctx;
|
||||
|
@ -18,7 +18,7 @@ using boost::mysql::tcp_resultset;
|
||||
using boost::mysql::owning_row;
|
||||
|
||||
/**
|
||||
* For this example, we will be using the 'mysql_asio_examples' database.
|
||||
* For this example, we will be using the 'boost_mysql_examples' database.
|
||||
* You can get this database by running db_setup.sql.
|
||||
* This example assumes you are connecting to a localhost MySQL server.
|
||||
*
|
||||
@ -78,7 +78,7 @@ class application
|
||||
public:
|
||||
application(const char* username, const char* password) :
|
||||
ep (boost::asio::ip::address_v4::loopback(), boost::mysql::default_port),
|
||||
conn_params(username, password, "mysql_asio_examples"),
|
||||
conn_params(username, password, "boost_mysql_examples"),
|
||||
connection(ctx)
|
||||
{
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ using boost::mysql::error_code;
|
||||
using boost::mysql::error_info;
|
||||
|
||||
/**
|
||||
* For this example, we will be using the 'mysql_asio_examples' database.
|
||||
* For this example, we will be using the 'boost_mysql_examples' database.
|
||||
* You can get this database by running db_setup.sql.
|
||||
* This example assumes you are connecting to a localhost MySQL server.
|
||||
*
|
||||
@ -84,7 +84,7 @@ void main_impl(int argc, char** argv)
|
||||
boost::mysql::connection_params params (
|
||||
argv[1], // username
|
||||
argv[2], // password
|
||||
"mysql_asio_examples" // database to use; leave empty or omit the parameter for no database
|
||||
"boost_mysql_examples" // database to use; leave empty or omit the parameter for no database
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@ using boost::mysql::error_code;
|
||||
using boost::asio::use_future;
|
||||
|
||||
/**
|
||||
* For this example, we will be using the 'mysql_asio_examples' database.
|
||||
* For this example, we will be using the 'boost_mysql_examples' database.
|
||||
* You can get this database by running db_setup.sql.
|
||||
* This example assumes you are connecting to a localhost MySQL server.
|
||||
*
|
||||
@ -99,7 +99,7 @@ void main_impl(int argc, char** argv)
|
||||
boost::mysql::connection_params params (
|
||||
argv[1], // username
|
||||
argv[2], // password
|
||||
"mysql_asio_examples" // database to use; leave empty or omit the parameter for no database
|
||||
"boost_mysql_examples" // database to use; leave empty or omit the parameter for no database
|
||||
);
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
* For this example, we will be using the 'mysql_asio_examples' database.
|
||||
* For this example, we will be using the 'boost_mysql_examples' database.
|
||||
* You can get this database by running db_setup.sql.
|
||||
* This example assumes you are connecting to a localhost MySQL server.
|
||||
*
|
||||
@ -59,7 +59,7 @@ void main_impl(int argc, char** argv)
|
||||
boost::mysql::connection_params params (
|
||||
argv[1], // username
|
||||
argv[2], // password
|
||||
"mysql_asio_examples" // database to use; leave empty or omit the parameter for no database
|
||||
"boost_mysql_examples" // database to use; leave empty or omit the parameter for no database
|
||||
);
|
||||
// Note: by default, SSL will be used if the server supports it.
|
||||
// connection_params accepts an optional ssl_options argument
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
* For this example, we will be using the 'mysql_asio_examples' database.
|
||||
* For this example, we will be using the 'boost_mysql_examples' database.
|
||||
* You can get this database by running db_setup.sql.
|
||||
* This example assumes you are connecting to MySQL server using
|
||||
* a UNIX socket. The socket path can be configured using command line
|
||||
@ -59,7 +59,7 @@ void main_impl(int argc, char** argv)
|
||||
boost::mysql::connection_params params (
|
||||
argv[1], // username
|
||||
argv[2], // password
|
||||
"mysql_asio_examples" // database to use; leave empty or omit the parameter for no database
|
||||
"boost_mysql_examples" // database to use; leave empty or omit the parameter for no database
|
||||
);
|
||||
// Note: by default, SSL will be used if the server supports it.
|
||||
// connection_params accepts an optional ssl_options argument
|
||||
|
@ -56,7 +56,7 @@ target_link_libraries(
|
||||
gtest
|
||||
gtest_main
|
||||
gmock
|
||||
mysql_asio
|
||||
Boost_mysql
|
||||
)
|
||||
_mysql_common_target_settings(mysql_unittests)
|
||||
|
||||
@ -94,7 +94,7 @@ target_link_libraries(
|
||||
gtest
|
||||
gtest_main
|
||||
gmock
|
||||
mysql_asio
|
||||
Boost_mysql
|
||||
Boost::coroutine
|
||||
)
|
||||
target_include_directories(
|
||||
|
@ -10,9 +10,9 @@ SET NAMES utf8;
|
||||
SET global max_connections = 10000;
|
||||
|
||||
-- Database
|
||||
DROP DATABASE IF EXISTS awesome;
|
||||
CREATE DATABASE awesome;
|
||||
USE awesome;
|
||||
DROP DATABASE IF EXISTS boost_mysql_integtests;
|
||||
CREATE DATABASE boost_mysql_integtests;
|
||||
USE boost_mysql_integtests;
|
||||
|
||||
-- Tables
|
||||
CREATE TABLE inserts_table (
|
||||
@ -376,16 +376,16 @@ INSERT INTO types_flags VALUES
|
||||
DROP USER IF EXISTS 'integ_user'@'localhost';
|
||||
CREATE USER 'integ_user'@'localhost' IDENTIFIED WITH 'mysql_native_password';
|
||||
ALTER USER 'integ_user'@'localhost' IDENTIFIED BY 'integ_password';
|
||||
GRANT ALL PRIVILEGES ON awesome.* TO 'integ_user'@'localhost';
|
||||
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'integ_user'@'localhost';
|
||||
|
||||
DROP USER IF EXISTS 'mysqlnp_user'@'localhost';
|
||||
CREATE USER 'mysqlnp_user'@'localhost' IDENTIFIED WITH 'mysql_native_password';
|
||||
ALTER USER 'mysqlnp_user'@'localhost' IDENTIFIED BY 'mysqlnp_password';
|
||||
GRANT ALL PRIVILEGES ON awesome.* TO 'mysqlnp_user'@'localhost';
|
||||
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'mysqlnp_user'@'localhost';
|
||||
|
||||
DROP USER IF EXISTS 'mysqlnp_empty_password_user'@'localhost';
|
||||
CREATE USER 'mysqlnp_empty_password_user'@'localhost' IDENTIFIED WITH 'mysql_native_password';
|
||||
ALTER USER 'mysqlnp_empty_password_user'@'localhost' IDENTIFIED BY '';
|
||||
GRANT ALL PRIVILEGES ON awesome.* TO 'mysqlnp_empty_password_user'@'localhost';
|
||||
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'mysqlnp_empty_password_user'@'localhost';
|
||||
|
||||
FLUSH PRIVILEGES;
|
@ -9,17 +9,17 @@
|
||||
DROP USER IF EXISTS 'csha2p_user'@'localhost';
|
||||
CREATE USER 'csha2p_user'@'localhost' IDENTIFIED WITH 'caching_sha2_password';
|
||||
ALTER USER 'csha2p_user'@'localhost' IDENTIFIED BY 'csha2p_password';
|
||||
GRANT ALL PRIVILEGES ON awesome.* TO 'csha2p_user'@'localhost';
|
||||
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'csha2p_user'@'localhost';
|
||||
|
||||
DROP USER IF EXISTS 'csha2p_empty_password_user'@'localhost';
|
||||
CREATE USER 'csha2p_empty_password_user'@'localhost' IDENTIFIED WITH 'caching_sha2_password';
|
||||
ALTER USER 'csha2p_empty_password_user'@'localhost' IDENTIFIED BY '';
|
||||
GRANT ALL PRIVILEGES ON awesome.* TO 'csha2p_empty_password_user'@'localhost';
|
||||
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'csha2p_empty_password_user'@'localhost';
|
||||
|
||||
-- This one is used for unknown authentication plugin tests
|
||||
DROP USER IF EXISTS 'sha2p_user'@'localhost';
|
||||
CREATE USER 'sha2p_user'@'localhost' IDENTIFIED WITH 'sha256_password';
|
||||
ALTER USER 'sha2p_user'@'localhost' IDENTIFIED BY 'sha2p_password';
|
||||
GRANT ALL PRIVILEGES ON awesome.* TO 'sha2p_user'@'localhost';
|
||||
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'sha2p_user'@'localhost';
|
||||
|
||||
FLUSH PRIVILEGES;
|
@ -52,7 +52,11 @@ struct IntegTest : testing::Test
|
||||
{
|
||||
using stream_type = Stream;
|
||||
|
||||
mysql::connection_params connection_params {"integ_user", "integ_password", "awesome"};
|
||||
mysql::connection_params connection_params {
|
||||
"integ_user",
|
||||
"integ_password",
|
||||
"boost_mysql_integtests"
|
||||
};
|
||||
boost::asio::io_context ctx;
|
||||
mysql::connection<Stream> conn {ctx};
|
||||
boost::asio::executor_work_guard<boost::asio::io_context::executor_type> guard { ctx.get_executor() };
|
||||
|
@ -42,7 +42,7 @@ void meta_validator::validate(
|
||||
) const
|
||||
{
|
||||
// Fixed fields
|
||||
EXPECT_EQ(value.database(), "awesome");
|
||||
EXPECT_EQ(value.database(), "boost_mysql_integtests");
|
||||
EXPECT_EQ(value.table(), table_);
|
||||
EXPECT_EQ(value.original_table(), org_table_);
|
||||
EXPECT_EQ(value.field_name(), field_);
|
||||
|
Loading…
x
Reference in New Issue
Block a user