· 8 years ago · Aug 28, 2018, 01:44 PM
1Database Table Inserts, Exception 19, and Physical Location
2import android.content.ContentValues;
3import android.content.Context;
4import android.database.Cursor;
5import android.database.SQLException;
6import android.database.sqlite.SQLiteDatabase;
7import android.database.sqlite.SQLiteOpenHelper;
8import android.util.Log;
9
10public class DBAdapter {
11
12 private static final String TAG = "DBAdapter";
13 private static final String DATABASE_NAME = "vardata";
14 private static final String DATABASE_TABLE_1 = "inspection";
15 private static final String DATABASE_TABLE_2 = "fedexvehicles";
16 private static final String DATABASE_TABLE_3 = "attachments";
17 private static final String DATABASE_TABLE_4 = "nonvehicles";
18 private static final String DATABASE_TABLE_5 = "property";
19 private static final String DATABASE_TABLE_6 = "people";
20 private static final String DATABASE_TABLE_7 = "photos";
21 private static final String DATABASE_TABLE_8 = "notes";
22 private static final int DATABASE_VERSION = 1;
23 public static final String KEY_ROW_ID = "_id";
24 public static final String KEY_INSPECTION_ID = "_id";
25 public static final String KEY_INSPECTION_ACCDATE = "accdate";
26 public static final String KEY_INSPECTION_ACCTIME = "acctime";
27 public static final String KEY_INSPECTION_NOTIFIED = "notified";
28 public static final String KEY_INSPECTION_ARRIVED = "arrived";
29 public static final String KEY_INSPECTION_ACCTYPE = "acctype";
30 public static final String KEY_INSPECTION_GATE = "gate";
31 public static final String KEY_INSPECTION_ROADSURFACE = "roadsurface";
32 public static final String KEY_INSPECTION_ROADTYPE = "roadtype";
33 public static final String KEY_INSPECTION_WEATHER = "weather";
34 public static final String KEY_INSPECTION_TRAFFIC = "traffic";
35 public static final String KEY_INSPECTION_LIGHTING = "lighting";
36 public static final String KEY_INSPECTION_HAZMAT = "hazmat";
37 public static final String KEY_INSPECTION_MANAGER = "manager";
38 public static final String KEY_INSPECTION_SPEEDLIMIT = "speedlimit";
39 public static final String KEY_INSPECTION_POLICE = "police";
40 public static final String KEY_INSPECTION_POLICEDEPARTMENT = "policedepartment";
41 public static final String KEY_INSPECTION_POLICEOFFICER = "policeofficer";
42 public static final String KEY_INSPECTION_POLICEBADGE = "policebadge";
43 public static final String KEY_INSPECTION_POLICEREPORT = "policereport";
44 public static final String KEY_INSPECTION_FEDEXVEHICLES = "fedexvehicles";
45 public static final String KEY_INSPECTION_ATTACHED = "attached";
46 public static final String KEY_INSPECTION_NONVEHICLES = "nonvehicles";
47 public static final String KEY_INSPECTION_PROPERTY = "property";
48 public static final String KEY_INSPECTION_INJURED = "injured";
49 public static final String KEY_INSPECTION_WITNESSES = "witnesses";
50 public static final String KEY_INSPECTION_PHOTOS = "photos";
51 public static final String KEY_INSPECTION_COMPLETED = "completed";
52 //I created constants for all the table fields, but removed them here due to size
53
54 private static final String DATABASE_CREATE_TABLE_1 =
55 "create table inspection (_id integer primary key autoincrement, "
56 + "accdate text not null, acctime text not null, "
57 + "notified text not null, arrived text not null, "
58 + "acctype text not null, location text not null, "
59 + "gate text not null, roadcondition text not null, "
60 + "roadsurface text not null, roadtype text not null, "
61 + "weather text not null, traffic text not null, "
62 + "lighting text not null, hazmat text not null, "
63 + "manager text not null, speedlimit text not null, "
64 + "police text not null, policedepartment text not null, "
65 + "policeofficer text not null, policebadge text not null, "
66 + "policereport text not null, fedexvehicles text not null, "
67 + "attached text not null, nonvehicles text not null, "
68 + "property text not null, injured text not null, "
69 + "witnesses text not null, photos text not null, "
70 + "completed text not null);";
71
72 private static final String DATABASE_CREATE_TABLE_2 =
73 "create table fedexvehicles (_id integer primary key autoincrement, "
74 + "investigationkey text not null, vehiclenumber text not null, "
75 + "vehicletype text not null, assetnumber text not null, "
76 + "vehicleaction text not null, speed text not null, "
77 + "interaction text not null, objectstruck text not null, "
78 + "damagetype text not null, damagelocationgeneral text not null, "
79 + "damagelocationspecific text not null, guideperson text not null, "
80 + "passengersfed text not null, passengersnon text not null, "
81 + "wheeledgse text not null, carriedgse text not null, "
82 + "damagedattachments text not null, driver text not null, "
83 + "driverslicense text not null, driverslicensestate text not null, "
84 + "driverslicensedate text not null, seatbelt text not null, "
85 + "citation text not null, preventable text not null, "
86 + "vio1 text not null, vio2 text not null, "
87 + "vio3 text not null, vio4 text not null, "
88 + "vio5 text not null, vio6 text not null, "
89 + "vio7 text not null, vio8 text not null, "
90 + "vio9 text not null, vio10 text not null, "
91 + "vio11 text not null, vio12 text not null, "
92 + "vio13 text not null, vio14 text not null, "
93 + "vio15 text not null, vio16 text not null, "
94 + "vio17 text not null, vio18 text not null, "
95 + "vio19 text not null, vio20 text not null, "
96 + "vio21 text not null, vio22 text not null, "
97 + "completed text not null);";
98
99 private static final String DATABASE_CREATE_TABLE_3 =
100 "create table attachments (_id integer primary key autoincrement, "
101 + "investigationkey text not null, vehiclekey text not null, "
102 + "attachmenttype text not null, assetnumber text not null, "
103 + "interaction text not null, objectstruck text not null, "
104 + "damagetype text not null, damagelocationgeneral text not null, "
105 + "damagelocationspecific text not null, dollyonstring text not null, "
106 + "positiononstring text not null, positionondolly text not null, "
107 + "attachmentnumber text not null, completed text not null);";
108
109 private static final String DATABASE_CREATE_TABLE_4 =
110 "create table nonvehicles (_id integer primary key autoincrement, "
111 + "investigationkey text not null, vehiclenumber text not null, "
112 + "vin text not null, text vehmake not null, "
113 + "vehmodel text not null, vehyear text not null, "
114 + "plate text not null, platestate text not null, "
115 + "vehicleaction text not null, speed text not null, "
116 + "damagetype text not null, damagelocation text not null, "
117 + "damagepart text not null, towed text not null, "
118 + "owner text not null, insurance text not null, "
119 + "insurancephone text not null, policy text not null, "
120 + "policydate text not null, driver text not null, "
121 + "driverslicense text not null, driverslicensestate text not null, "
122 + "driverslicensedate text not null, citation text not null, "
123 + "passengersfed text not null, passengersnon text not null, "
124 + "completed text not null);";
125
126 private static final String DATABASE_CREATE_TABLE_5 =
127 "create table property (_id integer primary key autoincrement, "
128 + "investigationkey text not null, owner text not null, "
129 + "propertytype text not null, propertydamage text not null, "
130 + "propertynumber text not null, completed text not null);";
131
132 private static final String DATABASE_CREATE_TABLE_6 =
133 "create table people (_id integer primary key autoincrement, "
134 + "investigationkey text not null, persontype text not null, "
135 + "employeeid text not null, personname text not null, "
136 + "personaddress text not null, personcity text not null, "
137 + "personstate text not null, personzip text not null, "
138 + "personphone text not null, injured text not null);";
139
140 private static final String DATABASE_CREATE_TABLE_7 =
141 "create table photos (_id integer primary key autoincrement, "
142 + "investigationkey text not null, photofilename text not null, "
143 + "photolocation text not null, photodirection text not null, "
144 + "photocaption text not null);";
145
146 private static final String DATABASE_CREATE_TABLE_8 =
147 "create table notes (_id integer primary key autoincrement, "
148 + "investigationkey text not null, notetext text not null);";
149
150 private final Context context;
151 private DatabaseHelper DBHelper;
152 private SQLiteDatabase db;
153
154 public DBAdapter(Context ctx)
155 {
156 this.context = ctx;
157 DBHelper = new DatabaseHelper(context);
158 }
159
160 private static class DatabaseHelper extends SQLiteOpenHelper
161 {
162 DatabaseHelper(Context context)
163 {
164 super(context, DATABASE_NAME, null, DATABASE_VERSION);
165 }
166
167 @Override
168 public void onCreate(SQLiteDatabase db)
169 {
170 db.execSQL(DATABASE_CREATE_TABLE_1);
171 db.execSQL(DATABASE_CREATE_TABLE_2);
172 db.execSQL(DATABASE_CREATE_TABLE_3);
173 db.execSQL(DATABASE_CREATE_TABLE_4);
174 db.execSQL(DATABASE_CREATE_TABLE_5);
175 db.execSQL(DATABASE_CREATE_TABLE_6);
176 db.execSQL(DATABASE_CREATE_TABLE_7);
177 db.execSQL(DATABASE_CREATE_TABLE_8);
178 }
179
180 @Override
181 public void onUpgrade(SQLiteDatabase db, int oldVersion,
182 int newVersion)
183 {
184 Log.w(TAG, "Upgrading database from version " + oldVersion
185 + " to "
186 + newVersion + ", which will destroy all old data");
187 db.execSQL("DROP TABLE IF EXISTS investigation");
188 db.execSQL("DROP TABLE IF EXISTS fedexvehicles");
189 db.execSQL("DROP TABLE IF EXISTS attachments");
190 db.execSQL("DROP TABLE IF EXISTS nonvehicles");
191 db.execSQL("DROP TABLE IF EXISTS property");
192 db.execSQL("DROP TABLE IF EXISTS people");
193 db.execSQL("DROP TABLE IF EXISTS photos");
194 db.execSQL("DROP TABLE IF EXISTS notes");
195 onCreate(db);
196 }
197 }
198
199
200//---opens the database---
201
202 public DBAdapter open() throws SQLException
203 {
204
205
206 db = DBHelper.getWritableDatabase();
207
208
209
210 return this;
211 }
212
213
214//---closes the database---
215
216 public void close()
217 {
218 DBHelper.close();
219 }
220
221
222//---insert an inspection into the database---
223
224 public long insertinspection(String acDat, String acNot)
225 {
226
227 ContentValues initialValues = new ContentValues();
228 try{
229 initialValues.put(KEY_INSPECTION_ACCDATE, acDat);
230 initialValues.put(KEY_INSPECTION_ACCTIME, EMPTYSTRING);
231 initialValues.put(KEY_INSPECTION_NOTIFIED, "acNot");
232 initialValues.put(KEY_INSPECTION_ARRIVED, EMPTYSTRING);
233 initialValues.put(KEY_INSPECTION_ACCTYPE, EMPTYSTRING);
234 initialValues.put(KEY_INSPECTION_GATE, EMPTYSTRING);
235 initialValues.put(KEY_INSPECTION_ROADSURFACE, EMPTYSTRING);
236 initialValues.put(KEY_INSPECTION_ROADTYPE, EMPTYSTRING);
237 initialValues.put(KEY_INSPECTION_WEATHER, EMPTYSTRING);
238 initialValues.put(KEY_INSPECTION_TRAFFIC, EMPTYSTRING);
239 initialValues.put(KEY_INSPECTION_LIGHTING, EMPTYSTRING);
240 initialValues.put(KEY_INSPECTION_HAZMAT, EMPTYSTRING);
241 initialValues.put(KEY_INSPECTION_MANAGER, EMPTYSTRING);
242 initialValues.put(KEY_INSPECTION_SPEEDLIMIT, EMPTYSTRING);
243 initialValues.put(KEY_INSPECTION_POLICE, EMPTYSTRING);
244 initialValues.put(KEY_INSPECTION_POLICEDEPARTMENT, EMPTYSTRING);
245 initialValues.put(KEY_INSPECTION_POLICEOFFICER, EMPTYSTRING);
246 initialValues.put(KEY_INSPECTION_POLICEBADGE, EMPTYSTRING);
247 initialValues.put(KEY_INSPECTION_POLICEREPORT, EMPTYSTRING);
248 initialValues.put(KEY_INSPECTION_FEDEXVEHICLES, ONE_STRING);
249 initialValues.put(KEY_INSPECTION_ATTACHED, EMPTYSTRING);
250 initialValues.put(KEY_INSPECTION_NONVEHICLES, EMPTYSTRING);
251 initialValues.put(KEY_INSPECTION_PROPERTY, EMPTYSTRING);
252 initialValues.put(KEY_INSPECTION_INJURED, EMPTYSTRING);
253 initialValues.put(KEY_INSPECTION_WITNESSES, EMPTYSTRING);
254 initialValues.put(KEY_INSPECTION_PHOTOS, EMPTYSTRING);
255 initialValues.put(KEY_INSPECTION_COMPLETED, FALSE_STRING);
256 } catch (Exception e)
257 {
258 Log.e("ERROR", "DATABASE ERROR: " + e.toString());
259 e.printStackTrace();
260 }
261
262 return db.insert(DATABASE_TABLE_1, null, initialValues);
263 }
264
265 //---insert a FedEx Vehicle into the database---
266
267 public long insertFedVeh(String inspectionKey, String vehiclenumber)
268 {
269 ContentValues initialValues = new ContentValues();
270 initialValues.put(KEY_FEDVEHICLE_INVESTIGATIONKEY, inspectionKey);
271 initialValues.put(KEY_FEDVEHICLE_VEHICLENUMBER, vehiclenumber);
272 initialValues.put(KEY_FEDVEHICLE_VEHICLETYPE, "");
273 initialValues.put(KEY_FEDVEHICLE_ASSETNUMBER, "");
274 initialValues.put(KEY_FEDVEHICLE_VEHICLEACTION, "");
275 initialValues.put(KEY_FEDVEHICLE_SPEED, "");
276 initialValues.put(KEY_FEDVEHICLE_INTERACTION, "");
277 initialValues.put(KEY_FEDVEHICLE_OBJECTSTRUCK, "");
278 initialValues.put(KEY_FEDVEHICLE_DAMAGETYPE, "");
279 initialValues.put(KEY_FEDVEHICLE_DAMAGELOCATIONGENERAL, "");
280 initialValues.put(KEY_FEDVEHICLE_DAMAGELOCATIONSPECIFIC, "");
281 initialValues.put(KEY_FEDVEHICLE_GUIDEPERSON, "");
282 initialValues.put(KEY_FEDVEHICLE_PASSENGERSFED, "0");
283 initialValues.put(KEY_FEDVEHICLE_PASSENGERSNON, "0");
284 initialValues.put(KEY_FEDVEHICLE_WHEELEDGSE, "0");
285 initialValues.put(KEY_FEDVEHICLE_CARRIEDGSE, "0");
286 initialValues.put(KEY_FEDVEHICLE_DAMAGEDATTACHMENTS, "0");
287 initialValues.put(KEY_FEDVEHICLE_DRIVER, "");
288 initialValues.put(KEY_FEDVEHICLE_DRIVERSLICENSE, "");
289 initialValues.put(KEY_FEDVEHICLE_DRIVERSLICENSESTATE, "");
290 initialValues.put(KEY_FEDVEHICLE_DRIVERSLICENSEDATE, "");
291 initialValues.put(KEY_FEDVEHICLE_SEATBELT, "");
292 initialValues.put(KEY_FEDVEHICLE_CITATION, "");
293 initialValues.put(KEY_FEDVEHICLE_PREVENTABLE, "");
294 initialValues.put(KEY_FEDVEHICLE_VIO1, "false");
295 initialValues.put(KEY_FEDVEHICLE_VIO2, "false");
296 initialValues.put(KEY_FEDVEHICLE_VIO3, "false");
297 initialValues.put(KEY_FEDVEHICLE_VIO4, "false");
298 initialValues.put(KEY_FEDVEHICLE_VIO5, "false");
299 initialValues.put(KEY_FEDVEHICLE_VIO6, "false");
300 initialValues.put(KEY_FEDVEHICLE_VIO7, "false");
301 initialValues.put(KEY_FEDVEHICLE_VIO8, "false");
302 initialValues.put(KEY_FEDVEHICLE_VIO9, "false");
303 initialValues.put(KEY_FEDVEHICLE_VIO10, "false");
304 initialValues.put(KEY_FEDVEHICLE_VIO11, "false");
305 initialValues.put(KEY_FEDVEHICLE_VIO12, "false");
306 initialValues.put(KEY_FEDVEHICLE_VIO13, "false");
307 initialValues.put(KEY_FEDVEHICLE_VIO14, "false");
308 initialValues.put(KEY_FEDVEHICLE_VIO15, "false");
309 initialValues.put(KEY_FEDVEHICLE_VIO16, "false");
310 initialValues.put(KEY_FEDVEHICLE_VIO17, "false");
311 initialValues.put(KEY_FEDVEHICLE_VIO18, "false");
312 initialValues.put(KEY_FEDVEHICLE_VIO19, "false");
313 initialValues.put(KEY_FEDVEHICLE_VIO20, "false");
314 initialValues.put(KEY_FEDVEHICLE_VIO21, "false");
315 initialValues.put(KEY_FEDVEHICLE_VIO22, "false");
316 initialValues.put(KEY_FEDVEHICLE_COMPLETED, "false");
317 return db.insert(DATABASE_TABLE_2, null, initialValues);
318 }
319
320 //---I also created methods to insert each table, but removed them here for size ---
321
322 //---deletes a particular inspection---
323
324 public boolean deleteInspection(long rowId)
325 {
326 return db.delete(DATABASE_TABLE_1, KEY_INSPECTION_ID +
327 "=" + rowId, null) > 0;
328 }
329
330 //---deletes a particular FedEx Vehicle---
331
332 public boolean deleteFedVehicle(long rowId)
333 {
334 return db.delete(DATABASE_TABLE_2, KEY_FEDVEHICLE_ID +
335 "=" + rowId, null) > 0;
336 }
337
338 //---deletes a particular Attachment---
339
340 public boolean deleteAttach(long rowId)
341 {
342 return db.delete(DATABASE_TABLE_3, KEY_ATTACHMENTS_ID +
343 "=" + rowId, null) > 0;
344 }
345
346 //---deletes a particular Non FedEx Vehicle---
347
348 public boolean deleteNonVehicle(long rowId)
349 {
350 return db.delete(DATABASE_TABLE_4, KEY_NONVEHICLES_ID +
351 "=" + rowId, null) > 0;
352 }
353
354 //---deletes a particular Property---
355
356 public boolean deleteProperty(long rowId)
357 {
358 return db.delete(DATABASE_TABLE_5, KEY_PROPERTY_ID +
359 "=" + rowId, null) > 0;
360 }
361
362 //---deletes a particular Person---
363
364 public boolean deletePeople(long rowId)
365 {
366 return db.delete(DATABASE_TABLE_6, KEY_PEOPLE_ID +
367 "=" + rowId, null) > 0;
368 }
369
370 //---deletes a particular Photo---
371 public boolean deletePhoto(long rowId)
372 {
373 return db.delete(DATABASE_TABLE_7, KEY_PHOTOS_ID +
374 "=" + rowId, null) > 0;
375 }
376
377 //---deletes a particular Note---
378 public boolean deleteNote(long rowId)
379 {
380 return db.delete(DATABASE_TABLE_8, KEY_NOTES_ID +
381 "=" + rowId, null) > 0;
382 }
383
384 //---retrieves all the Inspections---
385
386 public Cursor getAllInspections()
387 {
388 return db.query(DATABASE_TABLE_1, new String[] {
389 KEY_INSPECTION_ID,
390 KEY_INSPECTION_ACCDATE,
391 KEY_INSPECTION_NOTIFIED},
392 null,
393 null,
394 null,
395 null,
396 null);
397 }
398
399 //---retrieves all Persons---
400
401 public Cursor getAllPeople(String investigationKey)
402 {
403 return db.query(DATABASE_TABLE_6, new String[] {
404 KEY_PEOPLE_PERSONNAME,
405 KEY_PEOPLE_EMPLOYEEID},
406 null,
407 null,
408 null,
409 null,
410 null);
411 }
412
413 //---retrieves all Employees---
414
415 public Cursor getAllEmployees(String investigationKey)
416 {
417 return db.query(DATABASE_TABLE_6, new String[] {
418 KEY_PEOPLE_PERSONNAME,
419 KEY_PEOPLE_EMPLOYEEID},
420 KEY_PEOPLE_EMPLOYEEID + "<> 0",
421 null,
422 null,
423 null,
424 null);
425 }
426
427 //---retrieves all Non Persons---
428
429 public Cursor getAllPersons(String investigationKey)
430 {
431 return db.query(DATABASE_TABLE_6, new String[] {
432 KEY_PEOPLE_PERSONNAME},
433 KEY_PEOPLE_EMPLOYEEID + "= 0",
434 null,
435 null,
436 null,
437 null);
438 }
439
440 //---retrieves a particular inspection---
441
442 public Cursor getInspection(long investigationKey) throws SQLException
443 {
444 Cursor mCursor =
445 db.query(true, DATABASE_TABLE_1, null,
446 KEY_INSPECTION_ID + "=" + investigationKey,
447 null,
448 null,
449 null,
450 null,
451 null);
452 if (mCursor != null) {
453 mCursor.moveToFirst();
454 }
455 return mCursor;
456 }
457
458 //---retrieves a particular fedexvehicle---
459 public Cursor getFedVehicle(String investigationKey, String vehicleNumber) throws SQLException
460 {
461 Cursor mCursor =
462 db.query(true, DATABASE_TABLE_2, null,
463 KEY_FEDVEHICLE_INVESTIGATIONKEY + "=" + investigationKey+" AND "+KEY_FEDVEHICLE_VEHICLENUMBER+"="+vehicleNumber,
464 null,
465 null,
466 null,
467 null,
468 null);
469 if (mCursor != null) {
470 mCursor.moveToFirst();
471 }
472 return mCursor;
473 }
474
475 //---retrieves a particular attachment---
476
477 public Cursor getAttachment(String investigationKey, String vehicleNumber, String attachmentNumber) throws SQLException
478 {
479 Cursor mCursor =
480 db.query(true, DATABASE_TABLE_3, null,
481 KEY_ATTACHMENTS_INVESTIGATIONKEY + "=" + investigationKey+" AND "+KEY_ATTACHMENTS_VEHICLEKEY+"="+vehicleNumber+" AND "+KEY_ATTACHMENTS_ATTACHMENTNUMBER+"="+attachmentNumber,
482 null,
483 null,
484 null,
485 null,
486 null);
487 if (mCursor != null) {
488 mCursor.moveToFirst();
489 }
490 return mCursor;
491 }
492
493 //---retrieves a particular NonFedExVehicle---
494
495 public Cursor getNonVehicle(String investigationKey, String vehicleNumber) throws SQLException
496 {
497 Cursor mCursor =
498 db.query(true, DATABASE_TABLE_4, null,
499 KEY_NONVEHICLES_INVESTIGATIONKEY + "=" + investigationKey+" AND "+KEY_NONVEHICLES_VEHICLENUMBER+"="+vehicleNumber,
500 null,
501 null,
502 null,
503 null,
504 null);
505 if (mCursor != null) {
506 mCursor.moveToFirst();
507 }
508 return mCursor;
509 }
510
511 //---retrieves a particular property---
512
513 public Cursor getProperty(String investigationKey, String propertyNumber) throws SQLException
514 {
515 Cursor mCursor =
516 db.query(true, DATABASE_TABLE_5, null,
517 KEY_PROPERTY_INVESTIGATIONKEY + "=" + investigationKey+" AND "+KEY_PROPERTY_PROPERTYNUMBER+"="+propertyNumber+" AND "+KEY_ATTACHMENTS_ATTACHMENTNUMBER+"="+propertyNumber,
518 null,
519 null,
520 null,
521 null,
522 null);
523 if (mCursor != null) {
524 mCursor.moveToFirst();
525 }
526 return mCursor;
527 }
528
529 //---retrieves a particular Person---
530
531 public Cursor getPerson(String investigationKey, String personName, String employeeID) throws SQLException
532 {
533 Cursor mCursor =
534 db.query(true, DATABASE_TABLE_6, null,
535 KEY_PEOPLE_INVESTIGATIONKEY + "=" + investigationKey + " AND " + KEY_PEOPLE_EMPLOYEEID + " = " + employeeID + " AND " + KEY_PEOPLE_PERSONNAME + " = " + personName,
536 null,
537 null,
538 null,
539 null,
540 null);
541 if (mCursor != null) {
542 mCursor.moveToFirst();
543 }
544 return mCursor;
545 }
546
547 //---updates a Field---
548
549 public boolean updateField(long rowId, String tablename, String fieldname, String newdata)
550 {
551 ContentValues args = new ContentValues();
552 args.put(fieldname, newdata);
553 return db.update(tablename, args,
554 KEY_ROW_ID + "=" + rowId, null) > 0;
555 }
556
557}