4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef __DBUTIL_COLLATION_H__
23 #define __DBUTIL_COLLATION_H__
29 #include <db-util-common.h>
34 * These types are intended for use in the
35 * 2nd parameter to the [db_util_create_collation()] interface.
36 * The meanings of the various types is shown below.
39 * Unicode Collation Algorithm / Locale InSensitive / Accent Sensitive / Case Insensitive
40 * This type will be mostly used in 'ORDER BY' clause of sql for sorted list.
42 * [DB_UTIL_COL_LS_AS_CI]
43 * Locale Sensitive / Accent Sensitive / Case Insensitive
44 * This type will be mostly used in 'ORDER BY' clause of sql for sorted list.
46 * [DB_UTIL_COL_LS_AI_CI]
47 * Locale Sensitive / Accent Insensitive / Case Insensitive
48 * This type will be mostly used for '=' operator comparison in 'WHERE' clause.
50 * [DB_UTIL_COL_LS_AI_CI_LC]
51 * Locale Sensitive / Accent Insensitive / Loop Comparison
52 * This type will be mostly used for 'LIKE' operator comparison in 'WHERE' clause.
55 * Locale Sensitive / Korea / Initial(leading) Consonant
56 * Compares string data using initial(leading) consonant for korea locale.
57 * This type will be mostly used for '=' operator comparison in 'WHERE' clause.
59 * [DB_UTIL_COL_KR_IC_LC]
60 * Locale Sensitive / Korea / Initial(leading) Consonant / Loop Comparison
61 * Compares string data using initial(leading) consonant for korea locale.
62 * This type will be mostly used for 'LIKE' operator comparison in 'WHERE' clause.
69 DB_UTIL_COL_LS_AI_CI_LC,
72 } db_util_collate_type;
77 * These encodings are intended for use in the
78 * 3rd parameter to the [db_util_create_collation()] interface.
81 DB_UTIL_COL_UTF8 = SQLITE_UTF8,
82 DB_UTIL_COL_UTF16 = SQLITE_UTF16
83 } db_util_collate_textrep;
93 * @fn int db_util_create_collation(sqlite3 *db_handle, db_util_collate_type type, db_util_collate_textrep text_type, char* col_name);
94 * This function defines a new collating sequences with the database connection specified as the firtst argument.
95 * This function is needed to be invoked after [db_util_open()].
97 * @param[in] Db connection handle to create collation with
98 * @param[in] Collation type. This value must be one of the [db_util_collate_type]
99 * @param[in] Encoding of text passed to the collating function callback
100 * @param[in] The name of collation(UTF-8 string)
101 * return This function returns DB_UTIL_OK or error code on failure
104 * @pre Database connected
108 EXPORT_API int db_util_create_collation(
109 PARAM_IN sqlite3 *db_handle,
110 PARAM_IN db_util_collate_type type,
111 PARAM_IN db_util_collate_textrep text_type,
112 PARAM_IN char* col_name
122 #endif /* __DBUTIL_COLLATION_H__ */