[Liblas-commits] hg: fix ReadSQLData to work with las2oci

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Sep 30 10:16:49 EDT 2010


changeset 9e9a4789f7d2 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=9e9a4789f7d2
summary: fix ReadSQLData to work with las2oci

diffstat:

 apps/las2oci.cpp  |   6 +++---
 apps/oci_util.cpp |  23 -----------------------
 apps/oci_util.hpp |   3 +++
 3 files changed, 6 insertions(+), 26 deletions(-)

diffs (83 lines):

diff -r 0ca912be5966 -r 9e9a4789f7d2 apps/las2oci.cpp
--- a/apps/las2oci.cpp	Thu Sep 30 08:06:41 2010 -0500
+++ b/apps/las2oci.cpp	Thu Sep 30 09:16:42 2010 -0500
@@ -917,7 +917,7 @@
             std::string sql = vm["pre-sql"].as< string >();
             bool used_file = false;
             try {
-                pre_sql = TryReadFileData(sql);
+                pre_sql = ReadSQLData(sql);
                 used_file = true;
             } catch (std::runtime_error const& e) {
                 boost::ignore_unused_variable_warning(e);
@@ -935,7 +935,7 @@
             std::string sql = vm["post-sql"].as< string >();
             bool used_file = false;
             try {
-                post_sql = TryReadFileData(sql);
+                post_sql = ReadSQLData(sql);
                 used_file = true;
             } catch (std::runtime_error const& e) {
                 boost::ignore_unused_variable_warning(e);
@@ -953,7 +953,7 @@
             std::string sql = vm["pre-block-sql"].as< string >();
             bool used_file = false;
             try {
-                pre_block_sql = TryReadFileData(sql);
+                pre_block_sql = ReadSQLData(sql);
                 used_file = true;
             } catch (std::runtime_error const& e) {
                 boost::ignore_unused_variable_warning(e);
diff -r 0ca912be5966 -r 9e9a4789f7d2 apps/oci_util.cpp
--- a/apps/oci_util.cpp	Thu Sep 30 08:06:41 2010 -0500
+++ b/apps/oci_util.cpp	Thu Sep 30 09:16:42 2010 -0500
@@ -1,29 +1,6 @@
 #include "oci_util.hpp"
 
 
-std::istream* OpenInput(std::string filename, bool bEnd) 
-{
-    std::ios::openmode mode = std::ios::in | std::ios::binary;
-    if (bEnd == true) {
-        mode = mode | std::ios::ate;
-    }
-    std::istream* istrm;
-    if (compare_no_case(filename.c_str(),"STDIN",5) == 0)
-    {
-        istrm = &std::cin;
-    }
-    else 
-    {
-        istrm = new std::ifstream(filename.c_str(), mode);
-    }
-    
-    if (!istrm->good())
-    {
-        delete istrm;
-        throw std::runtime_error("Reading stream was not able to be created");
-    }
-    return istrm;
-}
 
 std::string ReadSQLData(std::string filename)
 {
diff -r 0ca912be5966 -r 9e9a4789f7d2 apps/oci_util.hpp
--- a/apps/oci_util.hpp	Thu Sep 30 08:06:41 2010 -0500
+++ b/apps/oci_util.hpp	Thu Sep 30 09:16:42 2010 -0500
@@ -4,6 +4,7 @@
 
 #include "oci_wrapper.h"
 
+
 #include <fstream>
 #include <string>
 #include <sstream>
@@ -31,6 +32,8 @@
                     std::string cloudTableName, 
                     std::string cloudColumnName);
 std::string to_upper(const std::string&);
+std::string ReadSQLData(std::string filename);
+std::istream* OpenInput(std::string filename, bool bEnd) ;
 
 #ifdef _WIN32
 #define compare_no_case(a,b,n)  _strnicmp( (a), (b), (n) )


More information about the Liblas-commits mailing list