[{TableOfContents }]

!!! Introduction
Makumba supports mainly two query languages: the native Makumba Query Language ([MQL|QueryLanguages#MQL]) and the Hibernate Query Language ([HQL|QueryLanguages#HQL]) .

!!!MQL

MQL was developed as a sum of the most useful aspects of OQL and HQL. As such is it based on HQL in many regards (see the [reference documentation|http://www.hibernate.org/hib_docs/reference/en/html/queryhql.html]), except following:

* it accepts boolean projections: SELECT a=1 AS col1 ... etc
* selecting an object will lead in selecting the external form of its [Makumba pointer|api:Pointer]
* it works with Makumba [DataDefinitions] instead of Hibernate mappings
* like HQL, it supports subqueries in the style of e.g. [MySQL|http://dev.mysql.com/doc/refman/5.0/en/subqueries.html]
* since Makumba only has set (equivalent of Hibernate bag), some of the HQL constructs like indices() don't make sense.
* some of the HQL functions are not yet implemented (e.g. current_date())

!!MQL Functions

MQL provides support for functions that will translate into SQL functions. Currently, the following functions are supported:

!String functions
||name 	||argument(s) 	||result type 	||description
|lower 	|(str) 	|string 	|Converts the string argument to lower case
|upper 	|(str) 	|string 	|Converts the string argument to upper case
|trim 	|(str) 	|string 	|Remove leading trailing spaces.
|ltrim 	|(str) 	|string 	|Remove leading spaces.
|rtrim 	        |(str) 	|string 	|Remove trailing spaces.
|concat 	|(str1, str2, ...) 	|string 	|Concatenates two or more strings
|concat_ws 	|(separator, str1, str2, ...) 	|string 	|Concatenates two or more string with the given separator
|substring 	|(str, position [[, length]) 	|string 	|Takes a substring of the given string
|replace 	|(str, fromStr, toStr) 	|string 	|Replace occurrences of a specified string
|reverse 	|(str) 	|string 	|Returns the string str with the order of the characters reversed.
|ascii 	|(str) 	|int 	|Return numeric value of left-most character.
|character_length 	|(str) 	|int 	|Return number of characters in the string argument.
|format 	|(int) 	|string 	|Return a number formatted to specified number of decimal places

!Date functions
||name 	||argument(s) 	||result type 	||description
|dayOfMonth 	|(date) 	|int 	|Return the day of the month (0-31).
|dayOfWeek (alternatively: weekday) 	|(date) 	|int 	|Return the weekday index of the argument.
|week 	|(date) 	|int 	|Return the week number.
|dayOfYear 	|(date) 	|int 	|Return the day of the year (1-366).
|year 	|(date) 	|int 	|Return the year from the date argument.
|month 	|(date) 	|int 	|Return the month from the date argument.
|hour 	|(date) 	|int 	|Return the hour from the date argument.
|minute 	|(date) 	|int 	|Return the minute from the date argument.
|second 	|(date) 	|int 	|Return the second from the date argument.
|extract 	|(unit FROM date) 	|int 	|Extracts parts from the date. For example: SELECT EXTRACT(YEAR_MONTH FROM '2009-07-02 01:02:03'); -> 200907. \\See the [MySQL Documentation|http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_extract] for available units.
|monthName 	|(date) 	|string 	|Return the name of the month.
|dayName 	|(date) 	|string 	|Return the name of the day.
|date_add 	|(date, INTERVAL expr unit) 	|date 	|Adds expr times the unit to the date. For example: SELECT '2008-12-31 23:59:59' + INTERVAL 1 SECOND; -> '2009-01-01 00:00:00'. \\See the [MySQL Documentation|http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-add] for available units.
|date_sub 	|(date, INTERVAL expr unit) 	|date 	|Substracts expr times the unit to the date. See date_add.
|last_day 	|(date) 	|string 	|Return the name of the day.
|current_date 	|	|date 	|Return the current date.
|current_time 	|	|date 	|Return the current time.
|current_timestamp (alternatively: now) 	|	|date 	|Return the current date and time.

[{Box

Support for new functions is normally easy to add, so if you miss specific functions, please just mail the makumba developers!
}]

!!!HQL

Makumba supports HQL as a query language. Please check its [reference documentation|http://www.hibernate.orghib_docs/reference/en/html/queryhql.html].

In order to use HQL in Makumba JSPs pages, the following TLD declaration should be used: 
[{Code

<%@taglib uri="http://www.makumba.org/view-hql" prefix="mak" %>

}]


%%(display:none;)[Category Documentation]%%
