Skip to content

Commit 726d84a

Browse files
palichoroba
authored andcommitted
Async queries do not work with Embedded server
This is because mysql_send_query() client function is synchronous and waits for results when connection is to Embedded server. So asynchronous support via mysql_send_query() is not supported for Embedded server. So do not allow to create asynchronous queries within Embedded server.
1 parent 0eb1a0c commit 726d84a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

dbdimp.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2786,6 +2786,11 @@ IV mariadb_db_do6(SV *dbh, imp_dbh_t *imp_dbh, SV *statement_sv, SV *attribs, I3
27862786

27872787
if (async)
27882788
{
2789+
if (imp_dbh->is_embedded)
2790+
{
2791+
mariadb_dr_do_error(dbh, CR_UNKNOWN_ERROR, "Async option not supported for Embedded server", "HY000");
2792+
return -2;
2793+
}
27892794
if (disable_fallback_for_server_prepare)
27902795
{
27912796
mariadb_dr_do_error(dbh, ER_UNSUPPORTED_PS, "Async option not supported with server side prepare", "HY000");
@@ -3963,6 +3968,11 @@ mariadb_st_prepare_sv(
39633968
(void)hv_stores(processed, "mariadb_async", &PL_sv_yes);
39643969
svp = MARIADB_DR_ATTRIB_GET_SVPS(attribs, "mariadb_async");
39653970
if(svp && SvTRUE(*svp)) {
3971+
if (imp_dbh->is_embedded)
3972+
{
3973+
mariadb_dr_do_error(sth, CR_UNKNOWN_ERROR, "Async option not supported for Embedded server", "HY000");
3974+
return 0;
3975+
}
39663976
imp_sth->is_async = TRUE;
39673977
if (imp_sth->disable_fallback_for_server_prepare)
39683978
{

lib/DBD/MariaDB.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@ my %odbc_info_constants = (
731731
169 => 127, # SQL_AGGREGATE_FUNCTIONS
732732
117 => 0, # SQL_ALTER_DOMAIN
733733
86 => 3, # SQL_ALTER_TABLE
734-
10021 => 2, # SQL_ASYNC_MODE
735734
120 => 2, # SQL_BATCH_ROW_COUNT
736735
121 => 2, # SQL_BATCH_SUPPORT
737736
82 => 0, # SQL_BOOKMARK_PERSISTENCE
@@ -905,6 +904,7 @@ my %odbc_info_constants = (
905904
);
906905

907906
my %odbc_info_subs = (
907+
10021 => sub { $_[0]->FETCH('mariadb_hostinfo') eq 'Embedded' ? 0 : 2 }, # SQL_ASYNC_MODE
908908
2 => sub { "DBI:MariaDB:" . $_[0]->{Name} }, # SQL_DATA_SOURCE_NAME
909909
17 => sub { ($_[0]->FETCH('mariadb_serverinfo') =~ /MariaDB|-maria-/) ? 'MariaDB' : 'MySQL' }, # SQL_DBMS_NAME
910910
18 => sub { my $ver = $_[0]->FETCH('mariadb_serverversion'); sprintf("%02u.%02u.%02u00", $ver/10000, ($ver%10000)/100, $ver%100) }, # SQL_DBMS_VER

0 commit comments

Comments
 (0)