1
0
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:
Alexander Medvednikov
2019-08-12 18:54:28 +03:00
parent cba4d59712
commit ef2ab31e88
4 changed files with 54 additions and 19 deletions

View File

@@ -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

View File

@@ -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
}