You can subscribe to this list here.
2003 |
Jan
(30) |
Feb
(20) |
Mar
(151) |
Apr
(86) |
May
(23) |
Jun
(25) |
Jul
(107) |
Aug
(141) |
Sep
(55) |
Oct
(85) |
Nov
(65) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(22) |
Feb
(18) |
Mar
(3) |
Apr
(16) |
May
(69) |
Jun
(3) |
Jul
(1) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(6) |
Dec
(1) |
2005 |
Jan
(2) |
Feb
(16) |
Mar
|
Apr
|
May
|
Jun
(47) |
Jul
(1) |
Aug
|
Sep
(6) |
Oct
(4) |
Nov
|
Dec
(34) |
2006 |
Jan
(39) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
(26) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(8) |
Oct
(8) |
Nov
(22) |
Dec
(30) |
2009 |
Jan
(10) |
Feb
(13) |
Mar
(14) |
Apr
(14) |
May
(32) |
Jun
(25) |
Jul
(36) |
Aug
(10) |
Sep
(2) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
(9) |
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: <kr_...@us...> - 2006-01-05 20:14:31
|
Update of /cvsroot/htoolkit/HSQL/HSQL/Database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21065/Database Modified Files: HSQL.hsc Log Message: the stmtSetParam method needs the param index. Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL.hsc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** HSQL.hsc 4 Jan 2006 22:19:57 -0000 1.12 --- HSQL.hsc 5 Jan 2006 20:14:23 -0000 1.13 *************** *** 170,175 **** executePrepared :: Statement -> [SqlValue] -> IO Integer executePrepared stmt values = checkHandle (stmtClosed stmt) $ do ! mapM_ (stmtSetParam stmt) values stmtExecute stmt -- | 'fetch' fetches the next rowset of data from the result set. --- 170,180 ---- executePrepared :: Statement -> [SqlValue] -> IO Integer executePrepared stmt values = checkHandle (stmtClosed stmt) $ do ! setParameters 0 values stmtExecute stmt + where + setParameters paramNum [] = return () + setParameters paramNum (value:values) = paramNum `seq` do + stmtSetParam stmt paramNum value + setParameters (paramNum+1) values -- | 'fetch' fetches the next rowset of data from the result set. |
From: <kr_...@us...> - 2006-01-04 22:20:05
|
Update of /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30760/Database/HSQL Modified Files: Types.hs Log Message: stmtExecute should return Integer like connExecute Index: Types.hs =================================================================== RCS file: /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL/Types.hs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Types.hs 4 Jan 2006 21:00:09 -0000 1.5 --- Types.hs 4 Jan 2006 22:19:57 -0000 1.6 *************** *** 134,138 **** , stmtClose :: IO () , stmtSetParam :: SqlValue -> IO () ! , stmtExecute :: IO () , stmtFetch :: IO Bool , stmtGetCol :: forall a . Int -> FieldDef -> (FieldDef -> CString -> Int -> IO a) -> IO a --- 134,138 ---- , stmtClose :: IO () , stmtSetParam :: SqlValue -> IO () ! , stmtExecute :: IO Integer , stmtFetch :: IO Bool , stmtGetCol :: forall a . Int -> FieldDef -> (FieldDef -> CString -> Int -> IO a) -> IO a |
From: <kr_...@us...> - 2006-01-04 22:20:05
|
Update of /cvsroot/htoolkit/HSQL/HSQL/Database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30760/Database Modified Files: HSQL.hsc Log Message: stmtExecute should return Integer like connExecute Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL.hsc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** HSQL.hsc 4 Jan 2006 21:08:49 -0000 1.11 --- HSQL.hsc 4 Jan 2006 22:19:57 -0000 1.12 *************** *** 168,172 **** -- | 'fetch' fetches the next rowset of data from the result set. -- The values from columns can be retrieved with 'getFieldValue' function. ! executePrepared :: Statement -> [SqlValue] -> IO () executePrepared stmt values = checkHandle (stmtClosed stmt) $ do mapM_ (stmtSetParam stmt) values --- 168,172 ---- -- | 'fetch' fetches the next rowset of data from the result set. -- The values from columns can be retrieved with 'getFieldValue' function. ! executePrepared :: Statement -> [SqlValue] -> IO Integer executePrepared stmt values = checkHandle (stmtClosed stmt) $ do mapM_ (stmtSetParam stmt) values |
From: <kr_...@us...> - 2006-01-04 21:08:57
|
Update of /cvsroot/htoolkit/HSQL/HSQL/Database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13337/Database Modified Files: HSQL.hsc Log Message: fix comment Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL.hsc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** HSQL.hsc 4 Jan 2006 21:01:25 -0000 1.10 --- HSQL.hsc 4 Jan 2006 21:08:49 -0000 1.11 *************** *** 51,57 **** -- * Utilities ! , forEachRow -- :: (Statement -> s -> IO s) -- ^ an action ! , forEachRow' -- :: (Statement -> IO ()) -> Statement -> IO () ! , collectRows -- :: (Statement -> IO a) -> Statement -> IO [a] -- * Metadata --- 51,57 ---- -- * Utilities ! , forEachRow -- :: (Statement -> s -> IO s) -> Statement -> s -> IO s ! , forEachRow' -- :: (Statement -> IO ()) -> Statement -> IO () ! , collectRows -- :: (Statement -> IO a) -> Statement -> IO [a] -- * Metadata |
From: <kr_...@us...> - 2006-01-04 21:01:38
|
Update of /cvsroot/htoolkit/HSQL/HSQL/Database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11066/Database Modified Files: HSQL.hsc Log Message: fix comment Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL.hsc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** HSQL.hsc 4 Jan 2006 21:00:09 -0000 1.9 --- HSQL.hsc 4 Jan 2006 21:01:25 -0000 1.10 *************** *** 26,30 **** , query -- :: Connection -> String -> IO Statement , closeStatement -- :: Statement -> IO () ! , executePrepared -- :: Statement -> IO () , fetch -- :: Statement -> IO Bool --- 26,30 ---- , query -- :: Connection -> String -> IO Statement , closeStatement -- :: Statement -> IO () ! , executePrepared -- :: Statement -> [SqlValue] -> IO () , fetch -- :: Statement -> IO Bool |
From: <kr_...@us...> - 2006-01-04 21:00:44
|
Update of /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10357/Database/HSQL Modified Files: Types.hs Log Message: possible framework for prepared statements Index: Types.hs =================================================================== RCS file: /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL/Types.hs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Types.hs 3 Jan 2006 22:59:46 -0000 1.4 --- Types.hs 4 Jan 2006 21:00:09 -0000 1.5 *************** *** 7,10 **** --- 7,11 ---- import Foreign import Foreign.C + import System.Time type FieldDef = (String, SqlType, Bool) *************** *** 117,120 **** --- 118,122 ---- { connDisconnect :: IO () , connExecute :: String -> IO Integer + , connPrepare :: String -> IO Statement , connQuery :: String -> IO Statement , connTables :: IO [String] *************** *** 129,140 **** data Statement = Statement ! { stmtConn :: Connection ! , stmtClose :: IO () ! , stmtFetch :: IO Bool ! , stmtGetCol :: forall a . Int -> FieldDef -> (FieldDef -> CString -> Int -> IO a) -> IO a ! , stmtFields :: [FieldDef] ! , stmtClosed :: MVar Bool } class SqlBind a where --- 131,150 ---- data Statement = Statement ! { stmtConn :: Connection ! , stmtClose :: IO () ! , stmtSetParam :: SqlValue -> IO () ! , stmtExecute :: IO () ! , stmtFetch :: IO Bool ! , stmtGetCol :: forall a . Int -> FieldDef -> (FieldDef -> CString -> Int -> IO a) -> IO a ! , stmtFields :: [FieldDef] ! , stmtClosed :: MVar Bool } + data SqlValue = SqlStringValue String + | SqlIntValue Int + | SqlDoubleValue Double + | SqlBoolValue Bool + | SqlClockTimeValue ClockTime + | SqlNullValue class SqlBind a where |
From: <kr_...@us...> - 2006-01-04 21:00:44
|
Update of /cvsroot/htoolkit/HSQL/HSQL/Database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10357/Database Modified Files: HSQL.hsc Log Message: possible framework for prepared statements Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL.hsc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** HSQL.hsc 3 Jan 2006 22:59:46 -0000 1.8 --- HSQL.hsc 4 Jan 2006 21:00:09 -0000 1.9 *************** *** 22,32 **** -- the functions described here are used to perform SQL queries and commands. , execute -- :: Connection -> String -> IO Integer , Statement , query -- :: Connection -> String -> IO Statement , closeStatement -- :: Statement -> IO () , fetch -- :: Statement -> IO Bool -- * Retrieving Statement values and types ! , FieldDef, SqlType(..), SqlBind, toSqlValue , getFieldValue -- :: SqlBind a => Statement -> String -> IO a , getFieldValue' -- :: SqlBind a => Statement -> String -> a -> IO a --- 22,34 ---- -- the functions described here are used to perform SQL queries and commands. , execute -- :: Connection -> String -> IO Integer + , prepare -- :: Connection -> String -> IO Integer , Statement , query -- :: Connection -> String -> IO Statement , closeStatement -- :: Statement -> IO () + , executePrepared -- :: Statement -> IO () , fetch -- :: Statement -> IO Bool -- * Retrieving Statement values and types ! , FieldDef, SqlType(..), SqlValue(..), SqlBind, toSqlValue , getFieldValue -- :: SqlBind a => Statement -> String -> IO a , getFieldValue' -- :: SqlBind a => Statement -> String -> a -> IO a *************** *** 113,119 **** execute :: Connection -- ^ the database connection -> String -- ^ the text of SQL command ! -> IO Integer execute conn query = checkHandle (connClosed conn) (connExecute conn query) -- | Executes a query and returns a result set query :: Connection -- ^ the database connection --- 115,127 ---- execute :: Connection -- ^ the database connection -> String -- ^ the text of SQL command ! -> IO Integer -- ^ returns the number of affected rows execute conn query = checkHandle (connClosed conn) (connExecute conn query) + -- | Submits a command to the database. + prepare :: Connection -- ^ the database connection + -> String -- ^ the text of SQL command + -> IO Statement + prepare conn query = checkHandle (connClosed conn) (connPrepare conn query) + -- | Executes a query and returns a result set query :: Connection -- ^ the database connection *************** *** 160,163 **** --- 168,178 ---- -- | 'fetch' fetches the next rowset of data from the result set. -- The values from columns can be retrieved with 'getFieldValue' function. + executePrepared :: Statement -> [SqlValue] -> IO () + executePrepared stmt values = checkHandle (stmtClosed stmt) $ do + mapM_ (stmtSetParam stmt) values + stmtExecute stmt + + -- | 'fetch' fetches the next rowset of data from the result set. + -- The values from columns can be retrieved with 'getFieldValue' function. fetch :: Statement -> IO Bool fetch stmt = checkHandle (stmtClosed stmt) (stmtFetch stmt) *************** *** 276,279 **** --- 291,295 ---- toSqlValue s = show s + instance SqlBind String where fromSqlValue _ = Just *************** *** 553,556 **** --- 569,603 ---- showHex = showIntAtBase 16 intToDigit + instance SqlBind SqlValue where + fromSqlCStringLen (name,sqlType,_) cstr cstrLen + | cstr == nullPtr = return SqlNullValue + | otherwise = do + str <- peekCStringLen (cstr, cstrLen) + case fromSqlValue sqlType str of + Nothing -> throwDyn (SqlBadTypeCast name sqlType) + Just v -> return v + + fromSqlValue SqlInteger s = Just $! SqlIntValue $! read s + fromSqlValue SqlMedInt s = Just $! SqlIntValue $! read s + fromSqlValue SqlTinyInt s = Just $! SqlIntValue $! read s + fromSqlValue SqlSmallInt s = Just $! SqlIntValue $! read s + fromSqlValue SqlBigInt s = Just $! SqlIntValue $! read s + fromSqlValue (SqlDecimal _ _) s = Just $! SqlDoubleValue $! read s + fromSqlValue (SqlNumeric _ _) s = Just $! SqlDoubleValue $! read s + fromSqlValue SqlDouble s = Just $! SqlDoubleValue $! read s + fromSqlValue SqlReal s = Just $! SqlDoubleValue $! read s + fromSqlValue SqlFloat s = Just $! SqlDoubleValue $! read s + fromSqlValue SqlBit s = Just $! SqlBoolValue $! (s == "t") + fromSqlValue tp s = Just $! + case fromSqlValue tp s of + Just t -> SqlClockTimeValue t + Nothing -> SqlStringValue s + + toSqlValue (SqlIntValue v) = toSqlValue v + toSqlValue (SqlDoubleValue v) = toSqlValue v + toSqlValue (SqlBoolValue v) = toSqlValue v + toSqlValue (SqlClockTimeValue v) = toSqlValue v + toSqlValue (SqlStringValue v) = toSqlValue v + -- | Retrieves the value of column with the specified name. getFieldValue :: SqlBind a => Statement |
From: <kr_...@us...> - 2006-01-04 19:59:45
|
Update of /cvsroot/htoolkit/HSQL/MySQL/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24354/Database/HSQL Modified Files: MySQL.hsc Log Message: return the number of affected rows Index: MySQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MySQL/Database/HSQL/MySQL.hsc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MySQL.hsc 3 Jan 2006 22:59:46 -0000 1.5 --- MySQL.hsc 4 Jan 2006 19:59:36 -0000 1.6 *************** *** 49,52 **** --- 49,53 ---- foreign import #{CALLCONV} "HsMySQL.h mysql_error" mysql_error :: MYSQL -> IO CString foreign import #{CALLCONV} "HsMySQL.h mysql_query" mysql_query :: MYSQL -> CString -> IO CInt + foreign import #{CALLCONV} "HsMySQL.h mysql_affected_rows" mysql_affected_rows :: MYSQL -> IO (#type my_ulonglong) foreign import #{CALLCONV} "HsMySQL.h mysql_use_result" mysql_use_result :: MYSQL -> IO MYSQL_RES foreign import #{CALLCONV} "HsMySQL.h mysql_fetch_field" mysql_fetch_field :: MYSQL_RES -> IO MYSQL_FIELD *************** *** 99,105 **** , connTables = tables connection pMYSQL , connDescribe = describe connection pMYSQL ! , connBeginTransaction = execute pMYSQL "begin" ! , connCommitTransaction = execute pMYSQL "commit" ! , connRollbackTransaction = execute pMYSQL "rollback" , connClosed = refFalse } --- 100,106 ---- , connTables = tables connection pMYSQL , connDescribe = describe connection pMYSQL ! , connBeginTransaction = execute pMYSQL "begin" >> return () ! , connCommitTransaction = execute pMYSQL "commit" >> return () ! , connRollbackTransaction = execute pMYSQL "rollback" >> return () , connClosed = refFalse } *************** *** 110,114 **** res <- withCString query (mysql_query pMYSQL) when (res /= 0) (handleSqlError pMYSQL) ! return (-1) withStatement :: Connection -> MYSQL -> MYSQL_RES -> IO Statement --- 111,116 ---- res <- withCString query (mysql_query pMYSQL) when (res /= 0) (handleSqlError pMYSQL) ! nrows <- mysql_affected_rows pMYSQL ! return $! fromIntegral nrows withStatement :: Connection -> MYSQL -> MYSQL_RES -> IO Statement |
From: <kr_...@us...> - 2006-01-04 19:48:05
|
Update of /cvsroot/htoolkit/HSQL/ODBC/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19528/Database/HSQL Modified Files: ODBC.hsc Log Message: return the number of affected rows Index: ODBC.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/ODBC/Database/HSQL/ODBC.hsc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ODBC.hsc 3 Jan 2006 22:59:46 -0000 1.6 --- ODBC.hsc 4 Jan 2006 19:47:57 -0000 1.7 *************** *** 74,77 **** --- 74,78 ---- foreign import #{CALLCONV} "HsODBC.h SQLGetDiagRec" sqlGetDiagRec :: SQLSMALLINT -> SQLHANDLE -> SQLSMALLINT -> CString -> Ptr SQLINTEGER -> CString -> SQLSMALLINT -> Ptr SQLSMALLINT -> IO SQLRETURN foreign import #{CALLCONV} "HsODBC.h SQLExecDirect" sqlExecDirect :: HSTMT -> CString -> Int -> IO SQLRETURN + foreign import #{CALLCONV} "HsODBC.h SQLRowCount" sqlRowCount :: HSTMT -> Ptr SQLINTEGER -> IO SQLRETURN foreign import #{CALLCONV} "HsODBC.h SQLSetConnectOption" sqlSetConnectOption :: HDBC -> SQLUSMALLINT -> SQLULEN -> IO SQLRETURN foreign import #{CALLCONV} "HsODBC.h SQLTransact" sqlTransact :: HENV -> HDBC -> SQLUSMALLINT -> IO SQLRETURN *************** *** 194,200 **** res <- sqlExecDirect hSTMT pQuery len handleSqlResult (#const SQL_HANDLE_STMT) hSTMT res res <- sqlFreeStmt hSTMT (#const SQL_DROP) handleSqlResult (#const SQL_HANDLE_STMT) hSTMT res ! return (-1) stmtBufferSize = 256 --- 195,205 ---- res <- sqlExecDirect hSTMT pQuery len handleSqlResult (#const SQL_HANDLE_STMT) hSTMT res + numRows <- alloca $ \pNumRows -> do + res <- sqlRowCount hSTMT pNumRows + handleSqlResult (#const SQL_HANDLE_STMT) hSTMT res + peek pNumRows res <- sqlFreeStmt hSTMT (#const SQL_DROP) handleSqlResult (#const SQL_HANDLE_STMT) hSTMT res ! return $! fromIntegral numRows stmtBufferSize = 256 |
From: <kr_...@us...> - 2006-01-04 18:39:55
|
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 |
From: <kr_...@us...> - 2006-01-04 09:04:44
|
Update of /cvsroot/htoolkit/HSQL/Oracle/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15259/Database/HSQL Modified Files: Oracle.hsc Log Message: return the number of affected rows from execute method. Index: Oracle.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/Oracle/Database/HSQL/Oracle.hsc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Oracle.hsc 3 Jan 2006 22:59:46 -0000 1.9 --- Oracle.hsc 4 Jan 2006 09:04:36 -0000 1.10 *************** *** 146,155 **** withCStringLen query $ \(query,query_len) -> alloca $ \pStmt -> do ociHandleAlloc env pStmt (#const OCI_HTYPE_STMT) 0 nullPtr >>= handleSqlResult err stmt <- peek pStmt ociStmtPrepare stmt err query (fromIntegral query_len) (#const OCI_NTV_SYNTAX) (#const OCI_DEFAULT) >>= handleSqlResult err ociStmtExecute svcCtx stmt err 1 0 nullPtr nullPtr (#const OCI_DEFAULT) >>= handleSqlResult err ociHandleFree stmt (#const OCI_HTYPE_STMT) >>= handleSqlResult err ! return (-1) query connection envRef svcCtx err query = --- 146,158 ---- withCStringLen query $ \(query,query_len) -> alloca $ \pStmt -> do + alloca $ \pCount -> do ociHandleAlloc env pStmt (#const OCI_HTYPE_STMT) 0 nullPtr >>= handleSqlResult err stmt <- peek pStmt ociStmtPrepare stmt err query (fromIntegral query_len) (#const OCI_NTV_SYNTAX) (#const OCI_DEFAULT) >>= handleSqlResult err ociStmtExecute svcCtx stmt err 1 0 nullPtr nullPtr (#const OCI_DEFAULT) >>= handleSqlResult err + ociAttrGet stmt (#const OCI_HTYPE_STMT) pCount nullPtr (#const OCI_ATTR_ROW_COUNT) err >>= handleSqlResult err + count <- peek (pCount :: Ptr (#type ub4)) ociHandleFree stmt (#const OCI_HTYPE_STMT) >>= handleSqlResult err ! return $! fromIntegral count query connection envRef svcCtx err query = |
From: <kr_...@us...> - 2006-01-04 08:24:12
|
Update of /cvsroot/htoolkit/HSQL/SQLite3/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8096/Database/HSQL Modified Files: SQLite3.hsc Log Message: fixes for the new execute method. Index: SQLite3.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/SQLite3/Database/HSQL/SQLite3.hsc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SQLite3.hsc 3 Jan 2006 22:59:47 -0000 1.3 --- SQLite3.hsc 4 Jan 2006 08:23:59 -0000 1.4 *************** *** 78,84 **** , connTables = tables connection sqlite , connDescribe = describe connection sqlite ! , connBeginTransaction = execute sqlite "BEGIN TRANSACTION" ! , connCommitTransaction = execute sqlite "COMMIT TRANSACTION" ! , connRollbackTransaction = execute sqlite "ROLLBACK TRANSACTION" } return connection --- 78,84 ---- , connTables = tables connection sqlite , connDescribe = describe connection sqlite ! , connBeginTransaction = execute sqlite "BEGIN TRANSACTION" >> return () ! , connCommitTransaction = execute sqlite "COMMIT TRANSACTION" >> return () ! , connRollbackTransaction = execute sqlite "ROLLBACK TRANSACTION" >> return () } return connection *************** *** 96,100 **** res <- sqlite3_exec sqlite pQuery nullFunPtr nullPtr ppMsg handleSqlResult res ppMsg ! sqlite3_changes sqlite query :: Connection -> SQLite3 -> String -> IO Statement --- 96,101 ---- res <- sqlite3_exec sqlite pQuery nullFunPtr nullPtr ppMsg handleSqlResult res ppMsg ! changes <- sqlite3_changes sqlite ! return $! fromIntegral changes query :: Connection -> SQLite3 -> String -> IO Statement |
From: <kr_...@us...> - 2006-01-04 08:22:43
|
Update of /cvsroot/htoolkit/HSQL/SQLite/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7721/Database/HSQL Modified Files: SQLite2.hsc Log Message: use strict return. Index: SQLite2.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/SQLite/Database/HSQL/SQLite2.hsc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SQLite2.hsc 4 Jan 2006 08:19:49 -0000 1.3 --- SQLite2.hsc 4 Jan 2006 08:22:35 -0000 1.4 *************** *** 96,100 **** handleSqlResult res ppMsg changes <- sqlite_changes sqlite ! return (fromIntegral changes) query :: Connection -> SQLite -> String -> IO Statement --- 96,100 ---- handleSqlResult res ppMsg changes <- sqlite_changes sqlite ! return $! fromIntegral changes query :: Connection -> SQLite -> String -> IO Statement |
From: <kr_...@us...> - 2006-01-04 08:19:58
|
Update of /cvsroot/htoolkit/HSQL/SQLite/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7266/Database/HSQL Modified Files: SQLite2.hsc Log Message: fixes for the changed execute method. Index: SQLite2.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/SQLite/Database/HSQL/SQLite2.hsc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SQLite2.hsc 3 Jan 2006 22:59:47 -0000 1.2 --- SQLite2.hsc 4 Jan 2006 08:19:49 -0000 1.3 *************** *** 31,35 **** foreign import ccall sqlite_close :: SQLite -> IO () foreign import ccall sqlite_exec :: SQLite -> CString -> FunPtr () -> Ptr () -> Ptr CString -> IO CInt ! foreign import ccall sqlite_changes :: SQLite3 -> IO CInt foreign import ccall sqlite_get_table :: SQLite -> CString -> Ptr (Ptr CString) -> Ptr CInt -> Ptr CInt -> Ptr CString -> IO CInt foreign import ccall sqlite_free_table :: Ptr CString -> IO () --- 31,35 ---- foreign import ccall sqlite_close :: SQLite -> IO () foreign import ccall sqlite_exec :: SQLite -> CString -> FunPtr () -> Ptr () -> Ptr CString -> IO CInt ! foreign import ccall sqlite_changes :: SQLite -> IO CInt foreign import ccall sqlite_get_table :: SQLite -> CString -> Ptr (Ptr CString) -> Ptr CInt -> Ptr CInt -> Ptr CString -> IO CInt foreign import ccall sqlite_free_table :: Ptr CString -> IO () *************** *** 77,83 **** , connTables = tables connection sqlite , connDescribe = describe connection sqlite ! , connBeginTransaction = execute sqlite "BEGIN TRANSACTION" ! , connCommitTransaction = execute sqlite "COMMIT TRANSACTION" ! , connRollbackTransaction = execute sqlite "ROLLBACK TRANSACTION" } return connection --- 77,83 ---- , connTables = tables connection sqlite , connDescribe = describe connection sqlite ! , connBeginTransaction = execute sqlite "BEGIN TRANSACTION" >> return () ! , connCommitTransaction = execute sqlite "COMMIT TRANSACTION" >> return () ! , connRollbackTransaction = execute sqlite "ROLLBACK TRANSACTION" >> return () } return connection *************** *** 95,99 **** res <- sqlite_exec sqlite pQuery nullFunPtr nullPtr ppMsg handleSqlResult res ppMsg ! sqlite_changes sqlite query :: Connection -> SQLite -> String -> IO Statement --- 95,100 ---- res <- sqlite_exec sqlite pQuery nullFunPtr nullPtr ppMsg handleSqlResult res ppMsg ! changes <- sqlite_changes sqlite ! return (fromIntegral changes) query :: Connection -> SQLite -> String -> IO Statement |
From: <kr_...@us...> - 2006-01-03 22:59:57
|
Update of /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24722/HSQL/Database/HSQL Modified Files: Types.hs Log Message: The type of execute function is changed. Now it returns the number of the rows affected. Index: Types.hs =================================================================== RCS file: /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL/Types.hs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Types.hs 12 Dec 2005 15:21:55 -0000 1.3 --- Types.hs 3 Jan 2006 22:59:46 -0000 1.4 *************** *** 116,120 **** = Connection { connDisconnect :: IO () ! , connExecute :: String -> IO () , connQuery :: String -> IO Statement , connTables :: IO [String] --- 116,120 ---- = Connection { connDisconnect :: IO () ! , connExecute :: String -> IO Integer , connQuery :: String -> IO Statement , connTables :: IO [String] |
From: <kr_...@us...> - 2006-01-03 22:59:55
|
Update of /cvsroot/htoolkit/HSQL/SQLite/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24722/SQLite/Database/HSQL Modified Files: SQLite2.hsc Log Message: The type of execute function is changed. Now it returns the number of the rows affected. Index: SQLite2.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/SQLite/Database/HSQL/SQLite2.hsc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SQLite2.hsc 15 Dec 2005 13:27:05 -0000 1.1 --- SQLite2.hsc 3 Jan 2006 22:59:47 -0000 1.2 *************** *** 31,34 **** --- 31,35 ---- foreign import ccall sqlite_close :: SQLite -> IO () foreign import ccall sqlite_exec :: SQLite -> CString -> FunPtr () -> Ptr () -> Ptr CString -> IO CInt + foreign import ccall sqlite_changes :: SQLite3 -> IO CInt foreign import ccall sqlite_get_table :: SQLite -> CString -> Ptr (Ptr CString) -> Ptr CInt -> Ptr CInt -> Ptr CString -> IO CInt foreign import ccall sqlite_free_table :: Ptr CString -> IO () *************** *** 88,92 **** AppendMode -> (#const O_APPEND) ! execute :: SQLite -> String -> IO () execute sqlite query = withCString query $ \pQuery -> do --- 89,93 ---- AppendMode -> (#const O_APPEND) ! execute :: SQLite -> String -> IO Integer execute sqlite query = withCString query $ \pQuery -> do *************** *** 94,97 **** --- 95,99 ---- res <- sqlite_exec sqlite pQuery nullFunPtr nullPtr ppMsg handleSqlResult res ppMsg + sqlite_changes sqlite query :: Connection -> SQLite -> String -> IO Statement |
From: <kr_...@us...> - 2006-01-03 22:59:55
|
Update of /cvsroot/htoolkit/HSQL/SQLite3/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24722/SQLite3/Database/HSQL Modified Files: SQLite3.hsc Log Message: The type of execute function is changed. Now it returns the number of the rows affected. Index: SQLite3.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/SQLite3/Database/HSQL/SQLite3.hsc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SQLite3.hsc 12 Dec 2005 15:21:56 -0000 1.2 --- SQLite3.hsc 3 Jan 2006 22:59:47 -0000 1.3 *************** *** 32,35 **** --- 32,36 ---- foreign import ccall sqlite3_close :: SQLite3 -> IO () foreign import ccall sqlite3_exec :: SQLite3 -> CString -> FunPtr () -> Ptr () -> Ptr CString -> IO CInt + foreign import ccall sqlite3_changes :: SQLite3 -> IO CInt foreign import ccall sqlite3_get_table :: SQLite3 -> CString -> Ptr (Ptr CString) -> Ptr CInt -> Ptr CInt -> Ptr CString -> IO CInt foreign import ccall sqlite3_free_table :: Ptr CString -> IO () *************** *** 89,93 **** AppendMode -> (#const O_APPEND) ! execute :: SQLite3 -> String -> IO () execute sqlite query = withCString query $ \pQuery -> do --- 90,94 ---- AppendMode -> (#const O_APPEND) ! execute :: SQLite3 -> String -> IO Integer execute sqlite query = withCString query $ \pQuery -> do *************** *** 95,98 **** --- 96,100 ---- res <- sqlite3_exec sqlite pQuery nullFunPtr nullPtr ppMsg handleSqlResult res ppMsg + sqlite3_changes sqlite query :: Connection -> SQLite3 -> String -> IO Statement |
From: <kr_...@us...> - 2006-01-03 22:59:55
|
Update of /cvsroot/htoolkit/HSQL/PostgreSQL/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24722/PostgreSQL/Database/HSQL Modified Files: PostgreSQL.hsc Log Message: The type of execute function is changed. Now it returns the number of the rows affected. Index: PostgreSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/PostgreSQL/Database/HSQL/PostgreSQL.hsc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PostgreSQL.hsc 3 Jan 2006 21:01:30 -0000 1.3 --- PostgreSQL.hsc 3 Jan 2006 22:59:47 -0000 1.4 *************** *** 97,101 **** return connection where ! execute :: PGconn -> String -> IO () execute pConn sqlExpr = do pRes <- withCString sqlExpr (pqExec pConn) --- 97,101 ---- return connection where ! execute :: PGconn -> String -> IO Integer execute pConn sqlExpr = do pRes <- withCString sqlExpr (pqExec pConn) *************** *** 107,111 **** errMsg <- pqResultErrorMessage pRes >>= peekCString throwDyn (SqlError {seState="E", seNativeError=fromIntegral status, seErrorMsg=errMsg})) ! return () query :: Connection -> PGconn -> String -> IO Statement --- 107,111 ---- errMsg <- pqResultErrorMessage pRes >>= peekCString throwDyn (SqlError {seState="E", seNativeError=fromIntegral status, seErrorMsg=errMsg})) ! return (-1) query :: Connection -> PGconn -> String -> IO Statement |
From: <kr_...@us...> - 2006-01-03 22:59:54
|
Update of /cvsroot/htoolkit/HSQL/Oracle/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24722/Oracle/Database/HSQL Modified Files: Oracle.hsc Log Message: The type of execute function is changed. Now it returns the number of the rows affected. Index: Oracle.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/Oracle/Database/HSQL/Oracle.hsc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Oracle.hsc 15 Dec 2005 21:57:48 -0000 1.8 --- Oracle.hsc 3 Jan 2006 22:59:46 -0000 1.9 *************** *** 151,154 **** --- 151,155 ---- ociStmtExecute svcCtx stmt err 1 0 nullPtr nullPtr (#const OCI_DEFAULT) >>= handleSqlResult err ociHandleFree stmt (#const OCI_HTYPE_STMT) >>= handleSqlResult err + return (-1) query connection envRef svcCtx err query = |
From: <kr_...@us...> - 2006-01-03 22:59:54
|
Update of /cvsroot/htoolkit/HSQL/MySQL/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24722/MySQL/Database/HSQL Modified Files: MySQL.hsc Log Message: The type of execute function is changed. Now it returns the number of the rows affected. Index: MySQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MySQL/Database/HSQL/MySQL.hsc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MySQL.hsc 12 Dec 2005 21:33:50 -0000 1.4 --- MySQL.hsc 3 Jan 2006 22:59:46 -0000 1.5 *************** *** 106,113 **** return connection where ! execute :: MYSQL -> String -> IO () execute pMYSQL query = do res <- withCString query (mysql_query pMYSQL) when (res /= 0) (handleSqlError pMYSQL) withStatement :: Connection -> MYSQL -> MYSQL_RES -> IO Statement --- 106,114 ---- return connection where ! execute :: MYSQL -> String -> IO Integer execute pMYSQL query = do res <- withCString query (mysql_query pMYSQL) when (res /= 0) (handleSqlError pMYSQL) + return (-1) withStatement :: Connection -> MYSQL -> MYSQL_RES -> IO Statement |
From: <kr_...@us...> - 2006-01-03 22:59:54
|
Update of /cvsroot/htoolkit/HSQL/ODBC/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24722/ODBC/Database/HSQL Modified Files: ODBC.hsc Log Message: The type of execute function is changed. Now it returns the number of the rows affected. Index: ODBC.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/ODBC/Database/HSQL/ODBC.hsc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ODBC.hsc 12 Dec 2005 15:21:56 -0000 1.5 --- ODBC.hsc 3 Jan 2006 22:59:46 -0000 1.6 *************** *** 185,189 **** sqlFreeConnect hDBC >>= handleSqlResult (#const SQL_HANDLE_DBC) hDBC ! execute :: HDBC -> String -> IO () execute hDBC query = allocaBytes (#const sizeof(HSTMT)) $ \pStmt -> do --- 185,189 ---- sqlFreeConnect hDBC >>= handleSqlResult (#const SQL_HANDLE_DBC) hDBC ! execute :: HDBC -> String -> IO Integer execute hDBC query = allocaBytes (#const sizeof(HSTMT)) $ \pStmt -> do *************** *** 196,199 **** --- 196,200 ---- res <- sqlFreeStmt hSTMT (#const SQL_DROP) handleSqlResult (#const SQL_HANDLE_STMT) hSTMT res + return (-1) stmtBufferSize = 256 |
From: <kr_...@us...> - 2006-01-03 22:59:54
|
Update of /cvsroot/htoolkit/HSQL/MSI/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24722/MSI/Database/HSQL Modified Files: MSI.hsc Log Message: The type of execute function is changed. Now it returns the number of the rows affected. Index: MSI.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MSI/Database/HSQL/MSI.hsc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MSI.hsc 12 Dec 2005 15:21:56 -0000 1.4 --- MSI.hsc 3 Jan 2006 22:59:46 -0000 1.5 *************** *** 57,61 **** msiCloseHandle hDatabase >>= checkResult ! execute :: MSIHANDLE -> String -> IO () execute hDatabase query = withCString query $ \cquery -> --- 57,61 ---- msiCloseHandle hDatabase >>= checkResult ! execute :: MSIHANDLE -> String -> IO Integer execute hDatabase query = withCString query $ \cquery -> *************** *** 65,68 **** --- 65,69 ---- msiViewExecute hView 0 >>= checkResult msiCloseHandle hView >>= checkResult + return (-1) col_buffer_size = 1024 |
From: <kr_...@us...> - 2006-01-03 22:59:54
|
Update of /cvsroot/htoolkit/HSQL/HSQL/Database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24722/HSQL/Database Modified Files: HSQL.hsc Log Message: The type of execute function is changed. Now it returns the number of the rows affected. Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL.hsc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HSQL.hsc 3 Jan 2006 22:14:32 -0000 1.7 --- HSQL.hsc 3 Jan 2006 22:59:46 -0000 1.8 *************** *** 21,25 **** -- | Once a connection to a database has been successfully established, -- the functions described here are used to perform SQL queries and commands. ! , execute -- :: Connection -> String -> IO () , Statement , query -- :: Connection -> String -> IO Statement --- 21,25 ---- -- | Once a connection to a database has been successfully established, -- the functions described here are used to perform SQL queries and commands. ! , execute -- :: Connection -> String -> IO Integer , Statement , query -- :: Connection -> String -> IO Statement *************** *** 113,117 **** execute :: Connection -- ^ the database connection -> String -- ^ the text of SQL command ! -> IO () execute conn query = checkHandle (connClosed conn) (connExecute conn query) --- 113,117 ---- execute :: Connection -- ^ the database connection -> String -- ^ the text of SQL command ! -> IO Integer execute conn query = checkHandle (connClosed conn) (connExecute conn query) |
From: <kr_...@us...> - 2006-01-03 22:14:44
|
Update of /cvsroot/htoolkit/HSQL/HSQL/Database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14758/Database Modified Files: HSQL.hsc Log Message: - added getColumnValue(') to export list. - added getColumnValueType function Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL.hsc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HSQL.hsc 3 Jan 2006 22:09:15 -0000 1.6 --- HSQL.hsc 3 Jan 2006 22:14:32 -0000 1.7 *************** *** 30,36 **** , FieldDef, SqlType(..), SqlBind, toSqlValue , getFieldValue -- :: SqlBind a => Statement -> String -> IO a - , getFieldValueMB , getFieldValue' -- :: SqlBind a => Statement -> String -> a -> IO a , getFieldValueType -- :: Statement -> String -> (SqlType, Bool) , getFieldsTypes -- :: Statement -> [(String, SqlType, Bool)] --- 30,39 ---- , FieldDef, SqlType(..), SqlBind, toSqlValue , getFieldValue -- :: SqlBind a => Statement -> String -> IO a , getFieldValue' -- :: SqlBind a => Statement -> String -> a -> IO a + , getColumnValue -- :: SqlBind a => Statement -> Int -> IO a + , getColumnValue' -- :: SqlBind a => Statement -> Int -> a -> IO a + , getFieldValueMB , getFieldValueType -- :: Statement -> String -> (SqlType, Bool) + , getColumnValueType-- :: Statement -> Int -> FieldDef , getFieldsTypes -- :: Statement -> [(String, SqlType, Bool)] *************** *** 173,176 **** --- 176,183 ---- (sqlType,nullable,colNumber) = findFieldInfo name (stmtFields stmt) 0 + -- | Returns the type and the @nullable@ flag for field with specified name + getColumnValueType :: Statement -> Int -> FieldDef + getColumnValueType stmt index = findColumnInfo (stmtFields stmt) index + -- | Returns the list of fields with their types and @nullable@ flags getFieldsTypes :: Statement -> [(String, SqlType, Bool)] |
From: <kr_...@us...> - 2006-01-03 22:09:26
|
Update of /cvsroot/htoolkit/HSQL/HSQL/Database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13563/Database Modified Files: HSQL.hsc Log Message: added getColumnValue(') functions. They can be used to get field values by index. Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/HSQL/Database/HSQL.hsc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HSQL.hsc 15 Dec 2005 20:59:51 -0000 1.5 --- HSQL.hsc 3 Jan 2006 22:09:15 -0000 1.6 *************** *** 183,186 **** --- 183,192 ---- | otherwise = findFieldInfo name fields $! (colNumber+1) + findColumnInfo :: [FieldDef] -> Int -> FieldDef + findColumnInfo (field:fields) colNumber + | colNumber == 0 = field + | colNumber > 0 = findColumnInfo fields $! (colNumber-1) + findColumnInfo _ colNumber = throwDyn (SqlUnknownField ('#':show colNumber)) + ----------------------------------------------------------------------------------------- -- binding *************** *** 540,558 **** showHex = showIntAtBase 16 intToDigit ! -- | Retrieves the value of field with the specified name. getFieldValue :: SqlBind a => Statement -> String -- ^ Field name -> IO a -- ^ Field value ! getFieldValue stmt name = do stmtGetCol stmt colNumber (name,sqlType,nullable) fromSqlCStringLen where (sqlType,nullable,colNumber) = findFieldInfo name (stmtFields stmt) 0 ! {-# DEPRECATED getFieldValueMB "Use getFieldValue instead." #-} ! getFieldValueMB :: SqlBind a => Statement -> String -> IO (Maybe a) ! getFieldValueMB = getFieldValue ! ! -- | Retrieves the value of field with the specified name. ! -- If the field value is @null@ then the function will return the default value. getFieldValue' :: SqlBind a => Statement -> String -- ^ Field name --- 546,560 ---- showHex = showIntAtBase 16 intToDigit ! -- | Retrieves the value of column with the specified name. getFieldValue :: SqlBind a => Statement -> String -- ^ Field name -> IO a -- ^ Field value ! getFieldValue stmt name = stmtGetCol stmt colNumber (name,sqlType,nullable) fromSqlCStringLen where (sqlType,nullable,colNumber) = findFieldInfo name (stmtFields stmt) 0 ! -- | Retrieves the value of column with the specified name. ! -- If the column value is @null@ then the function will return the default value. getFieldValue' :: SqlBind a => Statement -> String -- ^ Field name *************** *** 563,566 **** --- 565,590 ---- return (case mb_v of { Nothing -> def; Just a -> a }) + -- | Retrieves the value of column with the specified index. + getColumnValue :: SqlBind a => Statement + -> Int -- ^ Column index + -> IO a -- ^ Column value + getColumnValue stmt index = + fieldDef `seq` stmtGetCol stmt index fieldDef fromSqlCStringLen + where + fieldDef = findColumnInfo (stmtFields stmt) index + + -- | Retrieves the value of column with the specified index. + -- If the column value is @null@ then the function will return the default value. + getColumnValue' :: SqlBind a => Statement + -> Int -- ^ Column index + -> a -- ^ Default value + -> IO a -- ^ Column value + getColumnValue' stmt index def = do + mb_v <- getColumnValue stmt index + return (case mb_v of { Nothing -> def; Just a -> a }) + + {-# DEPRECATED getFieldValueMB "Use getFieldValue instead." #-} + getFieldValueMB :: SqlBind a => Statement -> String -> IO (Maybe a) + getFieldValueMB = getFieldValue ----------------------------------------------------------------------------------------- |