/*****************************************************************************
FILE:               O2CI7Cursor.h
LANGUAGE:           Objective-C
SYSTEM:             GNUstep
USER-INTERFACE:     None
DESCRIPTION

    This class is a private class of the GNUstep/db adaptor to the 
    Oracle databases.
    It implements an object interface to the O2CI7 primitives, cursor-related.
    It's implementation is based on the O2CI7 v7, and should be compatible
    with, at least, both Oracle7 and Oracle8 databases.

AUTHORS
    <PJB> Pascal J. Bourguignon <pjb@imaginet.fr>
MODIFICATIONS
    1999/07/25 Creation.
BUGS
    - ...
LEGAL
    Written by:  Pascal J. Bourguignon <pjb@imaginet.fr>
    Funds from:  Orange Concept (http://www.orange-concept.com/)
    Date:        August 1999 - February 2000

    This file is part of the Oracle7 Adaptor, GNUstep Database Library.
    The Oracle7 Adaptor allows access to Oracle[678] databases from GDL.

    Copyright (C) 2000 Free Software Foundation, Inc.

    This  library is  free software;  you can  redistribute  it and/or
    modify it under the terms of the GNU Lesser General Public License
    as published by the Free  Software Foundation; either version 2 of
    the License, or (at your option) any later version.

    This library  is distributed in the  hope that it  will be useful,
    but  WITHOUT ANY WARRANTY;  without even  the implied  warranty of
    MERCHANTABILITY or FITNESS FOR  A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have  received a copy of the  GNU Lesser General Public
    License  along  with this  library;  if  not,  write to  the  Free
    Software  Foundation, Inc.,  59 Temple  Place, Suite  330, Boston,
    MA 02111-1307 USA
*****************************************************************************/
#ifndef __O2CI7Cursor_h__
#define __O2CI7Cursor_h__
#include <O2CI7Object.h>
#include <oci.h>


@class O2CI7Context;

@interface O2CI7Cursor:O2CI7Object
{
    O2CI7Context*       ociContext;
    Cda_Def             cda;
    BOOL                isOpen;
}


// NSObject methods:

    -(id)init;
        /*
            RAISE:      O2CI7Object_eBadInitializer.
        */

    -(void)dealloc;


// O2CI7Cursor methods:

    -(id)initWithContext:(O2CI7Context*)aContext;
        /*
            This is the designated initialized.
            aContext is the O2CI7 connection that created this cursor.
            PRE:        [aContext retainCount]==n
            POST:       [aContext retainCount]==n+1
        */

    -(BOOL)open;
    -(BOOL)close;

    -(BOOL)parseSQL:(NSString*)sqlStatement;
        /*
            DO:         analyse the sqlStatement and prepare for its execution.
        */

    -(ub2)sqlFunctionType;
        /*
            RETURN:     
        */

    -(BOOL)describeAttributeAtPosition:(sword)attrPosition
           size:(ub4*)attrSize type:(ub2*)attrType
           name:(sb1*)attrName nameSize:(ub4*)attrNameSize
           precision:(sb2*)prec scale:(sb2*)scale
           mayBeNull:(sb2*)attrNull;
        /*
            DO:         obtain a description of the attribute at position
                        attrPosition: it's size, it's type, the name of
                        the column.
                        attrNameSize is in/out: set it to the size of the
                        buffer allocated to attrName.
                        Other pointer parameters are out.

            NOTE:       describes should be done after binds.
        */
            

    -(BOOL)defineAttributeAtPosition:(sword)attrPosition
            buffer:(void*)attrBuffer size:(sword)attrSize type:(sword)attrType
            indicator:(sb2*)indicator dataLength:(ub2*)dataLength 
            returnCode:(ub2*)rcode;
        /*
            DO:         set up to store the attribute at position into the
                        buffer. position numbering starts from 1.
        */

    -(BOOL)execute;

    -(BOOL)fetch;
        /*
            RETURN:     whether the buffers attributed with 
                        defineAttributeAtPosition:buffer:size:type: 
                        are filled with data from a new row.

            NOTE:       A result of NO does not always mean that an error occured.
                        That may be the end-of-data. Check [self errorMessages].
        */


    -(BOOL)cancel;
    

    -(void)reportErrorFromOCI;
    -(void)reportErrorAlreadyOpen;
    -(void)reportErrorNotOpen;
    -(void)reportErrorOnClose;
    -(void)reportErrorCode:(ub2)rc functionCode:(ub1)fc;

@end // O2CI7Cursor;



#endif /* __O2CI7Cursor_h__ */
/*** O2CI7Cursor.h                    -- 2000-02-21 07:11:20 -- PJB ***/
