Tip: How To Extend HSQLDB RDBMS With Java Functions �� : rdbms�� �ڹ� ������ϴ� ���, HSQLDB�� ����
HSQLDB is an unique high performing, high quality Java based relational database which can be very easily extended with simple Java static functions. , HSQLDB�� ��Ư�� �?��, ��ǰ�� ���ִ� �ڹ� ����� ����� �����ͺ��̽��� ������ �ڹ� ���� ����� ���� ���� Ȯ���մϴ�. Here we will see how you can easily extend the database capability with a real-life example. ��� �츮�� �����ͺ��̽��� Ȯ���ϴ� ����� ���� �� ���ִ� ����� ���� - ��Ȱ ��.
I wanted to do a case-insensitive LIKE comparison, specifically get rows where the column data contains the target string. ���� ��츦 �����ϰ� ���� - ��, Ư�� get ���� ������ ���Ǵ� ���ڿ��� �����ϴ� �� ������ �����մϴ�. The where clause using LIKE would be: "Column Name" LIKE 'Target String'. �� ���� ������ ����ϴ°� ��� �ִ��� : "�� �̸���"ó�� '�� ������ ���Ǵ� ���ڿ���'�մϴ�.
Unfortunately SQL LIKE is case sensitive. sqló�� ���������� ��ҹ��ڸ� �����մϴ�. A simple way to accomplish this would be write a static function to do the comparison. �̰��� ����� ���ϴ� ������ ����� ���� ����� �� �� ���մϴ�. He is the function I wrote in my Util.java file (a collection of static java utility functions) to do the comparison: �� ����� ����� ���� ���� util.java ���� (������ ���� �ڹ� ��ƿ��Ƽ �Լ�)�� �ּ��� �� :
public static boolean containsMatch(String target, String search) { ��� ���� �ο� containsmatch (���ڿ� ���, ���ڿ��� �˻�) (
return target.toLowerCase().contains(search.toLowerCase()); ��ȯ target.tolowercase (). ���ԵǾ��ֽ��ϴ� (search.tolowercase ());
} )
To use it I executed the following SQL query: ���� ������ ���� ������ ����� �� sql ���� :
select distinct "e-Biz Manager" from Sheet where "com.taragana.myexcel.Util.containsMatch"("e-Biz Manager", 'emily') ���� ���� "�̸��� - ��� ����"�� �� ������ "com.taragana.myexcel.util.containsmatch"( "�̸��� - ��� ����", '���и�')
Note that I enclosed the function invocation in double quote. ��� :�� �Լ��� ȣ� ���� ū ���ǥ �����մϴ�. The column name is enclosed in double quotes because it contains space. ���� �̸��� ���ԵǾ� �ֱ� ������ ���� ū ���ǥ�� �����ֽ��ϴ�. The actual data is enclosed in single quotes. �� ���� �����ʹ� ���� ���ǥ�� �����ֽ��ϴ�.
Also note that I can shorten the name of the function invoked with an alias statement. ���� ���� �� ���ִ� ����� ȣ���� �̸��� �����ϱ� ������ ��Ī�����մϴ�.
Isn't this simplicity defined? �̰��� �ܼ� ����? I find HSQLDB an extremely versatile database which has served me over the years, highly recommended. ����, HSQLDB �ص��� �پ��� �����ͺ��̽��� ã�Ⱑ �� �����Ұ� ���� �� �⵿��, ��� ��õ�մϴ�. And as for performance? ���� ������ ����? It beats any other database hands down including but not limited to MySQL, Oracle etc. �װ� ��Ʈ �ٸ� �����ͺ��̽��� ���� mysql ������ ���ѵ��� ������, ����Ŭ ��
Filed under �ؿ� Database �����ͺ��̽��� , Enterprise Software ���� �������� ����Ʈ��� , HSQLDB , HSQLDB , Headline News ��� ���� ���� , How To �ϴ� ����� , Java Software �ڹ� ����Ʈ���� , Programming ���α��� , RDBMS rdbms , Tech Note ��� ��� ���� | |
| |
RSS 2.0 rss 2.0 | |
Trackback Ʈ���� this Article | �� ���� |
Email this Article ���� ������ ����
You may also like to read ������ ���� ���ֽ��ϴ� |




































