aviaryan / Clipjump

:clipboard: Clipboard Manager for Windows, built in AutoHotkey
http://clipjump.sourceforge.net/
384 stars 62 forks source link

Random SQLite syntax error "near" "Code: 1" popups #134

Open CollinChaffin opened 7 years ago

CollinChaffin commented 7 years ago

Been using clipjump for many years and just finally upgraded to the x64 2.5 version that now uses SQLite. Been working great but since upgrading i've been getting seemingly random popups of the following error:

SQLite Error

Msg: near",": syntax error Code: 1

That at least one other person over in the forum posted also getting on a special paste operation. In my case, I have some RDP windows/mgrs open cannot link the timing of these syntax error popups to a specific operation not to say it isn't.....but with RDP sometimes background copy/paste operations to share clip contents could be triggering.

Either way, this issue is new with the new SQLite version (obviously) since it's a syntax error apparently specific to SQLite but not sure how to give you more info than this - just let me know! Thanks!

CollinChaffin commented 7 years ago

Have an update. I have tested enough to finally have a way to reproduce this error. I use the very popular freeware symlink extension called "Link Shell Extension" that allows various soft & hard link operations. Some of which are copying and pasting or "picking" and "dropping" (same thing because clipboard is used). EDIT: Upon the first PICK (COPY) operation in this new version of Clipjump will now generate this error). This always worked without any error with the old versions for many years of Clipjump but this 2.5 is the first version to ever have any issue. I will say, this is absolutely NOT the only thing causing this "syntax error" in SQLite because I have absolutely had it pop up during many other non-linkshellext operations, but this just happens to give us a 100% reproducible method to show the error.

Hope it helps and you can figure out what is causing this error because I absolutely cannot live without Clipjump and love the new version would really rather not have to roll back if at all possible!

Edit: Screenshot: https://1drv.ms/i/s!AhSqjTYUuHPKgZ1mdCQq2UkNSmHhwQ

snag_1-28-2017_10-20-01

CollinChaffin commented 7 years ago

Hi, any progress on this just want to confirm if someone has been able to reproduce and can confirm they think a fix is forthcoming possibly sooner rather than later? I just would rather not have to roll back but if it won't be fixed anytime soon I may have to. :(

aviaryan commented 7 years ago

@CollinChaffin Hey, sorry to keep you waiting. The thing is, I have pretty much stopped using Windows these days so I can't fix it. Can you please try disabling History from Settings OR activating Incognito mode and then try the same steps again. It obviously has got to do something with SQLite, specifically SQLite insert statements.. Your results will help us get closer to the fix.

CollinChaffin commented 7 years ago

Sorry I didn't reply sooner. We definitely need to get to the bottom of this since there are so many Windows users so I'll help however I can. I can tell you that activating the Incognito mode (not a mode I've ever once used so not even sure what it does) results in the error NOT appearing that are otherwise 100% reproducible. So, that kills the errors but not sure how much that can help you hopefully it does.

What else can we test? In the forum there was another user that had this exact SQLite error in a different operation and I had a possible code fix and I guess I thought that forum user may have been you, but apparently not?

CollinChaffin commented 7 years ago

FYI, here is a free, universal, sure-fire way to also reproduce this error:

Open Windows Powershell and type the following and it will immediately generate this error. Meaning - this is a common, widespread syntax error issue since all this command it doing, is using the built-in MS API's to access the clipboard but for some reason, it's methods cause the error:

Set-Clipboard -Value "Test"

"Msg: near ",": syntax error" "Code: 1"
aviaryan commented 7 years ago

Sorry I didn't reply sooner. We definitely need to get to the bottom of this since there are so many Windows users so I'll help however I can. I can tell you that activating the Incognito mode (not a mode I've ever once used so not even sure what it does) results in the error NOT appearing that are otherwise 100% reproducible. So, that kills the errors but not sure how much that can help you hopefully it does.

Incognito mode disables History keeping i.e. Action Mode -> H. Disabling it removes the error means that the problem is in the code to store history text to SQLite db. Is there any type of specific text, upon copying of which this error shows up? I have a feeling that there is some particular character, which when is tried to insert into SQLite, causes this error.

CollinChaffin commented 7 years ago

Yea see the last powershell above literally copies the text "Test" into clipboard using I'm assuming windows API, which is also BTW upon opening RDP sessions that share clipboard using the Win API also right now generate this SQLite error, and then the picking of the symlink path so it must be the API but not sure why since the above Powershell literally when Clipjump is in disabled state, I run it and paste back immediately and what is in the clipboard is literally a string, with 4 characters of "Test" - no newline, no special char, etc. so I don't have much else to go on without some direction from you. I haven't tried myself to dig into the source code is it all there in the AHK file and readable so I could also try to debug? Is there any way to breakpoint and debug a AHK file execution?

Skrell commented 7 years ago

I also get this error, I assume as of today there is no known fix?

Donads commented 7 years ago

I'm having the same issue. I've just started using Clipjump and I'm loving it, though I have this sort of issue with a few specific programs as well. As soon as I started using Clipjump I had enabled "Store images in history", so after reading through this issue I tried disabling it and now it's working wonderfully!

ew12 commented 5 years ago

In case anyone is still looking for some solution,here it is:

edit "lib/History GUI Plug.ahk"

CCCBBBAAAHIGHSCORE commented 5 years ago

hey ew12 and aviaryan (i see you liked his reply and you seem to know about clipjump :p )

Can you explain what the modification you suggest does ?

I read the thread diagonnaly and i see that : i have the same issue, most of the time it is when i copy an image ; and i would like to keep images in my history and have the preview,

does your modification change that ?

thanks !

ew12 commented 5 years ago

Yes,with that modification you can keep images in your clipjump history.I am gonna explain what the modification do below.

The function addHistoryImage in "lib/History GUI Plug.ahk" reads the given local image file,then adds a record to database with sql command like this:

insert into history (data, type, time, size, fileid) values ("[IMAGE]", 1,"2019-01-06 14:26:32", 158811, "cache\history\7tuf4qou1uph20z.jpg")

But in some case,that image file doesn't exist,so when the function addHistoryImage read the size of that file,it would get nothing.In situation like that,the sql command addHistoryImage tries to execute is like this:

insert into history (data, type, time, size, fileid) values ("[IMAGE]", 1,"2019-01-06 14:26:32", , "cache\history\7tuf4qou1uph20z.jpg")

This command is not acceptable in sqlite3,so the error happens.

So what I did was telling the addHistoryImage funcion to set the size=0 when the file not exist.And that's it.

CCCBBBAAAHIGHSCORE commented 5 years ago

Thank you for the perfect explaination !

Now i have another problem, maybe i should make a new thread ? the popup error doesnt show but the error can still happen, i mean : i make a screenshot (with windows snipping tool, with greenshot or lastly shareX) and i copy it to my clipboard, well sometimes it work, sometimes it doesnt, any idea how i can fix it ?

ew12 commented 5 years ago

Yes that's right,my solution above is just ignoring the issue of non-existing image cache file. But I dont have the time to tackle it right now.As far as I can tell,the real cause of the issue could be tricky.Like the comment 'CollinChaffin' posted,try to set a text record to clipboard in powershell would trigger that image function too.