Functions Back | Forward | Home

'Language Reference'
  • Logical Operators

  • Relational Operators

  • Data Types

  • Column Types

  • Primary Keys

  • Functions

  • Where Clauses

  • LIKE Clauses

  • Limit Clauses

  • OrderBy Clauses

  • Notes


  • User Functions

    Database Functions

    Data Manipulation Functions

    Table Functions

    Error Handling Functions

    << Last Section ( Primary Keys ) Functions Next Section ( Where Clauses ) >>

    These functions can be used in constructing where clauses. They are only available where txtSQL >= 2.2.2 RC2. Valid functions are listed below

    Function Example Description
    strUpper() array('strUpper($a) = $b') Converts $a to uppercase
    strLower() array('strLower($a) = $b') Converts $a to lowercase
    chop() array('chop($a) = $b') Strip whitespace from the end of a string
    rtrim() array('rtrim($a) = $b') Strip whitespace from the end of a string
    ltrim() array('ltrim($a) = $b') Strip whitespace from the beginning of a string
    trim() array('trim($a) = $b') Strip whitespace from the beginning and end of a string
    md5() array('md5($a) = $b') Calculates the md5 hash of a string
    stripSlash() array('stripSlash($a) = $b') Un-quote string quoted with addslashes
    strLength() array('stripSlash($a) = $b') Calculates the length of $a
    strReverse() array('strReverse($a) = $b') Reverses $a
    ucFirst() array('ucFirst($a) = $b') Makes $a's first character uppercase
    ucwords() array('ucWords($a) = $b') Uppercase the first character of each word in a $a
    bin2hex() array('bin2hex($a) = $b') Convert binary data into hexadecimal representation
    entDecode() array('entDecode($a) = $b') Convert all HTML entities to their applicable characters
    entEncode() array('entEncode($a) = $b') Convert all applicable characters to HTML entities
    soundex() array('soundex($a) = $b') Calculate the soundex key of a string
    ceil() array('ceil($a) = $b') Round fractions up
    floor() array('floor($a) = $b') Round fractions down
    round() array('round($a) = $b') Rounds a float
    isNumeric()* array('isNumeric($a)') Finds whether a variable is a number or a numeric string
    isString()* array('isString($a)') Finds whether a variable is a string
    isFile()* array('isFile($a)') Tells whether the filename is a regular file
    isDir()* array('isDir($a)') Tells whether the filename is a directory
    *- These functions can be negated by placing a '!' in front of the function name. For example, array('!isdir($a)'). Also these functions can __NOT__ have an operator in it, they are 'unary functions'.

    User-Contributed Comments for:
    Functions
    Faraz Ali <SaiyanM at hotmail dot com>
    July 30, 2004, 11:19 pm
    You can only use these functions on a column, for example
    <?php
    $sql
    ->select(array(
    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in c:\program files\other\easyphp\www\txtsql\documents\index.php on line 549
    '
    where\' => array(\'strLower(name) = john doe\') // correct
                                     //
    \'name = strLower(john doe) is incorrect,
                                     // will produce unwanted results
    ...));
    ?>