Author: rfm
Date: Mon Jun 29 14:07:00 2015
New Revision: 38719

URL: http://svn.gna.org/viewcvs/gnustep?rev=38719&view=rev
Log:
further cleanups

Modified:
    libs/sqlclient/trunk/ChangeLog
    libs/sqlclient/trunk/SQLClient.h
    libs/sqlclient/trunk/SQLClient.jigs
    libs/sqlclient/trunk/SQLClient.m

Modified: libs/sqlclient/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/ChangeLog?rev=38719&r1=38718&r2=38719&view=diff
==============================================================================
--- libs/sqlclient/trunk/ChangeLog      (original)
+++ libs/sqlclient/trunk/ChangeLog      Mon Jun 29 14:07:00 2015
@@ -6,6 +6,7 @@
        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  <[email protected]>
 

Modified: libs/sqlclient/trunk/SQLClient.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClient.h?rev=38719&r1=38718&r2=38719&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClient.h    (original)
+++ libs/sqlclient/trunk/SQLClient.h    Mon Jun 29 14:07:00 2015
@@ -1784,7 +1784,7 @@
 @interface     SQLTransaction : NSObject <NSCopying>
 {
 SQLCLIENT_PRIVATE
-  id                   _db;
+  id                   _owner;
   NSMutableArray       *_info;
   unsigned             _count;
   BOOL                  _batch;
@@ -1836,14 +1836,6 @@
 - (NSUInteger) count;
 
 /**
- * Returns the database client with which this instance operates.<br />
- * This client is retained by the transaction.<br />
- * If the transaction was created by/for an SQLClientPool, this method
- * returns that pool rather than an individual client.
- */
-- (id) db;
-
-/**
  * <p>Performs any statements added to the transaction as a single operation.
  * If any problem occurs, an NSException is raised, but the database connection
  * is left in a consistent state and a partially completed operation is
@@ -1907,6 +1899,14 @@
  * database client as the receiver.
  */
 - (void) insertTransaction: (SQLTransaction*)trn atIndex: (unsigned)index;
+
+/**
+ * Returns the database client with which this instance operates.<br />
+ * This client is retained by the transaction.<br />
+ * If the transaction was created by/for an SQLClientPool, this method
+ * returns that pool rather than an individual client.
+ */
+- (id) owner;
 
 /** Remove the index'th transaction or statement from the receiver.
  */

Modified: libs/sqlclient/trunk/SQLClient.jigs
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClient.jigs?rev=38719&r1=38718&r2=38719&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClient.jigs (original)
+++ libs/sqlclient/trunk/SQLClient.jigs Mon Jun 29 14:07:00 2015
@@ -72,7 +72,7 @@
        "add:with:",
        "append:",
        "count",
-       "db",
+       "owner",
        "execute",
        "reset"
       );

Modified: libs/sqlclient/trunk/SQLClient.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClient.m?rev=38719&r1=38718&r2=38719&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClient.m    (original)
+++ libs/sqlclient/trunk/SQLClient.m    Mon Jun 29 14:07:00 2015
@@ -3118,7 +3118,7 @@
   transaction = (SQLTransaction*)NSAllocateObject(self, 0,
     NSDefaultMallocZone());
  
-  transaction->_db = [clientOrPool retain];
+  transaction->_owner = [clientOrPool retain];
   transaction->_info = [NSMutableArray new];
   transaction->_batch = isBatched;
   transaction->_stop = stopOnFailure;
@@ -3356,7 +3356,7 @@
   NSMutableArray        *p;
 
   va_start (ap, stmt);
-  p = [_db prepare: stmt args: ap];
+  p = [_owner prepare: stmt args: ap];
   va_end (ap);
   [self _merge: p];
 }
@@ -3365,7 +3365,7 @@
 {
   NSMutableArray        *p;
 
-  p = [_db prepare: stmt with: values];
+  p = [_owner prepare: stmt with: values];
   [self _merge: p];
 }
 
@@ -3373,10 +3373,10 @@
 {
   if (other != nil && other->_count > 0)
     {
-      if (NO == [_db isEqual: other->_db])
+      if (NO == [_owner isEqual: other->_owner])
        {
          [NSException raise: NSInvalidArgumentException
-                     format: @"[%@-%@] database client missmatch",
+                     format: @"[%@-%@] database owner missmatch",
            NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
        }
       if (_merge > 0)
@@ -3406,7 +3406,7 @@
   SQLTransaction        *c;
 
   c = (SQLTransaction*)NSCopyObject(self, 0, z);
-  c->_db = [c->_db retain];
+  c->_owner = [c->_owner retain];
   c->_info = [c->_info mutableCopy];
   return c;
 }
@@ -3418,12 +3418,12 @@
 
 - (id) db
 {
-  return _db;
+  return _owner;
 }
 
 - (void) dealloc
 {
-  [_db release]; _db = nil;
+  [_owner release]; _owner = nil;
   [_info release]; _info = nil;
   [super dealloc];
 }
@@ -3432,7 +3432,7 @@
 {
   return [NSString stringWithFormat: @"%@ with SQL '%@' for %@",
     [super description],
-    (_count == 0 ? (id)@"" : (id)_info), _db];
+    (_count == 0 ? (id)@"" : (id)_info), _owner];
 }
 
 - (void) execute
@@ -3445,14 +3445,14 @@
       NSRecursiveLock   *dbLock;
       BOOL              wrap;
 
-      if ([_db isKindOfClass: [SQLClientPool class]])
-        {
-          pool = (SQLClientPool*)_db;
+      if ([_owner isKindOfClass: [SQLClientPool class]])
+        {
+          pool = (SQLClientPool*)_owner;
           db = [pool provideClient];
         }
       else
         {
-          db = _db;
+          db = _owner;
         }
           
       dbLock = [db _lock];
@@ -3537,14 +3537,14 @@
       SQLClientPool     *pool = nil;
       SQLClient         *db;
 
-      if ([_db isKindOfClass: [SQLClientPool class]])
-        {
-          pool = (SQLClientPool*)_db;
+      if ([_owner isKindOfClass: [SQLClientPool class]])
+        {
+          pool = (SQLClientPool*)_owner;
           db = [pool provideClient];
         }
       else
         {
-          db = _db;
+          db = _owner;
         }
 
       dbLock = [db _lock];
@@ -3674,10 +3674,10 @@
                  format: @"[%@-%@] attempt to insert nil/empty transaction",
        NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
     }
-  if (NO == [_db isEqual: trn->_db])
+  if (NO == [_owner isEqual: trn->_owner])
     {
       [NSException raise: NSInvalidArgumentException
-                 format: @"[%@-%@] database client missmatch",
+                 format: @"[%@-%@] database owner missmatch",
        NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
     }
   trn = [trn copy];
@@ -3686,6 +3686,11 @@
   [trn release];
 }
 
+- (id) owner
+{
+  return _owner;
+}
+
 - (void) removeTransactionAtIndex: (unsigned)index
 {
   id   o;
@@ -3740,7 +3745,7 @@
   o = [_info objectAtIndex: index];
   if ([o isKindOfClass: NSArrayClass] == YES)
     {
-      SQLTransaction   *t = [[self db] transaction];
+      SQLTransaction   *t = [[self owner] transaction];
 
       [t addPrepared: o];
       return t;


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to