buffer_add_char( state->sql, ')' );
}
break;
- case EXP_FIELD :
- if( expr->negate )
- buffer_add( state->sql, "NOT " );
-
- sqlAddMsg( state, "Field expressions not yet supported" );
- state->error = 1;
- break;
case EXP_FUNCTION :
buildFunction( state, expr );
break;
if( expr->negate )
buffer_add( state->sql, "NOT " );
+ // If a subfield is specified, the function call
+ // needs an extra layer of parentheses
+ if( expr->column_name )
+ buffer_add_char( state->sql, '(' );
+
// We rely on the input side to ensure that the function name is available
buffer_add( state->sql, expr->function_name );
buffer_add_char( state->sql, '(' );
buildSeries( state, expr->subexp_list, NULL );
buffer_add_char( state->sql, ')' );
+
+ if( expr->column_name ) {
+ // Add the name of the subfield
+ buffer_add( state->sql, ").\"" );
+ buffer_add( state->sql, expr->column_name );
+ buffer_add_char( state->sql, '\"' );
+ }
}
/**
type = EXP_COLUMN;
else if( !strcmp( type_str, "xex" ))
type = EXP_EXIST;
- else if( !strcmp( type_str, "xfld" ))
- type = EXP_FIELD;
else if( !strcmp( type_str, "xfunc" ))
type = EXP_FUNCTION;
else if( !strcmp( type_str, "xin" ))