Re: [android-developers] Shy are things not sending/recieving correctly from this database?

2012-02-19 Thread TreKing
On Sat, Feb 18, 2012 at 8:48 AM, Jeresam515 jeremyschiff...@gmail.comwrote:

 None of the notes are created and as such I can't do anything with them,
 help would be appreciated.


You need to debug your application and whittle the problem down to
something small and specific. No one is going to dig through that much code
to try to figure out an answer to your vague question for you.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Shy are things not sending/recieving correctly from this database?

2012-02-18 Thread Jeresam515
None of the notes are created and as such I can't do anything with
them, help would be appreciated. TestCount always returns 0.

package com.real;


import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class NotesDbAdapter {

public static final String KEY_VALUE = x;
public static final String KEY_ISROOT = y;
public static final String KEY_ROWID = _id;
public static final String KEY_REALROWID = _ids;
public static final String KEY_ISPOWER = z;
public static final String KEY_POWERORROOTNUMBER = b;
public static final String KEY_ISDIVISOR = a;
public static final String KEY_ISMULTIPLIER = c;
public static final String KEY_ISADD = d;
public static final String KEY_ISSUBTRACT = e;
public static final String KEY_ISPS = f;
public static final String KEY_ISPE = g;
private static final String TAG = NotesDbAdapter;
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_NAME = data;
private static final String DATABASE_TABLE = notes;
private static final int DATABASE_VERSION =20;
private static final String DATABASE_CREATE =
   create table  +DATABASE_TABLE+  (
 +KEY_VALUE+  double,  
 +KEY_REALROWID+  integer,  
 +KEY_ROWID+  integer primary key autoincrement,  
+KEY_ISPOWER+  boolean,  
+KEY_ISDIVISOR+  boolean,  
+KEY_ISMULTIPLIER+  boolean,  
+KEY_ISADD+  boolean,  
+KEY_ISSUBTRACT+  boolean,  
+KEY_ISPS+  boolean,  
+KEY_ISPE+  boolean,  
+KEY_POWERORROOTNUMBER+  double,  
 +KEY_ISROOT+  boolean);;
private final Context mCtx;

private static class DatabaseHelper extends SQLiteOpenHelper {

DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}


@Override
public void onCreate(SQLiteDatabase db) {
try {
db.execSQL(DATABASE_CREATE);
} catch (Exception e) {
Log.e(dbAdapter, e.getMessage().toString());
}
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
Log.w(TAG, Upgrading database from version  + oldVersion
+  to 
+ newVersion + , which will destroy all old
data);
db.execSQL(DROP TABLE IF EXISTS notes);
onCreate(db);
}

}

public NotesDbAdapter(Context ctx) {
this.mCtx = ctx;
}

public NotesDbAdapter open() throws SQLException {
mDbHelper = new DatabaseHelper(mCtx);
mDb = mDbHelper.getWritableDatabase();
return this;
}

public void close() {
mDbHelper.close();
}


public void createNote(double value, boolean isroot, boolean
ispower, boolean ismultiply, boolean isdivisor, boolean add,
boolean issubtract, double roototpowerval, boolean
paranthaseesend, boolean paranthaseesstart) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_VALUE, value);
initialValues.put(KEY_ISROOT, isroot);
initialValues.put(KEY_ISPOWER, ispower);
initialValues.put(KEY_ISMULTIPLIER, ismultiply);
initialValues.put(KEY_ISDIVISOR, isdivisor);
initialValues.put(KEY_ISADD, add);
initialValues.put(KEY_ISSUBTRACT, issubtract);
initialValues.put(KEY_POWERORROOTNUMBER, roototpowerval);
initialValues.put(KEY_ISPE, paranthaseesend);
initialValues.put(KEY_ISPS, paranthaseesstart);
  long r= mDb.insert(DATABASE_TABLE, null, initialValues);
  int a = testCount();
  ContentValues argsa = new ContentValues();
  argsa.put(KEY_VALUE, value);
  argsa.put(KEY_ISROOT, isroot);
  argsa.put(KEY_ISPOWER, ispower);
  argsa.put(KEY_ISMULTIPLIER, ismultiply);
  argsa.put(KEY_ISDIVISOR, isdivisor);
  argsa.put(KEY_ISADD, add);
  argsa.put(KEY_ISSUBTRACT, issubtract);
  argsa.put(KEY_POWERORROOTNUMBER, roototpowerval);
  argsa.put(KEY_REALROWID, a);
  argsa.put(KEY_ISPE, paranthaseesend);
  argsa.put(KEY_ISPS, paranthaseesstart);
  mDb.update(DATABASE_TABLE, argsa, KEY_ROWID + = + r, null);
}

public void deleteNote(long rowId) {
mDb.delete(DATABASE_TABLE, KEY_REALROWID + = + rowId, null);
int x = (int) rowId;
int y = testCount();
while(xy)
{x++;
Cursor note= fetchNote(x);
ContentValues argsan = new ContentValues();
argsan.put(KEY_VALUE,
note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE)));
argsan.put(KEY_ISROOT,