use of android.database.SQLException in project cw-omnibus by commonsguy.
the class Provider method insert.
@Override
public Uri insert(Uri url, ContentValues initialValues) {
long rowID = db.getWritableDatabase().insert(TABLE, Constants.TITLE, initialValues);
if (rowID > 0) {
Uri uri = ContentUris.withAppendedId(Provider.Constants.CONTENT_URI, rowID);
getContext().getContentResolver().notifyChange(uri, null);
return (uri);
}
throw new SQLException("Failed to insert row into " + url);
}
use of android.database.SQLException in project cw-advandroid by commonsguy.
the class Provider method insert.
@Override
public Uri insert(Uri url, ContentValues initialValues) {
long rowID = db.getWritableDatabase().insert(TABLE, Constants.TITLE, initialValues);
if (rowID > 0) {
Uri uri = ContentUris.withAppendedId(Provider.Constants.CONTENT_URI, rowID);
getContext().getContentResolver().notifyChange(uri, null);
return (uri);
}
throw new SQLException("Failed to insert row into " + url);
}
use of android.database.SQLException in project cw-advandroid by commonsguy.
the class Provider method insert.
@Override
public Uri insert(Uri url, ContentValues initialValues) {
long rowID = db.getWritableDatabase().insert(TABLE, Constants.TITLE, initialValues);
if (rowID > 0) {
Uri uri = ContentUris.withAppendedId(Provider.Constants.CONTENT_URI, rowID);
getContext().getContentResolver().notifyChange(uri, null);
return (uri);
}
throw new SQLException("Failed to insert row into " + url);
}
use of android.database.SQLException in project cw-advandroid by commonsguy.
the class Provider method insert.
@Override
public Uri insert(Uri url, ContentValues initialValues) {
long rowID = db.getWritableDatabase().insert(TABLE, Constants.TITLE, initialValues);
if (rowID > 0) {
Uri uri = ContentUris.withAppendedId(Provider.Constants.CONTENT_URI, rowID);
getContext().getContentResolver().notifyChange(uri, null);
return (uri);
}
throw new SQLException("Failed to insert row into " + url);
}
use of android.database.SQLException in project android-app by eoecn.
the class APNManager method addNewApn.
/**
* 增加新的apn
*
* @param apnNode
* @return
*/
private int addNewApn(APN apnNode) {
int apnId = -1;
ContentValues values = new ContentValues();
values.put("name", apnNode.getName());
values.put("apn", apnNode.getApn());
values.put("proxy", apnNode.getProxy());
values.put("port", apnNode.getPort());
values.put("user", apnNode.getUser());
values.put("password", apnNode.getPassword());
values.put("mcc", apnNode.getMcc());
values.put("mnc", apnNode.getMnc());
values.put("numeric", apnNode.getNumeric());
// Note: this values need to be update, and for now, it only for XT800.
Cursor c = null;
try {
Uri newRow = resolver.insert(APN_TABLE_URI, values);
if (newRow != null) {
c = resolver.query(newRow, null, null, null, null);
int idindex = c.getColumnIndex("_id");
c.moveToFirst();
apnId = c.getShort(idindex);
Log.d("Robert", "New ID: " + apnId + ": Inserting new APN succeeded!");
}
} catch (SQLException e) {
e.printStackTrace();
}
if (c != null)
c.close();
return apnId;
}
Aggregations