8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 18:43:03 +01:00

Change this confusing ROWCOUNT feature to MAXROWS (there's also COUNT) but the old name is accepted for compatibility with FB2.5.

This commit is contained in:
robocop 2009-12-28 11:54:51 +00:00
parent b0d546473e
commit 6ef6202f89
4 changed files with 33 additions and 32 deletions

View File

@ -249,7 +249,7 @@ static processing_state newdb(TEXT*, const TEXT*, const TEXT*, int, const TEXT*,
static processing_state newinput(const TEXT*);
static processing_state newoutput(const TEXT*);
static processing_state newsize(const TEXT*, const TEXT*);
static processing_state newRowCount(const TEXT* newRowCountStr);
static processing_state newMaxRows(const TEXT* newMaxRowsStr);
static processing_state newtrans(const TEXT*);
static processing_state parse_arg(int, SCHAR**, SCHAR*); //, FILE**);
#ifdef DEV_BUILD
@ -322,7 +322,7 @@ static bool Warnings = true; // Print warnings
static int Doblob = 1; // Default to printing only text types
static bool List = false;
static bool Docount = false;
static size_t rowCount = 0;
static size_t maxRows = 0;
static bool Plan = false;
static bool Planonly = false;
static bool Heading = true;
@ -4875,7 +4875,7 @@ static processing_state frontend_set(const char* cmd, const char* const* parms,
sqlda_display,
//#endif
sql, warning, generator, statistics, heading, bail,
bulk_insert, rowcount, wrong
bulk_insert, maxrows, wrong
};
SetOptions(const optionsMap* inmap, size_t insize, int wrongval)
: OptionsBase(inmap, insize, wrongval)
@ -4908,7 +4908,8 @@ static processing_state frontend_set(const char* cmd, const char* const* parms,
{SetOptions::heading, "HEADING", 0},
{SetOptions::bail, "BAIL", 0},
{SetOptions::bulk_insert, "BULK_INSERT", 0},
{SetOptions::rowcount, "ROWCOUNT", 0},
{SetOptions::maxrows, "ROWCOUNT", 0}, // legacy, oompatible with FB2.5
{SetOptions::maxrows, "MAXROWS", 0},
};
// Display current set options
@ -5050,8 +5051,8 @@ static processing_state frontend_set(const char* cmd, const char* const* parms,
ret = ps_ERR;
break;
case SetOptions::rowcount:
ret = newRowCount((*lparms[2]) ? lparms[2] : "0");
case SetOptions::maxrows:
ret = newMaxRows((*lparms[2]) ? lparms[2] : "0");
break;
default:
@ -5951,7 +5952,7 @@ static processing_state print_sets()
print_set("List format:", List);
print_set("Show Row Count:", Docount);
//print_set("Row Count:", Docount); // Changed print to the above to avoid confusion with next one
isqlGlob.printf("%-25s%lu%s", "Select rowcount limit:", rowCount, NEWLINE);
isqlGlob.printf("%-25s%lu%s", "Select maxrows limit:", maxRows, NEWLINE);
print_set("Autocommit DDL:", Autocommit);
print_set("Access Plan:", Plan);
print_set("Access Plan only:", Planonly);
@ -6043,7 +6044,7 @@ static processing_state help(const TEXT* what)
HLP_SETBLOB, // SET BLOB [ALL|<n>] -- display BLOBS of subtype <n> or ALL
HLP_SETBLOB2, // SET BLOB -- turn off BLOB display
HLP_SETCOUNT, // SET COUNT -- toggle count of selected rows on/off
HLP_SETROWCOUNT, // SET ROWCOUNT [<n>] -- toggle limit of selected rows to <n>, zero is no limit
HLP_SETMAXROWS, // SET MAXROWS [<n>] -- toggle limit of selected rows to <n>, zero is no limit
HLP_SETECHO, // SET ECHO -- toggle command echo on/off
HLP_SETHEADING, // SET HEADING -- toggle column titles display on/off
HLP_SETLIST, // SET LIST -- toggle column or table display format
@ -6521,33 +6522,33 @@ static processing_state newsize(const TEXT* colname, const TEXT* sizestr)
return SKIP;
}
static processing_state newRowCount(const TEXT* newRowCountStr)
static processing_state newMaxRows(const TEXT* newMaxRowsStr)
{
/**************************************
*
* newRowCount
* newMaxRows
*
**************************************
*
* Functional description
* Sets the new value for the rowcount limit (max rows to be retrieved).
* Sets the new value for the maxRows limit (max rows to be retrieved).
*
**************************************/
char* p;
errno = 0;
const long newRowCount = strtol(newRowCountStr, &p, 10);
const long newMaxRows = strtol(newMaxRowsStr, &p, 10);
// I was going to use this one, but "-1" parses as max ulong without error
// and it would be politer to give an error.
//const ULONG newRowCount = strtoul(newRowCountStr, &p, 10);
//const ULONG newMaxRows = strtoul(newMaxRowsStr, &p, 10);
// CVC: I added this block because Windows wasn't working according to Mark's
// expectation: it only produces ERANGE. Thus, garbage like
// set rowcount abs; wasn't caught.
if (p == newRowCountStr)
// set maxrows abs; wasn't caught.
if (p == newMaxRowsStr)
{
IUTILS_put_errmsg(ROWCOUNT_INVALID, SafeArg() << newRowCountStr);
IUTILS_put_errmsg(MAXROWS_INVALID, SafeArg() << newMaxRowsStr);
return ps_ERR;
}
@ -6557,21 +6558,21 @@ static processing_state newRowCount(const TEXT* newRowCountStr)
break;
case ERANGE:
// Only ERANGE is part of the ANSI standard here.
IUTILS_put_errmsg(ROWCOUNT_OUTOF_RANGE, SafeArg() << newRowCountStr << SLONG_MAX);
IUTILS_put_errmsg(MAXROWS_OUTOF_RANGE, SafeArg() << newMaxRowsStr << SLONG_MAX);
return ps_ERR;
default:
// EINVAL and the like
IUTILS_put_errmsg(ROWCOUNT_INVALID, SafeArg() << newRowCountStr);
IUTILS_put_errmsg(MAXROWS_INVALID, SafeArg() << newMaxRowsStr);
return ps_ERR;
}
if (newRowCount < 0)
if (newMaxRows < 0)
{
IUTILS_put_errmsg(ROWCOUNT_NEGATIVE, SafeArg() << newRowCountStr);
IUTILS_put_errmsg(MAXROWS_NEGATIVE, SafeArg() << newMaxRowsStr);
return ps_ERR;
}
rowCount = newRowCount;
maxRows = newMaxRows;
return SKIP;
}
@ -8600,8 +8601,8 @@ static int process_statement(const TEXT* string, XSQLDA** sqldap)
for (lines = 0; !Interrupt_flag && !Abort_flag; ++lines)
{
// Check if exceeded rowCount value
if (rowCount != 0 && lines >= rowCount)
// Check if exceeded maxRows value
if (maxRows != 0 && lines >= maxRows)
break;
// Fetch the current cursor

View File

@ -138,7 +138,7 @@ const int HLP_SET = 30; // \tSET -- Display current options \n
const int HLP_SETAUTO = 31; // \tSET AUTOcommit -- toggle autocommit of DDL statments\n
const int HLP_SETBLOB = 32; // \tSET BLOBdisplay [ALL|N]-- Display blobs of type N\n\t SET BLOB turns off blob display\n
const int HLP_SETCOUNT = 33; // \tSET COUNT -- toggle count of selected rows on/off \n
const int HLP_SETROWCOUNT = 165; // \tSET ROWCOUNT [N] -- limits the number of rows returned, zero is no limit \n
const int HLP_SETMAXROWS = 165; // \tSET MAXROWS [N] -- limits the number of rows returned, zero is no limit \n
const int HLP_SETECHO = 34; // \tSET ECHO -- toggle command echo on/off \n
const int HLP_SETSTAT = 35; // \tSET STATs -- toggles performance statistics display\n
const int HLP_SETTERM = 36; // \tSET TERM <string> -- changes termination character\n
@ -254,9 +254,9 @@ const int NO_PACKAGE = 166; // There is no package @1 in this database
const int NO_PACKAGES = 167; // There are no packages in this database
const int NO_SCHEMA = 168; // There is no schema @1 in this database
const int NO_SCHEMAS = 169; // There are no schemas in this database
const int ROWCOUNT_INVALID = 170; // Unable to convert @1 to a number for rowcount
const int ROWCOUNT_OUTOF_RANGE = 171; // Value @1 for rowcount is out of range. Max value is @2
const int ROWCOUNT_NEGATIVE = 172; // The value (@1) for rowcount must be zero or greater
const int MAXROWS_INVALID = 170; // Unable to convert @1 to a number for MAXWROWS option
const int MAXROWS_OUTOF_RANGE = 171; // Value @1 for MAXROWS is out of range. Max value is @2
const int MAXROWS_NEGATIVE = 172; // The value (@1) for MAXROWS must be zero or greater
// Initialize types

View File

@ -26,7 +26,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUM
--
--('1996-11-07 13:38:43', 'GJRN', 16, 241)
--
('2009-11-13 08:37:53', 'ISQL', 17, 173)
('2009-12-21 04:00:05', 'ISQL', 17, 173)
('2009-11-13 17:49:54', 'GSEC', 18, 104)
--
--('2002-03-05 02:30:12', 'LICENSE', 19, 60)

View File

@ -2753,14 +2753,14 @@ Fetches = !f', NULL, NULL);
('PASS_FILE_OPEN', 'ISQL_main', 'isql.epp', NULL, 17, 162, NULL, 'could not open password file @1, errno @2', NULL, NULL);
('PASS_FILE_READ', 'ISQL_main', 'isql.epp', NULL, 17, 163, NULL, 'could not read password file @1, errno @2', NULL, NULL);
('EMPTY_PASS', 'ISQL_main', 'isql.epp', NULL, 17, 164, NULL, 'empty password file @1', NULL, NULL);
('HLP_SETROWCOUNT', 'help', 'isql.epp', NULL, 17, 165, NULL, ' SET ROWCOUNT [<n>] -- limit select stmt to <n> rows, zero is no limit', NULL, NULL);
('HLP_SETMAXROWS', 'help', 'isql.epp', NULL, 17, 165, NULL, ' SET MAXROWS [<n>] -- limit select stmt to <n> rows, zero is no limit', NULL, NULL);
('NO_PACKAGE', 'SHOW_metadata', 'show.epp', NULL, 17, 166, NULL, 'There is no package @1 in this database', NULL, NULL)
('NO_PACKAGES', 'SHOW_metadata', 'show.epp', NULL, 17, 167, NULL, 'There are no packages in this database', NULL, NULL)
('NO_SCHEMA', 'SHOW_metadata', 'show.epp', NULL, 17, 168, NULL, 'There is no schema @1 in this database', NULL, NULL)
('NO_SCHEMAS', 'SHOW_metadata', 'show.epp', NULL, 17, 169, NULL, 'There are no schemas in this database', NULL, NULL)
('ROWCOUNT_INVALID', 'newRowCount', 'isql.epp', NULL, 17, 170, NULL, 'Unable to convert @1 to a number for rowcount', NULL, NULL)
('ROWCOUNT_OUTOF_RANGE', 'newRowCount', 'isql.epp', NULL, 17, 171, NULL, 'Value @1 for rowcount is out of range. Max value is @2', NULL, NULL)
('ROWCOUNT_NEGATIVE', 'newRowCount', 'isql.epp', NULL, 17, 172, NULL, 'The value (@1) for rowcount must be zero or greater', NULL, NULL)
('MAXROWS_INVALID', 'newRowCount', 'isql.epp', NULL, 17, 170, NULL, 'Unable to convert @1 to a number for MAXROWS option', NULL, NULL)
('MAXROWS_OUTOF_RANGE', 'newRowCount', 'isql.epp', NULL, 17, 171, NULL, 'Value @1 for MAXROWS is out of range. Max value is @2', NULL, NULL)
('MAXROWS_NEGATIVE', 'newRowCount', 'isql.epp', NULL, 17, 172, NULL, 'The value (@1) for MAXROWS must be zero or greater', NULL, NULL)
-- GSEC
('GsecMsg1', 'get_line', 'gsec.e', NULL, 18, 1, NULL, 'GSEC>', NULL, NULL);
('GsecMsg2', 'printhelp', 'gsec.e', 'This message is used in the Help display. It should be the same as number 1 (but in lower case).', 18, 2, NULL, 'gsec', NULL, NULL);