⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tuple.c

📁 postgresql-odbc,跨平台应用
💻 C
字号:
/*------- * 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>voidset_tuplefield_null(TupleField *tuple_field){	tuple_field->len = 0;	tuple_field->value = NULL;	/* strdup(""); */}voidset_tuplefield_string(TupleField *tuple_field, const char *string){	if (string)	{		tuple_field->len = (Int4) strlen(string); /* PG restriction */		tuple_field->value = malloc(strlen(string) + 1);		strcpy(tuple_field->value, string);	}	else		set_tuplefield_null(tuple_field);}voidset_tuplefield_int2(TupleField *tuple_field, Int2 value){	char		buffer[10];	sprintf(buffer, "%d", value);	tuple_field->len = (Int4) (strlen(buffer) + 1);	/* +1 ... is this correct (better be on the save side-...) */	tuple_field->value = strdup(buffer);}voidset_tuplefield_int4(TupleField *tuple_field, Int4 value){	char		buffer[15];	sprintf(buffer, "%d", value);	tuple_field->len = (Int4) (strlen(buffer) + 1);	/* +1 ... is this correct (better be on the save side-...) */	tuple_field->value = strdup(buffer);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -