├── .gitignore ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── sirocco-docs ├── src │ └── docs │ │ └── asciidoc │ │ ├── chapter │ │ ├── connection.adoc │ │ ├── execute.adoc │ │ ├── update.adoc │ │ └── query.adoc │ │ └── index.adoc └── build.gradle ├── sirocco-core ├── src │ └── main │ │ └── frege │ │ └── sirocco │ │ ├── Util.fr │ │ ├── Sirocco.fr │ │ ├── FDBC.fr │ │ └── JDBC.fr └── build.gradle ├── sirocco-sample ├── src │ └── main │ │ └── frege │ │ └── songs │ │ ├── data │ │ ├── Json.fr │ │ └── Bands.fr │ │ ├── db │ │ ├── Db.fr │ │ └── Bands.fr │ │ ├── App.fr │ │ ├── init │ │ └── Fixtures.fr │ │ └── handler │ │ └── Bands.fr └── build.gradle ├── CHANGELOG.md ├── README.md ├── .travis.yml ├── gradlew.bat ├── gradlew └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.class 3 | .gradle/ 4 | .nb-gradle/ 5 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include 'sirocco-core' 2 | include 'sirocco-docs' 3 | include 'sirocco-sample' 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fregelab/sirocco/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | releaseGroup=com.github.fregelab 2 | releaseVersion=0.1.2 3 | releaseDescription=Sirocco is a Frege (http://frege-lang.org) library to access relational databases. 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Dec 08 01:27:28 CET 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-bin.zip 7 | -------------------------------------------------------------------------------- /sirocco-docs/src/docs/asciidoc/chapter/connection.adoc: -------------------------------------------------------------------------------- 1 | == Connection 2 | 3 | To create a connection: 4 | 5 | [source,haskell] 6 | ---- 7 | include::{sampleSrc}/songs/db/Db.fr[] 8 | ---- 9 | 10 | <1> String representing the `jdbc` uri 11 | <2> `sirocco.Sirocco.createConnection` function to connect to the database 12 | -------------------------------------------------------------------------------- /sirocco-core/src/main/frege/sirocco/Util.fr: -------------------------------------------------------------------------------- 1 | module sirocco.Util where 2 | 3 | {-- 4 | This function is very useful, it extracts a value wrapped in a Right. It Left then 5 | it throws an error 6 | -} 7 | fromRight :: Either a b -> b 8 | fromRight (Left _) = error "Either.Unwrap.fromRight: Argument takes form 'Left _'" -- yuck 9 | fromRight (Right x) = x 10 | -------------------------------------------------------------------------------- /sirocco-sample/src/main/frege/songs/data/Json.fr: -------------------------------------------------------------------------------- 1 | {-- 2 | This module handles how Band instances are created 3 | -} 4 | module songs.data.Json where 5 | 6 | import Data.JSON 7 | import Data.List 8 | 9 | {-- 10 | Reducing boiler plate code when converting 11 | any instance to JSON 12 | -} 13 | render :: (ToJSON a) => a -> Maybe String 14 | render = Just . show . toJSON 15 | -------------------------------------------------------------------------------- /sirocco-sample/src/main/frege/songs/db/Db.fr: -------------------------------------------------------------------------------- 1 | {-- 2 | This module configures the database connection config 3 | -} 4 | module songs.db.Db where 5 | 6 | import sirocco.JDBC (Connection) 7 | import sirocco.Sirocco (createConnection) 8 | 9 | databaseURI = "jdbc:h2:~/test" -- <1> 10 | 11 | --- Creates a new connection 12 | connection :: IO Connection 13 | connection = createConnection databaseURI "sa" "" -- <2> 14 | -------------------------------------------------------------------------------- /sirocco-docs/src/docs/asciidoc/chapter/execute.adoc: -------------------------------------------------------------------------------- 1 | == Execute 2 | 3 | `Sirocco.execute` can be used when defining database structures 4 | (create, drop, alter...): 5 | 6 | [source,haskell] 7 | ---- 8 | include::{coreSrc}/sirocco/Sirocco.fr[tags=execute] 9 | ---- 10 | 11 | It only returns a `Bool` value indicating whether the action was a 12 | success or a failure. 13 | 14 | [source,haskell] 15 | ---- 16 | include::{sampleSrc}/songs/init/Fixtures.fr[tags=execute] 17 | ---- 18 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | ## [0.1.2] 2016-05-10 5 | ### Changed 6 | - project group id changed to com.github.fregelab 7 | 8 | ### Added 9 | - update insert returning the generated key 10 | 11 | ## [0.1.1] 2016-02-15 12 | ### Changed 13 | - Upgrade Chinook version to 0.2.0 (chinook-sample) 14 | 15 | ## [0.1.0] 2016-02-05 16 | ### Added 17 | - Add Travis integration 18 | - Upgrade Frege/Gradle plugin 19 | -------------------------------------------------------------------------------- /sirocco-sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: "org.frege-lang" 3 | apply plugin: 'application' 4 | 5 | repositories { 6 | maven { 7 | url "http://dl.bintray.com/januslynd/maven" 8 | } 9 | } 10 | 11 | dependencies { 12 | compile project (':sirocco-core') 13 | compile 'com.h2database:h2:1.4.187' 14 | compile 'com.github.januslynd:chinook-core:0.2.0' 15 | } 16 | 17 | compileFrege.dependsOn 'compileJava' 18 | 19 | mainClassName = "songs.App" 20 | -------------------------------------------------------------------------------- /sirocco-docs/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | } 5 | 6 | dependencies { 7 | classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2' 8 | } 9 | } 10 | 11 | apply plugin: 'org.asciidoctor.convert' 12 | 13 | asciidoctor { 14 | attributes 'source-highlighter': 'prettify', 15 | toc : 'left', 16 | icons : 'font', 17 | toclevels : 3, 18 | 'pdf-style' : 'default' 19 | } 20 | -------------------------------------------------------------------------------- /sirocco-sample/src/main/frege/songs/App.fr: -------------------------------------------------------------------------------- 1 | module songs.App where 2 | 3 | import chinook.Router 4 | import chinook.Chinook 5 | import songs.init.Fixtures 6 | import songs.handler.Bands as Handler 7 | 8 | -- Application entry point 9 | main _ = do 10 | -- Execute fixtures 11 | createDrop 12 | loadFixtures 13 | -- Endpoints 14 | Chinook.run [] [ 15 | "/bands" + [ 16 | Get "" Handler.list, 17 | Get "/:id" Handler.byId, 18 | Delete "/:id" Handler.deleteById 19 | ] 20 | ] 21 | -------------------------------------------------------------------------------- /sirocco-docs/src/docs/asciidoc/chapter/update.adoc: -------------------------------------------------------------------------------- 1 | == Update 2 | 3 | `Sirocco.update` can be used when manipulating the database (delete, 4 | insert, update): 5 | 6 | [source,haskell] 7 | ---- 8 | include::{coreSrc}/sirocco/Sirocco.fr[tags=update] 9 | ---- 10 | 11 | It will return the number of rows affected for the SQL statement. 12 | 13 | [source,haskell] 14 | ---- 15 | include::{sampleSrc}/songs/db/Bands.fr[tags=deleteBandById] 16 | ---- 17 | 18 | <1> Query 19 | <2> Params 20 | <3> Query execution 21 | 22 | Many times if your table has an auto-generated primary key, it comes 23 | handy to know the primary key of the record you have just 24 | inserted. For this you can use the following function: 25 | 26 | [source,haskell] 27 | ---- 28 | include::{coreSrc}/sirocco/Sirocco.fr[tags=insertAndReturnGeneratedKey] 29 | ---- -------------------------------------------------------------------------------- /sirocco-docs/src/docs/asciidoc/index.adoc: -------------------------------------------------------------------------------- 1 | = Sirocco 2 | :revnumber: 0.1.2 3 | :numbered: 4 | :imagesDir: images/ 5 | :baseDir: ../../../../.. 6 | :stem: 7 | 8 | :coreBase: {baseDir}/sirocco-core 9 | :sampleBase: {baseDir}/sirocco-sample 10 | 11 | :coreSrc: {coreBase}/src/main/frege 12 | :sampleSrc: {sampleBase}/src/main/frege 13 | 14 | "Sirocco, scirocco, /sɪˈrɒkoʊ/, jugo or, rarely, siroc (Catalan: Xaloc, Greek: Σορόκος, Spanish: Siroco, Occitan: Siròc, Eisseròc) is a Mediterranean wind that comes from the Sahara and can reach hurricane speeds in North Africa and Southern Europe." 15 | -- Wikipedia 16 | 17 | `Sirocco` is a small database abstraction on top of `jdbc`. 18 | 19 | include::chapter/connection.adoc[] 20 | 21 | include::chapter/query.adoc[] 22 | 23 | include::chapter/execute.adoc[] 24 | 25 | include::chapter/update.adoc[] 26 | -------------------------------------------------------------------------------- /sirocco-sample/src/main/frege/songs/data/Bands.fr: -------------------------------------------------------------------------------- 1 | {-- 2 | This module handles how Band instances are created 3 | -} 4 | module songs.data.Bands where 5 | 6 | import Data.JSON 7 | import Data.List 8 | 9 | data Band = Band { id :: Long, 10 | name :: String, 11 | year :: Long} 12 | 13 | derive Show Band 14 | 15 | {-- 16 | Converts a Band to JSON representation 17 | -} 18 | instance ToJSON Band where 19 | toJSON Band {id, name, year} = 20 | Struct [ 21 | assoc "id" id, 22 | assoc "name" name, 23 | assoc "year" year 24 | ] 25 | 26 | {-- 27 | Creates a Band from a JSON document 28 | -} 29 | instance FromJSON Band where 30 | fromJSON v = case v of 31 | -- PARSING OK 32 | Struct s -> do 33 | id <- field "id" s 34 | name <- field "name" s 35 | year <- field "year" s 36 | return Band {id, name, year} 37 | -- PARSING KO 38 | _ -> fail ("expected {\"name\" : ...}, found " ++ show v) 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/fregelab/sirocco.svg?branch=master)](https://travis-ci.org/fregelab/sirocco) 2 | [![Bintray](https://img.shields.io/bintray/v/fregelab/maven/sirocco-core.svg?style=flat-square)](https://bintray.com/fregelab/maven/sirocco-core) 3 | 4 | # Sirocco 5 | 6 | Sirocco is a Frege library to access relational databases via jdbc. 7 | Documentation is available at https://fregelab.github.io/sirocco 8 | 9 | Sirocco first started as some ideas based on project: 10 | https://github.com/DellCliff/frege-dbc 11 | 12 | ## Dependencies 13 | 14 | Binaries are available at Bintray: 15 | 16 | repositories { 17 | maven { 18 | url "http://dl.bintray.com/fregelab/maven" 19 | } 20 | } 21 | 22 | Gradle dependencies: 23 | 24 | compile 'com.github.fregelab:sirocco-core:0.1.2' 25 | 26 | ## Examples 27 | 28 | The `sirocco-samples` project joins `Sirocco` and `Chinook` together 29 | to show how a full Frege app may look like. To run the app, on the 30 | project root folder: 31 | 32 | ./gradlew :sirocco-samples:run 33 | 34 | Or to only play with the code: 35 | 36 | ./gradlew :sirocco-samples:fregeRepl 37 | -------------------------------------------------------------------------------- /sirocco-sample/src/main/frege/songs/init/Fixtures.fr: -------------------------------------------------------------------------------- 1 | {-- 2 | This module loads a basic set of data to start playing 3 | with the application 4 | -} 5 | module songs.init.Fixtures where 6 | 7 | import sirocco.Sirocco 8 | import songs.db.Db 9 | 10 | -- tag::execute[] 11 | --- Drops the Bands table 12 | dropBandTable :: IO () 13 | dropBandTable = do 14 | records <- execute connection $ Just "DROP TABLE bands" 15 | println $ "Table bands deleted" 16 | 17 | --- Creates the Bands table 18 | createBandTable :: IO () 19 | createBandTable = do 20 | stmt <- execute connection $ Just "CREATE TABLE bands (id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, name TEXT NOT NULL, year INTEGER NOT NULL)" 21 | println $ "Table bands created" 22 | -- end::execute[] 23 | 24 | createDrop :: IO () 25 | createDrop = do 26 | _ <- dropBandTable 27 | `catch` \(e :: Exception) -> return () 28 | `finally` (println "Table already gone") 29 | createBandTable 30 | 31 | 32 | --- Inserts some bands to populate the database 33 | loadFixtures :: IO () 34 | loadFixtures = do 35 | _ <- execute connection $ Just "INSERT INTO bands (name, year) values ('Whitesnake', 1978)" 36 | _ <- execute connection $ Just "INSERT INTO bands (name, year) values ('Iron Maiden', 1975)" 37 | _ <- execute connection $ Just "INSERT INTO bands (name, year) values ('Metallica', 1981)" 38 | _ <- execute connection $ Just "INSERT INTO bands (name, year) values ('Helloween', 1984)" 39 | println $ "List of bands inserted" 40 | -------------------------------------------------------------------------------- /sirocco-sample/src/main/frege/songs/handler/Bands.fr: -------------------------------------------------------------------------------- 1 | {-- 2 | This module handles requests and response for 3 | Band resources. 4 | -} 5 | module songs.handler.Bands where 6 | 7 | import chinook.Core 8 | import songs.db.Bands as DB 9 | import songs.data.Json as JSON 10 | 11 | {-- 12 | List all available bands 13 | -} 14 | list :: IO Request -> IO Response 15 | list req = do 16 | bands <- DB.findAll 17 | return response.{ output = JSON.render bands } 18 | 19 | {-- 20 | Gets a specific band by its id 21 | -} 22 | byId :: IO Request -> IO Response 23 | byId req = do 24 | id <- req.path ":id" 25 | band <- DB.findById id 26 | return $ case band of 27 | Just b -> response.{ output = JSON.render b } 28 | Nothing -> badRequestResponse 29 | 30 | 31 | deleteById :: IO Request -> IO Response 32 | deleteById req = do 33 | id <- getIdFromParam $ req.path ":id" 34 | case id of 35 | Right idInt -> deletedResponse $ DB.deleteBandById $ Just idInt 36 | Left e -> return badRequestResponse 37 | 38 | getIdFromParam :: IO (Maybe String) -> IO (Either NumberFormatException Int) 39 | getIdFromParam param = do 40 | id <- param 41 | return $ case id of 42 | Just x -> x.int 43 | Nothing -> "".int 44 | 45 | badRequestResponse :: Response 46 | badRequestResponse = response.{ status = 400 } 47 | 48 | -- #TODO JSON is not shown...FIX 49 | deletedResponse :: IO Int -> IO Response 50 | deletedResponse rows = do 51 | howMany <- rows 52 | return response.{ status = 204, 53 | output = JSON.render ("affected.rows." ++ (show howMany)) } 54 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | before_cache: 5 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 6 | cache: 7 | directories: 8 | - "$HOME/.gradle/caches/" 9 | - "$HOME/.gradle/wrapper/" 10 | env: 11 | global: 12 | - secure: h/5xX1pPWw7S1VDagy6s5lHY/4LAn7n/yM8nLN71W5f8vseJessouDXKVpCPZjiN+UuHrIl+vkhLFBuT6OjOaUno6JiIRJ+tmVhtYD3gOVH2QjvWYUvfT+wj+C+pno2UqLYz9xe6hW6BxA47hj5a5vShs6XiddbWNtYecc/yQK5g+Kiy78K/KK7MbQ3sw/DEE/Tsb1XY/ZlEUpbwv9lKdtIayLPH2Zh6wycclZNqjwNdJUh5fHMjZBNhu2Ve6webPFB3qD5BrJT4rC6PowgYvLQ2+RJg9g84/ZW6YIJ/D/zmh0HIeJ53OVFansx3b1jE2T5WUuByzHCeqTWqVSvV/cWztAgCiI3VhghUqDUapc0UEpwvuY80d4/y+8g7ZUJ7Rjz9o1IzLpwonRRcUO25b5VyKVCh8Zr9BTvSkAeZ84g3svLy7NNT+MsNN7r0tBNX9Fi1FySC/ZJsK3d+scCp2KSbmhS80HA0wvaGanoWecSCJ67dEuvS3MPQqPv8K1qF4SqXcaho1LZ4wqo/a67FMvlDLSARi8AiS+m/M/YzynuZEw+l6Z6LmWcEMCOJ/u1sq5jJuDdFdubi70RAZ7Sr4caNkOa/kmRyMHmI+XxDapp3Oo1rDEgA+Kx8ad41ySwFdBVMxQiI7KFl3Y/WXuGX7md4ru46zIYJS6hNbzXDvYw= 13 | - secure: WyrfZ81Nmo5zhk2tNg94HmUSw+Q7nQ3BnhSegSViwdnuNt5zzi7bKFEuZVnKqe4588jL+U38UkJpgaQ6G95aSDSIA9W/jPMN0A50XPKpXsYZAUCBMfcribQMEUZW9O2kE4YOVDg83q1DnNhQFYGhfTFvL+Nof7mbYRlKWXFNiBW0Vi9NvfgrJ16GMOLfH8DmR04PrR7ARxXs7Wh+zLW1mxkFvu1OmZ6kwqlC5WLP+HXD3RcPpTydwF8UWuM68uWkhuRm58mEeP/C8a40/77h+GeQUafgIBv2n365FNp+ykYHYrpe/r0DzsAkeKXJg20xV+4TVG/vtTdwhl7AlCvivHSeniuTW62JibwwmhGGeDyi0IwzTgyE4YqZBoDIrc0jibJQnT/KSnkWoGiyimQkcHD6iY5NO8yvTDcgC1/d+sdSWgEJd6BgHvCY//2XIYdFist65S/30gB7VYkQhGg07faBDTcGTaS+KDwcePv2phdcRJNvCtiFll87IwrkfdQilQrg202VgRi6fR73kdYhersLhup8MvgMSkIGvCo8w2NPip9B87VFskemid031Wyw8fjk5tp3nRhQDPdEv6DTQAAdvvoQapnkh49fxPx2+b9VK3QPhv8997B/iuZw/FveZcqz6fSmpQMFHLSfybWbEZcOiPOJei6keaxO/pI9050= 14 | install: "./gradlew assemble -PbintrayUser=${bintrayUser} -PbintrayKey=${bintrayKey}" 15 | script: "./gradlew clean build :sirocco-core:bintrayUpload -x fregeQuickCheck -PbintrayUser=${bintrayUser} 16 | -PbintrayKey=${bintrayKey}" 17 | branches: 18 | only: 19 | - master 20 | -------------------------------------------------------------------------------- /sirocco-sample/src/main/frege/songs/db/Bands.fr: -------------------------------------------------------------------------------- 1 | {-- 2 | This module has all Band related queries 3 | -} 4 | module songs.db.Bands where 5 | 6 | import sirocco.FDBC 7 | import sirocco.Sirocco 8 | 9 | import songs.db.Db 10 | import songs.data.Bands as Model 11 | 12 | --- Lists all available bands in database 13 | -- tag::selectall[] 14 | findAll :: IO [Model.Band] 15 | findAll = mapToBands select 16 | where sql = Just "SELECT * FROM bands" -- <1> 17 | params = [] :: [Maybe SqlParam] -- <2> 18 | select = query connection sql params -- <3> 19 | -- end::selectall[] 20 | 21 | -- tag::singleParam[] 22 | --- Finds a specific band by id 23 | findById :: Maybe String -> IO (Maybe Model.Band) 24 | findById id = getFirst bands 25 | where 26 | sql = Just "SELECT * FROM bands WHERE id = ?" 27 | params = toParam <$> [id] 28 | bands = mapToBands (query connection sql params) 29 | -- end::singleParam[] 30 | 31 | -- tag::findAllByYears[] 32 | findAllByYears :: Maybe Int -> Maybe Int -> IO [Model.Band] 33 | findAllByYears from to = bands 34 | where 35 | sql = Just "SELECT * FROM bands WHERE year >= ? and year <= ?" -- <1> 36 | params = toParam <$> [from, to] -- <2> 37 | result = query connection sql params -- <3> 38 | bands = mapToBands result -- <4> 39 | -- end::findAllByYears[] 40 | 41 | -- tag::mapToBands[] 42 | --- Maps a list of rows to Model.Band instances 43 | mapToBands :: IO [CatchAll [SqlValue]] -> IO [Model.Band] 44 | mapToBands = mapRowsTo toBand 45 | 46 | --- Maps a single row to a Model.Band instances 47 | toBand :: [SqlValue] -> Model.Band 48 | toBand ((SqlLong id):(SqlString name):(SqlLong year):[]) = Model.Band { id = id, name = name, year = year } 49 | toBand x = error $ "Error while parsing Band" ++ show x 50 | -- end::mapToBands[] 51 | 52 | --- Gets first element of a list of records 53 | getFirst :: IO [a] -> IO (Maybe a) 54 | getFirst results = do 55 | rows <- results 56 | return $ case rows of 57 | (x:_) -> Just x 58 | [] -> Nothing 59 | 60 | -- tag::deleteBandById[] 61 | deleteBandById :: Maybe Int -> IO Int 62 | deleteBandById id = result 63 | where 64 | sql = Just "DELETE FROM bands WHERE id = ?" -- <1> 65 | params = toParam <$> [id] -- <2> 66 | result = update connection sql params -- <3> 67 | -- end::deleteBandById[] 68 | -------------------------------------------------------------------------------- /sirocco-core/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: "org.frege-lang" 3 | apply plugin: 'maven' 4 | apply plugin: 'maven-publish' 5 | apply plugin: 'com.jfrog.bintray' 6 | 7 | // _____ _ _ 8 | // | __ \ | | (_) 9 | // | | | | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ 10 | // | | | |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __| |/ _ \/ __| 11 | // | |__| | __/ |_) | __/ | | | (_| | __/ | | | (__| | __/\__ \ 12 | // |_____/ \___| .__/ \___|_| |_|\__,_|\___|_| |_|\___|_|\___||___/ 13 | // | | 14 | // |_| 15 | 16 | dependencies { 17 | compile groups.compilation 18 | testCompile groups.testing 19 | } 20 | 21 | compileFrege.dependsOn 'compileJava' 22 | 23 | // _____ _ _ _ _ _ _ 24 | // | __ \(_) | | (_) | | | (_) 25 | // | | | |_ ___| |_ _ __ _| |__ _ _| |_ _ ___ _ __ 26 | // | | | | / __| __| '__| | '_ \| | | | __| |/ _ \| '_ \ 27 | // | |__| | \__ \ |_| | | | |_) | |_| | |_| | (_) | | | | 28 | // |_____/|_|___/\__|_| |_|_.__/ \__,_|\__|_|\___/|_| |_| 29 | // 30 | // 31 | 32 | group = releaseGroup 33 | version = releaseVersion 34 | 35 | publishing { 36 | publications { 37 | mavenCustom(MavenPublication) { 38 | groupId releaseGroup 39 | artifactId 'sirocco-core' 40 | version releaseVersion 41 | 42 | from components.java 43 | } 44 | } 45 | } 46 | 47 | bintray { 48 | /* Normally taken from ~/.gradle/gradle.properties */ 49 | user = bintrayUser 50 | key = bintrayKey 51 | publish = false 52 | publications = ['mavenCustom'] 53 | pkg { 54 | repo = 'maven' 55 | name = 'sirocco-core' 56 | userOrg = 'fregelab' 57 | desc = releaseDescription 58 | websiteUrl = 'http://fregelab.github.io/sirocco/' 59 | issueTrackerUrl = 'https://github.com/fregelab/sirocco/issues' 60 | licenses = ['Apache-2.0'] 61 | vcsUrl = 'https://github.com/fregelab/sirocco.git' 62 | labels = ['frege', 'database', 'jdbc'] 63 | version { 64 | name = releaseVersion 65 | desc = 'Sirocco Release' 66 | released = new Date() 67 | vcsTag = releaseVersion 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /sirocco-docs/src/docs/asciidoc/chapter/query.adoc: -------------------------------------------------------------------------------- 1 | == Query 2 | 3 | To perform a prepared statement query you should be using the function `Sirocco.query`: 4 | 5 | [source,haskell] 6 | ---- 7 | include::{coreSrc}/sirocco/Sirocco.fr[tags=query] 8 | ---- 9 | 10 | The function receives: 11 | 12 | * Connection 13 | * Query 14 | * Parameters 15 | 16 | And returns a list of records of type `CatchAll [SqlValue]`. A 17 | `CatchAll` type is an alias for `Either Throwable` and `[SqlValue]` 18 | represents every column of each row. So basically we will be expecting 19 | a list of rows containing list of column values. 20 | 21 | Lets see a `SELECT` example: 22 | 23 | [source,haskell] 24 | ---- 25 | include::{sampleSrc}/songs/db/Bands.fr[tags=selectall] 26 | ---- 27 | 28 | <1> Defining the `SQL` query 29 | <2> Defining the list of params (empty this time) 30 | <3> Executing the query 31 | 32 | After executing the query we will be mapping the result to another 33 | datatatype. 34 | 35 | === Mapping results 36 | 37 | In the previous example we were mapping our result to a list of 38 | music bands. `Sirocco` has a helper method to map a given database 39 | row to a defined user data type. 40 | 41 | [source,haskell] 42 | ---- 43 | include::{coreSrc}/sirocco/Sirocco.fr[tags=mapRowsTo] 44 | ---- 45 | 46 | Basically you need to define a function converting from a given row 47 | (strictly speaking a list of columns of a given row) to another type. 48 | 49 | In our band example this is how it was implemented: 50 | 51 | [source,haskell] 52 | ---- 53 | include::{sampleSrc}/songs/db/Bands.fr[tags=mapToBands] 54 | ---- 55 | 56 | === Parameters 57 | 58 | A param is of type `Sirocco.SqlParam`, that's why we can pass a list of 59 | parameters to our query, if we were using simple types, Frege wouldn't 60 | allow us to create a list of different types. 61 | 62 | [source,haskell] 63 | ---- 64 | include::{coreSrc}/sirocco/Sirocco.fr[tags=toParam] 65 | ---- 66 | 67 | In order to convert a simple type to a `SqlParam` we can use the different 68 | implemented instances of class type `Sirocco.ToParam`. In the following 69 | example we would like to convert a string to a valid param: 70 | 71 | [source,haskell] 72 | ---- 73 | include::{sampleSrc}/songs/db/Bands.fr[tags=singleParam] 74 | ---- 75 | 76 | NOTE: In the example you can also say `[toParam id]`. You will be 77 | using this, specially when trying to create params combining different 78 | types, e.g: `[(toParam . Just) 1, (toParam . Just) "Metallica"] 79 | 80 | Here's another example: 81 | 82 | [source,haskell] 83 | ---- 84 | include::{sampleSrc}/songs/db/Bands.fr[tags=findAllByYears] 85 | ---- 86 | 87 | <1> Defining a query with two parameters 88 | <2> Creating required parameters 89 | <3> Executing query 90 | <4> Mapping result 91 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /sirocco-core/src/main/frege/sirocco/Sirocco.fr: -------------------------------------------------------------------------------- 1 | module sirocco.Sirocco where 2 | 3 | import sirocco.Util 4 | import sirocco.JDBC 5 | import sirocco.FDBC 6 | 7 | --- Creates a new connection 8 | createConnection :: String -> String -> String -> IO Connection 9 | createConnection uri username password = DriverManager.getConnection uri username password 10 | 11 | {-- 12 | `SqlParam` data type represents all possible type params that 13 | can be used in a sql statement. 14 | -} 15 | data SqlParam = IntParam Int | 16 | StringParam String | 17 | BoolParam Bool | 18 | ByteParam Byte | 19 | DoubleParam Double | 20 | FloatParam Float | 21 | LongParam Long | 22 | ShortParam Short | 23 | ObjectParam Object 24 | 25 | {-- 26 | This type class defines al possible conversions of type 27 | (a -> SqlParam) through function `toParam` 28 | -} 29 | -- tag::toParam[] 30 | class ToParam a where 31 | toParam :: Maybe a -> Maybe SqlParam 32 | -- end::toParam[] 33 | 34 | instance ToParam Int where 35 | toParam = fmap IntParam 36 | 37 | instance ToParam String where 38 | toParam = fmap StringParam 39 | 40 | instance ToParam Bool where 41 | toParam = fmap BoolParam 42 | 43 | instance ToParam Byte where 44 | toParam = fmap ByteParam 45 | 46 | instance ToParam Double where 47 | toParam = fmap DoubleParam 48 | 49 | instance ToParam Float where 50 | toParam = fmap FloatParam 51 | 52 | instance ToParam Long where 53 | toParam = fmap LongParam 54 | 55 | instance ToParam Short where 56 | toParam = fmap ShortParam 57 | 58 | instance ToParam Object where 59 | toParam = fmap ObjectParam 60 | 61 | {-- 62 | Sets parameters in a PreparedStatement query. Parameters are taken from a list of 63 | tuples of type (Int, Maybe a). The first integer is the position in the query and 64 | the second part represents the possible value 65 | -} 66 | setParams' :: PreparedStatement -> Int -> [Maybe SqlParam] -> IO PreparedStatement 67 | setParams' stmt _ [] = return stmt 68 | setParams' stmt n (x:xs) = case x of 69 | Just param -> do 70 | mstmt <- case param of 71 | StringParam p -> useit PreparedStatement.setString stmt n p 72 | IntParam p -> useit PreparedStatement.setInt stmt n p 73 | BoolParam p -> useit PreparedStatement.setBoolean stmt n p 74 | ByteParam p -> useit PreparedStatement.setByte stmt n p 75 | DoubleParam p -> useit PreparedStatement.setDouble stmt n p 76 | FloatParam p -> useit PreparedStatement.setFloat stmt n p 77 | LongParam p -> useit PreparedStatement.setLong stmt n p 78 | ShortParam p -> useit PreparedStatement.setShort stmt n p 79 | ObjectParam p -> useit PreparedStatement.setObject stmt n p 80 | _ -> fail "Need SqlParam here" 81 | setParams' mstmt (n+1) xs 82 | 83 | Nothing -> do 84 | mstmt <- useit PreparedStatement.setNull stmt n 0 85 | setParams' stmt (n+1) xs 86 | 87 | useit :: (PreparedStatement -> Int -> a -> IO ()) -> PreparedStatement -> Int -> a -> IO PreparedStatement 88 | useit fn stmt pos value = do 89 | _ <- fn stmt pos value 90 | return stmt 91 | 92 | {-- 93 | Instance to show SqlValue instances as a String 94 | -} 95 | instance Show SqlValue where 96 | show (SqlString s) = "String: " ++ s 97 | show (SqlInt s) = "Int: " ++ show s 98 | show (SqlLong s) = "Long: " ++ show s 99 | show (SqlBool s) = "Bool: " ++ show s 100 | show (SqlInteger s) = "Integer:" ++ show s 101 | show (SqlFloat s) = "Float:" ++ show s 102 | show (SqlDouble s) = "Double:" ++ show s 103 | show (SqlDecimal s) = "Decimal:" ++ (BigDecimal.toString s) 104 | show (SqlChar s) = "Char:" ++ show s 105 | show (SqlDate s) = "Date:" ++ (Date.toString s) 106 | show (SqlTime s) = "Time:" ++ (Time.toString s) 107 | show (SqlTimestamp s) = "Timestamp:" ++ (Timestamp.toString s) 108 | show (SqlNull) = "Null:" 109 | show t = "Some value" 110 | 111 | {-- 112 | Executes a given query to modify the state of the database: create a table, 113 | drop table... If the query succeed the function will return true, otherwise 114 | it will return false 115 | -} 116 | -- tag::execute[] 117 | execute :: IO Connection -> Maybe String -> IO Bool 118 | -- end::execute[] 119 | execute connection sql = do 120 | conn <- connection 121 | case sql of 122 | Just q -> do 123 | stmt <- Connection.prepareStatement conn q 124 | PreparedStatement.execute stmt 125 | Nothing -> pure false 126 | 127 | {-- 128 | Executes queries of type INSERT for tables with a generated key. 129 | It will return the generated key. 130 | -} 131 | -- tag::insertAndReturnGeneratedKey[] 132 | insertAndReturnGeneratedKey :: IO Connection -> Maybe String -> [Maybe SqlParam] -> IO Long 133 | -- end::insertAndReturnGeneratedKey[] 134 | insertAndReturnGeneratedKey connection msql parameters = do 135 | conn <- connection 136 | case msql of 137 | Just sql -> do 138 | stmt <- Connection.prepareStatement conn sql Statement.return_generated_keys 139 | stmt' <- setParams' stmt 1 parameters 140 | howMany <- PreparedStatement.executeUpdate stmt' 141 | rs <- PreparedStatement.getGeneratedKeys stmt' 142 | hasNext <- ResultSet.next rs 143 | ResultSet.getLong rs 1 144 | Nothing -> pure 0 145 | 146 | {-- 147 | Executes queries of type UPDATE/INSERT. It will be returning those 148 | affected rows 149 | -} 150 | -- tag::update[] 151 | update :: IO Connection -> Maybe String -> [Maybe SqlParam] -> IO Int 152 | -- end::update[] 153 | update connection msql parameters = do 154 | conn <- connection 155 | case msql of 156 | Just sql -> do 157 | stmt <- Connection.prepareStatement conn sql 158 | stmt' <- setParams' stmt 1 parameters 159 | PreparedStatement.executeUpdate stmt' 160 | Nothing -> pure 0 161 | 162 | 163 | {-- 164 | Executes a query and returns a list of results 165 | -} 166 | -- tag::query[] 167 | query :: IO Connection -> Maybe String -> [Maybe SqlParam] -> IO [CatchAll [SqlValue]] 168 | -- end::query[] 169 | query connection msql parameters = do 170 | conn <- connection 171 | case msql of 172 | Just sql -> do 173 | stmt <- Connection.prepareStatement conn sql 174 | stmt' <- setParams' stmt 1 parameters 175 | rows <- PreparedStatement.executeQuery stmt' 176 | takeWhileRight $ repeat $ fetchRow rows 177 | Nothing -> pure [] 178 | 179 | {-- 180 | This function maps a list of query results to a specific type of list 181 | -} 182 | -- tag::mapRowsTo[] 183 | mapRowsTo :: ([SqlValue] -> a) -> IO [CatchAll [SqlValue]] -> IO [a] 184 | -- end::mapRowsTo[] 185 | mapRowsTo mapper xs = fmap fromRight $ fmap (fmap (fmap mapper)) $ fmap sequence xs 186 | 187 | {-- 188 | When invoking the function `fetchRow` it only ask for one row of the 189 | current ResultSet. Every call to fetchRow returns an IO Right _ 190 | while there are records, once the records have been consumed the 191 | fetchRow call will return IO Left _ records. 192 | -} 193 | takeWhileRight :: [IO (CatchAll a)] -> IO [(CatchAll a)] 194 | takeWhileRight (x:xs) = do 195 | y <- x 196 | case y of 197 | Right _ -> (y:) <$> (takeWhileRight xs) 198 | Left _ -> pure [] 199 | takeWhileRight [] = return [] 200 | -------------------------------------------------------------------------------- /sirocco-core/src/main/frege/sirocco/FDBC.fr: -------------------------------------------------------------------------------- 1 | {-- 2 | This code has been copied from https://github.com/DellCliff/frege-dbc 3 | -} 4 | module sirocco.FDBC where 5 | 6 | import sirocco.JDBC 7 | 8 | data SqlValue = SqlShort Short 9 | | SqlInt Int 10 | | SqlLong Long 11 | | SqlInteger Integer 12 | | SqlBytes [Byte] 13 | | SqlBool Bool 14 | | SqlFloat Float 15 | | SqlDouble Double 16 | | SqlDecimal BigDecimal 17 | | SqlChar Char 18 | | SqlObject Object 19 | | SqlDate Date 20 | | SqlTime Time 21 | | SqlTimestamp Timestamp 22 | | SqlString String 23 | | SqlNull 24 | 25 | data SqlColDesc = SqlColDesc { 26 | catalogName :: String, 27 | columnClassName :: String, 28 | columnDisplaySize :: Int, 29 | columnLabel :: String, 30 | columnName :: String, 31 | columnType :: Int, 32 | columnTypeName :: String, 33 | precision :: Int, 34 | scale :: Int, 35 | schemaName :: String, 36 | tableName :: String, 37 | isAutoIncrement :: Bool, 38 | isCaseSensitive :: Bool, 39 | isCurrency :: Bool, 40 | isDefinitelyWritable :: Bool, 41 | isNullable :: Int, 42 | isReadOnly :: Bool, 43 | isSearchable :: Bool, 44 | isSigned :: Bool, 45 | isWritable :: Bool 46 | } 47 | 48 | -- Throws Exceptions. Not meant to be used outside this file. 49 | -- Good information: http://www.cis.upenn.edu/~bcpierce/courses/629/jdkdocs/guide/jdbc/getstart/mapping.doc.html 50 | -- Numbers are interpreted as the next bigger type to avoid signed/unsigned problems 51 | -- e.g. 8-bit tinyint becomes 16-bit Java short 52 | -- 16-bit smallint becomes 32-bit Java int 53 | -- 32-bit integer becomes 32-bit Java long 54 | -- 64-bit bigint becomes Java BitInteger 55 | 56 | columnConverter :: ResultSet -> Int -> Int -> IO SqlValue 57 | columnConverter rset idx sql_type 58 | | sql_type == Types.null = do { return SqlValue.SqlNull } 59 | 60 | | sql_type == Types.longvarchar = do 61 | c <- ResultSet.getString rset idx 62 | didreadnull <- ResultSet.wasNull rset 63 | return $ if (didreadnull) 64 | then SqlValue.SqlNull 65 | else SqlValue.SqlString c 66 | | sql_type == Types.varchar = columnConverter rset idx Types.longvarchar 67 | | sql_type == Types.char = columnConverter rset idx Types.longvarchar 68 | | sql_type == Types.clob = columnConverter rset idx Types.longvarchar 69 | 70 | | sql_type == Types.longnvarchar = do 71 | c <- ResultSet.getNString rset idx 72 | didreadnull <- ResultSet.wasNull rset 73 | return $ if (didreadnull) 74 | then SqlValue.SqlNull 75 | else SqlValue.SqlString c 76 | | sql_type == Types.nchar = columnConverter rset idx Types.longnvarchar 77 | | sql_type == Types.nvarchar = columnConverter rset idx Types.longnvarchar 78 | | sql_type == Types.nclob = columnConverter rset idx Types.longnvarchar 79 | 80 | | sql_type == Types.binary = do 81 | c <- ResultSet.getBytes rset idx 82 | didreadnull <- ResultSet.wasNull rset 83 | res <- if (didreadnull) 84 | then do return [] 85 | else Mutable.readonly (\x -> x.toList) c 86 | return $ if (didreadnull) 87 | then SqlValue.SqlNull 88 | else SqlValue.SqlBytes res 89 | | sql_type == Types.varbinary = columnConverter rset idx Types.binary 90 | | sql_type == Types.longvarbinary = columnConverter rset idx Types.binary 91 | | sql_type == Types.blob = columnConverter rset idx Types.binary 92 | 93 | | sql_type == Types.bit = do 94 | c <- ResultSet.getBoolean rset idx 95 | didreadnull <- ResultSet.wasNull rset 96 | return $ if (didreadnull) 97 | then SqlValue.SqlNull 98 | else SqlValue.SqlBool c 99 | | sql_type == Types.boolean = columnConverter rset idx Types.bit 100 | 101 | | sql_type == Types.tinyint = do 102 | c <- ResultSet.getShort rset idx 103 | didreadnull <- ResultSet.wasNull rset 104 | return $ if (didreadnull) 105 | then SqlValue.SqlNull 106 | else SqlValue.SqlShort c 107 | 108 | | sql_type == Types.smallint = do 109 | c <- ResultSet.getInt rset idx 110 | didreadnull <- ResultSet.wasNull rset 111 | return $ if (didreadnull) 112 | then SqlValue.SqlNull 113 | else SqlValue.SqlInt c 114 | 115 | | sql_type == Types.integer = do 116 | c <- ResultSet.getLong rset idx 117 | didreadnull <- ResultSet.wasNull rset 118 | return $ if (didreadnull) 119 | then SqlValue.SqlNull 120 | else SqlValue.SqlLong c 121 | 122 | | sql_type == Types.bigint = do 123 | c <- ResultSet.getBigDecimal rset idx 124 | didreadnull <- ResultSet.wasNull rset 125 | return $ if (didreadnull) 126 | then SqlValue.SqlNull 127 | else SqlValue.SqlInteger $ c.toBigInteger 128 | 129 | | sql_type == Types.real = do 130 | c <- ResultSet.getFloat rset idx 131 | didreadnull <- ResultSet.wasNull rset 132 | return $ if (didreadnull) 133 | then SqlValue.SqlNull 134 | else SqlValue.SqlFloat c 135 | 136 | | sql_type == Types.double = do 137 | c <- ResultSet.getDouble rset idx 138 | didreadnull <- ResultSet.wasNull rset 139 | return $ if (didreadnull) 140 | then SqlValue.SqlNull 141 | else SqlValue.SqlDouble c 142 | | sql_type == Types.float = columnConverter rset idx Types.double 143 | 144 | | sql_type == Types.decimal = do 145 | c <- ResultSet.getBigDecimal rset idx 146 | didreadnull <- ResultSet.wasNull rset 147 | return $ if (didreadnull) 148 | then SqlValue.SqlNull 149 | else SqlValue.SqlDecimal c 150 | | sql_type == Types.numeric = columnConverter rset idx Types.decimal 151 | 152 | | sql_type == Types.date = do 153 | c <- ResultSet.getDate rset idx 154 | didreadnull <- ResultSet.wasNull rset 155 | return $ if (didreadnull) 156 | then SqlValue.SqlNull 157 | else SqlValue.SqlDate c 158 | 159 | | sql_type == Types.time = do 160 | c <- ResultSet.getTime rset idx 161 | didreadnull <- ResultSet.wasNull rset 162 | return $ if (didreadnull) 163 | then SqlValue.SqlNull 164 | else SqlValue.SqlTime c 165 | 166 | | sql_type == Types.timestamp = do 167 | c <- ResultSet.getTimestamp rset idx 168 | didreadnull <- ResultSet.wasNull rset 169 | return $ if (didreadnull) 170 | then SqlValue.SqlNull 171 | else SqlValue.SqlTimestamp c 172 | 173 | | sql_type == Types.java_object = do 174 | c <- ResultSet.getObject rset idx 175 | didreadnull <- ResultSet.wasNull rset 176 | return $ if (didreadnull) 177 | then SqlValue.SqlNull 178 | else SqlValue.SqlObject c 179 | | sql_type == Types.other = columnConverter rset idx Types.java_object 180 | | true = columnConverter rset idx Types.java_object 181 | 182 | describeColumn :: ResultSetMetaData -> Int -> IO (Either Throwable SqlColDesc) 183 | describeColumn meta x = 184 | catchAll do 185 | catalogName <- ResultSetMetaData.getCatalogName meta x 186 | columnClassName <- ResultSetMetaData.getColumnClassName meta x 187 | columnDisplaySize <- ResultSetMetaData.getColumnDisplaySize meta x 188 | columnLabel <- ResultSetMetaData.getColumnLabel meta x 189 | columnName <- ResultSetMetaData.getColumnName meta x 190 | columnType <- ResultSetMetaData.getColumnType meta x 191 | columnTypeName <- ResultSetMetaData.getColumnTypeName meta x 192 | precision <- ResultSetMetaData.getPrecision meta x 193 | scale <- ResultSetMetaData.getScale meta x 194 | schemaName <- ResultSetMetaData.getSchemaName meta x 195 | tableName <- ResultSetMetaData.getTableName meta x 196 | isAutoIncrement <- ResultSetMetaData.isAutoIncrement meta x 197 | isCaseSensitive <- ResultSetMetaData.isCaseSensitive meta x 198 | isCurrency <- ResultSetMetaData.isCurrency meta x 199 | isDefinitelyWritable <- ResultSetMetaData.isDefinitelyWritable meta x 200 | isNullable <- ResultSetMetaData.isNullable meta x 201 | isReadOnly <- ResultSetMetaData.isReadOnly meta x 202 | isSearchable <- ResultSetMetaData.isSearchable meta x 203 | isSigned <- ResultSetMetaData.isSigned meta x 204 | isWritable <- ResultSetMetaData.isWritable meta x 205 | return SqlColDesc { catalogName, columnClassName, 206 | columnDisplaySize, columnLabel, 207 | columnName, columnType, 208 | columnTypeName, precision, scale, 209 | schemaName, tableName, isAutoIncrement, 210 | isCaseSensitive, isCurrency, 211 | isDefinitelyWritable, isNullable, 212 | isReadOnly, isSearchable, 213 | isSigned, isWritable } 214 | 215 | describeResult :: ResultSet -> IO [SqlColDesc] 216 | describeResult rset = 217 | try unsafe rset `catch` default 218 | where 219 | unsafe rset = do 220 | meta <- ResultSet.getMetaData rset 221 | columnCount <- ResultSetMetaData.getColumnCount meta 222 | res <- sequence $ map (describeColumn meta) [1..columnCount] 223 | allRight = not $ any (either (\x -> true) (\x -> false)) res 224 | getRight (Right x) = x 225 | if allRight 226 | then return $ map getRight res 227 | else return $ [] 228 | default :: Exception -> IO [SqlColDesc] 229 | default e = do return [] 230 | 231 | fetchRow :: ResultSet -> IO (Either Throwable [SqlValue]) 232 | fetchRow rset = 233 | catchAll unsafe 234 | where 235 | unsafe = do 236 | ResultSet.next rset 237 | meta <- ResultSet.getMetaData rset 238 | columnCount <- ResultSetMetaData.getColumnCount meta 239 | columnTypes <- sequence $ map (ResultSetMetaData.getColumnType meta) [1..columnCount] 240 | sequence $ [columnConverter rset idx ctype | (idx, ctype) <- (zip [1..columnCount] columnTypes)] 241 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | 3 | Apache License 4 | Version 2.0, January 2004 5 | http://www.apache.org/licenses/ 6 | 7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 8 | 9 | 1. Definitions. 10 | 11 | "License" shall mean the terms and conditions for use, reproduction, 12 | and distribution as defined by Sections 1 through 9 of this document. 13 | 14 | "Licensor" shall mean the copyright owner or entity authorized by 15 | the copyright owner that is granting the License. 16 | 17 | "Legal Entity" shall mean the union of the acting entity and all 18 | other entities that control, are controlled by, or are under common 19 | control with that entity. For the purposes of this definition, 20 | "control" means (i) the power, direct or indirect, to cause the 21 | direction or management of such entity, whether by contract or 22 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 23 | outstanding shares, or (iii) beneficial ownership of such entity. 24 | 25 | "You" (or "Your") shall mean an individual or Legal Entity 26 | exercising permissions granted by this License. 27 | 28 | "Source" form shall mean the preferred form for making modifications, 29 | including but not limited to software source code, documentation 30 | source, and configuration files. 31 | 32 | "Object" form shall mean any form resulting from mechanical 33 | transformation or translation of a Source form, including but 34 | not limited to compiled object code, generated documentation, 35 | and conversions to other media types. 36 | 37 | "Work" shall mean the work of authorship, whether in Source or 38 | Object form, made available under the License, as indicated by a 39 | copyright notice that is included in or attached to the work 40 | (an example is provided in the Appendix below). 41 | 42 | "Derivative Works" shall mean any work, whether in Source or Object 43 | form, that is based on (or derived from) the Work and for which the 44 | editorial revisions, annotations, elaborations, or other modifications 45 | represent, as a whole, an original work of authorship. For the purposes 46 | of this License, Derivative Works shall not include works that remain 47 | separable from, or merely link (or bind by name) to the interfaces of, 48 | the Work and Derivative Works thereof. 49 | 50 | "Contribution" shall mean any work of authorship, including 51 | the original version of the Work and any modifications or additions 52 | to that Work or Derivative Works thereof, that is intentionally 53 | submitted to Licensor for inclusion in the Work by the copyright owner 54 | or by an individual or Legal Entity authorized to submit on behalf of 55 | the copyright owner. For the purposes of this definition, "submitted" 56 | means any form of electronic, verbal, or written communication sent 57 | to the Licensor or its representatives, including but not limited to 58 | communication on electronic mailing lists, source code control systems, 59 | and issue tracking systems that are managed by, or on behalf of, the 60 | Licensor for the purpose of discussing and improving the Work, but 61 | excluding communication that is conspicuously marked or otherwise 62 | designated in writing by the copyright owner as "Not a Contribution." 63 | 64 | "Contributor" shall mean Licensor and any individual or Legal Entity 65 | on behalf of whom a Contribution has been received by Licensor and 66 | subsequently incorporated within the Work. 67 | 68 | 2. Grant of Copyright License. Subject to the terms and conditions of 69 | this License, each Contributor hereby grants to You a perpetual, 70 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 71 | copyright license to reproduce, prepare Derivative Works of, 72 | publicly display, publicly perform, sublicense, and distribute the 73 | Work and such Derivative Works in Source or Object form. 74 | 75 | 3. Grant of Patent License. Subject to the terms and conditions of 76 | this License, each Contributor hereby grants to You a perpetual, 77 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 78 | (except as stated in this section) patent license to make, have made, 79 | use, offer to sell, sell, import, and otherwise transfer the Work, 80 | where such license applies only to those patent claims licensable 81 | by such Contributor that are necessarily infringed by their 82 | Contribution(s) alone or by combination of their Contribution(s) 83 | with the Work to which such Contribution(s) was submitted. If You 84 | institute patent litigation against any entity (including a 85 | cross-claim or counterclaim in a lawsuit) alleging that the Work 86 | or a Contribution incorporated within the Work constitutes direct 87 | or contributory patent infringement, then any patent licenses 88 | granted to You under this License for that Work shall terminate 89 | as of the date such litigation is filed. 90 | 91 | 4. Redistribution. You may reproduce and distribute copies of the 92 | Work or Derivative Works thereof in any medium, with or without 93 | modifications, and in Source or Object form, provided that You 94 | meet the following conditions: 95 | 96 | (a) You must give any other recipients of the Work or 97 | Derivative Works a copy of this License; and 98 | 99 | (b) You must cause any modified files to carry prominent notices 100 | stating that You changed the files; and 101 | 102 | (c) You must retain, in the Source form of any Derivative Works 103 | that You distribute, all copyright, patent, trademark, and 104 | attribution notices from the Source form of the Work, 105 | excluding those notices that do not pertain to any part of 106 | the Derivative Works; and 107 | 108 | (d) If the Work includes a "NOTICE" text file as part of its 109 | distribution, then any Derivative Works that You distribute must 110 | include a readable copy of the attribution notices contained 111 | within such NOTICE file, excluding those notices that do not 112 | pertain to any part of the Derivative Works, in at least one 113 | of the following places: within a NOTICE text file distributed 114 | as part of the Derivative Works; within the Source form or 115 | documentation, if provided along with the Derivative Works; or, 116 | within a display generated by the Derivative Works, if and 117 | wherever such third-party notices normally appear. The contents 118 | of the NOTICE file are for informational purposes only and 119 | do not modify the License. You may add Your own attribution 120 | notices within Derivative Works that You distribute, alongside 121 | or as an addendum to the NOTICE text from the Work, provided 122 | that such additional attribution notices cannot be construed 123 | as modifying the License. 124 | 125 | You may add Your own copyright statement to Your modifications and 126 | may provide additional or different license terms and conditions 127 | for use, reproduction, or distribution of Your modifications, or 128 | for any such Derivative Works as a whole, provided Your use, 129 | reproduction, and distribution of the Work otherwise complies with 130 | the conditions stated in this License. 131 | 132 | 5. Submission of Contributions. Unless You explicitly state otherwise, 133 | any Contribution intentionally submitted for inclusion in the Work 134 | by You to the Licensor shall be under the terms and conditions of 135 | this License, without any additional terms or conditions. 136 | Notwithstanding the above, nothing herein shall supersede or modify 137 | the terms of any separate license agreement you may have executed 138 | with Licensor regarding such Contributions. 139 | 140 | 6. Trademarks. This License does not grant permission to use the trade 141 | names, trademarks, service marks, or product names of the Licensor, 142 | except as required for reasonable and customary use in describing the 143 | origin of the Work and reproducing the content of the NOTICE file. 144 | 145 | 7. Disclaimer of Warranty. Unless required by applicable law or 146 | agreed to in writing, Licensor provides the Work (and each 147 | Contributor provides its Contributions) on an "AS IS" BASIS, 148 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 149 | implied, including, without limitation, any warranties or conditions 150 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 151 | PARTICULAR PURPOSE. You are solely responsible for determining the 152 | appropriateness of using or redistributing the Work and assume any 153 | risks associated with Your exercise of permissions under this License. 154 | 155 | 8. Limitation of Liability. In no event and under no legal theory, 156 | whether in tort (including negligence), contract, or otherwise, 157 | unless required by applicable law (such as deliberate and grossly 158 | negligent acts) or agreed to in writing, shall any Contributor be 159 | liable to You for damages, including any direct, indirect, special, 160 | incidental, or consequential damages of any character arising as a 161 | result of this License or out of the use or inability to use the 162 | Work (including but not limited to damages for loss of goodwill, 163 | work stoppage, computer failure or malfunction, or any and all 164 | other commercial damages or losses), even if such Contributor 165 | has been advised of the possibility of such damages. 166 | 167 | 9. Accepting Warranty or Additional Liability. While redistributing 168 | the Work or Derivative Works thereof, You may choose to offer, 169 | and charge a fee for, acceptance of support, warranty, indemnity, 170 | or other liability obligations and/or rights consistent with this 171 | License. However, in accepting such obligations, You may act only 172 | on Your own behalf and on Your sole responsibility, not on behalf 173 | of any other Contributor, and only if You agree to indemnify, 174 | defend, and hold each Contributor harmless for any liability 175 | incurred by, or claims asserted against, such Contributor by reason 176 | of your accepting any such warranty or additional liability. 177 | 178 | END OF TERMS AND CONDITIONS 179 | 180 | APPENDIX: How to apply the Apache License to your work. 181 | 182 | To apply the Apache License to your work, attach the following 183 | boilerplate notice, with the fields enclosed by brackets "[]" 184 | replaced with your own identifying information. (Don't include 185 | the brackets!) The text should be enclosed in the appropriate 186 | comment syntax for the file format. We also recommend that a 187 | file or class name and description of purpose be included on the 188 | same "printed page" as the copyright notice for easier 189 | identification within third-party archives. 190 | 191 | Copyright [yyyy] [name of copyright owner] 192 | 193 | Licensed under the Apache License, Version 2.0 (the "License"); 194 | you may not use this file except in compliance with the License. 195 | You may obtain a copy of the License at 196 | 197 | http://www.apache.org/licenses/LICENSE-2.0 198 | 199 | Unless required by applicable law or agreed to in writing, software 200 | distributed under the License is distributed on an "AS IS" BASIS, 201 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 202 | See the License for the specific language governing permissions and 203 | limitations under the License. 204 | -------------------------------------------------------------------------------- /sirocco-core/src/main/frege/sirocco/JDBC.fr: -------------------------------------------------------------------------------- 1 | {-- 2 | This code has been copied from https://github.com/DellCliff/frege-dbc 3 | -} 4 | module sirocco.JDBC where 5 | 6 | data CallableStatement = mutable native java.sql.CallableStatement where 7 | 8 | native getBoolean :: CallableStatement -> String -> IO Bool throws SQLException 9 | | CallableStatement -> Int -> IO Bool throws SQLException 10 | 11 | native getByte :: CallableStatement -> String -> IO Byte throws SQLException 12 | | CallableStatement -> Int -> IO Byte throws SQLException 13 | 14 | native getDouble :: CallableStatement -> String -> IO Double throws SQLException 15 | | CallableStatement -> Int -> IO Double throws SQLException 16 | 17 | native getFloat :: CallableStatement -> Int -> IO Float throws SQLException 18 | | CallableStatement -> String -> IO Float throws SQLException 19 | 20 | native getInt :: CallableStatement -> String -> IO Int throws SQLException 21 | | CallableStatement -> Int -> IO Int throws SQLException 22 | 23 | native getLong :: CallableStatement -> Int -> IO Long throws SQLException 24 | | CallableStatement -> String -> IO Long throws SQLException 25 | 26 | native getNString :: CallableStatement -> String -> IO String throws SQLException 27 | | CallableStatement -> Int -> IO String throws SQLException 28 | 29 | native getObject :: CallableStatement -> Int -> IO Object throws SQLException 30 | | CallableStatement -> String -> IO Object throws SQLException 31 | | CallableStatement -> String -> Class t -> IO t throws SQLException 32 | | CallableStatement -> Int -> Class t -> IO t throws SQLException 33 | 34 | native getShort :: CallableStatement -> String -> IO Short throws SQLException 35 | | CallableStatement -> Int -> IO Short throws SQLException 36 | 37 | native getString :: CallableStatement -> String -> IO String throws SQLException 38 | | CallableStatement -> Int -> IO String throws SQLException 39 | 40 | native wasNull :: CallableStatement -> IO Bool throws SQLException 41 | 42 | data BigDecimal = pure native java.math.BigDecimal where 43 | 44 | pure native zero "java.math.BigDecimal.ZERO" :: BigDecimal 45 | pure native one "java.math.BigDecimal.ONE" :: BigDecimal 46 | pure native ten "java.math.BigDecimal.TEN" :: BigDecimal 47 | pure native round_up "java.math.BigDecimal.ROUND_UP" :: Int 48 | pure native round_down "java.math.BigDecimal.ROUND_DOWN" :: Int 49 | pure native round_ceiling "java.math.BigDecimal.ROUND_CEILING" :: Int 50 | pure native round_floor "java.math.BigDecimal.ROUND_FLOOR" :: Int 51 | pure native round_half_up "java.math.BigDecimal.ROUND_HALF_UP" :: Int 52 | pure native round_half_down "java.math.BigDecimal.ROUND_HALF_DOWN" :: Int 53 | pure native round_half_even "java.math.BigDecimal.ROUND_HALF_EVEN" :: Int 54 | pure native round_unnecessary "java.math.BigDecimal.ROUND_UNNECESSARY" :: Int 55 | 56 | pure native new :: Integer -> Int -> BigDecimal 57 | | Integer -> BigDecimal 58 | | Double -> BigDecimal 59 | | Long -> BigDecimal 60 | | Int -> BigDecimal 61 | | String -> BigDecimal 62 | 63 | pure native abs :: BigDecimal -> BigDecimal 64 | 65 | pure native add :: BigDecimal -> BigDecimal -> BigDecimal 66 | 67 | pure native byteValueExact :: BigDecimal -> Byte 68 | 69 | pure native compareTo :: BigDecimal -> BigDecimal -> Int 70 | 71 | pure native divide :: BigDecimal -> BigDecimal -> Int -> Int -> BigDecimal 72 | | BigDecimal -> BigDecimal -> BigDecimal 73 | | BigDecimal -> BigDecimal -> Int -> BigDecimal 74 | 75 | pure native divideToIntegralValue :: BigDecimal -> BigDecimal -> BigDecimal 76 | 77 | pure native doubleValue :: BigDecimal -> Double 78 | 79 | pure native equals :: BigDecimal -> Object -> Bool 80 | 81 | pure native floatValue :: BigDecimal -> Float 82 | 83 | pure native hashCode :: BigDecimal -> Int 84 | 85 | pure native intValue :: BigDecimal -> Int 86 | 87 | pure native intValueExact :: BigDecimal -> Int 88 | 89 | pure native longValue :: BigDecimal -> Long 90 | 91 | pure native longValueExact :: BigDecimal -> Long 92 | 93 | pure native max :: BigDecimal -> BigDecimal -> BigDecimal 94 | 95 | pure native min :: BigDecimal -> BigDecimal -> BigDecimal 96 | 97 | pure native movePointLeft :: BigDecimal -> Int -> BigDecimal 98 | 99 | pure native movePointRight :: BigDecimal -> Int -> BigDecimal 100 | 101 | pure native multiply :: BigDecimal -> BigDecimal -> BigDecimal 102 | 103 | pure native negate :: BigDecimal -> BigDecimal 104 | 105 | pure native plus :: BigDecimal -> BigDecimal 106 | 107 | pure native pow :: BigDecimal -> Int -> BigDecimal 108 | 109 | pure native precision :: BigDecimal -> Int 110 | 111 | pure native remainder :: BigDecimal -> BigDecimal -> BigDecimal 112 | 113 | pure native scale :: BigDecimal -> Int 114 | 115 | pure native scaleByPowerOfTen :: BigDecimal -> Int -> BigDecimal 116 | 117 | pure native setScale :: BigDecimal -> Int -> Int -> BigDecimal 118 | | BigDecimal -> Int -> BigDecimal 119 | 120 | pure native shortValueExact :: BigDecimal -> Short 121 | 122 | pure native signum :: BigDecimal -> Int 123 | 124 | pure native stripTrailingZeros :: BigDecimal -> BigDecimal 125 | 126 | pure native subtract :: BigDecimal -> BigDecimal -> BigDecimal 127 | 128 | pure native toBigInteger :: BigDecimal -> Integer 129 | 130 | pure native toBigIntegerExact :: BigDecimal -> Integer 131 | 132 | pure native toEngineeringString :: BigDecimal -> String 133 | 134 | pure native toPlainString :: BigDecimal -> String 135 | 136 | pure native toString :: BigDecimal -> String 137 | 138 | pure native ulp :: BigDecimal -> BigDecimal 139 | 140 | pure native unscaledValue :: BigDecimal -> Integer 141 | 142 | pure native valueOf "java.math.BigDecimal.valueOf" :: Double -> BigDecimal 143 | | Long -> Int -> BigDecimal 144 | | Long -> BigDecimal 145 | 146 | data Connection = mutable native java.sql.Connection where 147 | 148 | pure native transaction_none "java.sql.Connection.TRANSACTION_NONE" :: Int 149 | pure native transaction_read_uncommitted "java.sql.Connection.TRANSACTION_READ_UNCOMMITTED" :: Int 150 | pure native transaction_read_committed "java.sql.Connection.TRANSACTION_READ_COMMITTED" :: Int 151 | pure native transaction_repeatable_read "java.sql.Connection.TRANSACTION_REPEATABLE_READ" :: Int 152 | pure native transaction_serializable "java.sql.Connection.TRANSACTION_SERIALIZABLE" :: Int 153 | 154 | native clearWarnings :: Connection -> IO () throws SQLException 155 | 156 | native close :: Connection -> IO () throws SQLException 157 | 158 | native commit :: Connection -> IO () throws SQLException 159 | 160 | native createStatement :: Connection -> Int -> Int -> Int -> IO Statement throws SQLException 161 | | Connection -> Int -> Int -> IO Statement throws SQLException 162 | | Connection -> IO Statement throws SQLException 163 | 164 | native getAutoCommit :: Connection -> IO Bool throws SQLException 165 | 166 | native getCatalog :: Connection -> IO String throws SQLException 167 | 168 | native getClientInfo :: Connection -> String -> IO String throws SQLException 169 | 170 | native getHoldability :: Connection -> IO Int throws SQLException 171 | 172 | native getMetaData :: Connection -> IO DatabaseMetaData throws SQLException 173 | 174 | native getNetworkTimeout :: Connection -> IO Int throws SQLException 175 | 176 | native getSchema :: Connection -> IO String throws SQLException 177 | 178 | native getTransactionIsolation :: Connection -> IO Int throws SQLException 179 | 180 | native getWarnings :: Connection -> IO SQLWarning throws SQLException 181 | 182 | native isClosed :: Connection -> IO Bool throws SQLException 183 | 184 | native isReadOnly :: Connection -> IO Bool throws SQLException 185 | 186 | native isValid :: Connection -> Int -> IO Bool throws SQLException 187 | 188 | native nativeSQL :: Connection -> String -> IO String throws SQLException 189 | 190 | native prepareCall :: Connection -> String -> Int -> Int -> Int -> IO CallableStatement throws SQLException 191 | | Connection -> String -> IO CallableStatement throws SQLException 192 | | Connection -> String -> Int -> Int -> IO CallableStatement throws SQLException 193 | 194 | native prepareStatement :: Connection -> String -> IO PreparedStatement throws SQLException 195 | | Connection -> String -> Int -> Int -> IO PreparedStatement throws SQLException 196 | | Connection -> String -> Int -> Int -> Int -> IO PreparedStatement throws SQLException 197 | | Connection -> String -> Int -> IO PreparedStatement throws SQLException 198 | 199 | native rollback :: Connection -> IO () throws SQLException 200 | 201 | native setAutoCommit :: Connection -> Bool -> IO () throws SQLException 202 | 203 | native setCatalog :: Connection -> String -> IO () throws SQLException 204 | 205 | native setHoldability :: Connection -> Int -> IO () throws SQLException 206 | 207 | native setReadOnly :: Connection -> Bool -> IO () throws SQLException 208 | 209 | native setSchema :: Connection -> String -> IO () throws SQLException 210 | 211 | native setTransactionIsolation :: Connection -> Int -> IO () throws SQLException 212 | 213 | data DatabaseMetaData = pure native java.sql.DatabaseMetaData where 214 | 215 | pure native procedureresultunknown "java.sql.DatabaseMetaData.procedureResultUnknown" :: Int 216 | pure native procedurenoresult "java.sql.DatabaseMetaData.procedureNoResult" :: Int 217 | pure native procedurereturnsresult "java.sql.DatabaseMetaData.procedureReturnsResult" :: Int 218 | pure native procedurecolumnunknown "java.sql.DatabaseMetaData.procedureColumnUnknown" :: Int 219 | pure native procedurecolumnin "java.sql.DatabaseMetaData.procedureColumnIn" :: Int 220 | pure native procedurecolumninout "java.sql.DatabaseMetaData.procedureColumnInOut" :: Int 221 | pure native procedurecolumnout "java.sql.DatabaseMetaData.procedureColumnOut" :: Int 222 | pure native procedurecolumnreturn "java.sql.DatabaseMetaData.procedureColumnReturn" :: Int 223 | pure native procedurecolumnresult "java.sql.DatabaseMetaData.procedureColumnResult" :: Int 224 | pure native procedurenonulls "java.sql.DatabaseMetaData.procedureNoNulls" :: Int 225 | pure native procedurenullable "java.sql.DatabaseMetaData.procedureNullable" :: Int 226 | pure native procedurenullableunknown "java.sql.DatabaseMetaData.procedureNullableUnknown" :: Int 227 | pure native columnnonulls "java.sql.DatabaseMetaData.columnNoNulls" :: Int 228 | pure native columnnullable "java.sql.DatabaseMetaData.columnNullable" :: Int 229 | pure native columnnullableunknown "java.sql.DatabaseMetaData.columnNullableUnknown" :: Int 230 | pure native bestrowtemporary "java.sql.DatabaseMetaData.bestRowTemporary" :: Int 231 | pure native bestrowtransaction "java.sql.DatabaseMetaData.bestRowTransaction" :: Int 232 | pure native bestrowsession "java.sql.DatabaseMetaData.bestRowSession" :: Int 233 | pure native bestrowunknown "java.sql.DatabaseMetaData.bestRowUnknown" :: Int 234 | pure native bestrownotpseudo "java.sql.DatabaseMetaData.bestRowNotPseudo" :: Int 235 | pure native bestrowpseudo "java.sql.DatabaseMetaData.bestRowPseudo" :: Int 236 | pure native versioncolumnunknown "java.sql.DatabaseMetaData.versionColumnUnknown" :: Int 237 | pure native versioncolumnnotpseudo "java.sql.DatabaseMetaData.versionColumnNotPseudo" :: Int 238 | pure native versioncolumnpseudo "java.sql.DatabaseMetaData.versionColumnPseudo" :: Int 239 | pure native importedkeycascade "java.sql.DatabaseMetaData.importedKeyCascade" :: Int 240 | pure native importedkeyrestrict "java.sql.DatabaseMetaData.importedKeyRestrict" :: Int 241 | pure native importedkeysetnull "java.sql.DatabaseMetaData.importedKeySetNull" :: Int 242 | pure native importedkeynoaction "java.sql.DatabaseMetaData.importedKeyNoAction" :: Int 243 | pure native importedkeysetdefault "java.sql.DatabaseMetaData.importedKeySetDefault" :: Int 244 | pure native importedkeyinitiallydeferred "java.sql.DatabaseMetaData.importedKeyInitiallyDeferred" :: Int 245 | pure native importedkeyinitiallyimmediate "java.sql.DatabaseMetaData.importedKeyInitiallyImmediate" :: Int 246 | pure native importedkeynotdeferrable "java.sql.DatabaseMetaData.importedKeyNotDeferrable" :: Int 247 | pure native typenonulls "java.sql.DatabaseMetaData.typeNoNulls" :: Int 248 | pure native typenullable "java.sql.DatabaseMetaData.typeNullable" :: Int 249 | pure native typenullableunknown "java.sql.DatabaseMetaData.typeNullableUnknown" :: Int 250 | pure native typeprednone "java.sql.DatabaseMetaData.typePredNone" :: Int 251 | pure native typepredchar "java.sql.DatabaseMetaData.typePredChar" :: Int 252 | pure native typepredbasic "java.sql.DatabaseMetaData.typePredBasic" :: Int 253 | pure native typesearchable "java.sql.DatabaseMetaData.typeSearchable" :: Int 254 | pure native tableindexstatistic "java.sql.DatabaseMetaData.tableIndexStatistic" :: Short 255 | pure native tableindexclustered "java.sql.DatabaseMetaData.tableIndexClustered" :: Short 256 | pure native tableindexhashed "java.sql.DatabaseMetaData.tableIndexHashed" :: Short 257 | pure native tableindexother "java.sql.DatabaseMetaData.tableIndexOther" :: Short 258 | pure native attributenonulls "java.sql.DatabaseMetaData.attributeNoNulls" :: Short 259 | pure native attributenullable "java.sql.DatabaseMetaData.attributeNullable" :: Short 260 | pure native attributenullableunknown "java.sql.DatabaseMetaData.attributeNullableUnknown" :: Short 261 | pure native sqlstatexopen "java.sql.DatabaseMetaData.sqlStateXOpen" :: Int 262 | pure native sqlstatesql "java.sql.DatabaseMetaData.sqlStateSQL" :: Int 263 | pure native sqlstatesql99 "java.sql.DatabaseMetaData.sqlStateSQL99" :: Int 264 | pure native functioncolumnunknown "java.sql.DatabaseMetaData.functionColumnUnknown" :: Int 265 | pure native functioncolumnin "java.sql.DatabaseMetaData.functionColumnIn" :: Int 266 | pure native functioncolumninout "java.sql.DatabaseMetaData.functionColumnInOut" :: Int 267 | pure native functioncolumnout "java.sql.DatabaseMetaData.functionColumnOut" :: Int 268 | pure native functionreturn "java.sql.DatabaseMetaData.functionReturn" :: Int 269 | pure native functioncolumnresult "java.sql.DatabaseMetaData.functionColumnResult" :: Int 270 | pure native functionnonulls "java.sql.DatabaseMetaData.functionNoNulls" :: Int 271 | pure native functionnullable "java.sql.DatabaseMetaData.functionNullable" :: Int 272 | pure native functionnullableunknown "java.sql.DatabaseMetaData.functionNullableUnknown" :: Int 273 | pure native functionresultunknown "java.sql.DatabaseMetaData.functionResultUnknown" :: Int 274 | pure native functionnotable "java.sql.DatabaseMetaData.functionNoTable" :: Int 275 | pure native functionreturnstable "java.sql.DatabaseMetaData.functionReturnsTable" :: Int 276 | 277 | native allProceduresAreCallable :: DatabaseMetaData -> IO Bool throws SQLException 278 | 279 | native allTablesAreSelectable :: DatabaseMetaData -> IO Bool throws SQLException 280 | 281 | native autoCommitFailureClosesAllResultSets :: DatabaseMetaData -> IO Bool throws SQLException 282 | 283 | native dataDefinitionCausesTransactionCommit :: DatabaseMetaData -> IO Bool throws SQLException 284 | 285 | native dataDefinitionIgnoredInTransactions :: DatabaseMetaData -> IO Bool throws SQLException 286 | 287 | native deletesAreDetected :: DatabaseMetaData -> Int -> IO Bool throws SQLException 288 | 289 | native doesMaxRowSizeIncludeBlobs :: DatabaseMetaData -> IO Bool throws SQLException 290 | 291 | native generatedKeyAlwaysReturned :: DatabaseMetaData -> IO Bool throws SQLException 292 | 293 | native getAttributes :: DatabaseMetaData -> String -> String -> String -> String -> IO ResultSet throws SQLException 294 | 295 | native getBestRowIdentifier :: DatabaseMetaData -> String -> String -> String -> Int -> Bool -> IO ResultSet throws SQLException 296 | 297 | native getCatalogSeparator :: DatabaseMetaData -> IO String throws SQLException 298 | 299 | native getCatalogTerm :: DatabaseMetaData -> IO String throws SQLException 300 | 301 | native getCatalogs :: DatabaseMetaData -> IO ResultSet throws SQLException 302 | 303 | native getClientInfoProperties :: DatabaseMetaData -> IO ResultSet throws SQLException 304 | 305 | native getColumnPrivileges :: DatabaseMetaData -> String -> String -> String -> String -> IO ResultSet throws SQLException 306 | 307 | native getColumns :: DatabaseMetaData -> String -> String -> String -> String -> IO ResultSet throws SQLException 308 | 309 | native getCrossReference :: DatabaseMetaData -> String -> String -> String -> String -> String -> String -> IO ResultSet throws SQLException 310 | 311 | native getDatabaseMajorVersion :: DatabaseMetaData -> IO Int throws SQLException 312 | 313 | native getDatabaseMinorVersion :: DatabaseMetaData -> IO Int throws SQLException 314 | 315 | native getDatabaseProductName :: DatabaseMetaData -> IO String throws SQLException 316 | 317 | native getDatabaseProductVersion :: DatabaseMetaData -> IO String throws SQLException 318 | 319 | native getDefaultTransactionIsolation :: DatabaseMetaData -> IO Int throws SQLException 320 | 321 | pure native getDriverMajorVersion :: DatabaseMetaData -> Int 322 | 323 | pure native getDriverMinorVersion :: DatabaseMetaData -> Int 324 | 325 | native getDriverName :: DatabaseMetaData -> IO String throws SQLException 326 | 327 | native getDriverVersion :: DatabaseMetaData -> IO String throws SQLException 328 | 329 | native getExportedKeys :: DatabaseMetaData -> String -> String -> String -> IO ResultSet throws SQLException 330 | 331 | native getExtraNameCharacters :: DatabaseMetaData -> IO String throws SQLException 332 | 333 | native getFunctionColumns :: DatabaseMetaData -> String -> String -> String -> String -> IO ResultSet throws SQLException 334 | 335 | native getFunctions :: DatabaseMetaData -> String -> String -> String -> IO ResultSet throws SQLException 336 | 337 | native getIdentifierQuoteString :: DatabaseMetaData -> IO String throws SQLException 338 | 339 | native getImportedKeys :: DatabaseMetaData -> String -> String -> String -> IO ResultSet throws SQLException 340 | 341 | native getIndexInfo :: DatabaseMetaData -> String -> String -> String -> Bool -> Bool -> IO ResultSet throws SQLException 342 | 343 | native getJDBCMajorVersion :: DatabaseMetaData -> IO Int throws SQLException 344 | 345 | native getJDBCMinorVersion :: DatabaseMetaData -> IO Int throws SQLException 346 | 347 | native getMaxBinaryLiteralLength :: DatabaseMetaData -> IO Int throws SQLException 348 | 349 | native getMaxCatalogNameLength :: DatabaseMetaData -> IO Int throws SQLException 350 | 351 | native getMaxCharLiteralLength :: DatabaseMetaData -> IO Int throws SQLException 352 | 353 | native getMaxColumnNameLength :: DatabaseMetaData -> IO Int throws SQLException 354 | 355 | native getMaxColumnsInGroupBy :: DatabaseMetaData -> IO Int throws SQLException 356 | 357 | native getMaxColumnsInIndex :: DatabaseMetaData -> IO Int throws SQLException 358 | 359 | native getMaxColumnsInOrderBy :: DatabaseMetaData -> IO Int throws SQLException 360 | 361 | native getMaxColumnsInSelect :: DatabaseMetaData -> IO Int throws SQLException 362 | 363 | native getMaxColumnsInTable :: DatabaseMetaData -> IO Int throws SQLException 364 | 365 | native getMaxConnections :: DatabaseMetaData -> IO Int throws SQLException 366 | 367 | native getMaxCursorNameLength :: DatabaseMetaData -> IO Int throws SQLException 368 | 369 | native getMaxIndexLength :: DatabaseMetaData -> IO Int throws SQLException 370 | 371 | native getMaxLogicalLobSize :: DatabaseMetaData -> IO Long throws SQLException 372 | 373 | native getMaxProcedureNameLength :: DatabaseMetaData -> IO Int throws SQLException 374 | 375 | native getMaxRowSize :: DatabaseMetaData -> IO Int throws SQLException 376 | 377 | native getMaxSchemaNameLength :: DatabaseMetaData -> IO Int throws SQLException 378 | 379 | native getMaxStatementLength :: DatabaseMetaData -> IO Int throws SQLException 380 | 381 | native getMaxStatements :: DatabaseMetaData -> IO Int throws SQLException 382 | 383 | native getMaxTableNameLength :: DatabaseMetaData -> IO Int throws SQLException 384 | 385 | native getMaxTablesInSelect :: DatabaseMetaData -> IO Int throws SQLException 386 | 387 | native getMaxUserNameLength :: DatabaseMetaData -> IO Int throws SQLException 388 | 389 | native getNumericFunctions :: DatabaseMetaData -> IO String throws SQLException 390 | 391 | native getPrimaryKeys :: DatabaseMetaData -> String -> String -> String -> IO ResultSet throws SQLException 392 | 393 | native getProcedureColumns :: DatabaseMetaData -> String -> String -> String -> String -> IO ResultSet throws SQLException 394 | 395 | native getProcedureTerm :: DatabaseMetaData -> IO String throws SQLException 396 | 397 | native getProcedures :: DatabaseMetaData -> String -> String -> String -> IO ResultSet throws SQLException 398 | 399 | native getPseudoColumns :: DatabaseMetaData -> String -> String -> String -> String -> IO ResultSet throws SQLException 400 | 401 | native getResultSetHoldability :: DatabaseMetaData -> IO Int throws SQLException 402 | 403 | native getSQLKeywords :: DatabaseMetaData -> IO String throws SQLException 404 | 405 | native getSQLStateType :: DatabaseMetaData -> IO Int throws SQLException 406 | 407 | native getSchemaTerm :: DatabaseMetaData -> IO String throws SQLException 408 | 409 | native getSchemas :: DatabaseMetaData -> IO ResultSet throws SQLException 410 | | DatabaseMetaData -> String -> String -> IO ResultSet throws SQLException 411 | 412 | native getSearchStringEscape :: DatabaseMetaData -> IO String throws SQLException 413 | 414 | native getStringFunctions :: DatabaseMetaData -> IO String throws SQLException 415 | 416 | native getSuperTables :: DatabaseMetaData -> String -> String -> String -> IO ResultSet throws SQLException 417 | 418 | native getSuperTypes :: DatabaseMetaData -> String -> String -> String -> IO ResultSet throws SQLException 419 | 420 | native getSystemFunctions :: DatabaseMetaData -> IO String throws SQLException 421 | 422 | native getTablePrivileges :: DatabaseMetaData -> String -> String -> String -> IO ResultSet throws SQLException 423 | 424 | native getTableTypes :: DatabaseMetaData -> IO ResultSet throws SQLException 425 | 426 | native getTimeDateFunctions :: DatabaseMetaData -> IO String throws SQLException 427 | 428 | native getTypeInfo :: DatabaseMetaData -> IO ResultSet throws SQLException 429 | 430 | native getURL :: DatabaseMetaData -> IO String throws SQLException 431 | 432 | native getUserName :: DatabaseMetaData -> IO String throws SQLException 433 | 434 | native getVersionColumns :: DatabaseMetaData -> String -> String -> String -> IO ResultSet throws SQLException 435 | 436 | native insertsAreDetected :: DatabaseMetaData -> Int -> IO Bool throws SQLException 437 | 438 | native isCatalogAtStart :: DatabaseMetaData -> IO Bool throws SQLException 439 | 440 | native isReadOnly :: DatabaseMetaData -> IO Bool throws SQLException 441 | 442 | native locatorsUpdateCopy :: DatabaseMetaData -> IO Bool throws SQLException 443 | 444 | native nullPlusNonNullIsNull :: DatabaseMetaData -> IO Bool throws SQLException 445 | 446 | native nullsAreSortedAtEnd :: DatabaseMetaData -> IO Bool throws SQLException 447 | 448 | native nullsAreSortedAtStart :: DatabaseMetaData -> IO Bool throws SQLException 449 | 450 | native nullsAreSortedHigh :: DatabaseMetaData -> IO Bool throws SQLException 451 | 452 | native nullsAreSortedLow :: DatabaseMetaData -> IO Bool throws SQLException 453 | 454 | native othersDeletesAreVisible :: DatabaseMetaData -> Int -> IO Bool throws SQLException 455 | 456 | native othersInsertsAreVisible :: DatabaseMetaData -> Int -> IO Bool throws SQLException 457 | 458 | native othersUpdatesAreVisible :: DatabaseMetaData -> Int -> IO Bool throws SQLException 459 | 460 | native ownDeletesAreVisible :: DatabaseMetaData -> Int -> IO Bool throws SQLException 461 | 462 | native ownInsertsAreVisible :: DatabaseMetaData -> Int -> IO Bool throws SQLException 463 | 464 | native ownUpdatesAreVisible :: DatabaseMetaData -> Int -> IO Bool throws SQLException 465 | 466 | native storesLowerCaseIdentifiers :: DatabaseMetaData -> IO Bool throws SQLException 467 | 468 | native storesLowerCaseQuotedIdentifiers :: DatabaseMetaData -> IO Bool throws SQLException 469 | 470 | native storesMixedCaseIdentifiers :: DatabaseMetaData -> IO Bool throws SQLException 471 | 472 | native storesMixedCaseQuotedIdentifiers :: DatabaseMetaData -> IO Bool throws SQLException 473 | 474 | native storesUpperCaseIdentifiers :: DatabaseMetaData -> IO Bool throws SQLException 475 | 476 | native storesUpperCaseQuotedIdentifiers :: DatabaseMetaData -> IO Bool throws SQLException 477 | 478 | native supportsANSI92EntryLevelSQL :: DatabaseMetaData -> IO Bool throws SQLException 479 | 480 | native supportsANSI92FullSQL :: DatabaseMetaData -> IO Bool throws SQLException 481 | 482 | native supportsANSI92IntermediateSQL :: DatabaseMetaData -> IO Bool throws SQLException 483 | 484 | native supportsAlterTableWithAddColumn :: DatabaseMetaData -> IO Bool throws SQLException 485 | 486 | native supportsAlterTableWithDropColumn :: DatabaseMetaData -> IO Bool throws SQLException 487 | 488 | native supportsBatchUpdates :: DatabaseMetaData -> IO Bool throws SQLException 489 | 490 | native supportsCatalogsInDataManipulation :: DatabaseMetaData -> IO Bool throws SQLException 491 | 492 | native supportsCatalogsInIndexDefinitions :: DatabaseMetaData -> IO Bool throws SQLException 493 | 494 | native supportsCatalogsInPrivilegeDefinitions :: DatabaseMetaData -> IO Bool throws SQLException 495 | 496 | native supportsCatalogsInProcedureCalls :: DatabaseMetaData -> IO Bool throws SQLException 497 | 498 | native supportsCatalogsInTableDefinitions :: DatabaseMetaData -> IO Bool throws SQLException 499 | 500 | native supportsColumnAliasing :: DatabaseMetaData -> IO Bool throws SQLException 501 | 502 | native supportsConvert :: DatabaseMetaData -> IO Bool throws SQLException 503 | | DatabaseMetaData -> Int -> Int -> IO Bool throws SQLException 504 | 505 | native supportsCoreSQLGrammar :: DatabaseMetaData -> IO Bool throws SQLException 506 | 507 | native supportsCorrelatedSubqueries :: DatabaseMetaData -> IO Bool throws SQLException 508 | 509 | native supportsDataDefinitionAndDataManipulationTransactions :: DatabaseMetaData -> IO Bool throws SQLException 510 | 511 | native supportsDataManipulationTransactionsOnly :: DatabaseMetaData -> IO Bool throws SQLException 512 | 513 | native supportsDifferentTableCorrelationNames :: DatabaseMetaData -> IO Bool throws SQLException 514 | 515 | native supportsExpressionsInOrderBy :: DatabaseMetaData -> IO Bool throws SQLException 516 | 517 | native supportsExtendedSQLGrammar :: DatabaseMetaData -> IO Bool throws SQLException 518 | 519 | native supportsFullOuterJoins :: DatabaseMetaData -> IO Bool throws SQLException 520 | 521 | native supportsGetGeneratedKeys :: DatabaseMetaData -> IO Bool throws SQLException 522 | 523 | native supportsGroupBy :: DatabaseMetaData -> IO Bool throws SQLException 524 | 525 | native supportsGroupByBeyondSelect :: DatabaseMetaData -> IO Bool throws SQLException 526 | 527 | native supportsGroupByUnrelated :: DatabaseMetaData -> IO Bool throws SQLException 528 | 529 | native supportsIntegrityEnhancementFacility :: DatabaseMetaData -> IO Bool throws SQLException 530 | 531 | native supportsLikeEscapeClause :: DatabaseMetaData -> IO Bool throws SQLException 532 | 533 | native supportsLimitedOuterJoins :: DatabaseMetaData -> IO Bool throws SQLException 534 | 535 | native supportsMinimumSQLGrammar :: DatabaseMetaData -> IO Bool throws SQLException 536 | 537 | native supportsMixedCaseIdentifiers :: DatabaseMetaData -> IO Bool throws SQLException 538 | 539 | native supportsMixedCaseQuotedIdentifiers :: DatabaseMetaData -> IO Bool throws SQLException 540 | 541 | native supportsMultipleOpenResults :: DatabaseMetaData -> IO Bool throws SQLException 542 | 543 | native supportsMultipleResultSets :: DatabaseMetaData -> IO Bool throws SQLException 544 | 545 | native supportsMultipleTransactions :: DatabaseMetaData -> IO Bool throws SQLException 546 | 547 | native supportsNamedParameters :: DatabaseMetaData -> IO Bool throws SQLException 548 | 549 | native supportsNonNullableColumns :: DatabaseMetaData -> IO Bool throws SQLException 550 | 551 | native supportsOpenCursorsAcrossCommit :: DatabaseMetaData -> IO Bool throws SQLException 552 | 553 | native supportsOpenCursorsAcrossRollback :: DatabaseMetaData -> IO Bool throws SQLException 554 | 555 | native supportsOpenStatementsAcrossCommit :: DatabaseMetaData -> IO Bool throws SQLException 556 | 557 | native supportsOpenStatementsAcrossRollback :: DatabaseMetaData -> IO Bool throws SQLException 558 | 559 | native supportsOrderByUnrelated :: DatabaseMetaData -> IO Bool throws SQLException 560 | 561 | native supportsOuterJoins :: DatabaseMetaData -> IO Bool throws SQLException 562 | 563 | native supportsPositionedDelete :: DatabaseMetaData -> IO Bool throws SQLException 564 | 565 | native supportsPositionedUpdate :: DatabaseMetaData -> IO Bool throws SQLException 566 | 567 | native supportsRefCursors :: DatabaseMetaData -> IO Bool throws SQLException 568 | 569 | native supportsResultSetConcurrency :: DatabaseMetaData -> Int -> Int -> IO Bool throws SQLException 570 | 571 | native supportsResultSetHoldability :: DatabaseMetaData -> Int -> IO Bool throws SQLException 572 | 573 | native supportsResultSetType :: DatabaseMetaData -> Int -> IO Bool throws SQLException 574 | 575 | native supportsSavepoints :: DatabaseMetaData -> IO Bool throws SQLException 576 | 577 | native supportsSchemasInDataManipulation :: DatabaseMetaData -> IO Bool throws SQLException 578 | 579 | native supportsSchemasInIndexDefinitions :: DatabaseMetaData -> IO Bool throws SQLException 580 | 581 | native supportsSchemasInPrivilegeDefinitions :: DatabaseMetaData -> IO Bool throws SQLException 582 | 583 | native supportsSchemasInProcedureCalls :: DatabaseMetaData -> IO Bool throws SQLException 584 | 585 | native supportsSchemasInTableDefinitions :: DatabaseMetaData -> IO Bool throws SQLException 586 | 587 | native supportsSelectForUpdate :: DatabaseMetaData -> IO Bool throws SQLException 588 | 589 | native supportsStatementPooling :: DatabaseMetaData -> IO Bool throws SQLException 590 | 591 | native supportsStoredFunctionsUsingCallSyntax :: DatabaseMetaData -> IO Bool throws SQLException 592 | 593 | native supportsStoredProcedures :: DatabaseMetaData -> IO Bool throws SQLException 594 | 595 | native supportsSubqueriesInComparisons :: DatabaseMetaData -> IO Bool throws SQLException 596 | 597 | native supportsSubqueriesInExists :: DatabaseMetaData -> IO Bool throws SQLException 598 | 599 | native supportsSubqueriesInIns :: DatabaseMetaData -> IO Bool throws SQLException 600 | 601 | native supportsSubqueriesInQuantifieds :: DatabaseMetaData -> IO Bool throws SQLException 602 | 603 | native supportsTableCorrelationNames :: DatabaseMetaData -> IO Bool throws SQLException 604 | 605 | native supportsTransactionIsolationLevel :: DatabaseMetaData -> Int -> IO Bool throws SQLException 606 | 607 | native supportsTransactions :: DatabaseMetaData -> IO Bool throws SQLException 608 | 609 | native supportsUnion :: DatabaseMetaData -> IO Bool throws SQLException 610 | 611 | native supportsUnionAll :: DatabaseMetaData -> IO Bool throws SQLException 612 | 613 | native updatesAreDetected :: DatabaseMetaData -> Int -> IO Bool throws SQLException 614 | 615 | native usesLocalFilePerTable :: DatabaseMetaData -> IO Bool throws SQLException 616 | 617 | native usesLocalFiles :: DatabaseMetaData -> IO Bool throws SQLException 618 | 619 | data Date = pure native java.sql.Date where 620 | 621 | pure native new :: Long -> Date 622 | 623 | pure native toString :: Date -> String 624 | 625 | pure native valueOf "java.sql.Date.valueOf" :: String -> Date 626 | 627 | data DriverManager = mutable native java.sql.DriverManager where 628 | 629 | native getConnection "java.sql.DriverManager.getConnection" :: String -> IO Connection throws SQLException 630 | | String -> String -> String -> IO Connection throws SQLException 631 | 632 | data ParameterMetaData = pure native java.sql.ParameterMetaData where 633 | 634 | pure native parameternonulls "java.sql.ParameterMetaData.parameterNoNulls" :: Int 635 | pure native parameternullable "java.sql.ParameterMetaData.parameterNullable" :: Int 636 | pure native parameternullableunknown "java.sql.ParameterMetaData.parameterNullableUnknown" :: Int 637 | pure native parametermodeunknown "java.sql.ParameterMetaData.parameterModeUnknown" :: Int 638 | pure native parametermodein "java.sql.ParameterMetaData.parameterModeIn" :: Int 639 | pure native parametermodeinout "java.sql.ParameterMetaData.parameterModeInOut" :: Int 640 | pure native parametermodeout "java.sql.ParameterMetaData.parameterModeOut" :: Int 641 | 642 | native getParameterClassName :: ParameterMetaData -> Int -> IO String throws SQLException 643 | 644 | native getParameterCount :: ParameterMetaData -> IO Int throws SQLException 645 | 646 | native getParameterMode :: ParameterMetaData -> Int -> IO Int throws SQLException 647 | 648 | native getParameterType :: ParameterMetaData -> Int -> IO Int throws SQLException 649 | 650 | native getParameterTypeName :: ParameterMetaData -> Int -> IO String throws SQLException 651 | 652 | native getPrecision :: ParameterMetaData -> Int -> IO Int throws SQLException 653 | 654 | native getScale :: ParameterMetaData -> Int -> IO Int throws SQLException 655 | 656 | native isNullable :: ParameterMetaData -> Int -> IO Int throws SQLException 657 | 658 | native isSigned :: ParameterMetaData -> Int -> IO Bool throws SQLException 659 | 660 | data PreparedStatement = pure native java.sql.PreparedStatement where 661 | 662 | native addBatch :: PreparedStatement -> IO () throws SQLException 663 | 664 | native clearParameters :: PreparedStatement -> IO () throws SQLException 665 | 666 | native execute :: PreparedStatement -> IO Bool throws SQLException 667 | 668 | native executeLargeUpdate :: PreparedStatement -> IO Long throws SQLException 669 | 670 | native executeQuery :: PreparedStatement -> IO ResultSet throws SQLException 671 | 672 | native executeUpdate :: PreparedStatement -> IO Int throws SQLException 673 | 674 | native getGeneratedKeys :: PreparedStatement -> IO ResultSet throws SQLException 675 | 676 | native getMetaData :: PreparedStatement -> IO ResultSetMetaData throws SQLException 677 | 678 | native getParameterMetaData :: PreparedStatement -> IO ParameterMetaData throws SQLException 679 | 680 | native setBoolean :: PreparedStatement -> Int -> Bool -> IO () throws SQLException 681 | 682 | native setByte :: PreparedStatement -> Int -> Byte -> IO () throws SQLException 683 | 684 | native setDouble :: PreparedStatement -> Int -> Double -> IO () throws SQLException 685 | 686 | native setFloat :: PreparedStatement -> Int -> Float -> IO () throws SQLException 687 | 688 | native setInt :: PreparedStatement -> Int -> Int -> IO () throws SQLException 689 | 690 | native setLong :: PreparedStatement -> Int -> Long -> IO () throws SQLException 691 | 692 | native setNString :: PreparedStatement -> Int -> String -> IO () throws SQLException 693 | 694 | native setNull :: PreparedStatement -> Int -> Int -> IO () throws SQLException 695 | | PreparedStatement -> Int -> Int -> String -> IO () throws SQLException 696 | 697 | native setObject :: PreparedStatement -> Int -> Object -> Int -> IO () throws SQLException 698 | | PreparedStatement -> Int -> Object -> IO () throws SQLException 699 | | PreparedStatement -> Int -> Object -> Int -> Int -> IO () throws SQLException 700 | 701 | native setShort :: PreparedStatement -> Int -> Short -> IO () throws SQLException 702 | 703 | native setString :: PreparedStatement -> Int -> String -> IO () throws SQLException 704 | 705 | data ResultSet = mutable native java.sql.ResultSet where 706 | 707 | pure native fetch_forward "java.sql.ResultSet.FETCH_FORWARD" :: Int 708 | pure native fetch_reverse "java.sql.ResultSet.FETCH_REVERSE" :: Int 709 | pure native fetch_unknown "java.sql.ResultSet.FETCH_UNKNOWN" :: Int 710 | pure native type_forward_only "java.sql.ResultSet.TYPE_FORWARD_ONLY" :: Int 711 | pure native type_scroll_insensitive "java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE" :: Int 712 | pure native type_scroll_sensitive "java.sql.ResultSet.TYPE_SCROLL_SENSITIVE" :: Int 713 | pure native concur_read_only "java.sql.ResultSet.CONCUR_READ_ONLY" :: Int 714 | pure native concur_updatable "java.sql.ResultSet.CONCUR_UPDATABLE" :: Int 715 | pure native hold_cursors_over_commit "java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT" :: Int 716 | pure native close_cursors_at_commit "java.sql.ResultSet.CLOSE_CURSORS_AT_COMMIT" :: Int 717 | 718 | native close :: ResultSet -> IO () throws SQLException 719 | 720 | native getBigDecimal :: ResultSet -> Int -> IO BigDecimal throws SQLException 721 | | ResultSet -> String -> IO BigDecimal throws SQLException 722 | 723 | native getBoolean :: ResultSet -> Int -> IO Bool throws SQLException 724 | | ResultSet -> String -> IO Bool throws SQLException 725 | 726 | native getByte :: ResultSet -> String -> IO Byte throws SQLException 727 | | ResultSet -> Int -> IO Byte throws SQLException 728 | 729 | native getBytes :: ResultSet -> Int -> IO (ArrayOf RealWorld Byte) throws SQLException 730 | | ResultSet -> String -> IO (ArrayOf RealWorld Byte) throws SQLException 731 | 732 | native getDate :: ResultSet -> String -> IO Date throws SQLException 733 | | ResultSet -> Int -> IO Date throws SQLException 734 | 735 | native getDouble :: ResultSet -> String -> IO Double throws SQLException 736 | | ResultSet -> Int -> IO Double throws SQLException 737 | 738 | native getFetchDirection :: ResultSet -> IO Int throws SQLException 739 | 740 | native getFetchSize :: ResultSet -> IO Int throws SQLException 741 | 742 | native getFloat :: ResultSet -> String -> IO Float throws SQLException 743 | | ResultSet -> Int -> IO Float throws SQLException 744 | 745 | native getHoldability :: ResultSet -> IO Int throws SQLException 746 | 747 | native getInt :: ResultSet -> Int -> IO Int throws SQLException 748 | | ResultSet -> String -> IO Int throws SQLException 749 | 750 | native getLong :: ResultSet -> String -> IO Long throws SQLException 751 | | ResultSet -> Int -> IO Long throws SQLException 752 | 753 | native getMetaData :: ResultSet -> IO ResultSetMetaData throws SQLException 754 | 755 | native getNString :: ResultSet -> String -> IO String throws SQLException 756 | | ResultSet -> Int -> IO String throws SQLException 757 | 758 | native getObject :: ResultSet -> String -> IO Object throws SQLException 759 | | ResultSet -> Int -> IO Object throws SQLException 760 | | ResultSet -> Int -> Class t -> IO t throws SQLException 761 | | ResultSet -> String -> Class t -> IO t throws SQLException 762 | 763 | native getRow :: ResultSet -> IO Int throws SQLException 764 | 765 | native getShort :: ResultSet -> Int -> IO Short throws SQLException 766 | | ResultSet -> String -> IO Short throws SQLException 767 | 768 | native getString :: ResultSet -> Int -> IO String throws SQLException 769 | | ResultSet -> String -> IO String throws SQLException 770 | 771 | native getTime :: ResultSet -> String -> IO Time throws SQLException 772 | | ResultSet -> Int -> IO Time throws SQLException 773 | 774 | native getTimestamp :: ResultSet -> Int -> IO Timestamp throws SQLException 775 | | ResultSet -> String -> IO Timestamp throws SQLException 776 | 777 | native getType :: ResultSet -> IO Int throws SQLException 778 | 779 | native getWarnings :: ResultSet -> IO SQLWarning throws SQLException 780 | 781 | native isAfterLast :: ResultSet -> IO Bool throws SQLException 782 | 783 | native isBeforeFirst :: ResultSet -> IO Bool throws SQLException 784 | 785 | native isClosed :: ResultSet -> IO Bool throws SQLException 786 | 787 | native isFirst :: ResultSet -> IO Bool throws SQLException 788 | 789 | native isLast :: ResultSet -> IO Bool throws SQLException 790 | 791 | native next :: ResultSet -> IO Bool throws SQLException 792 | 793 | native relative :: ResultSet -> Int -> IO Bool throws SQLException 794 | 795 | native rowDeleted :: ResultSet -> IO Bool throws SQLException 796 | 797 | native rowInserted :: ResultSet -> IO Bool throws SQLException 798 | 799 | native rowUpdated :: ResultSet -> IO Bool throws SQLException 800 | 801 | native wasNull :: ResultSet -> IO Bool throws SQLException 802 | 803 | data ResultSetMetaData = mutable native java.sql.ResultSetMetaData where 804 | 805 | pure native columnnonulls "java.sql.ResultSetMetaData.columnNoNulls" :: Int 806 | pure native columnnullable "java.sql.ResultSetMetaData.columnNullable" :: Int 807 | pure native columnnullableunknown "java.sql.ResultSetMetaData.columnNullableUnknown" :: Int 808 | 809 | native getCatalogName :: ResultSetMetaData -> Int -> IO String throws SQLException 810 | 811 | native getColumnClassName :: ResultSetMetaData -> Int -> IO String throws SQLException 812 | 813 | native getColumnCount :: ResultSetMetaData -> IO Int throws SQLException 814 | 815 | native getColumnDisplaySize :: ResultSetMetaData -> Int -> IO Int throws SQLException 816 | 817 | native getColumnLabel :: ResultSetMetaData -> Int -> IO String throws SQLException 818 | 819 | native getColumnName :: ResultSetMetaData -> Int -> IO String throws SQLException 820 | 821 | native getColumnType :: ResultSetMetaData -> Int -> IO Int throws SQLException 822 | 823 | native getColumnTypeName :: ResultSetMetaData -> Int -> IO String throws SQLException 824 | 825 | native getPrecision :: ResultSetMetaData -> Int -> IO Int throws SQLException 826 | 827 | native getScale :: ResultSetMetaData -> Int -> IO Int throws SQLException 828 | 829 | native getSchemaName :: ResultSetMetaData -> Int -> IO String throws SQLException 830 | 831 | native getTableName :: ResultSetMetaData -> Int -> IO String throws SQLException 832 | 833 | native isAutoIncrement :: ResultSetMetaData -> Int -> IO Bool throws SQLException 834 | 835 | native isCaseSensitive :: ResultSetMetaData -> Int -> IO Bool throws SQLException 836 | 837 | native isCurrency :: ResultSetMetaData -> Int -> IO Bool throws SQLException 838 | 839 | native isDefinitelyWritable :: ResultSetMetaData -> Int -> IO Bool throws SQLException 840 | 841 | native isNullable :: ResultSetMetaData -> Int -> IO Int throws SQLException 842 | 843 | native isReadOnly :: ResultSetMetaData -> Int -> IO Bool throws SQLException 844 | 845 | native isSearchable :: ResultSetMetaData -> Int -> IO Bool throws SQLException 846 | 847 | native isSigned :: ResultSetMetaData -> Int -> IO Bool throws SQLException 848 | 849 | native isWritable :: ResultSetMetaData -> Int -> IO Bool throws SQLException 850 | 851 | data SQLException = mutable native java.sql.SQLException 852 | 853 | derive Exceptional SQLException 854 | 855 | data SQLWarning = mutable native java.sql.SQLWarning 856 | 857 | derive Exceptional SQLWarning 858 | 859 | data Statement = mutable native java.sql.Statement where 860 | 861 | pure native close_current_result "java.sql.Statement.CLOSE_CURRENT_RESULT" :: Int 862 | pure native keep_current_result "java.sql.Statement.KEEP_CURRENT_RESULT" :: Int 863 | pure native close_all_results "java.sql.Statement.CLOSE_ALL_RESULTS" :: Int 864 | pure native success_no_info "java.sql.Statement.SUCCESS_NO_INFO" :: Int 865 | pure native execute_failed "java.sql.Statement.EXECUTE_FAILED" :: Int 866 | pure native return_generated_keys "java.sql.Statement.RETURN_GENERATED_KEYS" :: Int 867 | pure native no_generated_keys "java.sql.Statement.NO_GENERATED_KEYS" :: Int 868 | 869 | native addBatch :: Statement -> String -> IO () throws SQLException 870 | 871 | native cancel :: Statement -> IO () throws SQLException 872 | 873 | native clearBatch :: Statement -> IO () throws SQLException 874 | 875 | native clearWarnings :: Statement -> IO () throws SQLException 876 | 877 | native close :: Statement -> IO () throws SQLException 878 | 879 | native closeOnCompletion :: Statement -> IO () throws SQLException 880 | 881 | native execute :: Statement -> String -> Int -> IO Bool throws SQLException 882 | |Statement -> String -> IO Bool throws SQLException 883 | 884 | native executeQuery :: Statement -> String -> IO ResultSet throws SQLException 885 | 886 | native executeUpdate :: Statement -> String -> Int -> IO Int throws SQLException 887 | | Statement -> String -> IO Int throws SQLException 888 | 889 | native getFetchDirection :: Statement -> IO Int throws SQLException 890 | 891 | native getFetchSize :: Statement -> IO Int throws SQLException 892 | 893 | native getGeneratedKeys :: Statement -> IO ResultSet throws SQLException 894 | 895 | native getLargeMaxRows :: Statement -> IO Long throws SQLException 896 | 897 | native getLargeUpdateCount :: Statement -> IO Long throws SQLException 898 | 899 | native getMaxFieldSize :: Statement -> IO Int throws SQLException 900 | 901 | native getMaxRows :: Statement -> IO Int throws SQLException 902 | 903 | native getMoreResults :: Statement -> Int -> IO Bool throws SQLException 904 | | Statement -> IO Bool throws SQLException 905 | 906 | native getQueryTimeout :: Statement -> IO Int throws SQLException 907 | 908 | native getResultSet :: Statement -> IO ResultSet throws SQLException 909 | 910 | native getResultSetConcurrency :: Statement -> IO Int throws SQLException 911 | 912 | native getResultSetHoldability :: Statement -> IO Int throws SQLException 913 | 914 | native getResultSetType :: Statement -> IO Int throws SQLException 915 | 916 | native getUpdateCount :: Statement -> IO Int throws SQLException 917 | 918 | native getWarnings :: Statement -> IO SQLWarning throws SQLException 919 | 920 | native isCloseOnCompletion :: Statement -> IO Bool throws SQLException 921 | 922 | native isClosed :: Statement -> IO Bool throws SQLException 923 | 924 | native isPoolable :: Statement -> IO Bool throws SQLException 925 | 926 | data Time = pure native java.sql.Time where 927 | 928 | pure native new :: Long -> Time 929 | 930 | pure native toString :: Time -> String 931 | 932 | pure native valueOf "java.sql.Time.valueOf" :: String -> Time 933 | 934 | data Timestamp = pure native java.sql.Timestamp where 935 | 936 | pure native new :: Long -> Timestamp 937 | 938 | pure native after :: Timestamp -> Timestamp -> Bool 939 | 940 | pure native before :: Timestamp -> Timestamp -> Bool 941 | 942 | pure native compareTo :: Timestamp -> Timestamp -> Int 943 | 944 | pure native equals :: Timestamp -> Timestamp -> Bool 945 | | Timestamp -> Object -> Bool 946 | 947 | pure native getNanos :: Timestamp -> Int 948 | 949 | pure native getTime :: Timestamp -> Long 950 | 951 | pure native hashCode :: Timestamp -> Int 952 | 953 | pure native toString :: Timestamp -> String 954 | 955 | pure native valueOf "java.sql.Timestamp.valueOf" :: String -> Timestamp 956 | 957 | data Types = pure native java.sql.Types where 958 | 959 | pure native bit "java.sql.Types.BIT" :: Int 960 | pure native tinyint "java.sql.Types.TINYINT" :: Int 961 | pure native smallint "java.sql.Types.SMALLINT" :: Int 962 | pure native integer "java.sql.Types.INTEGER" :: Int 963 | pure native bigint "java.sql.Types.BIGINT" :: Int 964 | pure native float "java.sql.Types.FLOAT" :: Int 965 | pure native real "java.sql.Types.REAL" :: Int 966 | pure native double "java.sql.Types.DOUBLE" :: Int 967 | pure native numeric "java.sql.Types.NUMERIC" :: Int 968 | pure native decimal "java.sql.Types.DECIMAL" :: Int 969 | pure native char "java.sql.Types.CHAR" :: Int 970 | pure native varchar "java.sql.Types.VARCHAR" :: Int 971 | pure native longvarchar "java.sql.Types.LONGVARCHAR" :: Int 972 | pure native date "java.sql.Types.DATE" :: Int 973 | pure native time "java.sql.Types.TIME" :: Int 974 | pure native timestamp "java.sql.Types.TIMESTAMP" :: Int 975 | pure native binary "java.sql.Types.BINARY" :: Int 976 | pure native varbinary "java.sql.Types.VARBINARY" :: Int 977 | pure native longvarbinary "java.sql.Types.LONGVARBINARY" :: Int 978 | pure native null "java.sql.Types.NULL" :: Int 979 | pure native other "java.sql.Types.OTHER" :: Int 980 | pure native java_object "java.sql.Types.JAVA_OBJECT" :: Int 981 | pure native distinct "java.sql.Types.DISTINCT" :: Int 982 | pure native struct "java.sql.Types.STRUCT" :: Int 983 | pure native array "java.sql.Types.ARRAY" :: Int 984 | pure native blob "java.sql.Types.BLOB" :: Int 985 | pure native clob "java.sql.Types.CLOB" :: Int 986 | pure native ref "java.sql.Types.REF" :: Int 987 | pure native datalink "java.sql.Types.DATALINK" :: Int 988 | pure native boolean "java.sql.Types.BOOLEAN" :: Int 989 | pure native rowid "java.sql.Types.ROWID" :: Int 990 | pure native nchar "java.sql.Types.NCHAR" :: Int 991 | pure native nvarchar "java.sql.Types.NVARCHAR" :: Int 992 | pure native longnvarchar "java.sql.Types.LONGNVARCHAR" :: Int 993 | pure native nclob "java.sql.Types.NCLOB" :: Int 994 | pure native sqlxml "java.sql.Types.SQLXML" :: Int 995 | pure native ref_cursor "java.sql.Types.REF_CURSOR" :: Int 996 | pure native time_with_timezone "java.sql.Types.TIME_WITH_TIMEZONE" :: Int 997 | pure native timestamp_with_timezone "java.sql.Types.TIMESTAMP_WITH_TIMEZONE" :: Int 998 | 999 | data Blob = mutable native java.sql.Blob where 1000 | 1001 | native getBytes :: Blob -> Long -> Int -> IO (ArrayOf RealWorld Byte) throws SQLException 1002 | 1003 | native length :: Blob -> IO Long throws SQLException 1004 | --------------------------------------------------------------------------------