Commit Graph

624 Commits

Author SHA1 Message Date
MKleusberg
3b0efd8769 Merge pull request #28 from justinclift/we_don_need_no_steeeenkin_embedded_tabz
Converted another embedded tab to space.
2013-06-08 15:44:19 -07:00
Justin Clift
da3e356bd8 Typo fix in help tooltip 2013-06-08 20:11:38 +01:00
Justin Clift
af4dcbfa07 Converted another embedded tab to space.
Missed this one. :(
2013-06-08 20:01:59 +01:00
Peinthor Rene
0f37137a0a Merge pull request #27 from justinclift/we_don_need_no_steeeenkin_embedded_tabz
Convert the embedded tabs to spaces
2013-06-08 11:58:26 -07:00
Justin Clift
4b45f040ac Convert the embedded tabs to spaces
For the benefit of people who's editors show embedded tabs visually
as errors (like me). :)
2013-06-08 19:54:55 +01:00
Peinthor Rene
d6552ce7bf Merge pull request #26 from justinclift/osx_include_paths
Added include paths for SQLite3 installed using OSX Homebrew
2013-06-08 11:47:25 -07:00
Justin Clift
c83bf8fcb8 Added include paths for SQLite3 installed using OSX Homebrew 2013-06-08 19:42:05 +01:00
MKleusberg
141cfd5df2 Merge pull request #25 from justinclift/osx_build_instructions
Added initial working OSX build instructions
2013-06-08 03:23:13 -07:00
MKleusberg
b7725841a6 Merge pull request #24 from justinclift/macfixv2
Improved resilience when checking for SQLite on OSX
2013-06-08 03:22:56 -07:00
Justin Clift
31223a0d49 Added initial working OSX build instructions 2013-06-08 01:08:25 +01:00
Justin Clift
8db087a8fb Improved resilience when checking for SQLite on OSX 2013-06-08 00:16:04 +01:00
MKleusberg
487f8adbb1 Merge pull request #22 from justinclift/macpathfix
Update OSX build to use Homebrew compiled libs
2013-06-07 12:03:39 -07:00
Martin Kleusberg
7a81189d50 PreferencesDialog: New settings for font size of SQL editor and log
Add two new settings to allow changing the font size inside the SQL log
and the SQL editor.

Increase the default font size from 8 to 9 - better a bit too big on
some systems than too small on others.

Also do some restructuring in the MainWindow to avoid duplicate code to
reload settings.
2013-06-07 20:57:58 +02:00
Justin Clift
8d9044500d Update OSX build to use Homebrew compiled libs 2013-06-07 13:05:39 +01:00
Peinthor Rene
34887e42bf add a fallback gen_version.h if for some reason the creation of the file fails 2013-06-06 09:36:51 +02:00
Martin Kleusberg
720ef9bc95 Also load SQLite extensions when importing a SQL file into a new DB
When creating a new database file for an SQL import load the default
SQLite extensions - just like it's done when creating a new database the
normal way.
2013-06-05 21:23:48 +02:00
Martin Kleusberg
d7c9585982 DBBrowserDB: Don't export sqlite_sequence table
When creating an SQL dump don't export the sqlite_sequence table as it
is created internally by SQLite and it is not possible to import it
again.
2013-06-04 22:15:15 +02:00
Martin Kleusberg
324bb23193 DBBrowserDB: Merge renameColumn() and dropColumn()
Merge the renameColumn() and dropColumn() methods. They are just way too
long and complicated but also very similar that it makes no sense to
keep them separated.
This also simplifies the code of renameColumn() a bit while fixing the
trigger/view/index problem in dropColumn().
2013-06-04 17:36:14 +02:00
Martin Kleusberg
2463116976 DBBrowserDB: Use SQL grammar for getting fields of table
When reading in the DB layout use our SQL grammar parser to determine
the fields of a table. This simplifies the code a bit and might also
give more detailed information in some situations.
2013-06-04 17:13:27 +02:00
Martin Kleusberg
b07f0a5add DBBrowserDB: Clean up logSQL() method 2013-06-04 17:03:57 +02:00
Martin Kleusberg
eb560e2a62 EditTableDialog: Warn when trying to set AI flag on non-integer column
Show a warning and abort the action when trying to set the auto increment
flag on a column with non-integer values in it because SQLite doesn't
allow setting the flag on these columns.
2013-06-04 16:58:54 +02:00
Martin Kleusberg
db39e3e293 DBBrowserDB: Attempt to restore views, indices etc. in renameColumn()
Save views, triggers and indices before deleting the old table in
renameColumn() and try to create them again after renaming the new
table. This is likely to fail and we'd probably need a grammar for these
objects to make the appropriate changes, so in case it does fail this
just prints a warning with some ideas of what to do.
2013-06-04 16:42:31 +02:00
Martin Kleusberg
6bd114dca3 Merge branch 'feature-nologtruncate' of https://github.com/oysteinkrog/sqlitebrowser into oysteinkrog-feature-nologtruncate 2013-06-04 15:13:19 +02:00
Øystein Krog
da0ac6bc0d Don't truncate log messages unless they contain binary data (removes previous log limit of 300 characters)
Adapted from c4d253287f
2013-06-04 10:18:07 +02:00
Martin Kleusberg
63cf871017 SqliteTypes: Move PK flag from table to field
Store the primary key flag(s) inside the sqlb::Field objects instead of
the sqlb::Table object. Technically this doesn't make a lot of sense but
then again it makes things a lot easier for us. So this should fix quite
a few issues in the entire program, especially - again - in
renameColumn(). It also magically fixes createColumn() which had no
chance of guessing which column should be a PK prior to this.

To benefit from these changes the EditTableDialog has changes as well.
- It should now be possible to set and unset PK and AI flags and they
  are actually saved.
- Setting the AI flag automatically sets the data type to Integer
  because that's the only type SQLite can handle in an autoincrement
  field.
- Clicking on the entry in the data type combobox which is currently
  selected doesn't update the DB anymore.

This commit also makes some changes to the unit tests to reflect the API
changes made. But it also adds missing quote characters in some
verification strings.

I hope this is a worthy 500th commit - at least it's got a long commit
message...
2013-06-03 20:15:29 +02:00
Martin Kleusberg
3a85d96a6d DBBrowserDB: When reading DB layout also save not null and default value
Fix the updateSchemea() method to also read and save the not null flag
and the default value of each column.
This fixes a problem in renameColumn() which made it "forget" these
values. It is now possible to set the not null flag of multiple columns
in EditTableDialog.
2013-06-03 18:26:46 +02:00
Martin Kleusberg
26faa9c0fb EditTableDialog: Check before setting NN when editing existing table
When setting the Not Null flag of a column in an existing table check if
there are rows with NULL values in this column before making any
changes. This avoids an error in renameColumn() caused by the INSERT
INTO ... SELECT ... statement failing. In a next step we could check if
a default value for this column has been specified and use this in these
kind of situations.
2013-06-02 21:50:25 +02:00
Martin Kleusberg
928a957e70 SqliteTypes: Allow non-numeric default values
Fix the sqlb::Field class to support non-numeric default values by
putting them in quotes.
2013-06-02 17:16:35 +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
ebadc180ce EditTableDialog: Remove unused function 2013-06-01 12:50:19 +02:00
Martin Kleusberg
fa2589c829 DBBrowserDB: Use sqlb::Field for createTable()
When creating a new table specify the table structure using the
sqlb::Field type instead of just a plain string list.
2013-06-01 12:43:43 +02:00
Martin Kleusberg
c0b3506ede EditTableDialog: Fix bug when renaming column
Store the old column name to be able to address it by its current name
when renameColumn is called.
2013-06-01 12:42:36 +02:00
Martin Kleusberg
cbd81de88b Remove the DBBrowserField class
Remove the DBBrowserField class and change all parts of the program
which used to use this class to work with sqlb::Field instead.
2013-05-31 16:50:13 +02:00
Martin Kleusberg
b9afbe2aea EditTableDialog: Allow some more changes to existing tables
Allow setting the default value, the check values and under some
circumstances the not null flag when editing existing tables.

This required some changes to DBBrowserDB::renameColumn() which is now
using some more features of sqlitetypes.cpp but could still be improved.
2013-05-31 16:13:58 +02:00
Martin Kleusberg
82d78384e0 EditTableDialog: Some minor code clean up 2013-05-31 14:29:45 +02:00
Martin Kleusberg
7e319bd80f EditTableDialog: Fix adding new fields to table
Fix the function to add new columns to an existing table to work
properly with the recent changes.
2013-05-31 14:21:11 +02:00
Martin Kleusberg
b1333c90c7 EditTableDialog: Make it possible to change the type of existing columns
Restore the possibility to change the data type of a column of an
existing table - a feature we lost some time ago.

Also change the updateTypes() method to not actually update the types of
all columns when only one can be changed at a time.
2013-05-31 14:14:30 +02:00
Martin Kleusberg
23331ea181 DBBrowserDB: Always update internal variables after changing the DB layout
Make sure to always replace the old DB layout representation in
DBBrowserDB after making changes to the database.
2013-05-31 14:12:10 +02:00
Martin Kleusberg
8063502def EditTableDialog: Allow renaming columns of existing tables
Make it possible to rename the columns of already existing tables using
the EditTableDialog. This is a feature we lost somewhere around commit
b36800ea02.
2013-05-30 15:35:25 +02:00
Martin Kleusberg
8c86a01faf EditTableDialog: Don't change the cursor when renaming the table
Renaming a table doesn't take a lot of time hence no need to change the
cursor.
2013-05-25 17:22:20 +02:00
Martin Kleusberg
f3ae25572d DBBrowserDB: Remove the dirty flag
Remove the dirty flag as it is no longer needed. Because we track the
savepoints currently held open we can just use that list to see wether
there are changes to be committed. So there is no need to track this in
a separate variable.
2013-05-23 18:16:58 +02:00
Martin Kleusberg
6de8425985 VacuumDialog: Fix dialog after savepoint change
Call saveAll() in the VacuumDialog to make sure to release all savepoints.

Also cancel the dialog when no object was select but the OK button
clicked. This avoids an unnecessary DB reload in the main window.
2013-05-23 18:09:09 +02:00
Martin Kleusberg
7f03e01a86 ImportCsvDialog: Also use the new savepoint logic in this dialog
Do just the same in the ImportCsvDialog as before in the
EditTableDialog, i.e. using a unique savepoint name which is not
released when the import was successfull.
2013-05-23 18:04:27 +02:00
Martin Kleusberg
a1b72c5eef Extend the entire savepoint logic to allow multiple active savepoints
Allow multiple savepoints in DBBrowserDB, i.e. setRestorePoint() doesn't
simply return if the DB is already set to dirty but creates an
additional savepoint.

Track the names of all savepoints which have not been either saved or
reverted yet.

Finally, and that's the whole point of this commit, change the savepoint
logic of the EditTableDialog. We used to have a transaction started when
opening a database which was only committed when the file was closed
again. This way the EditFileDialog could savely create a savepoint when
being opened and just release it when OK was clicked or revert to it
when cancel was clicked. Getting rid of the transaction broke this
logic. The dialog still worked but as the savepoint was released when
the changes were applied all changes made via the dialog were
immediately committed to the database. So clicking the revert button had
no effect on those changes. This is at best an unexpected behaviour but
could also be a problem when some changes are reverted while others
aren't. So, having the option now of keeping multiple savepoints opened
this problem can be fixed by just creating a new savepoint every time
the dialog is opened, reverting to it when it is cancelled and _not_
releasing it when OK is clicked.

I hope this works!
2013-05-23 17:41:16 +02:00
Martin Kleusberg
4dfabe4a78 VacuumDialog: Add dialog to allow compacting single objects individually
Add a new dialog which is shown when compacting the database. This
dialog allows selecting single objects individually to avoid vacuuming
the entire database.

It also shows a new warning if the database is dirty as changes are
going to be saved before vacuuming.
2013-05-21 22:32:05 +02:00
Martin Kleusberg
6f8e988f10 Also enable extension loading when creating a new database 2013-05-21 21:01:19 +02:00
Martin Kleusberg
929bb9026d SqlTextEdit: Support opening files by drag and drop
When dropping a file on the editor widget try to open and read it.
2013-05-17 15:05:21 +02:00
Martin Kleusberg
c0e6d251d5 MainWindow: Show execution time in SQL tab
Show the time needed for executing a statement in the result box.

Generally fix some minor problems with the result view.
2013-05-17 14:56:58 +02:00
Martin Kleusberg
c251a001a1 DBBrowserDB: Fix transaction logic in execute{Multi}SQL
Create a restore point in executeSQL and executeMultiSQL instead of just
setting the dirty flag. This way the changes made using these functions
are not applied immediately when no restore point was created yet.
2013-05-17 14:39:42 +02:00