From efcea3a80da7c4479d5fe168435ecc9fd06bdc72 Mon Sep 17 00:00:00 2001 From: John Turner Date: Sun, 14 Sep 2025 00:16:10 -0400 Subject: Squashed 'subprojects/boost-sqlite/' content from commit 3378e35 git-subtree-dir: subprojects/boost-sqlite git-subtree-split: 3378e353705271e569cf4ba15c467b840a39798c --- test/meta_data.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/meta_data.cpp (limited to 'test/meta_data.cpp') diff --git a/test/meta_data.cpp b/test/meta_data.cpp new file mode 100644 index 0000000..2861a1c --- /dev/null +++ b/test/meta_data.cpp @@ -0,0 +1,45 @@ +// Copyright (c) 2022 Klemens D. Morgenstern +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include "test.hpp" +#include + +using namespace boost; + +BOOST_AUTO_TEST_CASE(meta_data) +{ + sqlite::connection conn; + conn.connect(":memory:"); + conn.execute( +#include "test-db.sql" + ); + + + + auto fn = table_column_meta_data(conn, "author", "first_name"); + BOOST_CHECK_MESSAGE(boost::iequals(fn.data_type, "TEXT"), fn.data_type); + BOOST_CHECK(!fn.auto_increment); + BOOST_CHECK_MESSAGE(boost::iequals(fn.collation, "BINARY"), fn.collation); + BOOST_CHECK(!fn.primary_key); + BOOST_CHECK( fn.not_null); + + auto ln = table_column_meta_data(conn, "main", "author", "last_name"); + BOOST_CHECK_MESSAGE(boost::iequals(ln.data_type, "TEXT"), ln.data_type); + BOOST_CHECK(!ln.auto_increment); + BOOST_CHECK_MESSAGE(boost::iequals(ln.collation, "BINARY"), ln.collation); + BOOST_CHECK(!ln.primary_key); + BOOST_CHECK(!ln.not_null); + + auto id = table_column_meta_data(conn, "main", "author", "id"); + BOOST_CHECK(boost::iequals(id.data_type, "INTEGER")); + BOOST_CHECK( id.auto_increment); + BOOST_CHECK(boost::iequals(id.collation, "BINARY")); + BOOST_CHECK( id.primary_key); + BOOST_CHECK( id.not_null); + + conn.close(); +} \ No newline at end of file -- cgit v1.2.3