Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add drop-down list with foreign keys in the GUIs (Feature request) #153

Closed
SilvioGrosso opened this issue Jan 17, 2024 · 6 comments
Closed

Comments

@SilvioGrosso
Copy link

Hello @little-brother

With many softwares (Db Browser for SQLite, Sqlitestudio, Dbeaver, LibreOffice Calc) whenever you have a foreign key there appears by default, in the GUIs, a drop-down list with all the items you are allowed to select.
It is quite useful whenever there are plenty of them, therefore you can't remember all of them by heart.

For instance, suppose we create 2 tables:

create table articles(
id integer not null,
fruit text primary key
);

insert into articles (id, fruit) values
(1, 'apple'),
(2, 'kiwi'),
(3, 'pear');

create table buyers (
id integer primary key,
buyer text,
fruit text,
price integer,
FOREIGN KEY (fruit)
REFERENCES articles(fruit)
);

insert into buyers (id, buyer, fruit, price) values
(1, 'Silvio', 'apple', 1500),
(2, 'Marco', 'pear', 1600),
(3, 'Stefano', 'kiwi', 1800);

Now, I want to insert, through the GUIs, a new line (4°) in the table buyers.
The items (fruit) allowed are: apple - pear - kiwi

Here is what occurs with Db Browser for SQLite:

image

I suppose it would be quite difficult to add (code) an option to get a drop-down like this in sqlite-gui
This when: pragma foreign-keys = ON (in the settings)

However, I am wondering whether it would be possible to add an option with such a list in here (edit value window)?

image

@little-brother
Copy link
Owner

Could you check "Add row"-dialog in sqlite-x (use Ctrl + Space to show dropdown list) ? Is it what you asked for?

@SilvioGrosso
Copy link
Author

SilvioGrosso commented Jan 17, 2024

Hello @little-brother

In all truth, I recall having this feature in some old versions of sqlite-gui.
To make it short, I didn't remember the shortcut to trigger it and where it was supposed to work

However, now, I have tried but it does not work (ctr+space) with cursor in fruit
image

EDIT: tried this shortcut also into the value editor window (sqlite-gui.1.8.2-x64-inja on Windows 10 - 64 bit)

@little-brother
Copy link
Owner

little-brother commented Jan 17, 2024

sqlite-gui doesn't have it yet. Check sqlite-x. It's another my small project for SQLite where I test some features (cause its code is much simpler).

@SilvioGrosso
Copy link
Author

Yep. it works fine on sqlite-x.
The drop-down list appears like in the other softwares.

I have noticed it is also possible to hide and move columns, within a table, in the GUIs, which is quite neat.
Not to mention, the dark theme 😄

Is this GUIs a QT application?

@little-brother
Copy link
Owner

Not to mention, the dark theme

sqlite-gui has many forms. So there is a lot of work to colorize them all :(

Is this GUIs a QT application?

Nope. It uses WinAPI as all another my projects.

little-brother added a commit that referenced this issue Mar 7, 2024
* Improve UI for non-100% scales (issue #144)
* Extension manager
* Attach external sources as a schema through ODBC interface
* Execute the current line by F12 (issue #152)
* Auto-complete in row dialog (issue #153)
* Modify help
* Remove "Database diagram"-tool
* Up SQLite to 3.45.1
* Many other changes
@little-brother
Copy link
Owner

Done. Use Ctrl + Space to view suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants