mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Check when statement is too long.
This commit is contained in:
parent
9c63b9f37a
commit
6bc1a8bb59
@ -542,6 +542,12 @@ impl InnerSqliteConnection {
|
|||||||
fn prepare<'a>(&mut self,
|
fn prepare<'a>(&mut self,
|
||||||
conn: &'a SqliteConnection,
|
conn: &'a SqliteConnection,
|
||||||
sql: &str) -> SqliteResult<SqliteStatement<'a>> {
|
sql: &str) -> SqliteResult<SqliteStatement<'a>> {
|
||||||
|
if sql.len() >= ::std::i32::MAX as usize {
|
||||||
|
return Err(SqliteError {
|
||||||
|
code: ffi::SQLITE_TOOBIG,
|
||||||
|
message: "statement too long".to_string()
|
||||||
|
});
|
||||||
|
}
|
||||||
let mut c_stmt: *mut ffi::sqlite3_stmt = unsafe { mem::uninitialized() };
|
let mut c_stmt: *mut ffi::sqlite3_stmt = unsafe { mem::uninitialized() };
|
||||||
let c_sql = try!(str_to_cstring(sql));
|
let c_sql = try!(str_to_cstring(sql));
|
||||||
let r = unsafe {
|
let r = unsafe {
|
||||||
|
Loading…
Reference in New Issue
Block a user