Query doesn't handle %d
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=973
Reported by Martin Nilsson, IDA nilsson@pike.ida.liu.se
Pike v7.1 release 11 running Hilfe v2.0 (Incremental Pike Frontend)
> object db = Sql.sql("mysql://localhost/nilsson");
Result: object
> db->query("select * from test where foo='xo'");
Result: ({ /* 1 element */
([ /* 6 elements */
"bar":"48",
"foo":"xo",
"id":"1",
"test.bar":"48",
"test.foo":"xo",
"test.id":"1"
])
})
> db->query("select * from test where foo='%s'", "xo");
Result: ({ /* 1 element */
([ /* 6 elements */
"bar":"48",
"foo":"xo",
"id":"1",
"test.bar":"48",
"test.foo":"xo",
"test.id":"1"
])
})
> db->query("select * from test where bar=48");
Result: ({ /* 1 element */
([ /* 6 elements */
"bar":"48",
"foo":"xo",
"id":"1",
"test.bar":"48",
"test.foo":"xo",
"test.id":"1"
])
})
> db->query("select * from test where bar=%d", 48);
Sprintf: Wrong type for argument 2: expected integer, got string.
/i/pike/7.1.11/lib/modules/Sql.pmod/sql.pike:363: query("select * from test
where bar=%d")
-:1: ___Foo4711()