summaryrefslogtreecommitdiff
blob: df25b5bc95281affb0d6f810269c30214a9fac5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
diff -urN mercury-extras-10.04.1.orig/odbc/Mmakefile mercury-extras-10.04.1/odbc/Mmakefile
--- mercury-extras-10.04.1.orig/odbc/Mmakefile	2006-04-03 18:19:54.000000000 +1200
+++ mercury-extras-10.04.1/odbc/Mmakefile	2010-09-06 19:44:01.000000000 +1200
@@ -12,7 +12,7 @@
 # The driver manager.
 # Legal values for MODBC_DRIVER are MODBC_IODBC, MODBC_UNIX, and MODBC_MS.
 # Feel free to add more (and handle them in odbc.m).
-MODBC_DRIVER=MODBC_UNIX
+MODBC_DRIVER=MODBC_IODBC
 
 # The database.
 # Legal values for MODBC_DB are MODBC_MYSQL and MODBC_SQL_SERVER.
@@ -41,17 +41,20 @@
 	# The following are for Debian.
 
 	# for unixODBC
-	MLLIBS=-lodbc -lpthread -lltdl -ldl
-
+	MLLIBS=`iodbc-config --libs`
+	ODBC_CFLAGS=`iodbc-config --cflags`
 	# for iODBC
 	# MLLIBS=-liodbc l-pthread -ldl
 	# note: on a DEC Alpha using OSF1 remove the -ldl.
 endif
 
-MAIN_TARGET=odbc_test
+MAIN_TARGET=libodbc
 
 .PHONY: depend
-depend: odbc_test.depend
+depend: odbc.depend
+
+.PHONY: install
+install: libodbc.install
 
 .PHONY: check
 check:
@@ -62,7 +65,7 @@
 # `--no-ansi' is needed because the ODBC header files include C++-style
 # "//" comments.  `--no-ansi' allows recognition of C++-style "//" comments,
 # presuming you have gcc version 2.7.1 or greater.
-MGNUCFLAGS=--no-ansi -D$(MODBC_DRIVER) -D$(MODBC_DB) -I$(ODBC_INCL_DIR)
+MGNUCFLAGS=--no-ansi -D$(MODBC_DRIVER) -D$(MODBC_DB) $(ODBC_CFLAGS)
 
 #-----------------------------------------------------------------------------#
 #-----------------------------------------------------------------------------#
diff -urN mercury-extras-10.04.1.orig/odbc/odbc.m mercury-extras-10.04.1/odbc/odbc.m
--- mercury-extras-10.04.1.orig/odbc/odbc.m	2006-08-31 23:09:50.000000000 +1200
+++ mercury-extras-10.04.1/odbc/odbc.m	2010-09-06 19:44:01.000000000 +1200
@@ -2000,8 +2000,8 @@
             ** Arbitrary size, only needs to hold a 
             ** descriptive string like ""SQL Server"".
             */
-    String new_dsn;
-    String new_desc;
+    LPSTR new_dsn;
+    LPSTR new_desc;
     SWORD dsn_len;
     SWORD desc_len;
     SQLRETURN rc;
@@ -2335,7 +2335,7 @@
     SQLSMALLINT msg_len;
     UCHAR       message[SQL_MAX_MESSAGE_LENGTH];
     UCHAR       sql_state[SQL_SQLSTATE_SIZE + 1];
-    String      mercury_message;
+    LPSTR       mercury_message;
     MR_Word     new_message;
 
     MR_ASSERT_IMPLY(connection_handle == SQL_NULL_HDBC,