Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/libraries/Cabal/tests/HSQL/examples/Main.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module Main where

import Control.Exception
import Database.HSQL.ODBC
import Queries

-- Change the following definitions to connect to
-- another data source
datasource = "HSQL_Example"
user_id    = ""
password   = ""

main = handleSql print $ do
	bracket (connect datasource user_id password) disconnect $ \c ->
		inTransaction c $ \c -> do
			createTables c
			insertRecords c
			retrieveRecords c
			rs <- retrieveRecords c
			
			putStrLn " Records inserted in table Test are: "
			putStrLn "*************************************"
			mapM print rs
			putStrLn "*************************************"
			putStrLn ""
			
			putStrLn " The tables in your database are:    "
			putStrLn "*************************************"
			mi <- getMetaInfo c
			mapM print mi
			putStrLn "*************************************"
			putStrLn ""
			
			dropTables c

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.