Yuzz Web Framework Wiki
Yuzz NoSQL Compile-Time Checked HTML Web Framework
Status: Alpha
Brought to you by:
smceligot
Dbm dbm = new Dbm(); dbm.open(); long rowid = -1L; try { Schema schema = createSchema("secondary"); DbIndex bySubject = new DbIndex("subject", ColType.STRING); schema.addIndex(bySubject); DbTable table = dbm.getTable(schema); { { DbRow row = table.newRow(); row.setString("subject", "first"); row.setString("text", "first text"); table.saveRow(row); } { DbRow row = table.newRow(); row.setString("subject", "Hello"); row.setString("text", "Hello World!"); table.saveRow(row); rowid = row.getRowId(); } { DbRow row = table.newRow(); row.setString("subject", "last"); row.setString("text", "last text"); table.saveRow(row); } } { DbRow row = table.getRow(bySubject, new DatabaseColumn("Hello")); String subject = row.getString("subject"); String text = row.getString("text"); System.out.println("get row by subject: "+row.getRowId()+":"+row.getString("subject")); assertEquals(rowid, row.getRowId()); assertEquals("Hello", subject); assertEquals("Hello World!", text); } } finally { dbm.close(); }