在MySQL中生成多行命令语句时:
即:
INCLUDE Irvine32.inc
.data
money dword 200,100,50,20,10,5,1
str1 byte "Enter the amounts for each value of money : ",0
str2 byte "The sum of your moneys are:",0
total dword 0
buffer dword 1000 dup(0),0
str3 byte "Do not enter neg number ",0
.code
main PROC
mov edx,offset str1
call writestring
call crlf
mov ecx,lengthof money
mov esi,0
mov edi,0
start1:
jmp continue
don:
push ecx
mov edx,ecx
mov edx,0
mov edx,7
sub edx,ecx
mov ecx,edx
mov edi,0
mov esi,0
start2:
mov eax,money[esi]
call writedec
mov ebx,eax
mov al,'x'
call writechar
mov eax,buffer[edi]
call writedec
call crlf
add esi,4
add edi,4
loop start2
pop ecx
continue:
;**************************************************
mov edx,0
mov eax,money[esi]
call writedec
mov ebx,eax
mov al,'x'
call writechar
call readint
;***************************************************
sub eax,0
js don
mov buffer[edi],eax
;*************************
mul ebx
add total,eax ;we add each the multiplication to total.
add esi,4 ;increases the index by 4.(because of dword type)
add edi,4
loop start1
mov edx,offset str2
call writestring
mov eax, total
call writedec
exit
main ENDP
END main
假设您在第三行,是否有任何方法可以升级到上一行进行修改?
我已经尝试使用标记功能(CTRL + M)并选择该线,然后似乎没有任何工作,直到线的末端并按下左箭头。
使用Windows 10,MySQL命令行客户端。
答案 0 :(得分:1)
MySQL具有\e
命令,您可以在自己喜欢的编辑器中编辑当前命令。因此,如果前一行有错字,可以键入\e<enter>
,编辑器将打开,并且可以解决错字。
mysql> how
-> tables\e
... in your favorite text editor, fix the query ...
-> \p
--------------
show tables;
--------------
-> ;
+---------------+
| Tables_in_foo |
+---------------+
| bar |
+---------------+
mysql>
请注意,固定命令是在命令缓冲区中,但是mysql不会重新打印缓冲区。使用\p
命令查看您的修改。
我还注意到,即使已编辑的命令包含分号,您仍然需要在命令行中添加一个以使其运行。
在Linux上,选择编辑器由$EDITOR
环境变量指定,也许Windows具有等效功能。抱歉,我目前无法在Windows上进行测试。
有关更多此类技巧,请参见mysql参考:4.5.1.2 mysql Commands。