Commit Graph

42 Commits

Author SHA1 Message Date
Peinthor Rene
c495524fbc fix a crash with browsing VIRTUAL tables, that we can't query 2014-05-09 17:41:00 +02:00
Martin Kleusberg
a002e6768f Make 'without rowid' tables browseable
Don't depend on the existance of the rowid column when using the Browse
Data tab; this means falling back to the primary key if the selected
table is a 'without rowid' table.
While still not supporting these tables very well this makes them at
least readable.
2014-05-09 15:21:27 +02:00
Peinthor Rene
2552249cf8 fix bug, if there is no NL in the last line comment #40
if there was no NL in the line comment we ran into an
endless recursion, now we check for that corner case.
2014-02-14 13:41:15 +01:00
Martin Kleusberg
044907f655 Fix infinite loop when executing some SQL statements with limit part
Issue #31 was about some problems in the SqliteTableModel which caused
an endless loop in the Execute SQL tab when executing statements with a
LIMIT part that didn't end with a semicolon. This was fixed in 0362d615fd
but the regular expression in this commit only worked for statements
like 'SELECT * FROM t LIMIT 0,10' and didn't detect a statement like
'SELECT * FROM t LIMIT 10' where there is only one number after 'limit',
so the bug still ocurred for those commands. This is fixed by this
commit.
2014-01-01 14:45:27 +01:00
Peinthor Rene
94819f22e2 for loop pre-increment optimization's and a slight syntax style change 2013-09-20 14:49:07 +02:00
Peinthor Rene
1bac11348f include cleanup 2013-09-19 22:55:35 +02:00
Martin Kleusberg
bc2511434e SqliteTableModel: Fix bug in last commit to support multiline strings
Fix a bug in the last commit to correctly remove comments on multi-line
queries.
2013-09-06 14:30:50 +02:00
Martin Kleusberg
169eccbebb SqliteTableModel: Remove comments from SQL queries
Remove any single line comments from the SQL queries to fix all those
problems ocurring when a query ending with such a comment is inserted
into the COUNT query.

Executing the query
SELECT * FROM table -- comment
would otherwise lead to this one being executed as well
SELECT COUNT(*) FROM (SELECT * FROM table -- comment);
This is obviously invalid SQL and therefore returns no data, sometimes
even crashing the application, even though the original statement by the
user is perfectly fine.

The code used in this commit is a bit of a workaround and should be
replaced as soon as there is a more complete SQL parser supporting SQL
comments in our grammar tools.

Closes #31.
2013-09-06 14:08:33 +02:00
Martin Kleusberg
a98c96e314 SqliteTableModel: Fix invalid SQL syntax if there's already a LIMIT
Fix the syntax of the SQL string generated by fetchData() if there is
already a LIMIT statement at the end of the query. In this case don't
add an additional one. This fixes half of issue #31.
2013-09-06 12:22:25 +02:00
Martin Kleusberg
26d5645671 SqliteTableModel: Don't add LIMIT to query if it is a PRAGMA or EXPLAIN
Don't add a "LIMIT x,y" at the end of the query in fetchData() when it
is a PRAGMA or EXPLAIN statement. This way correct SQL code is produced
and it also fixes an endless loop when the statement didn't end in a
semicolon.
2013-07-19 22:36:28 +02:00
Martin Kleusberg
13c3963651 SqliteTableModel: Support EXPLAIN and PRAGMA queries again
Change the approach to count the total number of rows returned by an SQL
query to also support EXPLAIN and PRAGMA statements. These failed before
because you are not allowed to put them into a COUNT query. This commit
adds the code needed to count the number of rows manually when one of
these queries is executed.
2013-06-01 14:41:25 +02:00
Martin Kleusberg
40f8a28fad SqliteTableModel: Don't crash when query contains ';'
Fix a bug in SqliteTableModel that caused the application to crash when
the SQL query contained a semicolon somewhere in the middle of the
string. This was caused by an error in the rtrimChar function which
returned everything left of the first semicolon. The new implementation
only removed trailing characters.
2013-06-01 12:58:07 +02:00
Martin Kleusberg
74bdfee384 SqliteTableModel: Return from setData() if value hasn't changed
Don't do any changes to the database if the value hasn't actually
changed. This avoids settings the dirty flag when there is no need to.
2013-05-07 20:51:07 +02:00
Martin Kleusberg
ea31c8023b SqliteTableModel: Don't show binary data in table widgets
Don't show BLOBs as binary data in table widgets, instead put a "BLOB"
text in that cell.

Also make BLOBs not editable unless you use the edit dialog.
2013-05-07 20:47:16 +02:00
Martin Kleusberg
d6ed7e932f Show error message when changing table data fails
Give the user an error message when setting new data for a cell fails.
This is especially useful when the problem is caused by foreign key
constraints.
2013-05-07 20:25:35 +02:00
Martin Kleusberg
a031386edd Fix filter row SQL generation to always produce correct SQL statements
Always produce correct SQL statements, even when using an incomplete
comparison operator.

Fix escaping to make it possible to search for '-charachters.
2013-05-03 13:34:26 +02:00
Martin Kleusberg
909d435ec6 Allow inline editing in browse data tab
Make it possible to edit records directly in the table view without
having to open the edit dialog.
2013-05-02 17:36:16 +02:00
Martin Kleusberg
b3465546bb SqliteTableModel: Remove dependency from PreferencesDialog 2013-04-26 13:55:29 +02:00
Martin Kleusberg
7799ef1865 Make number of rows to prefetch when doing lazy population configuarable
Add a new option to the settings dialog to allow changing the number of
rows to get at a time.
2013-04-24 20:25:36 +02:00
Martin Kleusberg
214a56d916 Partially revert 7073230 to fix filter row 2013-04-17 22:06:14 +02:00
Peinthor Rene
c0441dcd97 Revert "don't canFetchMore on our own"
This reverts commit b9af3706e7.

As explained MKleusberg, this might be needed, and this practise
is also used by Qt itself.
2013-04-16 19:57:03 +02:00
Peinthor Rene
707323067d get setQuery without setTable working again 2013-04-15 17:45:41 +02:00
Peinthor Rene
e2d75ff1cf add a check for valid querys 2013-04-15 17:35:28 +02:00
Peinthor Rene
b9af3706e7 don't canFetchMore on our own
This is called by Qt itself before showing more data.
2013-04-15 06:34:33 +02:00
Peinthor Rene
6f3f21fbd7 increase default chunk size
this speeds up going to record 900000 significantly
2013-04-14 21:37:38 +02:00
Martin Kleusberg
ae6e452f36 SqliteTableModel: Notify view and parent class code when clearing cache
Call beginRemoveRows() and endRemoveRows() when emptying the cache. This
silences those warnings from QAbstractItemModel::endInsertRows() and
fixes a crash when exiting the program both ocurring when the data was
resorted.
2013-04-11 16:00:54 +02:00
Martin Kleusberg
7145872f66 SqliteTableModel: Fix wrong LIMIT value in fetchData() 2013-04-11 14:23:30 +02:00
Martin Kleusberg
c7e6684fc4 SqliteTableModel: Allow data() and setData() on rows not cached yet 2013-04-11 14:08:59 +02:00
Martin Kleusberg
f73e3f0546 SqliteTableModel: Fix really stupid bug in insertRows() and removeRows() 2013-04-10 20:44:00 +02:00
Martin Kleusberg
334cc26c57 SqliteTableModel: Speed up on large table in certain circumstances 2013-04-10 19:27:16 +02:00
Martin Kleusberg
31bf07000b SqliteTableModel: Restore BLOB support and clean up DBSQLiteDB 2013-04-10 18:18:08 +02:00
Martin Kleusberg
44a635167d Allow different comparison operators in the new filter row
Allow other comparison methods than just the LIKE operator when using
the new filter row.
2013-04-09 19:28:21 +02:00
Martin Kleusberg
6742f5632d Add a filter row to the table view in the browse tab
Add a row of line edits between the table header and the actual content
of the table in the browse tab. Show one input widget per table column
in this row.

Add a live search which hides any table rows which do not fit to the
current filter settings.

Why add this to the parital-data-fetch branch? Because this is an
attempt to get rid of the find dialog which is broken again and not even
worth fixing. Also there is not much to break in this branch at the
moment ;)
2013-04-09 18:52:37 +02:00
Peinthor Rene
217ca805a1 fix correct row insert 2013-04-07 22:47:25 +02:00
Martin Kleusberg
9d02480294 SqliteTableModel: Simplify code 2013-04-07 20:49:54 +02:00
Martin Kleusberg
225e5a1c74 SqliteTableModel: Don't crash when opening an empty table 2013-04-07 19:21:03 +02:00
Martin Kleusberg
77cf98fd53 SqliteTableModel: Inserting and deleting rows, clean up, bug fixes
Add some basic code to support inserting and deleting rows again.

Fix a few bugs here and there.

Do some general code clean up.
2013-04-07 19:08:40 +02:00
Martin Kleusberg
73bda97ce9 SqliteTableModel: Fix editing 2013-04-07 17:51:56 +02:00
Martin Kleusberg
3cd5792cea More improvements and fixes to the new SqliteTableModel
Change the way sorting is done to correctly sort all data even if it
hasn't been loaded completely yet.

Fix the navigation label and buttons by showing the correct information
again and fixing the validator of the input field.

Log all SQL statements executed from within the SqliteTableModel.

Silence a few warnings.
2013-04-07 17:30:35 +02:00
Martin Kleusberg
00b9f40271 SqliteTableModel: Make editing of data possible again 2013-04-06 23:12:53 +02:00
Martin Kleusberg
f25892d6d2 SqliteTableModel: Do a few fixes and add sorting again
Fix empty rows being shown in the main window when changing to a table
with less rows than the old one.

Add sorting in the browse tab again.

Do some minor clean ups.
2013-04-06 22:09:36 +02:00
Peinthor Rene
93cce3d87f first working prototype 2013-04-06 12:22:50 +02:00