我有一个包装工json喜欢:
"builders": [{...}],
"provisioners": [
{
"type": "file",
"source": "packer/myfile.json",
"destination": "/tmp/myfile.json"
}
],
"variables": {
"myvariablename": "value"
}
Run Code Online (Sandbox Code Playgroud)
和myfile.json是:
{
"var" : "{{ user `myvariablename`}}"
}
Run Code Online (Sandbox Code Playgroud)
进入文件的变量确实被替换,在文件可用于此处的唯一选项后,是否使用shell provisioner进行sed替换?
使用封隔器版本0.12.0
我想创建一种方法来动态创建表,只需将表名作为变量传递即可。我已经定义了我的 xml 映射器
<mapper namespace="com.mappers.TableCreatorMapper">
<cache />
<insert id="createNewTableIfNotExists" parameterType="String" >
CREATE TABLE IF NOT EXISTS #{tableName}
(
`ID` varchar(20) NOT NULL,
PRIMARY KEY (`ID`)
)
ENGINE=InnoDB
</insert>
</mapper>
Run Code Online (Sandbox Code Playgroud)
我的 Java 接口映射器很简单:
public interface TableCreatorMapper {
public void createNewTableIfNotExists(String tableName);
}
Run Code Online (Sandbox Code Playgroud)
但是当我调用我的界面时
tableCreatorMapper.createNewTableIfNotExists("test");
Run Code Online (Sandbox Code Playgroud)
我得到以下异常:
org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 ''test'
(
`ID` varchar(20) …Run Code Online (Sandbox Code Playgroud)