1 /**
  2  * Returns an array with the query results
  3  * @param jsonData
  4  * @return {*}
  5  * @constructor
  6  */
  7 exports.RowsArray = function (jsonData) {
  8   if (typeof  jsonData == 'undefined' || jsonData == null || jsonData.length == 0) {
  9     return null;
 10   }
 11 
 12   try {
 13     var fullArray = JSON.parse(jsonData);
 14     var arr = new Array();
 15 
 16     var rowsCount = fullArray['ColumnValues'].length;
 17     if (rowsCount <= 0) {
 18       return null;
 19     } else {
 20       for (var i = 0; i < rowsCount; i++) {
 21         arr[i] = fullArray['ColumnValues'][i];
 22       }
 23     }
 24     return arr;
 25   }
 26   catch (ex) {
 27     return null;
 28   }
 29 };
 30 
 31 /**
 32  * Returns an array with the query results column names
 33  * @param jsonData
 34  * @return {*}
 35  * @constructor
 36  */
 37 exports.ColumnNamesArray = function (jsonData) {
 38   if (typeof  jsonData == 'undefined' || jsonData == null || jsonData.length == 0) {
 39     return null;
 40   }
 41 
 42   var fullArray = '';
 43 
 44   try {
 45     fullArray = JSON.parse(jsonData);
 46 
 47     var rowsCount = fullArray['ColumnNames'].length;
 48     if (rowsCount <= 0) {
 49       return null;
 50     } else {
 51       return fullArray['ColumnNames'];
 52     }
 53   }
 54   catch (ex) {
 55     return null;
 56   }
 57 };
 58 
 59 /**
 60  * Returns an array with the query results columns data types
 61  * @param jsonData
 62  * @return {*}
 63  * @constructor
 64  */
 65 exports.ColumnTypesArray = function (jsonData) {
 66   if (typeof  jsonData == 'undefined' || jsonData == null || jsonData.length == 0) {
 67     return null;
 68   }
 69 
 70   var fullArray = '';
 71 
 72   try {
 73     fullArray = JSON.parse(jsonData);
 74 
 75     var rowsCount = fullArray['ColumnDataTypes'].length;
 76     if (rowsCount <= 0) {
 77       return null;
 78     } else {
 79       return fullArray['ColumnDataTypes'];
 80     }
 81   }
 82   catch (ex) {
 83     return null;
 84   }
 85 };
 86 
 87 /**
 88  * Returns the query results rows count
 89  * Please note that this is the total query rows count and not the current "batch of data" rows count.
 90  * @param jsonData
 91  * @return {*}
 92  * @constructor
 93  */
 94 exports.TotalRowsCount = function (jsonData) {
 95   if (typeof  jsonData == 'undefined' || jsonData == null || jsonData.length == 0) {
 96     return null;
 97   }
 98 
 99   var fullArray = '';
100 
101   try {
102     fullArray = JSON.parse(jsonData);
103 
104     var rowsCount = fullArray['RowsCount'];
105     if (rowsCount <= 0) {
106       return null;
107     } else {
108       return fullArray['RowsCount'];
109     }
110   }
111   catch (ex) {
112     return null;
113   }
114 };
115 
116