"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/database/src/general_query.cpp" between
irods-4.2.5.tar.gz and irods-4.2.6.tar.gz

About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.

general_query.cpp  (irods-4.2.5):general_query.cpp  (irods-4.2.6)
skipping to change at line 31 skipping to change at line 31
There is also a routine that checks for cycles, tCycleChk, which can There is also a routine that checks for cycles, tCycleChk, which can
be called when the tables change to make sure there are no cycles. be called when the tables change to make sure there are no cycles.
*/ */
#include "rodsClient.h" #include "rodsClient.h"
#include "icatHighLevelRoutines.hpp" #include "icatHighLevelRoutines.hpp"
#include "mid_level.hpp" #include "mid_level.hpp"
#include "low_level.hpp" #include "low_level.hpp"
#include "irods_virtual_path.hpp" #include "irods_virtual_path.hpp"
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <string> #include <string>
#include <algorithm>
extern int logSQLGenQuery; extern int logSQLGenQuery;
void icatGeneralQuerySetup(); void icatGeneralQuerySetup();
int insertWhere( char *condition, int option ); int insertWhere( char *condition, int option );
/* use a column size of at least this many characters: */ /* use a column size of at least this many characters: */
#define MINIMUM_COL_SIZE 50 #define MINIMUM_COL_SIZE 50
#define MAX_LINKS_TABLES_OR_COLUMNS 500 #define MAX_LINKS_TABLES_OR_COLUMNS 500
skipping to change at line 99 skipping to change at line 102
int nColumns; int nColumns;
int nToFind; int nToFind;
char tableAbbrevs; char tableAbbrevs;
int debug = 0; int debug = 0;
int debug2 = 0; int debug2 = 0;
namespace
{
int mask_query_argument(std::string& _condition, std::string::size_type _off
set)
{
if (_condition.empty() || _offset >= _condition.size()) {
return -1;
}
const auto bpos = _condition.find_first_of("'", _offset);
if (bpos == std::string::npos) {
return -1;
}
const auto epos = _condition.find_first_of("'", bpos + 1);
if (epos == std::string::npos) {
return -1;
}
std::fill(&_condition[bpos + 1], &_condition[epos], ' ');
return epos + 1;
}
void mask_query_arguments(std::string& _condition)
{
int offset = 0;
while ((offset = mask_query_argument(_condition, offset)) > -1);
}
} // anonymous namespace
/* /*
Used by fklink (below) to find an existing name and return the Used by fklink (below) to find an existing name and return the
value. Once the table is set up, the code can use the integer value. Once the table is set up, the code can use the integer
table1 and table2 values to more quickly compare. table1 and table2 values to more quickly compare.
*/ */
int fkFindName( const char *tableName ) { int fkFindName( const char *tableName ) {
int i; int i;
for ( i = 0; i < nTables; i++ ) { for ( i = 0; i < nTables; i++ ) {
if ( strcmp( Tables[i].tableName, tableName ) == 0 ) { if ( strcmp( Tables[i].tableName, tableName ) == 0 ) {
return i; return i;
skipping to change at line 961 skipping to change at line 996
if ( !rstrcpy( condPart2, condition, MAX_NAME_LEN * 2 ) ) { if ( !rstrcpy( condPart2, condition, MAX_NAME_LEN * 2 ) ) {
return USER_STRLEN_TOOLONG; return USER_STRLEN_TOOLONG;
} }
while ( true ) { while ( true ) {
if ( !rstrcpy( condPart1, condPart2, MAX_NAME_LEN * 2 ) ) { if ( !rstrcpy( condPart1, condPart2, MAX_NAME_LEN * 2 ) ) {
return USER_STRLEN_TOOLONG; return USER_STRLEN_TOOLONG;
} }
char* orptr = strstr( condPart1, "||" ); char* orptr{};
char* andptr = strstr( condPart1, "&&" ); char* andptr{};
char *cptr = NULL;
{
std::string tmp = condPart1;
// Masking the query arguments (characters surrounded by quotes) is
// required in case the arguments contain character sequences that
// can trip up the parser (e.g. "&&" and "||"). This allows the pars
er
// to find the correct location of the "and" and "or" operators.
mask_query_arguments(tmp);
auto pos = tmp.find("||");
if (std::string::npos != pos) {
orptr = condPart1 + pos;
}
pos = tmp.find("&&");
if (std::string::npos != pos) {
andptr = condPart1 + pos;
}
}
char *cptr{};
int type = 0; int type = 0;
if ( orptr != NULL && ( andptr == NULL || orptr < andptr ) ) { if ( orptr != NULL && ( andptr == NULL || orptr < andptr ) ) {
cptr = orptr; cptr = orptr;
type = 1; type = 1;
} }
else if ( andptr != NULL && ( orptr == NULL || andptr < orptr ) ) { else if ( andptr != NULL && ( orptr == NULL || andptr < orptr ) ) {
cptr = andptr; cptr = andptr;
type = 2; type = 2;
} }
else { else {
 End of changes. 5 change blocks. 
3 lines changed or deleted 63 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)