public function getPreparedStatement(ConnectionCommon $conn) { $body = $this->createStatementBody(); $values = array(); if (is_null($this->filter)) { return $conn->prepareStatement($body); } $prepared = $this->filter->createPreparedStatement(); preg_match_all('/\\?\\?\\?([a-z0-9]*)@@@/', $prepared['sql'], $matches); $values = $matches[1]; $statement = $conn->prepareStatement($body . preg_replace('/\\?\\?\\?([a-z0-9]*)@@@/', '?', $prepared['sql'])); foreach ($values as $key => $id) { $key++; $value = $prepared['values'][$id]; if ('int' == $value['type']) { $statement->setInt($key, $value['value']); } else { if ('timestamp' == $value['type']) { $statement->setTimestamp($key, $value['value']); } else { $statement->setString($key, $value['value']); } } } return $statement; }