Changeset 1587:2c9c86274a23


Ignore:
Timestamp:
02/20/10 14:27:38 (5 months ago)
Author:
Howard Butler <hobu.inc@…>
Branch:
default
Message:

more oracle

Location:
apps
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/las2oci.cpp

    r1583 r1587  
    338338} 
    339339 
     340void GetOrdinates(   OWStatement* statement, 
     341                     OCIArray* sdo_ordinates,  
     342                     double x0, double x1,  
     343                     double y0, double y1, 
     344                     double z0, double z1, 
     345                     bool bUse3d) 
     346{ 
     347     
     348    statement->AddElement(sdo_ordinates, x0); 
     349    statement->AddElement(sdo_ordinates, y0); 
     350    if (bUse3d) 
     351        statement->AddElement(sdo_ordinates, z0); 
     352     
     353    statement->AddElement(sdo_ordinates, x1); 
     354    statement->AddElement(sdo_ordinates, y1); 
     355    if (bUse3d) 
     356        statement->AddElement(sdo_ordinates, z1); 
     357         
     358 
     359} 
    340360bool InsertBlock(OWConnection* connection,  
    341361                const LASQueryResult& result,  
     
    437457    oss_geom.precision(precision); 
    438458 
    439     oss_geom << "           mdsys.sdo_geometry("<<s_gtype.str() <<", "<<s_srid.str()<<", null,\n" 
     459//     oss_geom << "           mdsys.sdo_geometry("<<s_gtype.str() <<", "<<s_srid.str()<<", null,\n" 
     460// "              mdsys.sdo_elem_info_array"<< s_eleminfo.str() <<",\n" 
     461// "              mdsys.sdo_ordinate_array(\n"; 
     462 
     463    oss_geom << "           mdsys.sdo_geometry(:5, :6, null,\n" 
    440464"              mdsys.sdo_elem_info_array"<< s_eleminfo.str() <<",\n" 
    441465"              mdsys.sdo_ordinate_array(\n"; 
    442  
    443466    oss_geom << x0 << ",\n" << y0 << ",\n"; 
    444467 
     
    457480     
    458481    oss_geom << "))"; 
     482    oss << "INSERT INTO "<< tableName <<  
     483            "(OBJ_ID, BLK_ID, NUM_POINTS, POINTS, BLK_EXTENT,  " 
     484            "PCBLK_MIN_RES, PCBLK_MAX_RES, NUM_UNSORTED_POINTS, PT_SORT_DIM) " 
     485            "VALUES ( :1, :2, :3, :4, " << oss_geom.str() << //:7, :8)"  
     486            // << pc_id << "," << result.GetID() <<"," << num_points << ", "  
     487            // << oss_geom.str() <<", :1" 
     488            ", 1, 1, 0, 1)"; 
     489 
     490 
    459491    // oss << "INSERT INTO "<< tableName <<  
    460492    //         "(OBJ_ID, BLK_ID, NUM_POINTS, BLK_EXTENT, POINTS, " 
    461493    //         "PCBLK_MIN_RES, PCBLK_MAX_RES, NUM_UNSORTED_POINTS, PT_SORT_DIM) " 
    462     //         "VALUES ( :1, :2, :3, :4, MDSYS.SDO_GEOMETRY(:5, :6, null, :7, :8)"  
     494    //         "VALUES ( :1, :2, :3, " << oss_geom.str() << 
    463495    //         // << pc_id << "," << result.GetID() <<"," << num_points << ", "  
    464     //         // << oss_geom.str() <<", :1" 
    465     //         ", 1, 1, 0, 1)"; 
    466  
    467  
    468     oss << "INSERT INTO "<< tableName <<  
    469             "(OBJ_ID, BLK_ID, NUM_POINTS, BLK_EXTENT, POINTS, " 
    470             "PCBLK_MIN_RES, PCBLK_MAX_RES, NUM_UNSORTED_POINTS, PT_SORT_DIM) " 
    471             "VALUES ( :1, :2, :3, " << oss_geom.str() << 
    472             // << pc_id << "," << result.GetID() <<"," << num_points << ", "  
    473               
    474             ",:4, 1, 1, 0, 1)"; 
     496    //           
     497    //         ",:4, 1, 1, 0, 1)"; 
     498 
     499 
    475500             
    476501    OWStatement* statement = 0; 
     
    492517     
    493518    // :1 
    494     statement->Bind( &pc_id ); 
     519    statement->Bind( p_pc_id ); 
    495520     
    496521    // :2 
     
    512537    int gtype = atoi(s_gtype.str().c_str()); 
    513538    long* p_gtype = (long*) malloc (1 * sizeof(long)); 
    514     *p_gtype = gtype; 
     539    p_gtype[0] = gtype; 
    515540 
    516541    printf("gtype: %d %d %s\n", *p_gtype, gtype, s_gtype.str().c_str()); 
    517     // statement->Bind(p_gtype); 
     542    statement->Bind(p_gtype); 
    518543     
    519544    // :6 
    520     int* p_srid = (int*) malloc (1 * sizeof(int)); 
    521     *p_srid = srid; 
    522     // statement->Bind(p_srid); 
     545     
     546    long* p_srid  = 0; 
     547     
     548    if (srid) { 
     549        p_srid = (long*) malloc (1 * sizeof(long)); 
     550        p_srid[0] = srid; 
     551    } 
     552    statement->Bind(p_srid); 
    523553     
    524554    // :7 
    525555 
    526556    OCIArray* sdo_elem_info=0; 
     557    // connection->CreateType(sdo_elem_info, connection->GetElemInfoType()); 
     558    // GetElements(statement, sdo_elem_info, bUseSolidGeometry); 
     559     
     560    // statement->Bind(sdo_elem_info, connection->GetElemInfoType()); 
     561     
     562    // :8 
    527563    OCIArray* sdo_ordinates=0; 
    528      
    529     connection->CreateType(sdo_elem_info, connection->GetElemInfoType()); 
    530     connection->CreateType(sdo_ordinates, connection->GetOrdinateType()); 
    531  
    532     // GetElements(statement, sdo_elem_info, bUseSolidGeometry); 
    533      
    534     // statement->Bind(sdo_elem_info, connection->GetElemInfoType()); 
    535      
    536     // :8 
    537     // statement->Bind(ordinates); 
     564    // connection->CreateType(sdo_ordinates, connection->GetOrdinateType()); 
     565     
     566    // GetOrdinates(statement, sdo_ordinates, x0, x1, y0, y1, z0, z1, bUse3d); 
     567    // statement->Bind(sdo_ordinates, connection->GetOrdinateType()); 
    538568     
    539569    if (statement->Execute() == false) { 
  • apps/oci_wrapper.cpp

    r1586 r1587  
    584584 
    585585    nNextCol++; 
    586  
     586     
     587    sb4 s = -1; 
     588     
     589    if (pnData != NULL)  
     590        s = (sb4)sizeof(long); 
     591     
     592    printf("Setting size to %d\n", s); 
    587593    CheckError( OCIDefineByPos( hStmt, 
    588594        &hDefine, 
     
    590596        (ub4) nNextCol, 
    591597        (dvoid*) pnData, 
    592         (sb4) sizeof(long), 
     598        (sb4) s, 
    593599        (ub2) SQLT_LNG, 
    594600        (void*) NULL, 
     
    605611     
    606612    printf("Binding long column #: %d\n", nNextBnd); 
     613 
     614    sb4 s = 0; 
     615     
     616    if (pnData != NULL)  
     617        s = (sb4)sizeof(long int); 
     618     
     619    printf("Setting size to %d\n", s); 
    607620    CheckError( OCIBindByPos( 
    608621        hStmt, 
     
    611624        (ub4) nNextBnd, 
    612625        (dvoid*) pnData, 
    613         (sb4) sizeof(long), 
    614         (ub2) SQLT_NUM, 
     626        (sb4) s, 
     627        (ub2) SQLT_INT, 
    615628        (void*) NULL, 
    616629        (ub2*) NULL, 
Note: See TracChangeset for help on using the changeset viewer.