mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
parent
8e478e8909
commit
3f5be0f4fc
2 changed files with 6 additions and 8 deletions
|
@ -102,10 +102,8 @@ pub fn (conn Connection) tables(wildcard string) ?[]string {
|
|||
|
||||
// escape_string creates a legal SQL string for use in an SQL statement.
|
||||
pub fn (conn Connection) escape_string(s string) string {
|
||||
len := C.strlen(s.str)
|
||||
to := malloc(2 * len + 1)
|
||||
quote := byte(39) // single quote
|
||||
C.mysql_real_escape_string_quote(conn.conn, to, s.str, len, quote)
|
||||
to := malloc(2 * s.len + 1)
|
||||
C.mysql_real_escape_string_quote(conn.conn, to, s.str, s.len, `\'`)
|
||||
return unsafe {to.vstring()}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue