Usage

dbAPI-server is a JavaScript API, supporting create, select, insert, update, delete, alter, index commands using SQL syntax across different DBMS databases.The input and output format are described in section dbAPI parameters

Node.js usage:
var dbAPI = require('./dbAPI-server').dbAPI;
                         
dbAPI(input, function (error, output) { 
    if (!error){ //no error occurs
        console.log("Result: ", output.data.results);
    } else {
        console.log("Error/Warnings: ", error.others.message);
    }
});

dbAPI input object JSON:

input = {
    "requestID": "REQUEST_ID_TOKEN",
    "metadata": {
        "dbinfo": {
            "DBMS": "mysql/sqlite/couchdb/neo4j/redis",
            "cFile": "CONFIG_FILE_PATCH",
            "config":{
                "pin": "",
                "protocol": "",
                "host": "",
                "port": "",
                "user": "",
                "password": "",
                "database": ""
                },
            "connectionString": "CONNECTION_STRING",
            "dbInstance": CONNECTION_INSTANCE
        },
        "tbinfo": ""
    },
    "data": {
        "SQLtype":"create/select/insert/update/delete/alter/index",
        "format": "text",
        "szSQL": "SQL_QUERY_STRING"
    },
    "others": {
        "execution": "async/sync" //Default "async"
    }
}

dbAPI ouput object JSON:

output = {
      "requestID": "REQUEST_ID_TOKEN",
      "metadata": {
        "tbinfo": []
      },
      "data": {
        "format": "json",
        "results": []
      },
      "others": {
        "status": "ERROR_STATUS",
        "message": "ERROR_MESSAGE/WARNING_MESSAGE",
        "metrics": {
          "elapsedTime": "TOTAL_TIME_PERFORM",  //milliseconds
          "executionTime": "EXECUTE_QUERY_TIME", //milliseconds
          "resultCount": "NUMBER_ELEMENT_OF_RESULT",
          "resultSize": "SIZE_OF_RESULT"        //bytes
        }
      }
    }
Status error response:
  • 0 - success.
  • 199 - warning.
  • 400 - client error.
  • 500 - server error.
  • status of DBMS execution error response - DBMS execution error.