DB Access Module for Sybase User’s Guide : Chapter 2 Technical Information : Expressions
Expressions
Due to limitations in Adaptive Server, there are some restrictions on the use of DB Interface Module expressions.
Global Functions
Table 4 lists restrictions on the global functions associated with RWDBExpr.
Table 4 – Restrictions on the use of global functions with RWDBExpr 
Function
Restrictions
rwdbAvg(const RWDBExpr&)
None. Corresponds to: AVG(expr)
rwdbCast(const RWDBExpr&,
const RWDBValue&)
None. Corresponds to: CONVERT(val, expr)
rwdbCast(const RWDBExpr&,
const RWDBValue&,
const RWDBExpr&)
None. Corresponds to:
CONVERT(val, expr0, expr2)
rwdbCast(const RWBDExpr&,
const RWDBValue&,
const RWDBExpr&,
const RWDBExpr&)
The fourth parameter is not supported,
effectively supporting only the three-parameter
version of CONVERT()
rwdbCharLength(const RWDBExpr&)
None. Corresponds to: CHAR_LENGTH(expr)
rwdbCount()
None. Corresponds to: COUNT(*)
rwdbCount(const RWDBExpr&)
None. Corresponds to: COUNT(expr)
rwdbCountDistinct(const RWDBExpr&)
None. Corresponds to:
COUNT(DISTINCT(expr))
rwdbCurrentUser()
None. Corresponds to: USER_NAME()
rwdbExists(const RWDBSelectorBase&)
None. Corresponds to: EXISTS(sel)
rwdbLower(const RWDBExpr&)
None. Corresponds to: LOWER(expr)
rwdbMax(const RWDBExpr&)
None. Corresponds to: MAX(expr)
rwdbMin(const RWDBExpr&)
None. Corresponds to: MIN(expr)
rwdbName(const RWCString&,
const RWDBExpr&)
None. Corresponds to: str = expr
rwdbPosition(const RWDBExpr&,
const RWDBExpr&)
None. Corresponds to:
CHARINDEX(expr0, expr1)
rwdbSessionUser()
None. Corresponds to: USER_NAME()
rwdbSubString(const RWDBExpr&,
const RWDBExpr&)
None. Corresponds to:
SUBSTRING(expr0, expr1, 256)
rwdbSubString(const RWDBExpr&,
const RWDBExpr&,
const RWDBExpr&)
None. Corresponds to:
SUBSTRING(expr0, expr1, expr2)
rwdbSum(const RWDBExpr&)
None. Corresponds to: SUM(expr)
rwdbSystemDateTime()
None. Corresponds to: GETDATE()
rwdbSystemUser()
None. Corresponds to: SUSER_NAME()
rwdbTrimLeading(const RWDBExpr&,
const RWDBExpr&)
Ignores first parameter. Always removes blanks. Corresponds to: LTRIM(expr1)
rwdbTrimTrailing(const RWDBExpr&,
const RWDBExpr&)
Ignores first parameter. Always removes blanks. Corresponds to: RTRIM(expr1)
rwdbTrimBoth(const RWDBExpr&,
const RWDBExpr&)
Ignores first parameter. Always removes blanks. Corresponds to:LTRIM(RTRIM(expr1))
rwdbUpper(const RWDBExpr&)
None. Corresponds to: UPPER(expr)
Outer Joins
Sybase supports both of the following:
the ANSI-compliant syntax for outer joins with the join condition in the FROM clause.
the Sybase-specific syntax using the Sybase join operator (*=) in the WHERE clause (ANSI-noncompliant)
See the section “Outer Joins,” in the DB Interface Module User's Guide, for information on constructing outer joins.
The following example shows how you would write an outer join for Sybase. You may assume that myDbase is a valid RWDBDatabase instance.
An Outer Join for Sybase in ANSI-Noncompliant Syntax
 
RWDBTable employee = myDbase.table("emp");
RWDBTable depart = myDbase.table("dept");
RWDBTable locate = myDbase.table("loc");
 
RWDBSelector selector = myDbase.selector();
selector << employee["empnum"] << employee["ename"]
<< employee["deptno"] << depart["deptno"] << depart["dname"]
<< depart["locno"] << locate["locno"] << locate["lname"];
 
// Specify the join condition in the WHERE clause using the
// leftOuterJoin() and rightOuterJoin() methods on the columns and
// expressions. The first criterion creates a right outer join
// between the tables emp and dept by their deptno columns.
// The second criterion creates a left outer join between
// the tables dept and loc by their locno columns.
selector.where(employee["deptno"].rightOuterJoin(depart["deptno"])
&& depart["locno"].leftOuterJoin(locate["locno"]));
NOTE >> Sybase does not support outer joins in which one table is outer to more than one other table. Attempting this will cause unexpected results.