String query = "select * from employee where employee_name = ?";
List employees = new ArrayList<>();
try (pStatement = con.pStatement(query)) {
pStatement.setString(1, "rajesh");
try (ResultSet rSet = pStatement.executeQuery()) {
while (rSet.next()) {
employees.add(rSet.getString(1));
}
}
}
Assert.assertEquals(1, employees.size());
Assert.assertTrue(employees.contains("rajesh"));
query = "insert into employee(employee_name, ramesh, madhav, vishnu) values(?, ?, ?, ?)";
int insertedRecordCount;
try (pStatement = con.pStatement(query)) {
pStatement.setString(1, "ravi");
pStatement.setInt(2, 239);
pStatement.setInt(3, 125);
pStatement.setInt(4, 11);
insertedRecordCount = pStatement.executeUpdate();
}
Assert.assertEquals(1, insertedRecordCount);
query = "update employee set blue = ? where employee_name = ?";
int updatedRecordCount;
try (pStatement = con.pStatement(query)) {
pStatement.setInt(1, 10);
pStatement.setString(2, "orange");
updatedRecordCount = pStatement.executeUpdate();
}
Assert.assertEquals(1, updatedRecordCount);
query = "delete from employee where employee_name = ?";
int deletedRecordCount;
try (pStatement = con.pStatement(query)) {
pStatement.setString(1, "ravi");
deletedRecordCount = pStatement.executeUpdate();
}
Assert.assertEquals(1, deletedRecordCount);
}
Answers
Answered by
1
Answer:
Wait it is written in JavaScript right?
Explanation:
Answered by
0
String where = " emp_id in (select _id from Employee where employee_name like ? )";
String[] whereArgs = new String[] {"'%" + mFilter + "%'" };
Cursor c = getDB(mContext).query("Salary", null, where, whereArgs,
null, null, null);
Explanation:
It it is only used for web applications & online publishing.
It is a fundamental part of an open-source enterprise known as Lamp.
Similar questions