I have this simple snippet, well not too simple that I needed to know how to make the connection or maybe a tip to tell me what code is this? appreciated. From the tags I'm assuming its one of them:
function Container(connectionString) {
var dataFetched = true;
var dbConnection = DbConnection(connectionString);
}
Container.prototype.getData = function () {
if (!this.dataFetched)
throw "Data not fetched!";
return this.data;
}
Container.prototype.fetch = function () {
this.dbConnection.getAllData(function (err, result) {
if (err) {
delete this.data;
this.dataFetched = false;
return false;
} else {
this.data = result;
this.dataFetched = true;
return true;
}
});
}
function DbConnection(connectionString) { }