xdrindex.c

Go to the documentation of this file.
00001 #include <grass/dbmi.h>
00002 #include "macros.h"
00003 
00004 db__send_index (dbIndex *index)
00005 
00006 {
00007     int i;
00008 
00009     DB_SEND_STRING (&index->indexName);
00010     DB_SEND_STRING (&index->tableName);
00011     DB_SEND_CHAR (index->unique);
00012 
00013     DB_SEND_INT (index->numColumns);
00014 
00015     for (i = 0; i < index->numColumns; i++)
00016     {
00017         DB_SEND_STRING (&index->columnNames[i]);
00018     }
00019 
00020     return DB_OK;
00021 }
00022 
00023 db__send_index_array  (dbIndex *list, int count)
00024 
00025 {
00026     int i;
00027 
00028     DB_SEND_INT (count);
00029     for (i = 0; i < count; i++)
00030     {
00031         DB_SEND_INDEX(&list[i]);
00032     }
00033     return DB_OK;
00034 }
00035 
00036 db__recv_index (dbIndex *index)
00037 
00038 {
00039     int i,ncols;
00040 
00041     db_init_index (index);
00042     DB_RECV_STRING (&index->indexName);
00043     DB_RECV_STRING (&index->tableName);
00044     DB_RECV_CHAR (&index->unique);
00045 
00046     DB_RECV_INT (&ncols);
00047 
00048     if (db_alloc_index_columns (index, ncols) != DB_OK)
00049         return db_get_error_code();
00050 
00051     for (i = 0; i < ncols; i++)
00052     {
00053         DB_RECV_STRING (&index->columnNames[i]);
00054     }
00055 
00056     return DB_OK;
00057 }
00058 
00059 db__recv_index_array  (dbIndex **list, int *count)
00060 
00061 {
00062     int i;
00063 
00064     DB_RECV_INT (count);
00065 
00066     *list = db_alloc_index_array (*count);
00067     if (*list == NULL)
00068         return db_get_error_code();
00069 
00070     for (i = 0; i < *count; i++)
00071     {
00072         DB_RECV_INDEX (&((*list)[i]));
00073     }
00074 
00075     return DB_OK;
00076 }

Generated on Sun Apr 6 17:31:38 2008 for GRASS by  doxygen 1.5.5