nefthon

Untitled

Jan 19th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. /* }}} */
  2.  
  3. /* {{{ proto String SQLite3::escapeString(String value)
  4. Returns a string that has been properly escaped. */
  5. PHP_METHOD(sqlite3, escapeString)
  6. {
  7. char *sql, *ret;
  8. int sql_len;
  9.  
  10. if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &sql, &sql_len)) {
  11. return;
  12. }
  13.  
  14. if (sql_len) {
  15. ret = sqlite3_mprintf("%q", sql);
  16. if (ret) {
  17. RETVAL_STRING(ret, 1);
  18. sqlite3_free(ret);
  19. }
  20. } else {
  21. RETURN_EMPTY_STRING();
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment