sqlite-gui icon indicating copy to clipboard operation
sqlite-gui copied to clipboard

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

Open SilvioGrosso opened this issue 1 year ago • 5 comments

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

SilvioGrosso avatar Jan 17 '24 15:01 SilvioGrosso

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

little-brother avatar Jan 17 '24 15:01 little-brother

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)

SilvioGrosso avatar Jan 17 '24 16:01 SilvioGrosso

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).

little-brother avatar Jan 17 '24 16:01 little-brother

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 :smile:

Is this GUIs a QT application?

SilvioGrosso avatar Jan 17 '24 17:01 SilvioGrosso

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 avatar Jan 17 '24 17:01 little-brother

Done. Use Ctrl + Space to view suggestions.

little-brother avatar Mar 07 '24 13:03 little-brother