Re: Small problem in contrib/dbase/dbf2pg.c

From: "Thomas Behr" <Thomas(dot)Behr(at)BNV-Bamberg(dot)De>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Small problem in contrib/dbase/dbf2pg.c
Date: 2003-07-24 11:38:38
Message-ID: 3F1FE15E.25646.18F60D7@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hej!

select version();
version
--------------------------------------------------------------
PostgreSQL 7.3.3 on sparc-sun-solaris2.7, compiled by cc -Xa

On 23 Jul 2003, Bruce Momjian wrote:
> Thomas, would you send me a context diff (diff -c) of the change and I
> will get into 7.4. Thanks.

I hope, it is OK.

Thomas

----8<-------------8<--------------8<----------

*** dbf2pg.c Thu Oct 31 20:11:48 2002
--- dbf2pg.c.TB Thu Jul 24 13:09:48 2003
***************
*** 194,200 ****
printf("dbf2pg\n"
"usage: dbf2pg [-u | -l] [-h hostname] [-W] [-U username]\n"
" [-B transaction_size] [-F charset_from [-T charset_to]]\n"
! " [-s oldname=newname[,oldname=newname[...]]] [-d dbase]\n"
" [-t table] [-c | -D] [-f] [-v[v]] dbf-file\n");
}

--- 194,200 ----
printf("dbf2pg\n"
"usage: dbf2pg [-u | -l] [-h hostname] [-W] [-U username]\n"
" [-B transaction_size] [-F charset_from [-T charset_to]]\n"
! " [-s oldname=[newname][,oldname=[newname][...]]] [-d dbase]\n"
" [-t table] [-c | -D] [-f] [-v[v]] dbf-file\n");
}

***************
*** 359,364 ****
--- 359,365 ----
field *fields;
int i,
h,
+ j,
result;
char *query,
*foo;
***************
*** 442,453 ****
if (result == DBF_VALID)
{
query[0] = '\0';
for (h = 0; h < dbh->db_nfields; h++)
{
! if (!strlen(fields[h].db_name))
continue;

! if (h != 0) /* not for the first field! */
strcat(query, "\t"); /* COPY statement field
* separator */

--- 443,461 ----
if (result == DBF_VALID)
{
query[0] = '\0';
+ j = 0; /* counter for fields in the output */
for (h = 0; h < dbh->db_nfields; h++)
{
! if (!strlen(fields[h].db_name)) /* When the new fieldname is empty, the field is skipped */
! {
continue;
+ }
+ else
+ {
+ j++;
+ }

! if (j > 1) /* not for the first field! */
strcat(query, "\t"); /* COPY statement field
* separator */

----8<-------------8<--------------8<----------

*** README.dbf2pg Fri Dec 21 06:29:46 2001
--- README.dbf2pg.TB Thu Jul 24 13:28:35 2003
***************
*** 12,18 ****
"dbf2pg [options] dbf-file"
Options:
[-v[v]] [-f] [-u | -l] [-c | -D] [-d database] [-t table]
! [-h host] [-s oldname=newname[,oldname=newname]] [-s
start] [-e end] [-W] [-U username] [-B transaction_size]
[-F charset_from [-T charset_to]]

--- 12,18 ----
"dbf2pg [options] dbf-file"
Options:
[-v[v]] [-f] [-u | -l] [-c | -D] [-d database] [-t table]
! [-h host] [-s oldname=[newname][,oldname=[newname]]] [-b
start] [-e end] [-W] [-U username] [-B transaction_size]
[-F charset_from [-T charset_to]]

***************
*** 70,84 ****
dbf2sql(1L) dbf2sql(1L)


! -s oldname=newname[,oldname=newname]
Change the name of a field from oldname to newname.
This is mainly used to avoid using reserved SQL-
! keywords. Example:
! -s SELECT=SEL,COMMIT=doit
This is done before the -f operator has taken
effect!

! -s start
Specify the first record-number in the xBase-file
we will insert.

--- 70,88 ----
dbf2sql(1L) dbf2sql(1L)


! -s oldname=[newname][,oldname=[newname]]
Change the name of a field from oldname to newname.
This is mainly used to avoid using reserved SQL-
! keywords. When the new fieldname is empty, the field
! is skipped in both the CREATE-clause and the
! INSERT-clauses, in common words: it will not be present
! in the SQL-table.
! Example:
! -s SELECT=SEL,remark=,COMMIT=doit
This is done before the -f operator has taken
effect!

! -b start
Specify the first record-number in the xBase-file
we will insert.

----8<-------------8<--------------8<----------

*** dbf2pg.1 Thu May 10 16:41:23 2001
--- dbf2pg.1.TB Thu Jul 24 13:33:08 2003
***************
*** 8,15 ****
Options:
.br
[-v[v]] [-f] [-u | -l] [-c | -D] [-d database] [-t table]
! [-h host] [-s oldname=newname[,oldname=newname]]
! [-s start] [-e end] [-W] [-U username] [-B transaction_size]
[-F charset_from [-T charset_to]]

.SH DESCRIPTION
--- 8,15 ----
Options:
.br
[-v[v]] [-f] [-u | -l] [-c | -D] [-d database] [-t table]
! [-h host] [-s oldname=[newname][,oldname=[newname]]]
! [-b start] [-e end] [-W] [-U username] [-B transaction_size]
[-F charset_from [-T charset_to]]

.SH DESCRIPTION
***************
*** 78,84 ****
.IR -f
operator has taken effect!
.TP
! .I "-s start"
Specify the first record-number in the xBase-file we will insert.
.TP
.I "-e end"
--- 78,84 ----
.IR -f
operator has taken effect!
.TP
! .I "-b start"
Specify the first record-number in the xBase-file we will insert.
.TP
.I "-e end"

----8<-------------8<--------------8<----------

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-07-24 13:46:03 Re: libpq incompatibility
Previous Message Andreas Pflug 2003-07-24 08:37:39 problem with libpq7.3.3/encrypted