Giter Club home page Giter Club logo

hrtosqlite's Introduction

HRtoSQLite

HRtoSQLite utility transfers Oracle Database sample HR schema's data into SQLite database.

Motivations:

  • Get acquainted with the POCO C++.
  • Using POCO data access API for operating on SQLite database.
  • Make it cross-platform (Windows/Linux OS).

Features:

  • Oracle call interface (OCI) is used to Oracle database access;
  • Poco features:
    • there's used POCO-proposed skeleton for application organizing (Application class);
    • data access API (SQLite database);
    • command-line parameters handling feature;
    • logging into application log;
    • some utilities (e.g. string formatting);
  • "Google's C++ test" as a unit testing framework.
  • CMake based configuration;

Usage:


Command line arguments:

-h, --help                      display help information on command line arguments  
-C value, --ora-conn-str=value  Oracle connection string   (//host[:port]/service)  
-N value, --ora-name=value      Oracle user name (default: "hr")  
-P value, --ora-psw=value       Oracle user password  
-S file, --sqlt-ddl=file        HR-SQLite database structute intialization file  
                                (default: ./sql/hrSQLiteDDL.sql)  
-O file, --output=file          SQLite database file (default: ./hr.db)  

Connection string format confirms to Database Connection Strings for OCI Instant Client

Command line samples:

HRtoSQLite_run -C//oracle_host/xe -N hr -P hr -S./../sql/hrSQLiteDDL.sql
HRtoSQLite_run -C//oracle_host/xe -N hr -P hr -S./../sql/hrSQLiteDDL.sql -O./../dbs/hr.db

Building:


(On the development phase, there's used POCO version 1.7.4, Oracle client 12.1, googletest-1.14.0)

  • For linux:

    The project building is based on CMake configuration files.
    Set the next variables that define headers and libraries directories:

    • go into file HRtoSQLite/CMakeLists.txt and set OCI and Poco paths in variables:
      OCI_INC_DIR, OCI_LIB_DIR, POCO_INC_DIR, POCO_LIB_DIR;
    • go into file HRtoSQLite_tests/g.tests/CMakeLists.txt and set google test paths in variables:
      GTEST_INC_DIR, GTEST_LIB_DIR

    In case you use CLion IDE, open project root directory to explore all projects' structure, build them and run.

    To build it without IDE, using only CMake CLI, do steps like below:

      ```
      mkdir build-debug
      cd build-debug
      cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" ../.
      cmake --build ./ --target all
      ```
    
  • For Windows (Visual Studio 2015):

    -go into directory HRtoSQLite.VS2015 and open HRToSQLiteWS.sln solution;

      Projects sesttings suppose the next default headers and libraries directories configuration:   
    
      ..\..\..\vendor\instantclient_12_1\sdk\include  - OCI headers
      ..\..\..\vendor\poco-1.7.4\include              - POCO headers
      ..\..\..\vendor\instantclient_12_1\sdk\lib\msvc - OCI libraries
      .\..\..\vendor\poco-1.7.4\lib64                 - POCO libraries
    

    (note: there's only x64 configuration provided)

    Simulate a similar directories disposition (e.g. using file system links) or substitute these directories on yours in projects settings ("Additional Include Directories", "Additional Library Directories")

      To get "google test" framework integrated into Visual Studio IDE, install the next NuGet packages for 
      the project "HRtoSQLite_tests":
      - gtest 17.0
      - fix8.dependencies.gtest
      - fix8.dependencies.gtest.symbols
    

Testing:


To get the unit tests runnable, build the subproject HRtoSQLite_tests.
There are provided a set of tests for Oracle connection, reading 'HR' schema tables, writing data into SQLite database, e.g.

The tests are parametrized by environment variables:

ORA_CONN_STR   Oracle connection string
ORA_NAME       Oracle user name
ORA_PSW        Oracle user password 
SQLT_DDL       HR-SQLite database structure initialization file
OUTPUT         SQLite database file (default: ./hr.db)

Directory 'Launchers' contains some configuration and scripts to help test launching.
To launch unit tests from command line, setup variables in 'config.env' file and launch 'testLauncher' script.

Warning: in case these tests are launched under from IDE (CLion, VS 2015), setup the given environment variables in the respective configuration (debug/run) before debugging or running some test(s)!


Project built and tested under OS:

  • Windows 7 (64-bit) (Microsoft Visual Studio 2015 (Version 14.0.25123.00))
  • Ubuntu 16.04 LTS (64-bit) (g++ 5.4.0)
  • Red Hat 7.2 (64-bit) (g++ 4.8.5-11)

hrtosqlite's People

Contributors

victorkryz avatar

Watchers

 avatar

Forkers

utka-v-tapkah1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.