1.13.2 Solution Use mysql’s built-in query editor. 1.13.3
1.13.2 Solution Use mysql’s built-in query editor. 1.13.3 Discussion If you issue a long query only to find that it contains a syntax error, what should you do? Type in the entire corrected query from scratch? No need. mysql maintains a statement history and supports input-line editing. This allows you to recall queries so that you can modify and reissue them easily. There are many, many editing functions, but most people tend to use a small set of commands for the majority of their editing.[3] A basic set of useful commands is shown in the following table. Typically, you use Up Arrow to recall the previous line, Left Arrow and Right Arrow to move around within the line, and Backspace or Delete to erase characters. To add new characters to the line, just move the cursor to the appropriate spot and type them in. When you’re done editing, press Return to issue the query (the cursor need not be at the end of the line when you do this). [3] The input-line editing capabilities in mysql are based on the GNU Readline library. You can read the documentation for this library to find out more about the many editing functions that are available. For more information, check the Bash manual, available online at http://www.gnu.org/manual/. Editing Key Effect of Key Up Arrow Scroll up through statement history Down Arrow Scroll down through statement history Left Arrow Move left within line Right Arrow Move right within line Ctrl-A Move to beginning of line Ctrl-E Move to end of line Backspace Delete previous character Ctrl-D Delete character under cursor Input-line editing is useful for more than just fixing mistakes. You can use it to try out variant forms of a query without retyping the entire thing each time. It’s also handy for entering a series of similar statements. For example, if you wanted to use the query history to issue the series of INSERT statements shown earlier in Recipe 1.3 to create the limbs table, first enter the initial INSERT statement. Then, to issue each successive statement, press the Up Arrow key to recall the previous statement with the cursor at the end, backspace back through the column values to erase them, enter the new values, and press Return. To recall a statement that was entered on multiple lines, the editing procedure is a little trickier than for single-line statements. In this case, you must recall and reenter each successive line of the query in order. For example, if you’ve entered a two-line query that contains a mistake, press Up Arrow twice to recall the first line. Make any modifications
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP Web Hosting services