CursorJoiner problem the cursors not correctly move.

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

CursorJoiner problem the cursors not correctly move.

Postby Addion » Tue Oct 13, 2009 5:08 pm

I have a problem about using crossjoiner to join my database and Phones database. Below is the example code.
the crossjoiner can't join when the right side is 11 and 21. I don't know why it show up after 1 and 2 of the left side. I think the cursor of the right side was supposed to wait until the cursor of the left side had got 11 and 21, respectively.


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  Cursor c = mDbHelper.query(mytable,new String[] {phoneId}, personId + "=" + myPersonId);
  3.  
  4.  
  5.  
  6.  Cursor cursorFromPhones = managedQuery(Phones.CONTENT_URI, new String[] {Phones._ID, Phones.NUMBER, Phones.TYPE, Phones.LABEL}, null, null, null);
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14. CursorJoiner pid_joiner = new CursorJoiner(cursorFromPhones, new String[] {Phones._ID}, c, new String[] {phoneId});
  15.  
  16.  
  17.  
  18.  
  19.  
  20. for (CursorJoiner.Result joinerResult : pid_joiner) {
  21.  
  22. switch (joinerResult) {
  23.  
  24. case LEFT:
  25.  
  26.      System.out.println("LEFT");
  27.  
  28.      System.out.println(cursorFromPhones.getString(0));
  29.  
  30.      break;
  31.  
  32. case RIGHT:
  33.  
  34.      System.out.println("RIGHT");
  35.  
  36.      System.out.println(c.getString(0));
  37.  
  38.      break;
  39.  
  40. case BOTH:      
  41.  
  42.      System.out.println("BOTH");
  43.  
  44.      System.out.println(c.getString(0));
  45.  
  46.      System.out.println(cursorFromPhones.getString(0));
  47.  
  48.     break;
  49.  
  50. }
  51.  
  52. }
  53.  
  54.  
  55.  
  56.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


This is my logcat.

I/System.out( 2680): LEFT
I/System.out( 2680): 1
I/System.out( 2680): RIGHT
I/System.out( 2680): 11
I/System.out( 2680): LEFT
I/System.out( 2680): 2
I/System.out( 2680): RIGHT
I/System.out( 2680): 21
I/System.out( 2680): LEFT
I/System.out( 2680): 3
I/System.out( 2680): LEFT
I/System.out( 2680): 4
I/System.out( 2680): LEFT
I/System.out( 2680): 5
I/System.out( 2680): LEFT
I/System.out( 2680): 6
I/System.out( 2680): LEFT
I/System.out( 2680): 7
I/System.out( 2680): LEFT
I/System.out( 2680): 8
I/System.out( 2680): LEFT
I/System.out( 2680): 9
I/System.out( 2680): LEFT
I/System.out( 2680): 10
I/System.out( 2680): LEFT
I/System.out( 2680): 11
I/System.out( 2680): LEFT
I/System.out( 2680): 12
I/System.out( 2680): LEFT
I/System.out( 2680): 13
I/System.out( 2680): LEFT
I/System.out( 2680): 14
I/System.out( 2680): LEFT
I/System.out( 2680): 15
I/System.out( 2680): LEFT
I/System.out( 2680): 16
I/System.out( 2680): LEFT
I/System.out( 2680): 17
I/System.out( 2680): LEFT
I/System.out( 2680): 18
I/System.out( 2680): LEFT
I/System.out( 2680): 19
I/System.out( 2680): LEFT
I/System.out( 2680): 20
I/System.out( 2680): LEFT
I/System.out( 2680): 21
Addion
Developer
Developer
 
Posts: 29
Joined: Tue Nov 18, 2008 3:49 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 2 guests