Comments (12)
Hi!
You are right this should be improved and is kinda already stated in the code:
bool SqliteTableModel::isBinary(const QModelIndex& index) const
{
QByteArray val = m_data.at(index.row()).at(index.column());
return val.size() > 1024 || val.contains('\0'); // Cheap BLOB test here...
}
We have to improve the isBinary() function
from sqlitebrowser.
I also noticed that if you change the type to "TEXT" in the EditDialog, as soon as you edit something it will change back to binary mode, which is a pain and unusable.
from sqlitebrowser.
Martin here is a small diff that would fix the 2 issues, any comments?
diff --git a/src/EditDialog.cpp b/src/EditDialog.cpp
index ae1703d..9257151 100644
--- a/src/EditDialog.cpp
+++ b/src/EditDialog.cpp
@@ -141,7 +141,7 @@ void EditDialog::checkDataType()
{
// Check if data is text only
ui->comboEditor->setVisible(true);
- if(QString(hexEdit->data()).toLatin1() == hexEdit->data()) // Any proper way??
+ if(QString(hexEdit->data()).toUtf8() == hexEdit->data()) // Any proper way??
{
ui->editorStack->setCurrentIndex(0);
diff --git a/src/sqlitetablemodel.cpp b/src/sqlitetablemodel.cpp
index 38b3cda..9ad9499 100644
--- a/src/sqlitetablemodel.cpp
+++ b/src/sqlitetablemodel.cpp
@@ -436,6 +436,6 @@ void SqliteTableModel::clearCache()
bool SqliteTableModel::isBinary(const QModelIndex& index) const
{
- QByteArray val = m_data.at(index.row()).at(index.column());
- return val.size() > 1024 || val.contains('\0'); // Cheap BLOB test here...
+ QByteArray val = m_data.at(index.row()).at(index.column()).left(1024);
+ return val.contains('\0'); // Cheap BLOB test here...
}
from sqlitebrowser.
Looks good to me. Especially for the isBinary function we might need to come up with an even better version since this function is called quite often and left()+contains() probably isn't the fastest way to check this - but it's definitely an improvement this way!
from sqlitebrowser.
Just commited the patch. The problem should be fixed now - thanks Steve for pointing this out!
from sqlitebrowser.
Should we make a 3.1.1 with this fix in say a week (and whatever else turns up in the meantime)?
from sqlitebrowser.
Hmmm, thinking about this more, it's a bit iffy to close this without confirmation from the reporter that the problem is solved. It probably is solved, but just in case... 😄
@rp- Your nightly build - non-portable version - will have the fix in it won't it?
If that's the case, @stevehodgett would you be able to test it? Even though it's the non-portable version. http://rp.oldsch00l.com/sqlitebrowser/sqlitebrowser.exe.xz (but wait until tomorrow, when its freshly regenerated)
from sqlitebrowser.
Sure, I'll try it tomorrow and let you know.
Quick work!
from sqlitebrowser.
yes the build tomorrow should have the fix, if there is no build error.
so before downloading check the file date or build log:
http://rp.oldsch00l.com/sqlitebrowser/
@MKleusberg How did you commit this patch as me? :)
from sqlitebrowser.
As predicted, Rene's fix works perfectly as far as I can see both for isBinary and for EditDialog::checkDataType() so, from my perspective, this issue is resolved.
(I do have a related EditDialog comment, but will raise a new issue for it)
Many thanks for the super quick fix!
from sqlitebrowser.
@rp- Here is what I did:
git apply yourpatch.diff
git commit -a --author='Peinthor Rene [email protected]'
This leads to a commit where committer!=author just like when applying changes from a foreign repository. Hope you didn't mind 😀
from sqlitebrowser.
na it's cool, just thought there is some hidden github button for that :)
from sqlitebrowser.
Related Issues (20)
- Vewteck HOT 2
- [Bug]: Timezone / UTC HOT 3
- [Feature]: Cursor key handling of selected row
- [Bug]: Export with quotes does not work HOT 2
- [Feature]: Dark Mode HOT 1
- [Feature]: Save plot as SVG
- Error in error log; (21) API called with NULL prepared statement HOT 2
- [Bug]: Changing the display format of a column destroys its sort order HOT 2
- [Bug]: Pin To Taskbar Windows10
- [Bug]: Some UI text don't scale according to font size settings. HOT 3
- [Bug]: Exact filter on COUNT() column doesn't work HOT 10
- [Bug]: Assertion [cpMax <= pdoc->Length()] failed at ../scintilla/src/Editor.cpp 6096 HOT 3
- [Feature]: Fix ordering of schema export HOT 3
- [Bug]: creation of new db file upon attach of non-existing file fails. HOT 2
- [Feature]: "Filter in any column" should only filter in '__rowid__' is visible HOT 3
- Add Debug Information to 'Continuous' Release HOT 2
- Check Update for Unstable Build HOT 1
- Port to Qt 6 HOT 1
- Rewrite Build Entries in the Wiki HOT 1
- Support for Branch-Specific Build Variants HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlitebrowser.