B2G/gecko/toolkit/components/places/tests/head_common.js
/**
 * Checks if an address is found in the database.
 * @param aURI
 *        nsIURI or address to look for.
 * @return place id of the page or 0 if not found
 */
Checks if an address is found in the database.
@param aURI
nsIURI or address to look for.
@return place id of the page or 0 if not found
Checks if an address is found in the database . @param aURI nsIURI or address to look for . @return place id of the page or 0 if not found
function page_in_database(aURI)
{
  let url = aURI instanceof Ci.nsIURI ? aURI.spec : aURI;
  let stmt = DBConn().createStatement(
    "SELECT id FROM moz_places WHERE url = :url"
  );
  stmt.params.url = url;
  try {
    if (!stmt.executeStep())
      return 0;
    return stmt.getInt64(0);
  }
  finally {
    stmt.finalize();
  }
}
function page_in_database ( aURI ) { let url = aURI instanceof Ci . nsIURI ? aURI . spec : aURI ; let stmt = DBConn ( ) . createStatement ( "SELECT id FROM moz_places WHERE url = :url" ) ; stmt . params . url = url ; try { if ( ! stmt . executeStep ( ) ) return 0 ; return stmt . getInt64 ( 0 ) ; } finally { stmt . finalize ( ) ; } }
Checks if an address is found in the database.
Checks if an address is found in the database .