plugins/database/src/general_query.cpp
int
compoundConditionSpecified( char *condition ) {
    char myCondition[MAX_NAME_LEN * 2];
    int quote;
    char *cptr;

    /* Simple case, not in the condition at all */
    if ( strstr( condition, "||" ) == NULL &&
            strstr( condition, "&&" ) == NULL ) {
        return 0;
    }

    /* Make a copy of the condition and erase the quoted strings */
    snprintf( myCondition, sizeof( myCondition ), "%s", condition );
    for ( cptr = myCondition, quote = 0; *cptr != '\0'; cptr++ ) {
        if ( *cptr == '\'' ) {
            if ( quote == 0 ) {
                quote = 1;
            }
            else {
                quote = 0;
            }
            *cptr = ' ';
        }
        if ( quote == 1 ) {
            *cptr = ' ';
        }
    }

    /* And now test again */
    if ( strstr( myCondition, "||" ) == NULL &&
            strstr( myCondition, "&&" ) == NULL ) {
        return 0;
    }
    return 1;
}
/*
 Check if this is a compound condition, that is if there is a && or ||
 outside of single quotes.  Previously the corresponding test was just
 to see if && or || existed in the string, but if the name
 (data-object or other) included && it would be mistaken.  At this
 level, names are always in quotes so we can just verify that && or ||
 is there and not quoted.
 */
Check if this is a compound condition, that is if there is a && or ||
outside of single quotes.  Previously the corresponding test was just
to see if && or || existed in the string, but if the name
(data-object or other) included && it would be mistaken.  At this
level, names are always in quotes so we can just verify that && or ||
is there and not quoted.
Check if this is a compound condition that is if there is a && or || outside of single quotes . Previously the corresponding test was just to see if && or || existed in the string but if the name ( data - object or other ) included && it would be mistaken . At this level names are always in quotes so we can just verify that && or || is there and not quoted .
int
compoundConditionSpecified( char *condition ) {
    char myCondition[MAX_NAME_LEN * 2];
    int quote;
    char *cptr;
    if ( strstr( condition, "||" ) == NULL &&
            strstr( condition, "&&" ) == NULL ) {
        return 0;
    }
    snprintf( myCondition, sizeof( myCondition ), "%s", condition );
    for ( cptr = myCondition, quote = 0; *cptr != '\0'; cptr++ ) {
        if ( *cptr == '\'' ) {
            if ( quote == 0 ) {
                quote = 1;
            }
            else {
                quote = 0;
            }
            *cptr = ' ';
        }
        if ( quote == 1 ) {
            *cptr = ' ';
        }
    }
    if ( strstr( myCondition, "||" ) == NULL &&
            strstr( myCondition, "&&" ) == NULL ) {
        return 0;
    }
    return 1;
}
int compoundConditionSpecified ( char * condition ) { char myCondition [ MAX_NAME_LEN * 2 ] ; int quote ; char * cptr ; if ( strstr ( condition , " " ) == NULL && strstr ( condition , " " ) == NULL ) { return 0 ; } snprintf ( myCondition , sizeof ( myCondition ) , " " , condition ) ; for ( cptr = myCondition , quote = 0 ; * cptr != ' \0 ' ; cptr ++ ) { if ( * cptr == ' \' ' ) { if ( quote == 0 ) { quote = 1 ; } else { quote = 0 ; } * cptr = ' ' ; } if ( quote == 1 ) { * cptr = ' ' ; } } if ( strstr ( myCondition , " " ) == NULL && strstr ( myCondition , " " ) == NULL ) { return 0 ; } return 1 ; }
Check if this is a compound condition, that is if there is a && or ||
outside of single quotes.
Check if this is a compound condition that is if there is a && or || outside of single quotes .
/* Simple case, not in the condition at all */ /* Make a copy of the condition and erase the quoted strings */ /* And now test again */