ADOdb Library for PHP Manual
Prev Concat, IfNull, length, random, substr Next

Concat($s1,$s2,....)

Generates the sql string used to concatenate $s1, $s2, etc together. Uses the string in the concat_operator field to generate the concatenation. Override this function if a concatenation operator is not used, eg. MySQL.

Returns the concatenated string.

IfNull($field, $nullReplacementValue)

Portable IFNULL function (NVL in Oracle). Returns a string that represents the function that checks whether a $field is null for the given database, and if null, change the value returned to $nullReplacementValue. Eg.

$sql = 'SELECT '.$db->IfNull('name', "'- unknown -'"). ' FROM table';

length

This is not a function, but a property. Some databases have "length" and others "len" as the function to measure the length of a string. To use this property:

  $sql = "SELECT ".$db->length."(field) from table";
  $rs = $db->Execute($sql);

random

This is not a function, but a property. This is a string that holds the sql to generate a random number between 0.0 and 1.0 inclusive.

substr

This is not a function, but a property. Some databases have "substr" and others "substring" as the function to retrieve a sub-string. To use this property:

  $sql = "SELECT ".$db->substr."(field, $offset, $length) from table";
  $rs = $db->Execute($sql);

For all databases, the 1st parameter of substr is the field, the 2nd is the offset (1-based) to the beginning of the sub-string, and the 3rd is the length of the sub-string.


Prev Home Next
SetFetchMode Up qstr

Sponsored by phpLens