Professional Web Applications Themes

Can you do this in MySQL 4.1 scripting? - MySQL

Is it possible to catch an error in 4.1 scripting? I have found that whan I run a script and a line of the script cannot find a table - instead of halting the script continues to run. Is there anyway to get MySQL to halt the running of a script if an error occurs in one line? It's a little like the whole system is running with the VB 'on error resume next' running all of the time. Thank you for your help....

  1. #1

    Default Can you do this in MySQL 4.1 scripting?

    Is it possible to catch an error in 4.1 scripting? I have found that whan I
    run a script and a line of the script cannot find a table - instead of
    halting
    the script continues to run.

    Is there anyway to get MySQL to halt the running of a script if an error
    occurs in one line?

    It's a little like the whole system is running with the VB 'on error resume
    next' running all of the time.

    Thank you for your help.


    Sam Guest

  2. #2

    Default Re: Can you do this in MySQL 4.1 scripting?

    > Is it possible to catch an error in 4.1 scripting? I have found that whan I 

    Funny question. MySQL does not support multiple queries, so the only one
    that is aborted is all there is to abort. If you keep sending it queries
    without checking for errors, you specifically _ask_ it to ignore the
    errors. The aborted query is aborted as a whole. Every query is an
    all-or-nothing command.

    If you mean running a file in the mysql command-line client, it should
    not continue unless you specify the --force option.

    Best regards
    --
    Willem Bogaerts

    Application smith
    Kratz B.V.
    http://www.kratz.nl/
    Willem Guest

  3. #3

    Default Re: Can you do this in MySQL 4.1 scripting?

    "Willem Bogaerts" <maardanzonderditstuk.nl> wrote in
    message news:45b76d23$0$328$xs4all.nl... 
    >
    > Funny question. MySQL does not support multiple queries, so the only one[/ref]

    Not really. If I have a multiple list of commands in a script and one of
    those lines errors (perhaps the table doesn't exist etc.) then I would
    expect the whole script to stop running. It doesn't do this - it carries on
    regardless.

    Sort of basic expectation of what a set of code should do really.

    ---
    Sam


    Sam Guest

  4. #4

    Default Re: Can you do this in MySQL 4.1 scripting?

    On Wed, 14 Feb 2007 11:19:37 -0000, Sam Smith wrote: 
    >>
    >> Funny question. MySQL does not support multiple queries, so the only one[/ref]
    >
    > Not really. If I have a multiple list of commands in a script and one of
    > those lines errors (perhaps the table doesn't exist etc.) then I would
    > expect the whole script to stop running. It doesn't do this - it carries on
    > regardless.
    >
    > Sort of basic expectation of what a set of code should do really.[/ref]

    But mostly mysql "script" are (effectively) typed commands from a
    redirected standard input, using the same CLI as is used for a great
    many other things. Stopping would require writing at least a gizmo that
    sat between the redirect and watched for errors and threw away the rest
    of the input after parsing an error response back from the CLI, OR
    chaning the CLI so that it seizes up after the first error, which would
    be inconvenient for interactive operation.

    Basically, the CLI isn't *wrong*, it's just not doing what you'd like it
    to do. So write a pr in expect, perl or php, or whatever language
    you like, and watch for errors. It's not that tricky.

    --
    Judging by this particular thread, many people in this group spent their
    school years taking illogical, pointless orders from morons and having
    their will to live systematically crushed. And people say school doesn't
    prepare kids for the real world. -- Rayner, in the Monastery
    Peter Guest

Similar Threads

  1. Replies: 2
    Last Post: February 14th, 10:54 AM
  2. Replies: 0
    Last Post: January 29th, 02:03 PM
  3. LRP scripting
    By Raúl Alexis Betancort Santana in forum Debian
    Replies: 0
    Last Post: July 15th, 12:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139