Code Monkey home page Code Monkey logo

Comments (2)

stockbal avatar stockbal commented on May 28, 2024 1

Hi @g-back,

it is certainly possible to also support MSSQL databases. As I only have access to ABAP Systems with HANA and Oracle DBMS connected, I did not want to implement and just blindly push it 😅.

The code that needs to be extended is not extensive:

  1. enable dbms support check in the following method

    METHOD is_db_supported.
    result = xsdbool( sy-dbsys = 'ORACLE' OR sy-dbsys = 'HDB' ).
    ENDMETHOD.

  2. create custom package reader implementation for MSSQL
    Here is the local class definition for HANA:

    CLASS lcl_hdb_scope_obj_reader DEFINITION
    INHERITING FROM lcl_adbc_scope_obj_reader_base.
    PUBLIC SECTION.
    METHODS constructor
    IMPORTING
    search_ranges TYPE zif_adcoset_ty_global=>ty_search_scope_ranges
    current_offset TYPE i.
    PROTECTED SECTION.
    METHODS combine_clauses REDEFINITION.
    METHODS build_offset_clause REDEFINITION.
    METHODS build_limit_clause REDEFINITION.
    ENDCLASS.

    and the corresponding implementation:
    CLASS lcl_hdb_scope_obj_reader IMPLEMENTATION.
    METHOD constructor.
    super->constructor( current_offset = current_offset
    search_ranges = search_ranges ).
    ENDMETHOD.
    METHOD combine_clauses.
    " HANA expects the LIMIT clause before the offset clause
    result = select_clause && from_clause && where_clause && order_by_clause && limit_clause && offset_clause.
    ENDMETHOD.
    METHOD build_limit_clause.
    limit_clause = |LIMIT { max_rows } |.
    ENDMETHOD.
    METHOD build_offset_clause.
    offset_clause = |OFFSET { current_offset }|.
    ENDMETHOD.
    ENDCLASS.

  3. return instance of the MSSQL implementation in the factory method for a package reader

    METHOD create_package_reader.
    " see domain DBSYS_TYPE_SELECTOR for possible values
    CASE sy-dbsys.
    WHEN 'ORACLE'.
    result = NEW lcl_oracle_scope_obj_reader( search_ranges = search_ranges
    current_offset = current_offset ).
    WHEN 'HDB'.
    result = NEW lcl_hdb_scope_obj_reader( search_ranges = search_ranges
    current_offset = current_offset ).
    ENDCASE.

I think that the implementation effort for MSSQL should be similar to Oracle and HANA. You have to check the native clauses for LIMIT and OFFSET in MSSQL and then adjust the implementation for MSSQL accordingly.

Regards,
Ludwig

from abap-code-search-tools.

stockbal avatar stockbal commented on May 28, 2024

Closed with #16

from abap-code-search-tools.

Related Issues (8)

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.