From: Claudio V. C. <ro...@us...> - 2005-05-26 06:46:07
|
Update of /cvsroot/firebird/firebird2/src/isql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4376/src/isql Modified Files: extract.epp isql.epp isql.h show.epp Log Message: - Cleanup. - A bit better handling of SHOW EXCEPTION. Index: extract.epp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/isql/extract.epp,v retrieving revision 1.60 retrieving revision 1.61 diff -b -U3 -r1.60 -r1.61 --- extract.epp 24 May 2005 04:41:54 -0000 1.60 +++ extract.epp 26 May 2005 06:45:16 -0000 1.61 @@ -145,7 +145,7 @@ "/*=========================================================*/%s", NEWLINE); } - isqlGlob.printf(" %s", NEWLINE); + isqlGlob.printf(NEWLINE); isqlGlob.printf("SET SQL DIALECT %d; %s", isqlGlob.db_SQL_dialect, NEWLINE); @@ -347,7 +347,7 @@ SINGLE_QUOTE); isqlGlob.printf("EXTERNAL FILE %s ", SQL_identifier2); } - ISQL_printf (isqlGlob.Out, "("); + isqlGlob.printf("("); } else { @@ -372,7 +372,7 @@ if (!FLD.RDB$COMPUTED_BLR.NULL) { - ISQL_printf (isqlGlob.Out, "COMPUTED BY "); + isqlGlob.printf("COMPUTED BY "); if (!FLD.RDB$COMPUTED_SOURCE.NULL) ISQL_print_validation (isqlGlob.Out, &FLD.RDB$COMPUTED_SOURCE, true, gds_trans); } @@ -384,10 +384,10 @@ if (isqlGlob.db_SQL_dialect > SQL_DIALECT_V6_TRANSITION) { ISQL_copy_SQL_id (FLD.RDB$FIELD_NAME, SQL_identifier, DBL_QUOTE); - isqlGlob.printf("%s", SQL_identifier); + isqlGlob.prints(SQL_identifier); } else - isqlGlob.printf("%s", FLD.RDB$FIELD_NAME); + isqlGlob.prints(FLD.RDB$FIELD_NAME); // International character sets // Print only the character set @@ -399,7 +399,7 @@ char_set_id = FLD.RDB$CHARACTER_SET_ID; ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, 0, true, char_sets); if (char_sets[0]) - ISQL_printf (isqlGlob.Out, char_sets); + isqlGlob.prints(char_sets); } } else @@ -468,7 +468,7 @@ sprintf (Print_buffer, "%s", Column_types[i].type_name); } - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.prints(Print_buffer); break; } @@ -477,13 +477,11 @@ if (FLD.RDB$CHARACTER_LENGTH.NULL) { - sprintf (Print_buffer, "(%d)", FLD.RDB$FIELD_LENGTH); - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.printf("(%d)", FLD.RDB$FIELD_LENGTH); } else { - sprintf (Print_buffer, "(%d)", FLD.RDB$CHARACTER_LENGTH); - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.printf("(%d)", FLD.RDB$CHARACTER_LENGTH); } // Catch arrays after printing the type @@ -494,17 +492,15 @@ if (FLD.RDB$FIELD_TYPE == BLOB) { const int subtype = FLD.RDB$FIELD_SUB_TYPE; - ISQL_printf (isqlGlob.Out, " SUB_TYPE "); + isqlGlob.printf(" SUB_TYPE "); if ((subtype > 0) && (subtype <= MAX_BLOBSUBTYPES)) - ISQL_printf (isqlGlob.Out, Sub_types[subtype]); + isqlGlob.prints(Sub_types[subtype]); else { - sprintf (Print_buffer, "%d", subtype); - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.printf("%d", subtype); } - sprintf (Print_buffer, " SEGMENT SIZE %u", + isqlGlob.printf(" SEGMENT SIZE %u", (USHORT) FLD.RDB$SEGMENT_LENGTH); - ISQL_printf (isqlGlob.Out, Print_buffer); } // International character sets @@ -527,7 +523,7 @@ if ((char_set_id != default_char_set_id) || collation) ISQL_get_character_sets (char_set_id, 0, false, char_sets); if (char_sets[0]) - ISQL_printf (isqlGlob.Out, char_sets); + isqlGlob.prints(char_sets); // CVC: Someone deleted the code that checks intchar when handling collations // several lines below, so it didn't have any effect. Commented it. //if (!char_set_id) @@ -541,7 +537,7 @@ if (!RFR.RDB$DEFAULT_SOURCE.NULL) { - ISQL_printf (isqlGlob.Out, " "); + isqlGlob.printf(" "); SHOW_print_metadata_text_blob (isqlGlob.Out, &RFR.RDB$DEFAULT_SOURCE); } @@ -571,9 +567,8 @@ sprintf (Print_buffer, " CONSTRAINT %s", SQL_identifier); } else - sprintf (Print_buffer, " CONSTRAINT %s", + isqlGlob.printf(" CONSTRAINT %s", CON.RDB$CONSTRAINT_NAME); - ISQL_printf (isqlGlob.Out, Print_buffer); } END_FOR ON_ERROR @@ -581,7 +576,7 @@ return FINI_ERROR; END_ERROR; - ISQL_printf (isqlGlob.Out, " NOT NULL"); + isqlGlob.printf(" NOT NULL"); } // Handle collations after defaults @@ -591,7 +586,7 @@ char_sets[0] = '\0'; ISQL_get_character_sets (char_set_id, collation, true, char_sets); if (char_sets[0]) - ISQL_printf (isqlGlob.Out, char_sets); + isqlGlob.prints(char_sets); } END_FOR ON_ERROR @@ -694,11 +689,11 @@ first_time = false; if (ptype == 0) { // this is the input part - ISQL_printf (isqlGlob.Out, "("); + isqlGlob.printf("("); } else { // we are in the output part - ISQL_printf (isqlGlob.Out, "RETURNS ("); + isqlGlob.printf("RETURNS ("); } } else @@ -782,7 +777,7 @@ Column_types[i].type_name); } } - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.prints(Print_buffer); break; } @@ -794,13 +789,11 @@ if (FLD.RDB$CHARACTER_LENGTH.NULL) { - sprintf (Print_buffer, "(%d)", FLD.RDB$FIELD_LENGTH); - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.printf("(%d)", FLD.RDB$FIELD_LENGTH); } else { - sprintf (Print_buffer, "(%d)", FLD.RDB$CHARACTER_LENGTH); - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.printf("(%d)", FLD.RDB$CHARACTER_LENGTH); } @@ -818,7 +811,7 @@ ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, FLD.RDB$COLLATION_ID, false, char_sets); if (char_sets[0]) - ISQL_printf (isqlGlob.Out, char_sets); + isqlGlob.prints(char_sets); } END_FOR ON_ERROR @@ -1174,7 +1167,7 @@ // If trigger is not SQL put it in comments if (TRG.RDB$FLAGS != TRG_sql) - ISQL_printf (isqlGlob.Out, "/* "); + isqlGlob.printf("/* "); if (isqlGlob.db_SQL_dialect > SQL_DIALECT_V6_TRANSITION) { @@ -1197,7 +1190,7 @@ SHOW_print_metadata_text_blob (isqlGlob.Out, &TRG.RDB$TRIGGER_SOURCE); isqlGlob.printf(" %s%s", Procterm, NEWLINE); - isqlGlob.printf(" %s", NEWLINE); + isqlGlob.printf(NEWLINE); if (TRG.RDB$FLAGS != TRG_sql) { @@ -1244,7 +1237,7 @@ fb_utils::exact_name(TRG.RDB$RELATION_NAME); - isqlGlob.printf(" %s ", NEWLINE); + isqlGlob.printf(NEWLINE); if (isqlGlob.db_SQL_dialect > SQL_DIALECT_V6_TRANSITION) { @@ -1293,8 +1286,8 @@ ************************************** * * Functional description - * print (using ISQL_printf) the word "SET" - * if the first line of the ALTER DATABASE + * print the word "SET" + * in the first line of the ALTER DATABASE * settings options. Also, add trailing * comma for end of prior line if needed. * @@ -1313,6 +1306,7 @@ } #endif + static void list_create_db() { /************************************** @@ -1335,7 +1329,7 @@ bool nodb = false; if (!*isqlGlob.global_Target_db) { - ISQL_printf(isqlGlob.Out, "/* "); + isqlGlob.printf("/* "); strcpy(isqlGlob.global_Target_db, isqlGlob.global_Db_name); nodb = true; } @@ -1414,7 +1408,7 @@ { isqlGlob.printf(" LENGTH %ld", FIL.RDB$FILE_LENGTH); } - isqlGlob.printf("%s", NEWLINE); + isqlGlob.printf(NEWLINE); } if (FIL.RDB$FILE_FLAGS & FILE_shadow) @@ -1430,13 +1424,13 @@ FIL.RDB$SHADOW_NUMBER, FIL.RDB$FILE_NAME); if (FIL.RDB$FILE_FLAGS & FILE_inactive) - ISQL_printf (isqlGlob.Out, "INACTIVE "); + isqlGlob.printf("INACTIVE "); if (FIL.RDB$FILE_FLAGS & FILE_manual) - ISQL_printf (isqlGlob.Out, "MANUAL "); + isqlGlob.printf("MANUAL "); else - ISQL_printf (isqlGlob.Out, "AUTO "); + isqlGlob.printf("AUTO "); if (FIL.RDB$FILE_FLAGS & FILE_conditional) - ISQL_printf (isqlGlob.Out, "CONDITIONAL "); + isqlGlob.printf("CONDITIONAL "); } if (FIL.RDB$FILE_LENGTH) { @@ -1446,7 +1440,7 @@ { isqlGlob.printf("STARTING %ld ", FIL.RDB$FILE_START); } - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } END_FOR @@ -1570,7 +1564,7 @@ sprintf (Print_buffer, "%s", Column_types[i].type_name); } } - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.prints(Print_buffer); break; } @@ -1578,26 +1572,22 @@ if (FLD.RDB$FIELD_TYPE == BLOB) { const int subtype = FLD.RDB$FIELD_SUB_TYPE; - ISQL_printf (isqlGlob.Out, " SUB_TYPE "); + isqlGlob.printf(" SUB_TYPE "); if ((subtype > 0) && (subtype <= MAX_BLOBSUBTYPES)) { - sprintf (Print_buffer, "%s", Sub_types[subtype]); - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.prints(Sub_types[subtype]); } else { - sprintf (Print_buffer, "%d", subtype); - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.printf("%d", subtype); } - sprintf (Print_buffer, " SEGMENT SIZE %u", (USHORT) FLD.RDB$SEGMENT_LENGTH); - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.printf(" SEGMENT SIZE %u", (USHORT) FLD.RDB$SEGMENT_LENGTH); } else if ((FLD.RDB$FIELD_TYPE == T_CHAR) || (FLD.RDB$FIELD_TYPE == VARCHAR)) { // Length for chars - sprintf (Print_buffer, "(%d)", ISQL_get_field_length(FLD.RDB$FIELD_NAME)); - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.printf("(%d)", ISQL_get_field_length(FLD.RDB$FIELD_NAME)); } /* Bug 8261: do not show the collation information just yet! If you @@ -1613,7 +1603,7 @@ (!FLD.RDB$COLLATION_ID.NULL && FLD.RDB$COLLATION_ID != 0)) ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, 0, false, char_sets); if (char_sets[0]) - ISQL_printf (isqlGlob.Out, char_sets); + isqlGlob.prints(char_sets); } if (!FLD.RDB$DIMENSIONS.NULL) @@ -1630,7 +1620,7 @@ ISQL_print_validation (isqlGlob.Out, &FLD.RDB$VALIDATION_SOURCE, false, gds_trans); } if (FLD.RDB$NULL_FLAG == 1) - ISQL_printf (isqlGlob.Out, " NOT NULL"); + isqlGlob.printf(" NOT NULL"); // Bug 8261: Now show the collation order information /* Show the collation order if one has been specified. If the collation @@ -1646,7 +1636,7 @@ ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, FLD.RDB$COLLATION_ID, true, char_sets); if (char_sets[0]) - ISQL_printf (isqlGlob.Out, char_sets); + isqlGlob.prints(char_sets); } isqlGlob.printf("%s%s", isqlGlob.global_Term, NEWLINE); @@ -1755,18 +1745,18 @@ sprintf (Print_buffer, "%s", Column_types[i].type_name); } } - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.prints(Print_buffer); break; } if (FLD.RDB$FIELD_TYPE == BLOB) { const int subtype = FLD.RDB$FIELD_SUB_TYPE; - ISQL_printf (isqlGlob.Out, " SUB_TYPE "); + isqlGlob.printf(" SUB_TYPE "); if ((subtype > 0) && (subtype <= MAX_BLOBSUBTYPES)) { - isqlGlob.printf("%s", Sub_types[subtype]); + isqlGlob.prints(Sub_types[subtype]); } else { @@ -1795,7 +1785,7 @@ ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, 0, false, char_sets); } if (char_sets[0]) - ISQL_printf (isqlGlob.Out, char_sets); + isqlGlob.prints(char_sets); } if (!FLD.RDB$DIMENSIONS.NULL) @@ -1812,7 +1802,7 @@ ISQL_print_validation (isqlGlob.Out, &FLD.RDB$VALIDATION_SOURCE, false, gds_trans); } if (FLD.RDB$NULL_FLAG == 1) - ISQL_printf (isqlGlob.Out, " NOT NULL"); + isqlGlob.printf(" NOT NULL"); // Bug 8261: Now show the collation order information /* Show the collation order if one has been specified. If the collation @@ -1828,7 +1818,7 @@ ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, FLD.RDB$COLLATION_ID, true, char_sets); if (char_sets[0]) - ISQL_printf (isqlGlob.Out, char_sets); + isqlGlob.prints(char_sets); } isqlGlob.printf("%s%s", isqlGlob.global_Term, NEWLINE); @@ -1965,7 +1955,7 @@ ISQL_get_index_segments (collist, sizeof(collist), RELC1.RDB$INDEX_NAME, true); - isqlGlob.printf(" %s", NEWLINE); + isqlGlob.printf(NEWLINE); if (isqlGlob.db_SQL_dialect > SQL_DIALECT_V6_TRANSITION) { @@ -2272,7 +2262,7 @@ if (first) { - ISQL_printf2(isqlGlob.Out, + isqlGlob.printf( "%s/* Generators or sequences */%s", NEWLINE, NEWLINE); @@ -2296,7 +2286,7 @@ return; END_ERROR; - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } @@ -2328,7 +2318,7 @@ if (first) { - ISQL_printf2(isqlGlob.Out, + isqlGlob.printf( "%s/* Index definitions for all user tables */%s", NEWLINE, NEWLINE); @@ -2361,7 +2351,7 @@ #ifdef EXPRESSION_INDICES if (!IDX.RDB$EXPRESSION_BLR.NULL) { - ISQL_printf (isqlGlob.Out, " COMPUTED BY "); + isqlGlob.printf(" COMPUTED BY "); if (!IDX.RDB$EXPRESSION_SOURCE.NULL) SHOW_print_metadata_text_blob (isqlGlob.Out, &IDX.RDB$EXPRESSION_SOURCE); isqlGlob.printf("%s%s", isqlGlob.global_Term, NEWLINE); Index: isql.epp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/isql/isql.epp,v retrieving revision 1.147 retrieving revision 1.148 diff -b -U3 -r1.147 -r1.148 --- isql.epp 24 May 2005 04:42:01 -0000 1.147 +++ isql.epp 26 May 2005 06:45:16 -0000 1.148 @@ -187,8 +187,8 @@ } -// p r i n t f -// Centralized printing facility, more flexible than ISQL_printf +// I s q l G l o b a l s : : p r i n t f +// Output to the Out stream. void IsqlGlobals::printf(const char* buffer, ...) { va_list args; @@ -198,6 +198,15 @@ fflush(Out); // John's fix. } +// I s q l G l o b a l s : : p r i n t s +// Output to the Out stream a literal string. No escape characters recognized. +void IsqlGlobals::prints(const char* buffer) +{ + fprintf(Out, "%s", buffer); + fflush(Out); // John's fix. +} + + struct collist { collist* collist_next; @@ -237,6 +246,7 @@ static bool get_numeric(const UCHAR*, USHORT, SSHORT*, SINT64*); static void get_str(const TEXT* const, const TEXT**, const TEXT**, literal_string_type*); +static void print_set(const char* str, bool v); static processing_state print_sets(); static processing_state help(const TEXT*); static processing_state input(const TEXT*); @@ -452,7 +462,7 @@ else { fAnsiCP = false; if (ulConsoleCP != GetOEMCP() && Warnings) { - ISQL_printf(isqlGlob.Out, + isqlGlob.printf( "WARNING: The current codepage is not supported. Any use of any\n" " extended characters may result in incorrect file names.\n"); } @@ -624,7 +634,7 @@ * **************************************/ - ISQL_printf(isqlGlob.Out, "["); + isqlGlob.printf("["); // Transaction for all frontend commands if (DB && !gds_trans) @@ -642,7 +652,7 @@ // When upper == 1 no need to print a range either, but it's confusing. Not done. if (FDIM.RDB$DIMENSION > 0) { - ISQL_printf (isqlGlob.Out, ", "); + isqlGlob.printf(", "); } if (FDIM.RDB$LOWER_BOUND == 1) isqlGlob.printf("%ld", FDIM.RDB$UPPER_BOUND); @@ -655,7 +665,7 @@ return; END_ERROR; - ISQL_printf(isqlGlob.Out, "]"); + isqlGlob.printf("]"); } @@ -806,8 +816,7 @@ { readNextInputLine(userPrompt); //.c_str()); if (Echo && (lastInputLine != NULL)) { - ISQL_printf(isqlGlob.Out, lastInputLine); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf("%s%s", lastInputLine, NEWLINE); } } @@ -3947,7 +3956,7 @@ NEWLINE); } isqlGlob.SQL_dialect = old_SQL_dialect; // restore SQL dialect - ISQL_printf(isqlGlob.Out, bad_dialect_buf); + isqlGlob.prints(bad_dialect_buf); } } else @@ -3983,7 +3992,7 @@ " when connecting to Database SQL dialect ", global_dialect_spoken, " database. ", NEWLINE); - ISQL_printf(isqlGlob.Out, bad_dialect_buf); + isqlGlob.prints(bad_dialect_buf); } } } @@ -4421,14 +4430,14 @@ global_dialect_spoken = gds__vax_integer(p, length); if (isqlGlob.major_ods < ODS_VERSION10) { if (isqlGlob.SQL_dialect > SQL_DIALECT_V5 && Warnings) { - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); sprintf(bad_dialect_buf, "%s%s%s%d%s%s", "WARNING: Pre IB V6 database only speaks", " SQL dialect 1 and ", "does not accept Client SQL dialect ", isqlGlob.SQL_dialect, " . Client SQL dialect is reset to 1.", NEWLINE); - ISQL_printf(isqlGlob.Out, bad_dialect_buf); + isqlGlob.prints(bad_dialect_buf); } } else { // ODS 10 databases @@ -4448,13 +4457,13 @@ } if (print_warning && Warnings) { print_warning = false; - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); sprintf(bad_dialect_buf, "%s%d%s%d%s%s", "WARNING: This database speaks SQL dialect ", global_dialect_spoken, " but Client SQL dialect was set to ", isqlGlob.SQL_dialect, " .", NEWLINE); - ISQL_printf(isqlGlob.Out, bad_dialect_buf); + isqlGlob.prints(bad_dialect_buf); } } break; @@ -4466,7 +4475,7 @@ break; } if (isqlGlob.SQL_dialect && isqlGlob.SQL_dialect != SQL_DIALECT_V5 && Warnings) { - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); if (call_by_create_db) sprintf(bad_dialect_buf, "%s%s%d%s%s", "WARNING: Pre IB V6 server only speaks SQL dialect 1", @@ -4481,7 +4490,7 @@ isqlGlob.SQL_dialect, " . Client SQL dialect is reset to 1.", NEWLINE); } - ISQL_printf(isqlGlob.Out, bad_dialect_buf); + isqlGlob.prints(bad_dialect_buf); } else { if (isqlGlob.SQL_dialect == 0) { @@ -4491,7 +4500,7 @@ " and does not accept Client SQL dialect ", isqlGlob.SQL_dialect, " . Client SQL dialect is reset to 1.", NEWLINE); - ISQL_printf(isqlGlob.Out, bad_dialect_buf); + isqlGlob.prints(bad_dialect_buf); } } break; @@ -4499,18 +4508,14 @@ strcpy(server_version, "Server: "); strncat(server_version, (char*) &p[2], (length - 2)); if (Version_info) { - strcat(server_version, NEWLINE); - ISQL_printf (isqlGlob.Out, server_version); + isqlGlob.printf("%s%s", server_version, NEWLINE); } break; default: { - TEXT message[100]; - sprintf(message, - "Internal error: Unexpected isc_info_value %d\n", - item); - ISQL_printf(isqlGlob.Out, message); + isqlGlob.printf("Internal error: Unexpected isc_info_value %d%s", + item, NEWLINE); } break; } @@ -4714,6 +4719,14 @@ return true; } + +// Helper to print boolean values in the SET options. +static void print_set(const char* str, bool v) +{ + isqlGlob.printf("%-25s%s%s", str, v ? "ON" : "OFF", NEWLINE); +} + + static processing_state print_sets() { /************************************** @@ -4727,49 +4740,35 @@ * **************************************/ - ISQL_printf(isqlGlob.Out, "Print statistics: "); - ISQL_printf(isqlGlob.Out, (Stats ? "ON" : "OFF")); - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, "Echo commands: "); - ISQL_printf(isqlGlob.Out, (Echo ? "ON" : "OFF")); - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, "List format: "); - ISQL_printf(isqlGlob.Out, (List ? "ON" : "OFF")); - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, "Row Count: "); - ISQL_printf(isqlGlob.Out, (Docount ? "ON" : "OFF")); - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, "Autocommit DDL: "); - ISQL_printf(isqlGlob.Out, (Autocommit ? "ON" : "OFF")); - ISQL_printf(isqlGlob.Out, NEWLINE); + print_set("Print statistics:", Stats); + print_set("Echo commands:", Echo); + print_set("List format:", List); + print_set("Row Count:", Docount); + print_set("Autocommit DDL:", Autocommit); #ifdef SCROLLABLE_CURSORS - ISQL_printf(isqlGlob.Out, "Autofetch records: "); - ISQL_printf(isqlGlob.Out, (Autofetch ? "ON" : "OFF")); - ISQL_printf(isqlGlob.Out, NEWLINE); + print_set("Autofetch records:", Autofetch); #endif - ISQL_printf(isqlGlob.Out, "Access Plan: "); - ISQL_printf(isqlGlob.Out, (Plan ? "ON" : "OFF")); - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, "Access Plan only: "); - ISQL_printf(isqlGlob.Out, (Planonly ? "ON" : "OFF")); - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, "Display BLOB type: "); + print_set("Access Plan:", Plan); + print_set("Access Plan only:", Planonly); + + isqlGlob.printf("%-25s", "Display BLOB type:"); if (Doblob == ALL_BLOBS) - ISQL_printf(isqlGlob.Out, "ALL"); + isqlGlob.printf("ALL"); else if (Doblob == NO_BLOBS) - ISQL_printf(isqlGlob.Out, "NONE"); + isqlGlob.printf("NONE"); else { isqlGlob.printf("%d", Doblob); } - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); + if (*ISQL_charset && strcmp(ISQL_charset, DEFCHARSET)) { - isqlGlob.printf("Set names: %s%s", - ISQL_charset, NEWLINE); + isqlGlob.printf("%-25s%s%s", "Set names:", ISQL_charset, NEWLINE); } - ISQL_printf(isqlGlob.Out, "Column headings: "); - ISQL_printf(isqlGlob.Out, Heading ? "ON" : "OFF"); - ISQL_printf(isqlGlob.Out, NEWLINE); - if (global_Cols) { + + print_set("Column headings:", Heading); + + if (global_Cols) + { isqlGlob.printf("Column print widths:%s", NEWLINE); const collist* p = global_Cols; while (p) { @@ -4778,15 +4777,11 @@ p = p->collist_next; } } - ISQL_printf(isqlGlob.Out, "Terminator: "); - ISQL_printf(isqlGlob.Out, isqlGlob.global_Term); - ISQL_printf(isqlGlob.Out, NEWLINE); - isqlGlob.printf("Time: %s%s", - (Time_display) ? "ON" : "OFF", NEWLINE); - isqlGlob.printf("Warnings: %s%s", - (Warnings) ? "ON" : "OFF", NEWLINE); - isqlGlob.printf("Bail on error: %s%s", - (BailOnError) ? "ON" : "OFF", NEWLINE); + isqlGlob.printf("%-25s%s%s", "Terminator:", isqlGlob.global_Term, NEWLINE); + + print_set("Time:", Time_display); + print_set("Warnings:", Warnings); + print_set("Bail on error:", BailOnError); return SKIP; } @@ -5715,7 +5710,7 @@ } } if (List) - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); else strcat(p, " "); } @@ -5743,10 +5738,9 @@ blobid->gds_quad_low); sprintf(p, "%17s ", blobbuf); if (List) { - ISQL_printf(isqlGlob.Out, blobbuf); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf("%s%s", blobbuf, NEWLINE); dtype = print_item_blob(isqlGlob.Out, var, M__trans); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } break; @@ -5906,16 +5900,14 @@ } buff2[(2 * var->sqllen + 1) - 1] = 0; if (List) { - ISQL_printf(isqlGlob.Out, buff2); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf("%s%s", buff2, NEWLINE); } else sprintf(p, "%s ", buff2); ISQL_FREE(buff2); } else if (List) { - ISQL_printf(isqlGlob.Out, string); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf("%s%s", string, NEWLINE); } else { // Truncate if necessary @@ -6002,8 +5994,7 @@ if (List) { - ISQL_printf(isqlGlob.Out, buff2); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf("%s%s", buff2, NEWLINE); } else { @@ -6014,8 +6005,7 @@ ISQL_FREE(buff2); } else if (List) { - ISQL_printf(isqlGlob.Out, avary->vary_string); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf("%s%s", avary->vary_string, NEWLINE); } else { // Truncate if necessary @@ -6236,7 +6226,8 @@ * line = pointer to the line buffer. * **************************************/ - XSQLVAR* varlist[20]; // No more than 20 blobs per line + const int maxblob = 20; + XSQLVAR* varlist[maxblob]; // No more than 20 blobs per line int varnum = 0; { // scope @@ -6250,7 +6241,7 @@ // Save all the blob vars and print them at the end // CVC: If varnum reaches 20, we must print an error instead of crashing. const int rc = print_item(&p, var, pad[i]); - if (rc == SQL_BLOB && varnum < 20) + if (rc == SQL_BLOB && varnum < maxblob) varlist[varnum++] = var; } } @@ -6258,19 +6249,22 @@ } // scope if (List) { - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); return (CONT); } - ISQL_printf(isqlGlob.Out, line); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf("%s%s", line, NEWLINE); // If blobdisplay is not wanted, set varnum back to -1 if (Doblob == NO_BLOBS) varnum = 0; - else if (varnum >= 20) - ISQL_printf2(isqlGlob.Out, "Printing only the first 20 blobs.%s", NEWLINE); + else if (varnum >= maxblob) + { + TEXT msg[MSG_LENGTH]; + ISQL_msg_get(ONLY_FIRST_BLOBS, msg, (TEXT*)(IPTR) maxblob); + isqlGlob.printf("%s%s", msg, NEWLINE); + } // If there were Blobs to print, print them passing the blobid @@ -6363,36 +6357,31 @@ if (is_selectable) { - TEXT buffer[100]; - sprintf(buffer, + isqlGlob.printf( //"\nINPUT SQLDA version: %d sqldaid: %s sqldabc: %ld sqln: %d sqld: %d\n", "\nINPUT SQLDA version: %d sqln: %d sqld: %d\n", //input_sqlda->version, input_sqlda->sqldaid, //input_sqlda->sqldabc, input_sqlda->sqln, input_sqlda->version, input_sqlda->sqln, input_sqlda->sqld); - ISQL_printf(isqlGlob.Out, buffer); int i = 0; const XSQLVAR* var = input_sqlda->sqlvar; for (const XSQLVAR* const end = var + input_sqlda->sqld; var < end; var++, i++) { - sprintf(buffer, + isqlGlob.printf( "%02d: sqltype: %d %s %s sqlscale: %d sqlsubtype: %d sqllen: %d\n", i + 1, var->sqltype, sqltype_to_string(var->sqltype), (var->sqltype & 1) ? "Nullable" : " ", var->sqlscale, var->sqlsubtype, var->sqllen); - ISQL_printf(isqlGlob.Out, buffer); - sprintf(buffer, " : name: (%d)%*s alias: (%d)%*s\n", + isqlGlob.printf(" : name: (%d)%*s alias: (%d)%*s\n", var->sqlname_length, var->sqlname_length, var->sqlname, var->aliasname_length, var->aliasname_length, var->aliasname); - ISQL_printf(isqlGlob.Out, buffer); - sprintf(buffer, " : table: (%d)%*s owner: (%d)%*s\n", + isqlGlob.printf(" : table: (%d)%*s owner: (%d)%*s\n", var->relname_length, var->relname_length, var->relname, var->ownname_length, var->ownname_length, var->ownname); - ISQL_printf(isqlGlob.Out, buffer); } } @@ -6408,34 +6397,29 @@ // both tables and procedures and execution of procedures that return output. static void print_sqlda_output(const XSQLDA& sqlda) { - TEXT buffer[100]; - sprintf(buffer, + isqlGlob.printf( //"\nOUTPUT SQLDA version: %d sqldaid: %s sqldabc: %ld sqln: %d sqld: %d\n", "\nOUTPUT SQLDA version: %d sqln: %d sqld: %d\n", //sqlda.version, sqlda.sqldaid, sqlda.sqldabc, sqlda.sqln, sqlda.version, sqlda.sqln, sqlda.sqld); - ISQL_printf(isqlGlob.Out, buffer); int i = 0; const XSQLVAR* var = sqlda.sqlvar; for (const XSQLVAR* const end = var + sqlda.sqld; var < end; var++, i++) { - sprintf(buffer, + isqlGlob.printf( "%02d: sqltype: %d %s %s sqlscale: %d sqlsubtype: %d sqllen: %d\n", i + 1, var->sqltype, sqltype_to_string(var->sqltype), (var->sqltype & 1) ? "Nullable" : " ", var->sqlscale, var->sqlsubtype, var->sqllen); - ISQL_printf(isqlGlob.Out, buffer); - sprintf(buffer, " : name: (%d)%*s alias: (%d)%*s\n", + isqlGlob.printf(" : name: (%d)%*s alias: (%d)%*s\n", var->sqlname_length, var->sqlname_length, var->sqlname, var->aliasname_length, var->aliasname_length, var->aliasname); - ISQL_printf(isqlGlob.Out, buffer); - sprintf(buffer, " : table: (%d)%*s owner: (%d)%*s\n", + isqlGlob.printf(" : table: (%d)%*s owner: (%d)%*s\n", var->relname_length, var->relname_length, var->relname, var->ownname_length, var->ownname_length, var->ownname); - ISQL_printf(isqlGlob.Out, buffer); } } @@ -6484,9 +6468,9 @@ const SCHAR plan_info[] = { isc_info_sql_get_plan }; TEXT plan_buffer[PRINT_BUFFER_LENGTH]; - memset(plan_buffer, 0, PRINT_BUFFER_LENGTH); + memset(plan_buffer, 0, sizeof(plan_buffer)); if (isc_dsql_sql_info(isc_status, &global_Stmt, sizeof(plan_info), plan_info, - PRINT_BUFFER_LENGTH, plan_buffer)) + sizeof(plan_buffer), plan_buffer)) { ISQL_errmsg(isc_status); } @@ -6812,12 +6796,13 @@ isqlGlob.SQL_dialect, sqlda)) { if (isqlGlob.SQL_dialect == SQL_DIALECT_V6_TRANSITION && Input_file) { - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, "**** Error preparing statement:"); - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, string); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf("%s%s%s%s%s%s", + NEWLINE, + "**** Error preparing statement:", + NEWLINE, + NEWLINE, + string, + NEWLINE); } ISQL_errmsg(isc_status); return ps_ERR; @@ -7053,15 +7038,16 @@ } else { if (sqlda->sqld) { // do not output unnecessary white text - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); if (!List && Heading) { - ISQL_printf(isqlGlob.Out, header); - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, header2); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf("%s%s%s%s", + header, + NEWLINE, + header2, + NEWLINE); } print_line(sqlda, pad, line); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } } } @@ -7114,11 +7100,12 @@ headings only once. */ if (!List && Heading && (lines % Pagelength == 0)) { - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, header); - ISQL_printf(isqlGlob.Out, NEWLINE); - ISQL_printf(isqlGlob.Out, header2); - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf("%s%s%s%s", + NEWLINE, + header, + NEWLINE, + header2, + NEWLINE); } if (isc_status[1]) { @@ -7141,13 +7128,13 @@ } if (!lines) - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); ret = print_line(sqlda, pad, line); } if (lines) - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); // Record count printed here upon request Index: isql.h =================================================================== RCS file: /cvsroot/firebird/firebird2/src/isql/isql.h,v retrieving revision 1.47 retrieving revision 1.48 diff -b -U3 -r1.47 -r1.48 --- isql.h 24 May 2005 04:42:01 -0000 1.47 +++ isql.h 26 May 2005 06:45:16 -0000 1.48 @@ -226,6 +226,9 @@ const int TIME_PROMPT = 112; // Enter %s as H:M:S> const int TIMESTAMP_PROMPT = 113; // Enter %s as Y/MON/D H:MIN:S[.MSEC]> const int TIMESTAMP_ERR = 114; // Bad TIMESTAMP: %s\n +const int ONLY_FIRST_BLOBS = 116; // Printing only the first %d blobs. +const int MSG_TABLES = 117; // Tables: +const int MSG_FUNCTIONS = 118; // Functions: // Initialize types @@ -333,6 +336,7 @@ // from isql.epp USHORT major_ods; void printf(const char* buffer, ...); + void prints(const char* buffer); }; extern IsqlGlobals isqlGlob; Index: show.epp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/isql/show.epp,v retrieving revision 1.73 retrieving revision 1.74 diff -b -U3 -r1.73 -r1.74 --- show.epp 24 May 2005 04:42:01 -0000 1.73 +++ show.epp 26 May 2005 06:45:16 -0000 1.74 @@ -51,6 +51,7 @@ #include "../jrd/ods.h" #include "../isql/extra_proto.h" #include "../common/utils_proto.h" +#include "../jrd/obj.h" #ifdef HAVE_CTYPE_H #include <ctype.h> @@ -564,7 +565,7 @@ make_priv_string (priv_flags, priv_string); if (first && optional_msg) - ISQL_printf (isqlGlob.Out, optional_msg); + isqlGlob.prints(optional_msg); first = false; @@ -692,7 +693,7 @@ if (prev_option != -1) { make_priv_string (priv_flags, priv_string); if (first && optional_msg) - ISQL_printf (isqlGlob.Out, optional_msg); + isqlGlob.prints(optional_msg); first = false; if (isqlGlob.db_SQL_dialect > SQL_DIALECT_V6_TRANSITION) @@ -732,7 +733,7 @@ SORTED BY PRV.RDB$USER, PRV.RDB$FIELD_NAME, PRV.RDB$GRANT_OPTION; if (first && optional_msg) - ISQL_printf (isqlGlob.Out, optional_msg); + isqlGlob.prints(optional_msg); first = false; fb_utils::exact_name(PRV.RDB$USER); @@ -847,10 +848,10 @@ user_string, with_option, terminator, NEWLINE); if (first && optional_msg) - ISQL_printf (isqlGlob.Out, optional_msg); + isqlGlob.prints(optional_msg); first = false; - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.prints(Print_buffer); END_FOR ON_ERROR @@ -917,7 +918,7 @@ if (first) { if (*first && optional_msg) { - ISQL_printf (isqlGlob.Out, optional_msg); + isqlGlob.prints(optional_msg); } *first = false; } @@ -1032,23 +1033,30 @@ if (!cmd[1]) return ps_ERR; -// Only show version works if there is no db attached - if ((!strcmp(cmd[1], "VERSION")) || (!strcmp(cmd[1], "VER"))) { + // Only show version and show sql dialect work if there is no db attached + bool handled = true; + if ((!strcmp(cmd[1], "VERSION")) || (!strcmp(cmd[1], "VER"))) + { TEXT msg_string[MSG_LENGTH]; ISQL_msg_get(VERSION, msg_string, FB_VERSION); isqlGlob.printf("%s%s", msg_string, NEWLINE); isc_version(&DB, local_fprintf, NULL); } - else if (!strcmp(cmd[1], "SQL")) { + else if (!strcmp(cmd[1], "SQL")) + { if (!strcmp(cmd[2], "DIALECT")) ret = show_dialect(); else ret = ps_ERR; } - else if (!ISQL_dbcheck()) + else + { + handled = false; + if (!ISQL_dbcheck()) ret = ps_ERR; + } - if (ret == ps_ERR) + if (ret == ps_ERR || handled) return ret; TEXT SQL_id_for_grant[BUFFER_LENGTH128]; @@ -1136,12 +1144,15 @@ break; case ShowOptions::system: - ISQL_printf(isqlGlob.Out, "Relations:"); - ISQL_printf(isqlGlob.Out, NEWLINE); + { + TEXT msg[MSG_LENGTH]; + ISQL_msg_get(MSG_TABLES, msg, NULL); + isqlGlob.printf("%s%s", msg, NEWLINE); show_all_tables(1); - ISQL_printf(isqlGlob.Out, "Functions:"); - ISQL_printf(isqlGlob.Out, NEWLINE); + ISQL_msg_get(MSG_FUNCTIONS, msg, NULL); + isqlGlob.printf("%s%s", msg, NEWLINE); show_functions("", 1); + } break; case ShowOptions::index: @@ -1413,9 +1424,7 @@ * **************************************/ - fprintf(isqlGlob.Out, "%s", string); - fprintf(isqlGlob.Out, "%s", NEWLINE); - + isqlGlob.printf("%s%s", string, NEWLINE); } @@ -1516,7 +1525,7 @@ } if (!first) { - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); return SKIP; } else @@ -1602,10 +1611,10 @@ } if (char_sets[0]) { if (doIndent) - ISQL_printf(isqlGlob.Out, spaces); - ISQL_printf(isqlGlob.Out, char_sets); + isqlGlob.printf(spaces); + isqlGlob.prints(char_sets); if (doReturn) - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } } @@ -1644,7 +1653,7 @@ if (!TRG.RDB$TRIGGER_SOURCE.NULL) SHOW_print_metadata_text_blob (isqlGlob.Out, &TRG.RDB$TRIGGER_SOURCE); - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); END_FOR ON_ERROR @@ -1669,7 +1678,7 @@ const bool escape_quotes = showextract == cmmExtract; if (escape_quotes && banner) - ISQL_printf(isqlGlob.Out, banner); + isqlGlob.prints(banner); if (name1) fb_utils::exact_name(name1); @@ -1694,14 +1703,14 @@ const char* quot = escape_quotes ? "'" : ""; if (!name1) - ISQL_printf2(isqlGlob.Out, "COMMENT ON %-12s IS %s", objtype, quot); + isqlGlob.printf("COMMENT ON %-12s IS %s", objtype, quot); else if (!name2) - ISQL_printf2(isqlGlob.Out, "COMMENT ON %-12s %s IS %s", objtype, name1, quot); + isqlGlob.printf("COMMENT ON %-12s %s IS %s", objtype, name1, quot); else - ISQL_printf2(isqlGlob.Out, "COMMENT ON %-12s %s.%s IS %s", objtype, name1, name2, quot); + isqlGlob.printf("COMMENT ON %-12s %s.%s IS %s", objtype, name1, name2, quot); SHOW_print_metadata_text_blob(isqlGlob.Out, blobfld, escape_quotes); - ISQL_printf2(isqlGlob.Out, "%s%s%s", quot, isqlGlob.global_Term, NEWLINE); + isqlGlob.printf("%s%s%s", quot, isqlGlob.global_Term, NEWLINE); } @@ -2068,7 +2077,7 @@ if (FIL.RDB$FILE_START) { isqlGlob.printf("starting %ld", FIL.RDB$FILE_START); } - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } END_FOR @@ -2079,12 +2088,12 @@ SCHAR info_buf[BUFFER_LENGTH400]; -// First general database parameters + // First general database parameters bool translate = true; if (SHOW_dbb_parameters(DB, info_buf, db_items, sizeof(db_items), translate)) { - ISQL_printf(isqlGlob.Out, info_buf); + isqlGlob.prints(info_buf); } FOR DBB IN RDB$DATABASE @@ -2128,7 +2137,7 @@ "Client SQL dialect is set to: ", isqlGlob.SQL_dialect, ". No database has been connected."); } - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); return SKIP; } @@ -2163,7 +2172,7 @@ return ps_ERR; END_ERROR; if (!first) - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } else { // List named domain @@ -2247,7 +2256,7 @@ } } - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.prints(Print_buffer); break; } @@ -2262,7 +2271,7 @@ isqlGlob.printf(" segment %u, subtype ", (USHORT) FLD.RDB$SEGMENT_LENGTH); const int subtype = FLD.RDB$FIELD_SUB_TYPE; if (subtype >= 0 && subtype <= MAX_BLOBSUBTYPES) { - isqlGlob.printf("%s", Sub_types[subtype]); + isqlGlob.prints(Sub_types[subtype]); } else { isqlGlob.printf("%d", subtype); @@ -2283,7 +2292,7 @@ else { isqlGlob.printf(" Not Null"); } - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); ISC_QUAD default_source; ISQL_get_default_source (NULL, FLD.RDB$FIELD_NAME, @@ -2291,13 +2300,13 @@ if (default_source.gds_quad_high) { isqlGlob.printf(" "); SHOW_print_metadata_text_blob (isqlGlob.Out, &default_source); - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } if (!FLD.RDB$VALIDATION_SOURCE.NULL) { isqlGlob.printf(" "); SHOW_print_metadata_text_blob (isqlGlob.Out, &FLD.RDB$VALIDATION_SOURCE); - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } // Show collations @@ -2346,9 +2355,13 @@ fb_utils::exact_name(EXC.RDB$EXCEPTION_NAME); // List all objects if none specified, or just the named exception - if (!*object || !strcmp (EXC.RDB$EXCEPTION_NAME, object)) { + if (!*object || !strcmp (EXC.RDB$EXCEPTION_NAME, object)) + { if (first) { - isqlGlob.printf("Exception Name Used by, Type%s=============================== =============================================%s", NEWLINE, NEWLINE); + isqlGlob.printf("Exception Name Used by, Type%s%s%s", + NEWLINE, + "=============================== =============================================", + NEWLINE); } first = false; @@ -2357,23 +2370,29 @@ // Look up dependent objects --procedures and triggers bool first_dep = true; FOR DEP IN RDB$DEPENDENCIES WITH - DEP.RDB$DEPENDED_ON_TYPE = 7 AND + DEP.RDB$DEPENDED_ON_TYPE = obj_exception AND DEP.RDB$DEPENDED_ON_NAME EQ EXC.RDB$EXCEPTION_NAME SORTED BY DEP.RDB$DEPENDENT_TYPE, DEP.RDB$DEPENDENT_NAME if (!first_dep) { - isqlGlob.printf(" "); + isqlGlob.printf("%31s ", ""); } first_dep = false; fb_utils::exact_name(DEP.RDB$DEPENDENT_NAME); - strcpy (type, "Unknown"); - if (DEP.RDB$DEPENDENT_TYPE == 2) + switch (DEP.RDB$DEPENDENT_TYPE) + { + case obj_trigger: strcpy (type, "Trigger"); - if (DEP.RDB$DEPENDENT_TYPE == 5) + break; + case obj_procedure: strcpy (type, "Stored procedure"); - + break; + default: + strcpy (type, "Unknown"); + break; + } isqlGlob.printf("%s, %s%s", DEP.RDB$DEPENDENT_NAME, type, @@ -2384,12 +2403,14 @@ return ps_ERR; END_ERROR; - isqlGlob.printf("%s %s%s", (first_dep ? NEWLINE : ""), - EXC.RDB$MESSAGE, - NEWLINE); + if (first_dep) + printf(NEWLINE); + + if (!EXC.RDB$MESSAGE.NULL && strlen(EXC.RDB$MESSAGE)) + isqlGlob.printf("Msg: %s%s", EXC.RDB$MESSAGE, NEWLINE); } if (!first) - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); END_FOR ON_ERROR ISQL_errmsg(isc_status); @@ -2431,7 +2452,7 @@ return ps_ERR; END_ERROR; if (!first) { - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); return (SKIP); } else @@ -2519,7 +2540,7 @@ } if (!first) { - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); return (SKIP); } else @@ -2622,7 +2643,7 @@ sprintf (Print_buffer, "%s", Column_types[i].type_name); } } - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.prints(Print_buffer); break; } @@ -2648,7 +2669,7 @@ END_ERROR; } - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); END_FOR ON_ERROR @@ -2843,7 +2864,7 @@ isqlGlob.printf(" COMPUTED BY "); if (!IDX1.RDB$EXPRESSION_SOURCE.NULL) SHOW_print_metadata_text_blob (isqlGlob.Out, &IDX1.RDB$EXPRESSION_SOURCE); - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } #endif @@ -2875,7 +2896,7 @@ isqlGlob.printf(" COMPUTED BY "); if (!IDX2.RDB$EXPRESSION_SOURCE.NULL) SHOW_print_metadata_text_blob (isqlGlob.Out, &IDX2.RDB$EXPRESSION_SOURCE); - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } #endif @@ -2950,7 +2971,7 @@ ISQL_errmsg (isc_status); return ps_ERR; END_ERROR; - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); END_FOR ON_ERROR @@ -3071,7 +3092,7 @@ { show_charsets(NULL, FLD.RDB$FIELD_NAME, true, true, false, false); } - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); END_FOR ON_ERROR @@ -3118,7 +3139,7 @@ if (!first) { - ISQL_printf(isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); return SKIP; } else @@ -3281,7 +3302,7 @@ isqlGlob.printf("Computed by: "); if (!FLD.RDB$COMPUTED_SOURCE.NULL) SHOW_print_metadata_text_blob (isqlGlob.Out, &FLD.RDB$COMPUTED_SOURCE); - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); continue; } @@ -3332,14 +3353,15 @@ sprintf (Print_buffer, "NUMERIC(9, %d)", -FLD.RDB$FIELD_SCALE); } else if ((FLD.RDB$FIELD_TYPE == DOUBLE_PRECISION) && - (FLD.RDB$FIELD_SCALE < 0)) { + (FLD.RDB$FIELD_SCALE < 0)) + { sprintf (Print_buffer, "NUMERIC(15, %d)", -FLD.RDB$FIELD_SCALE); } else { sprintf (Print_buffer, "%s", Column_types[i].type_name); } } - ISQL_printf (isqlGlob.Out, Print_buffer); + isqlGlob.prints(Print_buffer); break; } @@ -3355,7 +3377,7 @@ const int subtype = FLD.RDB$FIELD_SUB_TYPE; if (subtype >= 0 && subtype <= MAX_BLOBSUBTYPES) { - isqlGlob.printf("%s", Sub_types[subtype]); + isqlGlob.prints(Sub_types[subtype]); } else { @@ -3392,13 +3414,13 @@ SHOW_print_metadata_text_blob (isqlGlob.Out, &RFR.RDB$DEFAULT_SOURCE); else if (!FLD.RDB$DEFAULT_SOURCE.NULL) SHOW_print_metadata_text_blob (isqlGlob.Out, &FLD.RDB$DEFAULT_SOURCE); - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); // Validation clause for domains if (!FLD.RDB$VALIDATION_SOURCE.NULL) { isqlGlob.printf(" "); SHOW_print_metadata_text_blob (isqlGlob.Out, &FLD.RDB$VALIDATION_SOURCE); - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); } // Handle collations @@ -3422,7 +3444,7 @@ isqlGlob.printf("View Source:%s==== ======%s", NEWLINE, NEWLINE); if (!REL.RDB$VIEW_SOURCE.NULL) SHOW_print_metadata_text_blob (isqlGlob.Out, &REL.RDB$VIEW_SOURCE); - ISQL_printf (isqlGlob.Out, NEWLINE); + isqlGlob.printf(NEWLINE); END_FOR ON_ERROR ISQL_errmsg(isc_status); @@ -3482,7 +3504,7 @@ false); } - isqlGlob.printf("%s", NEWLINE); + isqlGlob.printf(NEWLINE); END_FOR ON_ERROR |