handle.c

Go to the documentation of this file.
00001 #include <stdlib.h>
00002 #include "dbmi.h"
00003 
00010 void
00011 db_init_handle (handle)
00012     dbHandle *handle;
00013 {
00014     db_init_string (&handle->dbName);
00015     db_init_string (&handle->dbSchema);
00016 }
00017 
00024 db_set_handle (handle, dbName, dbSchema)
00025     dbHandle *handle;
00026     char *dbName;
00027     char *dbSchema;
00028 {
00029     int stat;
00030 
00031     stat = db_set_string (&handle->dbName, dbName);
00032     if (stat != DB_OK)
00033         return stat;
00034     stat = db_set_string (&handle->dbSchema, dbSchema);
00035     return stat;
00036 }
00037 
00044 char *
00045 db_get_handle_dbname(handle)
00046     dbHandle *handle;
00047 {
00048     return db_get_string (&handle->dbName);
00049 }
00050 
00057 char *
00058 db_get_handle_dbschema(handle)
00059     dbHandle *handle;
00060 {
00061     return db_get_string (&handle->dbSchema);
00062 }
00063 
00070 void
00071 db_free_handle(handle)
00072     dbHandle *handle;
00073 {
00074     db_free_string (&handle->dbName);
00075     db_free_string (&handle->dbSchema);
00076 }
00077 
00084 void
00085 db_free_handle_array (handle, count)
00086     dbHandle *handle;
00087     int count;
00088 {
00089     int i;
00090 
00091     if (handle)
00092     {
00093         for (i = 0; i < count; i++)
00094             db_free_handle(&handle[i]);
00095         free(handle);
00096     }
00097 }
00098 
00105 dbHandle *
00106 db_alloc_handle_array (count)
00107     int count;
00108 {
00109     int i;
00110     dbHandle *handle;
00111 
00112     handle = (dbHandle *) db_calloc (count, sizeof(dbHandle));
00113     if (handle)
00114         for (i = 0; i < count; i++)
00115             db_init_handle (&handle[i]);
00116     return handle;
00117 }

Generated on Wed Aug 23 17:48:32 2006 for GRASS by  doxygen 1.4.7