Hi
I'm
using
MySQL++
version
2.3.2
with
MS
Visual
Studio
2005
Pro,
MySQL
version
5.0,
MyISAM
database.
I'm
confused
about
how
to
use
the
mysqlpp::quote
manipulator.
The
MySQL
documentation
(
http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
)
says
about
identifiers:
1)
"Database,
table,
index,
column,
and
alias
names
are
identifiers."
2)
"An
identifier
may
be
quoted
or
unquoted."
3)
"The
identifier
quote
character
is
the
backtick
(“`”):"
I
changed
the
resetdb
example
to
use
the
table
name
"stock
0"
instead
of
"stock"
and
placed
it
in
backticks.
Like
this:
-------------------------------------------------------------------------------------------------------
mysqlpp::Query
query
=
con.query();
query
<<
"CREATE
TABLE
"
<<
"`stock
0`"
<<
"
("
<<
"
item
CHAR(20)
NOT
NULL,
"
<<
"
num
BIGINT,
"
<<
"
weight
DOUBLE,
"
<<
"
price
DOUBLE,
"
<<
"
sdate
DATE)
"
<<
"ENGINE
=
MyISAM
"
<<
"CHARACTER
SET
utf8
COLLATE
utf8_general_ci";
-------------------------------------------------------------------------------------------------------
This
works
perfectly
fine
(after
fixing
the
other
references
to
"stock"
of
course).
I
would
prefer
to
use
the
mysqlpp::quote
manipulator
like
this:
-------------------------------------------------------------------------------------------------------
mysqlpp::Query
query
=
con.query();
query
<<
"CREATE
TABLE
"
<<
mysqlpp::quote
<<
"stock
0"
<<
"
("
<<
"
item
CHAR(20)
NOT
NULL,
"
<<
"
num
BIGINT,
"
<<
"
weight
DOUBLE,
"
<<
"
price
DOUBLE,
"
<<
"
sdate
DATE)
"
<<
"ENGINE
=
MyISAM
"
<<
"CHARACTER
SET
utf8
COLLATE
utf8_general_ci";
-------------------------------------------------------------------------------------------------------
But
this
syntax
gives
a
MySQL
error.
Note
that
it
doesn't
place
backticks
around
"stock
0"
but
single
quotes.
Question:
What
am
I
doing
wrong?
Regards,
Noud
__________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com