Author: byterock
Date: Tue Dec 11 04:25:11 2007
New Revision: 10406

Modified:
   dbd-oracle/trunk/dbdimp.h
   dbd-oracle/trunk/oci8.c

Log:
working version

Modified: dbd-oracle/trunk/dbdimp.h
==============================================================================
--- dbd-oracle/trunk/dbdimp.h   (original)
+++ dbd-oracle/trunk/dbdimp.h   Tue Dec 11 04:25:11 2007
@@ -166,8 +166,8 @@
     OCITypeCode        element_typecode;       /*if collection this is its 
element's OCI_ATTR_TYPECODE*/
        OCIRef          *obj_ref;                       /*if an embeded object 
this is ref handle to its TDO*/
 
-       dvoid                   **obj_instance;
-       dvoid                   *obj_ind;
+       OCIComplexObject                        **obj_instance;
+       OCIComplexObject                        *obj_ind;
        OCIComplexObject *obj_value;        /*the actual value from the DB*/
        OCIType         *obj_type;              /*if an embeded object this is 
the  OCIType returned by a OCIObjectPin*/
     fbh_obj_t       *fields;                   /*one object for each 
field/property*/

Modified: dbd-oracle/trunk/oci8.c
==============================================================================
--- dbd-oracle/trunk/oci8.c     (original)
+++ dbd-oracle/trunk/oci8.c     Tue Dec 11 04:25:11 2007
@@ -1398,35 +1398,36 @@
        for (pos = 0; pos < obj->field_count; pos++){
                                fld = &obj->fields[pos]; /*get the field */
 
-/* status = OCITypeAttrs(fbh->imp_sth->envhp, obj->obj_type);*/
-
+status=OCIObjectGetInd(fbh->imp_sth->envhp,fbh->imp_sth->errhp,value,&obj->obj_ind);
+PerlIO_printf(DBILOGFP, "OCIObjectGetInd=%d\n",status);
                                status = OCIObjectGetAttr(fbh->imp_sth->envhp, 
fbh->imp_sth->errhp, value,
                                                                                
obj->obj_ind, obj->tdo,
                                                                                
&fld->type_name, &fld->type_namel, 1,
                                                                                
(ub4 *)0, 0, &attr_null_status, &attr_null_struct,
                                                                                
&attr_value, &attr_tdo);
 
-                                                                               
OCIObjectPin_log_stat(fbh->imp_sth->envhp,fbh->imp_sth->errhp, attr_tdo,(dvoid  
**)&obj->obj_type,status);
-                                                                               
PerlIO_printf(DBILOGFP, "OCIObjectPin_log_stat=%d\n",attr_null_status);
-
 PerlIO_printf(DBILOGFP, "attr_null_status=%d\n",attr_null_status);
-                               if (status != OCI_SUCCESS) {
+                                               if (status != OCI_SUCCESS) {
                                        oci_error(sth, fbh->imp_sth->errhp, 
status, "OCIObjectGetAttr");
                                        return 0;
                        }
-                               if (fld->typecode == OCI_TYPECODE_OBJECT || 
fld->typecode == OCI_TYPECODE_VARRAY || fld->typecode == OCI_TYPECODE_TABLE || 
fld->typecode == OCI_TYPECODE_NAMEDCOLLECTION){
-
-                               fld->fields[0].value = newAV();
-                                       attr_value = *(dvoid **)attr_value;
-                                       get_object (sth,fld->fields[0].value, 
fbh, &fld->fields[0],attr_value);
-                                       av_push(list, newRV_noinc((SV *) 
fld->fields[0].value));
+                       
+                       if (attr_null_status==OCI_IND_NULL){
+                                    av_push(list,  &sv_undef);
+                               } else {
+                                       if (fld->typecode == 
OCI_TYPECODE_OBJECT || fld->typecode == OCI_TYPECODE_VARRAY || fld->typecode == 
OCI_TYPECODE_TABLE || fld->typecode == OCI_TYPECODE_NAMEDCOLLECTION){
 
-                } else{  /* else, display the scaler type attribute */
+                                       fld->fields[0].value = newAV();
+                                               attr_value = *(dvoid 
**)attr_value;
+                                               get_object 
(sth,fld->fields[0].value, fbh, &fld->fields[0],attr_value);
+                                               av_push(list, newRV_noinc((SV 
*) fld->fields[0].value));
 
-                    get_attr_val(list, fbh, fld->type_name, fld->typecode, 
attr_value);
+                       } else{  /* else, display the scaler type attribute */
 
-                }
+                           get_attr_val(list, fbh, fld->type_name, 
fld->typecode, attr_value);
 
+                       }
+                               }
              }
 
         /*    status = OCIObjectFree(fbh->imp_sth->envhp, fbh->imp_sth->errhp, 
value,
@@ -1718,25 +1719,7 @@
                }
                /*we will need a reff to the TDO for the pin operation*/
 
-
-
-status=OCIObjectNew (imp_sth->envhp,
-                     imp_sth->errhp,
-                     imp_sth->svchp,
-                    OCI_TYPECODE_OBJECT,
-                    obj->tdo,
-                    (dvoid *)0,
-                     OCI_DURATION_TRANS,
-                     1,
-                     obj->obj_instance );
-                     PerlIO_printf(DBILOGFP, "OCIObjectNew 
status=%d\n",status);
-
-
- status=OCIObjectGetInd(imp_sth->envhp,imp_sth->errhp,obj->obj_instance,(dvoid 
 **) &obj->obj_ind);
-
-PerlIO_printf(DBILOGFP, "OCIObjectGetInd status=%d\n",status);
-
-               OCIObjectPin_log_stat(imp_sth->envhp,imp_sth->errhp, 
obj->obj_ref,(dvoid  **)&obj->obj_type,status);
+               OCIObjectPin_log_stat(imp_sth->envhp,imp_sth->errhp, 
obj->obj_ref,(dvoid  **)&obj->obj_instance,status);
 
 
                if (status != OCI_SUCCESS) {

Reply via email to