<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.taosdata.jdbc.springbootdemo.dao.DatabaseMapper">

    <update id="createDatabase" parameterType="java.lang.String">
        create database if not exists ${dbname}
    </update>

    <update id="dropDatabase" parameterType="java.lang.String">
        DROP database if exists ${dbname}
    </update>
    
    
    <update id="creatDatabaseWithParameters" parameterType="map">
        CREATE database if not EXISTS ${dbname}
        <if test="keep != null">
            KEEP ${keep}
        </if>
        <if test="days != null">
            DAYS ${days}
        </if>
        <if test="replica != null">
            REPLICA ${replica}
        </if>
        <if test="cache != null">
            cache ${cache}
        </if>
        <if test="blocks != null">
            blocks ${blocks}
        </if>
        <if test="minrows != null">
            minrows ${minrows}
        </if>
        <if test="maxrows != null">
            maxrows ${maxrows}
        </if>
    </update>

    <update id="useDatabase" parameterType="java.lang.String">
        use ${dbname}
    </update>

</mapper>