diff options
| author | Marc G. Fournier | 1998-04-13 15:02:05 +0000 |
|---|---|---|
| committer | Marc G. Fournier | 1998-04-13 15:02:05 +0000 |
| commit | 0183b4605ee4ad76851cea69587d240492041705 (patch) | |
| tree | c865bd78a64f381be72b985bf0bce435d78ef46c /tuple.c | |
Replace old PostODBC driver with new one...
This one is based on an older PostODBC driver, rewritten and maintained by
InsightDist(?)
Diffstat (limited to 'tuple.c')
| -rw-r--r-- | tuple.c | 56 |
1 files changed, 56 insertions, 0 deletions
@@ -0,0 +1,56 @@ +
+/* Module: tuple.c
+ *
+ * Description: This module contains functions for setting the data for individual
+ * fields (TupleField structure) of a manual result set.
+ *
+ * Important Note: These functions are ONLY used in building manual result sets for
+ * info functions (SQLTables, SQLColumns, etc.)
+ *
+ * Classes: n/a
+ *
+ * API functions: none
+ *
+ * Comments: See "notice.txt" for copyright and license information.
+ *
+ */
+ +#include "tuple.h" +#include <string.h> +#include <stdlib.h> + +void set_tuplefield_null(TupleField *tuple_field) +{ + tuple_field->len = 0; + tuple_field->value = strdup(""); +} + +void set_tuplefield_string(TupleField *tuple_field, char *string) +{ + tuple_field->len = strlen(string); + tuple_field->value = malloc(strlen(string)+1); + strcpy(tuple_field->value, string); +} + + +void set_tuplefield_int2(TupleField *tuple_field, Int2 value) +{ +char buffer[10]; + + sprintf(buffer,"%d", value); + + tuple_field->len = strlen(buffer)+1; + /* +1 ... is this correct (better be on the save side-...) */ + tuple_field->value = strdup(buffer); +} + +void set_tuplefield_int4(TupleField *tuple_field, Int4 value) +{ +char buffer[15]; + + sprintf(buffer,"%ld", value); + + tuple_field->len = strlen(buffer)+1; + /* +1 ... is this correct (better be on the save side-...) */ + tuple_field->value = strdup(buffer); +} |
