diff --git a/src/zadf/zcl_adf_sqldb.clas.abap b/src/zadf/zcl_adf_sqldb.clas.abap deleted file mode 100644 index a53242a..0000000 --- a/src/zadf/zcl_adf_sqldb.clas.abap +++ /dev/null @@ -1,392 +0,0 @@ -class ZCL_ADF_SQLDB definition - public - create public . - -public section. - - data GV_DBCON type DBCON_NAME . - data GO_DBCON type ref to CL_SQL_CONNECTION . - - methods CONSTRUCTOR - importing - value(IV_DBCON) type DBCON_NAME - raising - CX_SQL_EXCEPTION - ZCX_ADF_SQLDB . - methods INSERT_TABLE - importing - value(IV_TABNAME) type TABNAME - value(IT_DATA) type ANY TABLE - raising - CX_SQL_EXCEPTION - ZCX_ADF_SQLDB . - methods INSERT_ROW - importing - value(IV_TABNAME) type TABNAME - value(IV_DATA) type DATA - raising - CX_SQL_EXCEPTION - ZCX_ADF_SQLDB . - methods DELETE_TABLE - importing - value(IV_TABNAME) type TABNAME - value(IT_DATA) type ANY TABLE - raising - CX_SQL_EXCEPTION - ZCX_ADF_SQLDB . - methods DELETE_ROW - importing - value(IV_TABNAME) type TABNAME - value(IV_DATA) type DATA - raising - CX_SQL_EXCEPTION - ZCX_ADF_SQLDB . - methods MODIFY_TABLE - importing - value(IV_TABNAME) type TABNAME - value(IT_DATA) type ANY TABLE - raising - CX_SQL_EXCEPTION - ZCX_ADF_SQLDB . - methods MODIFY_ROW - importing - value(IV_TABNAME) type TABNAME - value(IV_DATA) type DATA - raising - CX_SQL_EXCEPTION - ZCX_ADF_SQLDB . - methods COMMIT_DB - raising - CX_SQL_EXCEPTION - ZCX_ADF_SQLDB . - methods GENERATE_CREATE_STATEMENT - importing - value(IV_TABNAME) type TABNAME - returning - value(RV_STATEMENT) type STRING . - methods INSERT_MULTIPLE_ROWS - importing - value(IV_TABNAME) type TABNAME - value(IT_DATA) type ANY TABLE - returning - value(RV_ROWS) type INT4 . - methods DROP_TABLE - importing - value(IV_TABNAME) type TABNAME . - methods CREATE_TABLE - importing - value(IV_TABNAME) type TABNAME . -protected section. -private section. - - methods CHECK_CONNECTION - raising - CX_SQL_EXCEPTION - ZCX_ADF_SQLDB . - methods OPEN_CONNECTION . - methods CLOSE_CONNECTION . - methods GENERATE_INSERT_STATEMENT - importing - value(IV_TABNAME) type TABNAME - returning - value(RV_STATEMENT) type STRING . - methods GET_DDIC_FIELDS - importing - value(IV_TABNAME) type TABNAME - returning - value(RT_FIELDS) type ZADF_TT_DDFIELD . - methods UPDATE_MULTIPLE_ROWS . - methods SELECT_MULTIPLE_ROWS . - methods DELETE_MULTIPLE_ROWS . - methods INSERT_SINGLE_ROW . - methods SELECT_SINGLE_ROW . - methods UPDATE_SINGLE_ROW . -ENDCLASS. - - - -CLASS ZCL_ADF_SQLDB IMPLEMENTATION. - - -METHOD check_connection. - - open_connection( ). - close_connection( ). - -ENDMETHOD. - - -METHOD close_connection. - - DATA : lv_dbcon TYPE dbcon_name. - - lv_dbcon = go_dbcon->get_con_name( ). - CHECK lv_dbcon <> cl_sql_connection=>c_default_connection. - go_dbcon->close( ). - -ENDMETHOD. - - -method COMMIT_DB. -endmethod. - - -METHOD constructor. - - gv_dbcon = iv_dbcon. -* check_connection( ). - -ENDMETHOD. - - -METHOD create_table. - - DATA: lo_sqlerr_ref TYPE REF TO cx_sql_exception, - lv_stmt TYPE string, - lo_stmt_ref TYPE REF TO cl_sql_statement. - - IF go_dbcon IS NOT BOUND. - open_connection( ). - ENDIF. - - lo_stmt_ref = go_dbcon->create_statement( ). - lv_stmt = generate_create_statement( iv_tabname = iv_tabname ). - lo_stmt_ref->execute_ddl( lv_stmt ). - -ENDMETHOD. - - -method DELETE_MULTIPLE_ROWS. -endmethod. - - -METHOD delete_row. - - INSERT (iv_tabname) CLIENT SPECIFIED CONNECTION (gv_dbcon) - FROM iv_data. - -ENDMETHOD. - - -METHOD delete_table. - - DELETE (iv_tabname) CLIENT SPECIFIED CONNECTION (gv_dbcon) - FROM TABLE it_data. - -ENDMETHOD. - - -METHOD drop_table. - - DATA: lv_stmt TYPE string, - lv_stmt_ref TYPE REF TO cl_sql_statement. - - IF go_dbcon IS NOT BOUND. - open_connection( ). - ENDIF. - -* create a statement object - lv_stmt_ref = go_dbcon->create_statement( ). - -* create the statement string - CONCATENATE 'drop table' iv_tabname - INTO lv_stmt SEPARATED BY space. - -* execute the DDL command - lv_stmt_ref->execute_ddl( lv_stmt ). - - -ENDMETHOD. - - -METHOD generate_create_statement. - - DATA : lt_ddflds TYPE zadf_tt_ddfield, - ls_ddflds TYPE ddfield, - lv_stmt TYPE string, - lv_strlen TYPE i, - lt_dbflds TYPE TABLE OF dbftype, - ls_dbflds TYPE dbftype, - lv_field TYPE string, - lv_type TYPE string, - lv_length TYPE string, - lv_nullable TYPE string. - - lt_ddflds = get_ddic_fields( iv_tabname ). - - CALL FUNCTION 'DB_MAP_DDFIELDS' - EXPORTING - dbsys = sy-dbsys - with_check = ' ' - with_string = 'X' - nullable = 'X' - tabname = '' - TABLES - dbftypes = lt_dbflds - ddfields = lt_ddflds - EXCEPTIONS - not_mappable = 1 - OTHERS = 2. - IF sy-subrc <> 0. -* Implement suitable error handling here - ENDIF. - - LOOP AT lt_dbflds INTO ls_dbflds. - CONCATENATE '[' ls_dbflds-name ']' INTO lv_field. - SPLIT ls_dbflds-string AT '(' INTO lv_type lv_length. - CONCATENATE '[' lv_type ']' '(' lv_length INTO lv_type. - IF ls_dbflds-nullable IS INITIAL. - lv_nullable = 'NOT NULL'. - ELSE. - lv_nullable = 'NULL'. - ENDIF. - CONCATENATE lv_stmt lv_field lv_type lv_nullable ',' - INTO lv_stmt SEPARATED BY space. - ENDLOOP. - - lv_strlen = strlen( lv_stmt ). - lv_strlen = lv_strlen - 1. - lv_stmt = lv_stmt+0(lv_strlen). - - CONCATENATE '(' lv_stmt ')' INTO lv_stmt. - CONCATENATE 'CREATE TABLE' iv_tabname lv_stmt - INTO lv_stmt SEPARATED BY space. - - rv_statement = lv_stmt. - -ENDMETHOD. - - -METHOD generate_insert_statement. - - DATA : lt_ddflds TYPE zadf_tt_ddfield, - ls_ddflds TYPE ddfield, - lv_stmt TYPE string, - lv_strlen TYPE i. - - lt_ddflds = get_ddic_fields( iv_tabname ). - - LOOP AT lt_ddflds INTO ls_ddflds. - CONCATENATE lv_stmt '?,' INTO lv_stmt - SEPARATED BY space. - ENDLOOP. - lv_strlen = strlen( lv_stmt ). - lv_strlen = lv_strlen - 1. - lv_stmt = lv_stmt+0(lv_strlen). - - CONCATENATE '(' lv_stmt ')' INTO lv_stmt. - CONCATENATE 'INSERT INTO' iv_tabname 'VALUES' lv_stmt - INTO lv_stmt SEPARATED BY space. - - rv_statement = lv_stmt. - -ENDMETHOD. - - -METHOD get_ddic_fields. - - DATA: lv_tabname TYPE tabname, - lv_dbsys TYPE sy-dbsys, - lt_tabflds TYPE TABLE OF ddfield. - - - lv_dbsys = 'MSS'. - lv_tabname = iv_tabname. - TRANSLATE lv_tabname TO UPPER CASE. - - CALL FUNCTION 'DD_NAMETAB_TO_DDFIELDS' - EXPORTING - keyfields = 'X' - nullable = 'X' - tabname = lv_tabname - TABLES - ddfields = lt_tabflds. - - rt_fields = lt_tabflds. - -ENDMETHOD. - - -METHOD insert_multiple_rows. - - DATA : lv_stmt TYPE string, - lo_stmt_ref TYPE REF TO cl_sql_statement, - lo_table TYPE REF TO data. - - IF go_dbcon IS NOT BOUND. - open_connection( ). - ENDIF. - - lo_stmt_ref = go_dbcon->create_statement( ). - - GET REFERENCE OF it_data INTO lo_table. - lo_stmt_ref->set_param_table( lo_table ). - - lv_stmt = generate_insert_statement( iv_tabname ). - rv_rows = lo_stmt_ref->execute_update( lv_stmt ). - -ENDMETHOD. - - -METHOD insert_row. - - INSERT (iv_tabname) CLIENT SPECIFIED CONNECTION (gv_dbcon) - FROM iv_data. - -ENDMETHOD. - - -method INSERT_SINGLE_ROW. -endmethod. - - -METHOD insert_table. - - INSERT (iv_tabname) CLIENT SPECIFIED CONNECTION (gv_dbcon) - FROM TABLE it_data. - -ENDMETHOD. - - -METHOD modify_row. - - MODIFY (iv_tabname) CLIENT SPECIFIED CONNECTION (gv_dbcon) - FROM iv_data. - -ENDMETHOD. - - -METHOD modify_table. - - MODIFY (iv_tabname) CLIENT SPECIFIED CONNECTION (gv_dbcon) - FROM TABLE it_data. - -ENDMETHOD. - - -METHOD open_connection. - - IF gv_dbcon IS INITIAL. - CREATE OBJECT go_dbcon. - ELSE. - go_dbcon = cl_sql_connection=>get_connection( gv_dbcon ). - ENDIF. - -ENDMETHOD. - - -method SELECT_MULTIPLE_ROWS. -endmethod. - - -method SELECT_SINGLE_ROW. -endmethod. - - -method UPDATE_MULTIPLE_ROWS. -endmethod. - - -method UPDATE_SINGLE_ROW. -endmethod. -ENDCLASS. diff --git a/src/zadf/zcl_adf_sqldb.clas.xml b/src/zadf/zcl_adf_sqldb.clas.xml deleted file mode 100644 index 5bf134b..0000000 --- a/src/zadf/zcl_adf_sqldb.clas.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - ZCL_ADF_SQLDB - 1 - E - SAP-Azure Data Framework for SQL DB - 2 - 1 - X - X - X - - - - ZCL_ADF_SQLDB - CHECK_CONNECTION - E - Check the DB Connection - - - ZCL_ADF_SQLDB - CLOSE_CONNECTION - E - Close the DB Connection - - - ZCL_ADF_SQLDB - COMMIT_DB - E - Commit the DB Changes - - - ZCL_ADF_SQLDB - CONSTRUCTOR - E - Constructor Method - - - ZCL_ADF_SQLDB - CREATE_TABLE - E - Create table in SQL DB - - - ZCL_ADF_SQLDB - DELETE_MULTIPLE_ROWS - E - Delete Multiple rows from SQL DB - - - ZCL_ADF_SQLDB - DELETE_ROW - E - Delete a row from SQL DB - - - ZCL_ADF_SQLDB - DELETE_TABLE - E - Delete Multiple Rows from SQL DB - - - ZCL_ADF_SQLDB - DROP_TABLE - E - Drop the SQL DB Table - - - ZCL_ADF_SQLDB - GENERATE_CREATE_STATEMENT - E - Generate the Create SQL Statement - - - ZCL_ADF_SQLDB - GENERATE_INSERT_STATEMENT - E - Generate the Insert SQL Statement - - - ZCL_ADF_SQLDB - GET_DDIC_FIELDS - E - Get the fields Info from DDIC table - - - ZCL_ADF_SQLDB - GO_DBCON - E - Database Connection - - - ZCL_ADF_SQLDB - GV_DBCON - E - Description of Database Connections - - - ZCL_ADF_SQLDB - INSERT_MULTIPLE_ROWS - E - Insert Multiple rows into SQL DB - - - ZCL_ADF_SQLDB - INSERT_ROW - E - Insert a Row to SQL DB - - - ZCL_ADF_SQLDB - INSERT_SINGLE_ROW - E - Insert Single row of SQL DB - - - ZCL_ADF_SQLDB - INSERT_TABLE - E - Insert Multiple Row to SQL DB - - - ZCL_ADF_SQLDB - MODIFY_ROW - E - Modify a row in SQL DB - - - ZCL_ADF_SQLDB - MODIFY_TABLE - E - Modify Multiple Rows in SQL DB - - - ZCL_ADF_SQLDB - OPEN_CONNECTION - E - Open Connection to DB - - - ZCL_ADF_SQLDB - SELECT_MULTIPLE_ROWS - E - Select Multiple rows of SQL DB - - - ZCL_ADF_SQLDB - SELECT_SINGLE_ROW - E - Select Single row of SQL DB - - - ZCL_ADF_SQLDB - UPDATE_MULTIPLE_ROWS - E - Update Multiple rows of SQL DB - - - ZCL_ADF_SQLDB - UPDATE_SINGLE_ROW - E - Update Single row of SQL DB - - - - - diff --git a/src/zadf/zcl_adf_sqldb_scheduler.clas.abap b/src/zadf/zcl_adf_sqldb_scheduler.clas.abap deleted file mode 100644 index f6bde67..0000000 --- a/src/zadf/zcl_adf_sqldb_scheduler.clas.abap +++ /dev/null @@ -1,30 +0,0 @@ -class ZCL_ADF_SQLDB_SCHEDULER definition - public - final - create public . - -public section. - - data GV_DBCON type DBCON_NAME . - data GV_TABNAME type TABNAME . - - methods CONSTRUCTOR - importing - value(IV_DBCON) type DBCON_NAME - value(IV_TABNAME) type TABNAME . -protected section. -private section. -ENDCLASS. - - - -CLASS ZCL_ADF_SQLDB_SCHEDULER IMPLEMENTATION. - - -METHOD constructor. - - gv_dbcon = iv_dbcon. - gv_tabname = iv_tabname. - -ENDMETHOD. -ENDCLASS. diff --git a/src/zadf/zcl_adf_sqldb_scheduler.clas.xml b/src/zadf/zcl_adf_sqldb_scheduler.clas.xml deleted file mode 100644 index 3d70dcf..0000000 --- a/src/zadf/zcl_adf_sqldb_scheduler.clas.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - ZCL_ADF_SQLDB_SCHEDULER - 1 - E - SAP-Azure Data Framework SQL DB Scheduler - 2 - 1 - X - X - X - X - - - - ZCL_ADF_SQLDB_SCHEDULER - CONSTRUCTOR - E - Constructor Method - - - ZCL_ADF_SQLDB_SCHEDULER - GV_DBCON - E - Logical name for a database connection - - - ZCL_ADF_SQLDB_SCHEDULER - GV_TABNAME - E - Table Name - - - - -