diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2012-06-04 09:04:19 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2012-06-04 09:04:19 +0000 |
commit | 3dc68ebf90da88f1adf31c614fe8856b66e0df8b (patch) | |
tree | 22e197ffd6892f10ac0697cbb947a7e9b16a5e85 /usr.bin | |
parent | bc92864fa9d94b356859d1f7bded102e1065651b (diff) |
merge
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/sqlite3/shell.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/sqlite3/shell.c b/usr.bin/sqlite3/shell.c index c58738bdb4f..f23290ba252 100644 --- a/usr.bin/sqlite3/shell.c +++ b/usr.bin/sqlite3/shell.c @@ -2184,23 +2184,25 @@ static int do_meta_command(char *zLine, struct callback_data *p){ zShellStatic = azArg[1]; rc = sqlite3_exec(p->db, "SELECT sql FROM " - " (SELECT sql sql, type type, tbl_name tbl_name, name name" + " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x" " FROM sqlite_master UNION ALL" - " SELECT sql, type, tbl_name, name FROM sqlite_temp_master) " + " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) " "WHERE lower(tbl_name) LIKE shellstatic()" " AND type!='meta' AND sql NOTNULL " - "ORDER BY substr(type,2,1), name", + "ORDER BY substr(type,2,1), " + " CASE type WHEN 'view' THEN rowid ELSE name END", callback, &data, &zErrMsg); zShellStatic = 0; } }else{ rc = sqlite3_exec(p->db, "SELECT sql FROM " - " (SELECT sql sql, type type, tbl_name tbl_name, name name" + " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x" " FROM sqlite_master UNION ALL" - " SELECT sql, type, tbl_name, name FROM sqlite_temp_master) " + " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) " "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'" - "ORDER BY substr(type,2,1), name", + "ORDER BY substr(type,2,1)," + " CASE type WHEN 'view' THEN rowid ELSE name END", callback, &data, &zErrMsg ); } |