PostgreSQL 8.0.0 �����ĵ���PostgreSQL �й� ������ | ||||
---|---|---|---|---|
Prev | Fast Backward | Chapter 27. libpq - C �� | Fast Forward | Next |
һ���ͻ���Ӧ�ÿ���ʹ�ñ��������ĺ�����Ҫ��ȡ��һ�����ڱ���������������
����һ�����ݽṹ��������ݽṹ����ͨ���ض����ݿ�����ȡ��һ����������Ҫ����Ϣ��
PGcancel *PQgetCancel(PGconn *conn);
����һ�� PGconn ���Ӷ���PQgetCancel ����һ�� PGcancel ���� ��������� conn �� NULL ������һ����Ч�����ӣ���ô�������� NULL�� PGcancel ������һ�������Ľṹ����Ӧ��ΪӦ����ֱ�ӷ��ʣ� ����ֻ�ܰ������ݸ� PQcancel ���� PQfreeCancel��
�ͷ� PQgetCancel ���������ݽṹ��
void PQfreeCancel(PGcancel *cancel);
PQfreeCancel �ͷ�һ����ǰ��� PQgetCancel ���������ݶ���
Ҫ���������������ǰ���
int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize);
���ȡ������ɹ����ͣ���ֵΪ 1������Ϊ 0��������ɹ��� �� errbuf ��������һЩ������Ϣ������Ϊ�β��ɹ��� errbuf ������һ����СΪ errbufsize �� char ���� �������СΪ 256 �ֽڣ���
�������ɹ�����ȡ��������֤��������κ�Ч���� ���ȡ����Ч����ô��ǰ�������ǰ�������ҷ���һ������Ľ���� ���ȡ��ʧ�ܣ�Ҳ����˵����Ϊ�������Ѿ��������Ĵ�������ô���������пɼ��Ľ����
��� errbuf ���źž�����һ���ֲ���������ô PQcancel ������һ���źž���ﰲȫ�ص��á� �� PQcancel �漰�ķ�Χ�PGcancel ������ֻ���ģ� �������Ҳ���Դ�һ���봦�� PGconn ������̷߳�����߳��ﴦ������
Ҫ���������������ǰ���
int PQrequestCancel(PGconn *conn);
PQrequestCancel �� PQcancel ��һ�������ı��֡� ��ֱ���� PGconn �����Ͻ��в������������ʧ�ܣ��ͻ��� PGconn ������洢������Ϣ����˿����� PQerrorMessage ������������ ���ܹ���һ����������������ڶ��̳߳�������źž�������Σ�գ� ��Ϊ�����ܸ��� PGconn �Ĵ�����Ϣ����˽����ܰѵ�ǰ�������ڴ���IJ������ҡ�