Update of /cvsroot/htoolkit/HSQL/PostgreSQL/Database/HSQL
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25197/Database/HSQL
Modified Files:
PostgreSQL.hsc
Log Message:
* fix the spaceleak reported from John Goerzen
* execute method now returns the right number of affected rows
Index: PostgreSQL.hsc
===================================================================
RCS file: /cvsroot/htoolkit/HSQL/PostgreSQL/Database/HSQL/PostgreSQL.hsc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** PostgreSQL.hsc 3 Jan 2006 22:59:47 -0000 1.4
--- PostgreSQL.hsc 4 Jan 2006 18:39:47 -0000 1.5
***************
*** 45,49 ****
--- 45,51 ----
foreign import ccall "libpq-fe.h PQfinish" pqFinish :: PGconn -> IO ()
foreign import ccall "libpq-fe.h PQexec" pqExec :: PGconn -> CString -> IO PGresult
+ foreign import ccall "libpq-fe.h PQclear" pqClear :: PGresult -> IO ()
foreign import ccall "libpq-fe.h PQresultStatus" pqResultStatus :: PGresult -> IO ExecStatusType
+ foreign import ccall "libpq-fe.h PQcmdTuples" pqCmdTuples :: PGresult -> IO CString
foreign import ccall "libpq-fe.h PQresStatus" pqResStatus :: ExecStatusType -> IO CString
foreign import ccall "libpq-fe.h PQresultErrorMessage" pqResultErrorMessage :: PGresult -> IO CString
***************
*** 90,96 ****
, connTables = tables connection pConn
, connDescribe = describe connection pConn
! , connBeginTransaction = execute pConn "begin"
! , connCommitTransaction = execute pConn "commit"
! , connRollbackTransaction = execute pConn "rollback"
, connClosed = refFalse
}
--- 92,98 ----
, connTables = tables connection pConn
, connDescribe = describe connection pConn
! , connBeginTransaction = execute pConn "begin" >> return ()
! , connCommitTransaction = execute pConn "commit" >> return ()
! , connRollbackTransaction = execute pConn "rollback" >> return ()
, connClosed = refFalse
}
***************
*** 107,111 ****
errMsg <- pqResultErrorMessage pRes >>= peekCString
throwDyn (SqlError {seState="E", seNativeError=fromIntegral status, seErrorMsg=errMsg}))
! return (-1)
query :: Connection -> PGconn -> String -> IO Statement
--- 109,117 ----
errMsg <- pqResultErrorMessage pRes >>= peekCString
throwDyn (SqlError {seState="E", seNativeError=fromIntegral status, seErrorMsg=errMsg}))
! cstr <- pqCmdTuples pRes
! if cstr == nullPtr
! then return (-1)
! else do str <- peekCString cstr
! return $! read str
query :: Connection -> PGconn -> String -> IO Statement
***************
*** 125,129 ****
return (Statement
{ stmtConn = conn
! , stmtClose = return ()
, stmtFetch = fetch tupleIndex countTuples
, stmtGetCol = getColValue pRes tupleIndex countTuples
--- 131,135 ----
return (Statement
{ stmtConn = conn
! , stmtClose = pqClear pRes
, stmtFetch = fetch tupleIndex countTuples
, stmtGetCol = getColValue pRes tupleIndex countTuples
|