Ask HN: How do you store your external SQL statements?

4 points by wilsonfiifi ↗ HN
I was wondering what file format is considered appropriate for storing SQL statements outside of one's source code. I was considering XML (in CDATA tag). Any thoughts?

4 comments

[ 3.4 ms ] story [ 22.1 ms ] thread
How about .sql files?
This.

Remember, SQL statements are source code.

I imagine the problem is with assigning names to them.

Usually I've seen people keeping them in hibernate xml with named queries, or some proprietrary .xml files.

CDATA is overkill IMHO, easier to escape the few problematic characters.

Nice becuase you can get SQL syntax highlighting.