git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@29034 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2009-11-18 11:25:01 +00:00
parent 56d6b50af9
commit 9199fa5f6e
10 changed files with 34 additions and 26 deletions

View file

@ -40,6 +40,9 @@
#include <Foundation/NSAutoreleasePool.h> #include <Foundation/NSAutoreleasePool.h>
#include "config.h" #include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h" #include "SQLClient.h"
@interface SQLClientECPG : SQLClient @interface SQLClientECPG : SQLClient

23
JDBC.m
View file

@ -45,19 +45,14 @@
#import <Performance/GSTicker.h> #import <Performance/GSTicker.h>
#include "config.h" #include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h" #include "SQLClient.h"
@interface _JDBCTransaction : SQLTransaction @interface _JDBCTransaction : SQLTransaction
@end @end
typedef struct {
@defs(SQLClient);
} *CDefs;
typedef struct {
@defs(_JDBCTransaction);
} *TDefs;
#include <jni.h> #include <jni.h>
static NSString *JDBCException = @"SQLClientJDBCException"; static NSString *JDBCException = @"SQLClientJDBCException";
@ -1520,9 +1515,9 @@ static int JDBCVARCHAR = 0;
- (SQLTransaction*) batch: (BOOL)stopOnFailure - (SQLTransaction*) batch: (BOOL)stopOnFailure
{ {
TDefs transaction; _JDBCTransaction *transaction;
transaction = (TDefs)NSAllocateObject([_JDBCTransaction class], 0, transaction = (_JDBCTransaction*)NSAllocateObject([_JDBCTransaction class], 0,
NSDefaultMallocZone()); NSDefaultMallocZone());
transaction->_db = [self retain]; transaction->_db = [self retain];
@ -1679,9 +1674,9 @@ static int JDBCVARCHAR = 0;
- (SQLTransaction*) transaction - (SQLTransaction*) transaction
{ {
TDefs transaction; _JDBCTransaction *transaction;
transaction = (TDefs)NSAllocateObject([_JDBCTransaction class], 0, transaction = (_JDBCTransaction*)NSAllocateObject([_JDBCTransaction class], 0,
NSDefaultMallocZone()); NSDefaultMallocZone());
transaction->_db = [self retain]; transaction->_db = [self retain];
@ -1887,12 +1882,12 @@ static int JDBCVARCHAR = 0;
(*env)->PopLocalFrame (env, NULL); (*env)->PopLocalFrame (env, NULL);
((CDefs)_db)->_lastOperation = GSTickerTimeNow(); _db->_lastOperation = GSTickerTimeNow();
if (_duration >= 0) if (_duration >= 0)
{ {
NSTimeInterval d; NSTimeInterval d;
d = ((CDefs)_db)->_lastOperation - start; d = _db->_lastOperation - start;
if (d >= _duration) if (d >= _duration)
{ {
[_db debug: @"Duration %g for transaction %@", [_db debug: @"Duration %g for transaction %@",

View file

@ -39,6 +39,9 @@
#import <Foundation/NSAutoreleasePool.h> #import <Foundation/NSAutoreleasePool.h>
#include "config.h" #include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h" #include "SQLClient.h"
#include <mysql/mysql.h> #include <mysql/mysql.h>

View file

@ -41,6 +41,9 @@
#import <Foundation/NSAutoreleasePool.h> #import <Foundation/NSAutoreleasePool.h>
#include "config.h" #include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h" #include "SQLClient.h"
#include <libpq-fe.h> #include <libpq-fe.h>

View file

@ -203,6 +203,10 @@ extern NSString * const SQLClientDidConnectNotification;
*/ */
extern NSString * const SQLClientDidDisconnectNotification; extern NSString * const SQLClientDidDisconnectNotification;
#if !defined(SQLCLIENT_PRIVATE)
#define SQLCLIENT_PRIVATE @private
#endif
/** /**
* <p>An enhanced array to represent a record returned from a query. * <p>An enhanced array to represent a record returned from a query.
* You should <em>NOT</em> try to create instances of this class * You should <em>NOT</em> try to create instances of this class
@ -348,6 +352,7 @@ extern unsigned SQLClientTimeTick();
*/ */
@interface SQLClient : NSObject @interface SQLClient : NSObject
{ {
SQLCLIENT_PRIVATE
void *extra; /** For subclass specific data */ void *extra; /** For subclass specific data */
NSRecursiveLock *lock; /** Maintain thread-safety */ NSRecursiveLock *lock; /** Maintain thread-safety */
/** /**
@ -1242,10 +1247,6 @@ extern unsigned SQLClientTimeTick();
- (void) setCacheThread: (NSThread*)aThread; - (void) setCacheThread: (NSThread*)aThread;
@end @end
#if !defined(SQLCLIENT_PRIVATE)
#define SQLCLIENT_PRIVATE @private
#endif
/** /**
* The SQLTransaction transaction class provides a convenient mechanism * The SQLTransaction transaction class provides a convenient mechanism
* for grouping together a series of SQL statements to be executed as a * for grouping together a series of SQL statements to be executed as a

View file

@ -41,6 +41,9 @@
#import <Foundation/NSValue.h> #import <Foundation/NSValue.h>
#include "config.h" #include "config.h"
#define SQLCLIENT_PRIVATE @public
#include "SQLClient.h" #include "SQLClient.h"
#include <string.h> #include <string.h>
#include <sqlite3.h> #include <sqlite3.h>

View file

@ -29,7 +29,7 @@
int int
main() main()
{ {
NSAutoreleasePool pool = [NSAutoreleasePool new]; NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db; SQLClient *db;
NSUserDefaults *defs; NSUserDefaults *defs;
NSMutableArray *records; NSMutableArray *records;

View file

@ -30,7 +30,7 @@
int int
main() main()
{ {
NSAutoreleasePool pool = [NSAutoreleasePool new]; NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db; SQLClient *db;
NSUserDefaults *defs; NSUserDefaults *defs;
NSMutableArray *records; NSMutableArray *records;
@ -96,7 +96,7 @@ main()
NSLog(@"Start producing"); NSLog(@"Start producing");
for (i = 0; i < 100000; i++) for (i = 0; i < 100000; i++)
{ {
NSAutoreleasePool arp = [NSAutoreleasePool new]; NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSString *destination = [NSString stringWithFormat: @"%d", i]; NSString *destination = [NSString stringWithFormat: @"%d", i];
NSString *sid = [NSString stringWithFormat: @"%d", i%100]; NSString *sid = [NSString stringWithFormat: @"%d", i%100];
@ -112,7 +112,7 @@ main()
NSLog(@"Start consuming"); NSLog(@"Start consuming");
for (i = 0; i < 100000;) for (i = 0; i < 100000;)
{ {
NSAutoreleasePool arp = [NSAutoreleasePool new]; NSAutoreleasePool *arp = [NSAutoreleasePool new];
unsigned count; unsigned count;
int j; int j;

View file

@ -29,7 +29,7 @@
int int
main() main()
{ {
NSAutoreleasePool pool = [NSAutoreleasePool new]; NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db; SQLClient *db;
NSUserDefaults *defs; NSUserDefaults *defs;
NSMutableArray *records; NSMutableArray *records;

View file

@ -41,7 +41,7 @@
int int
main() main()
{ {
NSAutoreleasePool pool = [NSAutoreleasePool new]; NSAutoreleasePool *pool = [NSAutoreleasePool new];
SQLClient *db; SQLClient *db;
NSUserDefaults *defs; NSUserDefaults *defs;
NSMutableArray *records; NSMutableArray *records;
@ -116,7 +116,7 @@ main()
NSLog(@"Start producing"); NSLog(@"Start producing");
for (i = 0; i < 100000; i++) for (i = 0; i < 100000; i++)
{ {
NSAutoreleasePool arp = [NSAutoreleasePool new]; NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSString *destination = [NSString stringWithFormat: @"%d", i]; NSString *destination = [NSString stringWithFormat: @"%d", i];
NSString *sid = [NSString stringWithFormat: @"%d", i%100]; NSString *sid = [NSString stringWithFormat: @"%d", i%100];
@ -132,7 +132,7 @@ main()
NSLog(@"Start consuming"); NSLog(@"Start consuming");
for (i = 0; i < 100000;) for (i = 0; i < 100000;)
{ {
NSAutoreleasePool arp = [NSAutoreleasePool new]; NSAutoreleasePool *arp = [NSAutoreleasePool new];
unsigned count; unsigned count;
int j; int j;