Only support extracting JSON fields when the SDK supports it (#3717)

* Added preprocessor defined to detect support for JSON

* Only support extracting JSON fields when the SDK supports it

* Fix version comparison
This commit is contained in:
Hernan Martinez
2022-07-27 14:23:34 -06:00
committed by GitHub
parent 459f1ea19c
commit 0f63862059
8 changed files with 36 additions and 8 deletions

View File

@@ -487,6 +487,7 @@ void MySQLTest::testLongTEXT()
_pExecutor->longText();
}
#ifdef POCO_MYSQL_JSON
void MySQLTest::testJSON()
{
if (!_pSession) fail("Test not available.");
@@ -494,7 +495,7 @@ void MySQLTest::testJSON()
recreatePersonJSONTable();
_pExecutor->json();
}
#endif
void MySQLTest::testUnsignedInts()
{
@@ -796,7 +797,7 @@ void MySQLTest::recreatePersonLongBLOBTable()
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail ("recreatePersonLongBLOBTable()"); }
}
#ifdef POCO_MYSQL_JSON
void MySQLTest::recreatePersonJSONTable()
{
dropTable("Person");
@@ -804,7 +805,7 @@ void MySQLTest::recreatePersonJSONTable()
catch (ConnectionException& ce) { std::cout << ce.displayText() << std::endl; fail("recreatePersonJSONTable()"); }
catch (StatementException& se) { std::cout << se.displayText() << std::endl; fail("recreatePersonJSONTable()"); }
}
#endif
void MySQLTest::recreateIntsTable()
{

View File

@@ -81,7 +81,9 @@ public:
void testBLOBStmt();
void testLongBLOB();
void testLongTEXT();
#ifdef POCO_MYSQL_JSON
void testJSON();
#endif
void testUnsignedInts();
void testFloat();
@@ -122,7 +124,9 @@ private:
void recreatePersonTimeTable();
void recreatePersonTimestampTable();
void recreatePersonLongBLOBTable();
#ifdef POCO_MYSQL_JSON
void recreatePersonJSONTable();
#endif
void recreateStringsTable();
void recreateIntsTable();
void recreateUnsignedIntsTable();

View File

@@ -1513,6 +1513,7 @@ void SQLExecutor::longText()
poco_assert (longTextRes == biography);
}
#ifdef POCO_MYSQL_JSON
void SQLExecutor::json()
{
std::string funct = "json()";
@@ -1537,7 +1538,7 @@ void SQLExecutor::json()
catch (StatementException& se) { std::cout << se.displayText() << std::endl; fail(funct); }
poco_assert(res == biography);
}
#endif
void SQLExecutor::tuples()
{

View File

@@ -86,7 +86,9 @@ public:
void timestamp();
void longBlob();
void longText();
#ifdef POCO_MYSQL_JSON
void json();
#endif
void unsignedInts();
void floats();
void doubles();