View Single Post
  #14  
Old 06-20-2022, 06:18 AM
Spliff Spliff is offline
Registered User
 
Join Date: 04-07-2021
Posts: 192
Thank you so very much, Kyle for your tremendous help, everything, really everything, works now!

And of course, I would have believed you without the screenshots!

Not having found the "Manage Attachments" button yesterday, I now add a screenshot as an example for how UR created ALL new files then (i.e. before repair); curiously, these files would regularly open in UR; I have checked all my "real" = previously-created UR files, all of them are ok, functionally-, AND Hex-wise for their signature and their signature's, ditto for all newly created UR files now.

After your more than very kind answer, I then googled "windows repair" or similar, then I ran sfc /scannow - I know about that in principle, but as my post yesterday showed (again), when "nothing works anymore", I'm good-for-nothing, unfortunately, multiplying errors and mistakes.

So, sfc / scannow FOUND corrupt files, and was able to repair them - as said / implied above, nothing else though did not work correctly, except (!) for the sqlite problems (first "just" with sqlite3.exe - Navicat had worked for my UR files at the time! -, then also Navicat not opening those files anymore, and then also UR creating those crazy UR file "headers" for new files (I've got my "set" of files now, so I don't create new ones in regular use)...

After the repair, I re-downloaded (again) and re-installed (again) UR, Navicat, 010Editor, and sqlite3.exe (again into c:\), and now everything works as expected, incl. sqlite3.exe (the latter one badly, as expected).

Thank you very, very much, Kyle!


FOR FELLOW UR USERS:

Since UR creates new files (as expected, and before a possible registry key setting perhaps) with .urd, and with its own signature, you better create new files as renamed copies ("save as") from a (not corrupted, of course) "dummy" file, as for doing the necessary changes once-and-for-all. As Kyle has gracefully clarified above, UR will then "leave alone" both of these changes, so you can use the current, generic (!) sqlite3.exe now. Thus:

If I remember well, Kyle's (old, "special") version of SQLite3.exe (which didn't even do special chars like äöü well in command-window output if I remember well) is NOT needed anymore; once you do the signature switch and the suffix rename, use the newest sqlite3.exe from sqlite.org - mine is just days old (i.e. even newer than the one I had downloaded from them only weeks ago.

Their site is misleading: For their 64bit version, you would have to do the necessary compiling yourself (!) - so you use the 32bit version which is, as said, regularly updated. It is to be found here:
https://www.sqlite.org/download.html , and there then
"Precompiled Binaries for Windows", and there finally the THIRD and last entry,
SQLite TOOLS zip
and the sqlite3.exe (32bit then) is only to be found after unzipping that "tools" zip -

and you'll need their help page: https://www.sqlite.org/cli.html

(whilst this is a quite bad page, according to me:
https://www.sqlitetutorial.net/sqlite-commands/ )

Then, the following code works (more or less, see my (comments):

(first you run sqlite3.exe, which will open a command-window, and in there then

.open "d:/ur/filename.db"
(being renamed, and with the generic SQLite3 signature)
(here, you MUST enter the complete path, and incl. the file suffix; unfortunately, sqlite3.exe does NOT give you any hint if you mistype even a single char here, but just "creates" a new, empty db file (without suffix) instead, and it isn't but afterwards that it will you flood with "no such table", etc. error messages: no wonder then since everything you do, will apply to a new, empty db, unknown to you!)

.mode line
(or column or csv or several others)

.output stdout
(
will show your select results in the command window, even with äöü, etc. being preserved now; or then
.output |clip
= most useful for UR use, obviously: will write the output into the clipboard, but here äöü, etc. will create "chaos"; obviously, this is a question for the sqlite.org forum, or perhaps (i.e. in the meanwhile, if the sqlite.org developers do something about it but not immediately) for general Windows forums, re "clipboard page file"; or
.output d:/filename.txt or .csv..., with or without "", and with / or with \ (as above for the db file) but here you must expect problems: sqlite3.exe creates that file (if it not already exists) on the spot (i.e. not waiting for your select command to be written into that file), and in my tries today (mode line and suffix .txt), it will remain empty, even after the successful select command, that one being successfully executed being checked by both .output stdout and .output |clip, before the select - and, of "course", in my partially successful tries some weeks ago, sqlitee.exe effectively wrote into the given file, but scrambling all öäü, etc., as it continues to do now in .output |clip, but NOT in .output stdout anymore...
EDIT:
similar on first try:
.once d:/ur/YourOutputFile.txt
= will create that file immediately (instead of waiting for the subsequent select to "need" it, and then the (correct) output is done in the command window (which is the default anyway, so
.output stdout
is only necessary if you had defined some other output beforehand
EDIT 2:
but on second and third try, the same
.once ... with
select ...
then FILLED the output-file with the expected output, instead of again displaying it in the command window, thus:
sqlite3.exe obviously has its glitches... another very valid reason indeed to use its UPDATE commands onto COPIES of your valuable UR file... ;-)
EDIT 3:
And the FILE output (if it's successful, then...) is with äöü, etc. preserved, whilst the clipboard output is not, so the sqlite3 developers obviously are "working on it"?! ;-)
)

.header on
(in case, etc., etc.)

(for macros / scripts, the
.read d:/folder/SomeSqliteCommandsInATextfile.txt
command could become of real interest, didn't try it out yet though)

select ...;
(here, the ; is required; if you forget it, sqlite3.exe seems to hang, and does not execute the select)

And, not in parentheses, try any SQL that changes things, by "update", etc., on a COPY before, then comparing the resulting, new db with the "original" (there even is a free compare tool in the above-mentioned sqlite.org .zip download, and then there are several proprietary ones, as well as there is one within Navicat, I mentioned that fact some months ago - and finally, as you can see from one of Kyle's screenshots above, he chose Navicat, too, and yes, there's a reason for that - myself, just "playing around", i.e. doing "my things" as a pensioner, not "making money", had not pay for the really expensive regular = commercial version that is...)

It's obvious that if you destroy your UR db with sqlite3.exe, then ask Kyle for help, we'll drove him nuts! Thus:

As said, Navicat for SQLite is really best but if you want to use specific tools, there also is (not mentioning DBeaver, with Data compare, but also expensive):

- SQLiteDiff (25$, not trialed yet)

- KS DB Merge Tools for SQLite ( de-merge-tools.net , free and 50$ for more functionality, not trialed yet)

- SCLite Compare Utility (on codeproject.com, free, download for members only - membership is free I suppose -, not trialed yet)

- there are also Altova DiffDog and Altova DatabaseSpy (both altova.com), Apricot DB (sourceforge.net) and some others...

There are other compare tools (especially or also) for SQLite DBs ("schema compare" will not help you then in most circumstances, it's "sqlite data compare" you'll be after), but the important thing is, do "updates" work on a file copy first, then compare, in SQL, the slightest mistake can create havoc.

And in case of problems, or even on a regular - monthly? - basis, run
sfc / scannow (I've noted a ToDo for that matter; obviously, you can get very specific but very serious problems indeed, even without your whole system going "unstable"...)


My deepest apologies again, for the brave-and-unnecessary work I caused you, Kyle!
Attached Images
 

Last edited by Spliff; 06-20-2022 at 06:51 AM.
Reply With Quote