From cc2945a25962e3c4ba352a0266ffb332b8e67506 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 9 Sep 2021 14:41:13 +1000 Subject: Deal with database tables not existing while we wait for ROBUST to start up and create them. --- src/sledjchisl/sledjchisl.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 0bc696b..3e21d10 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -3804,6 +3804,20 @@ my_ulonglong dbCount(char *table, char *where) free(sql); return ret; } + + int e = mysql_errno(database); // Five different "table doesn't exist" errors? lol + if ( + (1051 == e) || // 1051 42S02 ER_BAD_TABLE_ERROR Unknown table '%s' + (1146 == e) || // 1146 42S02 ER_NO_SUCH_TABLE Table '%s.%s' doesn't exist + (1168 == e) || // 1168 HY000 ER_WRONG_MRG_TABLE Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist + (1177 == e) || // 1177 42000 ER_CHECK_NO_SUCH_TABLE Can't open table + (1472 == e) // 1472 HY000 ER_ADMIN_WRONG_MRG_TABLE Table '%s' is differently defined or of non-MyISAM type or doesn't exist + ) + { + W("Table %s doesn't exist. Yet.", table); + free(sql); + return 0; + } } else { @@ -3859,6 +3873,20 @@ my_ulonglong dbCountJoin(char *table, char *select, char *join, char *where) free(sql); return ret; } + + int e = mysql_errno(database); // Five different "table doesn't exist" errors? lol + if ( + (1051 == e) || // 1051 42S02 ER_BAD_TABLE_ERROR Unknown table '%s' + (1146 == e) || // 1146 42S02 ER_NO_SUCH_TABLE Table '%s.%s' doesn't exist + (1168 == e) || // 1168 HY000 ER_WRONG_MRG_TABLE Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist + (1177 == e) || // 1177 42000 ER_CHECK_NO_SUCH_TABLE Can't open table + (1472 == e) // 1472 HY000 ER_ADMIN_WRONG_MRG_TABLE Table '%s' is differently defined or of non-MyISAM type or doesn't exist + ) + { + W("Table %s doesn't exist. Yet.", table); + free(sql); + return 0; + } } else { -- cgit v1.1