Changeset 1589:b29fc8876204
- Timestamp:
- 02/22/10 12:17:06 (5 months ago)
- Branch:
- default
- Location:
- apps
- Files:
-
- 3 edited
-
las2oci.cpp (modified) (12 diffs)
-
oci_wrapper.cpp (modified) (7 diffs)
-
oci_wrapper.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
apps/las2oci.cpp
r1587 r1589 38 38 #endif 39 39 40 40 typedef struct 41 { 42 long* srid; 43 44 } block; 45 41 46 bool KDTreeIndexExists(std::string& filename) 42 47 { … … 76 81 } 77 82 return istrm; 83 } 84 85 bool EnableTracing(OWConnection* connection) 86 { 87 ostringstream oss; 88 // http://www.oracle-base.com/articles/10g/SQLTrace10046TrcsessAndTkprof10g.php 89 oss << "ALTER SESSION SET EVENTS '10046 trace name context forever, level 12'"; 90 91 OWStatement* statement = 0; 92 93 statement = connection->CreateStatement(oss.str().c_str()); 94 95 if (statement->Execute() == false) { 96 97 std::cout << "statement execution failed " << CPLGetLastErrorMsg() << std::endl; 98 delete statement; 99 return 0; 100 } 78 101 } 79 102 … … 319 342 } 320 343 321 void GetElements( OWStatement* statement,344 void SetElements( OWStatement* statement, 322 345 OCIArray* sdo_elem_info, 323 346 bool bUseSolidGeometry) … … 338 361 } 339 362 340 void GetOrdinates( OWStatement* statement,363 void SetOrdinates( OWStatement* statement, 341 364 OCIArray* sdo_ordinates, 342 365 double x0, double x1, … … 376 399 377 400 ostringstream s_srid; 378 ostringstream s_gtype;401 long gtype; 379 402 ostringstream s_eleminfo; 380 403 bool bGeographic = false; 381 404 382 if (srid == 0) { 383 s_srid << "NULL"; 384 // bUse3d = true; 385 // bUseSolidGeometry = true; 386 } 387 else if (srid == 4326) { 388 // bUse3d = true; 389 // bUseSolidGeometry = true; 405 EnableTracing(connection); 406 407 if (srid == 4326) { 390 408 bGeographic = true; 391 s_srid << srid;392 // s_srid << "NULL";393 409 } 394 410 else { … … 402 418 if (bUse3d) { 403 419 if (bUseSolidGeometry == true) { 404 s_gtype << "3008"; 405 s_eleminfo << "(1,1007,3)"; 420 gtype = 3008; 406 421 407 422 } else { 408 s_gtype << "3003"; 409 s_eleminfo << "(1,1003,3)"; 410 423 gtype = 3003; 411 424 } 412 425 } else { 413 426 if (bUseSolidGeometry == true) { 414 s_gtype << "2008"; 415 s_eleminfo << "(1,1007,3)"; 416 427 gtype = 2008; 417 428 } else { 418 s_gtype << "2003"; 419 s_eleminfo << "(1,1003,3)"; 420 429 gtype = 2003; 421 430 } 422 431 } 423 432 424 433 double x0, x1, y0, y1, z0, z1; 425 double tolerance = 0.05;426 434 427 435 … … 446 454 z0 = 0.0; 447 455 z1 = 20000.0; 448 tolerance = 0.000000005;449 456 } else { 450 457 z0 = 0.0; … … 453 460 454 461 455 // std::cout << "use 3d?: " << bUse3d << " srid: " << s_srid.str() << std::endl;456 462 oss_geom.setf(std::ios_base::fixed, std::ios_base::floatfield); 457 463 oss_geom.precision(precision); 458 464 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"464 " mdsys.sdo_elem_info_array"<< s_eleminfo.str() <<",\n"465 " mdsys.sdo_ordinate_array(\n";466 oss_geom << x0 << ",\n" << y0 << ",\n";467 468 if (bUse3d) {469 oss_geom << z0 << ",\n";470 }471 472 oss_geom << x1 << ",\n" << y1 << "\n";473 474 if (bUse3d) {475 oss_geom << ",\n";476 oss_geom << z1;477 }478 479 long result_id = result.GetID();480 481 oss_geom << "))";482 465 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 491 // oss << "INSERT INTO "<< tableName << 492 // "(OBJ_ID, BLK_ID, NUM_POINTS, BLK_EXTENT, POINTS, " 493 // "PCBLK_MIN_RES, PCBLK_MAX_RES, NUM_UNSORTED_POINTS, PT_SORT_DIM) " 494 // "VALUES ( :1, :2, :3, " << oss_geom.str() << 495 // // << pc_id << "," << result.GetID() <<"," << num_points << ", " 496 // 497 // ",:4, 1, 1, 0, 1)"; 498 499 500 466 "(OBJ_ID, BLK_ID, NUM_POINTS, POINTS, " 467 "PCBLK_MIN_RES, BLK_EXTENT, PCBLK_MAX_RES, NUM_UNSORTED_POINTS, PT_SORT_DIM) " 468 "VALUES ( :1, :2, :3, :4, 1, mdsys.sdo_geometry(:5, :6, null,:7, :8)" 469 ", 1, 0, 1)"; 470 501 471 OWStatement* statement = 0; 502 472 OCILobLocator** locator =(OCILobLocator**) VSIMalloc( sizeof(OCILobLocator*) * 1 ); … … 535 505 536 506 // :5 537 int gtype = atoi(s_gtype.str().c_str());538 507 long* p_gtype = (long*) malloc (1 * sizeof(long)); 539 508 p_gtype[0] = gtype; 540 509 541 printf("gtype: %d %d %s\n", *p_gtype, gtype, s_gtype.str().c_str());542 510 statement->Bind(p_gtype); 543 511 … … 553 521 554 522 // :7 555 556 523 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()); 524 connection->CreateType(&sdo_elem_info, connection->GetElemInfoType()); 525 SetElements(statement, sdo_elem_info, bUseSolidGeometry); 526 statement->Bind(&sdo_elem_info, connection->GetElemInfoType()); 561 527 562 528 // :8 563 529 OCIArray* sdo_ordinates=0; 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());530 connection->CreateType(&sdo_ordinates, connection->GetOrdinateType()); 531 532 SetOrdinates(statement, sdo_ordinates, x0, x1, y0, y1, z0, z1, bUse3d); 533 statement->Bind(&sdo_ordinates, connection->GetOrdinateType()); 568 534 569 535 if (statement->Execute() == false) { … … 649 615 // } 650 616 617 651 618 if (srid == 0) { 652 619 s_srid << "NULL"; … … 785 752 } 786 753 754 755 787 756 long CreatePCEntry( OWConnection* connection, 788 757 LASQuery* query, -
apps/oci_wrapper.cpp
r1588 r1589 245 245 } 246 246 247 void OWConnection::CreateType( OCIArray* phData, OCIType* otype)247 void OWConnection::CreateType( OCIArray** phData, OCIType* otype) 248 248 { 249 249 CheckError( … … 256 256 OCI_DURATION_SESSION, 257 257 FALSE, 258 (dvoid **) &phData)258 (dvoid **)phData) 259 259 , 260 260 hError ); 261 261 } 262 262 263 void OWConnection::DestroyType( OCIArray* phData )263 void OWConnection::DestroyType( OCIArray** phData ) 264 264 { 265 265 CheckError( OCIObjectFree( 266 266 hEnv, 267 267 hError, 268 (OCIColl*) phData,268 (OCIColl*) *phData, 269 269 (ub2) 0), NULL ); 270 270 } … … 466 466 if( nStmtType != OCI_STMT_SELECT ) 467 467 { 468 nStmtMode = OCI_COMMIT_ON_SUCCESS;469 //nStmtMode = OCI_DEFAULT;468 // nStmtMode = OCI_COMMIT_ON_SUCCESS; 469 nStmtMode = OCI_DEFAULT; 470 470 471 471 } … … 648 648 649 649 nNextBnd++; 650 printf("Binding blob column #: %d\n", nNextBnd);651 650 CheckError( OCIBindByPos( 652 651 hStmt, … … 831 830 } 832 831 833 void OWStatement::Bind( OCIArray* pphData, OCIType* type )832 void OWStatement::Bind( OCIArray** pphData, OCIType* type ) 834 833 { 835 834 OCIBind* hBind = NULL; … … 857 856 hError, 858 857 type, 859 (dvoid **) &pphData,858 (dvoid **)pphData, 860 859 (ub4 *)0, 861 860 (dvoid **)0, … … 1109 1108 { 1110 1109 OCINumber oci_number; 1111 1112 1110 1113 1111 CheckError(OCINumberFromInt(hError, (dvoid *)&nValue, 1114 1112 (uword)sizeof(ub4), OCI_NUMBER_UNSIGNED, -
apps/oci_wrapper.h
r1583 r1589 232 232 void DestroyType( sdo_geometry** pphData ); 233 233 234 void CreateType( OCIArray* phData , OCIType* type);235 void DestroyType( OCIArray* phData );234 void CreateType( OCIArray** phData , OCIType* type); 235 void DestroyType( OCIArray** phData ); 236 236 237 237 OCIType* DescribeType( char *pszTypeName ); … … 296 296 void Bind( double* pnData ); 297 297 void Bind( char* pData, long nData); 298 void Bind( OCIArray* pphData, OCIType* type );298 void Bind( OCIArray** pphData, OCIType* type ); 299 299 300 300 void Define( double* pnData );
Note: See TracChangeset
for help on using the changeset viewer.
