Add string vaild function
[platform/core/multimedia/libmedia-service.git] / src / common / media-svc-db-utils.c
index ba528ab..68b73b1 100755 (executable)
@@ -55,23 +55,23 @@ static void __add_table_info(const char *name,
 {
        table_info_s *tbl = NULL;
 
-       if (!MS_STRING_VALID(name))
+       if (!name)
                return;
 
-       if (MS_STRING_VALID(trigger_name)) {
-               if(!MS_STRING_VALID(event_table) || !MS_STRING_VALID(action_table))
+       if (trigger_name) {
+               if(!event_table || !action_table)
                        return;
        }
 
        tbl = g_new0(table_info_s, 1);
 
-       if (MS_STRING_VALID(trigger_name)) {
+       if (trigger_name) {
                tbl->trigger_name = g_strdup(trigger_name);
                tbl->event_table = g_strdup(event_table);
                tbl->action_table = g_strdup(action_table);
        }
 
-       if (MS_STRING_VALID(view_name))
+       if (view_name)
                tbl->view_name = g_strdup(view_name);
 
        g_hash_table_insert(table, (gpointer)name, (gpointer)tbl);
@@ -264,7 +264,7 @@ int _media_svc_make_table_query(const char *table_name, media_svc_table_slist_e
 
                /*create trigger */
                if (col_ptr->is_trigger) {
-                       if (MS_STRING_VALID(tb->trigger_name)) {
+                       if (tb->trigger_name) {
                                if (strncmp(table_name, DB_TABLE_ALBUM, strlen(DB_TABLE_ALBUM)) == 0) {
                                        g_string_append_printf(trigger_query, DB_QUERY_TRIGGER_WITH_COUNT,
                                                                                        tb->trigger_name, tb->event_table, tb->action_table, tb->event_table,
@@ -599,7 +599,7 @@ int _media_svc_sql_prepare_to_step_simple(sqlite3 *handle, const char *sql_str,
 
        media_svc_sec_debug("Query[%s]", sql_str);
 
-       if (!MS_STRING_VALID(sql_str)) {
+       if (!STRING_VALID(sql_str)) {
                media_svc_error("invalid query");
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
@@ -634,7 +634,7 @@ int _media_svc_sql_query_list(GList **query_list, uid_t uid)
 
        for (idx = 0; idx < length; idx++) {
                sql = (char *)g_list_nth_data(*query_list, idx);
-               if (MS_STRING_VALID(sql)) {
+               if (STRING_VALID(sql)) {
                        query_len = strlen(sql);
 
                        if (query_len >= (sizeof(query_bundle) - 1)) {
@@ -658,7 +658,7 @@ int _media_svc_sql_query_list(GList **query_list, uid_t uid)
                                /* column limit = 2000 */
                        }
 
-                       SAFE_STRLCAT(query_bundle, sql, sizeof(query_bundle));
+                       g_strlcat(query_bundle, sql, sizeof(query_bundle));
                        total_len += query_len;
 
                        SQLITE3_SAFE_FREE(sql);
@@ -705,7 +705,7 @@ int _media_svc_sql_query_list_direct(GList **query_list, uid_t uid)
 
        for (idx = 0; idx < length; idx++) {
                sql = (char *)g_list_nth_data(*query_list, idx);
-               if (MS_STRING_VALID(sql)) {
+               if (STRING_VALID(sql)) {
                        ret = __media_svc_query_direct(handle, sql, uid);
                        if (ret != MS_MEDIA_ERR_NONE)
                                media_svc_debug("_media_svc_query_direct failed[%s]", sql);