Main Contents

Archives: July 2009

Date functions in DbUnit fixtures

general | Comments (0)

I needed some simple functions for writing integegration tests with DbUnit.
Functions like:
NOW()
addDays(NOW(),1)
So I downloaded the source code of DbUnit and added them. You can downdload the patch here, or the patched jar here.
Short Documentation
In every DateTime field in your dbunit fixture you can use the following functions:
addDays(baseDate, days), addHours(baseDate, hours),
addMinutes(baseDate, minutes) and addSeconds(baseDate, seconds)
Example 1:
<table […]

jazzanowak @ July 18, 2009

Making a full text search with MySQL

general | Comments (0)

I looked for a possiblity to add a full text search to my application without using lucene.
What I found was the FULLTEXT index of mysql.
In Detail it is described here. I provide you a short summary:
1. Create a fulltext index
ALTER TABLE entities ADD FULLTEXT KEY search_text (title);
2. Execute a select
SELECT id,title FROM entities WHERE  MATCH(title) […]

jazzanowak @ July 7, 2009


Feed