db = new DB(this, dbName, createOperationExecutor()); DB temp = dbCache.putIfAbsent(dbName, db); if (temp != null) {
public ActionResult GetJsonData() { var dpdminst = new DB(); var data = dpdminst.getdata(); return Json(data,JsonRequestBehaviour.AllowGet); }
var db = new DB(); ... if(db instanceof DB){ ... }
var DB = function(){ this.Read = function(index){ if(this.Test()){ return JSON.parse(localStorage[index]).data; } }, this.Write = function(index, data){ localStorage[index] = JSON.stringify({data : data}); } this.Test = function(){ return typeof localStorage == typeof {}; } } // example: var x = new DB(); // new data base x.Write('food', ['food','bar','google']); // write data console.log(x.Read('food')); // get data!
function DB () { return { setCurrentRecordId: function (id) { alert('setting id'); return localStorage.setItem('id', id); }, getCurrentRecordId: function () { return localStorage.getItem('id'); } } } var dbstuff = new DB(); dbstuff.setCurrentRecordId(3); dbstuff.getCurrentRecordId() // 3
function getConnection() { function DB(db1, stuff) { if (db1 instanceof DB) { return new DB(db1.db1, stuff); } this.db1 = db1; this.stuff = stuff; } // Add to prototype etc. return getCollection() .then(function(db1) { // Do stuff return new DB(db1, stuff); }) .then(function(db) { // Do stuff return new DB(db, stuff); }); }
String query = "select a.* from ((select name as text from a) union (select version as text from b) union (select id as text from c)) as a"; List<Map> result = new DB("default").all(query);
function DB () { this.newRecord = function () { var id = 3; // yes, since you invoked the DB constructor using // using the new keyword, this will be pointing to // the created instance this.setCurrentRecordId(id); }; this.setCurrentRecordId = function (id) { alert('setting id'); return localStorage.setItem('id', id); }; this.getCurrentRecordId = function () { return localStorage.getItem('id'); }; } var dbStuff = new DB(); dbStuff.newRecord(); alert(dbStuff.getCurrentRecordId());
var x = new DB(); // new data base if(!x.Test()) alert('Error!'); // not support! x.Write('food', ['food','bar','google']); // write data
try { ResultSet rst = new DB().Detail(mobile); if(rst.next()) { String fname = rst.getString("firstname"); String lname = rst.getString("lasttname"); String date = rst.getString("dateofbirth"); System.out.println("First name : " + fname + "\nLast Name : " + lname + "\nDate of Birth : " + date); } else { System.out.println("No data for the given parameter '" + mobile + "'"); } } catch (Exception exc) { exc.printStackTrace(); }
public User(String name) { DB db = new DB(); db.addUser(name); }
DB db = new DB(this); db.insertStudent(name, gender, age, password, course, modules);
public class MainActivity extends Activity { DB eventsDB; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); eventsDB = new DB(this); ... eventsDB.insertSite(objectSite); } ... }
// define model public class Person extends Model {} ... Base.open(...) // open default database DB otherDB = new DB("other_database"); otherDB.open(...); // open other database // read users from "other" database List<Map> users = db.findAll("select first_name \"firstname\" from users"); // save people into default database for(Map user: users){ Person p = new Person(); p.fromMap(user); p.saveIt; } Base.close(); otherDb.close();
DB db = new DB(); try { db.connect(); String query = "select count(1) from Stock where Part_name =" + ...; ResultSet rs = db.execSQL(query); if (!rs.next()) { PartNotFound nf = ...; nf.setVisible(true); } else { Receptionist_FranchiseePartFound part = new Receptionist_FranchiseePartFound(); part.setVisible(true); rowCount = rs.getInt(1); part.getTable().addRowSelectionInterval(0, rowCount); } } catch (Exception e) { ...error handling with stack trace/JOptionPane... }
@GET @Path("statement") @Produces({MediaType.APPLICATION_XML}) public Response statement(@QueryParam("from") String from, @QueryParam("to") String to) { DB idb = new DB(); List<Transaction> transactions = idb.getTransactionsByDate(from, to); final GenericEntity<List<Transaction>> entity = new GenericEntity<List<Transaction>>(transactions) { }; return Response.status(Response.Status.OK).entity(entity).build(); }
DB db = new DB(); // get rows of my first table and second table ResultSet firstRS = db.getMyFirstTable(); ResultSet seconRS = db.getSecondTable(); // compare the two tables while(firstRS.next() || secondRS.next()) { // get the row of my first table String firstRSRow = firstRS.getString("col1"); String secondRSRow = seconRS.getString("col1") // compare row from first table to the row in second table if(firstRSRow.startsWith(secondRSRow)) { // do some processing here.... } // end if } // end while
DB db = new DB(); for (Player p : db.getPlayers()) System.out.println(p.getName());
DB getData = new DB(this); getData.open(); for (int i = 1; value1 == null; i++) { String value1 = getData.getValue1(i); String value2 = getData.getValue2(i); x = Double.parseDouble(value1); y = Double.parseDouble(value2); mCurrentSeries.add(x, y); //*** this has to be inside the loop in order to draw more than one point *** } getData.close(); if (mChartView != null) { mChartView.repaint(); } }
public MongoGridFSSession(IMongoDataSourceAdapter dataSourceAdapter, String bucketName) throws Exception { this.__id = UUIDUtils.UUID(); this.__dataSourceHolder = dataSourceAdapter; this.__bucketName = StringUtils.defaultIfBlank(bucketName, GridFS.DEFAULT_BUCKET); // __gridFS = new GridFS(new DB(dataSourceAdapter.getMongoClient(), dataSourceAdapter.getDataSourceCfgMeta().getDatabaseName()), __bucketName); __dbCollection = __gridFS.getDB().getCollection(__bucketName.concat(".files")); }