+ retv_if(!ai, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!property, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!str, AIL_ERROR_INVALID_PARAMETER);
+
+ prop = _ail_convert_to_prop_str(property);
+
+ if (prop < E_AIL_PROP_STR_MIN || prop > E_AIL_PROP_STR_MAX)
+ return AIL_ERROR_INVALID_PARAMETER;
+
+ localname = NULL;
+
+ if (E_AIL_PROP_NAME_STR == prop) {
+ if (ai->stmt) {
+ if (db_column_str(ai->stmt, E_AIL_PROP_X_SLP_PACKAGETYPE_STR, &pkg_type) < 0)
+ return AIL_ERROR_DB_FAILED;
+ if(pkg_type && (strcasecmp(pkg_type, "tpk") ==0))
+ {
+ locale = sql_get_locale();
+ retv_if (NULL == locale, AIL_ERROR_FAIL);
+
+ if (db_column_str(ai->stmt, E_AIL_PROP_PACKAGE_STR, &pkg) < 0){
+ free(locale);
+ return AIL_ERROR_DB_FAILED;
+ }
+ if (pkg == NULL){
+ free(locale);
+ return AIL_ERROR_DB_FAILED;
+ }
+
+ locale_new = __get_app_locale_by_fallback(pkg, locale);
+ localname = (char *)appinfo_get_localname(pkg, locale_new, uid);
+ free(locale);
+ free(locale_new);
+ } else {
+ if (db_column_str(ai->stmt, SQL_LOCALNAME_IDX, &localname) < 0)
+ return AIL_ERROR_DB_FAILED;
+ }
+ } else {
+ pkg_type = ai->values[E_AIL_PROP_X_SLP_PACKAGETYPE_STR];
+ pkg = ai->values[E_AIL_PROP_PACKAGE_STR];
+ retv_if (NULL == pkg, AIL_ERROR_FAIL);
+
+ locale = sql_get_locale();
+ retv_if (NULL == locale, AIL_ERROR_FAIL);
+
+ if(pkg_type && (strcasecmp(pkg_type, "tpk") ==0))
+ {
+ locale_new = __get_app_locale_by_fallback(pkg, locale);
+ localname = (char *)appinfo_get_localname(pkg, locale_new, uid);
+ free(locale);
+ free(locale_new);
+ } else {
+ localname = (char *)appinfo_get_localname(pkg, locale, uid);
+ free(locale);
+ }
+ }
+
+ if (localname) {
+ if (!ai->stmt) {
+ if (ai->values) {
+ if (ai->values[prop])
+ free(ai->values[prop]);
+ ai->values[prop] = localname;
+ }
+ }
+ *str = localname;
+ return AIL_ERROR_OK;
+ }
+ }
+
+ if (ai->stmt) {
+ index = sql_get_app_info_idx(prop);
+ if (db_column_str(ai->stmt, index, &value) < 0){
+ return AIL_ERROR_DB_FAILED;
+ }
+ *str = value;
+ } else
+ *str = ai->values[prop];
+
+ return AIL_ERROR_OK;
+}
+
+
+EXPORT_API ail_error_e ail_close_appinfo_db(void)
+{
+ return db_close();
+}