| 119 | /** |
| 120 | * Escapes content by reference for insertion into the database, for security |
| 121 | * @param string $s |
| 122 | */ |
| 123 | function escape_by_ref(&$s) { |
| 124 | $s = $this->escape($s); |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Prepares a SQL query for safe use, using sprintf() syntax |
| 129 | */ |
| 130 | function prepare($args=NULL) { |
| 131 | if ( NULL === $args ) |
| 132 | return; |
| 133 | $args = func_get_args(); |
| 134 | $query = array_shift($args); |
| 135 | array_walk($args, array(&$this, 'escape_by_ref')); |
| 136 | return @call_user_func_array('sprintf', array_merge(array($query), $args)); |
| 137 | } |
| 138 | |