Import: I need help

From: Quan Zongliang <quanzongliang(at)gmail(dot)com>
To: pgadmin-hackers(at)postgresql(dot)org(dot)
Subject: Import: I need help
Date: 2009-02-13 03:08:44
Message-ID: 20090213111232.33F1.4125B4E5@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi, all

I haven't any experience with libpq. So there are a lot of questions.

When import to db using INSERT statement. Like this:
res = PQexec(m_conn->connection(), "BEGIN");
LOOP: res = PQexec(m_conn->connection(), "INSERT INTO ...");
res = PQexec(m_conn->connection(), "COMMIT");
If any INSERT statement failed in the middle, the whole transaction is aborted.
In my plan, the end user can select a number of rows to commit their work.
(Option: commit every xxx rows.)
Is there a approach to ingnore error statement and leave current transaction
in normal status? If it can be did, the program only need log the error and
go on to deal with left statements.
Or when encounter a error, stop the deal?

If the end user decide to import with INSERT statement,
these statements will be sent to db with asynchronous mode:
LOOP:
1: submit statement asynchronous
2: generate next statement
3: wait for last one to be completed
4: log
goto 1
Is it OK?
Or we should use synchronous mode?

First, import function with INSERT statement will be implemented.
The questions about COPY command will come soon. ^-^

A discussion:
In schemas, the pgDatatype had been defined. but it use type-name to recognise type.
I noticed system types had been defined in server/catalog/pg_type.h:
#define BOOLOID 16
#define BYTEAOID 17
and so on.
Why don't use these defination in the pgAdmin?
The judgement with (type==BOOLOID) will get more effective than (name == wxT("boolean")).

Thanks.

-----------------------------------------------
Quan Zongliang
quanzongliang(at)gmail(dot)com
CIT Japan: http://www.cit.co.jp
CIT China: http://www.citbj.com.cn

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2009-02-13 08:55:00 Re: Import: I need help
Previous Message hirolin7 2009-02-13 02:08:13 about bit varying