MySQL Forums
Forum List  »  Connector/Node.js

Re: can I use a user variable for xpath_expr
Posted by: Steffen Sens
Date: January 28, 2008 07:03AM

Hallo,

what is here the problem ???!!!


mysql> set @p_column = 'name';
Query OK, 0 rows affected (0.00 sec)

mysql> select @p_column , extractValue(@p_xml,'//dachs/host[1]/$@p_column');
ERROR 1105 (HY000): XPATH syntax error: '$@p_column'

.....but

mysql> select @p_column , extractValue(@p_xml,'//dachs/host[1]/name');
+-----------+---------------------------------------------+
| @p_column | extractValue(@p_xml,'//dachs/host[1]/name') |
+-----------+---------------------------------------------+
| name | nottuln5 |
+-----------+---------------------------------------------+
1 row in set (0.00 sec)



Or another example....

mysql> select @p_column;
+-----------+
| @p_column |
+-----------+
| name |
+-----------+
1 row in set (0.01 sec)

mysql> select extractValue(@p_xml,concat(@p_xpath,'[1]/',@p_column));
+--------------------------------------------------------+
| extractValue(@p_xml,concat(@p_xpath,'[1]/',@p_column)) |
+--------------------------------------------------------+
| |
+--------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select extractValue(@p_xml,concat(@p_xpath,'[1]/name'));
+--------------------------------------------------+
| extractValue(@p_xml,concat(@p_xpath,'[1]/name')) |
+--------------------------------------------------+
| nottuln5 |
+--------------------------------------------------+
1 row in set (0.00 sec)

mysql> select extractValue(@p_xml,concat(@p_xpath,'[1]/','name'));
+-----------------------------------------------------+
| extractValue(@p_xml,concat(@p_xpath,'[1]/','name')) |
+-----------------------------------------------------+
| |
+-----------------------------------------------------+
1 row in set (0.01 sec)




Thanks for help...
best regards
Steffen Sens



Edited 1 time(s). Last edit at 01/28/2008 07:38AM by Steffen Sens.

Options: ReplyQuote


Subject
Written By
Posted
Re: can I use a user variable for xpath_expr
January 28, 2008 07:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.