Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LiquiBase : How to use <whereparams> inside an <update>?

I am looking for an example on how to use the <whereparams></whereparams> which belongs to <update></update>, but I couldn't find anything (even in the official documentation).

any help is much appreciated.thanks.

like image 457
user3488996 Avatar asked Apr 08 '14 15:04

user3488996


People also ask

How do I update Liquibase tag?

Running the update-to-tag command To run the update-to-tag command, specify the driver, classpath, and URL in the Liquibase properties file. You can also specify these properties in your command line. Note: Enter the name of the changelog and the tag that you want to use in place of communityOnly.

What is the purpose of adding changesets to your changelog?

Liquibase Concepts A change is contained in a changeset and changesets are added to the changelog in the order they need to be deployed. Simply put – a changelog contains an ordered list of changesets, and a changeset contains a change.


1 Answers

An example usage is

<update tableName="updateTest">
        <column name="varcharColumn" value="new column 1 value"/>
        <column name="dateCol" valueDate="2008-01-01"/>
        <column name="intCol" valueNumeric="11"/>
        <where>id=:value</where>
        <whereParams>
            <param valueNumeric="134" />
        </whereParams>
</update>

where the :value statements in the <where> block is replaced with the values in the `param' blocks. If there are multiple :value statements they are replaced in order within the where clause.

However, looking at the code, it looks like the usage of whereParams is not well used or integrated. Perhaps I am missing where it is being picked up, but it may not even be working outside blob/clob updating.

Give it a try and see if it works for you, otherwise I'd say stick with the standard where block until support is improved.

like image 129
Nathan Voxland Avatar answered Nov 12 '22 00:11

Nathan Voxland