Changeset 1592:bdc2854f7e5a


Ignore:
Timestamp:
02/23/10 08:30:48 (5 months ago)
Author:
Howard Butler <hobu.inc@…>
Branch:
default
Message:

transaction and commit support

Location:
apps
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/las2oci.cpp

    r1591 r1592  
    435435    return e;     
    436436} 
     437blocks* CreateBlock(int size) 
     438{ 
     439    blocks* b = (blocks*) malloc( sizeof(blocks)); 
     440     
     441    b->pc_ids = (long*) malloc( size * sizeof(long)); 
     442    b->block_ids = (long*) malloc ( size * sizeof(long)); 
     443    b->num_points = (long*) malloc ( size * sizeof(long)); 
     444    b->blobs = (std::vector<liblas::uint8_t>**) malloc ( size * sizeof(std::vector<liblas::uint8_t>*)); 
     445 
     446    b->srids = (long*) malloc ( size * sizeof(long)); 
     447    b->gtypes = (long*) malloc ( size * sizeof(long)); 
     448 
     449    b->element_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*)); 
     450    b->coordinate_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*)); 
     451    
     452} 
    437453bool FillBlock( OWConnection* connection,  
    438454                OWStatement* statement, 
     
    441457                blocks* b, 
    442458                long index, 
    443                  
    444459                int srid,  
    445460                long pc_id, 
     
    450465                bool bUse3d, 
    451466                long nDimensions 
    452                  
    453467              ) 
    454468{ 
     
    479493    OCIArray* sdo_ordinates=0; 
    480494    connection->CreateType(&sdo_ordinates, connection->GetOrdinateType()); 
    481      
    482     extent* e = (extent*) malloc(sizeof(extent)); 
     495 
     496 
     497    bool bGeographic = false; 
     498     
     499    if (srid == 4326) { 
     500        bGeographic = true; 
     501    } 
     502    else { 
     503        // s_srid << srid; 
     504        // bUse3d = false; 
     505        // If the user set an srid and set it to solid, we're still 3d 
     506        // if (bUseSolidGeometry == true) 
     507        //     bUse3d = true; 
     508    } 
     509         
     510    extent* e = GetExtent(result, bUse3d, bGeographic); 
    483511    SetOrdinates(statement, sdo_ordinates, e); 
    484512 
     
    524552    list<SpatialIndex::id_type> const& ids = result.GetIDs(); 
    525553    const SpatialIndex::Region* b = result.GetBounds(); 
    526     liblas::uint32_t num_points =ids.size(); 
    527  
    528  
    529     long gtype = GetGType(bUse3d, bUseSolidGeometry); 
     554    liblas::uint32_t num_points = ids.size(); 
    530555 
    531556 
     
    545570    } 
    546571 
    547  
    548     double x0, x1, y0, y1, z0, z1; 
    549      
    550  
    551     x0 = b->getLow(0); 
    552     x1 = b->getHigh(0); 
    553     y0 = b->getLow(1); 
    554     y1 = b->getHigh(1); 
    555      
    556     if (bUse3d) { 
    557         try { 
    558             z0 = b->getLow(2); 
    559             z1 = b->getHigh(2); 
    560         } catch (Tools::IndexOutOfBoundsException& e) { 
    561             z0 = 0; 
    562             z1 = 20000; 
    563         } 
    564     } else if (bGeographic) { 
    565         x0 = -180.0; 
    566         x1 = 180.0; 
    567         y0 = -90.0; 
    568         y1 = 90.0; 
    569         z0 = 0.0; 
    570         z1 = 20000.0; 
    571     } else { 
    572         z0 = 0.0; 
    573         z1 = 20000.0;             
    574     } 
    575      
    576          
    577     // oss_geom.setf(std::ios_base::fixed, std::ios_base::floatfield); 
    578     // oss_geom.precision(precision); 
     572    long gtype = GetGType(bUse3d, bUseSolidGeometry); 
    579573 
    580574    oss << "INSERT INTO "<< tableName <<  
     
    626620     
    627621    // :6 
    628      
    629622    long* p_srid  = 0; 
    630623     
     
    664657 
    665658    delete statement; 
    666  
    667  
    668659     
    669660    return true; 
     
    10751066        return 0; 
    10761067    } 
     1068     
     1069    connection->Commit(); 
    10771070    output = *pc_id; 
    10781071     
     
    14281421    } 
    14291422 
     1423    con->StartTransaction(); 
    14301424 
    14311425    std::istream* istrm; 
  • apps/oci_wrapper.cpp

    r1589 r1592  
    408408} 
    409409 
     410bool OWConnection::StartTransaction() 
     411{ 
     412    CheckError( OCITransStart ( 
     413        hSvcCtx, 
     414        hError, 
     415        (uword) 30, 
     416        OCI_TRANS_NEW),  
     417    hError );    
     418     
     419    return true; 
     420} 
     421 
     422bool OWConnection::Commit() 
     423{ 
     424    CheckError( OCITransCommit ( 
     425        hSvcCtx, 
     426        hError, 
     427        OCI_DEFAULT),  
     428    hError ); 
     429     
     430    return true; 
     431} 
     432 
    410433/*****************************************************************************/ 
    411434/*                           OWStatement                                     */ 
  • apps/oci_wrapper.h

    r1589 r1592  
    249249    OCIType*            GetElemInfoType() {return hElemArrayTDO; } 
    250250    OCIType*            GetOrdinateType() {return hOrdinateArrayTDO; } 
     251     
     252    bool                Commit(); // OCITransCommit()  
     253    bool                StartTransaction(); //  //OCITransStart() 
     254    bool                EndTransaction() {Commit(); }  
    251255 
    252256}; 
Note: See TracChangeset for help on using the changeset viewer.