[asterisk-commits] qwell: branch group/ast_storage r79434 - in /team/group/ast_storage: main/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Aug 14 12:20:32 CDT 2007
Author: qwell
Date: Tue Aug 14 12:20:32 2007
New Revision: 79434
URL: http://svn.digium.com/view/asterisk?view=rev&rev=79434
Log:
Make sure we use the right connection, and return if we fail.
Add dummy read/write/open/close functions for odbc.
Modified:
team/group/ast_storage/main/storage.c
team/group/ast_storage/res/res_storage_file.c
team/group/ast_storage/res/res_storage_odbc.c
Modified: team/group/ast_storage/main/storage.c
URL: http://svn.digium.com/view/asterisk/team/group/ast_storage/main/storage.c?view=diff&rev=79434&r1=79433&r2=79434
==============================================================================
--- team/group/ast_storage/main/storage.c (original)
+++ team/group/ast_storage/main/storage.c Tue Aug 14 12:20:32 2007
@@ -280,7 +280,7 @@
return RESULT_SUCCESS;
}
- if (!(e = ast_storage_request(sename, NULL)))
+ if (!(e = ast_storage_request(sename, stringp)))
ast_cli(fd, "Could not create storage engine named '%s'.\n", sename);
else {
ast_cli(fd, "File information\n");
Modified: team/group/ast_storage/res/res_storage_file.c
URL: http://svn.digium.com/view/asterisk/team/group/ast_storage/res/res_storage_file.c?view=diff&rev=79434&r1=79433&r2=79434
==============================================================================
--- team/group/ast_storage/res/res_storage_file.c (original)
+++ team/group/ast_storage/res/res_storage_file.c Tue Aug 14 12:20:32 2007
@@ -121,25 +121,28 @@
static void *se_read_file(struct ast_storage *st, struct ast_storage_fileinst *fi, size_t chunksize)
{
void *data = NULL;
- return data;
+ int res = 0;
+ res = read(fi->ent->fd, data, chunksize);
+ return res >= 0 ? data : NULL;
}
static int se_write_file(struct ast_storage *st, struct ast_storage_fileinst *fi, void *data, size_t chunksize)
{
int len = 0;
+ len = write(fi->ent->fd, data, chunksize);
return len;
}
static int se_open_file(struct ast_storage *st, struct ast_storage_fileinst *fi, int mode)
{
- fi->ent->fd = -1;
+ fi->ent->fd = open(fi->ent->name, mode);
return fi->ent->fd;
}
static int se_close_file(struct ast_storage *st, struct ast_storage_fileinst *fi)
{
- fi->ent->fd = 0;
- return 0;
+ fi->ent->fd = close(fi->ent->fd);
+ return fi->ent->fd;
}
static int se_get_file(struct ast_storage *st, const char *objectname, const char *exts, char *localfile, size_t localfilesize)
Modified: team/group/ast_storage/res/res_storage_odbc.c
URL: http://svn.digium.com/view/asterisk/team/group/ast_storage/res/res_storage_odbc.c?view=diff&rev=79434&r1=79433&r2=79434
==============================================================================
--- team/group/ast_storage/res/res_storage_odbc.c (original)
+++ team/group/ast_storage/res/res_storage_odbc.c Tue Aug 14 12:20:32 2007
@@ -157,11 +157,12 @@
return NULL;
}
- res = SQLAllocHandle(SQL_HANDLE_STMT, ost->conn, &stmt);
+ res = SQLAllocHandle(SQL_HANDLE_STMT, ost->conn->con, &stmt);
if (res != SQL_SUCCESS && res != SQL_SUCCESS_WITH_INFO) {
ast_log(LOG_ERROR, "Allocation of database handle failed.\n");
ast_odbc_release_obj(ost->conn);
free(ost);
+ return NULL;
}
/* Get the table columns */
@@ -589,6 +590,30 @@
return -1;
}
+static void *se_read_odbc(struct ast_storage *st, struct ast_storage_fileinst *fi, size_t chunksize)
+{
+ void *data = NULL;
+ return data;
+}
+
+static int se_write_odbc(struct ast_storage *st, struct ast_storage_fileinst *fi, void *data, size_t chunksize)
+{
+ int len = 0;
+ return len;
+}
+
+static int se_open_odbc(struct ast_storage *st, struct ast_storage_fileinst *fi, int mode)
+{
+ fi->ent->fd = -1;
+ return fi->ent->fd;
+}
+
+static int se_close_odbc(struct ast_storage *st, struct ast_storage_fileinst *fi)
+{
+ fi->ent->fd = -1;
+ return fi->ent->fd;
+}
+
static int se_status_odbc(struct ast_storage *st, int fd)
{
struct ast_storage_odbc *ost = (struct ast_storage_odbc *)st;
@@ -604,6 +629,10 @@
#if 0
.put = se_put_odbc,
#endif
+ .open = se_open_odbc,
+ .close = se_close_odbc,
+ .read = se_read_odbc,
+ .write = se_write_odbc,
.del = se_del_odbc,
.opendir = se_opendir_odbc,
.readdir = se_readdir_odbc,
More information about the asterisk-commits
mailing list