Bug #40242 NDBAPI : All NDBAPI objects should provide accessors for their 'parents'
Submitted: 22 Oct 2008 14:03 Modified: 12 Nov 2008 22:03
Reporter: Frazer Clement
Status: Closed
Category:Server: Docs Severity:S3 (Non-critical)
Version:5.1-telco-6.2+ OS:Any
Assigned to: Jon Stephens Target Version:
Triage: Triaged: D4 (Minor) / R2 (Low) / E2 (Low)

[22 Oct 2008 14:03] Frazer Clement
Description:
To simplify client error handling code, and code in NDBAPI wrapper frameworks, it should
be easier to navigate up the hierarchy of NDBAPI objects, for example : 

NdbBlob -> Ndb(Scan)Operation -> NdbTransaction
 

How to repeat:
Look at NdbBlob.hpp - no way to obtain 'parent' Transaction or Operation object pointers.

Suggested fix:
Add new accessor methods to NdbBlob and other Apis
[22 Oct 2008 18:57] Frazer Clement
Proposed patch adding accessors to NDBAPI objects

Attachment: bug40242.patch (text/x-patch), 3.37 KiB.

[22 Oct 2008 19:01] Frazer Clement
Cleaned up patch originally proposed for Bug#31775.

const NdbOperation* is returned as :
 1) Don't want to return non-const NdbOperation* to NdbRecord operation
 2) Don't want to have runtime checks of operation type to avoid returning null non-const
NdbOperation* for NdbRecord ops. 
 3) Expect that navigating up from Blob to operation would be done as part of error
handling post-execution rather than before, when users might try to modify the operation
before it's executed.

As a side-effect, the NdbOperation::getNdbErrorLine() method is modified to be const so
that it can be used with a const NdbOperation*
[6 Nov 2008 12:13] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/57996

2718 Frazer Clement	2008-11-06
      Bug# 40242 NDBAPI : All NDBAPI objects should provide accessors for their 'parents'
      
      This patch adds :
       - getNdbOperation() method to NdbBlob to get const operation*
       - getNdbTransaction() method to NdbScanOperation and NdbOperation to get
NdbTransaction*
       - const variant of getNdbErrorLine() to NdbOperation to allow error handling with
         a const*.
[8 Nov 2008 21:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/58251

2723 Frazer Clement	2008-11-08
            Bug# 40242 NDBAPI : All NDBAPI objects should provide accessors for their
'parents'
            
            This patch adds :
             - getNdbOperation() method to NdbBlob to get const operation*
             - getNdbTransaction() method to NdbScanOperation and NdbOperation to get
NdbTransaction*
             - const variant of getNdbErrorLine() to NdbOperation to allow error handling
with
               a const*.
[8 Nov 2008 23:19] Bugs System
Pushed into 5.1.29-ndb-6.4.0  (revid:frazer@mysql.com-20081108204015-izsn1r9ac1eqrwbs)
(version source revid:frazer@mysql.com-20081108214303-z8nr2z5c1yccxac8) (pib:5)
[8 Nov 2008 23:43] Bugs System
Pushed into 5.1.29-ndb-6.2.17  (revid:frazer@mysql.com-20081108204015-izsn1r9ac1eqrwbs)
(version source revid:frazer@mysql.com-20081108204015-izsn1r9ac1eqrwbs) (pib:5)
[8 Nov 2008 23:45] Bugs System
Pushed into 5.1.29-ndb-6.3.19  (revid:frazer@mysql.com-20081108204015-izsn1r9ac1eqrwbs)
(version source revid:frazer@mysql.com-20081108212257-xppq7h6xmg3wduzp) (pib:5)
[12 Nov 2008 14:34] Jon Stephens
Documented bugfix in the ndb-6.2.17 and ndb-6.3.19 changelogs as follows:

        It was not always possible to access parent objects directly
        from NdbBlob, NdbOperation, and NdbScanOperation objects. To fix
        this problem, a new getNdbOperation() method has been added to
        NdbBlob and new getNdbTransaction() method has been added to
        NdbOperation and NdbScanOperation. In addition, a const variant
        of NdbOperation::getErrorLine() is now also available.
[12 Nov 2008 14:39] Jon Stephens
Changing this to a Docs bug and assigning to myself so I won't forget to document the new
API methods after lunch. :)
[12 Nov 2008 22:03] Jon Stephens
NDBAPI docs updated, commit is here: http://lists.mysql.com/commits/58584
[13 Dec 2008 0:30] Bugs System
Pushed into 6.0.9-alpha  (revid:frazer@mysql.com-20081108204015-izsn1r9ac1eqrwbs) (version
source revid:tomas.ulin@sun.com-20081209185954-9svcixh2p5hsfi6w) (pib:5)