简体   繁体   中英

Syntax Error in mySQL script?

So when I run this script

mysql -h $mysqlhost -u$mysqluser -p$mysqlpass --database=$mysqldatabase -se "INSERT into $mysqldatabase.$mysqltable (prodID,mergePerformed,mergeStartdate) values ($prodID,'Merge - ${FIX_VERSION} ${BRANCH_TO_MERGE} to ${PROJECT_NAME} trunk', now())";

I get this error

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Merge - ${FIX_VERSION} ${BRANCH_TO_MERGE} to ${PROJECT_NAME} trunk', now())' at line 1

Anyone have any thoughts as to why this is...it works when there aren't any variables in jenkins.

Can`t see anything wrong as it stands, as xQbert says it is most likely to be some of your variable substitution. MySQL syntax errors usually quote the text just after the error, so I would take a look at what is going into $prodID as it is the most likely culprit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM