Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
1928cae1
Commit
1928cae1
authored
Oct 26, 2001
by
Administrator@co3064164-a.rochd1.qld.optushome.com.au
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixup of lingo (PR clean) in "-- as the start of a comment" text.
parent
21cae009
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
Docs/manual.texi
Docs/manual.texi
+20
-19
No files found.
Docs/manual.texi
View file @
1928cae1
...
@@ -4025,37 +4025,38 @@ system. @xref{Privilege system}.
...
@@ -4025,37 +4025,38 @@ system. @xref{Privilege system}.
@cindex comments, starting
@cindex comments, starting
@cindex starting, comments
@cindex starting, comments
Some other SQL databases use @samp{--} to start comments. MySQL
Some other SQL databases use @samp{--} to start comments.
has @samp{#} as the start comment character, even if the @code{mysql}
MySQL has @samp{#} as the start comment character. You can also use
command-line tool removes all lines that start with @samp{--}.
the C comment style @code{/* this is a comment */} with MySQL.
You can also use the C comment style @code{/* this is a comment */} with
MySQL.
@xref{Comments}.
@xref{Comments}.
MySQL Version 3.23.3 and above supports the @samp{--} comment style
MySQL Version 3.23.3 and above supports the @samp{--} comment style
,
only if
the comment is followed by a space. This is because this
provided
the comment is followed by a space. This is because this
degenerate comment style has caused many problems with automatically
comment style has caused many problems with automatically generated
generated SQL queries that have used something like the following code,
SQL queries that have used something like the following code, where
w
here w
e automatically insert the value of the payment for
we automatically insert the value of the payment for
@code{!payment!}:
@code{!payment!}:
@example
@example
UPDATE tbl_name SET credit=credit-!payment!
UPDATE tbl_name SET credit=credit-!payment!
@end example
@end example
What do you think will happen when the value of @code{payment} is negative?
Think about what happens if the value of @code{payment} is negative?
Because @code{1--1} is legal in SQL, the consequences of allowing
comments to start with @samp{--} are terrible.
Using our implementation of this method of commenting in MySQL
Version 3.23.3 and up, @code{1-- This is a comment} is actually safe.
Because @code{1--1} is legal in SQL, we think it is terrible tha
t
Another safe feature is that the @code{mysql} command-line clien
t
@samp{--} means start comment
.
removes all lines that start with @samp{--}
.
In MySQL Version 3.23 you can, however, use:
@code{1-- This is a comment}
The following
discussion only concerns you if you are running a MySQL
The following
information is only relevant if you are running a
version earlier than Version 3.2
3:
MySQL version earlier than Version 3.23.
3:
If you have a SQL program in a text file that contains @samp{--}
comments
If you have a SQL program in a text file that contains @samp{--}
you should use:
comments
you should use:
@example
@example
shell> replace " --" " #" < text-file-with-funny-comments.sql \
shell> replace " --" " #" < text-file-with-funny-comments.sql \
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment