<!DOCTYPE HTML PUBLIC> <HTML> <TITLE>Xbase DBMS Chapter 16</TITLE> <BODY BGCOLOR=#FFFFFF> <H1><p align="center">Expressions Reference<br></H1> <p align="center">Chapter Updated 2/12/99</p><hr> <br><br> <TABLE BORDER> <CAPTION ALIGN="TOP"><h3>Expression Operands</h3></CAPTION> <TR VALIGN="BASELINE"> <TR><TH ALIGN="LEFT">Operand<TD>Type<TD>Function <TR><TH ALIGN="LEFT">+<TD>Alpha<TD>Concatonate <TR><TH ALIGN="LEFT">+<TD>Numeric<TD>Addition <TR><TH ALIGN="LEFT">-<TD>Alpha<TD>Concatonate, remove white space <TR><TH ALIGN="LEFT">-<TD>Numeric<TD>Subtraction <TR><TH ALIGN="LEFT">*<TD>Numeric<TD>Multiplication <TR><TH ALIGN="LEFT">/<TD>Numeric<TD>Division <TR><TH ALIGN="LEFT">**<TD>Numeric<TD>Exponentiation <TR><TH ALIGN="LEFT"><<TD>Logical<TD>Less Than <TR><TH ALIGN="LEFT">><TD>Logical<TD>Greater Than <TR><TH ALIGN="LEFT">=<TD>Logical<TD>Equal <TR><TH ALIGN="LEFT"><><TD>Logical<TD>Not Equal <TR><TH ALIGN="LEFT">#<TD>Logical<TD>Not Equal <TR><TH ALIGN="LEFT"><=<TD>Logical<TD>Less Than or Equal <TR><TH ALIGN="LEFT">>=<TD>Logical<TD>Greater Than or Equal <TR><TH ALIGN="LEFT">$<TD>Logical<TD>Contains <TR><TH ALIGN="LEFT">-><TD>N/A<TD>Identifies database field ie; DATABASE->FIELD </TABLE> <br><br><br> <TABLE BORDER> <CAPTION ALIGN="TOP"><h3>Expression Functions</h3></CAPTION> <TR VALIGN="BASELINE"> <TR><TH ALIGN="LEFT">Expression Function<TD>Xbase C++ Method<TD>Description <TR><TH ALIGN="LEFT">ABS()<TD>xbDouble EXPN::ABS( xbDouble d )<TD> Returns absolute numeric value of argument. <TR><TH ALIGN="LEFT">ASC()<TD>xbLong EXPN::ASC( char * String )<TD> Returns ASCII code of left character of string. <TR><TH ALIGN="LEFT">AT()<TD>xbLong EXPN::AT( char *s1, char *s2 )<TD> Returns starting position of first alphanumeric argument in second argument. <TR><TH ALIGN="LEFT">CDOW()<TD>char * EXPN::CDOW( char Date8 )<TD> Returns name of the day of the week of Date8. <TR><TH ALIGN="LEFT">CHR()<TD>char * EXPN::CHR( xbLong l )<TD> Returns ASCII character corresponding to numeric value supplied. <TR><TH ALIGN="LEFT">CMONTH()<TD>char * EXPN::CMONTH( char * Date8 )<TD> Returns name of the month of Date8. <TR><TH ALIGN="LEFT">DATE()<TD>char * EXPN::DATE()<TD> Returns system date. <TR><TH ALIGN="LEFT">DAY()<TD>xbLong EXPN::DAY( char * Date8 )<TD> Returns numeric value of the day of the month for Date8. <TR><TH ALIGN="LEFT">DESCEND()<TD>EXPN::DESCEND()<TD>Descend <TR><TH ALIGN="LEFT">DTOC()<TD>char * EXPN::DTOC( char * Date8 )<TD> Returns a date converted to format MM/DD/YY. <TR><TH ALIGN="LEFT">EXP()<TD>xbDouble EXPN::EXP( xbDouble d )<TD> Returns exponential for supplied value. <TR><TH ALIGN="LEFT">INT()<TD>xbLong EXPN::INT( xbDouble d )<TD> Converts any numeric value to an integer. <TR><TH ALIGN="LEFT">ISALPHA()<TD>xbLong EXPN::ISALPHA( char * String )<TD> Returns TRUE if string is alpha. <TR><TH ALIGN="LEFT">ISLOWER()<TD>xbLong EXPN::ISLOWER( char * String )<TD> Returns TRUE if string is lower case. <TR><TH ALIGN="LEFT">ISUPPER()<TD>xbLong EXPN::ISUPPER( char * String )<TD> Returns TRUE if string is upper case. <TR><TH ALIGN="LEFT">LEFT()<TD>char * EXPN::LEFT( char * String, xbShort Len )<TD> Returns <em>Len</em> characters from the left side of <em>String</em>. <TR><TH ALIGN="LEFT">LEN()<TD>xbLong EXPN::LEN( char * String )<TD> eturns the number of characters in the String. <TR><TH ALIGN="LEFT">LOG()<TD>xbDouble EXPN::LOG( xbDouble d )<TD> Returns the natural log of d. <TR><TH ALIGN="LEFT">LOWER()<TD>char * EXPN::LOWER( char * String )<TD> Converts a string to lower case. <TR><TH ALIGN="LEFT">LTRIM()<TD>char * EXPN::LTRIM( char * String )<TD> Eliminates leading white space from String. <TR><TH ALIGN="LEFT">MAX()<TD>xbDouble EXPN::MAX( xbDouble d1, xbDouble d2 )<TD> Returns the larger of two numeric arguments. <TR><TH ALIGN="LEFT">MIN()<TD>xbDouble EXPN::MIN(xbDouble d1, xbDouble d2 )<TD> Returns the smaller of two numeric arguments. <TR><TH ALIGN="LEFT">MONTH()<TD>xbLong EXPN::MONTH( char * Date8 )<TD> Returns numeric month for Date8. <TR><TH ALIGN="LEFT">REPLICATE()<TD>char * EXPN::REPLICATE( char * String, xbShort Count )<TD> Replicates String Conut times. <TR><TH ALIGN="LEFT">RIGHT()<TD>char * EXPN::RIGHT( char * String, xbShort Count )<TD> Returns Count characters from the right side of String. <TR><TH ALIGN="LEFT">RTRIM()<TD>char * EXPN::RTRIM( char * String )<TD> Removes trailing white space from String. <TR><TH ALIGN="LEFT">SPACE()<TD>char * EXPN::SPACE( xbShort Count )<TD> Returns a buffer filled with Count spaces. <TR><TH ALIGN="LEFT">SQRT()<TD>xbDouble EXPN::SQRT( xbDouble d )<TD> Returns square root of d. <TR><TH ALIGN="LEFT">STR()<TD>char * EXPN::STR( xbDouble d )<TD> Converts a number to a string. <TR><TH ALIGN="LEFT">SUBSTR()<TD>char * EXPN::SUBSTR( char * String, xbShort StartPos, xbShort Len )<TD> Returns a string form String starting at position StartPos for a length of Len. <TR><TH ALIGN="LEFT">TRIM()<TD>char * EXPN::TRIM( char * String )<TD> Same as RTRIM. <TR><TH ALIGN="LEFT">UPPER()<TD>char * EXPN::UPPER( char * String )<TD> Converts a string to upper case. <TR><TH ALIGN="LEFT">VAL()<TD>xbLong EXPN::VAL( char * String )<TD> Converts a string to an integer. <TR><TH ALIGN="LEFT">YEAR()<TD>xbLong EXPN::YEAR( char * Date8 )<TD> Returns numeric year from Date8. </TABLE> <br><br><br> <TABLE BORDER> <CAPTION ALIGN="TOP"><h3>Expression Processing Method List</h3></CAPTION> <TR VALIGN="BASELINE"> <TR><TH ALIGN="LEFT">Method<TD>Description <TR><TH ALIGN="LEFT">GetCharResult()<TD>Get char * result from processed expression <TR><TH ALIGN="LEFT">GetDoubResult()<TD>Get xbDouble result from processed expression <TR><TH ALIGN="LEFT">GetIntResult()<TD>Get a xbLong result from processed expression <TR><TH ALIGN="LEFT">GetExpressionHandle()<TD>Get an expression's handle <TR><TH ALIGN="LEFT">GetExpressionResultType(xbExpression *)<TD>Get expression result type <TR><TH ALIGN="LEFT">ParseExpression(char *,xbDbf *)<TD>Parse an expression <TR><TH ALIGN="LEFT">ProcessExpression(xbExpression *)<TD>Process a parsed expression </TABLE> <br><hr> <h3>Method Definitions</h3> <hr> <h3>Method char * xbXBase::GetCharResult()</h3><br> This method returns a char * result from a processed expression. <br><br> See the program listing in chapter 5 for an example of how to use this method. <hr> <h3>Method xbDouble xbXBase::GetDoubleResult()</h3><br> This method returns a xbDouble result from a processed expression. <br><br> See the program listing in chapter 5 for an example of how to use this method. <hr> <h3>Method xbLong xbXBase::GetIntResult()</h3><br> This method returns a xbLong result from a processed expression. <br><br> See the program listing in chapter 5 for an example of how to use this method. <hr> <h3>Method xbExpression * xbXBase::GetExpressionHandle()</h3><br> This method returns a handle to a recently parsed expression. <br><br> See the program listing in chapter 5 for an example of how to use this method. <hr> <h3>Method char xbXBase::GetExpressionResultType( xbExpression * e )</h3><br> This method returns the result type for a given expression <em>e</em>. <br><br> <TABLE BORDER> <CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION> <TR VALIGN="BASELINE"> <TR><TH ALIGN="LEFT">Return Code Value<TD>Description <TR><TH ALIGN="LEFT">C<TD>char * result from processed expression <TR><TH ALIGN="LEFT">N<TD>xbDouble result from processed expression <TR><TH ALIGN="LEFT">L<TD>xbLong (also logical) result from processed expression </TABLE><br><br> See the program listing in chapter 5 for an example of how to use this method. <hr> <h3>Method xbShort ParseExpression( char * exp, DBF * d)</h3><br> This method parses expression <em>exp</em>.<br><em>d</em> is a pointer to a database used for resolving any fieldname which does not contain the <en>-></em> operator. <br><br> See the program listing in chapter 5 for an example of how to use this method. <hr> <h3>Method xbShort ProcessExpression( xbExpression * e )</h3><br> This method processes parsed expression <em>e</em>. <br><br> See the program listing in chapter 5 for an example of how to use this method. <br><br> <hr> <A HREF="mailto:xbase@startech.keller.tx.us"> Send me mail - xbase@startech.keller.tx.us</A><br> <p>(c)1997 StarTech <p><img src="xbase.jpg"><br><hr> </BODY> </HTML>