[Mono-bugs] [Bug 588831] New: DataColumn Expressions functions TRIM and SUBSTRING don't support calculated functions as argument

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Mar 16 16:58:15 EDT 2010



           Summary: DataColumn Expressions functions TRIM and SUBSTRING
                    don't support calculated functions as argument
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: Dominique.Normand at cegedim.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us)
AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7

The following expressions are not supported by System.Data:
SUBSTRING(ISNULL([columnName1] + ', ' + [columnName2], [columnName1]), 1, 200)
TRIM(ISNULL([columnName1] + ', ' + [columnName2], [columnName1]))

Reproducible: Always

Steps to Reproduce:
1. DataTable t = new DataTable() ;
2. DataColumn c1 = t.Columns.Add("c1");
3. DataColumn c2 = t.Columns.Add("c2");
4. c2.Expression = "TRIM(ISNULL(c1,' ')";
4. c2.Expression = "SUBSTRING(ISNULL(c1,' '), 1, 10)";
Actual Results:  
Unhandled Exception: System.Data.SyntaxErrorException: Expression
'TRIM(ISNULL(c1,''))' is invalid.
  at Mono.Data.SqlExpressions.Parser.Compile (System.String sqlExpr) [0x00041]
  at System.Data.DataColumn.set_Expression (System.String value) [0x000a2] in
  at TestExpression.MainClass.Main (System.String[] args) [0x00054] in

Expected Results:  
No Exception and the expression should work.

This is due to the definition of TRIM and SUBSTRING in

TRIM And SUBSTRING are StringFunction and accept only StringExpr as argument.
StringExpr allows only SingleColumnValue, StringLiteral or StringFunction but
NOT CalcFunction. So we can't even use CONVERT(<value>, "System.String") as
argument of those functions.

Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list