mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 06:43:04 +01:00
Misc (obsolete utilities)
This commit is contained in:
parent
0ae458ed62
commit
c9455664eb
@ -67,11 +67,14 @@ int main( int argc, char **argv)
|
|||||||
* Top level routine.
|
* Top level routine.
|
||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
char facility[20], text[256], module[32], routine[32];
|
char facility[20], text[256];
|
||||||
char sql_class[32], sql_sub_class[32];
|
BASED_ON MESSAGES.ROUTINE routine;
|
||||||
|
BASED_ON MESSAGES.MODULE module;
|
||||||
|
BASED_ON SYSTEM_ERRORS.SQL_CLASS sql_class;
|
||||||
|
BASED_ON SYSTEM_ERRORS.SQL_SUBCLASS sql_sub_class;
|
||||||
|
BASED_ON SYSTEM_ERRORS.GDS_SYMBOL symbol;
|
||||||
SCHAR input[200];
|
SCHAR input[200];
|
||||||
char yesno[100];
|
char yesno[100];
|
||||||
char symbol[30];
|
|
||||||
char nstring[32];
|
char nstring[32];
|
||||||
SSHORT count;
|
SSHORT count;
|
||||||
SSHORT sql_number;
|
SSHORT sql_number;
|
||||||
|
@ -43,12 +43,12 @@
|
|||||||
DATABASE DB = "msg.fdb";
|
DATABASE DB = "msg.fdb";
|
||||||
|
|
||||||
static void ascii_str_upper(UCHAR*);
|
static void ascii_str_upper(UCHAR*);
|
||||||
static bool get_sql_class(UCHAR *);
|
static bool get_sql_class(char*);
|
||||||
static bool get_sql_code(SSHORT *);
|
static bool get_sql_code(SSHORT *);
|
||||||
static bool get_sql_subclass(UCHAR *);
|
static bool get_sql_subclass(char*);
|
||||||
static bool store_sql_msg();
|
static bool store_sql_msg();
|
||||||
static bool translate(const UCHAR*, UCHAR*, SSHORT);
|
static bool translate(const UCHAR*, UCHAR*, SSHORT);
|
||||||
static bool get_symbol( UCHAR *);
|
static bool get_symbol( char*);
|
||||||
|
|
||||||
const int FAC_SQL_POSITIVE = 14;
|
const int FAC_SQL_POSITIVE = 14;
|
||||||
const int FAC_SQL_NEGATIVE = 13;
|
const int FAC_SQL_NEGATIVE = 13;
|
||||||
@ -75,10 +75,13 @@ int main( int argc, char **argv)
|
|||||||
/* Note that the lengths of these variables are based on the lengths of the
|
/* Note that the lengths of these variables are based on the lengths of the
|
||||||
* fields in the message database */
|
* fields in the message database */
|
||||||
|
|
||||||
UCHAR facility[20], text[256], module[32], routine[32];
|
UCHAR facility[20], text[256];
|
||||||
UCHAR sql_class[32], sql_sub_class[32];
|
BASED_ON MESSAGES.ROUTINE routine;
|
||||||
UCHAR symbol[30], pub[1];
|
BASED_ON MESSAGES.MODULE module;
|
||||||
UCHAR nstring[32];
|
BASED_ON SYSTEM_ERRORS.SQL_CLASS sql_class;
|
||||||
|
BASED_ON SYSTEM_ERRORS.SQL_SUBCLASS sql_sub_class;
|
||||||
|
BASED_ON SYSTEM_ERRORS.GDS_SYMBOL symbol;
|
||||||
|
UCHAR pub[1];
|
||||||
SSHORT count;
|
SSHORT count;
|
||||||
SSHORT sql_num;
|
SSHORT sql_num;
|
||||||
bool public_msg;
|
bool public_msg;
|
||||||
@ -92,7 +95,6 @@ int main( int argc, char **argv)
|
|||||||
memset(sql_sub_class, 0, sizeof(sql_sub_class));
|
memset(sql_sub_class, 0, sizeof(sql_sub_class));
|
||||||
memset(symbol, 0, sizeof(symbol));
|
memset(symbol, 0, sizeof(symbol));
|
||||||
memset(pub, 0, sizeof(pub));
|
memset(pub, 0, sizeof(pub));
|
||||||
memset(nstring, 0, sizeof(nstring));
|
|
||||||
|
|
||||||
printf("\nHit Ctrl-D (or Ctrl-Z) at prompt to exit level\n");
|
printf("\nHit Ctrl-D (or Ctrl-Z) at prompt to exit level\n");
|
||||||
printf
|
printf
|
||||||
@ -127,10 +129,10 @@ int main( int argc, char **argv)
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
printf(" Module: ");
|
printf(" Module: ");
|
||||||
if (!gets((char*) module))
|
if (!gets(module))
|
||||||
break;
|
break;
|
||||||
printf(" Routine: ");
|
printf(" Routine: ");
|
||||||
if (!gets((char*) routine))
|
if (!gets(routine))
|
||||||
break;
|
break;
|
||||||
printf(" Text: ");
|
printf(" Text: ");
|
||||||
if (!gets((char*) text))
|
if (!gets((char*) text))
|
||||||
@ -151,7 +153,7 @@ int main( int argc, char **argv)
|
|||||||
public_msg = true;
|
public_msg = true;
|
||||||
|
|
||||||
printf(" Symbol: ");
|
printf(" Symbol: ");
|
||||||
if (!gets((char*) symbol))
|
if (!gets(symbol))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (public_msg)
|
if (public_msg)
|
||||||
@ -175,15 +177,15 @@ int main( int argc, char **argv)
|
|||||||
|
|
||||||
S.SQL_CODE = sql_num;
|
S.SQL_CODE = sql_num;
|
||||||
|
|
||||||
strcpy(S.GDS_SYMBOL, (char*) symbol);
|
strcpy(S.GDS_SYMBOL, symbol);
|
||||||
if (sql_class[0]) {
|
if (sql_class[0]) {
|
||||||
strcpy(S.SQL_CLASS, (char*) sql_class);
|
strcpy(S.SQL_CLASS, sql_class);
|
||||||
S.SQL_CLASS.NULL = FALSE;
|
S.SQL_CLASS.NULL = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
S.SQL_CLASS.NULL = TRUE;
|
S.SQL_CLASS.NULL = TRUE;
|
||||||
if (sql_sub_class[0]) {
|
if (sql_sub_class[0]) {
|
||||||
strcpy(S.SQL_SUBCLASS, (char*) sql_sub_class);
|
strcpy(S.SQL_SUBCLASS, sql_sub_class);
|
||||||
S.SQL_SUBCLASS.NULL = FALSE;
|
S.SQL_SUBCLASS.NULL = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -195,9 +197,9 @@ int main( int argc, char **argv)
|
|||||||
STORE Y IN MESSAGES USING
|
STORE Y IN MESSAGES USING
|
||||||
Y.FAC_CODE = X.FAC_CODE;
|
Y.FAC_CODE = X.FAC_CODE;
|
||||||
Y.NUMBER = X.MAX_NUMBER;
|
Y.NUMBER = X.MAX_NUMBER;
|
||||||
strcpy(Y.MODULE, (char*) module);
|
strcpy(Y.MODULE, module);
|
||||||
strcpy(Y.ROUTINE, (char*) routine);
|
strcpy(Y.ROUTINE, routine);
|
||||||
strcpy(Y.SYMBOL, (char*) symbol);
|
strcpy(Y.SYMBOL, symbol);
|
||||||
if (!translate(text, (UCHAR*) Y.TEXT, sizeof(Y.TEXT))) {
|
if (!translate(text, (UCHAR*) Y.TEXT, sizeof(Y.TEXT))) {
|
||||||
printf
|
printf
|
||||||
("Message too long: max length: %d\n",
|
("Message too long: max length: %d\n",
|
||||||
@ -249,7 +251,7 @@ static void ascii_str_upper( UCHAR * str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool get_sql_class( UCHAR * sql_class)
|
static bool get_sql_class( char* sql_class)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -265,14 +267,14 @@ static bool get_sql_class( UCHAR * sql_class)
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
printf(" SQLCLASS: ");
|
printf(" SQLCLASS: ");
|
||||||
gets((char*) sql_class);
|
gets(sql_class);
|
||||||
const SSHORT length = strlen((char*) sql_class);
|
const SSHORT length = strlen(sql_class);
|
||||||
if (length == 0 || !isalnum(sql_class[0]))
|
if (length == 0 || !isalnum((UCHAR) sql_class[0]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (length == 2)
|
if (length == 2)
|
||||||
return true;
|
return true;
|
||||||
else
|
|
||||||
fprintf(stderr, "Sqlclass is two characters!\n");
|
fprintf(stderr, "Sqlclass is two characters!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +369,7 @@ static bool get_sql_code( SSHORT * sql_code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool get_sql_subclass( UCHAR * sql_sub_class)
|
static bool get_sql_subclass( char* sql_sub_class)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -383,9 +385,9 @@ static bool get_sql_subclass( UCHAR * sql_sub_class)
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
printf(" SQLSUBCLASS: ");
|
printf(" SQLSUBCLASS: ");
|
||||||
gets((char*) sql_sub_class);
|
gets(sql_sub_class);
|
||||||
const SSHORT length = strlen((char*) sql_sub_class);
|
const SSHORT length = strlen(sql_sub_class);
|
||||||
if (length == 0 || !isalnum(sql_sub_class[0]))
|
if (length == 0 || !isalnum((UCHAR) sql_sub_class[0]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (length == 3)
|
if (length == 3)
|
||||||
@ -400,7 +402,7 @@ static bool get_sql_subclass( UCHAR * sql_sub_class)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool get_symbol( UCHAR * symbol)
|
static bool get_symbol( char* symbol)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -417,10 +419,10 @@ static bool get_symbol( UCHAR * symbol)
|
|||||||
while (true) {
|
while (true) {
|
||||||
fprintf(stderr, "Symbols are required for system errors!\n");
|
fprintf(stderr, "Symbols are required for system errors!\n");
|
||||||
printf(" Symbol: ");
|
printf(" Symbol: ");
|
||||||
gets((char*) symbol);
|
gets(symbol);
|
||||||
if (!strlen((char*) symbol) || !isalnum(symbol[0]))
|
if (!strlen(symbol) || !isalnum((UCHAR) symbol[0]))
|
||||||
return false;
|
return false;
|
||||||
else
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user