Debugging SQL script



  • I have an SQL script to generate an SQLite database in iOS. This script was written on Windows and shared with the Mac/XCode via subversion. I've spent the past hour trying to debug why the database fails to create, and I've run into the same issue about a dozen times. Random 's' characters in the script. These are there because OS X has trained me to subconsciously hit Windows-S instead of Ctrl-S to save the current document. On Windows, that key combination just inserts an 's' character, then my SVN client is smart enough to save the document before committing.

    What would be really nice is if the SQLite runtime included on iOS could give me a line number, or perhaps print out the entire line that made the parser explode. Instead of just saying "Syntax error near Table."

    I think I'm about to rage-quit and take a lunch break at 10:00 am.



  • In my experience, I have never gotten a useful line number out of any SQL-related error message. Usually because the line number you see in the editor is not related to the line number the database execution engine sees (due to batching and what not).

    The proper solution is to add a pre-commit hook to subversion that strips out all 's' characters.





  •  I have a similar problem if I end up working on a C project and a VB.net project at the same time. My .net project ends up with tons of superfluous semicolons at the end of lines, and my C projects end up with mysterious errors at the end of functions.



  • The solution is to never use OS X ever.



  • AutoHotKey is good for working around muscle memory maladaptations. Windows-S doesn't do anything useful, so just remap it to Ctrl-S.



  • @blakeyrat said:

    The solution is to never use OS X ever.

    That's your solution to everything.



  • @morbiuswilters said:

    @blakeyrat said:
    The solution is to never use OS X ever.

    That's your solution to everything.

    It's a good solution



  • @morbiuswilters said:

    @blakeyrat said:
    The solution is to never use OS X ever.

    That's your solution to everything.

    It works, that's more than what can be said of most "solutions" I've seen.



  • @blakeyrat said:

    The solution is to never use OS X ever.
    ... if you have the luxury...

    A very long time ago, I had to rotate between DOS, VMS and SunOS, all at the same job and on the same project.  Naturally, my hands were always typing for the previous OS on which I was working, which left me repeating lots of commands using the correct name/syntax, and entering all sorts of stuff that didn't work into my scripts.

    Finally, I got fed up and decided to take a brute force approach. I created a set of command scripts (.bat, .ksh, etc) for each machine, to wrap all the commands of the other machines so that "ls -l " would run ls.bat and pass -l to it - which worked on dos and "dir" (implemented as a ksh script to do ls) worked on SunOS, etc. I also created the equivalent of key-macros on all versions of editors I had to use to effect the same thing (e.g.: translate: ctrl-s to the right thing in the right OS).

    It was a royal PITA, but it worked and made my life a lot less frustrating...

    FWIW.

     



  • @snoofle said:

    A very long time ago, I had to rotate between DOS, VMS and SunOS, all at the same job and on the same project.  Naturally, my hands were always typing for the previous OS on which I was working, which left me repeating lots of commands using the correct name/syntax, and entering all sorts of stuff that didn't work into my scripts.
     

    A long time ago, at university, I had a 1 hour Pascal tutorial followed immediately by a 1 hour C tutorial.  I spent most of the second hour adding semicolons to lines and swapping BEGIN and END for { and }.




  • @RTapeLoadingError said:

    ...a 1 hour Pascal tutorial followed immediately by a 1 hour C tutorial.

    Has such a perfect storm of buffer overflows ever existed before or since?



  • Reminds me of the number of times I type :wq into random places. I've also started slapping 'e', the gmail shortcut to 'archive', whenever I want to make something random disappear.



  • You people are pathetic. Habits are satan. Any software that uses ":wq" as a shortcut to ANYTHING deserves nothing but scorn.



  • @blakeyrat said:

    .... Any software that uses ":wq" as a shortcut to ANYTHING deserves nothing but scorn.
     

    So "CTRL-S, ALT-F4" is much better then?



  • @hetas said:

    @blakeyrat said:
    .... Any software that uses ":wq" as a shortcut to ANYTHING deserves nothing but scorn.

    So "CTRL-S, ALT-F4" is much better then?

    What is it with you keyboard phanatiques? Just use the mouse, like God intended.



  • @blakeyrat said:

    You people are pathetic. Habits are satan. Any software that uses ":wq" as a shortcut to ANYTHING deserves nothing but scorn.
     

    Exactly. Everyone knows ":x" is the way to go.



  • I type "exit" into IM windows when I am done with them.






    ^D



  • @Xyro said:

    I type "exit" into IM windows when I am done with them.

    I don't think I've typed "exit" for many, many years. Ctrl-D for shells and terminals. Ctrl-W for browsers and most other windowed apps (like IM clients).

    @Xyro said:

    ^D

    O_o



  • @hetas said:

    @blakeyrat said:

    .... Any software that uses ":wq" as a shortcut to ANYTHING deserves nothing but scorn.
     

    So "CTRL-S, ALT-F4" is much better then?

    Control-S is. Alt-F4 is not.

    Just because some Linux program is terrible doesn't mean the Windows shortcuts are good. Sometimes TWO things can be terrible, you know.



  • @Xyro said:

    I type "exit" into IM windows when I am done with them.






    ^D
     

    I realized I'd been spending too much time on MUDs when I started typing "quit" into terminals and then wondering why they didn't close.



  • @Mason Wheeler said:

    I realized I'd been spending too much time on MUDs when I started typing "quit" into terminals and then wondering why they didn't close.

    I realized I'd been spending too much time on MUDs when I found myself friendless and alone at 4:30 AM in a filthy apartment looking over a stack of bills and a notice that my GPA was too low to continue in my chosen major program.

    NOT FUNNY MAN.



  • @blakeyrat said:

    @hetas said:

    @blakeyrat said:

    .... Any software that uses ":wq" as a shortcut to ANYTHING deserves nothing but scorn.
     

    So "CTRL-S, ALT-F4" is much better then?

    Control-S is. Alt-F4 is not.

    Just because some Linux program is terrible doesn't mean the Windows shortcuts are good. Sometimes TWO things can be terrible, you know.

    Ctrl-X-S Ctrl-X-C



  • @JoeCool said:

    @blakeyrat said:
    @hetas said:

    @blakeyrat said:

    .... Any software that uses ":wq" as a shortcut to ANYTHING deserves nothing but scorn.
     

    So "CTRL-S, ALT-F4" is much better then?

    Control-S is. Alt-F4 is not.

    Just because some Linux program is terrible doesn't mean the Windows shortcuts are good. Sometimes TWO things can be terrible, you know.

    Ctrl-X-S Ctrl-X-C
    Years ago when I spent time on IRC channels, whenever someone asked how to change a setting, someone (sometimes me) would say: "Just use the short cut Alt-F4 and it will come right up".  It would be quite funny seeing 'the user has disconnect' message that would then appear.  Bonus points if they fell for it twice in a row when they got back on.


  • Yes ha ha the Mac version was while playing Warcraft II or whatever you'd say "hold down Command and type QUICK to go fast" and then they'd hit Command-Q and quit the game hilarious ha ha so funny omg



  • @mott555 said:

    Random 's' characters in the script.
    Pfff... just do a search for "s". Do I have to come up with all the solutions around here?



  • @snoofle said:

    Finally, I got fed up and decided to take a brute force approach...

    It was a royal PITA, but it worked and made my life a lot less frustrating...

    That.

    Did something similar for multitudes of *nix flavours - created a "down" script that would interrogate the OS then pass the OS-specific parameters to the shutdown command. Began creating loads of aliases so that mistyped commands performed their intention.

    BTW.. you know about the Berkeley DOS utils, right?



  • @boomzilla said:

    @hetas said:
    @blakeyrat said:
    .... Any software that uses ":wq" as a shortcut to ANYTHING deserves nothing but scorn.

    So "CTRL-S, ALT-F4" is much better then?

    What is it with you keyboard phanatiques? Just use the mouse, like God intended.

    Pfft, too slow.



  • @robbak said:

    Reminds me of the number of times I type :wq into random places.
    Random 'i's are the bane of my life. In config files. That result in the parsing library barfing on them. The library is common to all our programs, so usually ends up bricking the computer. That the config can be so brittle is probably one WTF here....



  • @PJH said:

    The library is common to all our programs, so usually ends up bricking the computer.

    I hope you meant "locking up" and not "bricking".



  • @morbiuswilters said:

    @PJH said:
    The library is common to all our programs, so usually ends up bricking the computer.

    I hope you meant "locking up" and not "bricking".

    Indeed - sloppiness on my part. But the effect is similar - it usually requires someone to go out to the unit and replace a compact flash card to rectify.



  • @PJH said:

    @morbiuswilters said:
    @PJH said:
    The library is common to all our programs, so usually ends up bricking the computer.

    I hope you meant "locking up" and not "bricking".

    Indeed - sloppiness on my part. But the effect is similar - it usually requires someone to go out to the unit and replace a compact flash card to rectify.

    Ah, wow, that's closer to bricking than I thought. I assumed you meant this was some server machine that just had to be rebooted.



  • @morbiuswilters said:

    @PJH said:
    @morbiuswilters said:
    @PJH said:
    The library is common to all our programs, so usually ends up bricking the computer.
    I hope you meant "locking up" and not "bricking".
    Indeed - sloppiness on my part. But the effect is similar - it usually requires someone to go out to the unit and replace a compact flash card to rectify.
    Ah, wow, that's closer to bricking than I thought. I assumed you meant this was some server machine that just had to be rebooted.
    Well, techincally, they are 'servers,' but they're the units we sell to customers in batches of 'lots' - most have the same config, but if we're (remotely) debugging a live problem, and the config gets changed in the process of debugging, and the config gets broken we have to wait until we can get someone physically there to 'fix' the broken config (by unbuggering the config or swapping out the CF.) (Un)fortunatly, the units are somewhat mobile, the vast majority of them being on public transport vehicles. (Nothing to do with safety or anything like that.)



    Not that this happens a lot - there are semi-written procedures to make sure you 'haven't fucked up the config' before typing 'sync; reboot; logout' and hoping and praying you can get back on there within (usually) 2 minutes. Any longer and it's an indication that a 'site visit' may be required...


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.