Compare commits

..

1 commit

Author SHA1 Message Date
Richard Frith-MacDonald
b8538d3276 Tag version 1_7_2
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/tags/sqlclient-1_7_2@37894 72102866-910b-0410-8b05-ffd578937521
2014-05-19 09:35:00 +00:00
18 changed files with 9160 additions and 9763 deletions

610
ChangeLog
View file

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

View file

@ -18,14 +18,10 @@ endif
include $(GNUSTEP_MAKEFILES)/common.make
# Force sequential build to prevent different versions of the same
# bundle overwriting each other's temporary files during building.
GNUSTEP_MAKE_PARALLEL_BUILDING=no
-include config.make
PACKAGE_NAME = SQLClient
PACKAGE_VERSION = 1.9.0
PACKAGE_VERSION = 1.7.2
CVS_MODULE_NAME = gnustep/dev-libs/SQLClient
CVS_TAG_NAME = SQLClient
SVN_BASE_URL=svn+ssh://svn.gna.org/svn/gnustep/libs
@ -38,10 +34,10 @@ TEST_TOOL_NAME=
LIBRARY_NAME=SQLClient
DOCUMENT_NAME=SQLClient
SQLClient_INTERFACE_VERSION=1.9
SQLClient_INTERFACE_VERSION=1.7
SQLClient_OBJC_FILES = SQLClient.m SQLClientPool.m
SQLClient_LIBRARIES_DEPEND_UPON = -lPerformance $(FND_LIBS) $(OBJC_LIBS)
SQLClient_OBJC_FILES = SQLClient.m
SQLClient_LIBRARIES_DEPEND_UPON = -lPerformance
SQLClient_HEADER_FILES = SQLClient.h
SQLClient_AGSDOC_FILES = SQLClient.h
SQLClient_AGSDOC_FLAGS = -WordMap '{SQLCLIENT_PRIVATE="";}'
@ -53,7 +49,7 @@ SQLClient_HEADER_FILES_INSTALL_DIR = SQLClient
BUNDLE_NAME=
BUNDLE_INSTALL_DIR=$(GNUSTEP_BUNDLES)/SQLClient$(SQLClient_INTERFACE_VERSION)
BUNDLE_INSTALL_DIR=$(GNUSTEP_BUNDLES)/SQLClient
# In some systems and situations the dynamic linker needs to haved the
# SQLClient, gnustep-base, and objc libraries explicityly linked into

View file

@ -66,10 +66,6 @@ after-distclean::
# Things to do after checking
# after-check::
config.make: config.status
if [ -x config.status ]; then \
./config.status --recheck; \
else \
./configure; \
fi
config.make: config.make.in
./configure

View file

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

56
JDBC.m
View file

@ -30,7 +30,6 @@
#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>
@ -1522,7 +1521,7 @@ static int JDBCVARCHAR = 0;
transaction = (_JDBCTransaction*)NSAllocateObject([_JDBCTransaction class], 0,
NSDefaultMallocZone());
transaction->_owner = [self retain];
transaction->_db = [self retain];
transaction->_info = [NSMutableArray new];
transaction->_batch = YES;
transaction->_stop = stopOnFailure;
@ -1681,7 +1680,7 @@ static int JDBCVARCHAR = 0;
transaction = (_JDBCTransaction*)NSAllocateObject([_JDBCTransaction class], 0,
NSDefaultMallocZone());
transaction->_owner = [self retain];
transaction->_db = [self retain];
transaction->_info = [NSMutableArray new];
return [(SQLTransaction*)transaction autorelease];
}
@ -1729,13 +1728,21 @@ static int JDBCVARCHAR = 0;
if (_count > 0)
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
SQLClientPool *pool;
SQLClient *db;
BOOL wrapped = NO;
BOOL batched = NO;
JNIEnv *env;
JInfo *ji;
/*
* Ensure we have a working connection.
*/
if ([_db connect] == NO)
{
[NSException raise: SQLException
format: @"Unable to connect to '%@' to execute transaction %@",
[_db name], self];
}
env = SQLClientJNIEnv();
if ((*env)->PushLocalFrame (env, 32) < 0)
{
@ -1745,38 +1752,16 @@ static int JDBCVARCHAR = 0;
format: @"No java memory for execute"];
}
if ([_owner isKindOfClass: [SQLClientPool class]])
{
pool = (SQLClientPool*)_owner;
db = [pool provideClient];
}
else
{
pool = nil;
db = _owner;
}
ji = [(SQLClientJDBC*)db _backendExtra];
ji = [(SQLClientJDBC*)_db _backendExtra];
NS_DURING
{
NSMutableArray *statements;
unsigned numberOfStatements;
unsigned statement;
NSTimeInterval _duration;
NSTimeInterval _duration = [_db durationLogging];
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];
@ -1786,7 +1771,7 @@ static int JDBCVARCHAR = 0;
start = GSTickerTimeNow();
}
if ([db isInTransaction] == NO)
if ([_db isInTransaction] == NO)
{
wrapped = YES;
}
@ -1898,15 +1883,15 @@ static int JDBCVARCHAR = 0;
(*env)->PopLocalFrame (env, NULL);
db->_lastOperation = GSTickerTimeNow();
_db->_lastOperation = GSTickerTimeNow();
if (_duration >= 0)
{
NSTimeInterval d;
d = db->_lastOperation - start;
d = _db->_lastOperation - start;
if (d >= _duration)
{
[db debug: @"Duration %g for transaction %@",
[_db debug: @"Duration %g for transaction %@",
d, statements];
}
}
@ -1928,11 +1913,6 @@ static int JDBCVARCHAR = 0;
}
NS_ENDHANDLER
if (nil != pool)
{
[pool swallowClient: db];
}
[arp release];
}
}

View file

@ -290,8 +290,8 @@ static unsigned int trim(char *str)
}
- (NSMutableArray*) backendQuery: (NSString*)stmt
recordType: (id)rtype
listType: (id)ltype
recordType: (Class)rtype
listType: (Class)ltype
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSMutableArray *records = nil;

1348
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",
"owner",
"db",
"execute",
"reset"
);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

1326
config.guess vendored Executable file

File diff suppressed because it is too large Load diff

1451
config.sub vendored Executable file

File diff suppressed because it is too large Load diff

6012
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -14,11 +14,6 @@ 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
@ -202,41 +197,42 @@ 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
AC_CHECK_HEADERS(mysql/mysql.h)
if test "$ac_cv_header_mysql_mysql_h" = "yes"; then
MYSQL=yes
else
MYSQL=
echo "*********************************************************"
echo "Unable to locate mysqlclient headers (are they installed)"
echo "*********************************************************"
fi
if test "$MYSQL" = "yes"; then
if test -d /usr/lib/mysql ; then
CPPFLAGS="$CPPFLAGS -L/usr/lib/mysql"
LIBD="$LIBD -L/usr/lib/mysql"
else
MYSQL=
echo "*********************************************************"
echo "Unable to locate mysqlclient headers (are they installed)"
echo "*********************************************************"
fi
if test "$MYSQL" = "yes"; then
if test -d /usr/lib/mysql ; then
CPPFLAGS="$CPPFLAGS -L/usr/lib/mysql"
LIBD="$LIBD -L/usr/lib/mysql"
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/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
if test -d /usr/local/mysql/lib ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/mysql/lib"
LIBD="$LIBD -L/usr/local/mysql/lib"
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
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
AC_SUBST(MYSQL)
fi
AC_MSG_CHECKING([if Sqllite support was manually disabled])
AC_ARG_ENABLE(sqllite-bundle, [
@ -254,27 +250,28 @@ 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
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
SQLITE=
echo "*****************************************************"
echo "Unable to locate sqlite3 headers (are they installed)"
echo "*****************************************************"
fi
if test "$SQLITE" = "yes"; then
AC_CHECK_LIB(sqlite3,sqlite3_open)
if test "$ac_cv_lib_sqlite3_sqlite3_open" != "yes"; then
SQLITE=
echo "******************************************************"
echo "Unable to locate sqlite3 library (is it installed)"
echo "******************************************************"
fi
echo "******************************************************"
echo "Unable to locate sqlite3 library (is it installed)"
echo "******************************************************"
fi
fi
AC_SUBST(SQLITE)
fi
AC_MSG_CHECKING([if Postgres support was manually disabled])
AC_ARG_ENABLE(postgres-bundle, [
--disable-postgres-bundle
@ -291,211 +288,163 @@ 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
if test "$POSTGRES" = ""; then
AC_CHECK_HEADERS(libpq-fe.h)
if test "$ac_cv_header_libpq_fe_h" = "yes"; then
POSTGRES=yes
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(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/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
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
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/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/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
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
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/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
echo "**************************************************************"
echo "Unable to locate libpq (postgres) headers (are they installed)"
echo "**************************************************************"
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" = "yes"; then
# NICOLA - hack
if test -d /usr/lib/pgsql ; then
CPPFLAGS="$CPPFLAGS -L/usr/lib/pgsql"
LIBD="$LIBD -L/usr/lib/pgsql"
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/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 -d /usr/local/pgsql/lib ; then
CPPFLAGS="$CPPFLAGS -L/usr/local/pgsql/lib"
LIBD="$LIBD -L/usr/local/pgsql/lib"
fi
fi
AC_CHECK_LIB(pq,PQfformat)
if test "$ac_cv_lib_pq_PQfformat" != "yes"; then
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
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 "********************************************************"
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)

250
install-sh Executable file
View file

@ -0,0 +1,250 @@
#! /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

@ -125,7 +125,7 @@ main()
if (count == 0)
{
[db commit];
[NSThread sleepForTimeInterval: 1.0];
sleep(1);
[db begin];
records = [db query: @"SELECT * FROM Queue WHERE Consumer = ",
[db quote: name],
@ -242,7 +242,7 @@ main()
r0 = [db cache: 1 query: @"select * from xxx", nil];
r1 = [db cache: 1 query: @"select * from xxx", nil];
NSCAssert([r0 lastObject] == [r1 lastObject], @"Cache failed");
[NSThread sleepForTimeInterval: 2.0];
sleep(2);
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 %"PRIuPTR, [records count]);
NSLog(@"Expected 3 records but got %u", [records count]);
}
else
{

View file

@ -42,7 +42,6 @@ int
main()
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClientPool *sp;
SQLClient *db;
NSUserDefaults *defs;
NSMutableArray *records;
@ -69,74 +68,7 @@ main()
nil]
];
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];
db = [SQLClient clientWithConfiguration: nil name: @"test"];
l = [Logger new];
[[NSNotificationCenter defaultCenter] addObserver: l
@ -160,7 +92,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:
@ -195,11 +127,8 @@ main()
}
[db execute: @"INSERT INTO Queue (Consumer, Destination,"
@" ServiceID, Payload) VALUES (",
[db quote: name], @", ",
[db quote: destination], @", ",
sid, @", ",
@"'helo there'",
@")", nil];
[db quote: name], @", ", [db quote: destination], @", ", sid, @", ",
@"'helo there'", @")", nil];
[arp release];
}
NSLog(@"End producing");
@ -268,18 +197,11 @@ main()
else
{
NSString *oddChars;
NSString *oddNoNul;
NSString *nonLatin;
id e1, e2, e3, e4, e5;
id d;
id d0;
id d1;
id d2;
id r0;
id r1;
oddChars = @"'a\\b'c\0\r\nd'\\ed\\";
oddNoNul = @"'a\\b'c\r\nd'\\ed\\";
oddChars = @"'a\\b'c\r\nd'\\ed\\";
nonLatin = [[NSString stringWithCString: "\"\\U2A11\""] propertyList];
for (i = 0; i < 256; i++)
{
@ -296,64 +218,34 @@ 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,"
@"extra1 int[],"
@"extra2 varchar[],"
@"extra3 bytea[],"
@"extra4 boolean[],"
@"extra5 timestamp with time zone[]"
@"b bytea"
@")",
nil];
if (1 != [db execute: @"INSERT into xxx (id, k, char1, boolval, intval,"
@" when1, when2, b, extra1, extra2, extra3, extra4, extra5) "
@"values (1,"
@"'{hello', "
if (1 != [db execute: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values ("
@"'hello', "
@"'X', "
@"TRUE, "
@"1, "
@"CURRENT_TIMESTAMP, "
@"CURRENT_TIMESTAMP, ",
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], @")",
data,
@")",
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,"
[db execute: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values ("
@"'hello', "
@"'X', "
@"TRUE, "
@ -363,9 +255,9 @@ main()
[NSData dataWithBytes: "" length: 0],
@")",
nil];
[db execute: @"INSERT into xxx "
@"(id, k, char1, boolval, intval, when1, when2, b) "
@"values (3,",
[db execute: @"insert into xxx "
@"(k, char1, boolval, intval, when1, when2, b) "
@"values (",
[db quote: oddChars],
@", ",
[db quote: nonLatin],
@ -378,15 +270,13 @@ main()
nil];
[db commit];
r0 = [db cache: 1 query: @"select * from xxx order by id", nil];
r1 = [db cache: 1 query: @"select * from xxx order by id", nil];
r0 = [db cache: 1 query: @"select * from xxx", nil];
r1 = [db cache: 1 query: @"select * from xxx", nil];
NSCAssert([r0 lastObject] == [r1 lastObject], @"Cache failed");
[NSThread sleepForTimeInterval: 2.0];
records = [db cache: 1 query: @"select * from xxx order by id", nil];
records = [db cache: 1 query: @"select * from xxx", nil];
NSCAssert([r0 lastObject] != [records lastObject], @"Lifetime failed");
db = [[[SQLClient alloc] initWithConfiguration: nil
name: @"test"] autorelease];
[db addObserver: l
selector: @selector(notified:)
name: @"foo"];
@ -401,8 +291,6 @@ main()
}
else
{
int i;
record = [records objectAtIndex: 0];
if ([[record objectForKey: @"b"] isEqual: data] == NO)
{
@ -419,99 +307,15 @@ main()
{
NSLog(@"Retrieved non-latin does not match saved string");
}
id o = [[record objectForKey: @"k"] stringByTrimmingSpaces];
if ([o isEqual: oddNoNul] == NO)
if ([[record objectForKey: @"k"] isEqual: oddChars] == NO)
{
NSLog(@"Retrieved odd chars (%@) does not match oddNoNul (%@)",
o, oddNoNul);
}
else
{
NSLog(@"Embedded nul correctly removed");
}
record = [records objectAtIndex: 0];
o = [record objectForKey: @"extra1"];
if ([o isEqual: e1] == NO)
{
NSLog(@"Retrieved extra1 (%@) does not match saved (%@)", o, e1);
}
o = [record objectForKey: @"extra2"];
if ([o isEqual: e2] == NO)
{
NSLog(@"Retrieved extra2 (%@) does not match saved (%@)", o, e2);
}
o = [record objectForKey: @"extra3"];
if ([o isEqual: e3] == NO)
{
NSLog(@"Retrieved extra3 (%@) does not match saved (%@)", o, e3);
}
o = [record objectForKey: @"extra4"];
if ([o count] != [e4 count])
{
NSLog(@"Retrieved extra4 (%@) does not match saved (%@)", o, e4);
}
for (i = 0; i < [o count]; i++)
{
if ([[o objectAtIndex: i] boolValue]
!= [[e4 objectAtIndex: i] boolValue])
{
NSLog(@"Retrieved extra4 (%@) does not match saved (%@)",
o, e4);
}
}
o = [record objectForKey: @"extra5"];
if ([o count] != [e5 count])
{
NSLog(@"Retrieved extra5 (%@) does not match saved (%@)", o, e5);
}
for (i = 0; i < [o count]; i++)
{
if (floor([[o objectAtIndex: i] timeIntervalSinceReferenceDate])
!= floor([[e5 objectAtIndex: i] timeIntervalSinceReferenceDate]))
{
NSLog(@"Retrieved extra5 (%@) does not match saved (%@)",
o, e5);
}
NSLog(@"Retrieved odd chars does not match saved string");
}
}
NSLog(@"Records - %@", [GSCache class]);
d = [NSCalendarDate date];
[d setTimeZone: [NSTimeZone timeZoneForSecondsFromGMT: 240]];
[db begin];
[db execute: @"create table xxx ( "
@"id int, "
@"when0 timestamp with time zone, "
@"when1 timestamp with time zone, "
@"when2 timestamp)",
nil];
[db execute: @"INSERT into xxx (id, when0, when1, when2) "
@"values (99,",
d, @", ",
[NSDate distantPast], @", ",
[NSDate distantFuture], @")",
nil];
r0 = [[db query: @"select * from xxx where id=99", nil] lastObject];
[db execute: @"drop table xxx", nil];
[db commit];
d0 = [r0 objectForKey:@"when0"];
NSCAssert(floor([d0 timeIntervalSinceReferenceDate])
== floor([d timeIntervalSinceReferenceDate]),
NSInternalInconsistencyException);
d1 = [r0 objectForKey:@"when1"];
NSCAssert([d1 timeIntervalSinceReferenceDate]
== [[NSDate distantPast] timeIntervalSinceReferenceDate],
NSInternalInconsistencyException);
d2 = [r0 objectForKey:@"when2"];
NSCAssert([d2 timeIntervalSinceReferenceDate]
== [[NSDate distantFuture] timeIntervalSinceReferenceDate],
NSInternalInconsistencyException);
}
NSLog(@"Pool stats:\n%@", [sp statistics]);
[pool release];
return 0;
}