Changeset 134

Show
Ignore:
Timestamp:
04/23/09 00:21:13 (3 years ago)
Author:
assefa
Message:

modify a bit test to detect if a user value passed is numeric or text #30

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/fe/fe_filter.c

    r130 r134  
    137137{ 
    138138    xmlChar *content; 
     139    int isstring = 0; 
    139140 
    140141    assert(o != NULL); 
     
    183184 
    184185        } else { 
    185             if (check_regexp((char *) content, "^[A-Za-z]") == 1 
    186                     || check_regexp((char *) content, ".*-.*") == 1) 
    187                 buffer_add_str(sql, "'"); 
    188  
    189             buffer_add_str(sql, (char *) content); 
    190  
    191             if (check_regexp((char *) content, "^[A-Za-z]") == 1 
    192                     || check_regexp((char *) content, ".*-.*") == 1) 
    193                 buffer_add_str(sql, "'"); 
     186          if (!check_regexp((char *)content, "[-+]?\\b[0-9]*\\.?[0-9]+\\b")) 
     187          { 
     188              isstring = 1; 
     189              buffer_add_str(sql, "'"); 
     190          } 
     191          buffer_add_str(sql, (char *) content); 
     192 
     193          if (isstring) 
     194            buffer_add_str(sql, "'"); 
    194195        } 
    195196    } else if (strcmp((char *) n->name, "PropertyName") == 0)