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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
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
Show 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}.
@cindex comments, starting
@cindex starting, comments
Some other SQL databases use @samp{--} to start comments. MySQL
has @samp{#} as the start comment character, even if the @code{mysql}
command-line tool removes all lines that start with @samp{--}.
You can also use the C comment style @code{/* this is a comment */} with
MySQL.
Some other SQL databases use @samp{--} to start comments.
MySQL has @samp{#} as the start comment character. You can also use
the C comment style @code{/* this is a comment */} with MySQL.
@xref{Comments}.
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
degenerate comment style has caused many problems with automatically
generated SQL queries that have used something like the following code,
w
here w
e automatically insert the value of the payment for
MySQL Version 3.23.3 and above supports the @samp{--} comment style
,
provided
the comment is followed by a space. This is because this
comment style has caused many problems with automatically generated
SQL queries that have used something like the following code, where
we automatically insert the value of the payment for
@code{!payment!}:
@example
UPDATE tbl_name SET credit=credit-!payment!
@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
@samp{--} means start comment
.
Another safe feature is that the @code{mysql} command-line clien
t
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
version earlier than Version 3.2
3:
The following
information is only relevant if you are running a
MySQL version earlier than Version 3.23.
3:
If you have a SQL program in a text file that contains @samp{--}
comments
you should use:
If you have a SQL program in a text file that contains @samp{--}
comments
you should use:
@example
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