Compare commits

..

447 commits

Author SHA1 Message Date
rfm
db1ff663f6 Fix buffer overrun 2025-02-18 17:32:45 +00:00
rfm
9f90bdc755 Another fix for modern runtimes not handling resurrection of objects 2025-01-02 16:28:55 +00:00
rfm
1ec70f9323 fix for ARC and bug in date comparison 2024-11-28 17:51:45 +00:00
rfm
f84f1f0487 Add -dealloc implementation for SQLString to null-out the pointer and break cyclic references. 2024-11-28 16:40:34 +00:00
rfm
78a66c1a75 Copy rather than retaining when making a literal string 2024-08-06 13:06:15 +01:00
rfm
2c9070cfd0 Remove instance from global tables in -release rather than -dealloc to avoid race condition where a deallocated instance could be retrieved from table. 2024-07-09 09:31:43 +01:00
rfm
936410c7e6 add debug 2024-02-07 14:11:02 +00:00
rfm
848c1fa4ac improve debug output 2024-02-07 12:29:58 +00:00
rfm
aa3262a521 Parse microseconds 2024-01-26 15:30:31 +00:00
rfm
527735d95a revert error 2024-01-26 15:25:18 +00:00
rfm
c307374590 fix stupid error in previous update 2024-01-26 15:10:44 +00:00
rfm
68678b864e Fix for millisecond timestamp info 2024-01-26 14:12:01 +00:00
rfm
3e35662803 Make lock reporting threshold go to zero if in debug or recording all queries. 2023-11-24 13:37:35 +00:00
rfm
16d56c5395 Report lock delays as part of query duration logging 2023-11-23 10:07:23 +00:00
Richard Frith-Macdonald
218578aa95 Add connect_timeout= option 2023-08-16 16:22:29 +01:00
Richard Frith-Macdonald
14dcbf5c7f make release 2023-01-13 15:00:52 +00:00
Richard Frith-Macdonald
465bcaa70d Avoid possible nil pointer dereference if a poll is created with nil clients. 2022-10-19 19:17:41 +01:00
Richard Frith-Macdonald
346f114fc6 fix dead assignment 2022-09-27 10:21:04 +01:00
Richard Frith-Macdonald
36fe235dba Track committed transactions 2022-07-14 15:08:13 +01:00
Richard Frith-Macdonald
4f622fb975 check that config passed to -setOptions: is a dictionary 2022-06-09 07:23:30 +01:00
Richard Frith-Macdonald
34aec94427 Add option to require encrypted connection. 2022-06-08 16:43:13 +01:00
Richard Frith-Macdonald
a8f405c563 Prevent runaway looping if database connection is lost: re-establish connection to database before retrying quuery/execute. 2020-09-02 14:44:44 +01:00
Wolfgang Lux
267987d01c Reinstate fix to avoid deadlock while purging pool 2020-09-01 15:24:16 +02:00
Richard Frith-Macdonald
4c2a293640 Copying literal strings should just retain them. 2020-08-13 01:43:08 +01:00
Richard Frith-Macdonald
ce149e7ee3 Fixup for array quoting to retain old behavio of the -quoteArray: method while adding a new safe method which quotes strings in the array. 2020-08-12 20:30:46 +01:00
Richard Frith-Macdonald
8335ce336a fix error in method name 2020-08-12 20:17:18 +01:00
Richard Frith-Macdonald
a496d0dd8e Fixup for quoted array 2020-08-12 19:56:50 +01:00
Richard Frith-Macdonald
869cfda7d1 ensure max pool connections setting is sane (if less than 1, assume 5) 2020-07-02 17:51:53 +01:00
Richard Frith-Macdonald
7a142e57c4 Efficiency tweak 2020-06-04 16:45:17 +01:00
Richard Frith-Macdonald
d7a3c06c8b query result containers must implement -count 2020-06-04 10:14:34 +01:00
Richard Frith-Macdonald
cd7daff661 Tidy new logs 2020-06-04 09:41:55 +01:00
Richard Frith-Macdonald
76fd64f7c3 Tidy loging 2020-06-04 09:32:08 +01:00
Richard Frith-Macdonald
76e72d3c0f In duration logging report the number of records returned/affected 2020-06-04 09:29:46 +01:00
Richard Frith-Macdonald
76ea8d486e Make sure we flush buffered database notifications 2020-04-22 07:56:04 +01:00
Richard Frith-Macdonald
da1b900b92 Merge branch 'master' of ssh://github.com/gnustep/libs-sqlclient
Conflicts:
	ChangeLog
2020-04-21 10:53:12 +01:00
Richard Frith-Macdonald
dc7955472e Change notification code to de-duplicate notifications if/when postgres sends many copies of the same notification at the same time. Also change the code to queue notifications in the thread that received them (as documented) and only queue them in the main thread if the receiving thread does not have an active run loop. 2020-04-21 10:51:54 +01:00
Wolfgang Lux
1b44a32f31 Bring MySQL backend back to life for the GNUstep Objective-C runtime 2020-04-13 15:38:51 +02:00
Wolfgang Lux
7851639677 Eventually reconfigure a client connection that gets reused 2020-04-08 14:24:39 +02:00
Wolfgang Lux
535914366a Eventually reconfigure a client connection that gets reused. 2020-04-06 09:04:08 +02:00
Richard Frith-Macdonald
1a0d338a78 fixup logging on connect 2020-03-21 17:27:18 +00:00
Richard Frith-Macdonald
ca2f44a323 Improve logging of timings (log time taken for connection separately from
that to query/execute a statement).
2020-03-21 17:15:27 +00:00
Richard Frith-Macdonald
c3557e74be make aware of tiny strings 2020-02-27 14:55:59 +00:00
Richard Frith-Macdonald
a9588e8073 changes to avoid deadlock 2020-02-25 11:21:11 +00:00
Richard Frith-Macdonald
fea9797591 New SQLString implementation 2020-02-14 17:04:24 +00:00
Richard Frith-Macdonald
94f644590a Remove some redundant code 2020-02-11 15:32:49 +00:00
Richard Frith-Macdonald
bb47241044 Fix notinifcation posting to refrain from coalescing 2020-01-22 12:29:27 +00:00
Wolfgang Lux
ec590a5253 Hide database connection password from debug logs 2019-12-11 09:40:12 +01:00
Richard Frith-Macdonald
5d099c8557 fix error in exception text 2019-08-06 18:52:50 +01:00
Richard Frith-Macdonald
46cf998afc Improve duration/debug logging 2019-07-29 12:33:42 +01:00
Wolfgang Lux
085c36c340 Hide structure definition from public interface, as it is incompatible with ARC 2019-07-14 10:33:09 +02:00
Wolfgang Lux
4fdcad1440 Rewrite release method to become portable accross Objective-C runtimes 2019-05-03 17:45:54 +02:00
Richard Frith-Macdonald
6c64e4cb9d consistently call -disconnect when connection is losts (so transaction end
ivar/lock adjustmentt is done).
2019-03-11 10:37:49 +00:00
Richard Frith-Macdonald
0fa39b65e0 Don't try to rollback wrapped transaction on exception if that exception was
telling us the database connection was lost (implicit rollback occurred).
2019-03-11 09:37:02 +00:00
Richard Frith-Macdonald
d6e4ccdb3e another quoting check fix 2019-03-09 09:39:34 +00:00
Richard Frith-Macdonald
0bb38c5def revert exttra un-proxy 2019-03-09 06:56:15 +00:00
Richard Frith-Macdonald
97216727ff improve diagnostics 2019-03-09 06:29:13 +00:00
Richard Frith-Macdonald
7b7d207f45 make code a bit clearer ... no functional change 2019-03-07 15:20:43 +00:00
Richard Frith-Macdonald
9ba41b6d5b Merge branch 'master' of ssh://github.com/gnustep/libs-sqlclient 2019-03-07 15:09:56 +00:00
Richard Frith-Macdonald
b176015f28 Don't set flag to say we are in a transaction unless the sql executes 2019-03-07 15:09:15 +00:00
Wolfgang Lux
048b1a76f8 Fix insertTransaction:atIndex: to work as advertised 2019-03-07 14:14:59 +01:00
Richard Frith-Macdonald
92e2b06efc Improve warnings about literals 2019-03-07 12:06:34 +00:00
Richard Frith-Macdonald
cfae0876cc Merge branch 'master' of ssh://github.com/gnustep/libs-sqlclient 2019-03-07 11:06:11 +00:00
Richard Frith-Macdonald
e0fdb1ce9a more quoting fixes 2019-03-07 11:05:25 +00:00
Wolfgang Lux
debbd3c763 Fix minor space leak in the Postgres backendConnect method 2019-03-01 13:31:43 +01:00
Richard Frith-Macdonald
e8eeb75eca add missing file 2019-02-28 16:58:11 +00:00
Richard Frith-Macdonald
b9a45a2fc4 add new method to pool 2019-02-28 16:57:41 +00:00
Richard Frith-Macdonald
8302102928 More sql injection prevention code 2019-02-28 16:51:49 +00:00
Richard Frith-Macdonald
1138287eb0 fixup adding prepared statement lost in last change 2019-02-19 15:36:59 +00:00
Richard Frith-Macdonald
d82d973983 remove deprecated transaction merging. 2019-02-19 13:55:31 +00:00
Wolfgang Lux
5201c42e01 Fix optimization to reuse small data values in Postgres query results so
that it actually works.
2019-01-24 11:39:28 +01:00
Wolfgang Lux
d52ddbd2f3 Avoid loss of precision when quoting floagint-point numbers 2018-11-23 14:48:25 +01:00
fredkiefer
aeb14dc493 * SQLClient.m: Fix some spelling errors. 2018-07-27 10:21:10 +02:00
Richard Frith-Macdonald
43bf08a70f Make SQLTransaction methods thread-safe 2018-06-29 09:22:13 +01:00
Richard Frith-Macdonald
f570253b40 fixup for {key?default} syntax 2018-04-16 16:45:25 +01:00
Richard Frith-Macdonald
cdf753373f fix checking ownership to allow for pools when checking transactions for insert 2017-12-05 14:26:36 +00:00
Richard Frith-Macdonald
9c2fcd8816 Avoid compiler warning 2017-11-29 10:05:19 +00:00
Richard Frith-Macdonald
a35a811727 Try again 2017-11-29 10:01:06 +00:00
Richard Frith-Macdonald
14e6d5a928 missed case in last change 2017-11-29 09:36:38 +00:00
Richard Frith-Macdonald
9e68a4d102 fix error quoting 32bit int 2017-11-28 16:08:17 +00:00
Richard Frith-Macdonald
1cc4f410e7 Add convenience methods for quoting as booleans 2017-11-22 10:57:19 +00:00
Richard Frith-Macdonald
2900203c67 Simplify database notification observation 2017-09-19 11:28:05 +01:00
Richard Frith-Macdonald
e23f3b66a5 fixup 2017-08-31 11:38:53 +01:00
Richard Frith-Macdonald
2be5efdd46 Making ready for release 2017-08-31 11:05:08 +01:00
Richard Frith-Macdonald
d33b4b5114 add new method to attempt connect without retry 2017-08-29 21:35:59 +01:00
Richard Frith-Macdonald
174af22f97 fixup test for connection loss 2017-08-28 08:23:19 +01:00
Richard Frith-Macdonald
d3a5c50890 If connection is lost during a rollback, the rollback is expected to have
succeeded (lost connection implies transaction not committed).
2017-08-27 18:06:29 +01:00
Richard Frith-Macdonald
9e722821c8 reconnect tweaks 2017-08-27 16:37:21 +01:00
Richard Frith-Macdonald
1dcbdc7226 remove unused method 2017-08-27 16:14:30 +01:00
Richard Frith-Macdonald
8b5db03110 More auto retry code 2017-08-27 16:13:10 +01:00
Richard Frith-Macdonald
24cb65059f have connect retry automatically 2017-08-27 12:41:22 +01:00
Richard Frith-Macdonald
48c8018343 don't listen unless connection succeeded 2017-08-25 22:30:44 +01:00
Richard Frith-Macdonald
09526be014 fix typo 2017-08-25 10:37:52 +01:00
Richard Frith-Macdonald
017a6165ee fix typo 2017-08-25 10:36:39 +01:00
Richard Frith-Macdonald
396dcb0355 fixups for notification file handle monitoring 2017-08-25 10:33:55 +01:00
Richard Frith-Macdonald
b4dd6312fe Fix to make all disconnects clean up the same way. 2017-08-15 12:38:10 +01:00
Richard Frith-Macdonald
6102dddbcc Fix for clean handling of loss of database server connection when we are
listening for notifications.
2017-08-15 11:13:06 +01:00
Richard Frith-Macdonald
c48ce0e78e missed parameter type change 2017-07-10 10:30:39 +01:00
Richard Frith-Macdonald
086c59480d Add more quoting convenience methods 2017-07-10 10:04:32 +01:00
Richard Frith-Macdonald
9c86e53072 The build... methods should return a literal 2017-07-05 15:25:13 +01:00
Richard Frith-Macdonald
9ba044c0ea Chenges to avoid warning/error messages 2017-07-05 10:41:27 +01:00
Richard Frith-Macdonald
85cc5451be Improve compile time checking of arguments 2017-07-05 10:21:11 +01:00
Richard Frith-Macdonald
2dc662177e More quoting changes 2017-07-04 12:13:16 +01:00
Richard Frith-Macdonald
e98ab6d200 More autoquote checks 2017-07-03 21:09:07 +01:00
Richard Frith-Macdonald
48a6cc9419 improve wautroquote warning 2017-07-03 15:39:28 +01:00
Richard Frith-Macdonald
bee12ae4ee Fixups for proxy to be an NSString subclass 2017-07-03 15:13:54 +01:00
Richard Frith-Macdonald
5727f252d5 fix error in proxy handling 2017-07-03 15:05:39 +01:00
Richard Frith-Macdonald
d75ff81bba Minor tweaks for returning literal strings for numeric columns 2017-07-03 11:03:58 +01:00
Richard Frith-Macdonald
b6cd1305b3 More tweaks and documentation 2017-06-30 13:43:45 +01:00
Richard Frith-Macdonald
e7dc1e2dc2 We need to include NSString.h in order to subclass NSString. 2017-06-30 12:01:41 +01:00
Richard Frith-Macdonald
549ba3d96a fixup declaration 2017-06-30 11:56:21 +01:00
Richard Frith-Macdonald
9174ee9ad7 unproxy tweaks 2017-06-30 11:55:33 +01:00
Richard Frith-Macdonald
0c3fd3449d further cleanups and fixes for quoting 2017-06-30 11:46:17 +01:00
Richard Frith-Macdonald
013c068a52 Restructure autoquoting to simplify 2017-06-30 11:39:24 +01:00
Richard Frith-Macdonald
311884bb4a Add explicit quoteSet: method and extend to support more collections 2017-06-29 14:41:36 +01:00
Richard Frith-Macdonald
9c2b980170 Return integer values as literal (so if re-used they won't be quoted).
Fix memory leak decoding arrays
2017-06-29 14:10:13 +01:00
Richard Frith-Macdonald
db5ac54036 Add method to quote table/column names 2017-06-29 13:53:11 +01:00
Richard Frith-Macdonald
c533e6e14c improve 2017-06-29 12:57:16 +01:00
Richard Frith-Macdonald
828c5e8ae5 add casting to literal and varargs prepare method 2017-06-29 12:40:38 +01:00
Richard Frith-Macdonald
c546062424 Add copy literal method 2017-06-29 11:30:33 +01:00
Richard Frith-Macdonald
eb58bd0d78 improve last fix 2017-06-29 09:57:04 +01:00
Richard Frith-Macdonald
8095873ae4 fixup config recheeck to avoid recursion 2017-06-29 09:54:17 +01:00
Richard Frith-Macdonald
23d6fea4b1 comment on new method and turn warnings on by default 2017-06-29 09:47:40 +01:00
Richard Frith-Macdonald
e284891e92 Add warning option for new autoquot 2017-06-29 09:32:09 +01:00
Richard Frith-MacDonald
8f6ed04196 make -simpleExecute: easier to use.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40495 72102866-910b-0410-8b05-ffd578937521
2017-04-28 08:37:59 +00:00
Richard Frith-MacDonald
db4f1f32cb tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40494 72102866-910b-0410-8b05-ffd578937521
2017-04-27 09:12:22 +00:00
Richard Frith-MacDonald
823f329413 Now that we use standard conforming strings, we can use use the superclass
string quoting code.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40493 72102866-910b-0410-8b05-ffd578937521
2017-04-26 13:49:24 +00:00
Richard Frith-MacDonald
fe7d8e2d9e tidied
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40469 72102866-910b-0410-8b05-ffd578937521
2017-04-12 06:22:07 +00:00
Richard Frith-MacDonald
552d190f31 Use class_addMethod() rather than class_replaceMethod() because of problems
with new gcc runtime altering superclass implementation.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40466 72102866-910b-0410-8b05-ffd578937521
2017-04-11 11:50:44 +00:00
Richard Frith-MacDonald
caebc38b3d Fixup another memory management issue
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40463 72102866-910b-0410-8b05-ffd578937521
2017-04-10 14:49:17 +00:00
Richard Frith-MacDonald
7fa072df70 Fix leak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40453 72102866-910b-0410-8b05-ffd578937521
2017-04-07 14:27:20 +00:00
Richard Frith-MacDonald
70be58d959 clarify comment
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40370 72102866-910b-0410-8b05-ffd578937521
2017-03-07 12:33:22 +00:00
Richard Frith-MacDonald
83d4873389 fix to return string valuem for retrieved dates (like times)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40369 72102866-910b-0410-8b05-ffd578937521
2017-03-07 12:31:41 +00:00
Richard Frith-MacDonald
e5d3ea6f6b Changes for sql injection attack resistance.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40368 72102866-910b-0410-8b05-ffd578937521
2017-03-06 17:23:37 +00:00
Richard Frith-MacDonald
1ce3253a97 revert last
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40190 72102866-910b-0410-8b05-ffd578937521
2016-11-02 12:25:58 +00:00
Richard Frith-MacDonald
efd9f26947 Post notifications without coalescing
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40189 72102866-910b-0410-8b05-ffd578937521
2016-11-02 12:03:15 +00:00
Richard Frith-MacDonald
8e12a18ec2 Fix for thread safety issue spotted by Wolfgang.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40162 72102866-910b-0410-8b05-ffd578937521
2016-10-19 12:38:02 +00:00
Richard Frith-MacDonald
52bedc89b3 Don't allow pool clients to be set as database notification observers
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40152 72102866-910b-0410-8b05-ffd578937521
2016-10-18 08:32:05 +00:00
Richard Frith-MacDonald
eac59b0d77 fix quoting in the wrong place
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39914 72102866-910b-0410-8b05-ffd578937521
2016-06-23 16:57:13 +00:00
Richard Frith-MacDonald
e1b855d2f2 more error checks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39913 72102866-910b-0410-8b05-ffd578937521
2016-06-23 16:04:00 +00:00
Richard Frith-MacDonald
a272f2cffa don't listen/unlisten when not connected
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39912 72102866-910b-0410-8b05-ffd578937521
2016-06-23 15:06:05 +00:00
Richard Frith-MacDonald
efa86d441e improve debug
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39911 72102866-910b-0410-8b05-ffd578937521
2016-06-23 14:52:36 +00:00
Richard Frith-MacDonald
8735bd4ab8 update comment
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39910 72102866-910b-0410-8b05-ffd578937521
2016-06-23 14:35:03 +00:00
Richard Frith-MacDonald
5576e55028 fix to use case sensitive notification names
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39909 72102866-910b-0410-8b05-ffd578937521
2016-06-23 11:00:58 +00:00
Richard Frith-MacDonald
3bb76c9230 Only allow observers to be added from one runloop/thread at a time.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39900 72102866-910b-0410-8b05-ffd578937521
2016-06-21 17:47:15 +00:00
Richard Frith-MacDonald
88ece98e6c missing changelog entry
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39899 72102866-910b-0410-8b05-ffd578937521
2016-06-21 16:15:51 +00:00
Richard Frith-MacDonald
316dca8d3f Alter to allow notifications to be sent to observers asynchronously
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39898 72102866-910b-0410-8b05-ffd578937521
2016-06-21 16:14:22 +00:00
Richard Frith-MacDonald
7ab46148d9 fixes to ensure that we don't return a client to a pool while it has
notification observers.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39895 72102866-910b-0410-8b05-ffd578937521
2016-06-21 15:34:42 +00:00
Richard Frith-MacDonald
905aa5c4a3 bugfixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39730 72102866-910b-0410-8b05-ffd578937521
2016-05-06 13:01:42 +00:00
Richard Frith-MacDonald
677a8e69d8 fixup initialisation error
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39729 72102866-910b-0410-8b05-ffd578937521
2016-05-06 12:59:19 +00:00
Richard Frith-MacDonald
6f69ad8b20 fix typo
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39728 72102866-910b-0410-8b05-ffd578937521
2016-05-06 12:13:37 +00:00
Richard Frith-MacDonald
88d8226d7b Add -isNull
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39698 72102866-910b-0410-8b05-ffd578937521
2016-04-27 07:55:26 +00:00
Richard Frith-MacDonald
19a0effa92 Prevent parallel build
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39474 72102866-910b-0410-8b05-ffd578937521
2016-03-07 13:47:32 +00:00
Richard Frith-MacDonald
a436122915 Add option to disable ecpg
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39473 72102866-910b-0410-8b05-ffd578937521
2016-03-07 13:15:28 +00:00
Niels Grewe
637653cd0c Fix missing interface warning
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39398 72102866-910b-0410-8b05-ffd578937521
2016-02-19 07:13:22 +00:00
Richard Frith-MacDonald
eecb706229 fix for #47178
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39394 72102866-910b-0410-8b05-ffd578937521
2016-02-18 09:25:09 +00:00
Richard Frith-MacDonald
03eca5e288 tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39142 72102866-910b-0410-8b05-ffd578937521
2015-11-04 09:32:40 +00:00
Richard Frith-MacDonald
ea01e0cb85 improve diagnostics
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39141 72102866-910b-0410-8b05-ffd578937521
2015-11-04 09:30:36 +00:00
Richard Frith-MacDonald
3fefb489fe improve status reporting
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39140 72102866-910b-0410-8b05-ffd578937521
2015-11-04 07:56:16 +00:00
Richard Frith-MacDonald
50a8a2ca59 tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39139 72102866-910b-0410-8b05-ffd578937521
2015-11-04 07:44:05 +00:00
Richard Frith-MacDonald
182fa71ff3 improve diagnostic log
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39138 72102866-910b-0410-8b05-ffd578937521
2015-11-04 07:38:50 +00:00
Richard Frith-MacDonald
bd4f1bcf96 fixup method name
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39137 72102866-910b-0410-8b05-ffd578937521
2015-11-03 21:58:15 +00:00
Richard Frith-MacDonald
42839ca9f1 retain/release fix
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39136 72102866-910b-0410-8b05-ffd578937521
2015-11-03 21:56:09 +00:00
Richard Frith-MacDonald
c391097b05 Add reporting of pool client retain counts
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39133 72102866-910b-0410-8b05-ffd578937521
2015-11-03 10:20:31 +00:00
Richard Frith-MacDonald
3c0f8a4840 morte error handling fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39067 72102866-910b-0410-8b05-ffd578937521
2015-10-14 13:28:52 +00:00
Richard Frith-MacDonald
14c31894a0 Be more rigorous about checkingfor failure response froms server and properly
closing the connection and cleaning up.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39052 72102866-910b-0410-8b05-ffd578937521
2015-10-12 15:25:19 +00:00
Richard Frith-MacDonald
fb23a2d5fd fixup 'xconnectd' flag
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39049 72102866-910b-0410-8b05-ffd578937521
2015-10-10 15:04:13 +00:00
Richard Frith-MacDonald
39c084eb1c don't call -backendDisconnect directly as it does not set the superclass state
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39048 72102866-910b-0410-8b05-ffd578937521
2015-10-10 14:30:58 +00:00
Richard Frith-MacDonald
8939b86ba4 Improve handling of server failure
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38974 72102866-910b-0410-8b05-ffd578937521
2015-09-08 08:12:18 +00:00
Wolfgang Lux
37447b55b9 Ensure dates are quoted correctly irrespective of their current format.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38835 72102866-910b-0410-8b05-ffd578937521
2015-07-23 14:59:03 +00:00
Richard Frith-MacDonald
896f6df0d6 Improve checking for a connection we can re-use
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38834 72102866-910b-0410-8b05-ffd578937521
2015-07-23 07:11:57 +00:00
Richard Frith-MacDonald
4f374e0150 don't re-use a connection if it is in a transaction
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38830 72102866-910b-0410-8b05-ffd578937521
2015-07-22 15:41:58 +00:00
Richard Frith-MacDonald
36533d3527 first attempt at allowing re-use of a client by different code layers as
long as they are in the same thread.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38827 72102866-910b-0410-8b05-ffd578937521
2015-07-22 12:45:21 +00:00
Richard Frith-MacDonald
5a4d4f3fce Internal reorganisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38826 72102866-910b-0410-8b05-ffd578937521
2015-07-22 11:04:39 +00:00
Niels Grewe
88796e18bc Add support for parsing "char"[] into NSArray
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38813 72102866-910b-0410-8b05-ffd578937521
2015-07-17 13:36:49 +00:00
Wolfgang Lux
3bde5e99a8 Use local time zone instead of GMT when parsing a date without a time zone.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38810 72102866-910b-0410-8b05-ffd578937521
2015-07-16 13:54:23 +00:00
Richard Frith-MacDonald
55e33d0f29 Add support for -sizeInBytesExcluding:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38807 72102866-910b-0410-8b05-ffd578937521
2015-07-16 10:13:12 +00:00
Richard Frith-MacDonald
023cba96ea transaction ownership fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38757 72102866-910b-0410-8b05-ffd578937521
2015-07-06 18:58:24 +00:00
Richard Frith-MacDonald
917150afd9 further cleanups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38719 72102866-910b-0410-8b05-ffd578937521
2015-06-29 12:07:00 +00:00
Richard Frith-MacDonald
08376ad7b9 Another new method for pools and transactions
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38718 72102866-910b-0410-8b05-ffd578937521
2015-06-29 11:59:18 +00:00
Richard Frith-MacDonald
b949cbd9c8 fix deadlock
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38717 72102866-910b-0410-8b05-ffd578937521
2015-06-29 10:38:39 +00:00
Richard Frith-MacDonald
ad45131796 add missing pool convenience method
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38716 72102866-910b-0410-8b05-ffd578937521
2015-06-29 09:44:18 +00:00
Richard Frith-MacDonald
a074b69395 implement -batch:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38714 72102866-910b-0410-8b05-ffd578937521
2015-06-27 15:28:03 +00:00
Richard Frith-MacDonald
097c71a9c9 add missing method
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38710 72102866-910b-0410-8b05-ffd578937521
2015-06-26 19:32:14 +00:00
Richard Frith-MacDonald
2e27c77f1a client name settings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38694 72102866-910b-0410-8b05-ffd578937521
2015-06-26 12:06:13 +00:00
Niels Grewe
53a51aa60a Add an accessor method to SQLClient to allow getting the pool that owns the
connection.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38679 72102866-910b-0410-8b05-ffd578937521
2015-06-25 13:38:41 +00:00
Richard Frith-MacDonald
eba637c00e Fixup default name
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38678 72102866-910b-0410-8b05-ffd578937521
2015-06-25 08:08:47 +00:00
Richard Frith-MacDonald
08808d55b8 add another test
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38653 72102866-910b-0410-8b05-ffd578937521
2015-06-17 14:26:25 +00:00
Richard Frith-MacDonald
e472d45d38 tiny tidyup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38652 72102866-910b-0410-8b05-ffd578937521
2015-06-17 12:54:45 +00:00
Richard Frith-MacDonald
a2f7d330b9 Improve distant past/future handling
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38650 72102866-910b-0410-8b05-ffd578937521
2015-06-17 08:00:14 +00:00
Richard Frith-MacDonald
97982d2d72 tweak date stuff
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38646 72102866-910b-0410-8b05-ffd578937521
2015-06-16 16:54:35 +00:00
Richard Frith-MacDonald
25a0a1220e fix error parsing timezone.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38643 72102866-910b-0410-8b05-ffd578937521
2015-06-16 09:37:59 +00:00
Richard Frith-MacDonald
11bf21a930 Try to manage count of connected clients better
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38608 72102866-910b-0410-8b05-ffd578937521
2015-06-10 08:05:59 +00:00
Richard Frith-MacDonald
85d8389ba0 add comment
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38607 72102866-910b-0410-8b05-ffd578937521
2015-06-09 17:31:09 +00:00
Richard Frith-MacDonald
c47c323a7f Attempted deadlock fix
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38606 72102866-910b-0410-8b05-ffd578937521
2015-06-09 16:47:36 +00:00
Richard Frith-MacDonald
9282a5134d Improve diagnostics
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38583 72102866-910b-0410-8b05-ffd578937521
2015-05-29 09:33:03 +00:00
Richard Frith-MacDonald
6eee4f014a Fix retain/release issue and add more diagnostics
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38580 72102866-910b-0410-8b05-ffd578937521
2015-05-28 12:57:08 +00:00
Richard Frith-MacDonald
35ee61bad9 Various pool management enhancements
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38579 72102866-910b-0410-8b05-ffd578937521
2015-05-28 08:39:10 +00:00
Richard Frith-MacDonald
a5ce6c870e connection pool enhancements
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38578 72102866-910b-0410-8b05-ffd578937521
2015-05-27 14:53:36 +00:00
Richard Frith-MacDonald
855171a26f Add pool p[urging
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38576 72102866-910b-0410-8b05-ffd578937521
2015-05-27 06:28:02 +00:00
Richard Frith-MacDonald
23870a60a2 fix logic of -longestIdle
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38575 72102866-910b-0410-8b05-ffd578937521
2015-05-27 06:02:43 +00:00
Richard Frith-MacDonald
1fd4b0abe9 Provide a description for a pool
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38574 72102866-910b-0410-8b05-ffd578937521
2015-05-27 05:48:13 +00:00
Richard Frith-MacDonald
bffc581dc0 fix timezone offset
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38565 72102866-910b-0410-8b05-ffd578937521
2015-05-26 15:36:06 +00:00
Richard Frith-MacDonald
754b6547a9 Tweak to allow connections in a pool to share a cache effectively
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38473 72102866-910b-0410-8b05-ffd578937521
2015-05-04 12:15:47 +00:00
Richard Frith-MacDonald
b10c6c592d another pre-c99 hack
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38469 72102866-910b-0410-8b05-ffd578937521
2015-04-30 10:33:05 +00:00
Richard Frith-MacDonald
28f18d26a4 support old compilers
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38468 72102866-910b-0410-8b05-ffd578937521
2015-04-30 10:31:05 +00:00
Richard Frith-MacDonald
d70286f339 Optimisation tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38467 72102866-910b-0410-8b05-ffd578937521
2015-04-30 09:12:47 +00:00
Richard Frith-MacDonald
19a68d1abd some optimisations
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38466 72102866-910b-0410-8b05-ffd578937521
2015-04-29 17:35:18 +00:00
Richard Frith-MacDonald
fe1d368d66 fix error in last update
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38464 72102866-910b-0410-8b05-ffd578937521
2015-04-28 15:32:21 +00:00
Richard Frith-MacDonald
17ce0ccf78 performance tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38461 72102866-910b-0410-8b05-ffd578937521
2015-04-28 11:47:23 +00:00
Richard Frith-MacDonald
dcbcc92993 fixup to post notifications from the database on the main thread
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38457 72102866-910b-0410-8b05-ffd578937521
2015-04-15 16:14:02 +00:00
Richard Frith-MacDonald
3d4c775f41 report if a query produces no result
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38456 72102866-910b-0410-8b05-ffd578937521
2015-04-15 15:09:18 +00:00
Richard Frith-MacDonald
0836cc15ad add -cache method for client pool
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38455 72102866-910b-0410-8b05-ffd578937521
2015-04-13 09:23:29 +00:00
Richard Frith-MacDonald
950252a37f Changes to avoid a client being removed from the pool longer than necessary.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38454 72102866-910b-0410-8b05-ffd578937521
2015-04-13 08:30:31 +00:00
Richard Frith-MacDonald
63ff9b2bfd expose method
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38453 72102866-910b-0410-8b05-ffd578937521
2015-04-12 09:50:50 +00:00
Richard Frith-MacDonald
a35f4cee92 quoting improvements for pools
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38452 72102866-910b-0410-8b05-ffd578937521
2015-04-09 08:04:38 +00:00
Richard Frith-MacDonald
f312d036d0 Threading/notification improvments
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38447 72102866-910b-0410-8b05-ffd578937521
2015-04-01 11:32:49 +00:00
Richard Frith-MacDonald
2db59e861c Add preliminary array support
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38400 72102866-910b-0410-8b05-ffd578937521
2015-03-11 17:16:14 +00:00
Richard Frith-MacDonald
78764f0ce1 bump version when we drop support for versions of postgres which don't support
standard sql strings


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38374 72102866-910b-0410-8b05-ffd578937521
2015-03-02 15:19:15 +00:00
Richard Frith-MacDonald
bd63d63d0f Improve string quotng support
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38373 72102866-910b-0410-8b05-ffd578937521
2015-03-02 09:36:50 +00:00
Richard Frith-MacDonald
7aafa6f372 updat to 1.8.2 for exposing minor functionality
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38366 72102866-910b-0410-8b05-ffd578937521
2015-02-26 16:14:51 +00:00
Richard Frith-MacDonald
391b543e6c use config.status when available
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38317 72102866-910b-0410-8b05-ffd578937521
2015-01-31 20:55:45 +00:00
Richard Frith-MacDonald
069b1b1e95 avoid some compiler warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38280 72102866-910b-0410-8b05-ffd578937521
2015-01-06 10:56:39 +00:00
Richard Frith-MacDonald
9d13495a8a fixup to avoid repeatedly closing/opening connections
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38279 72102866-910b-0410-8b05-ffd578937521
2015-01-05 15:52:02 +00:00
Richard Frith-MacDonald
3bdf2686b5 convenience methods
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38249 72102866-910b-0410-8b05-ffd578937521
2014-12-11 17:26:32 +00:00
Richard Frith-MacDonald
edc1a8310a Convenience code ... allow a pool to be used as a client.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38248 72102866-910b-0410-8b05-ffd578937521
2014-12-11 10:47:12 +00:00
Richard Frith-MacDonald
19b900d172 fix to handle TIME fields
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38183 72102866-910b-0410-8b05-ffd578937521
2014-11-19 10:21:24 +00:00
Richard Frith-MacDonald
7f64902d1f new release
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38158 72102866-910b-0410-8b05-ffd578937521
2014-11-04 12:33:10 +00:00
Richard Frith-MacDonald
e3429d9079 connection pool tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38114 72102866-910b-0410-8b05-ffd578937521
2014-10-13 10:47:06 +00:00
Richard Frith-MacDonald
6ae8df20b7 thread-safety fixup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38110 72102866-910b-0410-8b05-ffd578937521
2014-10-07 09:15:16 +00:00
Richard Frith-MacDonald
c035f9cf39 improve transaction rollback
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38109 72102866-910b-0410-8b05-ffd578937521
2014-10-07 07:09:38 +00:00
Richard Frith-MacDonald
0f06c9b7fc sent the client name to the database server
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38108 72102866-910b-0410-8b05-ffd578937521
2014-10-06 11:35:46 +00:00
Richard Frith-MacDonald
c6fc158f34 tweak for a final pass through the loop
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38103 72102866-910b-0410-8b05-ffd578937521
2014-10-03 11:28:22 +00:00
Richard Frith-MacDonald
e03ba02d29 fix failure to roll back
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38101 72102866-910b-0410-8b05-ffd578937521
2014-10-02 20:30:22 +00:00
Richard Frith-MacDonald
9d1157b9c0 don't auto-disconnect on error
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38091 72102866-910b-0410-8b05-ffd578937521
2014-09-24 15:03:05 +00:00
Richard Frith-MacDonald
832e22bc45 use standard conforming strings if available
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38072 72102866-910b-0410-8b05-ffd578937521
2014-09-10 12:05:47 +00:00
Richard Frith-MacDonald
f065c65fab only disconnect when connected
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38071 72102866-910b-0410-8b05-ffd578937521
2014-09-10 11:49:40 +00:00
Richard Frith-MacDonald
e062fabf15 Fix bug setting database user
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38070 72102866-910b-0410-8b05-ffd578937521
2014-09-10 11:36:20 +00:00
Richard Frith-MacDonald
b1ccabeb7e fixup for warnings about escapes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38068 72102866-910b-0410-8b05-ffd578937521
2014-09-10 08:45:58 +00:00
Richard Frith-MacDonald
90476078d5 escape strings if ther warning about bad escapes is enabled
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38067 72102866-910b-0410-8b05-ffd578937521
2014-09-10 08:15:54 +00:00
Richard Frith-MacDonald
0f84c574d5 lter merging mechanism for flexibility and ease of use
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38043 72102866-910b-0410-8b05-ffd578937521
2014-08-09 14:02:11 +00:00
Richard Frith-MacDonald
3a502f17bf optimise string buffer size and merge deletes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38042 72102866-910b-0410-8b05-ffd578937521
2014-08-08 09:15:13 +00:00
Richard Frith-MacDonald
6ac6b7033f first attempt at merge code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38041 72102866-910b-0410-8b05-ffd578937521
2014-08-08 08:07:06 +00:00
Richard Frith-MacDonald
5f54b5fad3 fix typo
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38000 72102866-910b-0410-8b05-ffd578937521
2014-07-17 08:52:27 +00:00
Richard Frith-MacDonald
39130494be patch by Yavor for versioned bundles
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37999 72102866-910b-0410-8b05-ffd578937521
2014-07-17 08:51:33 +00:00
Richard Frith-MacDonald
e54378f320 fixes for bug #42733 and bug #42734 by Yavor
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37993 72102866-910b-0410-8b05-ffd578937521
2014-07-13 08:38:55 +00:00
Richard Frith-MacDonald
698b359608 pool retain/release fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37986 72102866-910b-0410-8b05-ffd578937521
2014-07-07 16:25:16 +00:00
Richard Frith-MacDonald
aa159b1455 provide available connections
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37985 72102866-910b-0410-8b05-ffd578937521
2014-07-07 16:01:22 +00:00
Richard Frith-MacDonald
3c56d1fa82 Report max and min connections, try to keep at least min connections in pool
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37984 72102866-910b-0410-8b05-ffd578937521
2014-07-05 08:40:42 +00:00
Richard Frith-MacDonald
c46336e96c try to close unwanted connections whenever we end any operation which locks
the pool.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37981 72102866-910b-0410-8b05-ffd578937521
2014-07-04 13:56:29 +00:00
Richard Frith-MacDonald
2c37086861 fix logic error in picking existing client rather than adding to pool
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37980 72102866-910b-0410-8b05-ffd578937521
2014-07-04 13:31:30 +00:00
Richard Frith-MacDonald
92b29b8ed0 pool improvements
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37979 72102866-910b-0410-8b05-ffd578937521
2014-07-04 13:11:47 +00:00
Richard Frith-MacDonald
c8c192c738 add missing file
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37963 72102866-910b-0410-8b05-ffd578937521
2014-06-24 10:30:00 +00:00
Richard Frith-MacDonald
10478732e6 fix missing declaration
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37962 72102866-910b-0410-8b05-ffd578937521
2014-06-21 11:12:32 +00:00
Richard Frith-MacDonald
1a68bf02c2 Add pool stats
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37961 72102866-910b-0410-8b05-ffd578937521
2014-06-21 06:57:17 +00:00
Richard Frith-MacDonald
ab9010db3b new version number
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37958 72102866-910b-0410-8b05-ffd578937521
2014-06-20 15:44:52 +00:00
Richard Frith-MacDonald
fd50180862 Remove proxy for improved performance and (hopefully) simplification of code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37957 72102866-910b-0410-8b05-ffd578937521
2014-06-20 15:39:25 +00:00
Richard Frith-MacDonald
613de3c660 more pool improvements
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37953 72102866-910b-0410-8b05-ffd578937521
2014-06-20 08:35:33 +00:00
Richard Frith-MacDonald
38bf6cbe72 document pool initialisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37952 72102866-910b-0410-8b05-ffd578937521
2014-06-20 05:21:58 +00:00
Richard Frith-MacDonald
3c49c76afe Add code to limit idle connections in pool to the poll 'min' size.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37951 72102866-910b-0410-8b05-ffd578937521
2014-06-20 05:15:24 +00:00
Richard Frith-MacDonald
ac0e231c9a initial thread pool implementation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37950 72102866-910b-0410-8b05-ffd578937521
2014-06-19 21:26:25 +00:00
Richard Frith-MacDonald
2c40163ef2 remove async code ... only do I/O in one thread at a time
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37914 72102866-910b-0410-8b05-ffd578937521
2014-05-27 15:25:29 +00:00
Richard Frith-MacDonald
7f19e9e996 bugfix release for thread safety of notifications
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37913 72102866-910b-0410-8b05-ffd578937521
2014-05-27 15:22:35 +00:00
Richard Frith-MacDonald
9a00a62842 fix return without unlocking
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37893 72102866-910b-0410-8b05-ffd578937521
2014-05-19 09:31:02 +00:00
Richard Frith-MacDonald
2a8895805f more locking added
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37892 72102866-910b-0410-8b05-ffd578937521
2014-05-19 08:30:31 +00:00
Richard Frith-MacDonald
f4f2b640f9 improve comments
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37891 72102866-910b-0410-8b05-ffd578937521
2014-05-17 09:47:58 +00:00
Richard Frith-MacDonald
bf33b6d564 minor documentation fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37885 72102866-910b-0410-8b05-ffd578937521
2014-05-16 10:08:40 +00:00
Richard Frith-MacDonald
9f3394e3a4 lock protect use of backendNotify:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37884 72102866-910b-0410-8b05-ffd578937521
2014-05-16 10:03:51 +00:00
Richard Frith-MacDonald
840679cff1 more thread-safety changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37879 72102866-910b-0410-8b05-ffd578937521
2014-05-13 11:01:50 +00:00
Richard Frith-MacDonald
9feb78e6af fix minor thread safety issue
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37878 72102866-910b-0410-8b05-ffd578937521
2014-05-13 10:26:48 +00:00
Richard Frith-MacDonald
415aa4a3ad 1.7.1 bugfix release
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37859 72102866-910b-0410-8b05-ffd578937521
2014-05-08 07:56:13 +00:00
Richard Frith-MacDonald
1d93696eb4 tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37853 72102866-910b-0410-8b05-ffd578937521
2014-05-07 16:36:06 +00:00
Richard Frith-MacDonald
0b8dc96fa2 Fix retain/release error
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37794 72102866-910b-0410-8b05-ffd578937521
2014-04-12 07:24:31 +00:00
Richard Frith-MacDonald
f3cc52bc43 fix uninitialised variable
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37747 72102866-910b-0410-8b05-ffd578937521
2014-03-17 12:19:55 +00:00
Wolfgang Lux
d1beaed950 Fix incorrect comparison operator.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37725 72102866-910b-0410-8b05-ffd578937521
2014-03-05 17:25:07 +00:00
Richard Frith-MacDonald
bd40e7b084 fix typo in comment
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37724 72102866-910b-0410-8b05-ffd578937521
2014-03-04 13:59:15 +00:00
Richard Frith-MacDonald
17c3da4489 fixup for caching queries
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37700 72102866-910b-0410-8b05-ffd578937521
2014-02-21 09:56:09 +00:00
Richard Frith-MacDonald
631183a672 improve help
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37693 72102866-910b-0410-8b05-ffd578937521
2014-02-15 07:24:46 +00:00
Richard Frith-MacDonald
4b43448d28 add helper for building counted set
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37692 72102866-910b-0410-8b05-ffd578937521
2014-02-15 07:16:26 +00:00
Richard Frith-MacDonald
0c1eebfc6c 64bit printf format fixup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37063 72102866-910b-0410-8b05-ffd578937521
2013-09-10 12:42:41 +00:00
Richard Frith-MacDonald
3a3f32d920 add 1.7 release note
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37044 72102866-910b-0410-8b05-ffd578937521
2013-09-06 06:59:13 +00:00
Richard Frith-MacDonald
254d26adac use all domains for bundle lookup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37043 72102866-910b-0410-8b05-ffd578937521
2013-09-05 21:04:12 +00:00
Richard Frith-MacDonald
da40485fe2 fixup return type of sizeInBytes:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37042 72102866-910b-0410-8b05-ffd578937521
2013-09-05 12:48:53 +00:00
Richard Frith-MacDonald
1db8d56643 document database name
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36758 72102866-910b-0410-8b05-ffd578937521
2013-06-26 11:59:36 +00:00
Richard Frith-MacDonald
0469ba48fb Fix timestamps without timezone to use local time zone
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36655 72102866-910b-0410-8b05-ffd578937521
2013-05-24 14:20:29 +00:00
Richard Frith-MacDonald
5b64b5c3bf Turn off automatic trimming by default
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36500 72102866-910b-0410-8b05-ffd578937521
2013-04-10 15:03:55 +00:00
Richard Frith-MacDonald
ca230f1ae4 tweak prototypes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36291 72102866-910b-0410-8b05-ffd578937521
2013-03-06 22:46:15 +00:00
Richard Frith-MacDonald
803a67ff54 fixup format string error
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36278 72102866-910b-0410-8b05-ffd578937521
2013-03-05 15:16:07 +00:00
Richard Frith-MacDonald
1e02d0189f fixup version for minor release
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36264 72102866-910b-0410-8b05-ffd578937521
2013-03-04 14:59:14 +00:00
Richard Frith-MacDonald
272491adc9 1.6.0 release
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36262 72102866-910b-0410-8b05-ffd578937521
2013-03-04 14:48:29 +00:00
Richard Frith-MacDonald
56fc0088ad add helper classes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36261 72102866-910b-0410-8b05-ffd578937521
2013-03-04 14:47:29 +00:00
Sebastian Reitenbach
da909810ee * ECPG.pgm
* testECPG.m  
        * testMySQL.m 
        * testSQLite.m        
          use PRIuPTR to NSLog NSUIntegers

OK Richard



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36111 72102866-910b-0410-8b05-ffd578937521
2013-02-11 16:05:47 +00:00
Richard Frith-MacDonald
a4ec0e036b update for objc2
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36095 72102866-910b-0410-8b05-ffd578937521
2013-02-09 11:34:01 +00:00
Richard Frith-MacDonald
2e84577b69 fixes for potential locking issues.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36047 72102866-910b-0410-8b05-ffd578937521
2013-01-31 09:04:35 +00:00
Richard Frith-MacDonald
1f11ea97a9 lock safety fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35832 72102866-910b-0410-8b05-ffd578937521
2012-11-29 11:40:04 +00:00
Richard Frith-MacDonald
1fdb15cfb0 warning to take care with singletons method
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35796 72102866-910b-0410-8b05-ffd578937521
2012-11-15 18:16:24 +00:00
Niels Grewe
e455a6d65b Don't use -lobjc -lgnustep-base, use $(FND_LIBS) and $(OBJC_LIBS) instead.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35788 72102866-910b-0410-8b05-ffd578937521
2012-11-10 13:33:39 +00:00
Richard Frith-MacDonald
11194d702d improve error message handling
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35771 72102866-910b-0410-8b05-ffd578937521
2012-10-31 10:20:50 +00:00
Richard Frith-MacDonald
85d5fbfecf fix missing header
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35755 72102866-910b-0410-8b05-ffd578937521
2012-10-28 11:36:18 +00:00
Richard Frith-MacDonald
5db99986be Support for async notifications in Postgres
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35732 72102866-910b-0410-8b05-ffd578937521
2012-10-22 15:57:56 +00:00
Richard Frith-MacDonald
3be013e271 tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35723 72102866-910b-0410-8b05-ffd578937521
2012-10-19 18:51:51 +00:00
Richard Frith-MacDonald
940b3a5fd1 improved execute
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35722 72102866-910b-0410-8b05-ffd578937521
2012-10-19 18:41:36 +00:00
Richard Frith-MacDonald
383478b346 improve transaction compatibility check
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35206 72102866-910b-0410-8b05-ffd578937521
2012-06-17 14:57:48 +00:00
Richard Frith-MacDonald
306bdeb027 NSUInteger updates
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@34447 72102866-910b-0410-8b05-ffd578937521
2012-01-06 16:03:51 +00:00
Richard Frith-MacDonald
e72041ce6c avoid compiler warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@34446 72102866-910b-0410-8b05-ffd578937521
2012-01-06 15:42:02 +00:00
Richard Frith-MacDonald
f47e5833e6 tweak for 64bit and use of NSUInteger
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@34445 72102866-910b-0410-8b05-ffd578937521
2012-01-06 15:39:11 +00:00
Richard Frith-MacDonald
b00d51e017 mkae version 1.5.3
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@33914 72102866-910b-0410-8b05-ffd578937521
2011-09-30 17:21:04 +00:00
Richard Frith-MacDonald
837ddf035f locking cleanups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@33842 72102866-910b-0410-8b05-ffd578937521
2011-09-16 07:25:33 +00:00
Richard Frith-MacDonald
10a8ac3164 bump version number
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@32750 72102866-910b-0410-8b05-ffd578937521
2011-04-01 04:09:40 +00:00
Richard Frith-MacDonald
6543cd6314 declare a few needed classes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@32005 72102866-910b-0410-8b05-ffd578937521
2011-02-07 15:42:58 +00:00
Richard Frith-MacDonald
e54505f057 remove unnecessary includes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@32004 72102866-910b-0410-8b05-ffd578937521
2011-02-07 15:35:50 +00:00
Nicola Pero
1d4fdce501 Fixed rebuilding the library; nothing should happen if you type 'make' in an already-built directory
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@31615 72102866-910b-0410-8b05-ffd578937521
2010-11-17 15:21:11 +00:00
Richard Frith-MacDonald
c252834070 warn if gnustep-make not found
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@31316 72102866-910b-0410-8b05-ffd578937521
2010-09-10 14:00:05 +00:00
Richard Frith-MacDonald
6fe56d2e1e mysql fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@31131 72102866-910b-0410-8b05-ffd578937521
2010-08-13 13:20:06 +00:00
Richard Frith-MacDonald
e307f93142 fixup error parsing date/time
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@31128 72102866-910b-0410-8b05-ffd578937521
2010-08-13 11:28:26 +00:00
Richard Frith-MacDonald
ba81d9f082 MySQL fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@30982 72102866-910b-0410-8b05-ffd578937521
2010-07-16 14:49:55 +00:00
Richard Frith-MacDonald
2f54d889e4 check for mysqlclient library in more places
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@30977 72102866-910b-0410-8b05-ffd578937521
2010-07-16 10:04:59 +00:00
Richard Frith-MacDonald
72ca578ca0 minor cleanups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29641 72102866-910b-0410-8b05-ffd578937521
2010-02-15 11:52:59 +00:00
Richard Frith-MacDonald
1006966504 Fixup for postgres change
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29442 72102866-910b-0410-8b05-ffd578937521
2010-01-29 13:36:01 +00:00
Richard Frith-MacDonald
1b88d7bb36 Note changes for snow leopard
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29035 72102866-910b-0410-8b05-ffd578937521
2009-11-18 11:26:22 +00:00
Richard Frith-MacDonald
543cb6d43b fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29034 72102866-910b-0410-8b05-ffd578937521
2009-11-18 11:25:01 +00:00
Richard Frith-MacDonald
9c041a164a snow leopard porting
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29033 72102866-910b-0410-8b05-ffd578937521
2009-11-18 11:11:29 +00:00
Richard Frith-MacDonald
30edde0a7a improve test for gnustep make
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29032 72102866-910b-0410-8b05-ffd578937521
2009-11-18 07:58:28 +00:00
Richard Frith-MacDonald
cc233b6ba0 log notifications
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28896 72102866-910b-0410-8b05-ffd578937521
2009-10-27 12:42:10 +00:00
Richard Frith-MacDonald
258efaeaf7 Try to get notifications sent properly.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28895 72102866-910b-0410-8b05-ffd578937521
2009-10-27 12:34:41 +00:00
Richard Frith-MacDonald
799c2de9f2 workaround autoconf bug
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28763 72102866-910b-0410-8b05-ffd578937521
2009-10-02 18:34:28 +00:00
Richard Frith-MacDonald
ae4c868169 add convenience method
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28691 72102866-910b-0410-8b05-ffd578937521
2009-09-16 08:59:59 +00:00
Richard Frith-MacDonald
b3a84626e6 get makefiles location
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28682 72102866-910b-0410-8b05-ffd578937521
2009-09-15 09:03:16 +00:00
Richard Frith-MacDonald
f71418098c fixup transaction execution context for retrying batch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28630 72102866-910b-0410-8b05-ffd578937521
2009-09-08 09:59:05 +00:00
Richard Frith-MacDonald
0023174259 Tweak for improved logging
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28629 72102866-910b-0410-8b05-ffd578937521
2009-09-08 08:17:09 +00:00
Richard Frith-MacDonald
306b48c2bf Transaction manipulation methods added.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28628 72102866-910b-0410-8b05-ffd578937521
2009-09-08 08:05:31 +00:00
Richard Frith-MacDonald
2e858a3b55 Improve debug logging
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28319 72102866-910b-0410-8b05-ffd578937521
2009-06-02 17:20:00 +00:00
Richard Frith-MacDonald
64abeac596 Improve exception text.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28281 72102866-910b-0410-8b05-ffd578937521
2009-05-11 14:33:05 +00:00
Richard Frith-MacDonald
18bb5590ce Changes for new version
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@27025 72102866-910b-0410-8b05-ffd578937521
2008-11-12 06:09:44 +00:00
Richard Frith-MacDonald
6b6a5ed928 Add mechanism to avoid overloading database server when it's restarting.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@27024 72102866-910b-0410-8b05-ffd578937521
2008-11-12 05:52:38 +00:00
Nicola Pero
9a126738ed SQLClient: documented better some configure options, then regenerated configure and config.h.in
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@26794 72102866-910b-0410-8b05-ffd578937521
2008-07-19 13:40:51 +00:00
Richard Frith-MacDonald
29c3fa5061 Print full transaction in -description
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@26287 72102866-910b-0410-8b05-ffd578937521
2008-03-12 14:52:35 +00:00
Richard Frith-MacDonald
269223af2f Improve comments on batching.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@26283 72102866-910b-0410-8b05-ffd578937521
2008-03-12 09:15:13 +00:00
Richard Frith-MacDonald
7428af2adc Add options to permit performance optimisation.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@26183 72102866-910b-0410-8b05-ffd578937521
2008-03-03 14:10:54 +00:00
Richard Frith-MacDonald
65d09b350c Add mechanism to update cache only in main thread.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@26117 72102866-910b-0410-8b05-ffd578937521
2008-02-21 16:23:23 +00:00
Richard Frith-MacDonald
a00b7f88f7 Use new NEEDS_GUI for entire project rather than individual instructions for each component.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@26111 72102866-910b-0410-8b05-ffd578937521
2008-02-20 12:05:24 +00:00
Richard Frith-MacDonald
a664ef852c Don't link with gui if we can avoid it.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@26101 72102866-910b-0410-8b05-ffd578937521
2008-02-19 11:26:00 +00:00
Richard Frith-MacDonald
bcd242f388 Fix bad return value type
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@26071 72102866-910b-0410-8b05-ffd578937521
2008-02-15 07:14:06 +00:00
Richard Frith-MacDonald
d66ae7e9be Fix memory leak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@26070 72102866-910b-0410-8b05-ffd578937521
2008-02-15 06:52:53 +00:00
Richard Frith-MacDonald
7f296031ba Add missing declaration of NSMutableDictionary
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@25666 72102866-910b-0410-8b05-ffd578937521
2007-12-03 11:34:32 +00:00
Richard Frith-MacDonald
fd1357a5a9 Update bytea escaping for postgres-8.3 and beyond.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@25531 72102866-910b-0410-8b05-ffd578937521
2007-10-23 09:27:08 +00:00
Richard Frith-MacDonald
ef6dc82428 Avoid trivial warnign in documentation generation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@25501 72102866-910b-0410-8b05-ffd578937521
2007-09-25 14:19:43 +00:00
Richard Frith-MacDonald
314416a39a Update to LGPL3
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@25490 72102866-910b-0410-8b05-ffd578937521
2007-09-14 13:02:05 +00:00
Richard Frith-MacDonald
e85df9167e fixup for 'standard_conforming_strings'
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@25413 72102866-910b-0410-8b05-ffd578937521
2007-08-23 17:05:30 +00:00
Richard Frith-MacDonald
e19d2ab734 Clean up exception name declarations.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@25367 72102866-910b-0410-8b05-ffd578937521
2007-08-01 15:40:12 +00:00
Richard Frith-MacDonald
9ad6b08ed8 Fix retain/release error when copying transactions
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@25344 72102866-910b-0410-8b05-ffd578937521
2007-07-21 05:33:10 +00:00
Richard Frith-MacDonald
1f30daee2d Post notifications on connect and disconnect.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@25309 72102866-910b-0410-8b05-ffd578937521
2007-07-09 17:08:22 +00:00
Richard Frith-MacDonald
d1ae32b83b debug logging fix.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@25306 72102866-910b-0410-8b05-ffd578937521
2007-07-07 07:23:40 +00:00
Richard Frith-MacDonald
52b5f575cf more tolerent finding postgres
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24961 72102866-910b-0410-8b05-ffd578937521
2007-04-01 11:33:58 +00:00
Richard Frith-MacDonald
e175fb6ed0 update to build with apple-apple-apple
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24959 72102866-910b-0410-8b05-ffd578937521
2007-04-01 08:03:21 +00:00
Richard Frith-MacDonald
acd1603b67 Minor efficiency improvement sizing records for cache
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24958 72102866-910b-0410-8b05-ffd578937521
2007-04-01 07:03:43 +00:00
Richard Frith-MacDonald
e5217a11e7 Avoid bug in some compiler versions
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24875 72102866-910b-0410-8b05-ffd578937521
2007-03-15 12:38:44 +00:00
Richard Frith-MacDonald
41c74233c9 clarify comments a bit.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24838 72102866-910b-0410-8b05-ffd578937521
2007-03-09 18:22:53 +00:00
Richard Frith-MacDonald
6bab4c4daf SQLRecord enhancements for KVC and for performance optimisations.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24827 72102866-910b-0410-8b05-ffd578937521
2007-03-08 17:12:55 +00:00
Nicola Pero
2dc9e99bc2 Do not use GNUSTEP_INSTALLATION_DIR
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24553 72102866-910b-0410-8b05-ffd578937521
2007-02-14 12:28:32 +00:00
Richard Frith-MacDonald
896e7f5d86 Improve error messages
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24494 72102866-910b-0410-8b05-ffd578937521
2007-02-09 14:21:25 +00:00
Richard Frith-MacDonald
d4693f2397 Improve batching debug
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24430 72102866-910b-0410-8b05-ffd578937521
2007-01-29 20:08:56 +00:00
Richard Frith-MacDonald
a461b3da3b Add simple JDBC batching if available
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24429 72102866-910b-0410-8b05-ffd578937521
2007-01-29 19:40:08 +00:00
Richard Frith-MacDonald
a2182c46ff Fix rollback of transaction.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24428 72102866-910b-0410-8b05-ffd578937521
2007-01-29 14:44:37 +00:00
Richard Frith-MacDonald
fc46f3a865 Add JDBC transaction/batching
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24427 72102866-910b-0410-8b05-ffd578937521
2007-01-29 13:51:39 +00:00
Richard Frith-MacDonald
90cbc3a46b bump version to 1.4.0 for next unstable/trunk release
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24295 72102866-910b-0410-8b05-ffd578937521
2006-12-30 06:48:21 +00:00
Richard Frith-MacDonald
aa891e7a6a Use svn+ssh as base subversion url scheme
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24276 72102866-910b-0410-8b05-ffd578937521
2006-12-28 10:54:43 +00:00
Richard Frith-MacDonald
08456b4a80 Bugfix for occasional crash executing query.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24231 72102866-910b-0410-8b05-ffd578937521
2006-12-24 08:45:43 +00:00
Richard Frith-MacDonald
07b82dba68 Automcnf fixup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24222 72102866-910b-0410-8b05-ffd578937521
2006-12-22 13:01:29 +00:00
Richard Frith-MacDonald
5e2991ca45 Allow --with-jre-architecture= to override guessed cpu architecture
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24195 72102866-910b-0410-8b05-ffd578937521
2006-12-08 19:34:50 +00:00
Richard Frith-MacDonald
1aeb216ed9 Link Performance library with test tools
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24124 72102866-910b-0410-8b05-ffd578937521
2006-11-17 15:23:41 +00:00
Richard Frith-MacDonald
b7dd7a659a Fixup for building 64bit on a 32/64 system
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24123 72102866-910b-0410-8b05-ffd578937521
2006-11-17 12:41:24 +00:00
Richard Frith-MacDonald
983774ecce Siome improvements for detecting correct jre stuff
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24122 72102866-910b-0410-8b05-ffd578937521
2006-11-17 11:54:01 +00:00
Nicola Pero
2a45d0226e Fixed compiling the wrapper before the library is installed
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23773 72102866-910b-0410-8b05-ffd578937521
2006-10-06 07:49:59 +00:00
Nicola Pero
f7b9cc59d2 Do not read gnustep config info which is not used; added a few useful configure flags that I felt were missing
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23727 72102866-910b-0410-8b05-ffd578937521
2006-10-02 17:30:40 +00:00
Richard Frith-MacDonald
99d65a01a7 Add patch to use config file environment variable
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23716 72102866-910b-0410-8b05-ffd578937521
2006-10-02 14:36:53 +00:00
Richard Frith-MacDonald
0762f61120 simplify jdbc config
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23509 72102866-910b-0410-8b05-ffd578937521
2006-09-14 15:49:28 +00:00
Richard Frith-MacDonald
f180b1c6ca Memory leak fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23508 72102866-910b-0410-8b05-ffd578937521
2006-09-14 15:40:14 +00:00
Richard Frith-MacDonald
073f4242f1 small thread safety fix
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23449 72102866-910b-0410-8b05-ffd578937521
2006-09-10 13:37:23 +00:00
Richard Frith-MacDonald
6fa297b461 partial implementation of pool control
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23335 72102866-910b-0410-8b05-ffd578937521
2006-08-26 12:49:59 +00:00
Richard Frith-MacDonald
e6c648aa39 Add support for handling date/time
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23328 72102866-910b-0410-8b05-ffd578937521
2006-08-25 14:50:13 +00:00
Richard Frith-MacDonald
37111f260d Close to basic functionality in jdbc
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23325 72102866-910b-0410-8b05-ffd578937521
2006-08-25 11:41:54 +00:00
Richard Frith-MacDonald
563e93f83e Get some of the java code working
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23323 72102866-910b-0410-8b05-ffd578937521
2006-08-24 16:53:15 +00:00
Richard Frith-MacDonald
94f9151f12 some mre jni stuff implemented
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23322 72102866-910b-0410-8b05-ffd578937521
2006-08-24 11:46:05 +00:00
Richard Frith-MacDonald
bf3c2e5c38 First tentative steps towards a jdbc backend
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23313 72102866-910b-0410-8b05-ffd578937521
2006-08-18 15:05:17 +00:00
Nicola Pero
6956570428 Fixed local variable name that had the same name as method argument - confusing
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23198 72102866-910b-0410-8b05-ffd578937521
2006-08-03 00:14:22 +00:00
Richard Frith-MacDonald
305e7715c5 New release for postgres and blob handling updates
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23101 72102866-910b-0410-8b05-ffd578937521
2006-06-23 19:45:59 +00:00
Richard Frith-MacDonald
a4b1bbfc99 combine begin and commit with update statements, for improved performance
in small transactions.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23100 72102866-910b-0410-8b05-ffd578937521
2006-06-23 19:36:52 +00:00
Richard Frith-MacDonald
db2d235c42 Avoid compiler warnings.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@23028 72102866-910b-0410-8b05-ffd578937521
2006-06-04 09:19:28 +00:00
Richard Frith-MacDonald
aa30a2b0d0 Updates for string literal escaping in postgres 8.1.4 and later.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22982 72102866-910b-0410-8b05-ffd578937521
2006-05-25 11:34:03 +00:00
Richard Frith-MacDonald
9e7142bde6 Clean quoting code a little
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22917 72102866-910b-0410-8b05-ffd578937521
2006-05-12 15:37:03 +00:00
Richard Frith-MacDonald
2731b9ee3f Attempt to improve diagnostics if unable to load backend class
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22749 72102866-910b-0410-8b05-ffd578937521
2006-04-05 13:31:23 +00:00
Richard Frith-MacDonald
17b05c9f97 Include cache in description
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22725 72102866-910b-0410-8b05-ffd578937521
2006-03-29 06:46:37 +00:00
Adam Fedor
66bfe32e1b Add svn dist info
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22573 72102866-910b-0410-8b05-ffd578937521
2006-02-24 03:25:18 +00:00
Richard Frith-MacDonald
b8a2cd5f0a updates for mingw32
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22549 72102866-910b-0410-8b05-ffd578937521
2006-02-22 12:26:25 +00:00
Richard Frith-MacDonald
3460e25451 remove svn:eol-style property
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22548 72102866-910b-0410-8b05-ffd578937521
2006-02-22 11:47:27 +00:00
Richard Frith-MacDonald
7444679fde Fix linking of tools to newly created libs on mingw32
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22545 72102866-910b-0410-8b05-ffd578937521
2006-02-22 11:45:07 +00:00
Richard Frith-MacDonald
b168cfc003 Support quoting of NSArray and NSSet objects
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22542 72102866-910b-0410-8b05-ffd578937521
2006-02-22 11:15:16 +00:00
Richard Frith-MacDonald
fd883799a8 Support quoting of an NSArray
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22512 72102866-910b-0410-8b05-ffd578937521
2006-02-18 17:10:56 +00:00
Nicola Pero
f1e4b002a3 Small changes for backwards compatibility with older gnustep-make/base
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22296 72102866-910b-0410-8b05-ffd578937521
2006-01-11 14:27:36 +00:00
Richard Frith-Macdonald
3bde04197d Add missing library
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22106 72102866-910b-0410-8b05-ffd578937521
2005-11-26 06:49:32 +00:00
Richard Frith-Macdonald
92d4031698 Tidyups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22087 72102866-910b-0410-8b05-ffd578937521
2005-11-23 10:20:24 +00:00
Richard Frith-Macdonald
832e2bfdbd Fix typo
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22086 72102866-910b-0410-8b05-ffd578937521
2005-11-23 10:08:54 +00:00
Richard Frith-Macdonald
e0edc9e21a Added SQLite
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22085 72102866-910b-0410-8b05-ffd578937521
2005-11-23 10:02:46 +00:00
Richard Frith-Macdonald
67b9859bc8 Check for gnustep make being installed.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22084 72102866-910b-0410-8b05-ffd578937521
2005-11-23 09:51:54 +00:00
Richard Frith-Macdonald
29de615f8b Added test program
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22083 72102866-910b-0410-8b05-ffd578937521
2005-11-23 09:25:05 +00:00
Richard Frith-Macdonald
0c537df227 Add config checks for sqlite
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22082 72102866-910b-0410-8b05-ffd578937521
2005-11-23 07:42:42 +00:00
Richard Frith-Macdonald
119c1993dc Preliminary code for sqlite support.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22081 72102866-910b-0410-8b05-ffd578937521
2005-11-23 06:57:18 +00:00
Richard Frith-Macdonald
b7b7e38a6a Fix include
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22018 72102866-910b-0410-8b05-ffd578937521
2005-11-15 14:16:37 +00:00
Richard Frith-Macdonald
a9de728fa0 Simplify library ... move portions into WebServer and Performance libraries
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22006 72102866-910b-0410-8b05-ffd578937521
2005-11-14 20:37:33 +00:00
Richard Frith-Macdonald
96a28fa22b Minor documentation fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21892 72102866-910b-0410-8b05-ffd578937521
2005-10-28 08:34:22 +00:00
Richard Frith-Macdonald
cdfcb0e78d Make duration logging separate from verbose logging
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21891 72102866-910b-0410-8b05-ffd578937521
2005-10-28 08:07:12 +00:00
Richard Frith-Macdonald
56bfea7a6e Add logging useful for measuring performance.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21890 72102866-910b-0410-8b05-ffd578937521
2005-10-27 16:18:45 +00:00
Richard Frith-Macdonald
f9f44c7aad Send verbose alerts through alert method rather than NSLog() as NSLog has
high overheads (immediate write etc).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21874 72102866-910b-0410-8b05-ffd578937521
2005-10-25 16:38:49 +00:00
Richard Frith-Macdonald
567ea1756f Add java wrappings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21774 72102866-910b-0410-8b05-ffd578937521
2005-10-05 10:15:50 +00:00
Richard Frith-Macdonald
f42028ad00 Optimise -getClients:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21759 72102866-910b-0410-8b05-ffd578937521
2005-09-30 13:12:27 +00:00
Richard Frith-Macdonald
4516b9b9d1 Add -count for transaction
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21752 72102866-910b-0410-8b05-ffd578937521
2005-09-28 06:35:03 +00:00
Richard Frith-Macdonald
65c4b6015f Minor performance tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21751 72102866-910b-0410-8b05-ffd578937521
2005-09-28 06:20:43 +00:00
Richard Frith-Macdonald
d62edc6002 Fix caching bug
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21750 72102866-910b-0410-8b05-ffd578937521
2005-09-27 14:07:04 +00:00
Richard Frith-Macdonald
a6356d78ce Improve clock tickj handling.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21749 72102866-910b-0410-8b05-ffd578937521
2005-09-27 08:15:08 +00:00
Richard Frith-Macdonald
c5697eafaa Tidied a little
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21748 72102866-910b-0410-8b05-ffd578937521
2005-09-27 06:35:05 +00:00
Richard Frith-Macdonald
dfffb8e5f5 Fix error locating pgsql
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21747 72102866-910b-0410-8b05-ffd578937521
2005-09-26 14:41:35 +00:00
Richard Frith-Macdonald
c67e01ab7d Some cleanup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21746 72102866-910b-0410-8b05-ffd578937521
2005-09-26 11:22:35 +00:00
Richard Frith-Macdonald
0ef78e48ef Tidied
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21740 72102866-910b-0410-8b05-ffd578937521
2005-09-23 11:46:04 +00:00
Richard Frith-Macdonald
4ba19049b3 Added trivial test
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21739 72102866-910b-0410-8b05-ffd578937521
2005-09-23 11:44:33 +00:00
Richard Frith-Macdonald
d4f8c6d2a7 Fix error in keeping track of cache size
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21736 72102866-910b-0410-8b05-ffd578937521
2005-09-22 09:33:49 +00:00
Richard Frith-Macdonald
f9fc2a6ee9 Fix cache item creation, add trivial cache test, tweak to avoid compiler warn.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21735 72102866-910b-0410-8b05-ffd578937521
2005-09-22 09:04:08 +00:00
Richard Frith-Macdonald
7dabe7d8da Improve caching
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21734 72102866-910b-0410-8b05-ffd578937521
2005-09-22 08:42:37 +00:00
Richard Frith-Macdonald
dc896321a8 Improved comments.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21732 72102866-910b-0410-8b05-ffd578937521
2005-09-20 13:12:12 +00:00
Richard Frith-Macdonald
1c63231f37 Allow changing of values in an SQLRecord
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21731 72102866-910b-0410-8b05-ffd578937521
2005-09-20 12:57:48 +00:00
Richard Frith-Macdonald
e1f1c87e86 Improve code to locate postgres headers
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21719 72102866-910b-0410-8b05-ffd578937521
2005-09-15 08:25:12 +00:00
Richard Frith-Macdonald
56131fc572 Fix problem with NSMapRemove() on Apple
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21605 72102866-910b-0410-8b05-ffd578937521
2005-08-03 07:03:28 +00:00
Richard Frith-Macdonald
5c44a76439 More apple fixups.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21604 72102866-910b-0410-8b05-ffd578937521
2005-08-03 05:39:29 +00:00
Richard Frith-Macdonald
4da9b3ba28 More changes to try to make library work with apple runtime/foundation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21597 72102866-910b-0410-8b05-ffd578937521
2005-08-02 14:53:32 +00:00
Richard Frith-Macdonald
6e63e622ce Improve portability for MacOSX
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21596 72102866-910b-0410-8b05-ffd578937521
2005-08-02 10:42:42 +00:00
Richard Frith-Macdonald
2d123b3b54 Various tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21421 72102866-910b-0410-8b05-ffd578937521
2005-07-07 21:11:04 +00:00
Richard Frith-Macdonald
9f7710abc7 Expand tildes in paths
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21338 72102866-910b-0410-8b05-ffd578937521
2005-06-21 13:10:55 +00:00
Richard Frith-Macdonald
51fa3d864d Improve string quoting
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21258 72102866-910b-0410-8b05-ffd578937521
2005-05-25 14:06:19 +00:00
Richard Frith-Macdonald
6c65810e52 Fix typo in documentation.
Add test for multibyte unicode character in char(1) field.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21257 72102866-910b-0410-8b05-ffd578937521
2005-05-25 13:27:08 +00:00
Richard Frith-Macdonald
ed84e87806 cope better with exception during disconnect.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21256 72102866-910b-0410-8b05-ffd578937521
2005-05-25 07:58:41 +00:00
Richard Frith-Macdonald
d4d7428dc8 Bugfix for cases where an exception occurs during a disconnect.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21255 72102866-910b-0410-8b05-ffd578937521
2005-05-25 07:57:04 +00:00
Richard Frith-Macdonald
84a3492d08 Add transaction description
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21247 72102866-910b-0410-8b05-ffd578937521
2005-05-22 09:21:01 +00:00
Richard Frith-Macdonald
fb6bdb5b92 Fix bad memory reference
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21227 72102866-910b-0410-8b05-ffd578937521
2005-05-16 09:33:12 +00:00
Richard Frith-Macdonald
d9c511e1b0 Add convenience method to encode a form, as a counterpart to the existing
method to decode a form.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21207 72102866-910b-0410-8b05-ffd578937521
2005-05-09 15:35:46 +00:00
Richard Frith-Macdonald
daf6b5c848 Improve description
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@20906 72102866-910b-0410-8b05-ffd578937521
2005-03-14 12:16:49 +00:00
Richard Frith-Macdonald
9bf2560ae9 experimental updates for performance and security
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@20826 72102866-910b-0410-8b05-ffd578937521
2005-03-02 10:00:24 +00:00
Adam Fedor
d288d00918 Add distribution info
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@20796 72102866-910b-0410-8b05-ffd578937521
2005-02-25 18:12:36 +00:00
Adam Fedor
508af4e4c4 * Version 1.1.0:
* GNUmakefile: Add version.
* README: Add ftp location.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@20795 72102866-910b-0410-8b05-ffd578937521
2005-02-25 18:08:22 +00:00
33 changed files with 19532 additions and 11650 deletions

View file

@ -1,504 +1,166 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
0. Additional Definitions.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
1. Exception to Section 3 of the GNU GPL.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
2. Conveying Modified Versions.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
3. Object Code Incorporating Material from Library Header Files.
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
b) Accompany the object code with a copy of the GNU GPL and this license
document.
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
4. Combined Works.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

1623
ChangeLog

File diff suppressed because it is too large Load diff

326
ECPG.pgm
View file

@ -9,16 +9,16 @@
This file is part of the SQLClient Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
@ -40,6 +40,9 @@
#include <Foundation/NSAutoreleasePool.h>
#include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h"
@interface SQLClientECPG : SQLClient
@ -108,18 +111,18 @@ void SQLErrorHandler()
const char *e1 = "Error in transaction processing";
sqlca.sqlcode = 0; // Reset error code
NSLog (@"Raising an exception, %ld, %s", code, sqlca.sqlerrm.sqlerrmc);
NSLog (@"Raising an exception, %d, %s", code, sqlca.sqlerrm.sqlerrmc);
if (strncmp(ptr, e0, strlen(e0)) == 0
|| strncmp(ptr, e1, strlen(e1)) == 0)
{
[NSException raise: SQLConnectionException
format: @"SQL Error: SQLCODE=(%ld): %s", code, ptr];
format: @"SQL Error: SQLCODE=(%d): %s", code, ptr];
}
else
{
[NSException raise: SQLException
format: @"SQL Error: SQLCODE=(%ld): %s", code, ptr];
format: @"SQL Error: SQLCODE=(%d): %s", code, ptr];
}
}
@ -134,7 +137,7 @@ static NSDate *future = nil;
future = [NSCalendarDate dateWithString: @"9999-01-01 00:00:00 +0000"
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"
locale: nil];
RETAIN(future);
[future retain];
}
}
@ -245,20 +248,20 @@ static NSDate *future = nil;
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
EXEC SQL BEGIN DECLARE SECTION;
char *statement;
char *handle;
EXEC SQL END DECLARE SECTION;
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
unsigned int length;
NSString *stmt = [info objectAtIndex: 0];
length = [stmt length];
if (length == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
@ -276,9 +279,9 @@ static NSDate *future = nil;
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
RELEASE (arp);
[arp release];
[NSException raise: SQLException
format: @"Unable to connect to '%@' to execute statement %@",
[self name], stmt];
@ -296,7 +299,7 @@ static NSDate *future = nil;
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
/*
* remove line number information from database exception message
@ -322,13 +325,14 @@ static NSDate *future = nil;
[self debug: @"Error executing statement:\n%@\n%@",
stmt, localException];
}
RETAIN (localException);
RELEASE (arp);
AUTORELEASE (localException);
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
[arp release];
return -1;
}
static unsigned int trim(char *str)
@ -356,6 +360,8 @@ static unsigned int trim(char *str)
}
- (NSMutableArray*) backendQuery: (NSString*)stmt
recordType: (id)rtype
listType: (id)ltype
{
EXEC SQL BEGIN DECLARE SECTION;
bool aBool;
@ -377,7 +383,7 @@ static unsigned int trim(char *str)
char *query;
char *handle;
EXEC SQL END DECLARE SECTION;
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSMutableArray *records;
BOOL isOpen = NO;
BOOL localTransaction = NO;
@ -385,21 +391,21 @@ static unsigned int trim(char *str)
length = [stmt length];
if (length == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
query = (char*)[hackForPrepare(stmt) UTF8String];
handle = (char*)[[self clientName] UTF8String];
records = [[NSMutableArray alloc] initWithCapacity: 32];
records = [[ltype alloc] initWithCapacity: 32];
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
RELEASE (arp);
[arp release];
[NSException raise: SQLException
format: @"Unable to connect to '%@' to run query %@",
[self name], stmt];
@ -551,7 +557,10 @@ static unsigned int trim(char *str)
case SQL3_CHARACTER_VARYING:
EXEC SQL GET DESCRIPTOR myDesc VALUE :index
:aString = DATA;
trim(aString);
if (_shouldTrim)
{
trim(aString);
}
v = [NSString stringWithUTF8String: aString];
free(aString);
break;
@ -580,7 +589,10 @@ static unsigned int trim(char *str)
default:
EXEC SQL GET DESCRIPTOR myDesc VALUE :index
:aString = DATA;
trim(aString);
if (_shouldTrim)
{
trim(aString);
}
v = [NSString stringWithUTF8String: aString];
free(aString);
if ([self debugging] > 0)
@ -597,11 +609,11 @@ static unsigned int trim(char *str)
keys[index-1] = [NSString stringWithUTF8String:
fieldName];
}
record = [SQLRecord newWithValues: values
keys: keys
count: count];
record = [rtype newWithValues: values
keys: keys
count: count];
[records addObject: record];
RELEASE(record);
[record release];
}
}
@ -619,7 +631,8 @@ static unsigned int trim(char *str)
NSString *n = [localException name];
NSString *msg = [localException reason];
DESTROY(records);
[records release];
records = nil;
NS_DURING
{
@ -638,14 +651,14 @@ static unsigned int trim(char *str)
if ([e isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
}
NS_ENDHANDLER
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
/*
@ -667,15 +680,15 @@ static unsigned int trim(char *str)
userInfo: nil];
}
}
RETAIN(localException);
RELEASE(arp);
AUTORELEASE(localException);
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
[arp release];
return AUTORELEASE(records);
return [records autorelease];
}
- (unsigned) copyEscapedBLOB: (NSData*)blob into: (void*)buf
@ -809,7 +822,7 @@ static unsigned int trim(char *str)
}
}
dst[dLen] = '\0';
return dst; // Owned by autoreleased NSMutableData
return (const char*)dst; // Owned by autoreleased NSMutableData
}
- (NSData *) dataFromBlob: (const char *)blob
@ -933,9 +946,13 @@ static unsigned int trim(char *str)
- (NSDate*) dbToDateFromBuffer: (char*)b length: (int)l
{
char buf[l+32]; /* Allow space to expend buffer. */
NSString *s;
int i;
char buf[l+32]; /* Allow space to expand buffer. */
NSCalendarDate *d;
BOOL milliseconds = NO;
BOOL timezone = NO;
NSString *s;
int i;
int e;
memcpy(buf, b, l);
b = buf;
@ -958,98 +975,153 @@ static unsigned int trim(char *str)
if (l == 10)
{
s = [self dbToStringFromBuffer: b length: l];
s = [NSString stringWithUTF8String: b];
return [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d"
locale: nil];
}
i = l;
/* Convert +/-HH:SS timezone to +/-HHSS
*/
if (i > 5 && b[i-3] == ':' && (b[i-6] == '+' || b[i-6] == '-'))
{
b[i-3] = b[i-2];
b[i-2] = b[i-1];
b[--i] = '\0';
}
while (i-- > 0)
{
if (b[i] == '+' || b[i] == '-')
{
break;
}
if (b[i] == ':' || b[i] == ' ')
{
i = 0;
break; /* No time zone found */
}
}
if (i == 0)
{
e = l;
}
else
{
i = l;
while (i-- > 0)
{
if (b[i] == '+' || b[i] == '-')
{
break;
}
if (b[i] == ':' || b[i] == ' ')
{
i = 0;
break; /* No time zone found */
}
}
if (i > 0)
{
int e = i;
timezone = YES;
e = i;
if (isdigit(b[i-1]))
{
/*
* Make space between seconds and timezone.
*/
memmove(&b[i+1], &b[i], l - i);
b[i++] = ' ';
b[++l] = '\0';
}
if (isdigit(b[i-1]))
{
/*
* Make space between seconds and timezone.
*/
memmove(&b[i+1], &b[i], l - i);
b[i++] = ' ';
b[++l] = '\0';
}
if (isdigit(b[i+1]) && isdigit(b[i+2]))
{
if (b[i+3] == '\0')
{
// Two digit time zone
b[l++] = '0';
b[l++] = '0';
b[l] = '\0';
}
else if (b[i+3] == ':')
{
// Zone with colon before minutes
b[i+3] = b[i+4];
b[i+5] = b[i+5];
b[--l] = '\0';
}
}
/* FIXME ... horrible kludge for postgres returning timestamps with
fractional second information. */
while (i-- > 0)
{
if (b[i] == '.')
{
break;
}
}
if (i > 0)
{
memmove(&b[i], &b[e], l - e);
l -= (e - i);
b[l] = '\0';
}
}
else if (l == 19)
{
/* A date and time without a timezone ... assume gmt */
strcat(b, " +0000");
l += 6;
}
/* If it's a simple date (YYYY-MM-DD) append time for start of day. */
if (l == 10)
{
strcat(b, " 00:00:00 +0000");
l += 15;
}
if (l == 0)
{
return nil;
}
s = [self dbToStringFromBuffer: b length: l];
return [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"
locale: nil];
/*
* Ensure we have a four digit timezone value.
*/
if (isdigit(b[i+1]) && isdigit(b[i+2]))
{
if (b[i+3] == '\0')
{
// Two digit time zone ... append zero minutes
b[l++] = '0';
b[l++] = '0';
b[l] = '\0';
}
else if (b[i+3] == ':')
{
// Zone with colon before minutes ... remove it
b[i+3] = b[i+4];
b[i+4] = b[i+5];
b[--l] = '\0';
}
}
}
/* kludge for timestamps with fractional second information.
* Force it to 3 digit millisecond */
while (i-- > 0)
{
if (b[i] == '.')
{
milliseconds = YES;
i++;
if (!isdigit(b[i]))
{
memmove(&b[i+3], &b[i], e-i);
l += 3;
memcpy(&b[i], "000", 3);
}
i++;
if (!isdigit(b[i]))
{
memmove(&b[i+2], &b[i], e-i);
l += 2;
memcpy(&b[i], "00", 2);
}
i++;
if (!isdigit(b[i]))
{
memmove(&b[i+1], &b[i], e-i);
l += 1;
memcpy(&b[i], "0", 1);
}
i++;
break;
}
}
if (i > 0 && i < e)
{
memmove(&b[i], &b[e], l - e);
l -= (e - i);
}
b[l] = '\0';
if (l == 0)
{
return nil;
}
s = [NSString stringWithUTF8String: b];
if (YES == timezone)
{
if (milliseconds == YES)
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S.%F %z"
locale: nil];
}
else
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"
locale: nil];
}
}
else
{
if (milliseconds == YES)
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S.%F"
locale: nil];
}
else
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S"
locale: nil];
}
}
[d setCalendarFormat: @"%Y-%m-%d %H:%M:%S %z"];
return d;
}
- (NSString*) dbToStringFromBuffer: (char*)b length: (int)l
@ -1067,8 +1139,8 @@ static unsigned int trim(char *str)
}
d = [[NSData alloc] initWithBytes: b length: l];
s = [[NSString alloc] initWithData: d encoding: NSUTF8StringEncoding];
RELEASE(d);
return AUTORELEASE(s);
[d release];
return [s autorelease];
}
@end

View file

@ -1,30 +1,59 @@
ifeq ($(GNUSTEP_MAKEFILES),)
GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
ifeq ($(GNUSTEP_MAKEFILES),)
$(warning )
$(warning Unable to obtain GNUSTEP_MAKEFILES setting from gnustep-config!)
$(warning Perhaps gnustep-make is not properly installed,)
$(warning so gnustep-config is not in your PATH.)
$(warning )
$(warning Your PATH is currently $(PATH))
$(warning )
endif
endif
ifeq ($(GNUSTEP_MAKEFILES),)
$(error You need to set GNUSTEP_MAKEFILES before compiling!)
endif
include $(GNUSTEP_MAKEFILES)/common.make
# Force sequential build to prevent different versions of the same
# bundle overwriting each other's temporary files during building.
GNUSTEP_MAKE_PARALLEL_BUILDING=no
-include config.make
PACKAGE_NAME = SQLClient
PACKAGE_VERSION = 1.9.0
CVS_MODULE_NAME = gnustep/dev-libs/SQLClient
CVS_TAG_NAME = SQLClient
SVN_BASE_URL=svn+ssh://svn.gna.org/svn/gnustep/libs
SVN_MODULE_NAME=sqlclient
NEEDS_GUI = NO
TEST_TOOL_NAME=
LIBRARY_NAME=SQLClient
DOCUMENT_NAME=SQLClient
SQLClient_INTERFACE_VERSION=1.1
SQLClient_INTERFACE_VERSION=1.9
SQLClient_OBJC_FILES = SQLClient.m WebServer.m WebServerBundles.m
SQLClient_LIBRARIES_DEPEND_UPON =
SQLClient_HEADER_FILES = SQLClient.h WebServer.h
SQLClient_OBJC_FILES = SQLClient.m SQLClientPool.m
SQLClient_LIBRARIES_DEPEND_UPON = -lPerformance $(FND_LIBS) $(OBJC_LIBS)
SQLClient_HEADER_FILES = SQLClient.h
SQLClient_AGSDOC_FILES = SQLClient.h
SQLClient_AGSDOC_FLAGS = -WordMap '{SQLCLIENT_PRIVATE="";}'
# Optional Java wrappers for the library
JAVA_WRAPPER_NAME = SQLClient
SQLClient_HEADER_FILES_INSTALL_DIR = SQLClient
DOCUMENT_NAME=SQLClient
SQLClient_AGSDOC_FILES = SQLClient.h WebServer.h
BUNDLE_NAME=
BUNDLE_INSTALL_DIR=$(GNUSTEP_INSTALLATION_DIR)/Library/Bundles/SQLClient
BUNDLE_INSTALL_DIR=$(GNUSTEP_BUNDLES)/SQLClient$(SQLClient_INTERFACE_VERSION)
# In some systems and situations the dynamic linker needs to haved the
# SQLClient, gnustep-base, and objc libraries explicityly linked into
@ -32,61 +61,147 @@ BUNDLE_INSTALL_DIR=$(GNUSTEP_INSTALLATION_DIR)/Library/Bundles/SQLClient
# To handle that, we create two versions of each bundle, the seond version
# has _libs appended to the bundle name, and has the extra libraries linked.
ifeq ($(LINKSQLCLIENT),)
LINKSQLCLIENT=0
ifeq ($(findstring darwin, $(GNUSTEP_TARGET_OS)), darwin)
LINKSQLCLIENT=1
endif
endif
ifneq ($(ECPG),)
ifeq ($(LINKSQLCLIENT),1)
BUNDLE_NAME += ECPG
ECPG_OBJC_FILES = ECPG.m
ECPG_LIB_DIRS = -L./obj
ECPG_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
ECPG_BUNDLE_LIBS += -lSQLClient -lecpg
ECPG_PRINCIPAL_CLASS = SQLClientECPG
else
BUNDLE_NAME += ECPG
ECPG_OBJC_FILES = ECPG.m
ECPG_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
ECPG_BUNDLE_LIBS += -lecpg
ECPG_PRINCIPAL_CLASS = SQLClientECPG
BUNDLE_NAME += ECPG_libs
ECPG_libs_OBJC_FILES = ECPG.m
ECPG_libs_LIB_DIRS = -L./obj
ECPG_libs_BUNDLE_LIBS += -lSQLClient -lgnustep-base -lobjc -lecpg
ECPG_libs_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
ECPG_libs_BUNDLE_LIBS += -lSQLClient -lPerformance \
$(FND_LIBS) $(OBJC_LIBS) -lecpg
ECPG_libs_PRINCIPAL_CLASS = SQLClientECPG_libs
endif
TEST_TOOL_NAME += testECPG
testECPG_OBJC_FILES = testECPG.m
testECPG_TOOL_LIBS += -lSQLClient
testECPG_LIB_DIRS += -L./obj
testECPG_LIB_DIRS += -L./$(GNUSTEP_OBJ_DIR)
testECPG_TOOL_LIBS += -lSQLClient -lPerformance
endif
ifneq ($(POSTGRES),)
ifeq ($(LINKSQLCLIENT),1)
BUNDLE_NAME += Postgres
Postgres_OBJC_FILES = Postgres.m
Postgres_LIB_DIRS = -L./obj
Postgres_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
Postgres_BUNDLE_LIBS += -lSQLClient -lpq
Postgres_PRINCIPAL_CLASS = SQLClientPostgres
else
BUNDLE_NAME += Postgres
Postgres_OBJC_FILES = Postgres.m
Postgres_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
Postgres_BUNDLE_LIBS += -lpq
Postgres_PRINCIPAL_CLASS = SQLClientPostgres
BUNDLE_NAME += Postgres_libs
Postgres_libs_OBJC_FILES = Postgres.m
Postgres_libs_LIB_DIRS = -L./obj
Postgres_libs_BUNDLE_LIBS += -lSQLClient -lgnustep-base -lobjc -lpq
Postgres_libs_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
Postgres_libs_BUNDLE_LIBS += -lSQLClient -lPerformance \
$(FND_LIBS) $(OBJC_LIBS) -lpq
Postgres_libs_PRINCIPAL_CLASS = SQLClientPostgres_libs
endif
TEST_TOOL_NAME += testPostgres
testPostgres_OBJC_FILES = testPostgres.m
testPostgres_LIB_DIRS += -L./obj
testPostgres_TOOL_LIBS += -lSQLClient
testPostgres_LIB_DIRS += -L./$(GNUSTEP_OBJ_DIR)
testPostgres_TOOL_LIBS += -lSQLClient -lPerformance
endif
ifneq ($(JDBC),)
ifeq ($(LINKSQLCLIENT),1)
BUNDLE_NAME += JDBC
JDBC_OBJC_FILES = JDBC.m
JDBC_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR) $(JDBC_VM_LIBDIRS)
JDBC_BUNDLE_LIBS += -lSQLClient $(JDBC_VM_LIBS)
JDBC_PRINCIPAL_CLASS = SQLClientJDBC
else
BUNDLE_NAME += JDBC
JDBC_OBJC_FILES = JDBC.m
JDBC_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR) $(JDBC_VM_LIBDIRS)
JDBC_BUNDLE_LIBS += $(JDBC_VM_LIBS)
JDBC_PRINCIPAL_CLASS = SQLClientJDBC
BUNDLE_NAME += JDBC_libs
JDBC_libs_OBJC_FILES = JDBC.m
JDBC_libs_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR) $(JDBC_VM_LIBDIRS)
JDBC_libs_BUNDLE_LIBS += -lSQLClient -lPerformance \
$(FND_LIBS) $(OBJC_LIBS) $(JDBC_VM_LIBS)
JDBC_libs_PRINCIPAL_CLASS = SQLClientJDBC_libs
endif
TEST_TOOL_NAME += testJDBC
testJDBC_OBJC_FILES = testJDBC.m
testJDBC_LIB_DIRS += -L./$(GNUSTEP_OBJ_DIR)
testJDBC_TOOL_LIBS += -lSQLClient -lPerformance
endif
ifneq ($(MYSQL),)
ifeq ($(LINKSQLCLIENT),1)
BUNDLE_NAME += MySQL
MySQL_OBJC_FILES = MySQL.m
MySQL_LIB_DIRS = -L./obj
MySQL_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
MySQL_BUNDLE_LIBS += -lSQLClient -lmysqlclient
MySQL_PRINCIPAL_CLASS = SQLClientMySQL
else
BUNDLE_NAME += MySQL
MySQL_OBJC_FILES = MySQL.m
MySQL_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
MySQL_BUNDLE_LIBS += -lmysqlclient
MySQL_PRINCIPAL_CLASS = SQLClientMySQL
BUNDLE_NAME += MySQL_libs
MySQL_libs_OBJC_FILES = MySQL.m
MySQL_libs_LIB_DIRS = -L./obj
MySQL_libs_BUNDLE_LIBS += -lSQLClient -lgnustep-base -lobjc -lmysqlclient
MySQL_libs_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
MySQL_libs_BUNDLE_LIBS += -lSQLClient -lPerformance \
$(FND_LIBS) $(OBJC_LIBS) -lmysqlclient
MySQL_libs_PRINCIPAL_CLASS = SQLClientMySQL_libs
endif
TEST_TOOL_NAME += testMySQL
testMySQL_OBJC_FILES = testMySQL.m
testMySQL_LIB_DIRS += -L./obj
testMySQL_TOOL_LIBS += -lSQLClient
testMySQL_LIB_DIRS += -L./$(GNUSTEP_OBJ_DIR)
testMySQL_TOOL_LIBS += -lSQLClient -lPerformance
endif
ifneq ($(SQLITE),)
ifeq ($(LINKSQLCLIENT),1)
BUNDLE_NAME += SQLite
SQLite_OBJC_FILES = SQLite.m
SQLite_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
SQLite_BUNDLE_LIBS += -lSQLClient -lsqlite3
SQLite_PRINCIPAL_CLASS = SQLClientSQLite
else
BUNDLE_NAME += SQLite
SQLite_OBJC_FILES = SQLite.m
SQLite_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
SQLite_BUNDLE_LIBS += -lsqlite3
SQLite_PRINCIPAL_CLASS = SQLClientSQLite
BUNDLE_NAME += SQLite_libs
SQLite_libs_OBJC_FILES = SQLite.m
SQLite_libs_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
SQLite_libs_BUNDLE_LIBS += -lSQLClient -lPerformance \
$(FND_LIBS) $(OBJC_LIBS) -lsqlite3
SQLite_libs_PRINCIPAL_CLASS = SQLClientSQLite_libs
endif
TEST_TOOL_NAME += testSQLite
testSQLite_OBJC_FILES = testSQLite.m
testSQLite_LIB_DIRS += -L./$(GNUSTEP_OBJ_DIR)
testSQLite_TOOL_LIBS += -lSQLClient -lPerformance
endif
ifneq ($(ORACLE_HOME),)
BUNDLE_NAME += Oracle
Oracle_OBJC_FILES = Oracle.m
Oracle_LIB_DIRS = -L$(ORACLE_HOME)/lib -L./obj \
Oracle_LIB_DIRS = -L$(ORACLE_HOME)/lib -L./$(GNUSTEP_OBJ_DIR) \
$(shell cat $(ORACLE_HOME)/lib/ldflags)
Oracle_BUNDLE_LIBS += -lclntsh \
$(shell cat $(ORACLE_HOME)/lib/sysliblist) \
@ -94,10 +209,10 @@ Oracle_BUNDLE_LIBS += -lclntsh \
Oracle_PRINCIPAL_CLASS = SQLClientOracle
BUNDLE_NAME += Oracle_libs
Oracle_libs_OBJC_FILES = Oracle.m
Oracle_libs_LIB_DIRS = -L$(ORACLE_HOME)/lib -L./obj \
Oracle_libs_LIB_DIRS = -L$(ORACLE_HOME)/lib -L./$(GNUSTEP_OBJ_DIR) \
$(shell cat $(ORACLE_HOME)/lib/ldflags)
Oracle_libs_BUNDLE_LIBS += -lclntsh \
-lSQLClient -lgnustep-base -lobjc \
-lSQLClient -lPerformance $(FND_LIBS) $(OBJC_LIBS) \
$(shell cat $(ORACLE_HOME)/lib/sysliblist) \
-ldl -lm
Oracle_libs_PRINCIPAL_CLASS = SQLClientOracle_libs
@ -107,6 +222,10 @@ endif
include $(GNUSTEP_MAKEFILES)/library.make
include $(GNUSTEP_MAKEFILES)/bundle.make
# If JIGS is installed, automatically generate Java wrappers as well.
# Because of the '-', should not complain if java-wrapper.make can't be
# found ... simply skip generation of java wrappers in that case.
-include $(GNUSTEP_MAKEFILES)/java-wrapper.make
include $(GNUSTEP_MAKEFILES)/test-tool.make
include $(GNUSTEP_MAKEFILES)/documentation.make

View file

@ -13,9 +13,7 @@ ifneq ($(ECPG),)
%.m: %.pgm
ecpg -o $@ $< $(ADDITIONAL_INCLUDE_DIRS)
# if you need to see the .m files for debugging, uncomment
# the following line
#.PRECIOUS: %.m
.PRECIOUS: %.m
endif
@ -25,9 +23,7 @@ ifneq ($(ORACLE_HOME),)
%.m: %.pm
proc iname=$< oname=$@ mode=ansi parse=none
# if you need to see the .m files for debugging, uncomment
# the following line
#.PRECIOUS: %.m
.PRECIOUS: %.m
endif
@ -70,6 +66,10 @@ after-distclean::
# Things to do after checking
# after-check::
config.make: config.make.in
./configure
config.make: config.status
if [ -x config.status ]; then \
./config.status --recheck; \
else \
./configure; \
fi

View file

@ -12,7 +12,7 @@
#
# Additional flags to pass to the preprocessor
# ADDITIONAL_CPPFLAGS +=
ADDITIONAL_CPPFLAGS += -DSOVERSION=\"$(SQLClient_INTERFACE_VERSION)\"
# Additional flags to pass to the Objective-C compiler
# ADDITIONAL_OBJCFLAGS +=

View file

@ -0,0 +1,2 @@
LIBRARIES_DEPEND_UPON += -lPerformance.A
ADDITIONAL_LIB_DIRS = -L../../$(GNUSTEP_OBJ_DIR)

1942
JDBC.m Normal file

File diff suppressed because it is too large Load diff

268
MySQL.m
View file

@ -9,36 +9,40 @@
This file is part of the SQLClient Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$Date$ $Revision$
*/
#include <Foundation/NSString.h>
#include <Foundation/NSData.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSCalendarDate.h>
#include <Foundation/NSException.h>
#include <Foundation/NSProcessInfo.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSUserDefaults.h>
#include <Foundation/NSMapTable.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSNull.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDate.h>
#import <Foundation/NSException.h>
#import <Foundation/NSLock.h>
#import <Foundation/NSMapTable.h>
#import <Foundation/NSNotification.h>
#import <Foundation/NSNull.h>
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSString.h>
#import <Foundation/NSTimeZone.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h"
#include <mysql/mysql.h>
@ -58,12 +62,12 @@ static NSNull *null = nil;
{
if (future == nil)
{
future = [NSCalendarDate dateWithString: @"9999-01-01 00:00:00 +0000"
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"
future = [NSCalendarDate dateWithString: @"9999-01-01 00:00:00"
calendarFormat: @"%Y-%m-%d %H:%M:%S"
locale: nil];
RETAIN(future);
[future retain];
null = [NSNull null];
RETAIN(null);
[null retain];
}
}
@ -97,9 +101,11 @@ static NSNull *null = nil;
if ([self debugging] > 0)
{
[self debug: @"Connect to '%@' as %@", [self database], [self name]];
[self debug: @"Connect to '%@' as %@",
[self database], [self name]];
}
extra = mysql_init(0);
mysql_options(connection, MYSQL_SET_CHARSET_NAME, "utf8");
if (mysql_real_connect(connection,
[host UTF8String],
[[self user] UTF8String],
@ -107,23 +113,13 @@ static NSNull *null = nil;
[dbase UTF8String],
[port intValue],
NULL,
0
) == 0)
CLIENT_MULTI_STATEMENTS) == 0)
{
[self debug: @"Error connecting to '%@' (%@) - %s",
[self name], [self database], mysql_error(connection)];
mysql_close(connection);
extra = 0;
}
#if 0
else if (mysql_query(connection, "SET CHARACTER SET utf8") != 0)
{
[self debug: @"Error setting utf8 support for '%@' (%@) - %s",
[self name], [self database], mysql_error(connection)];
mysql_close(connection);
extra = 0;
}
#endif
else
{
connected = YES;
@ -168,6 +164,7 @@ static NSNull *null = nil;
}
NS_HANDLER
{
extra = 0;
[self debug: @"Error disconnecting from database (%@): %@",
[self clientName], localException];
}
@ -176,28 +173,30 @@ static NSNull *null = nil;
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
NSString *stmt;
CREATE_AUTORELEASE_POOL(arp);
NSString *stmt;
NSInteger rowCount = 0;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
stmt = [info objectAtIndex: 0];
if ([stmt length] == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
NS_DURING
{
MYSQL_RES *result;
const char *statement;
unsigned length;
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to execute statement %@",
@ -209,14 +208,38 @@ static NSNull *null = nil;
statement = [self insertBLOBs: info
intoStatement: statement
length: length
withMarker: "'''"
length: 3
withMarker: "'?'''?'"
length: 7
giving: &length];
if (mysql_real_query(connection, statement, length) != 0)
{
[NSException raise: SQLException format: @"%s",
mysql_error(connection)];
NSString *s;
s = [NSString stringWithFormat: @"%s", mysql_error(connection)];
if (mysql_ping(connection) == 0)
{
[NSException raise: SQLException format: @"%@", s];
}
else
{
[NSException raise: SQLConnectionException format: @"%@", s];
}
}
/* See how many rows were modified.
*/
rowCount = mysql_affected_rows(connection);
/* discard any results.
*/
result = mysql_store_result(connection);
if (result != 0) mysql_free_result(result);
while (mysql_more_results(connection))
{
if (mysql_next_result(connection) == 0)
{
result = mysql_store_result(connection);
if (result != 0) mysql_free_result(result);
}
}
}
NS_HANDLER
@ -225,20 +248,21 @@ static NSNull *null = nil;
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
if ([self debugging] > 0)
{
[self debug: @"Error executing statement:\n%@\n%@",
stmt, localException];
}
RETAIN (localException);
RELEASE (arp);
AUTORELEASE (localException);
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
[arp release];
return rowCount;
}
static unsigned int trim(char *str)
@ -266,14 +290,16 @@ static unsigned int trim(char *str)
}
- (NSMutableArray*) backendQuery: (NSString*)stmt
recordType: (id)rtype
listType: (id)ltype
{
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSMutableArray *records = nil;
MYSQL_RES *result = 0;
if ([stmt length] == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
@ -285,7 +311,7 @@ static unsigned int trim(char *str)
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to run query %@",
@ -304,10 +330,10 @@ static unsigned int trim(char *str)
for (i = 0; i < fieldCount; i++)
{
keys[i] = [NSString stringWithUTF8String: fields[i].name];
keys[i] = [NSString stringWithUTF8String: (char*)fields[i].name];
}
records = [[NSMutableArray alloc] initWithCapacity: recordCount];
records = [[ltype alloc] initWithCapacity: recordCount];
for (i = 0; i < recordCount; i++)
{
SQLRecord *record;
@ -319,7 +345,7 @@ static unsigned int trim(char *str)
for (j = 0; j < fieldCount; j++)
{
id v = null;
unsigned char *p = row[j];
unsigned char *p = (unsigned char*)row[j];
if (p != 0)
{
@ -335,60 +361,55 @@ static unsigned int trim(char *str)
{
case FIELD_TYPE_TIMESTAMP:
{
char b[32];
NSString *f;
NSString *s;
s = [[NSString alloc] initWithBytes: p
length: size encoding: NSASCIIStringEncoding];
if (size > 14)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S"
locale: nil];
size = 19;
f = @"%Y-%m-%d %H:%M:%S %z";
}
else if (size == 14)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y%m%d%H%M%S"
locale: nil];
f = @"%Y%m%d%H%M%S %z";
}
else if (size == 12)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y%m%d%H%M%S"
locale: nil];
f = @"%y%m%d%H%M%S %z";
}
else if (size == 10)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y%m%d%H%M"
locale: nil];
f = @"%y%m%d%H%M %z";
}
else if (size == 8)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y%m%d%H"
locale: nil];
f = @"%y%m%d%H %z";
}
else if (size == 6)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y%m%d"
locale: nil];
f = @"%y%m%d %z";
}
else if (size == 4)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y%m"
locale: nil];
f = @"%y%m %z";
}
else
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y"
locale: nil];
f = @"%y %z";
}
RELEASE(s);
strncpy(b, (char*)p, size);
strncpy(b + size, (char*)" +0000", 6);
s = [[NSString alloc] initWithBytes: b
length: size + 6
encoding: NSASCIIStringEncoding];
v = [NSCalendarDate dateWithString: s
calendarFormat: f
locale: nil];
[v setCalendarFormat: @"%Y-%m-%d %H:%M:%S %z"];
if ([self debugging] > 1)
[self debug: @"Parsed '%@' as '%@'\n", s, v];
[s release];
}
break;
@ -400,28 +421,49 @@ static unsigned int trim(char *str)
case FIELD_TYPE_TINY_BLOB:
case FIELD_TYPE_MEDIUM_BLOB:
case FIELD_TYPE_LONG_BLOB:
v = [NSData dataWithBytes: p length: size];
if (63 == fields[j].charsetnr)
{
v = [NSData dataWithBytes: p length: size];
}
else
{
v = [[[NSString alloc] initWithBytes: p
length: size
encoding: NSUTF8StringEncoding] autorelease];
}
break;
default:
trim(p);
v = [NSString stringWithUTF8String: p];
if (YES == _shouldTrim)
{
trim((char*)p);
}
v = [NSString stringWithUTF8String: (char*)p];
break;
}
}
values[j] = v;
}
record = [SQLRecord newWithValues: values
keys: keys
count: fieldCount];
record = [rtype newWithValues: values
keys: keys
count: fieldCount];
[records addObject: record];
RELEASE(record);
[record release];
}
}
else
{
[NSException raise: SQLException format: @"%s",
mysql_error(connection)];
NSString *s;
s = [NSString stringWithFormat: @"%s", mysql_error(connection)];
if (mysql_ping(connection) == 0)
{
[NSException raise: SQLException format: @"%@", s];
}
else
{
[NSException raise: SQLConnectionException format: @"%@", s];
}
}
}
NS_HANDLER
@ -430,7 +472,7 @@ static unsigned int trim(char *str)
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
if ([self debugging] > 0)
{
@ -441,19 +483,20 @@ static unsigned int trim(char *str)
{
mysql_free_result(result);
}
DESTROY(records);
RETAIN (localException);
RELEASE (arp);
AUTORELEASE (localException);
[records release];
records = nil;
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
[arp release];
if (result != 0)
{
mysql_free_result(result);
}
return AUTORELEASE(records);
return [records autorelease];
}
- (unsigned) copyEscapedBLOB: (NSData*)blob into: (void*)buf
@ -506,5 +549,38 @@ static unsigned int trim(char *str)
return length;
}
- (NSString*) quote: (id)obj
{
/* MySQL doesn't support timezones ... convert dates to simple GMT.
*/
if ([obj isKindOfClass: [NSDate class]] == YES)
{
NSString *fmt = nil;
static NSTimeZone *gmt = nil;
if (nil == gmt)
{
gmt = [[NSTimeZone timeZoneForSecondsFromGMT: 0] retain];
}
if ([obj isKindOfClass: [NSCalendarDate class]] == YES)
{
fmt = [obj calendarFormat];
if ([fmt length] > 17)
{
fmt = nil; // bad format ... had timezone
}
}
if (nil == fmt)
{
fmt = @"%Y-%m-%d %H:%M:%S";
}
fmt = [NSString stringWithFormat: @"'%@'", fmt];
return [obj descriptionWithCalendarFormat: fmt
timeZone: gmt
locale: nil];
}
return [super quote: obj];
}
@end

275
Oracle.pm
View file

@ -10,16 +10,16 @@
This file is part of the SQLClient Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
@ -216,7 +216,7 @@ void SQLClientOracleErrorHandler()
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
EXEC SQL BEGIN DECLARE SECTION;
char *statement;
@ -240,7 +240,7 @@ void SQLClientOracleErrorHandler()
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"(Oracle) Unable to connect to database"];
@ -273,7 +273,7 @@ void SQLClientOracleErrorHandler()
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
/*
* remove line number information from database exception message
@ -300,6 +300,7 @@ void SQLClientOracleErrorHandler()
}
NS_ENDHANDLER
DESTROY(arp);
return -1;
}
static unsigned int trim(char *str)
@ -326,7 +327,7 @@ static unsigned int trim(char *str)
return (str - start);
}
- (NSMutableArray*) backendQuery: (NSString*)stmt
- (NSMutableArray*) backendQuery: (NSString*)stmt recordClass: (Class)rClass
{
EXEC SQL BEGIN DECLARE SECTION;
int count;
@ -368,7 +369,7 @@ static unsigned int trim(char *str)
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"(Oracle) Unable to connect to database"];
@ -553,7 +554,10 @@ static unsigned int trim(char *str)
/* \0-pad the string. */
aString[octetLength] = '\0';
trim (aString);
if (YES == _shouldTrim)
{
trim (aString);
}
v = [NSString stringWithUTF8String: aString];
free(aString);
break;
@ -584,7 +588,10 @@ static unsigned int trim(char *str)
EXEC SQL GET DESCRIPTOR 'myDesc' VALUE :index
:aString = DATA;
aString[octetLength] = '\0';
trim (aString);
if (YES == _shouldTrim)
{
trim (aString);
}
v = [NSString stringWithUTF8String: aString];
free (aString);
NSLog(@"(Oracle) Unknown data type (%d) for '%s': '%@'",
@ -597,9 +604,9 @@ static unsigned int trim(char *str)
keys[index - 1] = [NSString stringWithUTF8String:
fieldName];
}
record = [SQLRecord newWithValues: values
keys: keys
count: count];
record = [rClass newWithValues: values
keys: keys
count: count];
[records addObject: record];
RELEASE(record);
}
@ -644,7 +651,7 @@ static unsigned int trim(char *str)
}
if ([e isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
}
NS_ENDHANDLER
@ -667,7 +674,7 @@ static unsigned int trim(char *str)
if ([n isEqual: SQLConnectionException] == YES)
{
_inTransaction = NO;
[self backendDisconnect];
[self disconnect];
}
/*
@ -892,14 +899,15 @@ static unsigned int trim(char *str)
return ok;
}
/**
* Convert from a database character buffer to an NSDate.
*/
- (NSDate*) dbToDateFromBuffer: (char*)b length: (int)l
{
char buf[l+32]; /* Allow space to expend buffer. */
NSString *s;
int i;
char buf[l+32]; /* Allow space to expand buffer. */
NSCalendarDate *d;
BOOL milliseconds = NO;
BOOL timezone = NO;
NSString *s;
int i;
int e;
memcpy(buf, b, l);
b = buf;
@ -922,98 +930,153 @@ static unsigned int trim(char *str)
if (l == 10)
{
s = [self dbToStringFromBuffer: b length: l];
s = [NSString stringWithUTF8String: b];
return [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d"
locale: nil];
}
i = l;
/* Convert +/-HH:SS timezone to +/-HHSS
*/
if (i > 5 && b[i-3] == ':' && (b[i-6] == '+' || b[i-6] == '-'))
{
b[i-3] = b[i-2];
b[i-2] = b[i-1];
b[--i] = '\0';
}
while (i-- > 0)
{
if (b[i] == '+' || b[i] == '-')
{
break;
}
if (b[i] == ':' || b[i] == ' ')
{
i = 0;
break; /* No time zone found */
}
}
if (i == 0)
{
e = l;
}
else
{
i = l;
while (i-- > 0)
{
if (b[i] == '+' || b[i] == '-')
{
break;
}
if (b[i] == ':' || b[i] == ' ')
{
i = 0;
break; /* No time zone found */
}
}
if (i > 0)
{
int e = i;
timezone = YES;
e = i;
if (isdigit(b[i-1]))
{
/*
* Make space between seconds and timezone.
*/
memmove(&b[i+1], &b[i], l - i);
b[i++] = ' ';
b[++l] = '\0';
}
if (isdigit(b[i-1]))
{
/*
* Make space between seconds and timezone.
*/
memmove(&b[i+1], &b[i], l - i);
b[i++] = ' ';
b[++l] = '\0';
}
if (isdigit(b[i+1]) && isdigit(b[i+2]))
{
if (b[i+3] == '\0')
{
// Two digit time zone
b[l++] = '0';
b[l++] = '0';
b[l] = '\0';
}
else if (b[i+3] == ':')
{
// Zone with colon before minutes
b[i+3] = b[i+4];
b[i+5] = b[i+5];
b[--l] = '\0';
}
}
/* FIXME ... horrible kludge for postgres returning timestamps with
fractional second information. */
while (i-- > 0)
{
if (b[i] == '.')
{
break;
}
}
if (i > 0)
{
memmove(&b[i], &b[e], l - e);
l -= (e - i);
b[l] = '\0';
}
}
else if (l == 19)
{
/* A date and time without a timezone ... assume gmt */
strcat(b, " +0000");
l += 6;
}
/* If it's a simple date (YYYY-MM-DD) append time for start of day. */
if (l == 10)
{
strcat(b, " 00:00:00 +0000");
l += 15;
}
if (l == 0)
{
return nil;
}
s = [self dbToStringFromBuffer: b length: l];
return [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"
locale: nil];
/*
* Ensure we have a four digit timezone value.
*/
if (isdigit(b[i+1]) && isdigit(b[i+2]))
{
if (b[i+3] == '\0')
{
// Two digit time zone ... append zero minutes
b[l++] = '0';
b[l++] = '0';
b[l] = '\0';
}
else if (b[i+3] == ':')
{
// Zone with colon before minutes ... remove it
b[i+3] = b[i+4];
b[i+4] = b[i+5];
b[--l] = '\0';
}
}
}
/* kludge for timestamps with fractional second information.
* Force it to 3 digit millisecond */
while (i-- > 0)
{
if (b[i] == '.')
{
milliseconds = YES;
i++;
if (!isdigit(b[i]))
{
memmove(&b[i+3], &b[i], e-i);
l += 3;
memcpy(&b[i], "000", 3);
}
i++;
if (!isdigit(b[i]))
{
memmove(&b[i+2], &b[i], e-i);
l += 2;
memcpy(&b[i], "00", 2);
}
i++;
if (!isdigit(b[i]))
{
memmove(&b[i+1], &b[i], e-i);
l += 1;
memcpy(&b[i], "0", 1);
}
i++;
break;
}
}
if (i > 0 && i < e)
{
memmove(&b[i], &b[e], l - e);
l -= (e - i);
}
b[l] = '\0';
if (l == 0)
{
return nil;
}
s = [NSString stringWithUTF8String: b];
if (YES == timezone)
{
if (milliseconds == YES)
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S.%F %z"
locale: nil];
}
else
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"
locale: nil];
}
}
else
{
if (milliseconds == YES)
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S.%F"
locale: nil];
}
else
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S"
locale: nil];
}
}
[d setCalendarFormat: @"%Y-%m-%d %H:%M:%S %z"];
return d;
}
/**

3
Performance.import Normal file
View file

@ -0,0 +1,3 @@
import gnu.gnustep.Performance.*;

1835
Postgres.m

File diff suppressed because it is too large Load diff

49
README
View file

@ -49,6 +49,13 @@ Current backend bundles are -
I don't use MySQL... but the test program ran successfully with a
vanilla install of the MySQL packages for recent Debian unstable.
* SQLite - a bundle using the sqlite3 library which supports an
SQL-like API for direct access to a database file (rather than
acting as a client of a database server process).
Not as functional as the other backends (doesn't support dates
for instance), but good enough for many purposes and very
'lightweight'. See http://www.sqlite.org
* Oracle - a bundle using embedded SQL for Oracle.
Completely untested... may even need some work to compile...
but this *is* based on code which was working about a year ago.
@ -56,16 +63,16 @@ Current backend bundles are -
Where can you get it? How can you install it?
The SQLClient library is currently only available via CVS from the GNUstep CVS repository.
See <https://savannah.gnu.org/cvs/?group=gnustep>
You need to check out gnustep/dev-libs/SQLClient
The SQLClient library is currently available at
<ftp://ftp.gnustep.org/pub/gnustep/libs>
or via CVS from the GNUstep CVS repository (See <https://savannah.gnu.org/cvs/?group=gnustep>. Check out gnustep/dev-libs/SQLClient).
To build this library you must have a basic GNUstep environment set up...
* The gnustep-make package must have been built and installed.
* The gnustep-base package must have been built and installed.
* You must hace sourced the GNUstep.sh script (from gnustep-make)
to set up environment variables needed for building this.
* The Performance library (from the dev-libs area in GNUstep CVS)
must have been built and installed.
* If this environment is in place, all you should need to do is
run 'make' to configure and build the library, 'make install'
to install it.
@ -80,35 +87,3 @@ should be entered on the GNUstep project page
<http://savannah.gnu.org/support/?group-gnustep>
The WebServer class provides the framework for a GNUstep program to act as
an HTTP or HTTPS server for simple applications.
It does not attempt to be a general-purpose web server, but is rather
intended to permit a program to easily handle requests from automated
systems which are intended to control, monitor, or use the services
provided by the program in which the class is embedded.
The emphasis is on making it robust/reliable/simple, so you can rapidly
develop software using it. It is a single-threaded, single-process
system using asynchronous I/O, so you can easily run it under debug
in gdb to fix any bugs in your delegate object.
In particular of course, it may be used in conjunction with the
SQLClient class to implement web-based database applications.
The class is controlled by a few straightforward settings and basically
operates by handing over requests to its delegate. The delegate must at
least implement the -processRequest:response:for: method.
Built-in facilities include -
* Parsing of parameter string in request URL
* Parsing of url encoded form data in a POST request
* Parsing of form encoded data in a POST request
* Substitution into template pages on output
* SSL support
* Limit access by IP address
* Limit total number of simultaneous connections
* Limit number of simultaneous connectionsform one address
* Limit idle time permitted on a connection
* Limit size of request headers permitted
* Limit size of request body permitted

File diff suppressed because it is too large Load diff

81
SQLClient.jigs Normal file
View file

@ -0,0 +1,81 @@
{ /* -*-c-*- */
"prerequisite libraries" = (
"gnustep-base",
"Performance"
);
types = {
NSTimeInterval = double;
};
classes = (
{
"file to include in preamble java code" = "Performance.import";
"java name" = "gnu.gnustep.SQLClient.SQLClient";
"objective-c name" = "SQLClient";
"class methods" = (
"allClients",
"clientWithConfiguration:name:",
"existingClient:",
"maxConnections",
"purgeConnections:",
"setMaxConnections:",
);
"instance methods" = (
"begin",
"cache",
"cache:query:with:",
"cache:simpleQuery:",
"clientName",
"commit",
"connect",
"connected",
"database",
"debugging",
"disconnect",
"durationLogging",
"isInTransaction",
"lastOperation",
"name",
"password",
"query:with:",
"quote:",
"quoteChar:",
"quoteFloat:",
"quoteInteger:",
"rollback",
"setCache:",
"setDatabase:",
"setDebugging:",
"setDurationLogging:",
"setName:",
"setPassword:",
"setUser:",
"simpleExecute:",
"simpleQuery:",
"singletons:",
"transaction",
"user"
);
},
{
"java name" = "gnu.gnustep.SQLClient.SQLRecord";
"objective-c name" = "SQLRecord";
"instance methods" = (
"allKeys",
"dictionary",
"sizeInBytes:"
);
},
{
"java name" = "gnu.gnustep.SQLClient.SQLTransaction";
"objective-c name" = "SQLTransaction";
"instance methods" = (
"add:with:",
"append:",
"count",
"owner",
"execute",
"reset"
);
}
);
}

File diff suppressed because it is too large Load diff

1526
SQLClientPool.m Normal file

File diff suppressed because it is too large Load diff

370
SQLite.m Normal file
View file

@ -0,0 +1,370 @@
/* -*-objc-*- */
/** Implementation of SQLClientSQLite for GNUStep
Copyright (C) 2005 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
Date: Nov 2005
This file is part of the SQLClient Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$Date$ $Revision$
*/
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDate.h>
#import <Foundation/NSException.h>
#import <Foundation/NSLock.h>
#import <Foundation/NSMapTable.h>
#import <Foundation/NSNotification.h>
#import <Foundation/NSNull.h>
#import <Foundation/NSPathUtilities.h>
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h"
#include <string.h>
#include <sqlite3.h>
@interface SQLClientSQLite : SQLClient
@end
@implementation SQLClientSQLite
/* use [self database] as path to database file */
- (BOOL) backendConnect
{
if (connected == NO)
{
if ([self database] != nil)
{
NSString *dbase = [self database];
sqlite3 *sql;
int result;
[[self class] purgeConnections: nil];
if ([self debugging] > 0)
{
[self debug: @"Connect to '%@' as %@",
[self database], [self name]];
}
result = sqlite3_open([dbase fileSystemRepresentation], &sql);
if (result != 0)
{
[self debug: @"Error connecting to '%@' (%@) - %s",
[self name], [self database], sqlite3_errmsg(sql)];
sqlite3_close(sql);
extra = 0;
}
else
{
connected = YES;
extra = sql;
if ([self debugging] > 0)
{
[self debug: @"Connected to '%@'", [self name]];
}
}
}
else
{
[self debug: @"Connect to '%@' with no database configured",
[self name]];
}
}
return connected;
}
- (void) backendDisconnect
{
if (connected == YES)
{
NS_DURING
{
if ([self isInTransaction] == YES)
{
[self rollback];
}
if ([self debugging] > 0)
{
[self debug: @"Disconnecting client %@", [self clientName]];
}
sqlite3_close((sqlite3 *)extra);
extra = 0;
if ([self debugging] > 0)
{
[self debug: @"Disconnected client %@", [self clientName]];
}
}
NS_HANDLER
{
extra = 0;
[self debug: @"Error disconnecting from database (%@): %@",
[self clientName], localException];
}
NS_ENDHANDLER
connected = NO;
}
}
- (NSInteger) backendExecute: (NSArray*)info
{
NSString *stmt;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
stmt = [info objectAtIndex: 0];
if ([stmt length] == 0)
{
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
NS_DURING
{
const char *statement;
unsigned length;
int result;
char *err;
/*
* Ensure we have a working connection.
*/
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to execute statement %@",
[self name], stmt];
}
statement = (char*)[stmt UTF8String];
length = strlen(statement);
statement = [self insertBLOBs: info
intoStatement: statement
length: length
withMarker: "'?'''?'"
length: 7
giving: &length];
result = sqlite3_exec((sqlite3 *)extra, statement, 0, 0, &err);
if (result != SQLITE_OK)
{
[NSException raise: SQLException format: @"%s", err];
}
}
NS_HANDLER
{
NSString *n = [localException name];
if ([n isEqual: SQLConnectionException] == YES)
{
[self disconnect];
}
if ([self debugging] > 0)
{
[self debug: @"Error executing statement:\n%@\n%@",
stmt, localException];
}
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
[arp release];
return -1;
}
- (NSMutableArray*) backendQuery: (NSString*)stmt
recordType: (id)rtype
listType: (id)ltype
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSMutableArray *records = [[ltype alloc] initWithCapacity: 2];
if ([stmt length] == 0)
{
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
NS_DURING
{
char *statement;
int result;
sqlite3_stmt *prepared;
const char *stmtEnd;
/*
* Ensure we have a working connection.
*/
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to run query %@",
[self name], stmt];
}
statement = (char*)[stmt UTF8String];
result = sqlite3_prepare((sqlite3 *)extra,
statement, strlen(statement), &prepared, &stmtEnd);
if (result != SQLITE_OK)
{
[NSException raise: SQLException
format: @"Unable to prepare '%@'", stmt];
}
if ((result = sqlite3_step(prepared)) == SQLITE_ROW)
{
int columns = sqlite3_column_count(prepared);
NSString *keys[columns];
int i;
for (i = 0; i < columns; i++)
{
keys[i] = [NSString stringWithUTF8String:
sqlite3_column_name(prepared, i)];
}
do
{
id values[columns];
SQLRecord *record;
for (i = 0; i < columns; i++)
{
int type = sqlite3_column_type(prepared, i);
switch (type)
{
case SQLITE_INTEGER:
values[i] = [NSNumber numberWithInt:
sqlite3_column_int(prepared, i)];
break;
case SQLITE_FLOAT:
values[i] = [NSNumber numberWithDouble:
sqlite3_column_double(prepared, i)];
break;
case SQLITE_TEXT:
values[i] = [NSString stringWithUTF8String:
(char *)sqlite3_column_text(prepared, i)];
break;
case SQLITE_BLOB:
values[i] = [NSData dataWithBytes:
sqlite3_column_blob(prepared, i)
length: sqlite3_column_bytes(prepared, i)];
break;
case SQLITE_NULL:
values[i] = nil;
break;
}
}
record = [rtype newWithValues: values
keys: keys
count: columns];
[records addObject: record];
[record release];
}
while ((result = sqlite3_step(prepared)) == SQLITE_ROW);
}
if (result != SQLITE_DONE)
{
[NSException raise: SQLException
format: @"%s", sqlite3_errmsg((sqlite3 *)extra)];
}
sqlite3_finalize(prepared);
}
NS_HANDLER
{
NSString *n = [localException name];
if ([n isEqual: SQLConnectionException] == YES)
{
[self disconnect];
}
if ([self debugging] > 0)
{
[self debug: @"Error executing statement:\n%@\n%@",
stmt, localException];
}
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
[arp release];
return [records autorelease];
}
static char hex[16] = "0123456789ABCDEF";
- (unsigned) copyEscapedBLOB: (NSData*)blob into: (void*)buf
{
const unsigned char *bytes = [blob bytes];
unsigned char *ptr = buf;
unsigned length = [blob length];
unsigned i;
*ptr++ = 'X';
*ptr++ = '\'';
for (i = 0; i < length; i++)
{
unsigned char c = bytes[i];
*ptr++ = hex[c / 16];
*ptr++ = hex[c % 16];;
}
*ptr++ = '\'';
return ((void*)ptr - buf);
}
- (unsigned) lengthOfEscapedBLOB: (NSData*)blob
{
/*
* A blob is X'xx' where xx is hexadecimal encoded binary data ...
* two hex digits per byte.
*/
return 3 + [blob length] * 2;
}
- (NSString*) quote: (id)obj
{
if ([obj isKindOfClass: [NSDate class]] == YES)
{
obj = [NSNumber numberWithDouble: [obj timeIntervalSinceReferenceDate]];
}
return [super quote: obj];
}
@end

View file

@ -1,530 +0,0 @@
/**
Copyright (C) 2004 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
Date: June 2004
This file is part of the SQLClient Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
<title>WebServer documentation</title>
<chapter>
<heading>The WebServer class</heading>
<section>
<heading>What is the WebServer class?</heading>
<p>
The WebServer class provides the framework for a GNUstep program to
act as an HTTP or HTTPS server for simple applications.<br />
It does not attempt to be a general-purpose web server, but is rather
intended to permit a program to easily handle requests from automated
systems which are intended to control, monitor, or use the services
provided by the program in which the class is embedded.<br />
The emphasis is on making it robust/reliable/simple, so you can rapidly
develop software using it. It is a single-threaded, single-process
system using asynchronous I/O, so you can easily run it under
debug in gdb to fix any bugs in your delegate object.<br />
In particular of course, it may be used in conjunction with the
[SQLClient] class to implement web-based database applications.
</p>
<p>
The class is controlled by a few straightforward settings and
basically operates by handing over requests to its delegate.
The delegate must at least implement the
[(WebServerDelegate)-processRequest:response:for:] method.
</p>
<p>
Built-in facilities include -
</p>
<list>
<item>Parsing of parameter string in request URL</item>
<item>Parsing of url encoded form data in a POST request</item>
<item>Parsing of form encoded data in a POST request</item>
<item>Substitution into template pages on output</item>
<item>SSL support</item>
<item>Limit access by IP address</item>
<item>Limit total number of simultaneous connections</item>
<item>Limit number of simultaneous connectionsform one address</item>
<item>Limit idle time permitted on a connection</item>
<item>Limit size of request headers permitted</item>
<item>Limit size of request body permitted</item>
</list>
</section>
</chapter>
$Date$ $Revision$
*/
#ifndef INCLUDED_WEBSERVER_H
#define INCLUDED_WEBSERVER_H
#include <Foundation/NSObject.h>
#include <Foundation/NSMapTable.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSFileHandle.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSSet.h>
#include <Foundation/NSTimer.h>
#include <GNUstepBase/GSMime.h>
@class WebServer;
/**
* This protocol is implemented by a delegate of a WebServer instance
* in order to allow the delegate to process requests which arrive
* at the server.
*/
@protocol WebServerDelegate
/**
* Process the http request whose headers and data are provided in
* a GSMimeDocument.<br />
* Extra headers are created as follows -
* <deflist>
* <term>x-http-method</term>
* <desc>The method from the HTTP request (eg. GET or POST)</desc>
* <term>x-http-path</term>
* <desc>The path from the HTTP request, or an empty string if
* there was no path.</desc>
* <term>x-http-query</term>
* <desc>The query string from the HTTP request or an empty string
* if there was no query.</desc>
* <term>x-http-version</term>
* <desc>The version from the HTTP request.</desc>
* <term>x-local-address</term>
* <desc>The IP address of the local host receiving the request.</desc>
* <term>x-local-port</term>
* <desc>The port of the local host receiving the request.</desc>
* <term>x-remote-address</term>
* <desc>The IP address of the host that the request came from.</desc>
* <term>x-remote-port</term>
* <desc>The port of the host that the request came from.</desc>
* <term>x-http-username</term>
* <desc>The username from the 'authorization' header if the request
* supplied http basic authentication.</desc>
* <term>x-http-password</term>
* <desc>The password from the 'authorization' header if the request
* supplied http basic authentication.</desc>
* </deflist>
* On completion, the method must modify response to contain the data
* and headers to be sent out.<br />
* The 'content-length' header need not be set in the response as it will
* be overridden anyway.<br />
* The special 'http' header will be used as the response/status line.
* If not supplied, 'HTTP/1.1 200 Success' or 'HTTP/1.1 204 No Content' will
* be used as the response line, depending on whether the data is empty or
* not.<br />
* If an exception is raised by this method, the response produced will
* be set to 'HTTP/1.0 500 Internal Server Error' and the connection will
* be closed.
*/
- (BOOL) processRequest: (GSMimeDocument*)request
response: (GSMimeDocument*)response
for: (WebServer*)http;
/**
* Log an error or warning ... if the delegate does not implement this
* method, the message is logged to stderr using the NSLog function.
*/
- (void) webAlert: (NSString*)message for: (WebServer*)http;
@end
/**
* <p>You create an instance of the WebServer class in order to handle
* incoming http or https requests on a single port.
* </p>
* <p>Before use, it must be configured using the -setPort:secure: method
* to specify the port and if/how ssl is to be used.
* </p>
* <p>You must also set a delegate to handle incoming requests,
* and may specify a maximum number of simultaneous connections
* which may be in progress etc.
* </p>
* <p>In addition to the options which may be set directly in the class,
* you can provide some configuration via the standard NSDefaults class.
* This information is set at initialisation of an instance and the
* class recognises the following defaults keys -
* </p>
* <deflist>
* <term>WebServerHosts</term>
* <desc>An array of host IP addresses to list the mhosts permitted to
* send requests to the server. If defined, requests from other hosts
* will be rejected. It's better to use firewalling to control this
* sort of thing.
* </desc>
* <term>WebServerQuiet</term>
* <desc>An array of host IP addresses to refrain from logging ...
* this is useful if (for instance) you have a monitoring process which
* sends requests to the server to be sure it's alive, and don't want
* to log all the connections from this monitor.<br />
* Not only do we refrain from logging anything but exceptional events
* about these hosts, connections and requests by these hosts are not
* counted in statistics we generate.
* </desc>
* </deflist>
*/
@interface WebServer : NSObject
{
@private
NSNotificationCenter *_nc;
NSString *_port;
BOOL _accepting;
BOOL _verbose;
NSDictionary *_sslConfig;
NSArray *_quiet;
NSArray *_hosts;
unsigned int _substitutionLimit;
unsigned int _maxBodySize;
unsigned int _maxRequestSize;
unsigned int _maxSessions;
unsigned int _maxPerHost;
id _delegate;
NSFileHandle *_listener;
NSMapTable *_sessions;
unsigned _handled;
unsigned _requests;
NSString *_root;
NSTimer *_ticker;
NSTimeInterval _sessionTimeout;
NSTimeInterval _ticked;
NSCountedSet *_perHost;
}
/**
* Decode an application/x-www-form-urlencoded form and store its
* contents into the supplied dictionary.<br />
* The resulting dictionary keys are strings.<br />
* The resulting dictionary values are arrays of NSData objects.<br />
* You probably don't need to call this method yourself ... more likely
* you will use the -parameters: method instead.<br />
* NB. For forms POSTed using <code>multipart/form-data</code> you don't
* need to perform any explicit decoding as this will already have been
* done for you and the decoded form will be presented as the request
* GSMimeDocument. The fields of the form will be the component parts
* of the content of the request and can be accessed using the standard
* GSMimeDocument methods.<br />
* This method returns the number of fields actually decoded.
*/
- (unsigned) decodeURLEncodedForm: (NSData*)data
into: (NSMutableDictionary*)dict;
/**
* Returns YES if the server is for HTTPS (encrypted connections),
* NO otherwise.
*/
- (BOOL) isSecure;
/**
* Extracts request parameters from the http query string and from the
* request body (if it was application/x-www-form-urlencoded or
* multipart/form-data) and return the extracted parameters as a
* mutable dictionary whose keys are the parameter names and whose
* values are arrays containing the data for each parameter.<br />
* You should call this no more than once per request, storing the result
* and using it as an argument to the methods used to extract particular
* parameters.<br />
* Parameters from the request data are <em>added</em> to any found in the
* query string.<br />
* Values provided as <code>multipart/form-data</code> are also available
* in a more flexible format as the content of the request.
*/
- (NSMutableDictionary*) parameters: (GSMimeDocument*)request;
/**
* Returns the index'th data parameter for the specified name.<br />
* Matching of names is case-insensitive<br />
* If there are no data items for the name, or if the index is
* too large for the number of items which exist, this returns nil.
*/
- (NSData*) parameter: (NSString*)name
at: (unsigned)index
from: (NSDictionary*)params;
/**
* Calls -parameter:at:from: with an index of zero.
*/
- (NSData*) parameter: (NSString*)name from: (NSDictionary*)params;
/**
* Calls -parameterString:at:from:charset: with a nil charset so that
* UTF-8 encoding is used for string conversion.
*/
- (NSString*) parameterString: (NSString*)name
at: (unsigned)index
from: (NSDictionary*)params;
/**
* Calls -parameter:at:from: and, if the result is non-nil
* converts the data to a string using the specified mime
* characterset, (if charset is nil, UTF-8 is used).
*/
- (NSString*) parameterString: (NSString*)name
at: (unsigned)index
from: (NSDictionary*)params
charset: (NSString*)charset;
/**
* Calls -parameterString:at:from:charset: with an index of zero and
* a nil value for charset (which causes data to be treated as UTF-8).
*/
- (NSString*) parameterString: (NSString*)name
from: (NSDictionary*)params;
/**
* Calls -parameterString:at:from:charset: with an index of zero.
*/
- (NSString*) parameterString: (NSString*)name
from: (NSDictionary*)params
charset: (NSString*)charset;
/**
* Loads a template file from disk and places it in aResponse as content
* whose mime type is determined from the file extension using the
* provided mapping (or a simple built-in default mapping if map is nil).<br />
* If you have a dedicated web server for handling static pages (eg images)
* it is better to use that rather than vending static pages using this
* method. It's unlikley that this method can be as efficient as a dedicated
* server. However this mechanism is adequate for moderate throughputs.
*/
- (BOOL) produceResponse: (GSMimeDocument*)aResponse
fromStaticPage: (NSString*)aPath
using: (NSDictionary*)map;
/**
* Loads a template file from disk and places it in aResponse as content
* of type 'text/html' with a charset of 'utf-8'.<br />
* The argument aPath is a path relative to the root path set using
* the -setRoot: method.<br />
* Substitutes values into the template from map using the
* -substituteFrom:using:into:depth: method.<br />
* Returns NO if them template could not be read or if any substitution
* failed. In this case no value is set in the response.<br />
* If the response is actually text of another type, or you want another
* characterset used, you can change the content type header in the
* request after you call this method.
*/
- (BOOL) produceResponse: (GSMimeDocument*)aResponse
fromTemplate: (NSString*)aPath
using: (NSDictionary*)map;
/**
* Sets the delegate object which processes requests for the receiver.
*/
- (void) setDelegate: (id)anObject;
/**
* Sets the maximum size of an uploaded request body.<br />
* The default is 4M bytes.<br />
*/
- (void) setMaxBodySize: (unsigned)max;
/**
* Sets the maximum size of an incoming request (including all headers,
* but not the body).<br />
* The default is 8K bytes.<br />
*/
- (void) setMaxRequestSize: (unsigned)max;
/**
* Sets the maximum number of simultaneous sessions with clients.<br />
* The default is 32.<br />
* A value of zero permits unlimited connections.
*/
- (void) setMaxSessions: (unsigned)max;
/**
* Sets the maximum number of simultaneous sessions with a particular
* remote host.<br />
* The default is 8.<br />
* A value of zero permits unlimited connections.
*/
- (void) setMaxSessionsPerHost: (unsigned)max;
/**
* Sets the port and security information for the receiver ... without
* this the receiver will not listen for incoming requests.<br />
* If secure is nil then the receiver listens on aPort for HTTP requests.<br />
* If secure is not nil, the receiver listens for HTTPS instead.<br />
* If secure is a dictionary containing <code>CertificateFile</code>,
* <code>KeyFile</code> and <code>Password</code> then the server will
* use the specified certificate and key files (which it will access
* using the password).<br />
* This method returns YES on success, NO on failure ... if it returns NO
* then the receiver will <em>not</em> be capable of handling incoming
* web requests!<br />
* Typically a failure will be due to an invalid port being specified ...
* a port may not already be in use and may not be in the range up to 1024
* (unless running as the super-user).
*/
- (BOOL) setPort: (NSString*)aPort secure: (NSDictionary*)secure;
/**
* Sets the maximum recursion depth allowed for subsititutions into
* templates. This defaults to 4.
*/
- (void) setSubstitutionLimit: (unsigned)depth;
/**
* Set root path for loading template files from.<br />
* Templates may only be loaded from within this directory.
*/
- (void) setRoot: (NSString*)aPath;
/**
* Sets the time after which an idle session should be shut down.<br />
* Default is 30.0
*/
- (void) setSessionTimeout: (NSTimeInterval)aDelay;
/**
* Sets a flag to determine whether verbose logging is to be performed.<br />
* If this is YES then all incming requests and their responses will
* be logged using the NSLog function. This is useful for debugging
* and where a full audit trail is required.
*/
- (void) setVerbose: (BOOL)aFlag;
/**
* Perform substituations replacing the markup in aTemplate with the
* values supplied by map and appending the results to the result.<br />
* Substitutions are recursive, and the depth argument is used to
* specify the current recursion depth (you should normally call this
* method with a depth of zero at the start of processing a template).<br />
* Any value inside SGML comment delimiters ('&lt;!--' and '--&gt;') is
* treated as a possible key in map and the entire comment is replaced
* by the corresponding map value (unless it is nil). Recursive substitution
* is done unless the mapped value <em>starts</em> with an SGML comment.<br />
* While the map is nominally a dictionary, in fact it may be any
* object which responds to the objectForKey: method by returning
* an NSString or nil.<br />
* The method returns YES on success, NO on failure (depth too great).<br />
* You don't normally need to use this method directly ... call the
* -produceResponse:fromTemplate:using: method instead.
*/
- (BOOL) substituteFrom: (NSString*)aTemplate
using: (NSDictionary*)map
into: (NSMutableString*)result
depth: (unsigned)depth;
@end
/**
* WebServerBundles is an example delegate for the WebServer class.<br />
* This is intended to act as a convenience for a scheme where the
* WebServer instance in a program is configured by values obtained
* from the user defaults system, and incoming requests may be handled
* by different delegate objects depending on the path information
* supplied in the request. The WebServerBundles intance is responsible
* for loading the bundles (based on information in the WebServerBundles
* dictionary in the user defaults system) and for forwarding requests
* to the appropriate bundles for processing.<br />
* If a request comes in which is not an exact match for the path of any
* handler, the request path is repeatedly shortened by chopping off the
* last path component until a matching handler is found.<br />
* The paths in the dictionary must <em>not</em> end with a slash...
* an empty string will match all requests which do not match a handler
* with a longer path.
* <example>
* </example>
*/
@interface WebServerBundles : NSObject <WebServerDelegate>
{
NSMutableDictionary *_handlers;
WebServer *_http;
}
/**
* Handle a notification that the defaults have been updated ... change
* WebServer configuration if necessary.<br />
* <list>
* <item>
* WebServerPort must be used to specify the port that the server
* listens on. See [WebServer-setPort:secure:] for details.
* </item>
* <item>
* WebServerSecure may be supplied to make the server operate as an
* HTTPS server rather than an HTTP server.
* See [WebServer-setPort:secure:] for details.
* </item>
* <item>
* WebServerBundles is a dictionary keyed on path strings, whose
* values are dictionaries, each containing per-handler configuration
* information and the name of the bundle containing the code to handle
* requests sent to the path. NB. the bundle name listed should
* omit the <code>.bundle</code> extension.
* </item>
* </list>
* Returns YES on success, NO on failure (if the port of the WebServer
* cannot be set).
*/
- (BOOL) defaultsUpdate: (NSNotification *)aNotification;
/**
* Returns the handler to be used for the specified path, or nil if there
* is no handler available.<br />
* If the info argument is non-null, it is used to return additional
* information, either the path actually matched, or an error string.
*/
- (id) handlerForPath: (NSString*)path info: (NSString**)info;
/**
* Return dictionary of all handlers by name (path in request which maps
* to that handler instance).
*/
- (NSMutableDictionary*) handlers;
/**
* Return the WebServer instance that the receiver is acting as a
* delegate for.
*/
- (WebServer*) http;
/** <init />
* Initialises the receiver as the delegate of http and configures
* the WebServer based upon the settings found in the user defaults
* system by using the -defaultsUpdate: method.
*/
- (id) initAsDelegateOf: (WebServer*)http;
/**
* Handles an incoming request by forwarding it to another handler.<br />
* If a direct mapping is available from the path in the request to
* an existing handler, that handler is used to process the request.
* Otherwise, the WebServerBundles dictionary (obtained from the
* defaults system) is used to map the request path to configuration
* information listing the bundle containing the handler to be used.<br />
* The configuration information is a dictionary containing the name
* of the bundle (keyed on 'Name'), and this is used to locate the
* bundle in the applications resources.<br />
* Before a request is passed on to a handler, two extra headers are set
* in it ... <code>x-http-path-base</code> and <code>x-http-path-info</code>
* being the actual path matched for the handler, and the remainder of the
* path after that base part.
*/
- (BOOL) processRequest: (GSMimeDocument*)request
response: (GSMimeDocument*)response
for: (WebServer*)http;
/**
* Registers an object as the handler for a particular path.<br />
* Registering a nil handler destroys any existing handler for the path.
*/
- (void) registerHandler: (id)handler forPath: (NSString*)path;
/**
* Just write to stderr using NSLog.
*/
- (void) webAlert: (NSString*)message for: (WebServer*)http;
@end
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,248 +0,0 @@
/**
Copyright (C) 2004 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
Date: June 2004
This file is part of the SQLClient Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$Date$ $Revision$
*/
#include <Foundation/Foundation.h>
#include "WebServer.h"
@implementation WebServerBundles
- (void) dealloc
{
RELEASE(_http);
RELEASE(_handlers);
[super dealloc];
}
- (BOOL) defaultsUpdate: (NSNotification *)aNotification
{
NSUserDefaults *defs = [aNotification object];
NSString *port;
NSDictionary *secure;
port = [defs stringForKey: @"WebServerPort"];
if ([port length] == 0)
{
return NO; // Can't make web server active.
}
secure = [defs dictionaryForKey: @"WebServerSecure"];
return [_http setPort: port secure: secure];
}
- (id) handlerForPath: (NSString*)path info: (NSString**)info
{
NSString *error = nil;
NSMutableDictionary *handlers;
id handler;
if (info != 0)
{
*info = path;
}
handlers = [self handlers];
handler = [handlers objectForKey: path];
if (handler == nil)
{
NSUserDefaults *defs;
NSDictionary *conf;
NSDictionary *byPath;
defs = [NSUserDefaults standardUserDefaults];
conf = [defs dictionaryForKey: @"WebServerBundles"];
byPath = [conf objectForKey: path];
if ([byPath isKindOfClass: [NSDictionary class]] == NO)
{
NSRange r;
r = [path rangeOfString: @"/" options: NSBackwardsSearch];
if (r.length > 0)
{
path = [path substringToIndex: r.location];
handler = [self handlerForPath: path info: info];
}
else
{
error = [NSString stringWithFormat:
@"Unable to find handler in Bundles config for '%@'", path];
}
}
else
{
NSString *name;
name = [byPath objectForKey: @"Name"];
if ([name length] == 0)
{
error = [NSString stringWithFormat:
@"Unable to find Name in Bundles config for '%@'", path];
}
else
{
NSBundle *mb = [NSBundle mainBundle];
NSString *p = [mb pathForResource: name ofType: @"bundle"];
NSBundle *b = [NSBundle bundleWithPath: p];
Class c = [b principalClass];
if (c == 0)
{
error = [NSString stringWithFormat:
@"Unable to find class in '%@' for '%@'", p, path];
}
else
{
handler = [c new];
[self registerHandler: handler forPath: path];
RELEASE(handler);
}
}
}
}
if (handler == nil && info != 0)
{
*info = error;
}
return handler;
}
- (NSMutableDictionary*) handlers
{
if (_handlers == nil)
{
_handlers = [NSMutableDictionary new];
}
return _handlers;
}
- (WebServer*) http
{
return _http;
}
- (id) init
{
return [self initAsDelegateOf: nil];
}
- (id) initAsDelegateOf: (WebServer*)http
{
if (http == nil)
{
DESTROY(self);
}
else
{
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSNotification *n;
ASSIGN(_http, http);
[_http setDelegate: self];
/*
* Watch for config changes, and set initial config by sending a
* faked change notification.
*/
[nc addObserver: self
selector: @selector(defaultsUpdate:)
name: NSUserDefaultsDidChangeNotification
object: defs];
n = [NSNotification
notificationWithName: NSUserDefaultsDidChangeNotification
object: defs
userInfo: nil];
if ([self defaultsUpdate: n] == NO)
{
DESTROY(self);
}
}
return self;
}
/**
* We handle the incoming requests here.
*/
- (BOOL) processRequest: (GSMimeDocument*)request
response: (GSMimeDocument*)response
for: (WebServer*)http
{
NSString *path;
NSString *info;
id handler;
path = [[request headerNamed: @"x-http-path"] value];
handler = [self handlerForPath: path info: &info];
if (handler == nil)
{
NSString *error = @"bad path";
/*
* Log the error message.
*/
[self webAlert: info for: (WebServer*)http];
/*
* Return status code 400 (Bad Request) with the informative error
*/
error = [NSString stringWithFormat: @"HTTP/1.0 400 %@", error];
[response setHeader: @"http" value: error parameters: nil];
return YES;
}
else
{
NSString *extra = [path substringFromIndex: [info length]];
/*
* Provide extra information about the exact path used to match
* the handler, and any remaining path information beyond it.
*/
[request setHeader: @"x-http-path-base"
value: info
parameters: nil];
[request setHeader: @"x-http-path-info"
value: extra
parameters: nil];
return [handler processRequest: request
response: response
for: http];
}
}
- (void) registerHandler: (id)handler forPath: (NSString*)path
{
if (handler == nil)
{
[[self handlers] removeObjectForKey: path];
}
else
{
[[self handlers] setObject: handler forKey: path];
}
}
- (void) webAlert: (NSString*)message for: (WebServer*)http
{
NSLog(@"%@", message);
}
@end

1326
config.guess vendored

File diff suppressed because it is too large Load diff

View file

@ -1,13 +1,117 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <ecpglib.h> header file. */
#undef HAVE_ECPGLIB_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <jni.h> header file. */
#undef HAVE_JNI_H
/* Define to 1 if you have the `ecpg' library (-lecpg). */
#undef HAVE_LIBECPG
/* Define to 1 if you have the `jvm' library (-ljvm). */
#undef HAVE_LIBJVM
/* Define to 1 if you have the `mysqlclient' library (-lmysqlclient). */
#undef HAVE_LIBMYSQLCLIENT
/* Define to 1 if you have the `pq' library (-lpq). */
#undef HAVE_LIBPQ
/* Define to 1 if you have the <libpq-fe.h> header file. */
#undef HAVE_LIBPQ_FE_H
/* Define to 1 if you have the `sqlite3' library (-lsqlite3). */
#undef HAVE_LIBSQLITE3
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <mysql/mysql.h> header file. */
#undef HAVE_MYSQL_MYSQL_H
/* Define to 1 if you have the `PQescapeStringConn' function. */
#undef HAVE_PQESCAPESTRINGCONN
/* Define to 1 if you have the <sqlite3.h> header file. */
#undef HAVE_SQLITE3_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the </usr/include/pgsql/ecpglib.h> header file. */
#undef HAVE__USR_INCLUDE_PGSQL_ECPGLIB_H
/* Define to 1 if you have the </usr/include/pgsql/libpq-fe.h> header file. */
#undef HAVE__USR_INCLUDE_PGSQL_LIBPQ_FE_H
/* Define to 1 if you have the </usr/include/postgresql/8.0/ecpglib.h> header
file. */
#undef HAVE__USR_INCLUDE_POSTGRESQL_8_0_ECPGLIB_H
/* Define to 1 if you have the </usr/include/postgresql/8.0/libpq-fe.h> header
file. */
#undef HAVE__USR_INCLUDE_POSTGRESQL_8_0_LIBPQ_FE_H
/* Define to 1 if you have the </usr/include/postgresql/ecpglib.h> header
file. */
#undef HAVE__USR_INCLUDE_POSTGRESQL_ECPGLIB_H
/* Define to 1 if you have the </usr/include/postgresql/libpq-fe.h> header
file. */
#undef HAVE__USR_INCLUDE_POSTGRESQL_LIBPQ_FE_H
/* Define to 1 if you have the </usr/local/include/pgsql/ecpglib.h> header
file. */
#undef HAVE__USR_LOCAL_INCLUDE_PGSQL_ECPGLIB_H
/* Define to 1 if you have the </usr/local/include/pgsql/libpq-fe.h> header
file. */
#undef HAVE__USR_LOCAL_INCLUDE_PGSQL_LIBPQ_FE_H
/* Define to 1 if you have the </usr/local/pgsql/include/ecpglib.h> header
file. */
#undef HAVE__USR_LOCAL_PGSQL_INCLUDE_ECPGLIB_H
/* Define to 1 if you have the </usr/local/pgsql/include/libpq-fe.h> header
file. */
#undef HAVE__USR_LOCAL_PGSQL_INCLUDE_LIBPQ_FE_H
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

View file

@ -1,6 +1,10 @@
ECPG=@ECPG@
JDBC=@JDBC@
JDBC_VM_LIBS=@JDBC_VM_LIBS@
JDBC_VM_LIBDIRS=@JDBC_VM_LIBDIRS@
MYSQL=@MYSQL@
SQLITE=@SQLITE@
ORACLE_HOME=@ORACLE_HOME@
POSTGRES=@POSTGRES@

1451
config.sub vendored

File diff suppressed because it is too large Load diff

7663
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -3,157 +3,499 @@ dnl Process this file with autoconf to produce configure.
AC_INIT(SQLClient.h)
AC_CONFIG_HEADER(config.h)
AC_ARG_WITH(additional-include-dir,
[ --with-additional-include-dir=PATH specify additional include dirs to use],
additional_include_dir="$withval", additional_include_dir="no")
if test "$additional_include_dir" != "no"; then
CPPFLAGS="$CPPFLAGS $additional_include_dir"
INCD="$INCD $additional_include_dir"
if test -z "$GNUSTEP_MAKEFILES"; then
GNUSTEP_MAKEFILES=`gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null`
export GNUSTEP_MAKEFILES
fi
echo "Postgres development support"
AC_ARG_WITH(postgres-dir,
[ --with-postgres-dir=PATH specify postgres installation dir],
if test -z "$GNUSTEP_MAKEFILES"; then
AC_MSG_ERROR([You must have the gnustep-make package installed and set up the GNUSTEP_MAKEFILES environment variable to contain the path to the makefiles directory before configuring!])
else
. $GNUSTEP_MAKEFILES/GNUstep.sh
fi
if test "x$GNUSTEP_HOST_OS" = "x"; then
GNUSTEP_HOST_OS=`gnustep-config --variable=GNUSTEP_HOST_OS`
GNUSTEP_HOST_CPU=`gnustep-config --variable=GNUSTEP_HOST_CPU`
fi
#--------------------------------------------------------------------
AC_ARG_WITH(additional-include, [
--with-additional-include=flags
Specifies additional include compiler flags to use.
If configure can not find your database library headers,
you may want to use this flag to help it find them. For
example:
--with-additional-include=-I/usr/local/include
],
additional_include="$withval", additional_include="no")
if test "$additional_include" != "no"; then
CPPFLAGS="$CPPFLAGS $additional_include"
INCD="$INCD $additional_include"
fi
AC_ARG_WITH(additional-lib, [
--with-additional-lib=flags
Specifies additional library compiler flags to use.
If configure can not find your database libraries,
you may want to use this flag to help it find them. For
example:
--with-additional-lib=-L/usr/local/lib/mysql
],
additional_lib="$withval", additional_lib="no")
if test "$additional_lib" != "no"; then
LDFLAGS="$LDFLAGS $additional_lib"
LIBD="$LIBD $additional_lib"
fi
AC_ARG_WITH(postgres-dir, [
--with-postgres-dir=PATH
Specifies the postgres installation dir; configure
will add the appropriate additional include and lib
flags. Useful when you installed postgres in some
unusual place and want to help configure find it. For
example:
--with-postgres-dir=/usr/local/pgsql
(which is equivalent to
--with-additional-include=-L/usr/local/pgsql/include
--with-additional-lib=-L/usr/local/pgsql/lib)
],
postgres_topdir="$withval", postgres_topdir="no")
if test "$postgres_topdir" != "no"; then
CPPFLAGS="$CPPFLAGS -I$postgres_topdir/include -L$postgres_topdir/lib"
INCD="$INCD -I$postgres_topdir/include"
LIBD="$LIBD -L$postgres_topdir/lib"
else
PGINC=`pg_config --includedir`
if test "$PGINC" != ""; then
CPPFLAGS="$CPPFLAGS -I$PGINC"
INCD="$INCD -I$PGINC"
fi
PGLIB=`pg_config --libdir`
if test "$PGLIB" != ""; then
CPPFLAGS="$CPPFLAGS -L$PGLIB"
LIBD="$LIBD -I$PGLIB"
fi
fi
AC_CHECK_HEADERS(mysql/mysql.h)
if test "$ac_cv_header_mysql_mysql_h" = "yes"; then
MYSQL=yes
# Call AC_CHECK_HEADERS here as a workaround for a configure bug/feature
# which messes up all subsequent tests if the first occurrence in the
# file does not get called ... as would otherwise be the case if jdbc
# support is disabled.
AC_CHECK_HEADERS(stdio.h)
AC_MSG_CHECKING([if Jdbc support was manually disabled])
AC_ARG_ENABLE(jdbc-bundle, [
--disable-jdbc-bundle
Disable creating the Jdbc bundle.
Use this option to force the Jdbc bundle not to be built
even if the Jdbc libraries look like being present.
],
ac_cv_jdbc_bundle=$enableval,
ac_cv_jdbc_bundle="yes")
if test "$ac_cv_jdbc_bundle" = "no"; then
AC_MSG_RESULT([yes: disabled from the command-line])
else
MYSQL=
echo "*********************************************************"
echo "Unable to locate mysqlclient headers (are they installed)"
echo "*********************************************************"
AC_MSG_RESULT([no: build if possible])
# Get likely subdirectory for system specific java include
case "$GNUSTEP_HOST_OS" in
bsdi*) _JNI_SUBDIR="bsdos";;
linux*) _JNI_SUBDIR="linux";;
osf*) _JNI_SUBDIR="alpha";;
solaris*) _JNI_SUBDIR="solaris";;
mingw*) _JNI_SUBDIR="win32";;
cygwin*) _JNI_SUBDIR="win32";;
*) _JNI_SUBDIR="genunix";;
esac
AC_ARG_WITH(jre-architecture, [
--with-jre-architecture=value
Specifies the CPU architecture to use for the JRE
(only used when building the JDBC module). Example
values are i386, amd64 and sparc.
],
jre_architecture="$withval", jre_architecture="")
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$JAVA_HOME/include -I$JAVA_HOME/include/$_JNI_SUBDIR"
AC_CHECK_HEADERS(jni.h)
if test "$ac_cv_header_jni_h" = "yes"; then
JDBC_VM_LIBS="-ljvm"
jre_lib="$JAVA_HOME/jre/lib"
if test "$jre_architecture" = ""; then
# If on a 32/64bit system and compiling for the 64bit model
# adjust the cpu type to be the 64bit version
case "$CFLAGS" in
*-m64*)
if test "$GNUSTEP_HOST_CPU" = "ix86"; then
_CPU="x86_64"
else
_CPU="$GNUSTEP_HOST_CPU"
fi;;
*) _CPU="$GNUSTEP_HOST_CPU";;
esac
case "$_CPU" in
ix86) JAVA_CPU=i386;;
x86_64) JAVA_CPU=amd64;;
sparc) JAVA_CPU=sparc;;
*) JAVA_CPU=i386;;
esac
else
JAVA_CPU="$jre_architecture"
fi
jre_cpu="$jre_lib/$JAVA_CPU"
JDBC_VM_LIBDIRS="-L$jre_cpu/server"
CFLAGS="$CFLAGS $JDBC_VM_LIBDIRS"
AC_CHECK_LIB(jvm,JNI_CreateJavaVM)
if test "$ac_cv_lib_jvm_JNI_CreateJavaVM" = "yes"; then
INCD="$INCD -I$JAVA_HOME/include -I$JAVA_HOME/include/$_JNI_SUBDIR"
JDBC=yes
else
JDBC=
JDBC_VM_LIBS=
JDBC_VM_LIBDIRS=
echo "**********************************************"
echo "Unable to locate jvm library (is it installed)"
echo "**********************************************"
fi
else
JDBC=
JDBC_VM_LIBS=
JDBC_VM_LIBDIRS=
echo "*********************************************"
echo "Unable to locate jni header (is it installed)"
echo "*********************************************"
fi
if test "$MYSQL" = "yes"; then
AC_CHECK_LIB(mysqlclient,mysql_init)
if test "$ac_cv_lib_mysqlclient_mysql_init" != "yes"; then
AC_SUBST(JDBC)
AC_SUBST(JDBC_VM_LIBS)
AC_SUBST(JDBC_VM_LIBDIRS)
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
CPPFLAGS="$save_CPPFLAGS"
fi
AC_MSG_CHECKING([if Mysql support was manually disabled])
AC_ARG_ENABLE(mysql-bundle, [
--disable-mysql-bundle
Disable creating the Mysql bundle.
Use this option to force the Mysql bundle not to be built
even if the Mysql libraries look like being present.
],
ac_cv_mysql_bundle=$enableval,
ac_cv_mysql_bundle="yes")
if test "$ac_cv_mysql_bundle" = "no"; then
AC_MSG_RESULT([yes: disabled from the command-line])
MYSQL=
else
AC_MSG_RESULT([no: build if possible])
AC_CHECK_HEADERS(mysql/mysql.h)
if test "$ac_cv_header_mysql_mysql_h" = "yes"; then
MYSQL=yes
else
MYSQL=
echo "******************************************************"
echo "Unable to locate mysqlclient library (is it installed)"
echo "******************************************************"
echo "*********************************************************"
echo "Unable to locate mysqlclient headers (are they installed)"
echo "*********************************************************"
fi
if test "$MYSQL" = "yes"; then
if test -d /usr/lib/mysql ; then
CPPFLAGS="$CPPFLAGS -L/usr/lib/mysql"
LIBD="$LIBD -L/usr/lib/mysql"
else
if test -d /usr/local/lib/mysql ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/lib/mysql"
LIBD="$LIBD -L/usr/local/lib/mysql"
else
if test -d /usr/local/mysql/lib ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/mysql/lib"
LIBD="$LIBD -L/usr/local/mysql/lib"
fi
fi
fi
AC_CHECK_LIB(mysqlclient,mysql_init)
if test "$ac_cv_lib_mysqlclient_mysql_init" != "yes"; then
MYSQL=
echo "******************************************************"
echo "Unable to locate mysqlclient library (is it installed)"
echo "******************************************************"
fi
fi
fi
AC_SUBST(MYSQL)
AC_CHECK_HEADERS(libpq-fe.h)
if test "$ac_cv_header_libpq_fe_h" = "yes"; then
POSTGRES=yes
AC_MSG_CHECKING([if Sqllite support was manually disabled])
AC_ARG_ENABLE(sqllite-bundle, [
--disable-sqllite-bundle
Disable creating the Sqllite bundle.
Use this option to force the Sqllite bundle not to be built
even if the Sqllite libraries look like being present.
],
ac_cv_sqllite_bundle=$enableval,
ac_cv_sqllite_bundle="yes")
if test "$ac_cv_sqllite_bundle" = "no"; then
AC_MSG_RESULT([yes: disabled from the command-line])
SQLLITE=
else
old="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I/usr/include/postgresql"
AC_CHECK_HEADERS(/usr/include/postgresql/libpq-fe.h)
CPPFLAGS="$old"
if test "$ac_cv_header__usr_include_postgresql_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/include/postgresql"
POSTGRES=yes
AC_MSG_RESULT([no: build if possible])
AC_CHECK_HEADERS(sqlite3.h)
if test "$ac_cv_header_sqlite3_h" = "yes"; then
SQLITE=yes
else
CPPFLAGS="$CPPFLAGS -I/usr/include/pgsql"
SQLITE=
echo "*****************************************************"
echo "Unable to locate sqlite3 headers (are they installed)"
echo "*****************************************************"
fi
if test "$SQLITE" = "yes"; then
AC_CHECK_LIB(sqlite3,sqlite3_open)
if test "$ac_cv_lib_sqlite3_sqlite3_open" != "yes"; then
SQLITE=
echo "******************************************************"
echo "Unable to locate sqlite3 library (is it installed)"
echo "******************************************************"
fi
fi
fi
AC_SUBST(SQLITE)
AC_MSG_CHECKING([if Postgres support was manually disabled])
AC_ARG_ENABLE(postgres-bundle, [
--disable-postgres-bundle
Disable creating the Postgres bundle.
Use this option to force the Postgres bundle not to be built
even if the Postgres libraries look like being present.
],
ac_cv_postgres_bundle=$enableval,
ac_cv_postgres_bundle="yes")
if test "$ac_cv_postgres_bundle" = "no"; then
AC_MSG_RESULT([yes: disabled from the command-line])
POSTGRES=
else
AC_MSG_RESULT([no: build if possible])
# Start POSTGRES checks
POSTGRES=
if test "$POSTGRES" = ""; then
AC_CHECK_HEADERS(libpq-fe.h)
if test "$ac_cv_header_libpq_fe_h" = "yes"; then
POSTGRES=yes
fi
fi
if test "$POSTGRES" = ""; then
AC_CHECK_HEADERS(/usr/include/postgresql/libpq-fe.h)
CPPFLAGS="$save_CPPFLAGS"
if test "$ac_cv_header__usr_include_postgresql_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/include/postgresql"
POSTGRES=yes
fi
fi
if test "$POSTGRES" = ""; then
AC_CHECK_HEADERS(/usr/include/postgresql/8.0/libpq-fe.h)
CPPFLAGS="$save_CPPFLAGS"
if test "$ac_cv_header__usr_include_postgresql_8_0_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/include/postgresql/8.0"
POSTGRES=yes
fi
fi
if test "$POSTGRES" = ""; then
AC_CHECK_HEADERS(/usr/include/pgsql/libpq-fe.h)
CPPFLAGS="$old"
CPPFLAGS="$save_CPPFLAGS"
if test "$ac_cv_header__usr_include_pgsql_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/include/pgsql"
POSTGRES=yes
else
CPPFLAGS="$CPPFLAGS -I/usr/local/include/pgsql"
AC_CHECK_HEADERS(/usr/local/include/pgsql/libpq-fe.h)
CPPFLAGS="$old"
if test "$ac_cv_header__usr_local_include_pgsql_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/local/include/pgsql"
POSTGRES=yes
else
CPPFLAGS="$save_CPPFLAGS"
POSTGRES=
echo "**************************************************************"
echo "Unable to locate libpq (postgres) headers (are they installed)"
echo "**************************************************************"
fi
fi
fi
fi
AC_CHECK_HEADERS(ecpglib.h)
if test "$ac_cv_header_ecpglib_h" = "yes"; then
ECPG=yes
else
old="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I/usr/include/postgresql"
AC_CHECK_HEADERS(/usr/include/postgresql/ecpglib.h)
CPPFLAGS="$old"
if test "$ac_cv_header__usr_include_postgresql_ecpglib_h" = "yes"; then
INCD="$INCD -I/usr/include/postgresql"
ECPG=yes
else
CPPFLAGS="$CPPFLAGS -I/usr/include/pgsql"
AC_CHECK_HEADERS(/usr/include/pgsql/ecpglib.h)
CPPFLAGS="$old"
if test "$ac_cv_header__usr_include_pgsql_ecpglib_h" = "yes"; then
INCD="$INCD -I/usr/include/pgsql"
ECPG=yes
if test "$POSTGRES" = ""; then
AC_CHECK_HEADERS(/usr/local/include/pgsql/libpq-fe.h)
CPPFLAGS="$save_CPPFLAGS"
if test "$ac_cv_header__usr_local_include_pgsql_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/local/include/pgsql"
POSTGRES=yes
fi
fi
if test "$POSTGRES" = ""; then
AC_CHECK_HEADERS(/usr/local/pgsql/include/libpq-fe.h)
CPPFLAGS="$save_CPPFLAGS"
if test "$ac_cv_header__usr_local_pgsql_include_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/local/pgsql/include"
POSTGRES=yes
fi
fi
if test "$POSTGRES" = ""; then
echo "**************************************************************"
echo "Unable to locate libpq (postgres) headers (are they installed)"
echo "**************************************************************"
fi
if test "$POSTGRES" = "yes"; then
# NICOLA - hack
if test -d /usr/lib/pgsql ; then
CPPFLAGS="$CPPFLAGS -L/usr/lib/pgsql"
LIBD="$LIBD -L/usr/lib/pgsql"
else
CPPFLAGS="$CPPFLAGS -I/usr/local/include/pgsql"
AC_CHECK_HEADERS(/usr/local/include/pgsql/ecpglib.h)
CPPFLAGS="$old"
if test "$ac_cv_header__usr_local_include_pgsql_ecpglib_h" = "yes"; then
INCD="$INCD -I/usr/local/include/pgsql"
ECPG=yes
if test -d /usr/local/lib/pgsql ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/lib/pgsql"
LIBD="$LIBD -L/usr/local/lib/pgsql"
else
CPPFLAGS="$save_CPPFLAGS"
ECPG=
echo "*************************************************************"
echo "Unable to locate ecpg (postgres) headers (are they installed)"
echo "*************************************************************"
if test -d /usr/local/pgsql/lib ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/pgsql/lib"
LIBD="$LIBD -L/usr/local/pgsql/lib"
fi
fi
fi
fi
fi
if test "$POSTGRES" = "yes"; then
# NICOLA - hack
if test -d /usr/lib/pgsql ; then
CPPFLAGS="$CPPFLAGS -L/usr/lib/pgsql"
LIBD="$LIBD -L/usr/lib/pgsql"
else
if test -d /usr/local/lib/pgsql ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/lib/pgsql"
LIBD="$LIBD -L/usr/local/lib/pgsql"
fi
fi
AC_CHECK_LIB(pq,PQfformat)
if test "$ac_cv_lib_pq_PQfformat" != "yes"; then
AC_CHECK_LIB(pq,PQfformat)
if test "$ac_cv_lib_pq_PQfformat" != "yes"; then
POSTGRES=
AC_CHECK_LIB(pq,PQclear)
echo "******************************************************"
if test "$ac_cv_lib_pq_PQclear" != "yes"; then
echo "Unable to locate postgres pq library (is it installed)"
echo "Unable to locate postgres pq library (is it installed)"
else
echo "Located postgres pq library, but it is too old to use!"
echo "Located postgres pq library, but it is too old to use!"
fi
echo "Perhaps you can try 'configure --with-postgres=dir=path'"
echo "to point to the postgres version you wish to use."
echo "******************************************************"
else
AC_CHECK_FUNCS(PQescapeStringConn)
fi
fi
AC_CHECK_LIB(ecpg,ECPGconnect)
if test "$ac_cv_lib_ecpg_ECPGconnect" != "yes"; then
ECPG=
echo "********************************************************"
echo "Unable to locate postgres ecpg library (is it installed)"
echo "Perhaps you can try 'configure --with-postgres=dir=path'"
echo "to point to the postgres version you wish to use."
echo "********************************************************"
fi
# End POSTGRES checks
fi
AC_SUBST(POSTGRES)
AC_MSG_CHECKING([if ECPG (Old Postgres) support was manually disabled])
AC_ARG_ENABLE(ecpg-bundle, [
--disable-ecpg-bundle
Disable creating the ECPG bundle.
Use this option to force the ECPG bundle not to be built
even if the Postgres libraries look like being present.
],
ac_cv_ecpg_bundle=$enableval,
ac_cv_ecpg_bundle="yes")
if test "$ac_cv_ecpg_bundle" = "no"; then
AC_MSG_RESULT([yes: disabled from the command-line])
ECPG=
else
AC_MSG_RESULT([no: build if possible])
# Start ECPG checks
ECPG=
if test "$ECPG" = ""; then
AC_CHECK_HEADERS(ecpglib.h)
if test "$ac_cv_header_ecpglib_h" = "yes"; then
ECPG=yes
fi
fi
if test "$ECPG" = ""; then
AC_CHECK_HEADERS(/usr/include/postgresql/ecpglib.h)
if test "$ac_cv_header__usr_include_postgresql_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/include/postgresql"
ECPG=yes
fi
fi
if test "$ECPG" = ""; then
AC_CHECK_HEADERS(/usr/include/postgresql/8.0/ecpglib.h)
if test "$ac_cv_header__usr_include_postgresql_8_0_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/include/postgresql/8.0"
ECPG=yes
fi
fi
if test "$ECPG" = ""; then
AC_CHECK_HEADERS(/usr/include/pgsql/ecpglib.h)
if test "$ac_cv_header__usr_include_pgsql_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/include/pgsql"
ECPG=yes
fi
fi
if test "$ECPG" = ""; then
AC_CHECK_HEADERS(/usr/local/include/pgsql/ecpglib.h)
if test "$ac_cv_header__usr_local_include_pgsql_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/local/include/pgsql"
ECPG=yes
fi
fi
if test "$ECPG" = ""; then
AC_CHECK_HEADERS(/usr/local/pgsql/include/ecpglib.h)
if test "$ac_cv_header__usr_local_pgsql_include_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/local/pgsql/include"
ECPG=yes
fi
fi
if test "$ECPG" = ""; then
echo "*************************************************************"
echo "Unable to locate ecpg (postgres) headers (are they installed)"
echo "*************************************************************"
fi
if test "$ECPG" = "yes"; then
# NICOLA - hack
if test -d /usr/lib/pgsql ; then
CPPFLAGS="$CPPFLAGS -L/usr/lib/pgsql"
LIBD="$LIBD -L/usr/lib/pgsql"
else
if test -d /usr/local/lib/pgsql ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/lib/pgsql"
LIBD="$LIBD -L/usr/local/lib/pgsql"
else
if test -d /usr/local/pgsql/lib ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/pgsql/lib"
LIBD="$LIBD -L/usr/local/pgsql/lib"
fi
fi
fi
AC_CHECK_LIB(pq,PQfformat)
AC_CHECK_LIB(ecpg,ECPGconnect)
if test "$ac_cv_lib_ecpg_ECPGconnect" != "yes"; then
ECPG=
echo "********************************************************"
echo "Unable to locate postgres ecpg library (is it installed)"
echo "Perhaps you can try 'configure --with-postgres=dir=path'"
echo "to point to the postgres version you wish to use."
echo "********************************************************"
fi
fi
# End ECPG checks
fi
AC_SUBST(ECPG)
ORACLE_HOME=
AC_SUBST(ORACLE_HOME)
@ -161,6 +503,13 @@ AC_SUBST(INCD)
AC_SUBST(LIBD)
AC_SUBST(LIBS)
if test "$JDBC" = "yes"; then
BUNDLE="The JDBC backend bundle will be built"
else
BUNDLE="The JDBC backend bundle will NOT be built"
fi
AC_MSG_RESULT(${BUNDLE})
if test "$MYSQL" = "yes"; then
BUNDLE="The MySQL backend bundle will be built"
else
@ -168,6 +517,13 @@ else
fi
AC_MSG_RESULT(${BUNDLE})
if test "$SQLITE" = "yes"; then
BUNDLE="The SQLite backend bundle will be built"
else
BUNDLE="The SQLite backend bundle will NOT be built"
fi
AC_MSG_RESULT(${BUNDLE})
if test "$POSTGRES" = "yes"; then
BUNDLE="The Postgres backend bundle will be built"
else

View file

@ -1,250 +0,0 @@
#! /bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

View file

@ -7,29 +7,29 @@
This file is part of the SQLClient Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$Date$ $Revision$
*/
#include <Foundation/Foundation.h>
#include "SQLClient.h"
#import <Foundation/Foundation.h>
#import "SQLClient.h"
int
main()
{
CREATE_AUTORELEASE_POOL(pool);
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
@ -109,7 +109,7 @@ main()
if ([records count] != 2)
{
NSLog(@"Expected 2 records but got %u", [records count]);
NSLog(@"Expected 2 records but got %" PRIuPTR "", [records count]);
}
else
{
@ -128,7 +128,7 @@ main()
NSLog(@"Records - %@", records);
RELEASE(pool);
[pool release];
return 0;
}

338
testJDBC.m Normal file
View file

@ -0,0 +1,338 @@
/**
Copyright (C) 2006 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
Date: August 2006
This file is part of the SQLClient Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$Date: 2006-05-25 12:34:03 +0100 (Thu, 25 May 2006) $ $Revision: 22982 $
*/
#import <Foundation/Foundation.h>
#import <Performance/GSCache.h>
#import "SQLClient.h"
int
main()
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
SQLRecord *record;
unsigned char dbuf[256];
unsigned int i;
NSData *data;
NSString *name;
defs = [NSUserDefaults standardUserDefaults];
[defs registerDefaults:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSDictionary dictionaryWithObjectsAndKeys:
@"org.postgresql.Driver:jdbc:postgresql://localhost/template1",
@"Database",
@"postgres", @"User",
@"postgres", @"Password",
@"JDBC", @"ServerType",
nil],
@"test",
nil],
@"SQLClientReferences",
nil]
];
db = [SQLClient clientWithConfiguration: nil name: @"test"];
[db connect];
if ((name = [defs stringForKey: @"Producer"]) != nil)
{
NS_DURING
{
[db execute: @"CREATE TABLE Queue ( "
@"ID SERIAL, "
@"Consumer CHAR(40) NOT NULL, "
@"ServiceID INT NOT NULL, "
@"Status CHAR(1) DEFAULT 'Q' NOT NULL, "
@"Delivery TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, "
@"Reference CHAR(128), "
@"Destination CHAR(15) NOT NULL, "
@"Payload CHAR(250) DEFAULT '' NOT NULL"
@")",
nil];
[db execute:
@"CREATE UNIQUE INDEX QueueIDX ON Queue (ID)",
nil];
[db execute:
@"CREATE INDEX ServiceIDX ON Queue (ServiceID)",
nil];
[db execute:
@"CREATE INDEX ConsumerIDX ON Queue (Consumer,Status,Delivery)",
nil];
[db execute:
@"CREATE INDEX ReferenceIDX ON Queue (Reference,Consumer)",
nil];
}
NS_HANDLER
{
NSLog(@"%@", localException);
}
NS_ENDHANDLER
NSLog(@"Start producing");
for (i = 0; i < 100000; i++)
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSString *destination = [NSString stringWithFormat: @"%d", i];
NSString *sid = [NSString stringWithFormat: @"%d", i%100];
[db execute: @"INSERT INTO Queue (Consumer, Destination, ServiceID, Payload) VALUES (",
[db quote: name], @", ", [db quote: destination], @", ", sid, @", ",
@"'helo there'", @")", nil];
[arp release];
}
NSLog(@"End producing");
}
else if ((name = [defs stringForKey: @"Consumer"]) != nil)
{
NSLog(@"Start consuming");
for (i = 0; i < 100000;)
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
unsigned count;
int j;
[db begin];
records = [db query: @"SELECT * FROM Queue WHERE Consumer = ",
[db quote: name],
@" AND Status = 'Q' AND Delivery < CURRENT_TIMESTAMP",
@" ORDER BY Delivery LIMIT 1000 FOR UPDATE" , nil];
count = [records count];
if (count == 0)
{
[db commit];
[NSThread sleepForTimeInterval: 1.0];
[db begin];
records = [db query: @"SELECT * FROM Queue WHERE Consumer = ",
[db quote: name],
@" AND Status = 'Q' AND Delivery < CURRENT_TIMESTAMP",
@" ORDER BY Delivery LIMIT 50 FOR UPDATE" , nil];
count = [records count];
if (count == 0)
{
break;
}
}
for (j = 0; j < count; j++)
{
SQLRecord *record = [records objectAtIndex: j];
NSString *reference = [record objectForKey: @"ID"];
[db execute: @"UPDATE Queue SET Status = 'S', Reference = ",
[db quote: reference], @" WHERE ID = ",
[record objectForKey: @"ID"], nil];
[db execute: @"UPDATE Queue SET Status = 'D'",
@" WHERE Consumer = ", [db quote: name],
@" AND Reference = ", [db quote: reference],
nil];
}
[db commit];
i += count;
[arp release];
}
NSLog(@"End consuming (%d records)", i);
/*
[db execute: @"DROP INDEX ReferenceIDX", nil];
[db execute: @"DROP INDEX ServiceIDX", nil];
[db execute: @"DROP INDEX ConsumerIDX", nil];
[db execute: @"DROP INDEX QueueIDX", nil];
[db execute: @"DROP TABLE Queue", nil];
*/
}
else
{
SQLTransaction *t;
NSString *oddChars;
NSString *nonLatin;
id r0;
id r1;
oddChars = @"'a\\b'c\r\nd'\\ed\\";
nonLatin = [[NSString stringWithCString: "\"\\U2A11\""] propertyList];
for (i = 0; i < 256; i++)
{
dbuf[i] = i;
}
data = [NSData dataWithBytes: dbuf length: i];
NS_DURING
[db execute: @"drop table xxx", nil];
NS_HANDLER
NS_ENDHANDLER
[db setDurationLogging: 0];
[db begin];
[db execute: @"create table xxx ( "
@"k char(40), "
@"char1 char(1), "
@"boolval BOOL, "
@"intval int, "
@"when1 timestamp with time zone, "
@"when2 timestamp, "
@"b bytea"
@")",
nil];
[db execute: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values ("
@"'hello', "
@"'X', "
@"TRUE, "
@"1, "
@"CURRENT_TIMESTAMP, "
@"CURRENT_TIMESTAMP, ",
data,
@")",
nil];
[db execute: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values ("
@"'hello', "
@"'X', "
@"TRUE, "
@"1, ",
[NSDate date], @", ",
[NSDate date], @", ",
[NSData dataWithBytes: "" length: 0],
@")",
nil];
[db execute: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values (",
[db quote: oddChars],
@", ",
[db quote: nonLatin],
@",TRUE, "
@"1, ",
[NSDate date], @", ",
[NSDate date], @", ",
[NSData dataWithBytes: "" length: 0],
@")",
nil];
[db commit];
r0 = [db cache: 1 query: @"select * from xxx", nil];
r1 = [db cache: 1 query: @"select * from xxx", nil];
NSCAssert([r0 lastObject] == [r1 lastObject], @"Cache failed");
[NSThread sleepForTimeInterval: 2.0];
records = [db cache: 1 query: @"select * from xxx", nil];
NSCAssert([r0 lastObject] != [records lastObject], @"Lifetime failed");
[db execute: @"drop table xxx", nil];
if ([records count] != 3)
{
NSLog(@"Expected 3 records but got %"PRIuPTR, [records count]);
}
else
{
record = [records objectAtIndex: 0];
if ([[record objectForKey: @"b"] isEqual: data] == NO)
{
NSLog(@"Retrieved data does not match saved data %@ %@",
data, [record objectForKey: @"b"]);
}
record = [records objectAtIndex: 1];
if ([[record objectForKey: @"b"] isEqual: [NSData data]] == NO)
{
NSLog(@"Retrieved empty data does not match saved data");
}
record = [records objectAtIndex: 2];
if ([[record objectForKey: @"char1"] isEqual: nonLatin] == NO)
{
NSLog(@"Retrieved non-latin does not match saved string");
}
if ([[record objectForKey: @"k"] isEqual: oddChars] == NO)
{
NSLog(@"Retrieved odd chars does not match saved string");
}
}
[db execute: @"create table xxx ( "
@"k char(40), "
@"char1 char(1), "
@"boolval BOOL, "
@"intval int, "
@"when1 timestamp with time zone, "
@"when2 timestamp, "
@"b bytea"
@")",
nil];
t = [db transaction];
[t add: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values (",
[db quote: oddChars],
@", ",
[db quote: nonLatin],
@",TRUE, "
@"0, ",
[NSDate date], @", ",
[NSDate date], @", ",
[db quote: nil],
@")",
nil];
[t add: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values (",
[db quote: oddChars],
@", ",
[db quote: nonLatin],
@",TRUE, "
@"1, ",
[NSDate date], @", ",
[NSDate date], @", ",
[db quote: nil],
@")",
nil];
[t add: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values (",
[db quote: oddChars],
@", ",
[db quote: nonLatin],
@",TRUE, "
@"2, ",
[NSDate date], @", ",
[NSDate date], @", ",
[db quote: nil],
@")",
nil];
[t execute];
[db execute: @"drop table xxx", nil];
NSLog(@"Records - %@", [GSCache class]);
}
[pool release];
return 0;
}

View file

@ -7,29 +7,29 @@
This file is part of the SQLClient Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$Date$ $Revision$
*/
#include <Foundation/Foundation.h>
#include "SQLClient.h"
#import <Foundation/Foundation.h>
#import "SQLClient.h"
int
main()
{
CREATE_AUTORELEASE_POOL(pool);
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
@ -109,7 +109,7 @@ main()
if ([records count] != 2)
{
NSLog(@"Expected 2 records but got %u", [records count]);
NSLog(@"Expected 2 records but got %" PRIuPTR "", [records count]);
}
else
{
@ -128,7 +128,7 @@ main()
NSLog(@"Records - %@", records);
RELEASE(pool);
[pool release];
return 0;
}

View file

@ -7,29 +7,42 @@
This file is part of the SQLClient Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$Date$ $Revision$
*/
#include <Foundation/Foundation.h>
#include "SQLClient.h"
#import <Foundation/Foundation.h>
#import <Performance/GSCache.h>
#import "SQLClient.h"
@interface Logger : NSObject
- (void) notified: (NSNotification*)n;
@end
@implementation Logger
- (void) notified: (NSNotification*)n
{
NSLog(@"Received %@", n);
}
@end
int
main()
{
CREATE_AUTORELEASE_POOL(pool);
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClientPool *sp;
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
@ -38,6 +51,7 @@ main()
unsigned int i;
NSData *data;
NSString *name;
Logger *l;
defs = [NSUserDefaults standardUserDefaults];
[defs registerDefaults:
@ -55,7 +69,84 @@ main()
nil]
];
db = [SQLClient clientWithConfiguration: nil name: @"test"];
sp = [[[SQLClientPool alloc] initWithConfiguration: nil
name: @"test"
max: 2
min: 1] autorelease];
#if 0
{
NSAutoreleasePool *p;
NSAutoreleasePool *q;
SQLClient *c0;
SQLClient *c1;
[sp setDebugging: 4];
p = [NSAutoreleasePool new];
c0 = [sp provideClientExclusive];
c1 = [sp provideClientExclusive];
NSLog(@"Got two clients from pool");
[c0 connect];
[c1 connect];
NSLog(@"Now putting clients back in pool again");
[sp swallowClient: c0];
[sp swallowClient: c1];
NSLog(@"And emptying autorelease pool");
[p release];
p = [NSAutoreleasePool new];
[sp setPurgeAll: 60 min: 1];
[NSThread sleepForTimeInterval: 1.0];
NSLog(@"Expecting purge to disconnect one client");
[sp purge];
c0 = [sp provideClientExclusive];
c1 = [sp provideClientExclusive];
NSLog(@"Expecting connected: %@", [c0 connected] ? @"YES" : @"NO");
NSLog(@"Expecting not connected: %@", [c1 connected] ? @"NO" : @"YES");
NSLog(@"Pool has provided both it's clients ... now try for another with a 15 second timeout");
[sp provideClientBeforeDate: [NSDate dateWithTimeIntervalSinceNow: 15.0]
exclusive: YES];
NSLog(@"Emptying autorelease pool ... clients should be put back in pool");
[p release];
p = [NSAutoreleasePool new];
NSLog(@"Getting two clients again");
c0 = [sp provideClientExclusive];
c1 = [sp provideClientExclusive];
NSLog(@"Pool has provided both it's clients ... now try for another with a 15 second timeout");
[sp provideClientBeforeDate: [NSDate dateWithTimeIntervalSinceNow: 15.0]
exclusive: YES];
NSLog(@"Emptying autorelease pool again");
[p release];
p = [NSAutoreleasePool new];
c0 = [sp provideClient];
q = [NSAutoreleasePool new];
c1 = [sp provideClient];
if (c0 != c1)
{
NSLog(@"ERROR was expecting provideClient to give the same object");
exit(1);
}
[q release];
[c0 connect];
[p release];
NSLog(@"Expect to get client immediately");
}
#endif
db = [sp provideClientExclusive];
[sp swallowClient: db];
[sp queryString: @"SELECT CURRENT_TIMESTAMP", nil];
db = [sp provideClientExclusive];
l = [Logger new];
[[NSNotificationCenter defaultCenter] addObserver: l
selector: @selector(notified:)
name: SQLClientDidConnectNotification
object: db];
[[NSNotificationCenter defaultCenter] addObserver: l
selector: @selector(notified:)
name: SQLClientDidDisconnectNotification
object: db];
if ((name = [defs stringForKey: @"Producer"]) != nil)
{
@ -69,7 +160,7 @@ main()
@"Delivery TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, "
@"Reference CHAR(128), "
@"Destination CHAR(15) NOT NULL, "
@"Payload CHAR(250) DEFAULT '' NOT NULL"
@"Payload CHAR(250) DEFAULT '' NOT NULL,"
@")",
nil];
[db execute:
@ -93,23 +184,35 @@ main()
NSLog(@"Start producing");
for (i = 0; i < 100000; i++)
{
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSString *destination = [NSString stringWithFormat: @"%d", i];
NSString *sid = [NSString stringWithFormat: @"%d", i%100];
[db execute: @"INSERT INTO Queue (Consumer, Destination, ServiceID, Payload) VALUES (",
[db quote: name], @", ", [db quote: destination], @", ", sid, @", ",
@"'helo there'", @")", nil];
RELEASE(arp);
if (i % 1000 == 999)
{
[db postNotificationName: @"Producing"
payload: [NSString stringWithFormat: @"%d", i]];
}
[db execute: @"INSERT INTO Queue (Consumer, Destination,"
@" ServiceID, Payload) VALUES (",
[db quote: name], @", ",
[db quote: destination], @", ",
sid, @", ",
@"'helo there'",
@")", nil];
[arp release];
}
NSLog(@"End producing");
}
else if ((name = [defs stringForKey: @"Consumer"]) != nil)
{
[db addObserver: l
selector: @selector(notified:)
name: @"Producing"];
NSLog(@"Start consuming");
for (i = 0; i < 100000;)
{
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
unsigned count;
int j;
@ -122,7 +225,7 @@ main()
if (count == 0)
{
[db commit];
sleep(1);
[NSThread sleepForTimeInterval: 1.0];
[db begin];
records = [db query: @"SELECT * FROM Queue WHERE Consumer = ",
[db quote: name],
@ -151,7 +254,7 @@ main()
}
[db commit];
i += count;
RELEASE(arp);
[arp release];
}
NSLog(@"End consuming (%d records)", i);
/*
@ -164,6 +267,20 @@ main()
}
else
{
NSString *oddChars;
NSString *oddNoNul;
NSString *nonLatin;
id e1, e2, e3, e4, e5;
id d;
id d0;
id d1;
id d2;
id r0;
id r1;
oddChars = @"'a\\b'c\0\r\nd'\\ed\\";
oddNoNul = @"'a\\b'c\r\nd'\\ed\\";
nonLatin = [[NSString stringWithCString: "\"\\U2A11\""] propertyList];
for (i = 0; i < 256; i++)
{
dbuf[i] = i;
@ -179,31 +296,64 @@ main()
[db begin];
[db execute: @"create table xxx ( "
@"id int, "
@"k char(40), "
@"char1 char(1), "
@"boolval BOOL, "
@"intval int, "
@"when1 timestamp with time zone, "
@"when2 timestamp, "
@"b bytea"
@"b bytea,"
@"extra1 int[],"
@"extra2 varchar[],"
@"extra3 bytea[],"
@"extra4 boolean[],"
@"extra5 timestamp with time zone[]"
@")",
nil];
[db execute: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values ("
@"'hello', "
if (1 != [db execute: @"INSERT into xxx (id, k, char1, boolval, intval,"
@" when1, when2, b, extra1, extra2, extra3, extra4, extra5) "
@"values (1,"
@"'{hello', "
@"'X', "
@"TRUE, "
@"1, "
@"CURRENT_TIMESTAMP, "
@"CURRENT_TIMESTAMP, ",
data,
@")",
nil];
[db execute: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values ("
data, @", ",
[db quoteArray:
(e1 = [NSArray arrayWithObjects: @"1", @"2", [NSNull null], nil])
toString: nil
quotingStrings: NO], @", ",
[db quoteArray:
(e2 = [NSArray arrayWithObjects: @"on,e", @"t'wo", @"many", nil])
toString: nil
quotingStrings: YES], @", ",
[db quoteArray:
(e3 = [NSArray arrayWithObjects: data, nil])
toString: nil
quotingStrings: YES], @", ",
[db quoteArray:
(e4 =[NSArray arrayWithObjects: @"TRUE", @"FALSE", nil])
toString: nil
quotingStrings: NO], @", ",
[db quoteArray:
(e5 = [NSArray arrayWithObjects: [NSDate date], nil])
toString: nil
quotingStrings: YES], @")",
nil])
{
NSLog(@"Insert failed to return row count");
}
[db setDebugging: 0];
[db query: @"select * from xxx", nil];
[db setDebugging: 0];
[db execute: @"INSERT into xxx "
@"(id, k, char1, boolval, intval, when1, when2, b) "
@"values (2,"
@"'hello', "
@"'X', "
@"TRUE, "
@ -213,17 +363,46 @@ main()
[NSData dataWithBytes: "" length: 0],
@")",
nil];
[db execute: @"INSERT into xxx "
@"(id, k, char1, boolval, intval, when1, when2, b) "
@"values (3,",
[db quote: oddChars],
@", ",
[db quote: nonLatin],
@",TRUE, "
@"1, ",
[NSDate date], @", ",
[NSDate date], @", ",
[NSData dataWithBytes: "" length: 0],
@")",
nil];
[db commit];
records = [db query: @"select * from xxx", nil];
r0 = [db cache: 1 query: @"select * from xxx order by id", nil];
r1 = [db cache: 1 query: @"select * from xxx order by id", nil];
NSCAssert([r0 lastObject] == [r1 lastObject], @"Cache failed");
[NSThread sleepForTimeInterval: 2.0];
records = [db cache: 1 query: @"select * from xxx order by id", nil];
NSCAssert([r0 lastObject] != [records lastObject], @"Lifetime failed");
db = [[[SQLClient alloc] initWithConfiguration: nil
name: @"test"] autorelease];
[db addObserver: l
selector: @selector(notified:)
name: @"foo"];
[db postNotificationName: @"foo" payload: @"hello"];
[db execute: @"drop table xxx", nil];
if ([records count] != 2)
if ([records count] != 3)
{
NSLog(@"Expected 2 records but got %u", [records count]);
NSLog(@"Expected 3 records but got %lu", [records count]);
}
else
{
int i;
record = [records objectAtIndex: 0];
if ([[record objectForKey: @"b"] isEqual: data] == NO)
{
@ -235,12 +414,105 @@ main()
{
NSLog(@"Retrieved empty data does not match saved data");
}
record = [records objectAtIndex: 2];
if ([[record objectForKey: @"char1"] isEqual: nonLatin] == NO)
{
NSLog(@"Retrieved non-latin does not match saved string");
}
id o = [[record objectForKey: @"k"] stringByTrimmingSpaces];
if ([o isEqual: oddNoNul] == NO)
{
NSLog(@"Retrieved odd chars (%@) does not match oddNoNul (%@)",
o, oddNoNul);
}
else
{
NSLog(@"Embedded nul correctly removed");
}
record = [records objectAtIndex: 0];
o = [record objectForKey: @"extra1"];
if ([o isEqual: e1] == NO)
{
NSLog(@"Retrieved extra1 (%@) does not match saved (%@)", o, e1);
}
o = [record objectForKey: @"extra2"];
if ([o isEqual: e2] == NO)
{
NSLog(@"Retrieved extra2 (%@) does not match saved (%@)", o, e2);
}
o = [record objectForKey: @"extra3"];
if ([o isEqual: e3] == NO)
{
NSLog(@"Retrieved extra3 (%@) does not match saved (%@)", o, e3);
}
o = [record objectForKey: @"extra4"];
if ([o count] != [e4 count])
{
NSLog(@"Retrieved extra4 (%@) does not match saved (%@)", o, e4);
}
for (i = 0; i < [o count]; i++)
{
if ([[o objectAtIndex: i] boolValue]
!= [[e4 objectAtIndex: i] boolValue])
{
NSLog(@"Retrieved extra4 (%@) does not match saved (%@)",
o, e4);
}
}
o = [record objectForKey: @"extra5"];
if ([o count] != [e5 count])
{
NSLog(@"Retrieved extra5 (%@) does not match saved (%@)", o, e5);
}
for (i = 0; i < [o count]; i++)
{
if (floor([[o objectAtIndex: i] timeIntervalSinceReferenceDate])
!= floor([[e5 objectAtIndex: i] timeIntervalSinceReferenceDate]))
{
NSLog(@"Retrieved extra5 (%@) does not match saved (%@)",
o, e5);
}
}
}
NSLog(@"Records - %@", records);
NSLog(@"Records - %@", [GSCache class]);
d = [NSCalendarDate date];
[d setTimeZone: [NSTimeZone timeZoneForSecondsFromGMT: 240]];
[db begin];
[db execute: @"create table xxx ( "
@"id int, "
@"when0 timestamp with time zone, "
@"when1 timestamp with time zone, "
@"when2 timestamp)",
nil];
[db execute: @"INSERT into xxx (id, when0, when1, when2) "
@"values (99,",
d, @", ",
[NSDate distantPast], @", ",
[NSDate distantFuture], @")",
nil];
r0 = [[db query: @"select * from xxx where id=99", nil] lastObject];
[db execute: @"drop table xxx", nil];
[db commit];
d0 = [r0 objectForKey:@"when0"];
NSCAssert(floor([d0 timeIntervalSinceReferenceDate])
== floor([d timeIntervalSinceReferenceDate]),
NSInternalInconsistencyException);
d1 = [r0 objectForKey:@"when1"];
NSCAssert([d1 timeIntervalSinceReferenceDate]
== [[NSDate distantPast] timeIntervalSinceReferenceDate],
NSInternalInconsistencyException);
d2 = [r0 objectForKey:@"when2"];
NSCAssert([d2 timeIntervalSinceReferenceDate]
== [[NSDate distantFuture] timeIntervalSinceReferenceDate],
NSInternalInconsistencyException);
}
RELEASE(pool);
NSLog(@"Pool stats:\n%@", [sp statistics]);
[pool release];
return 0;
}

129
testSQLite.m Normal file
View file

@ -0,0 +1,129 @@
/**
Copyright (C) 2005 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
Date: April 2005
This file is part of the SQLClient Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$Date$ $Revision$
*/
#import <Foundation/Foundation.h>
#import "SQLClient.h"
int
main()
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
SQLRecord *record;
unsigned char dbuf[256];
unsigned int i;
NSData *data;
defs = [NSUserDefaults standardUserDefaults];
[defs registerDefaults:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSDictionary dictionaryWithObjectsAndKeys:
@"test", @"Database",
@"", @"User",
@"", @"Password",
@"SQLite", @"ServerType",
nil],
@"test",
nil],
@"SQLClientReferences",
nil]
];
for (i = 0; i < 256; i++)
{
dbuf[i] = i;
}
data = [NSData dataWithBytes: dbuf length: i];
db = [SQLClient clientWithConfiguration: nil name: @"test"];
[db setDurationLogging: 0];
NS_DURING
[db execute: @"drop table xxx", nil];
NS_HANDLER
NS_ENDHANDLER
[db execute: @"create table xxx ( "
@"k char(40), "
@"char1 char(1), "
@"intval int, "
@"realval real, "
@"b blob)",
nil];
[db execute: @"insert into xxx "
@"(k, char1, intval, realval, b) "
@"values ("
@"'hello', "
@"'X', "
@"1, "
@"9.99, ",
data,
@")",
nil];
[NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 1]];
[db execute: @"insert into xxx "
@"(k, char1, intval, realval, b) "
@"values (",
[db quoteString: @"hello"], @", "
@"'X', "
@"1, ",
@"12345.6789, ",
[NSData dataWithBytes: "" length: 0], @")",
nil];
records = [db query: @"select * from xxx", nil];
[db execute: @"drop table xxx", nil];
if ([records count] != 2)
{
NSLog(@"Expected 2 records but got %" PRIuPTR "", [records count]);
}
else
{
record = [records objectAtIndex: 0];
if ([[record objectForKey: @"b"] isEqual: data] == NO)
{
NSLog(@"Retrieved data does not match saved data %@ %@",
data, [record objectForKey: @"b"]);
}
record = [records objectAtIndex: 1];
if ([[record objectForKey: @"b"] isEqual: [NSData data]] == NO)
{
NSLog(@"Retrieved empty data does not match saved data");
}
}
NSLog(@"Records - %@", records);
[pool release];
return 0;
}