*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.kim@samsung.com>
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
#include "media-svc-util.h"
#include "media-svc-storage.h"
-int _media_svc_init_storage(sqlite3 *handle, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
- char *sql = NULL;
- sqlite3_stmt *sql_stmt = NULL;
- int storage_cnt = 0;
-
- /*Add Internal storage*/
- sql = sqlite3_mprintf("SELECT COUNT(*) FROM '%s' WHERE storage_uuid='%s' AND storage_name='%s'", MEDIA_SVC_DB_TABLE_STORAGE, MEDIA_SVC_DB_TABLE_MEDIA, MEDIA_SVC_DB_TABLE_MEDIA);
- ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
-
- storage_cnt = sqlite3_column_int(sql_stmt, 0);
- SQLITE3_FINALIZE(sql_stmt);
-
- if (storage_cnt == 0) {
- char *internal_path = _media_svc_get_path(uid);
- sql = sqlite3_mprintf("INSERT INTO %s (storage_uuid, storage_name, storage_path, storage_type) VALUES ('%s', '%s', '%s', 0);",
- MEDIA_SVC_DB_TABLE_STORAGE, MEDIA_SVC_DB_TABLE_MEDIA, MEDIA_SVC_DB_TABLE_MEDIA, internal_path);
-
- ret = _media_svc_sql_query(handle, sql, uid);
- sqlite3_free(sql);
- SAFE_FREE(internal_path);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- }
-
- return ret;
-}
-
-int _media_svc_get_mmc_info(MediaSvcHandle *handle, char **storage_name, char **storage_path, int *validity, bool *info_exist)
+int _media_svc_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity)
{
int ret = MS_MEDIA_ERR_NONE;
sqlite3_stmt *sql_stmt = NULL;
char *sql = NULL;
- sql = sqlite3_mprintf("SELECT * FROM '%s' WHERE storage_uuid=%Q AND storage_name IS NOT '%s'", MEDIA_SVC_DB_TABLE_STORAGE, MEDIA_SVC_DB_TABLE_MEDIA, MEDIA_SVC_DB_TABLE_MEDIA);
-
- ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
- if (ret != MS_MEDIA_ERR_NONE) {
- *storage_name = NULL;
- *storage_path = NULL;
- *validity = 0;
- *info_exist = FALSE;
-
- if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
- *info_exist = FALSE;
- }
-
- return ret;
- }
-
- *storage_name = g_strdup((const char *)sqlite3_column_text(sql_stmt, 1));
- *storage_path = g_strdup((const char *)sqlite3_column_text(sql_stmt, 2));
- *validity = sqlite3_column_int(sql_stmt, 6);
-
- *info_exist = TRUE;
-
- SQLITE3_FINALIZE(sql_stmt);
-
- return MS_MEDIA_ERR_NONE;
-}
-
-int _media_svc_check_storage(sqlite3 *handle, const char *storage_id, const char *storage_name, char **storage_path, int *validity)
-{
- int ret = MS_MEDIA_ERR_NONE;
- sqlite3_stmt *sql_stmt = NULL;
- char *sql = NULL;
+ media_svc_retvm_if(storage_id == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
+ media_svc_retvm_if(storage_path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_path is NULL");
+ media_svc_retvm_if(validity == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "validity is NULL");
*storage_path = NULL;
*validity = 0;
- if(storage_name != NULL)
- sql = sqlite3_mprintf("SELECT * FROM '%s' WHERE storage_uuid=%Q AND storage_name=%Q", MEDIA_SVC_DB_TABLE_STORAGE, storage_id, storage_name);
- else
- sql = sqlite3_mprintf("SELECT * FROM '%s' WHERE storage_uuid=%Q", MEDIA_SVC_DB_TABLE_STORAGE, storage_id);
-
+ sql = sqlite3_mprintf("SELECT storage_path, validity FROM %q WHERE storage_id=%Q", DB_TABLE_STORAGE, storage_id);
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
-
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- *storage_path = g_strdup((const char *)sqlite3_column_text(sql_stmt, 2));
- *validity = sqlite3_column_int(sql_stmt, 6);
+ *storage_path = g_strdup((const char *)sqlite3_column_text(sql_stmt, 0));
+ *validity = sqlite3_column_int(sql_stmt, 1);
SQLITE3_FINALIZE(sql_stmt);
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_append_storage(sqlite3 *handle, const char *storage_id, const char *storage_name, const char *storage_path, const char *storage_account, media_svc_storage_type_e storage_type, uid_t uid)
+int _media_svc_append_storage(const char *storage_id, const char *storage_path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- char *sql = sqlite3_mprintf("INSERT INTO %s (storage_uuid, storage_name, storage_path, storage_account, storage_type) values (%Q, %Q, %Q, %Q, %d); ",
- MEDIA_SVC_DB_TABLE_STORAGE, storage_id, storage_name, storage_path, storage_account, storage_type);
+ char *sql = sqlite3_mprintf("INSERT INTO %q (storage_id, storage_path) values (%Q, %Q);",
+ DB_TABLE_STORAGE, storage_id, storage_path);
- ret = _media_svc_sql_query(handle, sql, uid);
- sqlite3_free(sql);
+ ret = _media_svc_sql_query_direct(sql, uid);
+ SQLITE3_SAFE_FREE(sql);
return ret;
}
char *old_storage_path = NULL;
int validity = 0;
+ media_svc_retvm_if(storage_id == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
+ media_svc_retvm_if(path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+
/*Get old path*/
- ret = _media_svc_check_storage(handle, storage_id, NULL, &old_storage_path, &validity);
+ ret = _media_svc_check_storage(handle, storage_id, &old_storage_path, &validity);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*Storage table update*/
- sql = sqlite3_mprintf("UPDATE '%s' SET storage_path=%Q WHERE storage_uuid=%Q", MEDIA_SVC_DB_TABLE_STORAGE, path, storage_id);
- ret = _media_svc_sql_query(handle, sql, uid);
- sqlite3_free(sql);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
+ sql = sqlite3_mprintf("UPDATE %q SET storage_path=%Q WHERE storage_id=%Q", DB_TABLE_STORAGE, path, storage_id);
+ ret = _media_svc_sql_query_direct(sql, uid);
+ SQLITE3_SAFE_FREE(sql);
+ if (ret != MS_MEDIA_ERR_NONE) {
+ g_free(old_storage_path);
+ return ret;
+ }
/*Folder table update*/
- sql = sqlite3_mprintf("UPDATE '%s' SET path=REPLACE(path, %Q, %Q) WHERE storage_uuid=%Q", MEDIA_SVC_DB_TABLE_FOLDER, old_storage_path, path, storage_id);
- ret = _media_svc_sql_query(handle, sql, uid);
- sqlite3_free(sql);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
+ sql = sqlite3_mprintf("UPDATE %q SET folder_path=REPLACE(folder_path, %Q, %Q) WHERE storage_uuid=%Q", DB_TABLE_FOLDER, old_storage_path, path, storage_id);
+ ret = _media_svc_sql_query_direct(sql, uid);
+ SQLITE3_SAFE_FREE(sql);
+ if (ret != MS_MEDIA_ERR_NONE) {
+ g_free(old_storage_path);
+ return ret;
+ }
/*Media table update*/
- sql = sqlite3_mprintf("UPDATE '%s' SET path=REPLACE(path, %Q, %Q)", storage_id, old_storage_path, path);
- ret = _media_svc_sql_query(handle, sql, uid);
- sqlite3_free(sql);
+ sql = sqlite3_mprintf("UPDATE %q SET media_path=REPLACE(media_path, %Q, %Q) WHERE storage_uuid=%Q", DB_TABLE_MEDIA, old_storage_path, path, storage_id);
+ ret = _media_svc_sql_query_direct(sql, uid);
+ SQLITE3_SAFE_FREE(sql);
+ g_free(old_storage_path);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
return ret;
}
-int _media_svc_delete_storage(sqlite3 *handle, const char *storage_id, const char *storage_name, uid_t uid)
+static int __media_svc_delete_thumbnail(sqlite3 *handle)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
-
- if (storage_name != NULL)
- sql = sqlite3_mprintf("DELETE FROM '%s' WHERE storage_uuid=%Q AND storage_name=%Q", MEDIA_SVC_DB_TABLE_STORAGE, storage_id, storage_name);
- else if (storage_id != NULL)
- sql = sqlite3_mprintf("DELETE FROM '%s' WHERE storage_uuid=%Q", MEDIA_SVC_DB_TABLE_STORAGE, storage_id);
-
- ret = _media_svc_sql_query(handle, sql, uid);
- sqlite3_free(sql);
-
- return ret;
-}
-
-int _media_svc_update_storage_validity(sqlite3 *handle, const char *storage_id, int validity, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
- char *sql = NULL;
-
- if (storage_id == NULL) {
- sql = sqlite3_mprintf("UPDATE '%s' SET validity=%d WHERE storage_uuid != 'media' AND storage_type != %d", MEDIA_SVC_DB_TABLE_STORAGE, validity, MEDIA_SVC_STORAGE_CLOUD);
- } else {
- sql = sqlite3_mprintf("UPDATE '%s' SET validity=%d WHERE storage_uuid=%Q;", MEDIA_SVC_DB_TABLE_STORAGE, validity, storage_id);
- }
-
- ret = _media_svc_sql_query(handle, sql, uid);
- sqlite3_free(sql);
-
- return ret;
-}
-
-int _media_svc_get_storage_uuid(sqlite3 *handle, const char *path, char *storage_id)
-{
- int ret = MS_MEDIA_ERR_NONE;
sqlite3_stmt *sql_stmt = NULL;
- char *sql = NULL;
- char *storage_path = NULL;
- char *remain_path = NULL;
- int remain_len = 0;
-
- if(strncmp(path, MEDIA_ROOT_PATH_INTERNAL, strlen(MEDIA_ROOT_PATH_INTERNAL)) == 0)
- {
- _strncpy_safe(storage_id, MEDIA_SVC_DB_TABLE_MEDIA, MEDIA_SVC_UUID_SIZE+1);
- return MS_MEDIA_ERR_NONE;
- }
-
- sql = sqlite3_mprintf("SELECT storage_uuid, storage_path FROM '%s' WHERE validity=1", MEDIA_SVC_DB_TABLE_STORAGE);
+ sql = sqlite3_mprintf("SELECT media_thumbnail_path FROM %q WHERE validity=0 AND media_thumbnail_path is not null", DB_TABLE_MEDIA);
ret = _media_svc_sql_prepare_to_step_simple(handle, sql, &sql_stmt);
-
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- remain_path = strstr(path + (STRING_VALID(MEDIA_ROOT_PATH_USB) ? strlen(MEDIA_ROOT_PATH_USB) : 0) + 1, "/");
- if (remain_path != NULL)
- remain_len = strlen(remain_path);
-
- storage_path = strndup(path, strlen(path) - remain_len);
-
- while(sqlite3_step(sql_stmt) == SQLITE_ROW)
- {
- if(STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 1)))
- {
- if (strlen(storage_path) == strlen((const char *)sqlite3_column_text(sql_stmt, 1)))
- {
- if(strncmp(storage_path, (const char *)sqlite3_column_text(sql_stmt, 1), strlen(storage_path)) == 0)
- {
- _strncpy_safe(storage_id, (const char *)sqlite3_column_text(sql_stmt, 0), MEDIA_SVC_UUID_SIZE+1);
- break;
- }
- }
- }
-
- }
-
- SQLITE3_FINALIZE(sql_stmt);
- SAFE_FREE(storage_path);
-
- if(!STRING_VALID(storage_id))
- {
- media_svc_error("Not found valid storage id [%s]", path);
- ret = MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int _media_svc_get_storage_type(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e *storage_type)
-{
- int ret = MS_MEDIA_ERR_NONE;
- sqlite3_stmt *sql_stmt = NULL;
- char *sql = NULL;
-
- if(!STRING_VALID(storage_id))
- {
- media_svc_error("Invalid storage_idid");
- ret = MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- sql = sqlite3_mprintf("SELECT storage_type FROM '%s' WHERE (storage_uuid=%Q AND validity=1)", MEDIA_SVC_DB_TABLE_STORAGE, storage_id);
-
- ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
-
- if (ret != MS_MEDIA_ERR_NONE) {
- if(ret == MS_MEDIA_ERR_DB_NO_RECORD) {
- media_svc_debug("there is no storage.");
- }
- else {
- media_svc_error("error when _media_svc_get_storage_type. err = [%d]", ret);
- }
- return ret;
- }
-
- *storage_type = sqlite3_column_int(sql_stmt, 0);
+ while (sqlite3_step(sql_stmt) == SQLITE_ROW)
+ _media_svc_remove_file((const char *)sqlite3_column_text(sql_stmt, 0));
SQLITE3_FINALIZE(sql_stmt);
return ret;
}
-int _media_svc_get_storage_path(sqlite3 *handle, const char *storage_id, char **storage_path)
+int _media_svc_delete_invalid_storage(sqlite3 *handle, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- sqlite3_stmt *sql_stmt = NULL;
char *sql = NULL;
- if(!STRING_VALID(storage_id))
- {
- media_svc_error("Invalid storage_idid");
- ret = MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- sql = sqlite3_mprintf("SELECT storage_path FROM '%s' WHERE (storage_uuid=%Q AND validity=1)", MEDIA_SVC_DB_TABLE_STORAGE, storage_id);
-
- ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
-
- if (ret != MS_MEDIA_ERR_NONE) {
- if(ret == MS_MEDIA_ERR_DB_NO_RECORD) {
- media_svc_debug("there is no storage.");
- }
- else {
- media_svc_error("error when _media_svc_get_storage_type. err = [%d]", ret);
- }
- return ret;
- }
-
- *storage_path = g_strdup((char *)sqlite3_column_text(sql_stmt, 0));
-
- SQLITE3_FINALIZE(sql_stmt);
-
- return ret;
-}
-
-int _media_svc_get_storage_scan_status(sqlite3 *handle, const char *storage_id, media_svc_scan_status_type_e *scan_status)
-{
- int ret = MS_MEDIA_ERR_NONE;
- sqlite3_stmt *sql_stmt = NULL;
- char *sql = NULL;
-
- if(!STRING_VALID(storage_id))
- {
- media_svc_error("Invalid storage_id");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- sql = sqlite3_mprintf("SELECT scan_status FROM '%s' WHERE (storage_uuid=%Q AND validity=1)", MEDIA_SVC_DB_TABLE_STORAGE, storage_id);
-
- ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
+ ret = __media_svc_delete_thumbnail(handle);
+ media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Fail to remove thumbnail");
- if (ret != MS_MEDIA_ERR_NONE) {
- if(ret == MS_MEDIA_ERR_DB_NO_RECORD) {
- media_svc_debug("there is no storage.");
- }
- else {
- media_svc_error("error when _media_svc_get_storage_scan_status. err = [%d]", ret);
- }
- return ret;
- }
+ sql = sqlite3_mprintf("DELETE FROM %q WHERE validity=0;DELETE FROM %q WHERE validity=0;DELETE FROM %q WHERE validity=0;",
+ DB_TABLE_MEDIA, DB_TABLE_STORAGE, DB_TABLE_FOLDER);
- *scan_status = sqlite3_column_int(sql_stmt, 0);
-
- SQLITE3_FINALIZE(sql_stmt);
+ ret = _media_svc_sql_query_direct(sql, uid);
+ SQLITE3_SAFE_FREE(sql);
return ret;
}
-int _media_svc_set_storage_scan_status(sqlite3 *handle, const char *storage_id, media_svc_scan_status_type_e scan_status, uid_t uid)
+int _media_svc_update_storage_validity(const char *storage_id, int validity, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
if (storage_id == NULL) {
- sql = sqlite3_mprintf("UPDATE '%s' SET scan_status=%d WHERE storage_uuid != 'media'", MEDIA_SVC_DB_TABLE_STORAGE, scan_status);
+ sql = sqlite3_mprintf("UPDATE %q SET validity=%d;UPDATE %q SET validity=%d WHERE storage_uuid IS NOT 'media';UPDATE %q SET validity=%d WHERE storage_uuid IS NOT 'media';",
+ DB_TABLE_STORAGE, validity, DB_TABLE_FOLDER, validity, DB_TABLE_MEDIA, validity);
} else {
- sql = sqlite3_mprintf("UPDATE '%s' SET scan_status=%d WHERE storage_uuid=%Q", MEDIA_SVC_DB_TABLE_STORAGE, scan_status, storage_id);
+ sql = sqlite3_mprintf("UPDATE %q SET validity=%d WHERE storage_id=%Q;UPDATE %q SET validity=%d WHERE storage_uuid=%Q;UPDATE %q SET validity=%d WHERE storage_uuid=%Q;",
+ DB_TABLE_STORAGE, validity, storage_id, DB_TABLE_FOLDER, validity, storage_id, DB_TABLE_MEDIA, validity, storage_id);
}
-
- ret = _media_svc_sql_query(handle, sql, uid);
- sqlite3_free(sql);
+ ret = _media_svc_sql_query_direct(sql, uid);
+ SQLITE3_SAFE_FREE(sql);
return ret;
}
-static int __media_svc_count_all_storage(sqlite3 *handle, int *count)
+int _media_svc_get_storage_uuid(sqlite3 *handle, const char *path, char *storage_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
sqlite3_stmt *sql_stmt = NULL;
- char *sql = sqlite3_mprintf("SELECT count(*) FROM '%s' WHERE validity = 1", MEDIA_SVC_DB_TABLE_STORAGE);
-
- ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("error when _media_svc_sql_prepare_to_step. err = [%d]", ret);
- return ret;
- }
-
- *count = sqlite3_column_int(sql_stmt, 0);
-
- SQLITE3_FINALIZE(sql_stmt);
-
- return MS_MEDIA_ERR_NONE;
-}
-
-int _media_svc_get_all_storage(sqlite3 *handle, char ***storage_list, char ***storage_id_list, int **scan_status_list, int *count)
-{
- int ret = MS_MEDIA_ERR_NONE;
- int idx = 0;
- sqlite3_stmt *sql_stmt = NULL;
char *sql = NULL;
- int cnt =0;
+ char *internal_path = NULL;
- ret = __media_svc_count_all_storage(handle, &cnt);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("error when __media_svc_count_all_folders. err = [%d]", ret);
- return ret;
- }
+ media_svc_retvm_if(path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
- if (cnt > 0) {
- sql = sqlite3_mprintf("SELECT storage_path, storage_uuid, scan_status FROM '%s' WHERE validity = 1", MEDIA_SVC_DB_TABLE_STORAGE);
- } else {
- *storage_list = NULL;
- *scan_status_list = NULL;
+ ret = ms_user_get_internal_root_path(uid, &internal_path);
+ media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get root path");
+
+ if (STRING_VALID(internal_path) && strncmp(path, internal_path, strlen(internal_path)) == 0) {
+ SAFE_STRLCPY(storage_id, DB_TABLE_MEDIA, MEDIA_SVC_UUID_SIZE + 1);
+ g_free(internal_path);
return MS_MEDIA_ERR_NONE;
}
- *storage_list = malloc(sizeof(char *) * cnt);
- *storage_id_list = malloc(sizeof(char *) * cnt);
- *scan_status_list = malloc(sizeof(int) * cnt);
+ g_free(internal_path);
+
+ sql = sqlite3_mprintf("SELECT storage_id FROM %q WHERE validity=1 AND instr(%Q, storage_path)", DB_TABLE_STORAGE, path);
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("prepare error [%s]", sqlite3_errmsg(handle));
- SAFE_FREE(*storage_list);
- SAFE_FREE(*scan_status_list);
- return ret;
- }
+ media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- media_svc_debug("QEURY OK");
+ if (STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 0)))
+ SAFE_STRLCPY(storage_id, (const char *)sqlite3_column_text(sql_stmt, 0), MEDIA_SVC_UUID_SIZE + 1);
- while (1) {
- (*storage_list)[idx] = g_strdup((char *)sqlite3_column_text(sql_stmt, 0));
- (*storage_id_list)[idx] = g_strdup((char *)sqlite3_column_text(sql_stmt, 1));
- (*scan_status_list)[idx] = (int)sqlite3_column_int(sql_stmt, 2);
- if(sqlite3_step(sql_stmt) != SQLITE_ROW)
- break;
- idx++;
- }
+ SQLITE3_FINALIZE(sql_stmt);
- if (cnt == idx + 1) {
- *count = cnt;
- media_svc_debug("OK");
- } else {
- /* free all data */
- int i =0;
- for (i = 0; i < idx; i ++) {
- SAFE_FREE((*storage_list)[i]);
- SAFE_FREE((*storage_id_list)[i]);
- }
- SAFE_FREE(*storage_list);
- SAFE_FREE(*storage_id_list);
- SAFE_FREE(*scan_status_list);
- *count = 0;
- ret = MS_MEDIA_ERR_INTERNAL;
+ if (!STRING_VALID(storage_id)) {
+ media_svc_error("Not found valid storage id [%s]", path);
+ ret = MS_MEDIA_ERR_INVALID_PARAMETER;
}
- SQLITE3_FINALIZE(sql_stmt);
-
return ret;
}