Skip to content

Commit 67dd0bc

Browse files
committed
modified build
1 parent 9f78a64 commit 67dd0bc

File tree

8 files changed

+38
-34
lines changed

8 files changed

+38
-34
lines changed

.travis.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,11 @@ install:
2828
- ci/install-instantclient.sh
2929
- ci/install-ocilib.sh
3030

31-
#before_script:
32-
#- docker --version
33-
#- docker pull alexeiled/docker-oracle-xe-11g
34-
#- docker run -d --name oracle -p 1521:1521 -v $(pwd)/sql:/etc/entrypoint-initdb.d alexeiled/docker-oracle-xe-11g
35-
36-
3731
# This line does all of the work: installs GHC if necessary, build the library,
3832
# executables, and test suites, and runs the test suites. --no-terminal works
3933
# around some quirks in Travis's terminal implementation.
4034
script:
41-
- stack --no-terminal --install-ghc build --test --no-run-tests
42-
- LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/test/test
43-
- cat /etc/ld.so.conf
35+
- stack --no-terminal --install-ghc build --test
4436

4537
# Caching so the next build will be fast too.
4638
cache:

ci/install-instantclient.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
set -ex
44

5-
cd ~
6-
wget https://storage.googleapis.com/oracle.fpinsight.com/instantClient/instantclient-basiclite-linux.x64-12.1.0.2.0.zip
7-
wget https://storage.googleapis.com/oracle.fpinsight.com/instantClient/instantclient-sdk-linux.x64-12.1.0.2.0.zip
8-
unzip instantclient-basiclite-linux.x64-12.1.0.2.0.zip
9-
sudo cp instantclient_12_1/lib* /usr/local/lib/
10-
sudo ln -s /usr/local/lib/libclntsh.so.12.1 /usr/local/lib/libclntsh.so
11-
ln -s $HOME/instantclient_12_1/libclntsh.so.12.1 $HOME/instantclient_12_1/libclntsh.so
12-
unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip
5+
cd /tmp
6+
7+
wget https://storage.googleapis.com/oracle.fpinsight.com/instantClient/oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb
8+
sudo dpkg -i oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb
9+
rm -f oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb
10+
wget https://storage.googleapis.com/oracle.fpinsight.com/instantClient/oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb
11+
sudo dpkg -i oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb
12+
rm -f oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb
13+
sudo echo "/usr/lib/oracle/12.1/client64/lib" > /etc/ld.so.conf.d/oracle-client.conf
14+
sudo ldconfig

ci/install-ocilib.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#!/bin/sh
22
set -ex
33

4-
cd ~
5-
wget https://storage.googleapis.com/oracle.fpinsight.com/instantClient/ocilib-4.2.1.tar.gz
6-
tar xvf ocilib-4.2.1.tar.gz
7-
cd ocilib-4.2.1 \
8-
&& ./configure --with-oracle-import=linkage \
9-
--with-oracle-charset=ansi \
10-
--with-oracle-headers-path=$HOME/instantclient_12_1/sdk/include \
11-
--with-oracle-lib-path=$HOME/instantclient_12_1 \
12-
&& make \
13-
&& sudo make install
4+
wget https://github.com/vrogier/ocilib/archive/v4.2.1.tar.gz
5+
tar xvf v4.2.1.tar.gz
6+
cd /tmp/ocilib-4.2.1
7+
8+
./configure --with-oracle-import=linkage \
9+
--with-oracle-charset=ansi \
10+
--with-oracle-headers-path=/usr/include/oracle/12.1/client64 \
11+
--with-oracle-lib-path=/usr/lib/oracle/12.1/client64/lib \
12+
make
13+
sudo make install
14+
cd
15+
rm -rf /tmp/ocilib-4.2.1
16+
sudo echo "/usr/local/lib" > /etc/ld.so.conf.d/usr-local.conf
17+
sudo ldconfig

docker.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#!/bin/sh
22

33
docker run -d --name oracle --shm-size=2g -p 1521:1521 -v $(pwd)/sql:/etc/entrypoint-initdb.d alexeiled/docker-oracle-xe-11g
4-
5-
# user: system/oracle@localhost:1521/xe

hocilib.cabal

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ library
6262

6363
cc-options: -Wall
6464
extra-libraries: ocilib
65+
extra-lib-dirs: /usr/local/lib
6566

6667
build-depends: base >= 4.8 && < 5
6768
, containers >= 0.5 && < 1
@@ -79,6 +80,9 @@ test-suite test
7980

8081
default-language: Haskell2010
8182

83+
extra-libraries: ocilib
84+
extra-lib-dirs: /usr/local/lib
85+
8286
build-depends: base
8387
, bytestring
8488
, hocilib

src/Database/Ocilib/Statement.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import Foreign.Ptr
5454
import qualified Language.C.Inline as C
5555
import Database.Ocilib.Oci
5656
import Database.Ocilib.Enums
57+
import Database.Ocilib.Internal
5758

5859
C.context (C.baseCtx <> C.funCtx <> ociCtx)
5960

@@ -62,8 +63,8 @@ C.include "<ocilib.h>"
6263
-- Executing Statements
6364

6465
-- | Create a statement object and return its handle.
65-
ociStatementCreate :: Ptr OCI_Connection -> IO (Ptr OCI_Statement)
66-
ociStatementCreate c = [C.exp| OCI_Statement* { OCI_StatementCreate($(OCI_Connection *c)) } |]
66+
ociStatementCreate :: Ptr OCI_Connection -> IO (Maybe (Ptr OCI_Statement))
67+
ociStatementCreate c = fmap toMaybePtr [C.exp| OCI_Statement* { OCI_StatementCreate($(OCI_Connection *c)) } |]
6768

6869
-- | Free a statement and all resources associated to it (resultsets ...)
6970
ociStatementFree :: Ptr OCI_Statement -> IO Bool

stack.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
resolver: lts-6.12
1+
resolver: lts-6.13
22
packages:
33
- '.'
44
extra-deps: []
55
flags: {}
66
extra-package-dbs: []
77
extra-include-dirs: []
88
extra-lib-dirs: []
9+
docker:
10+
enable: false
11+
repo: mystack:latest

tests/Tests.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fetchTest = do
3535
case maybeC of
3636
Nothing -> assertFailure "failed to create connection"
3737
Just c -> do
38-
st <- ociStatementCreate c
38+
Just st <- ociStatementCreate c
3939
b <- ociExecuteStmt st "select * from test_fetch"
4040
assertBool "ociExecuteStatement" b
4141

@@ -113,7 +113,7 @@ testStringBinding = do
113113
case maybeC of
114114
Nothing -> assertFailure "unable to connect"
115115
Just c -> do
116-
st <- ociStatementCreate c
116+
Just st <- ociStatementCreate c
117117
ociSetBindAllocation st OCI_BAM_INTERNAL
118118
b <- ociPrepare st "select * from test_fetch where article=(:article)"
119119
assertBool "prepared" b

0 commit comments

Comments
 (0)