ExecStatusType PgConnection::Exec(const char* query)·µ»Ø²éѯµÄ½á¹û¡£¿ÉÄܵÄ״̬½á¹û¿ÉÒÔÊÇÏÂÃæµÄÖµ£º
PGRES_EMPTY_QUERY |
PGRES_COMMAND_OK£¬Èç¹û²éѯÊÇÒ»ÌõÃüÁî |
PGRES_TUPLES_OK£¬Èç¹û²éѯ³É¹¦·µ»Ø¼Ç¼ |
PGRES_COPY_OUT |
PGRES_COPY_IN |
PGRES_BAD_RESPONSE£¬ÈçÊÕµ½Ò»¸öδ֪µÄÏìÓ¦ |
PGRES_NONFATAL_ERROR |
PGRES_FATAL_ERROR |
ExecCommandOk Ïòºó¶Ë·þÎñÆ÷·¢ËÍÒ»ÌõÃüÁî²éѯ¡£
int PgConnection::ExecCommandOk(const char *query)Èç¹ûÃüÁî²éѯ³É¹¦·µ»Ø TRUE¡£
ExecTuplesOk Ïòºó¶Ë·þÎñÆ÷·¢ËÍÒ»ÌõÃüÁî²éѯ¡£
int PgConnection::ExecTuplesOk(const char *query)Èç¹ûÃüÁî²éѯ³É¹¦·µ»Ø TRUE¡£
ErrorMessage ·µ»Ø×îºóÒ»Ìõ´íÎóÐÅÏ¢Îı¾¡£
const char *PgConnection::ErrorMessage()Tuples ·µ»Ø²éѯ½á¹ûÀï¼Ç¼£¨ÊµÀý£©µÄÌõÊý¡£
int PgDatabase::Tuples()CmdTuples ·µ»ØÔÚÒ»´Î INSERT£¬UPDATE »ò DELETE ºóÉæ¼°µÄÐÐÊý£®Èç¹ûÊÇÆäËûÃüÁ·µ»Ø -1£®
int PgDatabase::CmdTuples()Fields ·µ»Ø²éѯ½á¹ûÀïÿÌõ¼Ç¼µÄÊý¾ÝÓò£¨×ֶΣ©Êý¡£
int PgDatabase::Fields()FieldName ·µ»ØÓëÖ¸¶¨ÓòË÷ÒýÏàÁªµÄÓò£¨×ֶΣ©Ãû³Æ¡£ÓòË÷Òý´Ó 0 ¿ªÊ¼¼ÆÊý¡£
const char *PgDatabase::FieldName(int field_num)FieldNum ·µ»ØÓëÖ¸¶¨Óò£¨×ֶΣ©Ãû³ÆÏàÁªµÄÓòË÷Òý¡£
int PgDatabase::FieldNum(const char* field_name)Èç¹û¸ø³öµÄÃû³ÆÎÞ·¨ÓëÈκÎÓòÆ¥Åä·µ»Ø -1¡£
FieldType ·µ»ØÓë¸ø³öÓòË÷ÒýÏàÁªµÄÓòµÄÀàÐÍ¡£·µ»ØµÄÕûÊýÊǸÃÀàÐ͵ÄÄÚ²¿±àÂë¡£ÓòË÷Òý´Ó 0 ¿ªÊ¼¼ÆÊý¡£
Oid PgDatabase::FieldType(int field_num)FieldType ·µ»ØÓë¸ø³öÓòÃû³ÆÏàÁªµÄÓòµÄÀàÐÍ¡£·µ»ØµÄÕûÊýÊǸÃÀàÐ͵ÄÄÚ²¿±àÂë¡£ÓòË÷Òý´Ó 0 ¿ªÊ¼¼ÆÊý¡£
Oid PgDatabase::FieldType(const char* field_name)FieldSize ·µ»ØÓë¸ø³öÓòË÷ÒýÏàÁªµÄÓòµÄÒÔ×Ö½Ú¼ÆËãµÄ³ß´ç¡£ÓòË÷Òý´Ó 0 ¿ªÊ¼¼ÆÊý¡£
short PgDatabase::FieldSize(int field_num)·µ»ØÔÚÊý¾Ý¿â¼Ç¼ÀïÃæ¸ø¸ÃÊý¾ÝÓò·ÖÅäµÄ¿Õ¼ä£¬»»¾ä»°Ëµ¾ÍÊǸÃÊý¾ÝÀàÐÍÔÚ·þÎñÆ÷ÀïµÄ¶þ½øÖÆÐÎʽµÄ´óС£¨³ß´ç£©£®Èç¹û¸ÃÊý¾ÝÓòÊǿɱä³ß´ç£¬·µ»Ø -1£®
FieldSize ·µ»ØÓë¸ø³öÓòÃû³ÆÏàÁªµÄÓòµÄÒÔ×Ö½Ú¼ÆËãµÄ³ß´ç¡£ÓòË÷Òý´Ó 0 ¿ªÊ¼¼ÆÊý¡£
short PgDatabase::FieldSize(const char *field_name)·µ»ØÔÚÊý¾Ý¿â¼Ç¼ÀïÃæ¸ø¸ÃÊý¾ÝÓò·ÖÅäµÄ¿Õ¼ä£¬»»¾ä»°Ëµ¾ÍÊǸÃÊý¾ÝÀàÐÍÔÚ·þÎñÆ÷ÀïµÄ¶þ½øÖÆÐÎʽµÄ´óС£¨³ß´ç£©£®Èç¹û¸ÃÊý¾ÝÓòÊǿɱä³ß´ç£¬·µ»Ø -1£®
GetValue ·µ»ØÒ»¸ö PGresult ÀïÃæµÄÒ»Ìõ¼Ç¼µÄµ¥¶ÀµÄÒ»¸öÊý¾ÝÓò£¨×ֶΣ©µÄÖµ£®¼Ç¼ºÍÊý¾ÝÓòË÷Òý´Ó 0 ¿ªÊ¼£®
const char *PgDatabase::GetValue(int tup_num, int field_num)¶Ô´ó¶àÊý²éѯ¶øÑÔ£¬GetValue ·µ»ØµÄÖµÊÇÒ»¸ö±íʾ×Ö¶ÎÖµµÄ¿Õ£¨NULL£©½áβµÄ ASCII ×Ö·û´®£®µ«ÊÇÈç¹û BinaryTuples() Ϊ TRUE£¬ GetValue ·µ»ØµÄÖµ¾ÍÊǸÃÀàÐÍÔÚºó¶Ë·þÎñÆ÷ÄÚ²¿µÄ¶þ½øÖƱíÏÖÐÎʽ£¨µ«ÊDz»°üÀ¨³ß´ç×Ö££Èç¹ûÊý¾ÝÓòÊDZ䳤µÄ£©£®ÕâÑù£¬°ÑÊý¾Ýת»»³É¶ÔÓ¦µÄ C ÀàÐ;ÍÊdzÌÐòÔ±µÄÔðÈÎÁË£® GetValue ·µ»ØµÄÖ¸ÕëÖ¸ÏòÒ»¸ö±¾ÉíÊÇ PGresult ½á¹¹µÄÒ»²¿·ÖµÄ´æ´¢ÇøÓò£®ÎÒÃDz»Äܸü¸ÄËü£¬²¢ÇÒÈç¹ûÎÒÃÇÒªÔÚ PGresult ½á¹¹µÄÉú´æÆÚºó»¹ÒªÊ¹ÓÃËüµÄ»°£¬ÎÒÃDZØÐëÏÔʽµÄ°Ñ¸ÃÊýÖµ¿½±´µ½ÆäËû´æ´¢Æ÷ÖУ®BinaryTuples() »¹Ã»ÓÐʵÏÖ¡£
GetValue ·µ»ØÒ»¸ö PGresult ÀïÃæµÄÒ»Ìõ¼Ç¼µÄµ¥¶ÀµÄÒ»¸öÊý¾ÝÓò£¨×ֶΣ©µÄÖµ£®¼Ç¼ºÍÊý¾ÝÓòË÷Òý´Ó 0 ¿ªÊ¼£®
const char *PgDatabase::GetValue(int tup_num, const char *field_name)¶Ô´ó¶àÊý²éѯ¶øÑÔ£¬GetValue ·µ»ØµÄÖµÊÇÒ»¸ö±íʾ×Ö¶ÎÖµµÄ¿Õ£¨NULL£©½áβµÄ ASCII ×Ö·û´®£®µ«ÊÇÈç¹û BinaryTuples() Ϊ TRUE£¬ GetValue ·µ»ØµÄÖµ¾ÍÊǸÃÀàÐÍÔÚºó¶Ë·þÎñÆ÷ÄÚ²¿µÄ¶þ½øÖƱíÏÖÐÎʽ£¨µ«ÊDz»°üÀ¨³ß´ç×Ö££Èç¹ûÊý¾ÝÓòÊDZ䳤µÄ£©£®ÕâÑù£¬°ÑÊý¾Ýת»»³É¶ÔÓ¦µÄ C ÀàÐ;ÍÊdzÌÐòÔ±µÄÔðÈÎÁË£® GetValue ·µ»ØµÄÖ¸ÕëÖ¸ÏòÒ»¸ö±¾ÉíÊÇ PGresult ½á¹¹µÄÒ»²¿·ÖµÄ´æ´¢ÇøÓò£®ÎÒÃDz»Äܸü¸ÄËü£¬²¢ÇÒÈç¹ûÎÒÃÇÒªÔÚ PGresult ½á¹¹µÄÉú´æÆÚºó»¹ÒªÊ¹ÓÃËüµÄ»°£¬ÎÒÃDZØÐëÏÔʽµÄ°Ñ¸ÃÊýÖµ¿½±´µ½ÆäËû´æ´¢Æ÷ÖУ®BinaryTuples() »¹Ã»ÓÐʵÏÖ¡£
GetLength ·µ»ØÒÔ×ֽڼƵÄÊý¾ÝÓò£¨×ֶΣ©µÄ³¤¶È£®¼Ç¼ºÍÊý¾ÝÓòË÷Òý´Ó 0 ¿ªÊ¼£®
int PgDatabase::GetLength(int tup_num, int field_num)ÕâÊÇijһÌض¨Êý¾ÝÖµµÄʵ¼ÊÊý¾Ý³¤¶È£¬Ò²¾ÍÊÇÓÉ GetValue Ö¸ÏòµÄ¶ÔÏóµÄ³ß´ç£®×¢Ò⣬¶ÔÓÚ ASCII ´ú±íµÄÊýÖµ£¬Õâ¸ö³ß´çÓë PQfsize ±¨¸æµÄ¶þ½øÖƳߴçÎ޹أ®
GetLength ·µ»ØÒÔ×ֽڼƵÄÊý¾ÝÓò£¨×ֶΣ©µÄ³¤¶È£®¼Ç¼ºÍÊý¾ÝÓòË÷Òý´Ó 0 ¿ªÊ¼£®
int PgDatabase::GetLength(int tup_num, const char* field_name)ÕâÊÇijһÌض¨Êý¾ÝÖµµÄʵ¼ÊÊý¾Ý³¤¶È£¬Ò²¾ÍÊÇÓÉ GetValue Ö¸ÏòµÄ¶ÔÏóµÄ³ß´ç£®×¢Ò⣬¶ÔÓÚ ASCII ´ú±íµÄÊýÖµ£¬Õâ¸ö³ß´çÓë PQfsize ±¨¸æµÄ¶þ½øÖƳߴçÎ޹أ®
DisplayTuples ÏòÖ¸¶¨Êä³öÁ÷´òÓ¡ËùÓмǼºÍ£¨¿ÉÑ¡µÄ£©×Ö¶ÎÃû¡£
void PgDatabase::DisplayTuples(FILE *out = 0, int fillAlign = 1, const char* fieldSep = "|",int printHeader = 1, int quiet = 0)PrintTuples ÏòÖ¸¶¨Êä³öÁ÷´òÓ¡ËùÓмǼºÍ£¨¿ÉÑ¡µÄ£©×Ö¶ÎÃû¡£
void PgDatabase::PrintTuples(FILE *out = 0, int printAttName = 1, int terseOutput = 0, int width = 0)GetLine
int PgDatabase::GetLine(char* string, int length)PutLine
void PgDatabase::PutLine(const char* string)OidStatus
const char *PgDatabase::OidStatus()EndCopy
int PgDatabase::EndCopy()