pkg

Check-in [ed7cf1ccb1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:pkgdb_load_rdeps: Switch to a JOIN syntax
Timelines: family | ancestors | descendants | both | trunk | gsoc2013
Files: files | file ages | folders
SHA1: ed7cf1ccb169c716dbfb9c73a0890cba32283ce6
User & Date: bryan@shatow.net 2014-06-11 17:40:53
Context
2014-06-11
17:47
pkg check -d: Plug a memory leak check-in: 38f68bd875 user: bryan@shatow.net tags: trunk, gsoc2013
17:40
pkgdb_load_rdeps: Switch to a JOIN syntax check-in: ed7cf1ccb1 user: bryan@shatow.net tags: trunk, gsoc2013
17:33
Fix pkgdb_load_rdeps by reverting "Avoid deps full scan when loading dependencies." This reverts commit cf47e2c24af23c8f278d9c502fe2923a42f23d33. 1. deps should be joined on p.id=d.package_id rather than origin. Otherwise no results are returned breaking pkg-query %r, pkg-autoremove, etc. 2. Restore uniqueid support [1] Discussed with: bapt [1] Fixes #833 check-in: b295691032 user: bryan@shatow.net tags: trunk, gsoc2013
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to libpkg/pkgdb.c.

1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
	sqlite3_stmt	*stmt = NULL;
	int		 ret;
	const char	*uniqueid;
	const char	*reponame = NULL;
	char		 sql[BUFSIZ];
	const char	*mainsql = ""
		"SELECT p.name, p.origin, p.version, p.locked "
		"FROM main.packages AS p, main.deps AS d "
		"WHERE p.id = d.package_id "
			"AND d.name || '~' || d.origin = ?1;";
	const char	*reposql = ""
		"SELECT p.name, p.origin, p.version, 0 "
		"FROM %Q.packages AS p, %Q.deps AS d "
		"WHERE p.id = d.package_id "
			"AND d.name || '~' || d.origin = ?1;";

	assert(db != NULL && pkg != NULL);

	if (pkg->flags & PKG_LOAD_RDEPS)
		return (EPKG_OK);

	if (pkg->type == PKG_REMOTE) {







|
|
|


|
|
|







1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
	sqlite3_stmt	*stmt = NULL;
	int		 ret;
	const char	*uniqueid;
	const char	*reponame = NULL;
	char		 sql[BUFSIZ];
	const char	*mainsql = ""
		"SELECT p.name, p.origin, p.version, p.locked "
		"FROM main.packages AS p "
		"INNER JOIN main.deps AS d ON p.id = d.package_id "
		"WHERE d.name || '~' || d.origin = ?1;";
	const char	*reposql = ""
		"SELECT p.name, p.origin, p.version, 0 "
		"FROM %Q.packages AS p "
		"INNER JOIN %Q.deps AS d ON p.id = d.package_id "
		"WHERE d.name || '~' || d.origin = ?1;";

	assert(db != NULL && pkg != NULL);

	if (pkg->flags & PKG_LOAD_RDEPS)
		return (EPKG_OK);

	if (pkg->type == PKG_REMOTE) {