-- This is written in Haskell. {-- HBase -- general-purpose libraries for Haskell Copyright (C) 2002 Ashley Yakeley This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --} module Foreign.MySQL.Raw where { import Foreign.MySQL.RawField; import HBase; import Foreign.C; import Foreign; newtype MySQLSession = MkMySQLSession (Ptr ()) deriving HasNothing; newtype ResultCode = MkResultCode Int32; foreign import ccall "mysql/mysql.h mysql_init" rawInit :: MySQLSession -> IO MySQLSession; foreign import ccall "mysql/mysql.h mysql_close" rawClose :: MySQLSession -> IO (); foreign import ccall "mysql/mysql.h mysql_real_connect" rawRealConnect :: MySQLSession -> CStringPtr -> CStringPtr -> CStringPtr -> CStringPtr -> Word32 -> CStringPtr -> Word32 -> IO MySQLSession; foreign import ccall "mysql/mysql.h mysql_errno" rawErrno :: MySQLSession -> IO Word32; foreign import ccall "mysql/mysql.h mysql_error" rawError :: MySQLSession -> IO CString; foreign import ccall "mysql/mysql.h mysql_real_query" rawRealQuery :: MySQLSession -> CStringPtr -> Word32 -> IO ResultCode; foreign import ccall "mysql/mysql.h mysql_field_count" rawFieldCount :: MySQLSession -> IO Word32; newtype MySQLResult = MkMySQLResult (Ptr ()); foreign import ccall "mysql/mysql.h mysql_use_result" rawUseResult :: MySQLSession -> IO MySQLResult; foreign import ccall "mysql/mysql.h mysql_store_result" rawStoreResult :: MySQLSession -> IO MySQLResult; foreign import ccall "mysql/mysql.h mysql_free_result" rawFreeResult :: MySQLResult -> IO (); foreign import ccall "mysql/mysql.h mysql_fetch_field" rawFetchField :: MySQLResult -> IO (Ptr RawField); type RawRow = Ptr CStringPtr; foreign import ccall "mysql/mysql.h mysql_fetch_row" rawFetchRow :: MySQLResult -> IO RawRow; foreign import ccall "mysql/mysql.h mysql_fetch_lengths" rawFetchLengths :: MySQLResult -> IO (Ptr Word32); }