MySQL++

Check-in [d8def9fe7b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added explicit mysql_library_init() calls from the tests that do quoting and escaping to avoid a crash in newer MariaDB versions which apparently delay doing this until you create a connection. (Thus why none of the examples fail on modern MariaDB versions.) It's basically the same patch as in the forum request [44684af1fd], but with comment and whitespace fixes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d8def9fe7b2951ce42c4f6aa1020e6d954d8b1111da2c67220ec8163d777f09b
User & Date: lukemewburn 2020-07-10 20:35:57
Original User & Date: tangent 2020-07-10 20:35:57
Context
2020-07-23
06:52
The SQL type mapping for TIMESTAMP NULL was missing the MySQL++ tf_null annotation. Closes bug [585db77afe8]. check-in: 40f302fba1 user: tangent tags: trunk
2020-07-10
20:35
Added explicit mysql_library_init() calls from the tests that do quoting and escaping to avoid a crash in newer MariaDB versions which apparently delay doing this until you create a connection. (Thus why none of the examples fail on modern MariaDB versions.) It's basically the same patch as in the forum request [44684af1fd], but with comment and whitespace fixes. check-in: d8def9fe7b user: lukemewburn tags: trunk
20:14
Markdown tweak for Fossil's renderer check-in: e9f50a9293 user: tangent tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/manip.cpp.

151
152
153
154
155
156
157


158
159
160
161
162
163
164
165
166
167
168
169
170
			no_implicit_quote(test, len);
}


int
main()
{


	char s[] = "Doodle me, James, doodle me!";
	const size_t len = strlen(s);

	int failures = 0;
	failures += test(s, len) == false;
	failures += test(static_cast<char*>(s), len) == false;
	failures += test(static_cast<const char*>(s), len) == false;
	failures += test(std::string(s), len) == false;
	failures += test(mysqlpp::SQLTypeAdapter(s), len) == false;
	failures += test(mysqlpp::Null<std::string>(s), len) == false;
	return failures;
}








>
>













151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
			no_implicit_quote(test, len);
}


int
main()
{
    mysql_library_init(0, 0, 0);    // no longer implicit in newer MariaDB

	char s[] = "Doodle me, James, doodle me!";
	const size_t len = strlen(s);

	int failures = 0;
	failures += test(s, len) == false;
	failures += test(static_cast<char*>(s), len) == false;
	failures += test(static_cast<const char*>(s), len) == false;
	failures += test(std::string(s), len) == false;
	failures += test(mysqlpp::SQLTypeAdapter(s), len) == false;
	failures += test(mysqlpp::Null<std::string>(s), len) == false;
	return failures;
}

Changes to test/qssqls.cpp.

55
56
57
58
59
60
61


62
63
64
65
66
67
68
	sql_char,				char_v,	// only need one stringish type...
	sql_blob,				blob_v)	// ...and one blob type; they're all
									// the same under the hood in MySQL++

int
main()
{


	Query q(0);		// don't pass 0 for conn parameter in real code
	test empty(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false,
			Date(), Time(), DateTime(), "", sql_blob());
	test filled(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.0, 12.0, 13.0,
			bool(14), Date("1515-15-15"), Time("16:16:16"),
			DateTime("1717-17-17 17:17:17"), "18", sql_blob("1\09", 3));








>
>







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
	sql_char,				char_v,	// only need one stringish type...
	sql_blob,				blob_v)	// ...and one blob type; they're all
									// the same under the hood in MySQL++

int
main()
{
    mysql_library_init(0, 0, 0);    // no longer implicit in newer MariaDB

	Query q(0);		// don't pass 0 for conn parameter in real code
	test empty(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false,
			Date(), Time(), DateTime(), "", sql_blob());
	test filled(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.0, 12.0, 13.0,
			bool(14), Date("1515-15-15"), Time("16:16:16"),
			DateTime("1717-17-17 17:17:17"), "18", sql_blob("1\09", 3));

Changes to test/sqlstream.cpp.

61
62
63
64
65
66
67


68
69
70
71
72
73
74
	sql_mediumtext,			mediumtext_v,
	sql_longtext,			longtext_v)


int
main()
{


	SQLStream sqls(0);		// don't do this in real code
	test empty(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false,
			Date(), Time(), DateTime(),"","","","","","");
	test filled(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.0, 12.0, 13.0,
			bool(14), Date("1515-15-15"), Time("16:16:16"),
			DateTime("1717-17-17 17:17:17"),"18","19","20","21","22","23");








>
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
	sql_mediumtext,			mediumtext_v,
	sql_longtext,			longtext_v)


int
main()
{
    mysql_library_init(0, 0, 0);    // no longer implicit in newer MariaDB

	SQLStream sqls(0);		// don't do this in real code
	test empty(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false,
			Date(), Time(), DateTime(),"","","","","","");
	test filled(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.0, 12.0, 13.0,
			bool(14), Date("1515-15-15"), Time("16:16:16"),
			DateTime("1717-17-17 17:17:17"),"18","19","20","21","22","23");