From: Frank Schlottmann-G. <fs...@us...> - 2000-11-18 16:49:27
|
Update of /cvsroot/firebird/interbase/isql In directory slayer.i.sourceforge.net:/tmp/cvs-serv15190/interbase/isql Modified Files: extract.e isql.e isql.h Log Message: Increased PRINT_BUFFER_LENGTH to 2048 to show larger plans Fixed Bug #122563 in extract.e get_procedure_args Apparently this has to be done in show.e also, but that is for another day :-) Index: extract.e =================================================================== RCS file: /cvsroot/firebird/interbase/isql/extract.e,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** extract.e 2000/08/03 20:49:19 1.1.1.1 --- extract.e 2000/11/18 16:49:24 1.2 *************** *** 20,23 **** --- 20,30 ---- * All Rights Reserved. * Contributor(s): ______________________________________. + * $Log$ + * Revision 1.2 2000/11/18 16:49:24 fsg + * Increased PRINT_BUFFER_LENGTH to 2048 to show larger plans + * Fixed Bug #122563 in extract.e get_procedure_args + * Apparently this has to be done in show.e also, + * but that is for another day :-) + * */ *************** *** 79,83 **** static SCHAR *Procterm = "^"; /* TXNN: script use only */ ! static TEXT Print_buffer[512]; static TEXT SQL_identifier[BUFFER_LENGTH128]; static TEXT SQL_identifier2[BUFFER_LENGTH128]; --- 86,96 ---- static SCHAR *Procterm = "^"; /* TXNN: script use only */ ! ! /* Maybe 512 would be really enough as Print_buffer size, but ! as we have PRINT_BUFFER_LENGTH in isql.h, we should use it ! FSG 17.Nov.2000 ! */ ! ! static TEXT Print_buffer[PRINT_BUFFER_LENGTH]; static TEXT SQL_identifier[BUFFER_LENGTH128]; static TEXT SQL_identifier2[BUFFER_LENGTH128]; *************** *** 126,130 **** sprintf (Print_buffer, ! "/*= Command Line -sqldialect %d is over writted by ==*/%s", SQL_dialect, NEWLINE); ISQL_printf (Out, Print_buffer); --- 139,143 ---- sprintf (Print_buffer, ! "/*= Command Line -sqldialect %d is overwritten by ==*/%s", SQL_dialect, NEWLINE); ISQL_printf (Out, Print_buffer); *************** *** 412,415 **** --- 425,429 ---- } + if ((FLD.RDB$FIELD_TYPE == FCHAR) || (FLD.RDB$FIELD_TYPE == VARCHAR)) if (FLD.RDB$CHARACTER_LENGTH.NULL) *************** *** 727,743 **** * **************************************/ ! SSHORT first_time, i, header = TRUE; TEXT msg [MSG_LENGTH]; SCHAR char_sets [86]; /* query to retrieve the parameters. */ { first_time = TRUE; ! /* Parameter types 0 = input first */ FOR PRM IN RDB$PROCEDURE_PARAMETERS CROSS FLD IN RDB$FIELDS WITH PRM.RDB$PROCEDURE_NAME = proc_name AND PRM.RDB$FIELD_SOURCE EQ FLD.RDB$FIELD_NAME AND ! PRM.RDB$PARAMETER_TYPE = 0 SORTED BY PRM.RDB$PARAMETER_NUMBER --- 741,769 ---- * **************************************/ ! SSHORT ptype,first_time, i, header = TRUE; TEXT msg [MSG_LENGTH]; SCHAR char_sets [86]; /* query to retrieve the parameters. */ + { + + + /* placed the two identical code blocks into one + for loop as suggested by Ann H. and Claudio C. + FSG 18.Nov.2000 + */ + + /* Parameter types 0 = input */ + /* Parameter types 1 = return */ + + for (ptype = 0; ptype < 2; ptype++) { first_time = TRUE; ! FOR PRM IN RDB$PROCEDURE_PARAMETERS CROSS FLD IN RDB$FIELDS WITH PRM.RDB$PROCEDURE_NAME = proc_name AND PRM.RDB$FIELD_SOURCE EQ FLD.RDB$FIELD_NAME AND ! PRM.RDB$PARAMETER_TYPE = ptype SORTED BY PRM.RDB$PARAMETER_NUMBER *************** *** 745,750 **** { first_time = FALSE; ! ISQL_printf (Out, "("); ! } else { --- 771,783 ---- { first_time = FALSE; ! if (ptype==0) ! { // this is the input part ! ISQL_printf (Out, "("); ! } ! else ! { // we are in the output part ! ISQL_printf (Out, "RETURNS ("); ! } ! } else { *************** *** 825,836 **** break; } - if (((FLD.RDB$FIELD_TYPE == FCHAR) || - (FLD.RDB$FIELD_TYPE == VARCHAR)) && - !FLD.RDB$CHARACTER_LENGTH.NULL) - { - sprintf (Print_buffer, "(%d)", FLD.RDB$FIELD_LENGTH); - ISQL_printf (Out, Print_buffer); - } /* Show international character sets and collations */ if (!FLD.RDB$COLLATION_ID.NULL || !FLD.RDB$CHARACTER_SET_ID.NULL) --- 858,880 ---- break; } + /* Changed this to return RDB$CHARACTER_LENGTH if available + Fix for Bug #122563 + FSG 18.Nov.2000 + */ + if ((FLD.RDB$FIELD_TYPE == FCHAR) || (FLD.RDB$FIELD_TYPE == VARCHAR)) + if (FLD.RDB$CHARACTER_LENGTH.NULL) + { + sprintf (Print_buffer, "(%d)", FLD.RDB$FIELD_LENGTH); + ISQL_printf (Out, Print_buffer); + } + else + { + sprintf (Print_buffer, "(%d)", FLD.RDB$CHARACTER_LENGTH); + ISQL_printf (Out, Print_buffer); + } + + + /* Show international character sets and collations */ if (!FLD.RDB$COLLATION_ID.NULL || !FLD.RDB$CHARACTER_SET_ID.NULL) *************** *** 864,1001 **** ISQL_printf (Out, Print_buffer); } - first_time = TRUE; ! /* Parameter types 1 = return last */ ! FOR PRM IN RDB$PROCEDURE_PARAMETERS CROSS ! FLD IN RDB$FIELDS WITH ! PRM.RDB$PROCEDURE_NAME = proc_name AND ! PRM.RDB$FIELD_SOURCE EQ FLD.RDB$FIELD_NAME AND ! PRM.RDB$PARAMETER_TYPE = 1 ! SORTED BY PRM.RDB$PARAMETER_NUMBER ! ! if (first_time) ! { ! first_time = FALSE; ! ISQL_printf (Out, "RETURNS ("); ! } ! else ! { ! sprintf (Print_buffer, ",%s", NEWLINE); ! ISQL_printf (Out, Print_buffer); ! } ! ! ISQL_blankterm (PRM.RDB$PARAMETER_NAME); ! sprintf (Print_buffer, "%s ", PRM.RDB$PARAMETER_NAME); ! ISQL_printf (Out, Print_buffer); ! ! /* Get column type name to print */ ! for (i = 0; Column_types [i].type; i++) ! if (FLD.RDB$FIELD_TYPE == Column_types [i].type) ! { ! BOOLEAN precision_known = FALSE; ! ! if (major_ods >= ODS_VERSION10) ! { ! /* Handle Integral subtypes NUMERIC and DECIMAL */ ! if ((FLD.RDB$FIELD_TYPE == SMALLINT) || ! (FLD.RDB$FIELD_TYPE == INTEGER) || ! (FLD.RDB$FIELD_TYPE == blr_int64)) ! { ! /* We are ODS >= 10 and could be any Dialect */ ! FOR FLD1 IN RDB$FIELDS WITH ! FLD1.RDB$FIELD_NAME EQ FLD.RDB$FIELD_NAME ! ! if (!FLD1.RDB$FIELD_PRECISION.NULL) ! { ! /* We are Dialect >=3 since FIELD_PRECISION is non-NULL */ ! if (FLD1.RDB$FIELD_SUB_TYPE > 0 && ! FLD1.RDB$FIELD_SUB_TYPE <= MAX_INTSUBTYPES) ! { ! sprintf (Print_buffer, "%s(%d, %d)", ! Integral_subtypes [FLD1.RDB$FIELD_SUB_TYPE], ! FLD1.RDB$FIELD_PRECISION, ! -FLD1.RDB$FIELD_SCALE); ! precision_known = TRUE; ! } ! } ! END_FOR ! ON_ERROR ! ISQL_errmsg (isc_status); ! return; ! END_ERROR; ! } /* if field_type */ ! } /* if major_ods */ ! ! if (precision_known == FALSE) ! { ! /* Take a stab at numerics and decimals */ ! if ((FLD.RDB$FIELD_TYPE == SMALLINT) && ! (FLD.RDB$FIELD_SCALE < 0)) ! { ! sprintf (Print_buffer, "NUMERIC(4, %d)", ! -FLD.RDB$FIELD_SCALE); ! } ! else if ((FLD.RDB$FIELD_TYPE == INTEGER) && ! (FLD.RDB$FIELD_SCALE < 0)) ! { ! sprintf (Print_buffer, "NUMERIC(9, %d)", ! -FLD.RDB$FIELD_SCALE); ! } ! else if ((FLD.RDB$FIELD_TYPE == DOUBLE_PRECISION) && ! (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 (Out, Print_buffer); ! break; ! } ! ! if (((FLD.RDB$FIELD_TYPE == FCHAR) || ! (FLD.RDB$FIELD_TYPE == VARCHAR)) && !FLD.RDB$CHARACTER_LENGTH.NULL) ! { ! sprintf (Print_buffer, "(%d)", FLD.RDB$FIELD_LENGTH); ! ISQL_printf (Out, Print_buffer); ! } ! ! /* Show international character sets and collations */ ! if (!FLD.RDB$COLLATION_ID.NULL || !FLD.RDB$CHARACTER_SET_ID.NULL) ! { ! char_sets [0] = 0; ! if (FLD.RDB$COLLATION_ID.NULL) ! FLD.RDB$COLLATION_ID = 0; ! ! if (FLD.RDB$CHARACTER_SET_ID.NULL) ! FLD.RDB$CHARACTER_SET_ID = 0; ! ! ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, ! FLD.RDB$COLLATION_ID, FALSE, char_sets); ! if (char_sets [0]) ! ISQL_printf (Out, char_sets); ! } ! END_FOR ! ON_ERROR ! if (!V33) ! { ! ISQL_errmsg (gds__status); ! return; ! } ! END_ERROR; ! if (!first_time) ! { ! sprintf (Print_buffer, ")%s", NEWLINE); ! ISQL_printf (Out, Print_buffer); ! } sprintf (Print_buffer, "AS %s", NEWLINE); ISQL_printf (Out, Print_buffer); ! ! ! } } --- 908,916 ---- ISQL_printf (Out, Print_buffer); } ! }/* end for ptype */ sprintf (Print_buffer, "AS %s", NEWLINE); ISQL_printf (Out, Print_buffer); ! } } Index: isql.e =================================================================== RCS file: /cvsroot/firebird/interbase/isql/isql.e,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** isql.e 2000/09/04 14:43:52 1.4 --- isql.e 2000/11/18 16:49:24 1.5 *************** *** 22,26 **** */ /* ! $Id$ */ --- 22,32 ---- */ /* ! $Log$ ! Revision 1.5 2000/11/18 16:49:24 fsg ! Increased PRINT_BUFFER_LENGTH to 2048 to show larger plans ! Fixed Bug #122563 in extract.e get_procedure_args ! Apparently this has to be done in show.e also, ! but that is for another day :-) ! */ Index: isql.h =================================================================== RCS file: /cvsroot/firebird/interbase/isql/isql.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** isql.h 2000/08/03 20:49:22 1.1.1.1 --- isql.h 2000/11/18 16:49:24 1.2 *************** *** 20,23 **** --- 20,30 ---- * All Rights Reserved. * Contributor(s): ______________________________________. + * $Log$ + * Revision 1.2 2000/11/18 16:49:24 fsg + * Increased PRINT_BUFFER_LENGTH to 2048 to show larger plans + * Fixed Bug #122563 in extract.e get_procedure_args + * Apparently this has to be done in show.e also, + * but that is for another day :-) + * */ *************** *** 30,34 **** /* Define lengths used in isql.e */ ! #define PRINT_BUFFER_LENGTH 1024 #define MAXTERM_LENGTH 32 /* SQL termination character */ #define USER_LENGTH 128 --- 37,45 ---- /* Define lengths used in isql.e */ ! /* Increased this to allow display of somewhat lengthy plans ! hope this will last a year or so :-) ! FSG 17.Nov.2000 ! */ ! #define PRINT_BUFFER_LENGTH 2048 #define MAXTERM_LENGTH 32 /* SQL termination character */ #define USER_LENGTH 128 |