Update of /cvsroot/htoolkit/HSQL/SQLite3/Database/HSQL
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1617/Database/HSQL
Modified Files:
SQLite3.hsc
Log Message:
fix the prepared statement for NON-SELECT clauses
Index: SQLite3.hsc
===================================================================
RCS file: /cvsroot/htoolkit/HSQL/SQLite3/Database/HSQL/SQLite3.hsc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SQLite3.hsc 9 Jan 2006 12:45:04 -0000 1.5
--- SQLite3.hsc 9 Jan 2006 13:53:56 -0000 1.6
***************
*** 41,44 ****
--- 41,45 ----
foreign import ccall sqlite3_column_name :: SQLite3Stmt -> CInt -> IO CString
foreign import ccall sqlite3_column_text :: SQLite3Stmt -> CInt -> IO CString
+ foreign import ccall sqlite3_column_type :: SQLite3Stmt -> CInt -> IO CInt
foreign import ccall sqlite3_bind_double :: SQLite3Stmt -> CInt -> Double -> IO CInt
foreign import ccall sqlite3_bind_int :: SQLite3Stmt -> CInt -> CInt -> IO CInt
***************
*** 123,127 ****
{ stmtConn = connection
, stmtClose = sqlite3_finalize stmt >>= handleSqlResult sqlite
! , stmtExecute= return (-1)
, stmtReset = sqlite3_reset stmt >>= handleSqlResult sqlite
, stmtSetParam=setParam sqlite stmt
--- 124,128 ----
{ stmtConn = connection
, stmtClose = sqlite3_finalize stmt >>= handleSqlResult sqlite
! , stmtExecute= executePrepared defs sqlite stmt
, stmtReset = sqlite3_reset stmt >>= handleSqlResult sqlite
, stmtSetParam=setParam sqlite stmt
***************
*** 153,161 ****
})
getFieldDefs :: SQLite3Stmt -> CInt -> CInt -> IO [FieldDef]
getFieldDefs stmt index count
| index >= count = return []
| otherwise = do name <- sqlite3_column_name stmt index >>= peekCString
! defs <- getFieldDefs stmt (index+1) count
return ((name,SqlText,True):defs)
--- 154,169 ----
})
+ executePrepared [] sqlite stmt = do
+ sqlite3_step stmt
+ changes <- sqlite3_changes sqlite
+ return $! fromIntegral changes
+ executePrepared _ sqlite stmt = do
+ return (-1)
+
getFieldDefs :: SQLite3Stmt -> CInt -> CInt -> IO [FieldDef]
getFieldDefs stmt index count
| index >= count = return []
| otherwise = do name <- sqlite3_column_name stmt index >>= peekCString
! defs <- getFieldDefs stmt (index+1) count
return ((name,SqlText,True):defs)
|