Skip to content

Commit

Permalink
set errno
Browse files Browse the repository at this point in the history
  • Loading branch information
SunBeau committed May 22, 2024
1 parent 8ab8d84 commit 01fca68
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/extensions/qdatabase.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
#include <stdbool.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>

#define qtype_cast(_type, _src) ((_type)_src)

Expand Down Expand Up @@ -383,9 +384,15 @@ qdb_t *qdb(const char *dbtype,
{
// check db type
#ifdef Q_ENABLE_MYSQL
if (strcmp(dbtype, "MYSQL")) return NULL;
if (strcmp(dbtype, "MYSQL")) {
errno = ENOTSUP;
return NULL;
}
#elif defined(Q_ENABLE_PGSQL)
if (strcmp(dbtype, "PGSQL")) return NULL;
if (strcmp(dbtype, "PGSQL")) {
errno = ENOTSUP;
return NULL;
}
#else
return NULL;
#endif
Expand All @@ -399,6 +406,7 @@ qdb_t *qdb(const char *dbtype,

#ifdef Q_ENABLE_PGSQL
if (autocommit == false) {
errno = EINVAL;
return NULL;
}
#endif
Expand Down

0 comments on commit 01fca68

Please sign in to comment.