From: <kr_...@us...> - 2005-12-15 13:45:02
|
Update of /cvsroot/htoolkit/HSQL/Oracle/Database/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/Database/HSQL Modified Files: Oracle.hsc Log Message: Remove all type signatures in the patterns. This makes the code Haskell98 compatible. The -fglasgow-exts OPTION is removed too. Index: Oracle.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/Oracle/Database/HSQL/Oracle.hsc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Oracle.hsc 15 Dec 2005 13:11:38 -0000 1.6 --- Oracle.hsc 15 Dec 2005 13:44:42 -0000 1.7 *************** *** 1,4 **** - {-# OPTIONS -fglasgow-exts #-} - ----------------------------------------------------------------------------------------- {-| Module : Database.HSQL.Oracle --- 1,2 ---- *************** *** 70,74 **** {-# NOINLINE myEnvironment #-} myEnvironment :: OCIEnvRef ! myEnvironment = unsafePerformIO $ alloca $ \ (pOCIEnv :: Ptr OCIEnv) -> do ociEnvCreate pOCIEnv (#const OCI_DEFAULT) nullPtr nullFunPtr nullFunPtr nullFunPtr 0 nullPtr >>= handleSqlResult nullPtr env <- peek pOCIEnv --- 68,72 ---- {-# NOINLINE myEnvironment #-} myEnvironment :: OCIEnvRef ! myEnvironment = unsafePerformIO $ alloca $ \ pOCIEnv -> do ociEnvCreate pOCIEnv (#const OCI_DEFAULT) nullPtr nullFunPtr nullFunPtr nullFunPtr 0 nullPtr >>= handleSqlResult nullPtr env <- peek pOCIEnv *************** *** 163,167 **** ociStmtExecute svcCtx stmt err 0 0 nullPtr nullPtr (#const OCI_DEFAULT) >>= handleSqlResult err fields <- allocaBytes (#const (sizeof(FIELD_DEF))) (getFieldDefs stmt 1) ! let offsets_arr_size :: CInt = fromIntegral (length fields * sizeOf offsets_arr_size) buffer <- mallocBytes (fromIntegral (foldr ((+) . sqlType2Size) offsets_arr_size fields)) definePositions stmt err buffer 0 offsets_arr_size fields --- 161,165 ---- ociStmtExecute svcCtx stmt err 0 0 nullPtr nullPtr (#const OCI_DEFAULT) >>= handleSqlResult err fields <- allocaBytes (#const (sizeof(FIELD_DEF))) (getFieldDefs stmt 1) ! let offsets_arr_size = fromIntegral (length fields * sizeOf offsets_arr_size) :: CInt buffer <- mallocBytes (fromIntegral (foldr ((+) . sqlType2Size) offsets_arr_size fields)) definePositions stmt err buffer 0 offsets_arr_size fields *************** *** 248,253 **** ociAttrGet par (#const OCI_DTYPE_PARAM) ((#ptr FIELD_DEF, colName) buffer) ((#ptr FIELD_DEF, colNameLen) buffer) (#const OCI_ATTR_OBJ_NAME) err >>= handleSqlResult err pName <- (#peek FIELD_DEF, colName) buffer ! (nameLen :: (#type ub4)) <- (#peek FIELD_DEF, colNameLen) buffer ! name <- peekCStringLen (pName, fromIntegral nameLen) ociAttrGet par (#const OCI_DTYPE_PARAM) ((#ptr FIELD_DEF, dtype) buffer) nullPtr (#const OCI_ATTR_PTYPE) err >>= handleSqlResult err ptype <- (#peek FIELD_DEF, dtype) buffer --- 246,251 ---- ociAttrGet par (#const OCI_DTYPE_PARAM) ((#ptr FIELD_DEF, colName) buffer) ((#ptr FIELD_DEF, colNameLen) buffer) (#const OCI_ATTR_OBJ_NAME) err >>= handleSqlResult err pName <- (#peek FIELD_DEF, colName) buffer ! nameLen <- (#peek FIELD_DEF, colNameLen) buffer ! name <- peekCStringLen (pName, fromIntegral (nameLen :: (#type ub4))) ociAttrGet par (#const OCI_DTYPE_PARAM) ((#ptr FIELD_DEF, dtype) buffer) nullPtr (#const OCI_ATTR_PTYPE) err >>= handleSqlResult err ptype <- (#peek FIELD_DEF, dtype) buffer *************** *** 299,309 **** dscale <- (#peek FIELD_DEF, dscale) buffer ociAttrGet par (#const OCI_DTYPE_PARAM) ((#ptr FIELD_DEF, isNull) buffer) nullPtr (#const OCI_ATTR_IS_NULL) err >>= handleSqlResult err ! (isNull :: (#type ub1)) <- (#peek FIELD_DEF, isNull) buffer ociAttrGet par (#const OCI_DTYPE_PARAM) ((#ptr FIELD_DEF, colName) buffer) ((#ptr FIELD_DEF, colNameLen) buffer) (#const OCI_ATTR_NAME) err >>= handleSqlResult err pColName <- (#peek FIELD_DEF, colName) buffer ! (colNameLen :: (#type ub4)) <- (#peek FIELD_DEF, colNameLen) buffer ! colName <- peekCStringLen (pColName, fromIntegral colNameLen) ociDescriptorFree par (#const OCI_DTYPE_PARAM) ! return (colName,mkSqlType dtype dsize dprec dscale,toBool (fromIntegral isNull)) beginTransaction myEnvironment svcCtx err = --- 297,307 ---- dscale <- (#peek FIELD_DEF, dscale) buffer ociAttrGet par (#const OCI_DTYPE_PARAM) ((#ptr FIELD_DEF, isNull) buffer) nullPtr (#const OCI_ATTR_IS_NULL) err >>= handleSqlResult err ! isNull <- (#peek FIELD_DEF, isNull) buffer ociAttrGet par (#const OCI_DTYPE_PARAM) ((#ptr FIELD_DEF, colName) buffer) ((#ptr FIELD_DEF, colNameLen) buffer) (#const OCI_ATTR_NAME) err >>= handleSqlResult err pColName <- (#peek FIELD_DEF, colName) buffer ! colNameLen <- (#peek FIELD_DEF, colNameLen) buffer ! colName <- peekCStringLen (pColName, fromIntegral (colNameLen :: (#type ub4))) ociDescriptorFree par (#const OCI_DTYPE_PARAM) ! return (colName,mkSqlType dtype dsize dprec dscale,toBool (fromIntegral (isNull :: (#type ub1)))) beginTransaction myEnvironment svcCtx err = *************** *** 327,332 **** getColValue :: Ptr () -> Int -> FieldDef -> (FieldDef -> CString -> Int -> IO a) -> IO a getColValue buffer colNumber fieldDef f = do ! (offset :: CInt) <- peek (castPtr buffer `advancePtr` colNumber) ! let valuePtr = castPtr buffer `plusPtr` fromIntegral offset valueLen <- strlen valuePtr f fieldDef valuePtr (fromIntegral valueLen) --- 325,330 ---- getColValue :: Ptr () -> Int -> FieldDef -> (FieldDef -> CString -> Int -> IO a) -> IO a getColValue buffer colNumber fieldDef f = do ! offset <- peek (castPtr buffer `advancePtr` colNumber) ! let valuePtr = castPtr buffer `plusPtr` fromIntegral (offset :: CInt) valueLen <- strlen valuePtr f fieldDef valuePtr (fromIntegral valueLen) |