Compare commits

...

332 commits

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


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


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


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


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


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


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


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


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

OK Richard



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36111 72102866-910b-0410-8b05-ffd578937521
2013-02-11 16:05:47 +00:00
Richard Frith-MacDonald
a4ec0e036b update for objc2
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36095 72102866-910b-0410-8b05-ffd578937521
2013-02-09 11:34:01 +00:00
Richard Frith-MacDonald
2e84577b69 fixes for potential locking issues.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36047 72102866-910b-0410-8b05-ffd578937521
2013-01-31 09:04:35 +00:00
Richard Frith-MacDonald
1f11ea97a9 lock safety fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35832 72102866-910b-0410-8b05-ffd578937521
2012-11-29 11:40:04 +00:00
Richard Frith-MacDonald
1fdb15cfb0 warning to take care with singletons method
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35796 72102866-910b-0410-8b05-ffd578937521
2012-11-15 18:16:24 +00:00
Niels Grewe
e455a6d65b Don't use -lobjc -lgnustep-base, use $(FND_LIBS) and $(OBJC_LIBS) instead.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35788 72102866-910b-0410-8b05-ffd578937521
2012-11-10 13:33:39 +00:00
Richard Frith-MacDonald
11194d702d improve error message handling
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35771 72102866-910b-0410-8b05-ffd578937521
2012-10-31 10:20:50 +00:00
Richard Frith-MacDonald
85d5fbfecf fix missing header
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35755 72102866-910b-0410-8b05-ffd578937521
2012-10-28 11:36:18 +00:00
Richard Frith-MacDonald
5db99986be Support for async notifications in Postgres
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35732 72102866-910b-0410-8b05-ffd578937521
2012-10-22 15:57:56 +00:00
Richard Frith-MacDonald
3be013e271 tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35723 72102866-910b-0410-8b05-ffd578937521
2012-10-19 18:51:51 +00:00
Richard Frith-MacDonald
940b3a5fd1 improved execute
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35722 72102866-910b-0410-8b05-ffd578937521
2012-10-19 18:41:36 +00:00
Richard Frith-MacDonald
383478b346 improve transaction compatibility check
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35206 72102866-910b-0410-8b05-ffd578937521
2012-06-17 14:57:48 +00:00
Richard Frith-MacDonald
306bdeb027 NSUInteger updates
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@34447 72102866-910b-0410-8b05-ffd578937521
2012-01-06 16:03:51 +00:00
Richard Frith-MacDonald
e72041ce6c avoid compiler warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@34446 72102866-910b-0410-8b05-ffd578937521
2012-01-06 15:42:02 +00:00
Richard Frith-MacDonald
f47e5833e6 tweak for 64bit and use of NSUInteger
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@34445 72102866-910b-0410-8b05-ffd578937521
2012-01-06 15:39:11 +00:00
Richard Frith-MacDonald
b00d51e017 mkae version 1.5.3
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@33914 72102866-910b-0410-8b05-ffd578937521
2011-09-30 17:21:04 +00:00
Richard Frith-MacDonald
837ddf035f locking cleanups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@33842 72102866-910b-0410-8b05-ffd578937521
2011-09-16 07:25:33 +00:00
Richard Frith-MacDonald
10a8ac3164 bump version number
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@32750 72102866-910b-0410-8b05-ffd578937521
2011-04-01 04:09:40 +00:00
Richard Frith-MacDonald
6543cd6314 declare a few needed classes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@32005 72102866-910b-0410-8b05-ffd578937521
2011-02-07 15:42:58 +00:00
Richard Frith-MacDonald
e54505f057 remove unnecessary includes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@32004 72102866-910b-0410-8b05-ffd578937521
2011-02-07 15:35:50 +00:00
Nicola Pero
1d4fdce501 Fixed rebuilding the library; nothing should happen if you type 'make' in an already-built directory
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@31615 72102866-910b-0410-8b05-ffd578937521
2010-11-17 15:21:11 +00:00
Richard Frith-MacDonald
c252834070 warn if gnustep-make not found
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@31316 72102866-910b-0410-8b05-ffd578937521
2010-09-10 14:00:05 +00:00
Richard Frith-MacDonald
6fe56d2e1e mysql fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@31131 72102866-910b-0410-8b05-ffd578937521
2010-08-13 13:20:06 +00:00
Richard Frith-MacDonald
e307f93142 fixup error parsing date/time
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@31128 72102866-910b-0410-8b05-ffd578937521
2010-08-13 11:28:26 +00:00
Richard Frith-MacDonald
ba81d9f082 MySQL fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@30982 72102866-910b-0410-8b05-ffd578937521
2010-07-16 14:49:55 +00:00
Richard Frith-MacDonald
2f54d889e4 check for mysqlclient library in more places
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@30977 72102866-910b-0410-8b05-ffd578937521
2010-07-16 10:04:59 +00:00
Richard Frith-MacDonald
72ca578ca0 minor cleanups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29641 72102866-910b-0410-8b05-ffd578937521
2010-02-15 11:52:59 +00:00
Richard Frith-MacDonald
1006966504 Fixup for postgres change
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29442 72102866-910b-0410-8b05-ffd578937521
2010-01-29 13:36:01 +00:00
Richard Frith-MacDonald
1b88d7bb36 Note changes for snow leopard
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29035 72102866-910b-0410-8b05-ffd578937521
2009-11-18 11:26:22 +00:00
Richard Frith-MacDonald
543cb6d43b fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29034 72102866-910b-0410-8b05-ffd578937521
2009-11-18 11:25:01 +00:00
Richard Frith-MacDonald
9c041a164a snow leopard porting
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29033 72102866-910b-0410-8b05-ffd578937521
2009-11-18 11:11:29 +00:00
Richard Frith-MacDonald
30edde0a7a improve test for gnustep make
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29032 72102866-910b-0410-8b05-ffd578937521
2009-11-18 07:58:28 +00:00
Richard Frith-MacDonald
cc233b6ba0 log notifications
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28896 72102866-910b-0410-8b05-ffd578937521
2009-10-27 12:42:10 +00:00
Richard Frith-MacDonald
258efaeaf7 Try to get notifications sent properly.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28895 72102866-910b-0410-8b05-ffd578937521
2009-10-27 12:34:41 +00:00
Richard Frith-MacDonald
799c2de9f2 workaround autoconf bug
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28763 72102866-910b-0410-8b05-ffd578937521
2009-10-02 18:34:28 +00:00
Richard Frith-MacDonald
ae4c868169 add convenience method
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28691 72102866-910b-0410-8b05-ffd578937521
2009-09-16 08:59:59 +00:00
Richard Frith-MacDonald
b3a84626e6 get makefiles location
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28682 72102866-910b-0410-8b05-ffd578937521
2009-09-15 09:03:16 +00:00
Richard Frith-MacDonald
f71418098c fixup transaction execution context for retrying batch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28630 72102866-910b-0410-8b05-ffd578937521
2009-09-08 09:59:05 +00:00
Richard Frith-MacDonald
0023174259 Tweak for improved logging
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28629 72102866-910b-0410-8b05-ffd578937521
2009-09-08 08:17:09 +00:00
Richard Frith-MacDonald
306b48c2bf Transaction manipulation methods added.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28628 72102866-910b-0410-8b05-ffd578937521
2009-09-08 08:05:31 +00:00
Richard Frith-MacDonald
2e858a3b55 Improve debug logging
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28319 72102866-910b-0410-8b05-ffd578937521
2009-06-02 17:20:00 +00:00
Richard Frith-MacDonald
64abeac596 Improve exception text.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28281 72102866-910b-0410-8b05-ffd578937521
2009-05-11 14:33:05 +00:00
24 changed files with 13684 additions and 10295 deletions

1327
ChangeLog

File diff suppressed because it is too large Load diff

306
ECPG.pgm
View file

@ -40,6 +40,9 @@
#include <Foundation/NSAutoreleasePool.h>
#include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h"
@interface SQLClientECPG : SQLClient
@ -108,18 +111,18 @@ void SQLErrorHandler()
const char *e1 = "Error in transaction processing";
sqlca.sqlcode = 0; // Reset error code
NSLog (@"Raising an exception, %ld, %s", code, sqlca.sqlerrm.sqlerrmc);
NSLog (@"Raising an exception, %d, %s", code, sqlca.sqlerrm.sqlerrmc);
if (strncmp(ptr, e0, strlen(e0)) == 0
|| strncmp(ptr, e1, strlen(e1)) == 0)
{
[NSException raise: SQLConnectionException
format: @"SQL Error: SQLCODE=(%ld): %s", code, ptr];
format: @"SQL Error: SQLCODE=(%d): %s", code, ptr];
}
else
{
[NSException raise: SQLException
format: @"SQL Error: SQLCODE=(%ld): %s", code, ptr];
format: @"SQL Error: SQLCODE=(%d): %s", code, ptr];
}
}
@ -134,7 +137,7 @@ static NSDate *future = nil;
future = [NSCalendarDate dateWithString: @"9999-01-01 00:00:00 +0000"
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"
locale: nil];
RETAIN(future);
[future retain];
}
}
@ -245,20 +248,20 @@ static NSDate *future = nil;
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
EXEC SQL BEGIN DECLARE SECTION;
char *statement;
char *handle;
EXEC SQL END DECLARE SECTION;
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
unsigned int length;
NSString *stmt = [info objectAtIndex: 0];
length = [stmt length];
if (length == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
@ -276,9 +279,9 @@ static NSDate *future = nil;
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
RELEASE (arp);
[arp release];
[NSException raise: SQLException
format: @"Unable to connect to '%@' to execute statement %@",
[self name], stmt];
@ -296,7 +299,7 @@ static NSDate *future = nil;
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
/*
* remove line number information from database exception message
@ -322,13 +325,14 @@ static NSDate *future = nil;
[self debug: @"Error executing statement:\n%@\n%@",
stmt, localException];
}
RETAIN (localException);
RELEASE (arp);
AUTORELEASE (localException);
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
[arp release];
return -1;
}
static unsigned int trim(char *str)
@ -379,7 +383,7 @@ static unsigned int trim(char *str)
char *query;
char *handle;
EXEC SQL END DECLARE SECTION;
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSMutableArray *records;
BOOL isOpen = NO;
BOOL localTransaction = NO;
@ -387,7 +391,7 @@ static unsigned int trim(char *str)
length = [stmt length];
if (length == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
@ -399,9 +403,9 @@ static unsigned int trim(char *str)
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
RELEASE (arp);
[arp release];
[NSException raise: SQLException
format: @"Unable to connect to '%@' to run query %@",
[self name], stmt];
@ -553,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;
@ -582,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)
@ -603,7 +613,7 @@ static unsigned int trim(char *str)
keys: keys
count: count];
[records addObject: record];
RELEASE(record);
[record release];
}
}
@ -621,7 +631,8 @@ static unsigned int trim(char *str)
NSString *n = [localException name];
NSString *msg = [localException reason];
DESTROY(records);
[records release];
records = nil;
NS_DURING
{
@ -640,14 +651,14 @@ static unsigned int trim(char *str)
if ([e isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
}
NS_ENDHANDLER
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
/*
@ -669,15 +680,15 @@ static unsigned int trim(char *str)
userInfo: nil];
}
}
RETAIN(localException);
RELEASE(arp);
AUTORELEASE(localException);
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
[arp release];
return AUTORELEASE(records);
return [records autorelease];
}
- (unsigned) copyEscapedBLOB: (NSData*)blob into: (void*)buf
@ -935,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;
@ -960,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
@ -1069,8 +1139,8 @@ static unsigned int trim(char *str)
}
d = [[NSData alloc] initWithBytes: b length: l];
s = [[NSString alloc] initWithData: d encoding: NSUTF8StringEncoding];
RELEASE(d);
return AUTORELEASE(s);
[d release];
return [s autorelease];
}
@end

View file

@ -1,9 +1,31 @@
ifeq ($(GNUSTEP_MAKEFILES),)
GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
ifeq ($(GNUSTEP_MAKEFILES),)
$(warning )
$(warning Unable to obtain GNUSTEP_MAKEFILES setting from gnustep-config!)
$(warning Perhaps gnustep-make is not properly installed,)
$(warning so gnustep-config is not in your PATH.)
$(warning )
$(warning Your PATH is currently $(PATH))
$(warning )
endif
endif
ifeq ($(GNUSTEP_MAKEFILES),)
$(error You need to set GNUSTEP_MAKEFILES before compiling!)
endif
include $(GNUSTEP_MAKEFILES)/common.make
# Force sequential build to prevent different versions of the same
# bundle overwriting each other's temporary files during building.
GNUSTEP_MAKE_PARALLEL_BUILDING=no
-include config.make
PACKAGE_NAME = SQLClient
PACKAGE_VERSION = 1.5.0
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
@ -16,12 +38,13 @@ 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="";}'
# Optional Java wrappers for the library
JAVA_WRAPPER_NAME = SQLClient
@ -30,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
@ -62,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
@ -88,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
@ -114,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
@ -140,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
@ -166,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
@ -189,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

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

View file

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

147
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>
@ -45,19 +46,14 @@
#import <Performance/GSTicker.h>
#include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h"
@interface _JDBCTransaction : SQLTransaction
@end
typedef struct {
@defs(SQLClient);
} *CDefs;
typedef struct {
@defs(_JDBCTransaction);
} *TDefs;
#include <jni.h>
static NSString *JDBCException = @"SQLClientJDBCException";
@ -283,7 +279,7 @@ JNIEnv *SQLClientJNIEnv ()
}
{
CREATE_AUTORELEASE_POOL (pool);
NSAutoreleasePool *pool = [NSAutoreleasePool new];
args.version = JNI_VERSION_1_2;
args.name = (char *)[[NSString stringWithFormat:
@ -293,7 +289,7 @@ JNIEnv *SQLClientJNIEnv ()
result = (*SQLClientJavaVM)->AttachCurrentThread
(SQLClientJavaVM, (void **)&env, &args);
RELEASE (pool);
[pool release];
}
if (result < 0)
@ -764,9 +760,9 @@ static int JDBCVARCHAR = 0;
future = [NSCalendarDate dateWithString: @"9999-01-01 00:00:00 +0000"
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"
locale: nil];
RETAIN(future);
[future retain];
null = [NSNull null];
RETAIN(null);
[null retain];
[SQLClientJVM startVirtualMachineWithClassPath: nil libraryPath: nil];
env = SQLClientJNIEnv();
@ -1134,16 +1130,16 @@ static int JDBCVARCHAR = 0;
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSString *stmt = [info objectAtIndex: 0];
JNIEnv *env = SQLClientJNIEnv();
JInfo *ji;
if ([stmt length] == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
@ -1151,7 +1147,7 @@ static int JDBCVARCHAR = 0;
if ((*env)->PushLocalFrame (env, 32) < 0)
{
JExceptionClear(env);
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"No java memory for execute"];
}
@ -1164,7 +1160,7 @@ static int JDBCVARCHAR = 0;
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to execute statement %@",
@ -1232,13 +1228,14 @@ static int JDBCVARCHAR = 0;
stmt, localException];
}
}
RETAIN (localException);
RELEASE (arp);
AUTORELEASE (localException);
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
[arp release];
return -1;
}
- (NSMutableArray*) backendQuery: (NSString*)stmt
@ -1246,13 +1243,13 @@ static int JDBCVARCHAR = 0;
listType: (id)lType
{
NSMutableArray *records = nil;
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
JNIEnv *env = SQLClientJNIEnv();
JInfo *ji;
if ([stmt length] == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
@ -1260,7 +1257,7 @@ static int JDBCVARCHAR = 0;
if ((*env)->PushLocalFrame (env, 32) < 0)
{
JExceptionClear(env);
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"No java memory for query"];
}
@ -1277,7 +1274,7 @@ static int JDBCVARCHAR = 0;
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to run query %@",
@ -1389,7 +1386,7 @@ static int JDBCVARCHAR = 0;
if ((*env)->PushLocalFrame (env, fieldCount * 2) < 0)
{
JExceptionClear(env);
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"No java memory for query"];
}
@ -1480,7 +1477,7 @@ static int JDBCVARCHAR = 0;
keys: keys
count: fieldCount];
[records addObject: record];
RELEASE(record);
[record release];
}
}
else
@ -1498,7 +1495,7 @@ static int JDBCVARCHAR = 0;
(*env)->PopLocalFrame (env, NULL);
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
if ([self debugging] > 0)
{
@ -1506,29 +1503,30 @@ static int JDBCVARCHAR = 0;
stmt, localException];
}
}
DESTROY(records);
RETAIN (localException);
RELEASE (arp);
AUTORELEASE (localException);
[records release];
records = nil;
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
return AUTORELEASE(records);
[arp release];
return [records autorelease];
}
- (SQLTransaction*) batch: (BOOL)stopOnFailure
{
TDefs transaction;
_JDBCTransaction *transaction;
transaction = (TDefs)NSAllocateObject([_JDBCTransaction class], 0,
transaction = (_JDBCTransaction*)NSAllocateObject([_JDBCTransaction class], 0,
NSDefaultMallocZone());
transaction->_db = RETAIN(self);
transaction->_owner = [self retain];
transaction->_info = [NSMutableArray new];
transaction->_batch = YES;
transaction->_stop = stopOnFailure;
return AUTORELEASE((SQLTransaction*)transaction);
return [(SQLTransaction*)transaction autorelease];
}
- (void) begin
@ -1579,7 +1577,7 @@ static int JDBCVARCHAR = 0;
- (void) dealloc
{
[self backendDisconnect];
[self disconnect];
[super dealloc];
}
@ -1602,15 +1600,15 @@ static int JDBCVARCHAR = 0;
length: 3
encoding: NSASCIIStringEncoding];
special = [NSCharacterSet characterSetWithCharactersInString: stemp];
RELEASE(stemp);
RETAIN(special);
[stemp release];
[special retain];
}
/*
* Step through string removing nul characters
* and escaping quote characters as required.
*/
m = AUTORELEASE([s mutableCopy]);
m = [[s mutableCopy] autorelease];
l = [m length];
r = NSMakeRange(0, l);
r = [m rangeOfCharacterFromSet: special options: NSLiteralSearch range: r];
@ -1678,14 +1676,14 @@ static int JDBCVARCHAR = 0;
- (SQLTransaction*) transaction
{
TDefs transaction;
_JDBCTransaction *transaction;
transaction = (TDefs)NSAllocateObject([_JDBCTransaction class], 0,
transaction = (_JDBCTransaction*)NSAllocateObject([_JDBCTransaction class], 0,
NSDefaultMallocZone());
transaction->_db = RETAIN(self);
transaction->_owner = [self retain];
transaction->_info = [NSMutableArray new];
return AUTORELEASE((SQLTransaction*)transaction);
return [(SQLTransaction*)transaction autorelease];
}
@end
@ -1730,41 +1728,55 @@ static int JDBCVARCHAR = 0;
{
if (_count > 0)
{
CREATE_AUTORELEASE_POOL(arp);
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 backendConnect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to execute transaction %@",
[_db name], self];
}
env = SQLClientJNIEnv();
if ((*env)->PushLocalFrame (env, 32) < 0)
{
JExceptionClear(env);
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
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];
@ -1774,7 +1786,7 @@ static int JDBCVARCHAR = 0;
start = GSTickerTimeNow();
}
if ([_db isInTransaction] == NO)
if ([db isInTransaction] == NO)
{
wrapped = YES;
}
@ -1886,15 +1898,15 @@ static int JDBCVARCHAR = 0;
(*env)->PopLocalFrame (env, NULL);
((CDefs)_db)->_lastOperation = GSTickerTimeNow();
db->_lastOperation = GSTickerTimeNow();
if (_duration >= 0)
{
NSTimeInterval d;
d = ((CDefs)_db)->_lastOperation - start;
d = db->_lastOperation - start;
if (d >= _duration)
{
[_db debug: @"Duration %g for transaction %@",
[db debug: @"Duration %g for transaction %@",
d, statements];
}
}
@ -1916,7 +1928,12 @@ static int JDBCVARCHAR = 0;
}
NS_ENDHANDLER
RELEASE(arp);
if (nil != pool)
{
[pool swallowClient: db];
}
[arp release];
}
}

231
MySQL.m
View file

@ -24,21 +24,25 @@
$Date$ $Revision$
*/
#import <Foundation/NSString.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDate.h>
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSException.h>
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSNotification.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSMapTable.h>
#import <Foundation/NSLock.h>
#import <Foundation/NSMapTable.h>
#import <Foundation/NSNotification.h>
#import <Foundation/NSNull.h>
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSString.h>
#import <Foundation/NSTimeZone.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSAutoreleasePool.h>
#include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h"
#include <mysql/mysql.h>
@ -58,12 +62,12 @@ static NSNull *null = nil;
{
if (future == nil)
{
future = [NSCalendarDate dateWithString: @"9999-01-01 00:00:00 +0000"
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"
future = [NSCalendarDate dateWithString: @"9999-01-01 00:00:00"
calendarFormat: @"%Y-%m-%d %H:%M:%S"
locale: nil];
RETAIN(future);
[future retain];
null = [NSNull null];
RETAIN(null);
[null retain];
}
}
@ -97,9 +101,11 @@ static NSNull *null = nil;
if ([self debugging] > 0)
{
[self debug: @"Connect to '%@' as %@", [self database], [self name]];
[self debug: @"Connect to '%@' as %@",
[self database], [self name]];
}
extra = mysql_init(0);
mysql_options(connection, MYSQL_SET_CHARSET_NAME, "utf8");
if (mysql_real_connect(connection,
[host UTF8String],
[[self user] UTF8String],
@ -107,23 +113,13 @@ static NSNull *null = nil;
[dbase UTF8String],
[port intValue],
NULL,
0
) == 0)
CLIENT_MULTI_STATEMENTS) == 0)
{
[self debug: @"Error connecting to '%@' (%@) - %s",
[self name], [self database], mysql_error(connection)];
mysql_close(connection);
extra = 0;
}
#if 0
else if (mysql_query(connection, "SET CHARACTER SET utf8") != 0)
{
[self debug: @"Error setting utf8 support for '%@' (%@) - %s",
[self name], [self database], mysql_error(connection)];
mysql_close(connection);
extra = 0;
}
#endif
else
{
connected = YES;
@ -177,28 +173,30 @@ static NSNull *null = nil;
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
NSString *stmt;
CREATE_AUTORELEASE_POOL(arp);
NSString *stmt;
NSInteger rowCount = 0;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
stmt = [info objectAtIndex: 0];
if ([stmt length] == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
NS_DURING
{
MYSQL_RES *result;
const char *statement;
unsigned length;
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to execute statement %@",
@ -216,8 +214,32 @@ static NSNull *null = nil;
if (mysql_real_query(connection, statement, length) != 0)
{
[NSException raise: SQLException format: @"%s",
mysql_error(connection)];
NSString *s;
s = [NSString stringWithFormat: @"%s", mysql_error(connection)];
if (mysql_ping(connection) == 0)
{
[NSException raise: SQLException format: @"%@", s];
}
else
{
[NSException raise: SQLConnectionException format: @"%@", s];
}
}
/* See how many rows were modified.
*/
rowCount = mysql_affected_rows(connection);
/* discard any results.
*/
result = mysql_store_result(connection);
if (result != 0) mysql_free_result(result);
while (mysql_more_results(connection))
{
if (mysql_next_result(connection) == 0)
{
result = mysql_store_result(connection);
if (result != 0) mysql_free_result(result);
}
}
}
NS_HANDLER
@ -226,20 +248,21 @@ static NSNull *null = nil;
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
if ([self debugging] > 0)
{
[self debug: @"Error executing statement:\n%@\n%@",
stmt, localException];
}
RETAIN (localException);
RELEASE (arp);
AUTORELEASE (localException);
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
[arp release];
return rowCount;
}
static unsigned int trim(char *str)
@ -267,16 +290,16 @@ static unsigned int trim(char *str)
}
- (NSMutableArray*) backendQuery: (NSString*)stmt
recordType: (Class)rtype
listType: (Class)ltype
recordType: (id)rtype
listType: (id)ltype
{
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSMutableArray *records = nil;
MYSQL_RES *result = 0;
if ([stmt length] == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
@ -288,7 +311,7 @@ static unsigned int trim(char *str)
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to run query %@",
@ -338,60 +361,55 @@ static unsigned int trim(char *str)
{
case FIELD_TYPE_TIMESTAMP:
{
char b[32];
NSString *f;
NSString *s;
s = [[NSString alloc] initWithBytes: p
length: size encoding: NSASCIIStringEncoding];
if (size > 14)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S"
locale: nil];
size = 19;
f = @"%Y-%m-%d %H:%M:%S %z";
}
else if (size == 14)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y%m%d%H%M%S"
locale: nil];
f = @"%Y%m%d%H%M%S %z";
}
else if (size == 12)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y%m%d%H%M%S"
locale: nil];
f = @"%y%m%d%H%M%S %z";
}
else if (size == 10)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y%m%d%H%M"
locale: nil];
f = @"%y%m%d%H%M %z";
}
else if (size == 8)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y%m%d%H"
locale: nil];
f = @"%y%m%d%H %z";
}
else if (size == 6)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y%m%d"
locale: nil];
f = @"%y%m%d %z";
}
else if (size == 4)
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y%m"
locale: nil];
f = @"%y%m %z";
}
else
{
v = [NSCalendarDate dateWithString: s
calendarFormat: @"%y"
locale: nil];
f = @"%y %z";
}
RELEASE(s);
strncpy(b, (char*)p, size);
strncpy(b + size, (char*)" +0000", 6);
s = [[NSString alloc] initWithBytes: b
length: size + 6
encoding: NSASCIIStringEncoding];
v = [NSCalendarDate dateWithString: s
calendarFormat: f
locale: nil];
[v setCalendarFormat: @"%Y-%m-%d %H:%M:%S %z"];
if ([self debugging] > 1)
[self debug: @"Parsed '%@' as '%@'\n", s, v];
[s release];
}
break;
@ -403,11 +421,23 @@ static unsigned int trim(char *str)
case FIELD_TYPE_TINY_BLOB:
case FIELD_TYPE_MEDIUM_BLOB:
case FIELD_TYPE_LONG_BLOB:
v = [NSData dataWithBytes: p length: size];
if (63 == fields[j].charsetnr)
{
v = [NSData dataWithBytes: p length: size];
}
else
{
v = [[[NSString alloc] initWithBytes: p
length: size
encoding: NSUTF8StringEncoding] autorelease];
}
break;
default:
trim((char*)p);
if (YES == _shouldTrim)
{
trim((char*)p);
}
v = [NSString stringWithUTF8String: (char*)p];
break;
}
@ -418,13 +448,22 @@ static unsigned int trim(char *str)
keys: keys
count: fieldCount];
[records addObject: record];
RELEASE(record);
[record release];
}
}
else
{
[NSException raise: SQLException format: @"%s",
mysql_error(connection)];
NSString *s;
s = [NSString stringWithFormat: @"%s", mysql_error(connection)];
if (mysql_ping(connection) == 0)
{
[NSException raise: SQLException format: @"%@", s];
}
else
{
[NSException raise: SQLConnectionException format: @"%@", s];
}
}
}
NS_HANDLER
@ -433,7 +472,7 @@ static unsigned int trim(char *str)
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
if ([self debugging] > 0)
{
@ -444,19 +483,20 @@ static unsigned int trim(char *str)
{
mysql_free_result(result);
}
DESTROY(records);
RETAIN (localException);
RELEASE (arp);
AUTORELEASE (localException);
[records release];
records = nil;
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
[arp release];
if (result != 0)
{
mysql_free_result(result);
}
return AUTORELEASE(records);
return [records autorelease];
}
- (unsigned) copyEscapedBLOB: (NSData*)blob into: (void*)buf
@ -509,5 +549,38 @@ static unsigned int trim(char *str)
return length;
}
- (NSString*) quote: (id)obj
{
/* MySQL doesn't support timezones ... convert dates to simple GMT.
*/
if ([obj isKindOfClass: [NSDate class]] == YES)
{
NSString *fmt = nil;
static NSTimeZone *gmt = nil;
if (nil == gmt)
{
gmt = [[NSTimeZone timeZoneForSecondsFromGMT: 0] retain];
}
if ([obj isKindOfClass: [NSCalendarDate class]] == YES)
{
fmt = [obj calendarFormat];
if ([fmt length] > 17)
{
fmt = nil; // bad format ... had timezone
}
}
if (nil == fmt)
{
fmt = @"%Y-%m-%d %H:%M:%S";
}
fmt = [NSString stringWithFormat: @"'%@'", fmt];
return [obj descriptionWithCalendarFormat: fmt
timeZone: gmt
locale: nil];
}
return [super quote: obj];
}
@end

259
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;
@ -240,7 +240,7 @@ void SQLClientOracleErrorHandler()
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"(Oracle) Unable to connect to database"];
@ -273,7 +273,7 @@ void SQLClientOracleErrorHandler()
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
/*
* remove line number information from database exception message
@ -300,6 +300,7 @@ void SQLClientOracleErrorHandler()
}
NS_ENDHANDLER
DESTROY(arp);
return -1;
}
static unsigned int trim(char *str)
@ -368,7 +369,7 @@ static unsigned int trim(char *str)
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"(Oracle) Unable to connect to database"];
@ -553,7 +554,10 @@ static unsigned int trim(char *str)
/* \0-pad the string. */
aString[octetLength] = '\0';
trim (aString);
if (YES == _shouldTrim)
{
trim (aString);
}
v = [NSString stringWithUTF8String: aString];
free(aString);
break;
@ -584,7 +588,10 @@ static unsigned int trim(char *str)
EXEC SQL GET DESCRIPTOR 'myDesc' VALUE :index
:aString = DATA;
aString[octetLength] = '\0';
trim (aString);
if (YES == _shouldTrim)
{
trim (aString);
}
v = [NSString stringWithUTF8String: aString];
free (aString);
NSLog(@"(Oracle) Unknown data type (%d) for '%s': '%@'",
@ -644,7 +651,7 @@ static unsigned int trim(char *str)
}
if ([e isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
}
NS_ENDHANDLER
@ -667,7 +674,7 @@ static unsigned int trim(char *str)
if ([n isEqual: SQLConnectionException] == YES)
{
_inTransaction = NO;
[self backendDisconnect];
[self disconnect];
}
/*
@ -892,14 +899,15 @@ static unsigned int trim(char *str)
return ok;
}
/**
* Convert from a database character buffer to an NSDate.
*/
- (NSDate*) dbToDateFromBuffer: (char*)b length: (int)l
{
char buf[l+32]; /* Allow space to expend buffer. */
NSString *s;
int i;
char buf[l+32]; /* Allow space to expand buffer. */
NSCalendarDate *d;
BOOL milliseconds = NO;
BOOL timezone = NO;
NSString *s;
int i;
int e;
memcpy(buf, b, l);
b = buf;
@ -922,98 +930,153 @@ static unsigned int trim(char *str)
if (l == 10)
{
s = [self dbToStringFromBuffer: b length: l];
s = [NSString stringWithUTF8String: b];
return [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d"
locale: nil];
}
i = l;
/* Convert +/-HH:SS timezone to +/-HHSS
*/
if (i > 5 && b[i-3] == ':' && (b[i-6] == '+' || b[i-6] == '-'))
{
b[i-3] = b[i-2];
b[i-2] = b[i-1];
b[--i] = '\0';
}
while (i-- > 0)
{
if (b[i] == '+' || b[i] == '-')
{
break;
}
if (b[i] == ':' || b[i] == ' ')
{
i = 0;
break; /* No time zone found */
}
}
if (i == 0)
{
e = l;
}
else
{
i = l;
while (i-- > 0)
{
if (b[i] == '+' || b[i] == '-')
{
break;
}
if (b[i] == ':' || b[i] == ' ')
{
i = 0;
break; /* No time zone found */
}
}
if (i > 0)
{
int e = i;
timezone = YES;
e = i;
if (isdigit(b[i-1]))
{
/*
* Make space between seconds and timezone.
*/
memmove(&b[i+1], &b[i], l - i);
b[i++] = ' ';
b[++l] = '\0';
}
if (isdigit(b[i-1]))
{
/*
* Make space between seconds and timezone.
*/
memmove(&b[i+1], &b[i], l - i);
b[i++] = ' ';
b[++l] = '\0';
}
if (isdigit(b[i+1]) && isdigit(b[i+2]))
{
if (b[i+3] == '\0')
{
// Two digit time zone
b[l++] = '0';
b[l++] = '0';
b[l] = '\0';
}
else if (b[i+3] == ':')
{
// Zone with colon before minutes
b[i+3] = b[i+4];
b[i+5] = b[i+5];
b[--l] = '\0';
}
}
/* FIXME ... horrible kludge for postgres returning timestamps with
fractional second information. */
while (i-- > 0)
{
if (b[i] == '.')
{
break;
}
}
if (i > 0)
{
memmove(&b[i], &b[e], l - e);
l -= (e - i);
b[l] = '\0';
}
}
else if (l == 19)
{
/* A date and time without a timezone ... assume gmt */
strcat(b, " +0000");
l += 6;
}
/* If it's a simple date (YYYY-MM-DD) append time for start of day. */
if (l == 10)
{
strcat(b, " 00:00:00 +0000");
l += 15;
}
if (l == 0)
{
return nil;
}
s = [self dbToStringFromBuffer: b length: l];
return [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"
locale: nil];
/*
* Ensure we have a four digit timezone value.
*/
if (isdigit(b[i+1]) && isdigit(b[i+2]))
{
if (b[i+3] == '\0')
{
// Two digit time zone ... append zero minutes
b[l++] = '0';
b[l++] = '0';
b[l] = '\0';
}
else if (b[i+3] == ':')
{
// Zone with colon before minutes ... remove it
b[i+3] = b[i+4];
b[i+4] = b[i+5];
b[--l] = '\0';
}
}
}
/* kludge for timestamps with fractional second information.
* Force it to 3 digit millisecond */
while (i-- > 0)
{
if (b[i] == '.')
{
milliseconds = YES;
i++;
if (!isdigit(b[i]))
{
memmove(&b[i+3], &b[i], e-i);
l += 3;
memcpy(&b[i], "000", 3);
}
i++;
if (!isdigit(b[i]))
{
memmove(&b[i+2], &b[i], e-i);
l += 2;
memcpy(&b[i], "00", 2);
}
i++;
if (!isdigit(b[i]))
{
memmove(&b[i+1], &b[i], e-i);
l += 1;
memcpy(&b[i], "0", 1);
}
i++;
break;
}
}
if (i > 0 && i < e)
{
memmove(&b[i], &b[e], l - e);
l -= (e - i);
}
b[l] = '\0';
if (l == 0)
{
return nil;
}
s = [NSString stringWithUTF8String: b];
if (YES == timezone)
{
if (milliseconds == YES)
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S.%F %z"
locale: nil];
}
else
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"
locale: nil];
}
}
else
{
if (milliseconds == YES)
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S.%F"
locale: nil];
}
else
{
d = [NSCalendarDate dateWithString: s
calendarFormat: @"%Y-%m-%d %H:%M:%S"
locale: nil];
}
}
[d setCalendarFormat: @"%Y-%m-%d %H:%M:%S %z"];
return d;
}
/**

1733
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>
@ -41,7 +41,11 @@
#import <Foundation/NSValue.h>
#include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h"
#include <string.h>
#include <sqlite3.h>
@interface SQLClientSQLite : SQLClient
@ -128,15 +132,15 @@
}
}
- (void) backendExecute: (NSArray*)info
- (NSInteger) backendExecute: (NSArray*)info
{
NSString *stmt;
CREATE_AUTORELEASE_POOL(arp);
NSString *stmt;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
stmt = [info objectAtIndex: 0];
if ([stmt length] == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
@ -151,7 +155,7 @@
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to execute statement %@",
@ -179,32 +183,33 @@
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
if ([self debugging] > 0)
{
[self debug: @"Error executing statement:\n%@\n%@",
stmt, localException];
}
RETAIN (localException);
RELEASE (arp);
AUTORELEASE (localException);
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
[arp release];
return -1;
}
- (NSMutableArray*) backendQuery: (NSString*)stmt
recordType: (id)rtype
listType: (id)ltype
{
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSMutableArray *records = [[ltype alloc] initWithCapacity: 2];
if ([stmt length] == 0)
{
RELEASE (arp);
[arp release];
[NSException raise: NSInternalInconsistencyException
format: @"Statement produced null string"];
}
@ -219,7 +224,7 @@
/*
* Ensure we have a working connection.
*/
if ([self backendConnect] == NO)
if ([self connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to run query %@",
@ -288,7 +293,7 @@
keys: keys
count: columns];
[records addObject: record];
RELEASE(record);
[record release];
}
while ((result = sqlite3_step(prepared)) == SQLITE_ROW);
}
@ -305,21 +310,21 @@
if ([n isEqual: SQLConnectionException] == YES)
{
[self backendDisconnect];
[self disconnect];
}
if ([self debugging] > 0)
{
[self debug: @"Error executing statement:\n%@\n%@",
stmt, localException];
}
RETAIN (localException);
RELEASE (arp);
AUTORELEASE (localException);
[localException retain];
[arp release];
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER
DESTROY(arp);
return AUTORELEASE(records);
[arp release];
return [records autorelease];
}
static char hex[16] = "0123456789ABCDEF";

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

7209
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -3,12 +3,22 @@ dnl Process this file with autoconf to produce configure.
AC_INIT(SQLClient.h)
AC_CONFIG_HEADER(config.h)
if test -z "$GNUSTEP_MAKEFILES"; then
GNUSTEP_MAKEFILES=`gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null`
export GNUSTEP_MAKEFILES
fi
if test -z "$GNUSTEP_MAKEFILES"; then
AC_MSG_ERROR([You must have the gnustep-make package installed and set up the GNUSTEP_MAKEFILES environment variable to contain the path to the makefiles directory before configuring!])
else
. $GNUSTEP_MAKEFILES/GNUstep.sh
fi
if test "x$GNUSTEP_HOST_OS" = "x"; then
GNUSTEP_HOST_OS=`gnustep-config --variable=GNUSTEP_HOST_OS`
GNUSTEP_HOST_CPU=`gnustep-config --variable=GNUSTEP_HOST_CPU`
fi
#--------------------------------------------------------------------
AC_ARG_WITH(additional-include, [
--with-additional-include=flags
@ -58,8 +68,24 @@ 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
# which messes up all subsequent tests if the first occurrence in the
# file does not get called ... as would otherwise be the case if jdbc
# support is disabled.
AC_CHECK_HEADERS(stdio.h)
AC_MSG_CHECKING([if Jdbc support was manually disabled])
AC_ARG_ENABLE(jdbc-bundle, [
@ -73,7 +99,6 @@ AC_ARG_ENABLE(jdbc-bundle, [
if test "$ac_cv_jdbc_bundle" = "no"; then
AC_MSG_RESULT([yes: disabled from the command-line])
JDBC=
else
AC_MSG_RESULT([no: build if possible])
@ -177,28 +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
AC_CHECK_LIB(mysqlclient,mysql_init)
if test "$ac_cv_lib_mysqlclient_mysql_init" != "yes"; then
AC_CHECK_HEADERS(mysql/mysql.h)
if test "$ac_cv_header_mysql_mysql_h" = "yes"; then
MYSQL=yes
else
MYSQL=
echo "******************************************************"
echo "Unable to locate mysqlclient library (is it installed)"
echo "******************************************************"
echo "*********************************************************"
echo "Unable to locate mysqlclient headers (are they installed)"
echo "*********************************************************"
fi
if test "$MYSQL" = "yes"; then
if test -d /usr/lib/mysql ; then
CPPFLAGS="$CPPFLAGS -L/usr/lib/mysql"
LIBD="$LIBD -L/usr/lib/mysql"
else
if test -d /usr/local/lib/mysql ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/lib/mysql"
LIBD="$LIBD -L/usr/local/lib/mysql"
else
if test -d /usr/local/mysql/lib ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/mysql/lib"
LIBD="$LIBD -L/usr/local/mysql/lib"
fi
fi
fi
AC_CHECK_LIB(mysqlclient,mysql_init)
if test "$ac_cv_lib_mysqlclient_mysql_init" != "yes"; then
MYSQL=
echo "******************************************************"
echo "Unable to locate mysqlclient library (is it installed)"
echo "******************************************************"
fi
fi
fi
AC_SUBST(MYSQL)
fi
AC_MSG_CHECKING([if Sqllite support was manually disabled])
AC_ARG_ENABLE(sqllite-bundle, [
@ -216,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
@ -254,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

@ -29,7 +29,7 @@
int
main()
{
CREATE_AUTORELEASE_POOL(pool);
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
@ -109,7 +109,7 @@ main()
if ([records count] != 2)
{
NSLog(@"Expected 2 records but got %u", [records count]);
NSLog(@"Expected 2 records but got %" PRIuPTR "", [records count]);
}
else
{
@ -128,7 +128,7 @@ main()
NSLog(@"Records - %@", records);
RELEASE(pool);
[pool release];
return 0;
}

View file

@ -30,7 +30,7 @@
int
main()
{
CREATE_AUTORELEASE_POOL(pool);
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
@ -96,14 +96,14 @@ main()
NSLog(@"Start producing");
for (i = 0; i < 100000; i++)
{
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSString *destination = [NSString stringWithFormat: @"%d", i];
NSString *sid = [NSString stringWithFormat: @"%d", i%100];
[db execute: @"INSERT INTO Queue (Consumer, Destination, ServiceID, Payload) VALUES (",
[db quote: name], @", ", [db quote: destination], @", ", sid, @", ",
@"'helo there'", @")", nil];
RELEASE(arp);
[arp release];
}
NSLog(@"End producing");
}
@ -112,7 +112,7 @@ main()
NSLog(@"Start consuming");
for (i = 0; i < 100000;)
{
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
unsigned count;
int j;
@ -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],
@ -154,7 +154,7 @@ main()
}
[db commit];
i += count;
RELEASE(arp);
[arp release];
}
NSLog(@"End consuming (%d records)", i);
/*
@ -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
{
@ -332,7 +332,7 @@ main()
NSLog(@"Records - %@", [GSCache class]);
}
RELEASE(pool);
[pool release];
return 0;
}

View file

@ -29,7 +29,7 @@
int
main()
{
CREATE_AUTORELEASE_POOL(pool);
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
@ -109,7 +109,7 @@ main()
if ([records count] != 2)
{
NSLog(@"Expected 2 records but got %u", [records count]);
NSLog(@"Expected 2 records but got %" PRIuPTR "", [records count]);
}
else
{
@ -128,7 +128,7 @@ main()
NSLog(@"Records - %@", records);
RELEASE(pool);
[pool release];
return 0;
}

View file

@ -27,10 +27,22 @@
#import <Performance/GSCache.h>
#import "SQLClient.h"
@interface Logger : NSObject
- (void) notified: (NSNotification*)n;
@end
@implementation Logger
- (void) notified: (NSNotification*)n
{
NSLog(@"Received %@", n);
}
@end
int
main()
{
CREATE_AUTORELEASE_POOL(pool);
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClientPool *sp;
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
@ -39,6 +51,7 @@ main()
unsigned int i;
NSData *data;
NSString *name;
Logger *l;
defs = [NSUserDefaults standardUserDefaults];
[defs registerDefaults:
@ -56,7 +69,84 @@ main()
nil]
];
db = [SQLClient clientWithConfiguration: nil name: @"test"];
sp = [[[SQLClientPool alloc] initWithConfiguration: nil
name: @"test"
max: 2
min: 1] autorelease];
#if 0
{
NSAutoreleasePool *p;
NSAutoreleasePool *q;
SQLClient *c0;
SQLClient *c1;
[sp setDebugging: 4];
p = [NSAutoreleasePool new];
c0 = [sp provideClientExclusive];
c1 = [sp provideClientExclusive];
NSLog(@"Got two clients from pool");
[c0 connect];
[c1 connect];
NSLog(@"Now putting clients back in pool again");
[sp swallowClient: c0];
[sp swallowClient: c1];
NSLog(@"And emptying autorelease pool");
[p release];
p = [NSAutoreleasePool new];
[sp setPurgeAll: 60 min: 1];
[NSThread sleepForTimeInterval: 1.0];
NSLog(@"Expecting purge to disconnect one client");
[sp purge];
c0 = [sp provideClientExclusive];
c1 = [sp provideClientExclusive];
NSLog(@"Expecting connected: %@", [c0 connected] ? @"YES" : @"NO");
NSLog(@"Expecting not connected: %@", [c1 connected] ? @"NO" : @"YES");
NSLog(@"Pool has provided both it's clients ... now try for another with a 15 second timeout");
[sp provideClientBeforeDate: [NSDate dateWithTimeIntervalSinceNow: 15.0]
exclusive: YES];
NSLog(@"Emptying autorelease pool ... clients should be put back in pool");
[p release];
p = [NSAutoreleasePool new];
NSLog(@"Getting two clients again");
c0 = [sp provideClientExclusive];
c1 = [sp provideClientExclusive];
NSLog(@"Pool has provided both it's clients ... now try for another with a 15 second timeout");
[sp provideClientBeforeDate: [NSDate dateWithTimeIntervalSinceNow: 15.0]
exclusive: YES];
NSLog(@"Emptying autorelease pool again");
[p release];
p = [NSAutoreleasePool new];
c0 = [sp provideClient];
q = [NSAutoreleasePool new];
c1 = [sp provideClient];
if (c0 != c1)
{
NSLog(@"ERROR was expecting provideClient to give the same object");
exit(1);
}
[q release];
[c0 connect];
[p release];
NSLog(@"Expect to get client immediately");
}
#endif
db = [sp provideClientExclusive];
[sp swallowClient: db];
[sp queryString: @"SELECT CURRENT_TIMESTAMP", nil];
db = [sp provideClientExclusive];
l = [Logger new];
[[NSNotificationCenter defaultCenter] addObserver: l
selector: @selector(notified:)
name: SQLClientDidConnectNotification
object: db];
[[NSNotificationCenter defaultCenter] addObserver: l
selector: @selector(notified:)
name: SQLClientDidDisconnectNotification
object: db];
if ((name = [defs stringForKey: @"Producer"]) != nil)
{
@ -70,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:
@ -94,23 +184,35 @@ main()
NSLog(@"Start producing");
for (i = 0; i < 100000; i++)
{
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSString *destination = [NSString stringWithFormat: @"%d", i];
NSString *sid = [NSString stringWithFormat: @"%d", i%100];
[db execute: @"INSERT INTO Queue (Consumer, Destination, ServiceID, Payload) VALUES (",
[db quote: name], @", ", [db quote: destination], @", ", sid, @", ",
@"'helo there'", @")", nil];
RELEASE(arp);
if (i % 1000 == 999)
{
[db postNotificationName: @"Producing"
payload: [NSString stringWithFormat: @"%d", i]];
}
[db execute: @"INSERT INTO Queue (Consumer, Destination,"
@" ServiceID, Payload) VALUES (",
[db quote: name], @", ",
[db quote: destination], @", ",
sid, @", ",
@"'helo there'",
@")", nil];
[arp release];
}
NSLog(@"End producing");
}
else if ((name = [defs stringForKey: @"Consumer"]) != nil)
{
[db addObserver: l
selector: @selector(notified:)
name: @"Producing"];
NSLog(@"Start consuming");
for (i = 0; i < 100000;)
{
CREATE_AUTORELEASE_POOL(arp);
NSAutoreleasePool *arp = [NSAutoreleasePool new];
unsigned count;
int j;
@ -123,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],
@ -152,7 +254,7 @@ main()
}
[db commit];
i += count;
RELEASE(arp);
[arp release];
}
NSLog(@"End consuming (%d records)", i);
/*
@ -166,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++)
{
@ -187,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, "
@ -221,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],
@ -236,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)
{
@ -267,16 +419,100 @@ 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);
}
RELEASE(pool);
NSLog(@"Pool stats:\n%@", [sp statistics]);
[pool release];
return 0;
}

View file

@ -29,7 +29,7 @@
int
main()
{
CREATE_AUTORELEASE_POOL(pool);
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
@ -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
{
@ -123,7 +123,7 @@ main()
NSLog(@"Records - %@", records);
RELEASE(pool);
[pool release];
return 0;
}