@Override public long replace(CookieEntity cookie){
  SQLiteDatabase execute=getWriter();
  ContentValues values=new ContentValues();
  values.put(CookieSQLHelper.URI,cookie.getUri());
  values.put(CookieSQLHelper.NAME,cookie.getName());
  values.put(CookieSQLHelper.VALUE,cookie.getValue());
  values.put(CookieSQLHelper.COMMENT,cookie.getComment());
  values.put(CookieSQLHelper.COMMENT_URL,cookie.getCommentURL());
  values.put(CookieSQLHelper.DISCARD,String.valueOf(cookie.isDiscard()));
  values.put(CookieSQLHelper.DOMAIN,cookie.getDomain());
  values.put(CookieSQLHelper.EXPIRY,cookie.getExpiry());
  values.put(CookieSQLHelper.PATH,cookie.getPath());
  values.put(CookieSQLHelper.PORT_LIST,cookie.getPortList());
  values.put(CookieSQLHelper.SECURE,String.valueOf(cookie.isSecure()));
  values.put(CookieSQLHelper.VERSION,cookie.getVersion());
  try {
    return execute.replace(CookieSQLHelper.TABLE_NAME,null,values);
  }
 catch (  Exception e) {
    return -1;
  }
 finally {
    closeWriter(execute);
  }
}

@ Override public long replace ( CookieEntity cookie ) { SQLiteDatabase execute = getWriter ( ) ; ContentValues values = new ContentValues ( ) ; values . put ( CookieSQLHelper . URI , cookie . getUri ( ) ) ; values . put ( CookieSQLHelper . NAME , cookie . getName ( ) ) ; values . put ( CookieSQLHelper . VALUE , cookie . getValue ( ) ) ; values . put ( CookieSQLHelper . COMMENT , cookie . getComment ( ) ) ; values . put ( CookieSQLHelper . COMMENT_URL , cookie . getCommentURL ( ) ) ; values . put ( CookieSQLHelper . DISCARD , String . valueOf ( cookie . isDiscard ( ) ) ) ; values . put ( CookieSQLHelper . DOMAIN , cookie . getDomain ( ) ) ; values . put ( CookieSQLHelper . EXPIRY , cookie . getExpiry ( ) ) ; values . put ( CookieSQLHelper . PATH , cookie . getPath ( ) ) ; values . put ( CookieSQLHelper . PORT_LIST , cookie . getPortList ( ) ) ; values . put ( CookieSQLHelper . SECURE , String . valueOf ( cookie . isSecure ( ) ) ) ; values . put ( CookieSQLHelper . VERSION , cookie . getVersion ( ) ) ; try { return execute . replace ( CookieSQLHelper . TABLE_NAME , null , values ) ; } catch ( Exception e ) { return - 1 ; } finally { closeWriter ( execute ) ; } }
add or update by index ( name , domain , path ) .
