Compare commits

..

306 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
24 changed files with 11709 additions and 9834 deletions

749
ChangeLog
View file

@ -1,3 +1,752 @@
2024-01-26 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: Fix error in parsing milliseconds in timestamp.
2023-11-23 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h: New instance variables for timing lock waits.
* SQLClient.m: Record duration of waits for locks.
* SQLClientPool.m: Tell client when pool was locked before query.
Changes so that, the time spent waiting to obtain a lock to get a
connection from a pool or to be able to execute a query on a
connection used by another thread is recorded. When query duration
logging is performed, report lock delays of over a millisecond.
If debug is on or if the query logging duration is zero, then any
lock delay (no matter how small) is reported.
2023-08-16 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: Implement support for connect_timeoout= option to
control how long we allow for a connection attempt to a host.
2023-01-13 Richard Frith-Macdonald <rfm@gnu.org>
* GNUmakefile: bumped version to 1.9.0.
2022-06-08 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h: Declare new (-committed) method.
* SQLClient.m:
* SQLClientPool.m:
Implement -committed to return the count of transactions committed by
a client or pool. Update -description to report that too.
2022-06-08 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h: Declare new (-setOptions:) method.
* SQLClient.m: Implement stub for new method and add code to call it
to register any optional configuration, passing the configuration
dictionary as a parameter.
* Postgres.m: Implement new method to store configuration information
and use sslmode option if (and only if) it is set to require an
encrypted connection.
2020-09-01 Wolfgang Lux <wolfgang.lux@gmail.com>
* SQLClient.m (release): Reinstate fix to avoid deadlock while
purging pool.
2020-04-21 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: 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-13 Wolfgang Lux <wolfgang.lux@gmail.com>
* MySQL.m (backendQuery:recordType:listType:):
Change argument types to match those of the overridden base class
implementation to make the override work with the GNUstep
Objective-C runtime.
2020-04-08 Wolfgang Lux <wolfgang.lux@gmail.com>
* SQLClient.m (clientWithConfiguration:name:):
* SQLClient.m (initWithConfiguration:name:pool:):
Eventually reconfigure a client connection that gets reused.
2020-03-21 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: Don't attempt to establish connection before query or
execute (the superclass should do it).
* SQLClient.m: Ensure connection is established before calling backend
methods where possible. Add timing to establishment of connection.
2020-02-27 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Make the code aware of the tiny string class used by
the gnustep base library. Treat tiny strings as literal strings
because, unfortunately, we can't tell if they were created at
compile time or at run time.
2020-02-25 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Changes to -release to avoid deadlock purging pool.
2020-02-14 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Re-implement SQLString as a true subclass rather than
using trick depending on internals of gnustep-base (which change with
the ObjC-2.0 ABI and would break).
2020-02-11 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h: Remove redundant -prepareQuery: method.
* SQLClient.m: Remove redundant -prepareQuery: method and redundant
code from query building methods.
* SQLClientPool.m: Remove redundant -prepareQuery: method and redundant
code from query building methods.
2020-01-22 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: Fix notification posting to refrain from coalescing.
2019-12-11 Wolfgang Lux <wolfgang.lux@gmail.com>
* Postgres.m: Hide database connection password from debug logs.
2019-08-06 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClientPool.m: Fix error specifying query string in exceptions
2019-07-29 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Improve logging of cache queries to indicate that
the query was from the cache and whether it was a it or a miss.
2019-07-14 Wolfgang Lux <wolfgang.lux@gmail.com>
* SQLClient.h
* SQLClientPool.m:
Hide definition of SQLClientPoolItem from the public interface,
as it is incompatible with automatic reference counting.
2019-05-03 Wolfgang Lux <wolfgang.lux@gmail.com>
* SQLClient.m:
Rewrite release method to work with version 1.9 of the GNUstep
Objective-C runtime system and also Apple's runtime.
2019-03-07 Wolfgang Lux <wolfgang.lux@gmail.com>
* SQLClient.m:
Fix insertTransaction:atIndex: to work as advertised and insert at
the specified index.
2019-03-07 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: fix to make the result of a prepare method contain
'literal' strings.
In -begin do not set the flag to say we are in a transaction until
the statement has actually executed.
2019-02-28 Wolfgang Lux <wolfgang.lux@gmail.com>
* Postgres.m:
Fix minor space leak in the Postgres backendConnect method.
2019-02-28 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* SQLClientPool.m:
Add -prepareQuery:... method and make simpleQuery methods check that
they are given a literal (or proxy);
2019-02-19 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Remove transaction merging (deprecated in 2015).
2019-01-24 Wolfgang Lux <wolfgang.lux@gmail.com>
* Postgres.m (backendQuery:recordType:listType:):
Fix optimization to reuse small data values in query results so
that it actually works.
2018-11-23 Wolfgang Lux <wolfgang.lux@gmail.com>
* SQLClient.h:
* SQLClient.m:
* SQLClientPool.m:
Use a double for the argument of quoteFloat: and replace the
inappropriate %f conversion by %.17g to avoid loss of precision
when quoting floating-point numbers.
2018-07-27 Yavor Doganov <yavor@gnu.org>
* SQLClient.m: Fix some spelling errors.
2018-06-28 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Make SQLTransaction thread-safe, also add -lock and -unlock methods
to allow a sequence of other methods to be called without another
thread interfering. Add -setResetOnExecute: method to configure a
transaction to be automatically reset on successful execution.
2018-04-16 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Fix error checking for nil values when preparing with
a dictionary. This should make the {key?default} syntax work.
2017-09-19 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Simplify observation of database notifications ... one observation per
name per observing object.
2017-07-27 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Temporarily restore earlier behavior ...
Autoquote warnings off by default.
Connection retries off by default.
In future releases the plan is to
a. have connection attempts retried forever by default
b. first turn on warnings about autoquote issues by default
c. later, rurn on autoquote by default
2017-07-27 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Have connection attempts automatically retried (blocking
indefinitely). Have queries and statements outside a transaction
automatically retried if they fail due to loss of connection.
2017-08-25 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: Cache the file descriptor to fix problem in cleanup
when postgres returns -1 from PQsocket() as we are trying to remove
descriptor from run loop. Also fix error in unlisten where we would
stop monitoring the descriptor prematurely.
2017-08-15 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: Add code so that if the database connection is lost
while we are listening for notifications from it, we notice that
and clean up properly rather than continuing to process/ignore a
stream of end-of-file events on the dead descriptor.
2017-07-04 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* SQLClientPool.m:
* Postgres.m:
Lots of changes introducing new concept of a 'literal' as a string
which does not need to be quoted (and must not be autoquoted).
Quoting via the -quote: method now raises an exception if the
argument is not supported, but we have a new method to allow
classes to provide a mechanism for quoting themselves (ie to add
support for them being using in SQL queries/statements).
2017-06-29 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
New method to control warnings (on by default) about strings which
would automaticaly be quoted when autoquote is turned on.
2017-04-07 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m:
Fix leak of SQLString instances caused by inheriting memory management
methods from the literal string class.
2017-03-06 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* SQLClientPool.m:
Add new +literal: and -literal: methods to make a normal string into
one recognised as suitable for use literally (ie without quoting) in
an SQL query/statement.
Add +setAutoquote: method to turn on automatic quoting of non-literal
strings as an aid to avoiding SQL injectiuon attacks.
2016-10-19 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: Wolfgang spotted that the asynchronous notification
code is not thread safe ... we must not have one thread handle a
notification at the same time that another is trying to use the
database connectionto execute a query/statement.
Use the client's lock to prevent that from happening.
2016-10-18 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Make -addObserver:selector:name: raise if applied to a client in a
pool. Improve documentation to make it clear that pool clients
can't be used as observers of database notifications.
2016-06-23 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Fixup to use case sensitive notification names.
2016-06-21 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* SQLClientPool.m:
Allow easy removal of all database notification observers.
Remove all observers when a client is returned to a pool.
Postgres.m:
Implement asynchronous notification by watching descriptor.
2016-05-06 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Fix bug in initialisation ordering.
* Postgres.m: Fix bug in array parsing.
2016-04-27 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Add -isNull helper method for testing for null fields in records
returned from the database.
2016-02-18 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: get host and cpu with more recent gnustep-make
* configure: regenerate
* JDBC.m: Update for connection pools (bug #47178)
* testJDBC.m: get rid of compiler warnings
2015-07-22 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: disconnect on fatal error, so we don't keep trying to
re-use the same connection when there's a problem with the server.
2015-07-23 Wolfgang Lux <wolfgang.lux@gmail.com>
* SQLClient.m (initialize): Restore initialization of NSDateClass
so that dates are quoted correctly irrespective of their current
format.
2015-07-22 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClientPool.m:
Change internal pool data to allow for storing reference counts and
the threads which own each client connection.
Support exclusive and non-exclusive clients in the pool, where an
exclusive client is one which is only usable by the code which
fetched it from the pool, but a non-exclusive client may be provided
to other code in the same thread.
Change behavior of -provideClient and -provideClientBeforeDate: to
provide non-exclusive clients.
Add -provideClientExclusive and -provideClientBeforeDate:exclusive:
to support the old behavior.
2015-07-17 Niels Grewe <niels.grewe@halbordnung.de>
* Postgres.m: Support for "char"[] parsing.
2015-07-16 Wolfgang Lux <wolfgang.lux@gmail.com>
* Postgres.m (newDateFromBuffer): Use local time zone instead of
GMT when parsing a date without a time zone.
2015-06-29 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* SQLClientPool.m:
Implement another missing convenience method.
Fix locking error when executing a batch.
Add -prepare:with: method for use by transactions.
Add -owner method to get a transaction's owner.
2015-06-27 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* SQLClientPool.m:
Implement -batch: method for client pools.
2015-06-26 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* SQLClientPool.m:
Implement -transaction method for client pools so that we can build
a transaction which, when executed, will use any available client
from the pool.
Support setting of the client name for clients in a pool.
2015-06-25 Niels Grewe <niels.grewe@halbordnung.de>
* SQLClient.[hm]: Add an accessor method to obtain the SQLClientPool
object owning a specific SQLClient.
2015-06-25 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h: Add -name method for pools.
* SQLClient.m: Match documentation and use 'Database' as default name.
* SQLClientPool.m: Add -name method and fix default name.
2015-06-19 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: Fix error parsing timezone in date.
2015-06-09 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Fix race condition spotted by Wolfgang and change
purge operation to avoid disconnecting clients while the class lock
is locked.
2015-05-28 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h: Add pool purge control method.
* SQLClient.m: Fix bug finding least recently used client.
* SQLClientPool.m: Refine purging of pool. Fix autorelease bug.
Improve diagnostics. Fix bug reporting time pool has blocked.
2015-05-27 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: bugfixes
* SQLClient.m: bugfix for finding oldest idle connection
* SQLClientPool.m: implement method to disconnect idle connections
in pool. also check for clients being returned to pool while a
transaction is still in progress.
2015-04-30 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m:
* testPostgres.m:
Fix error parsing timestamps in arrays when the server quoters them.
Also optimise string allocation, and add some tests.
2015-04-28 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* Postgres.m:
Deprecate transaction merging.
Rewrite SQLRecord concrete class to use a new SQLRecordKeys object
shared between all the records produced by a query (as a performance
enhancement for large queries).
2015-04-15 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: notifications are posted in main thread.
2015-04-13 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClientPool.m:
Make sure clients provided temporarily in convenience methods are
swallowed by the pool again as soon as possible. Also trap and
re-raise exceptions after swallowing provided client, to avoid
the client being in use longer than necessary after an exception.
Also, avoid taking clients from the pool in a few cases wehere we
don't actually need to.
Add -cache method for SQLClientPool.
2015-04-12 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Expose method to add statement for insertion of data objects to
transaction.
2015-04-09 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h: Add array quoting method for pool. Add pool ivar.
* SQLClientPool.m: Implement array quoting and change other quoting
to use new ivar rather than expensive provide/swallow sequence.
2015-04-01 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* Postgres.m:
Fixup notification posting to be asynchronous using the default
notification queue for the thread so that the notifications do
not get delivered while the query/statement at which they were
detected is still in progress.
Add method to explicitly grab/release the client for the current
thread.
2015-03-11 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClientPool.m: Fixup for exposing prepare method
* SQLClient.h:
* SQLClient.m:
* Postgres.m:
* testPostgres.m:
Add simple array support for char/varchar/text, integer/real,
timestamp, bool and bytea. When a query returns an array of
one of these types, the resulting object is an NSArray containing
the database array elements rather than an NSString containing the
string literal representation of the database array.
Also added a method to convert an NSArray to a string literal
representation of a database array.
2015-03-02 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.h: Drop support for old versions of postgres which didn't
support standard conforming strings. This allows us to always turn
on standard conforming strings and be able to quote string and bytea
objects whether the database connection has been established or not.
* GNUmakefile:
Bumped version to 1.8.4.
2014-12-11 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* GNUmakefile:
Expose method to prepare a statement and a convenience method to
check for an existing cached value (using a prepared statement
as the cache key).
Bumped version to 1.8.3.
2014-12-11 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: Fix minor thread safety issue.
* SQLClient.h:
* SQLClient.m:
* SQLClientPool.m:
Convenience methods to let a pool act as a client for any one-off op.
2014-11-19 Richard Frith-Macdonald <rfm@gnu.org>
* GNUmakefile: bump version to 1.8.2 for bugfix release.
* Postgres.m: Fix error handling TIME fields.
2014-11-04 Richard Frith-Macdonald <rfm@gnu.org>
* GNUmakefile: bump version to 1.8.1 for connection pool tweaks.
2014-10-13 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* SQLClientPool.m:
Keep connections in pools outside the normal count of maximum number
of concurrent connections. If we are using a pool then we must
assume we want the pool to operate to its configured capacity.
2014-10-07 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Add locking of the database client by SQLTransaction
in case another thread tries to use the client whjile the transaction
is using it (ie between an attempted transaction and a rollback if
it fails).
2014-10-02 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: On exception during SQLTransaction -execute, roll back.
2014-09-24 Richard Frith-Macdonald <rfm@gnu.org>
* Postgres.m: An SQL exception/error should not automatically
disconnect.
2014-09-10 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m:
Fix error in [-setUser:] ... was checking wrong instance variable
to see if the user changed.
2014-08-09 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Redesign merging to give control over the number of statements
merged and to make merging an attribute of the transaction
rather than something done by a specific method.
2014-08-08 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Add merging of insert/update statements in a transaction.
2014-07-17 Yavor Doganov <yavor@gnu.org>
Install bundles in a versioned directory.
* GNUmakefile (BUNDLE_INSTALL_DIR): Append the interface version.
* GNUmakefile.preamble (ADDITIONAL_CPPFLAGS): Define.
* SQLClient.m (-_configure:): Load bundles from the versioned
directory.
2014-07-11 Yavor Doganov <yavor@gnu.org>
* GNUmakefile (SQLClient_LIBRARIES_DEPEND_UPON): Add $(FND_LIBS)
and $(OBJC_LIBS).
2014-06-20 Richard Frith-Macdonald <rfm@gnu.org>
* GNUmakefile: bump version to 1.8.0 for next release (will break
binary compatibility due to changes for pools adding ivars).
2014-06-20 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h: Add SQLClientPool, new method to check idle clients
and new initialiser.
* SQLClient.m: Changes to support pools of clients and permit a pool
to contain multiple clients with the same config.
* SQLClientPool.m: new class to provide a pool of clients with the
same config.
2014-05-27 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h: Warn about not using the database inside a
notification handler.
* Postgres.m: Add locking around database operations caused
by asynchronous arrival of a notification.
* GNUmakefile: new subminor version for bugfix release
* Version 1.7.3: released
2014-05-19 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: More locking to try to protect all access to the
database connection.
* GNUmakefile: new subminor version for bugfix release
* Version 1.7.2: released
2014-05-13 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m:
Fix tiny window in which a connection could be unlocked yet have
the flag set to say it is in a transaction (thus potentially
allowing a locking consistency error).
Add locking to protect setting/changing configuration.
2014-05-08 Richard Frith-Macdonald <rfm@gnu.org>
* GNUmakefile: new subminor version for bugfix release
* Version 1.7.1: released
2014-04-12 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m:
Fix error removing database observer when last name is removed.
2014-03-05 Wolfgang Lux <wolfgang.lux@gmail.com>
* Postgres.m (backendExecute:):
Fix incorrect comparison operator.
2014-02-21 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Add mutable copy implementation so that set and dictionary builders
can be used by caching queries without raising an exception ... the
mutable copy of the helper's content is what gets cached.
2014-02-15 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Add helper for building counted set from query.
2013-09-06 Richard Frith-Macdonald <rfm@gnu.org>
* Version 1.7.0: released
2013-09-05 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Use NSUInteger for sizeInBytes:
2013-04-10 Richard Frith-Macdonald <rfm@gnu.org>
* ECPG.pgm:
* MySQL.m:
* Oracle.pm:
* Postgres.m:
* SQLClient.h:
* SQLClient.m:
* GNUmakefile:
Change behavior to no longer trim leading and trailing space from
values retrieved from database by default.
Add method to restore automatic trimming for a connection if needed.
2013-03-04 Richard Frith-Macdonald <rfm@gnu.org>
* Version 1.6.1: released
2013-03-04 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h: Add helper classe interfaces.
* SQLClient.m: Add helper classe implementations.
Add performance helper classes for when querying a set of records
containing single values and when querying a dataset which contains
key/value pairs more naturally haqndled as a dictionary than an array.
2013-02-11 Sebastian Reitenbach <sebastia@l00-bugdead-prods.de>
* ECPG.pgm
* testECPG.m
* testMySQL.m
* testSQLite.m
use PRIuPTR to NSLog NSUIntegers
2013-01-31 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Check for -disconnect being called when inside a
transaction and handle locking properly in that case.
Change simple execute and query methods so they don't call -debug:
inside locked regions, in case the method has been overridden to
do something not safe in such locked sections (such as trying a
query in another thread to report extra debug info).
2012-11-29 Richard Frith-Macdonald <rfm@gnu.org>
* Wrap more code in exception handlers where there is any potential
for an exception in a lock protected region.
2012-11-10 Niels Grewe <niels.grewe@halbordnung.de>
* GNUmakefile: Link against $(FND_LIBS) and $(OBJC_LIBS) instead
of -lgnustep-base and -lobjc.
2012-10-22 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* Postgres.m:
* GNUmakefile:
Add support for asynchronous notifications and bump version number.
2012-10-18 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
* ECPG.pgm:
* MySQL.m:
* Postgres.m:
* Oracle.pm:
* SQLite.m:
* JDBC.m:
* testPostgres.m:
Change execute methods to return a count of the rows to which the
executed operation applies, or -1 if not supported.
Implement for postgresql and mysql.
2012-06-17 Richard Frith-Macdonald <rfm@gnu.org>
* Improve check for compatibility of transactions between clients.
2011-09-30 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: try to use pg_config if available.
* configure: regenerate
* Postgres.m: Fix to handle new bytea with \x format
* GNUmakefile: Bump to 1.5.3
2011-04-01 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Cleanup locking on -begin/-commit/-rollback

252
ECPG.pgm
View file

@ -111,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];
}
}
@ -248,7 +248,7 @@ static NSDate *future = nil;
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
EXEC SQL BEGIN DECLARE SECTION;
char *statement;
@ -332,6 +332,7 @@ static NSDate *future = nil;
}
NS_ENDHANDLER
[arp release];
return -1;
}
static unsigned int trim(char *str)
@ -556,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;
@ -585,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)
@ -939,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;
@ -964,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

View file

@ -18,10 +18,14 @@ 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.5.2
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
@ -34,10 +38,10 @@ TEST_TOOL_NAME=
LIBRARY_NAME=SQLClient
DOCUMENT_NAME=SQLClient
SQLClient_INTERFACE_VERSION=1.5
SQLClient_INTERFACE_VERSION=1.9
SQLClient_OBJC_FILES = SQLClient.m
SQLClient_LIBRARIES_DEPEND_UPON = -lPerformance
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="";}'
@ -49,7 +53,7 @@ SQLClient_HEADER_FILES_INSTALL_DIR = SQLClient
BUNDLE_NAME=
BUNDLE_INSTALL_DIR=$(GNUSTEP_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
@ -81,7 +85,7 @@ BUNDLE_NAME += ECPG_libs
ECPG_libs_OBJC_FILES = ECPG.m
ECPG_libs_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
ECPG_libs_BUNDLE_LIBS += -lSQLClient -lPerformance \
-lgnustep-base -lobjc -lecpg
$(FND_LIBS) $(OBJC_LIBS) -lecpg
ECPG_libs_PRINCIPAL_CLASS = SQLClientECPG_libs
endif
TEST_TOOL_NAME += testECPG
@ -107,7 +111,7 @@ BUNDLE_NAME += Postgres_libs
Postgres_libs_OBJC_FILES = Postgres.m
Postgres_libs_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
Postgres_libs_BUNDLE_LIBS += -lSQLClient -lPerformance \
-lgnustep-base -lobjc -lpq
$(FND_LIBS) $(OBJC_LIBS) -lpq
Postgres_libs_PRINCIPAL_CLASS = SQLClientPostgres_libs
endif
TEST_TOOL_NAME += testPostgres
@ -133,7 +137,7 @@ 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 \
-lgnustep-base -lobjc $(JDBC_VM_LIBS)
$(FND_LIBS) $(OBJC_LIBS) $(JDBC_VM_LIBS)
JDBC_libs_PRINCIPAL_CLASS = SQLClientJDBC_libs
endif
TEST_TOOL_NAME += testJDBC
@ -159,7 +163,7 @@ BUNDLE_NAME += MySQL_libs
MySQL_libs_OBJC_FILES = MySQL.m
MySQL_libs_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
MySQL_libs_BUNDLE_LIBS += -lSQLClient -lPerformance \
-lgnustep-base -lobjc -lmysqlclient
$(FND_LIBS) $(OBJC_LIBS) -lmysqlclient
MySQL_libs_PRINCIPAL_CLASS = SQLClientMySQL_libs
endif
TEST_TOOL_NAME += testMySQL
@ -185,7 +189,7 @@ BUNDLE_NAME += SQLite_libs
SQLite_libs_OBJC_FILES = SQLite.m
SQLite_libs_LIB_DIRS = -L./$(GNUSTEP_OBJ_DIR)
SQLite_libs_BUNDLE_LIBS += -lSQLClient -lPerformance \
-lgnustep-base -lobjc -lsqlite3
$(FND_LIBS) $(OBJC_LIBS) -lsqlite3
SQLite_libs_PRINCIPAL_CLASS = SQLClientSQLite_libs
endif
TEST_TOOL_NAME += testSQLite
@ -208,7 +212,7 @@ Oracle_libs_OBJC_FILES = Oracle.m
Oracle_libs_LIB_DIRS = -L$(ORACLE_HOME)/lib -L./$(GNUSTEP_OBJ_DIR) \
$(shell cat $(ORACLE_HOME)/lib/ldflags)
Oracle_libs_BUNDLE_LIBS += -lclntsh \
-lSQLClient -lPerformance -lgnustep-base -lobjc \
-lSQLClient -lPerformance $(FND_LIBS) $(OBJC_LIBS) \
$(shell cat $(ORACLE_HOME)/lib/sysliblist) \
-ldl -lm
Oracle_libs_PRINCIPAL_CLASS = SQLClientOracle_libs

View file

@ -66,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 +=

59
JDBC.m
View file

@ -30,6 +30,7 @@
#import <Foundation/NSCharacterSet.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDate.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSException.h>
#import <Foundation/NSLock.h>
#import <Foundation/NSMapTable.h>
@ -1129,7 +1130,7 @@ static int JDBCVARCHAR = 0;
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSString *stmt = [info objectAtIndex: 0];
@ -1234,6 +1235,7 @@ static int JDBCVARCHAR = 0;
}
NS_ENDHANDLER
[arp release];
return -1;
}
- (NSMutableArray*) backendQuery: (NSString*)stmt
@ -1520,7 +1522,7 @@ static int JDBCVARCHAR = 0;
transaction = (_JDBCTransaction*)NSAllocateObject([_JDBCTransaction class], 0,
NSDefaultMallocZone());
transaction->_db = [self retain];
transaction->_owner = [self retain];
transaction->_info = [NSMutableArray new];
transaction->_batch = YES;
transaction->_stop = stopOnFailure;
@ -1679,7 +1681,7 @@ static int JDBCVARCHAR = 0;
transaction = (_JDBCTransaction*)NSAllocateObject([_JDBCTransaction class], 0,
NSDefaultMallocZone());
transaction->_db = [self retain];
transaction->_owner = [self retain];
transaction->_info = [NSMutableArray new];
return [(SQLTransaction*)transaction autorelease];
}
@ -1727,21 +1729,13 @@ static int JDBCVARCHAR = 0;
if (_count > 0)
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
SQLClientPool *pool;
SQLClient *db;
BOOL wrapped = NO;
BOOL batched = NO;
JNIEnv *env;
JInfo *ji;
/*
* Ensure we have a working connection.
*/
if ([_db connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to execute transaction %@",
[_db name], self];
}
env = SQLClientJNIEnv();
if ((*env)->PushLocalFrame (env, 32) < 0)
{
@ -1751,16 +1745,38 @@ static int JDBCVARCHAR = 0;
format: @"No java memory for execute"];
}
ji = [(SQLClientJDBC*)_db _backendExtra];
if ([_owner isKindOfClass: [SQLClientPool class]])
{
pool = (SQLClientPool*)_owner;
db = [pool provideClient];
}
else
{
pool = nil;
db = _owner;
}
ji = [(SQLClientJDBC*)db _backendExtra];
NS_DURING
{
NSMutableArray *statements;
unsigned numberOfStatements;
unsigned statement;
NSTimeInterval _duration = [_db durationLogging];
NSTimeInterval _duration;
NSTimeInterval start = 0.0;
/*
* Ensure we have a working connection.
*/
if ([db connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to execute transaction %@",
[_owner name], self];
}
_duration = [db durationLogging];
statements = [NSMutableArray arrayWithCapacity: 100];
[self _merge: statements];
numberOfStatements = [statements count];
@ -1770,7 +1786,7 @@ static int JDBCVARCHAR = 0;
start = GSTickerTimeNow();
}
if ([_db isInTransaction] == NO)
if ([db isInTransaction] == NO)
{
wrapped = YES;
}
@ -1882,15 +1898,15 @@ static int JDBCVARCHAR = 0;
(*env)->PopLocalFrame (env, NULL);
_db->_lastOperation = GSTickerTimeNow();
db->_lastOperation = GSTickerTimeNow();
if (_duration >= 0)
{
NSTimeInterval d;
d = _db->_lastOperation - start;
d = db->_lastOperation - start;
if (d >= _duration)
{
[_db debug: @"Duration %g for transaction %@",
[db debug: @"Duration %g for transaction %@",
d, statements];
}
}
@ -1912,6 +1928,11 @@ static int JDBCVARCHAR = 0;
}
NS_ENDHANDLER
if (nil != pool)
{
[pool swallowClient: db];
}
[arp release];
}
}

16
MySQL.m
View file

@ -173,9 +173,10 @@ static NSNull *null = nil;
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
NSString *stmt;
NSInteger rowCount = 0;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
stmt = [info objectAtIndex: 0];
@ -225,6 +226,9 @@ static NSNull *null = nil;
[NSException raise: SQLConnectionException format: @"%@", s];
}
}
/* See how many rows were modified.
*/
rowCount = mysql_affected_rows(connection);
/* discard any results.
*/
result = mysql_store_result(connection);
@ -258,6 +262,7 @@ static NSNull *null = nil;
}
NS_ENDHANDLER
[arp release];
return rowCount;
}
static unsigned int trim(char *str)
@ -285,8 +290,8 @@ static unsigned int trim(char *str)
}
- (NSMutableArray*) backendQuery: (NSString*)stmt
recordType: (Class)rtype
listType: (Class)ltype
recordType: (id)rtype
listType: (id)ltype
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSMutableArray *records = nil;
@ -429,7 +434,10 @@ static unsigned int trim(char *str)
break;
default:
trim((char*)p);
if (YES == _shouldTrim)
{
trim((char*)p);
}
v = [NSString stringWithUTF8String: (char*)p];
break;
}

249
Oracle.pm
View file

@ -216,7 +216,7 @@ void SQLClientOracleErrorHandler()
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
EXEC SQL BEGIN DECLARE SECTION;
char *statement;
@ -300,6 +300,7 @@ void SQLClientOracleErrorHandler()
}
NS_ENDHANDLER
DESTROY(arp);
return -1;
}
static unsigned int trim(char *str)
@ -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': '%@'",
@ -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;
}
/**

1685
Postgres.m

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -72,7 +72,7 @@
"add:with:",
"append:",
"count",
"db",
"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

View file

@ -1,6 +1,6 @@
/* -*-objc-*- */
/** Implementation of SQLClientPostgres for GNUStep
/** Implementation of SQLClientSQLite for GNUStep
Copyright (C) 2005 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
@ -132,7 +132,7 @@
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
NSString *stmt;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
@ -197,6 +197,7 @@
}
NS_ENDHANDLER
[arp release];
return -1;
}
- (NSMutableArray*) backendQuery: (NSString*)stmt

1326
config.guess vendored

File diff suppressed because it is too large Load diff

1451
config.sub vendored

File diff suppressed because it is too large Load diff

6123
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,11 @@ 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
@ -63,6 +68,17 @@ 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
# Call AC_CHECK_HEADERS here as a workaround for a configure bug/feature
@ -186,42 +202,41 @@ if test "$ac_cv_mysql_bundle" = "no"; then
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 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"
AC_CHECK_HEADERS(mysql/mysql.h)
if test "$ac_cv_header_mysql_mysql_h" = "yes"; then
MYSQL=yes
else
if test -d /usr/local/lib/mysql ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/lib/mysql"
LIBD="$LIBD -L/usr/local/lib/mysql"
MYSQL=
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/mysql/lib ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/mysql/lib"
LIBD="$LIBD -L/usr/local/mysql/lib"
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
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 "******************************************************"
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)
fi
AC_MSG_CHECKING([if Sqllite support was manually disabled])
AC_ARG_ENABLE(sqllite-bundle, [
@ -239,28 +254,27 @@ if test "$ac_cv_sqllite_bundle" = "no"; then
else
AC_MSG_RESULT([no: build if possible])
AC_CHECK_HEADERS(sqlite3.h)
if test "$ac_cv_header_sqlite3_h" = "yes"; then
SQLITE=yes
else
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
AC_CHECK_HEADERS(sqlite3.h)
if test "$ac_cv_header_sqlite3_h" = "yes"; then
SQLITE=yes
else
SQLITE=
echo "******************************************************"
echo "Unable to locate sqlite3 library (is it installed)"
echo "******************************************************"
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)
fi
AC_MSG_CHECKING([if Postgres support was manually disabled])
AC_ARG_ENABLE(postgres-bundle, [
--disable-postgres-bundle
@ -277,163 +291,211 @@ if test "$ac_cv_postgres_bundle" = "no"; then
else
AC_MSG_RESULT([no: build if possible])
# Start POSTGRES checks
POSTGRES=
# 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 "$ECPG" = ""; then
AC_CHECK_HEADERS(ecpglib.h)
if test "$ac_cv_header_ecpglib_h" = "yes"; then
ECPG=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 "$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 "$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 "$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 "$POSTGRES" = ""; then
AC_CHECK_HEADERS(/usr/include/pgsql/libpq-fe.h)
CPPFLAGS="$save_CPPFLAGS"
if test "$ac_cv_header__usr_include_pgsql_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/include/pgsql"
POSTGRES=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 "$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 "$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 "$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 "$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 "$POSTGRES" = ""; then
echo "**************************************************************"
echo "Unable to locate libpq (postgres) headers (are they installed)"
echo "**************************************************************"
fi
if test "$ECPG" = ""; then
echo "*************************************************************"
echo "Unable to locate ecpg (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
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
if test "$POSTGRES" = ""; then
AC_CHECK_HEADERS(libpq-fe.h)
if test "$ac_cv_header_libpq_fe_h" = "yes"; then
POSTGRES=yes
fi
fi
AC_CHECK_LIB(pq,PQfformat)
if test "$ac_cv_lib_pq_PQfformat" != "yes"; then
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="$save_CPPFLAGS"
if test "$ac_cv_header__usr_include_pgsql_libpq_fe_h" = "yes"; then
INCD="$INCD -I/usr/include/pgsql"
POSTGRES=yes
fi
fi
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
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)
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
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 "********************************************************"
else
AC_CHECK_FUNCS(PQescapeStringConn)
fi
fi
# End POSTGRES checks
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)

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

@ -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
{

View file

@ -125,7 +125,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],
@ -242,7 +242,7 @@ main()
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");
sleep(2);
[NSThread sleepForTimeInterval: 2.0];
records = [db cache: 1 query: @"select * from xxx", nil];
NSCAssert([r0 lastObject] != [records lastObject], @"Lifetime failed");
@ -250,7 +250,7 @@ main()
if ([records count] != 3)
{
NSLog(@"Expected 3 records but got %u", [records count]);
NSLog(@"Expected 3 records but got %"PRIuPTR, [records count]);
}
else
{

View file

@ -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
{

View file

@ -42,6 +42,7 @@ int
main()
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClientPool *sp;
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
@ -68,7 +69,74 @@ 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
@ -92,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:
@ -120,15 +188,27 @@ main()
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];
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;)
{
@ -145,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],
@ -188,11 +268,18 @@ 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\r\nd'\\ed\\";
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++)
{
@ -209,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, "
@ -243,9 +363,9 @@ main()
[NSData dataWithBytes: "" length: 0],
@")",
nil];
[db execute: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values (",
[db execute: @"INSERT into xxx "
@"(id, k, char1, boolval, intval, when1, when2, b) "
@"values (3,",
[db quote: oddChars],
@", ",
[db quote: nonLatin],
@ -258,21 +378,31 @@ main()
nil];
[db commit];
r0 = [db cache: 1 query: @"select * from xxx", nil];
r1 = [db cache: 1 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");
sleep(2);
records = [db cache: 1 query: @"select * from xxx", nil];
[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] != 3)
{
NSLog(@"Expected 3 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)
{
@ -289,15 +419,99 @@ main()
{
NSLog(@"Retrieved non-latin does not match saved string");
}
if ([[record objectForKey: @"k"] isEqual: oddChars] == NO)
id o = [[record objectForKey: @"k"] stringByTrimmingSpaces];
if ([o isEqual: oddNoNul] == NO)
{
NSLog(@"Retrieved odd chars does not match saved string");
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 - %@", [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);
}
NSLog(@"Pool stats:\n%@", [sp statistics]);
[pool release];
return 0;
}

View file

@ -91,8 +91,8 @@ main()
[db execute: @"insert into xxx "
@"(k, char1, intval, realval, b) "
@"values ("
@"'hello', "
@"values (",
[db quoteString: @"hello"], @", "
@"'X', "
@"1, ",
@"12345.6789, ",
@ -104,7 +104,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
{