function addTableDataToArray() {

			mysql.query('SELECT * FROM `' + rows[iterator].table_name + '`', function(err, evtRows, evtCols) {

				if(err) {
					console.log('MYSQL', 'ERR', 'An error has occurred while extracting data from table \'' + rows[iterator].table_name + '\'');
					return errors.push(err);
				}


				var evtToAdd = { table_name: rows[iterator].table_name, rows: evtRows };
				eventsList.push(evtToAdd);

				iterator++;
				nTablesParsed++;

				if(nTablesParsed >= rows.length) {
					onGetEventsList(eventsList);
				} else {
					addTableDataToArray();
				}

			});
		}
/**
		 * Select contents of each table and add to array as object
		 */
Select contents of each table and add to array as object
Select contents of each table and add to array as object
function addTableDataToArray() {
			mysql.query('SELECT * FROM `' + rows[iterator].table_name + '`', function(err, evtRows, evtCols) {
				if(err) {
					console.log('MYSQL', 'ERR', 'An error has occurred while extracting data from table \'' + rows[iterator].table_name + '\'');
					return errors.push(err);
				}
				var evtToAdd = { table_name: rows[iterator].table_name, rows: evtRows };
				eventsList.push(evtToAdd);
				iterator++;
				nTablesParsed++;
				if(nTablesParsed >= rows.length) {
					onGetEventsList(eventsList);
				} else {
					addTableDataToArray();
				}
			});
		}
function addTableDataToArray ( ) { mysql . query ( 'SELECT * FROM `' + rows [ iterator ] . table_name + '`' , function ( err , evtRows , evtCols ) { if ( err ) { console . log ( 'MYSQL' , 'ERR' , 'An error has occurred while extracting data from table \'' + rows [ iterator ] . table_name + '\'' ) ; return errors . push ( err ) ; } var evtToAdd = { table_name : rows [ iterator ] . table_name , rows : evtRows } ; eventsList . push ( evtToAdd ) ; iterator ++ ; nTablesParsed ++ ; if ( nTablesParsed >= rows . length ) { onGetEventsList ( eventsList ) ; } else { addTableDataToArray ( ) ; } } ) ; }
Select contents of each table and add to array as object
Select contents of each table and add to array as object