//;
바로 한글로 설명해주는 문서의 부재가 아닐까 싶네요.
주효식님과 정재익님등의 노고에도 불구.....
//;
문서들의 한글화가 postgresql이 대중화가 되는 지름길이 아닐까 싶네요.
이런 의미에서 오늘 1시간동안 허접질한 c언어 함수에 대한 설명.. //;
먼저 DB에 접근하는 함수 설명
PGconn *PQconnectdb(const char *conninfo)
데이터베이스에 새로운 연결을 만든다.
conninfo에는 host,hostaddr,port,dbname,user,password,options,tty들을 포함하고 있다.
각 항목은 "form 키워드=값"으로 설정할수 있다.
PGconn *PQsetdbLogin(const char *pghost,
const char *pgport,
const char *pgoptions,
const char *pgtty,
const char *dbName,
const char *login,
const char *pwd)
데이터베이스에 새로운 연결을 만든다.
PQconnectdb랑 같은 일을 한다.
PGconn *PQsetdb(char *pghost,
char *pgport,
char *pgoptions,
char *pgtty,
char *dbName)
데이터베이스에 새로운 연결을 만든다.
PQsetdfLogin이랑 같은 일을 한다.(macro)
PostgresPollingStatusType *PQconnectPoll(PQconn *conn)
void PQfinish(PGconn *conn)
데이터베이스와 접속을 끊는다.
void PQreset(PGconn *conn)
데이터베이스와의 접속을 재설정한다.
char *PQdb(const PGconn *conn)
conn에 연결되어있는 db의 이름을 돌려준다.
char *PQuser(const PGconn *conn)
conn에 연결되어있는 사용자의 이름을 돌려준다.
char *PQpass(const PGconn *conn)
password를 가르쳐준다.
char *PQhost(const PGconn *conn)
host명을 가르쳐준다.
char *PQport(const PGconn *conn)
port를 가르쳐준다.
char *PQtty(const PGconn *conn)
연결된 tty를 갈쳐준다.
char *PQoptions(const PGconn *conn)
옵션을 갈쳐준당.
ConnStatusType PQstatus(const PGconn *conn)
접속상황을 갈쳐준다.
다음. 쿼리수행관련 함수
PGresult *PQexec(PGconn *conn,
const char *query);
쿼리를 실행하고 결과를 기다린다.(결과나올때까지)
int PQsendQuery(PGconn *conn, const char *query);
쿼리를 날리고 결과를 안기다린다. //;
성공적으로 수행했다면 PQgetRusult를 실행해서 쿼리결과를 알아온다.
PQgetRusult이 NULL을 리턴하지 않는 한 같은 명령을 두번 날리지마라.
PGresult *PQgetResult(PGconn *conn)
PQsendQuery에 의한 결과를 기다리고 리턴한다.
쿼리가 완료되었고 결과가 더 없으면 NULL을 리턴한다.
int PQisBusy(PGconn *conn)
쿼리가 실행중인지 확인한다. 1이면 실행중 0이면 PQgetResult를 쓸수 있다.
ExecStatusType PQresultStatus(const PGresult *res)
쿼리의 마지막 상황을 알려준다.
PGRES_EMPTY_QUERY
PGRES_COMMAND_OK
PGRES_TUPLES_OK
PGRES_COPY_OUT
PGRES_COPY_IN
PGRES_BAD_RESPONSE
PGRES_NONFATAL_ERROR
PGRES_FATAL_ERROR
char *PQresStatus(ExecStatusType status)
PQresultStatus에서 나온 에러코드를 문자열로 바꿔준다. /1이면 없는거다.
char *PQresultErrorMessage(const PGresult *res)
쿼리에서 나온 에러코드를 문자열로 바꿔준다.
int PQfnumber(const PGresult *res, const char *field_name)
field_name에 해당되는 필드번호를 리턴한다.
char *PQfname(const PGresult *res, int field_index)
field_index 번호에 해당되는 필드명을 리턴한다.
int PQbinaryTuples(const PGresult *res)
보기가 2진코드면 1을 리턴하고 2진코드가 아니면 0을 리턴한다.
int PQnfields(const PGresult *res)
쿼리결과의 보기의 필드숫자를 알려준다.
int PQntuples(const PGresult *res)
쿼리결과의 보기(tuples)의 갯수를 정수로 알려준다.
Oid PQftype(const PGresult *res, int field_num)
field_num에 있는 필드의 type을 리턴한다. oid는 src/include/catalog/pg_type.h에
명시되어있다.(데이터베이스마다 틀리다.)
int PQfsize(const PGresult *res, int field_index)
field_index에 있는 필드의 사이즈를 byte단위로 리턴한다.
int PQfmod(const PGresult *res, int field_index)
field_index에 있는 //뭐라고?//
char* PQgetvalue(const PGresult *res, int tup_num, int field_num)
PGresult의 보기값의 단일필드의 속성값을 리턴한다.(문자열로?)
int PQgetlength(const PGresult *res, int tup_num, int field_num)
필드의 길이를 byte단위로 리턴한다.
int PQgetisnull(const PGresult *res, int tup_num, int field_num)
NULL인지 확인한다. NULL이면 1을 리턴한다.
char * PQcmdStatus(const PGresult *res)
PGresult에의해 만들어진 SQL명령의 상황을 리턴한다.(문자열로)
char * PQcmdTuples(const PGresult *res)
SQL명령에 의해 적용된 결과의 줄을 리턴한다(?)
Oid PQoidValue(const PGresult *res)
삽입된 보기의 오브젝트ID를 리턴한다.
char * PQoidStatus(const PGresult *res)
삽입된 보기의 오브젝트ID와 문자열을 리턴한다.
void PQclear(PQresult *res)
PGresult에 의해 만들어진 저장공간을 해제한다.
PGresult* PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
뭐냐 이건..
겔겔.. 사전 찾아봐야겠다. 내가 아는 영단어의 수준이 겨우
이런 것이었단 말인가?
수고욥~
|