- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- ソース を表示
- PostgreSQL/開発/include/lib/stringinfo.h へ行く。
- 1 (2017-05-14 (日) 23:54:49)
- 2 (2017-05-14 (日) 23:59:51)
- 3 (2017-05-15 (月) 19:53:53)
- 4 (2017-05-16 (火) 00:08:52)
概要 †
- 文字列操作のための機能
定義 †
マクロ †
列挙型 †
構造体 †
stringinfo †
番号 | データ型 | フィールド | 説明 |
---|---|---|---|
1 | char* | data | 文字列データのポインタ |
2 | int | len | 文字列の長さ(\0終端) |
3 | int | maxlen | バッファ割り当ての最大長 |
4 | int | cursor | カーソル。makeStringInfoやinitStringInfoで0初期化される。 stringinfo.cルーチンの中で更新される訳ではなさそう。 |
関数 †
makeStringInfo †
appendStringInfoCharMacro(str,ch)
initStringInfo †
StringInfoData strdata; initStringInfo(&strdata); appendStringInfoCharMacro(&strdata, 'A'); elog(NOTICE, "%s", strdata.data);
resetStringInfo †
typedef StringInfoData *StringInfo;
appendStringInfo †
// 引数1: extern StringInfo makeStringInfo(void);
appendStringInfoVA †
StringInfo *strinfo = makeStringInfo();
appendStringInfoString †
// 引数1:StringInfo構造体(StringInfoDataのポインタ) extern void initStringInfo(StringInfo str);
appendStringInfoChar †
StringInfo strinfo = (StringInfo) palloc(sizeof(StringInfoData)); initStringInfo(strinfo);
appendStringInfoSpaces †
// 引数1:StringInfo構造体(StringInfoDataのポインタ) extern void resetStringInfo(StringInfo str);
appendBinaryStringInfo †
// 引数1:StringInfo構造体(StringInfoDataのポインタ) // 引数2〜:strに追加する文字列のフォーマット指定子と追加する文字列 extern void appendStringInfo(StringInfo str, const char *fmt,...) pg_attribute_printf(2, 3);
enlargeStringInfo †
StringInfo strinfo = makeStringInfo(); appendStringInfo(strinfo, "%s", "hoge"); elog(NOTICE, "%s", strinfo->data);
サンプルプログラム †
// 引数1:StringInfo構造体(StringInfoDataのポインタ) // 引数2〜:strに追加する文字列のフォーマット指定子と追加する文字列 // 引数3:追加する文字列の可変長引数 // 戻り値:=0:書き込み成功,≠0 追加に必要とされる領域サイズ extern int appendStringInfoVA(StringInfo str, const char *fmt, va_list args) pg_attribute_printf(2, 0);
参考・関連 †
- stringinfo.h - on doxygen.postgresql.org