南特:指示MySQL创建数据库和运行脚本南特、脚本、指示、数据库

2023-09-06 14:17:21 作者:小男人、有点小自恋ゞ

我如何指导南特告诉MySQL来运行特定的位置DDL脚本,然后再运行其他脚本的指示?

How do I instruct Nant to tell MySql to run ddl scripts from a particular location and then run other scripts as instructed?

谷歌让我来许多网站不幸的是不工作。 ..

Google let me to many sites which unfortunately do not work...

推荐答案

我用一个恶性脚本来重新创建存储在程序文件夹中的文件MySQL的存储过程。我南特的目标是这样的:

I use a nant script to recreate mysql stored procedures from files stored on a "procedures" folder. My Nant target looks like:

<target name="migrate-storeds" description="Creates stored procedures">
    <echo message="Creating Stored Procedures"/>
    <foreach item="File" property="filename">
    <in>
        <items>
            <include name="procedures\*.sql"></include>
        </items>
    </in>
    <do>
        <echo message="filename ${filename}"/>
        <exec program="${mysql.path}\mysql"
            workingdir="."
            failonerror="true"
            commandline='--host=${database.server} --user=${database.user} --password=${database.pwd} ${database.name} -e "source ${filename}"'/>
    </do>
    </foreach>
    <echo message="Procedures created succesfully"/>
</target>