Commit Graph

95 Commits

Author SHA1 Message Date
Martin Kleusberg
03374851f3 Fix foreign key preview for foreign keys in the first column
See #718.
2016-08-14 17:11:00 +02:00
Martin Kleusberg
777088fc80 Improve code for deleting table rows
Actually handle the case that deleting rows might fail in the
SqliteTableModel. That's where this sort of check belongs.

This allows us to get rid of the full refresh of the table view after
deleting a row in the Browse Data tab. Thanks to @innermous for pointing
this out!
2016-08-14 16:39:37 +02:00
Justin Clift
538116c97b Update an obsolete Qt::ItemDataRole 2016-08-11 14:02:55 +01:00
Vladislav Tronko
6b42af7fc6 Optimized choosing displayed text for cell 2016-08-06 05:18:01 +03:00
safaalfulaij
a78a4ef8f2 Fix Binary In-Place Editable Cell 2016-08-05 23:11:15 +03:00
Iulian Onofrei
f37c162c18 Replaced SQL comments removal function with regex
- this was introduced by @169eccbe
2016-08-03 21:46:14 +03:00
Iulian Onofrei
a4506bcbd2 Fixes #639
- fix crash when hovering over any row from the _rowid_ column
2016-07-12 23:51:36 +03:00
Vlad
c91390941d Add duplicate record option (#594) 2016-05-24 19:47:09 +02:00
Martin Kleusberg
730a272454 sqlitetablemodel: Don't insert new rows when there is no new data
When not getting any data from query we'd tell Qt that we're about to
insert data anyway and cause confusion this way. At least this might
cause some trouble on some systems.

This issue tries to deal with issue #565.
2016-04-23 20:55:08 +02:00
gimKondo
54cea17f3a set selected data type on imported by Edit database cell
Data type isn't decided by column type, but cell's type.
And, 2 bugs is fixed.
1. prevention in-place editing data
2. the lack of tr() on text literal
2016-01-18 15:56:57 +00:00
Peinthor Rene
1c233de3b5 sqlitetablemodel: fix crash on windows with sort order
if no sort column is set, new qt delivers random values
so this might be out of m_headers.size() and crashes
2015-12-26 08:57:07 +01:00
Peinthor Rene
4003dc6fec sqlitetablemodel: fix assert on windows 2015-12-26 08:47:59 +01:00
Martin Kleusberg
f84305ccbb Tidy up generated SQL statements when filtering 2015-12-21 01:44:39 +01:00
Martin Kleusberg
b9bef48b0e Fix bug in the filter bar
See the comment in the code for more details.
2015-12-21 01:38:24 +01:00
Martin Kleusberg
9582786237 Add dropping of URLs and text on the data browser view
See issue #441.
2015-12-19 19:02:38 +01:00
Martin Kleusberg
159605e2f8 Automatically add % wildcards to filter queries
Automatically add a % wildcard to the beginning and the end of a filter
query if the user hasn't typed in any wildcards by their own.

See issue #415.
2015-10-15 22:07:14 +02:00
Martin Kleusberg
1ea45a54d6 Allow escaping of filter wildcard characters
See issue #421.
2015-10-05 19:57:44 +02:00
Martin Kleusberg
eaf6ff1565 Support text in different encoding in Browse Data tab
When browsing and editing a table in the Browse Data tab allow the user
to change the assumed encoding of the text in the table. We'll then try
to convert from this encoding to Unicode for display purposes and to
convert from Unicode to this encoding for editing purposes. This way the
UI and all tools will keep using Unicode while the database format is
still respected. I hope the amount conversions generated this way won't
affect the performance too much.

See issue #414.
2015-09-15 00:14:55 +02:00
Martin Kleusberg
631979c330 Improve escpaing support
When generating SQL statements properly escape all identifiers, even
those containing backticks which apparently are allowed inside
identifiers in SQLite.

See issue #387.
2015-08-17 00:17:48 +02:00
Martin Kleusberg
743bdf9941 Fix a few warnings 2015-07-06 22:48:18 +02:00
Martin Kleusberg
90f651d548 displayformats: Semi-fix filters
Fix the filters. For columns with a display format set they always
perform string comparisons but this is probably just something you have
to live with...
2015-07-06 20:48:33 +02:00
Martin Kleusberg
7c1d237d9b Support alternative display formats in the Browse Data tab
This is a proof-of-concept or even a basic first implementation of a new
feature I'd like to have in DB4S which at the moment I call display
formats.

The idea here is to allow the user to change the data in the Browse Data
tab on a per column basis before displaying it. This means even though
the data is stored in format X in the database it can be shown in format
Y in the browser. This should be useful in cases where the original
format X is hard to read or just not useful in a particular case.

This first implementation allows the user to right click on the header
of a column and open a new dialog for setting the display format which
offers a (limited) list of pre-defined formats. The selected format is
then integrated into the SELECT statement which is sent to SQLite.

While it works, this draft implementation lacks a number of features.
Here are the most prominent ones I'm currently aware of:
* Data not editable (or only via the Edit Dialog) because it isn't
  transformed back yet.
* More display formats needed; maybe customizable ones, too.
* No indication in the UI for which columns a format has been set.
* Could _maybe_ be integrated into the import/export etc. for optional
  use.
2015-07-06 18:28:30 +02:00
schdub
b2e8dc3500 enhancement: advanced data browser colors preferences 2015-07-01 20:20:14 +03:00
Martin Kleusberg
d5164a0c64 Fix Qt4 build 2015-06-22 00:09:15 +02:00
Martin Kleusberg
39a49e33c2 Allow clicking cells with foreign key in order to jump to referenced cell
Add a tooltip to the database browser when you hover a cell with a
foreign key set in order to show the referenced table and column.

When clicking on such a cell while holding the Ctrl and Shift key (only
one of them won't work because they are for multiselection and Alt
doesn't do the trick on my system because it's just for grabbing and
moving the window) try to jump to the table and row which is referenced
in the clicked cell.

See issue #192.
2015-06-21 23:59:45 +02:00
Bernardo Sulzbach
abc432fcd6 Fixed a few typos. 2015-05-20 10:17:52 -03:00
schdub
517ecec18b sqlitetablemodel: return back 'cheap BLOB test' for data DisplayRole 2015-05-01 15:10:46 +03:00
Martin Kleusberg
6d196c004a Support non-integer primary keys
Add support for non-integer primary keys, especially on table without
rowid column. The previous code often assumed that the rowid column or
its equivalent was a 64bit integer but SQLite allows any data, including
text, to be stored in there.

See issue #240.
2015-04-25 14:22:54 +02:00
schdub
e23b0112d4 fix: type of imported BLOB data #239 2015-04-13 20:49:15 +03:00
Peinthor Rene
6231d3c4f3 sqlitetablemodel: fix a blank insert of row(s) if the actual insert statement failed
before really insert into the main internal data structure
store data in a temporary list and only insert into the table model
if no errors occurred
2015-04-10 08:55:07 +02:00
Samir Aguiar
c3c8f8ce56 sqlitetablemodel: Don't apply NULL fields colours to BLOB fields 2015-03-14 22:32:56 +01:00
Samir Aguiar
9038968c88 editdialog: Differentiate NULL values from empty ones
In the edit dialog the clear button sets the data to
NULL, but because we check if the data has changed
before updating, we need to also check the NULL flag,
otherwise we can't tell NULL values from empty values.

See issue #220.
2015-03-13 00:22:06 +01:00
Samir Aguiar
0dfae63cee sqlitetablemodel: Only return NULL text for display role and NULL fields 2015-03-13 00:22:06 +01:00
Samir Aguiar
994d37f99d preferencesdialog: Add NULL fields style options to Data Browser tab
This adds the ability to customize the text, font colour
and background colour of NULL fields.
2015-03-11 20:19:45 +01:00
Chuong Vu
74fd0793e3 Remove default NULL text for NULL value fields
See issue #163
2015-02-15 01:16:59 +01:00
Chuong Vu
eda00dcd81 Add setting to allow user to change the background color of NULL value fields
See issue #163
2015-02-15 01:16:59 +01:00
Samir Aguiar
4fee089d4d Fix QStrings that had placeholders for queries
When replacing placeholders, QString::arg() looks for
the sequence %n (where n is a number between 1 and 99).
As it turns out this sequence can also appear in SQL
queries and so they were being mistakenly replaced.

See issue #203.
2015-02-14 19:28:47 +01:00
Martin Kleusberg
03b4ef9d1f Further improve 408fbcf8b4 2015-02-06 14:36:53 +01:00
Martin Kleusberg
408fbcf8b4 Use same data type as SQLite for primary keys
This improves commit c20c58595a to
definitely make sure the primary key values are stored and handled
correctly by simply using the same data type as SQLite itself does.
2015-02-06 14:08:59 +01:00
Martin Kleusberg
4fa0576853 Support tables with empty table names
Apparently SQLite supports empty table names for whatever reason. This
commit patches SQLiteBrowser to support databases with a table with an
empty name. I haven't removed the check for an empty table name in the
Create/Edit table dialog though because you probably really shouldn't
create such a table.

See issue #194.
2015-02-06 13:30:30 +01:00
Martin Kleusberg
c20c58595a Support 64bit primary keys
Primary keys in SQLite are 64bit in size. We, however, used the int
datatype which often is 32bit only. Also the conversion from QString and
other Qt datatypes to numbers was done by the toInt() method which fails
on these large numbers. These issues are fixed by this commit, adding
support for databases with big primary key values.

See issue #172.
2015-02-04 17:55:43 +01:00
Martin Kleusberg
9e4a6df804 Show if field contains a NULL value
Show 'NULL' for those fields in a table which contain a NULL value. This
allows the user to see the difference between an empty string field and
a NULL field.

Also change the format of the 'BLOB' information shown for binary data
to match the new 'NULL' information.

See issue #163.
2014-11-29 15:02:10 +01:00
Martin Kleusberg
9ba36d02b2 Add initial SQLCipher support
Add some basic initial support for SQLCipher. Note that this is more of
a POC than a final implementation.

This commit adds an option called 'sqlcipher' to the cmake and qmake
projects which - when enabled - replaces the default SQLite3 include and
library files by their SQLCipher counter-parts. Especially on MacOS X
there might be some more work required in finding the correct include
paths. The SQLCipher library supports unencrypted databases, too, so
even if the option is enabled the program behaves like before. You can
see the difference, though, in the About Dialog where the SQLite version
string will say 'SQLCipher version xy'.

When the sqlcipher option is enabled and you try to open a file which is
neither a project file nor a normal SQLite3 database it is assumed now
that the file is an encypted database. There is no way to tell between
an invalid file and an encypted file, so in both cases a password dialog
pops up. When the correct password and page size are entered the file is
opened and can be edited like any other database before.

Creating encrypted databases isn't supported yet. So for testing you
need to fall back to the sqlcipher command line tool.

See issue #12.
2014-11-01 12:56:53 +01:00
Peinthor Rene
1f6fe11560 sqlitemodel: fix select statements with limit/offset using expressions 2014-09-04 19:46:11 +02:00
Martin Kleusberg
b87992c8fb Clean up the DBBrowserDB class a bit 2014-08-31 16:10:01 +02:00
Peinthor Rene
3b907df8e3 tablemodel: fix crash if rowdata couldn't be fetched 2014-08-22 23:13:39 +02:00
Peinthor Rene
9aa73915c3 sqliteparsing: add a flag to indicate if we support modifying in our dlg
This flag should indicate if we can fully handle this table definition
in our edit table dialog. if not we should do one of these things:
* disable the edit table dialog to modify the table
* display a warning message that modifying this table may remove constraints
* ??
2014-08-18 19:41:49 +02:00
Peinthor Rene
2cadb38719 tablemodel: if our sql parser failed get column names from sqlite
This makes browsing more robust if our sqlite parser fails
we will fallback to a sqlite query to retrieve the column names
2014-08-18 18:53:16 +02:00
Peinthor Rene
cf0213cd7e sqlitemodel: fix endless loop if offset is used in LIMIT 2014-08-13 12:11:03 +02:00
Peinthor Rene
6705e8c9f2 show real insert data after insert a new row
After the insert statement the inserted row
will be fetched and shown in the browse table.
2014-07-10 00:33:41 +02:00