xdrtable.c

Go to the documentation of this file.
00001 #include <grass/dbmi.h>
00002 #include "macros.h"
00003 
00004 db__send_table_definition (dbTable *table)
00005 
00006 {
00007     int i;
00008 
00009     DB_SEND_INT (table->numColumns);
00010 
00011     for (i = 0; i < table->numColumns; i++)
00012     {
00013         DB_SEND_COLUMN_DEFINITION (&table->columns[i]);
00014     }
00015     DB_SEND_STRING (&table->tableName);
00016     DB_SEND_STRING (&table->description);
00017 
00018     DB_SEND_INT (table->priv_insert);
00019     DB_SEND_INT (table->priv_delete);
00020 
00021     return DB_OK;
00022 }
00023 
00024 db__recv_table_definition (dbTable **table)
00025 
00026 {
00027     int i,ncols;
00028     dbTable *t;
00029 
00030     DB_RECV_INT (&ncols);
00031 
00032     *table = t = db_alloc_table (ncols);
00033     if (t == NULL)
00034         return db_get_error_code();
00035 
00036     for (i = 0; i < t->numColumns; i++)
00037     {
00038         DB_RECV_COLUMN_DEFINITION (&t->columns[i]);
00039     }
00040     DB_RECV_STRING (&t->tableName);
00041     DB_RECV_STRING (&t->description);
00042 
00043     DB_RECV_INT (&t->priv_insert);
00044     DB_RECV_INT (&t->priv_delete);
00045 
00046     return DB_OK;
00047 }
00048 
00049 db__send_table_data (dbTable *table)
00050 
00051 {
00052     int i,ncols;
00053 
00054     ncols = table->numColumns;
00055     DB_SEND_INT (ncols);
00056     for (i = 0; i < ncols; i++)
00057     {
00058         DB_SEND_COLUMN_VALUE (db_get_table_column(table,i));
00059     }
00060 
00061     return DB_OK;
00062 }
00063 
00064 db__recv_table_data (dbTable *table)
00065 
00066 {
00067     int i,ncols;
00068 
00069     ncols = table->numColumns;
00070     DB_RECV_INT (&i);
00071 
00072     if (i != ncols)
00073     {
00074         db_error ("fetch: table has wrong number of columns");
00075         return DB_FAILED;
00076     }
00077     for (i = 0; i < ncols; i++)
00078     {
00079         DB_RECV_COLUMN_VALUE (db_get_table_column(table,i));
00080     }
00081 
00082     return DB_OK;
00083 }

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