mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
sql: only accept strings and ints for now
This commit is contained in:
@@ -5,15 +5,15 @@
|
||||
module builtin
|
||||
|
||||
struct Option {
|
||||
data [500]byte
|
||||
data [255]byte
|
||||
error string
|
||||
ok bool
|
||||
}
|
||||
|
||||
// `fn foo() ?Foo { return foo }` => `fn foo() ?Foo { return opt_ok(foo); }`
|
||||
fn opt_ok(data voidptr, size int) Option {
|
||||
if size >= 500 {
|
||||
panic('option size too big: $size (max is 500), this is a temporary limit')
|
||||
if size >= 255 {
|
||||
panic('option size too big: $size (max is 255), this is a temporary limit')
|
||||
}
|
||||
res := Option {
|
||||
ok: true
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
strings
|
||||
net
|
||||
http
|
||||
net.urllib
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -172,7 +173,9 @@ fn (ctx mut Context) parse_form(s string) {
|
||||
keyval := word.trim_space().split('=')
|
||||
if keyval.len != 2 { continue }
|
||||
key := keyval[0]
|
||||
val := http.unescape_url(keyval[1])
|
||||
val := urllib.query_unescape(keyval[1]) or {
|
||||
continue
|
||||
}
|
||||
println('http form "$key" => "$val"')
|
||||
ctx.form[key] = val
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user