0
我想要翻译java中的一些目标C的代码为Android。我是Android新手,请任何人都可以帮助我如何执行这些查询。Sqlite查询从目标C到java
下面的代码是在目标C
private int getNextAccountIdForUserId (String userId, AccountType accountType)
{
int nextId = kFirstIDValue; //initial value is 0;
String queryString = "SELECT MAX(accountId) FROM MAAccounts WHERE userId = ? AND accountType = ?";
ResultSet resultSet = [_db executeQuery:queryString, [self stringToDB:userId], [self integerToDB:accountType], nil];
if([resultSet next])
{
int currentMax = [resultSet intForColumnIndex:0];
nextId = currentMax + 1;
}
[resultSet close];
return nextId;
}
如果有人能告诉我如何可以执行在Java源码此查询。
String queryString = "SELECT MAX(accountId) FROM MAAccounts WHERE userId = ? AND accountType = ?";
ACCOUNTTYPE类型是 “ACCOUNTTYPE”。它会继续工作吗?或者如果该类型是int或者其他什么会发生 – 2012-02-05 15:13:22