[Liblas-commits] hg: add pre- and post-sql methods
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Oct 14 13:49:19 EDT 2009
changeset 5a13b5fc940a in /home/www/liblas.org/hg
details: http://hg.liblas.org/main/hg?cmd=changeset;node=5a13b5fc940a
summary: add pre- and post-sql methods
diffstat:
apps/las2oci.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 50 insertions(+), 3 deletions(-)
diffs (100 lines):
diff -r 487723ab179f -r 5a13b5fc940a apps/las2oci.cpp
--- a/apps/las2oci.cpp Tue Oct 13 21:25:48 2009 -0500
+++ b/apps/las2oci.cpp Wed Oct 14 12:46:35 2009 -0500
@@ -523,7 +523,8 @@
fprintf(stderr,"--cloud-table-name: (-cn) \n");
fprintf(stderr,"--overwrite: (-d) \n");
fprintf(stderr,"--srid: (-s) \n");
-
+ fprintf(stderr,"--pre-sql: (-prs) \"CREATE TABLE BASE (id number, cloud mdsys.sdo_pc)\" \n");
+ fprintf(stderr,"--post-sql: (-prs) \"UPDATE TABLE BASE SET ID=1\" \n");
fprintf(stderr,"las2oci -i output.las lidar/lidar at oraclemachine/instance \n"
"--block-table-name hobu_blocks --base-table-name hobu_base\n"
@@ -566,6 +567,9 @@
std::string base_table_name("HOBU");
std::string block_table_name("");
+ std::string pre_sql("");
+ std::string post_sql("");
+
bool bUseExistingBlockTable = false;
bool bDropTable = false;
liblas::uint32_t nCapacity = 10000;
@@ -595,7 +599,6 @@
strcmp(argv[i],"-d") == 0
)
{
- i++;
bDropTable=true;
}
else if ( strcmp(argv[i],"--blk_capacity") == 0 ||
@@ -641,9 +644,22 @@
)
{
i++;
- printf("have bk");
block_table_name = std::string(argv[i]);
}
+ else if ( strcmp(argv[i],"--pre-sql") == 0 ||
+ strcmp(argv[i],"-prs") == 0
+ )
+ {
+ i++;
+ pre_sql = std::string(argv[i]);
+ }
+ else if ( strcmp(argv[i],"--post-sql") == 0 ||
+ strcmp(argv[i],"-pos") == 0
+ )
+ {
+ i++;
+ post_sql = std::string(argv[i]);
+ }
else if (input.empty())
{
input = std::string(argv[i]);
@@ -721,6 +737,21 @@
DeleteTable(con, table_name.c_str(), base_table_name.c_str(), point_cloud_name.c_str());
}
+ if (!pre_sql.empty()) {
+ std::cout << "running pre-sql ..." << std::endl;
+ ostringstream oss;
+ oss << pre_sql;
+ OWStatement* statement = 0;
+ statement = Run(con, oss);
+ if (statement != 0) {
+ delete statement;
+ }
+ else {
+ std::cout << "pre-sql execution failed.." << std::endl;
+ return false;
+ }
+ oss.str("");
+ }
if (!BlockTableExists(con, table_name.c_str()))
CreateBlockTable(con, table_name.c_str());
else {
@@ -773,6 +804,22 @@
nCapacity);
+ if (!post_sql.empty()) {
+ std::cout << "running post-sql ..." << std::endl;
+
+ ostringstream oss;
+ oss << pre_sql;
+ OWStatement* statement = 0;
+ statement = Run(con, oss);
+ if (statement != 0) {
+ delete statement;
+ }
+ else {
+ std::cout << "post-sql execution failed.." << std::endl;
+ return false;
+ }
+ oss.str("");
+ }
}
//
More information about the Liblas-commits
mailing list