| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
class DBSQLite extends DBAdapter { |
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
* For SQLite this method has no effect, since SQLite doesn't support specifying a character |
|---|
| 34 |
* set (or, another way to look at it, it doesn't require a single character set per DB). |
|---|
| 35 |
* |
|---|
| 36 |
* @param PDO A PDO connection instance. |
|---|
| 37 |
* @param string The charset encoding. |
|---|
| 38 |
* @throws PropelException If the specified charset doesn't match sqlite_libencoding() |
|---|
| 39 |
*/ |
|---|
| 40 |
public function setCharset(PDO $con, $charset) |
|---|
| 41 |
{ |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
* This method is used to ignore case. |
|---|
| 46 |
* |
|---|
| 47 |
* @param in The string to transform to upper case. |
|---|
| 48 |
* @return The upper case string. |
|---|
| 49 |
*/ |
|---|
| 50 |
public function toUpperCase($in) |
|---|
| 51 |
{ |
|---|
| 52 |
return 'UPPER(' . $in . ')'; |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
* This method is used to ignore case. |
|---|
| 57 |
* |
|---|
| 58 |
* @param in The string whose case to ignore. |
|---|
| 59 |
* @return The string in a case that can be ignored. |
|---|
| 60 |
*/ |
|---|
| 61 |
public function ignoreCase($in) |
|---|
| 62 |
{ |
|---|
| 63 |
return 'UPPER(' . $in . ')'; |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
* Returns SQL which concatenates the second string to the first. |
|---|
| 68 |
* |
|---|
| 69 |
* @param string String to concatenate. |
|---|
| 70 |
* @param string String to append. |
|---|
| 71 |
* @return string |
|---|
| 72 |
*/ |
|---|
| 73 |
public function concatString($s1, $s2) |
|---|
| 74 |
{ |
|---|
| 75 |
return "($s1 || $s2)"; |
|---|
| 76 |
} |
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
* Returns SQL which extracts a substring. |
|---|
| 80 |
* |
|---|
| 81 |
* @param string String to extract from. |
|---|
| 82 |
* @param int Offset to start from. |
|---|
| 83 |
* @param int Number of characters to extract. |
|---|
| 84 |
* @return string |
|---|
| 85 |
*/ |
|---|
| 86 |
public function subString($s, $pos, $len) |
|---|
| 87 |
{ |
|---|
| 88 |
return "substr($s, $pos, $len)"; |
|---|
| 89 |
} |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
* Returns SQL which calculates the length (in chars) of a string. |
|---|
| 93 |
* |
|---|
| 94 |
* @param string String to calculate length of. |
|---|
| 95 |
* @return string |
|---|
| 96 |
*/ |
|---|
| 97 |
public function strLength($s) |
|---|
| 98 |
{ |
|---|
| 99 |
return "length($s)"; |
|---|
| 100 |
} |
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
* @see DBAdapter::quoteIdentifier() |
|---|
| 104 |
*/ |
|---|
| 105 |
public function quoteIdentifier($text) |
|---|
| 106 |
{ |
|---|
| 107 |
return '[' . $text . ']'; |
|---|
| 108 |
} |
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
* @see DBAdapter::applyLimit() |
|---|
| 112 |
*/ |
|---|
| 113 |
public function applyLimit(&$sql, $offset, $limit) |
|---|
| 114 |
{ |
|---|
| 115 |
if ( $limit > 0 ) { |
|---|
| 116 |
$sql .= " LIMIT " . $limit . ($offset > 0 ? " OFFSET " . $offset : ""); |
|---|
| 117 |
} elseif ( $offset > 0 ) { |
|---|
| 118 |
$sql .= " LIMIT -1 OFFSET " . $offset; |
|---|
| 119 |
} |
|---|
| 120 |
} |
|---|
| 121 |
|
|---|
| 122 |
public function random($seed=NULL) |
|---|
| 123 |
{ |
|---|
| 124 |
return 'random()'; |
|---|
| 125 |
} |
|---|
| 126 |
|
|---|
| 127 |
} |
|---|
| 128 |
|
|---|