mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 00:03:57 -04:00 
			
		
		
		
	There is an option "-s oldname=newname", which changes the old field name of
  the dbf-file to the newname in PostgeSQL. If the length of the new name is 0,
  the field is skiped. If you want to skip the first field of the dbf-file,
  you get the wildest error-messages from the backend.
  dbf2pg load the dbf-file via "COPY tablename FROM STDIN". If you skip the
  first field, it is an \t to much in STDIN.
A fix could be an counter j=0, which increments only, if a field is imported
(IF (strlen(fields[h].db_name)> 0) j++. And only if j > 1 (if an other field is
imported) the \t is printed.
An other small bug in the README:
-s start
              Specify  the  first record-number in the xBase-file
              we will insert.
should be
-e start
              Specify  the  first record-number in the xBase-file
              we will insert.
Thomas Behr
		
	
			
		
			
				
	
	
		
			140 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			140 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
 | |
| 
 | |
| 
 | |
| dbf2sql(1L)					      dbf2sql(1L)
 | |
| 
 | |
| 
 | |
| NAME
 | |
|        dbf2sql	-  Insert  xBase-style	.dbf-files  into  a Post-
 | |
|        greSQL-table
 | |
| 
 | |
| SYNOPSIS
 | |
|        "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]]
 | |
| 
 | |
| 
 | |
| DESCRIPTION
 | |
|        This  manual  page documents the program dbf2pg.  It takes
 | |
|        an xBase-style .dbf-file, and inserts it into  the  speci-
 | |
|        fied database and table.
 | |
| 
 | |
|    OPTIONS
 | |
|        -v     Display some status-messages.
 | |
| 
 | |
|        -vv    Also display progress.
 | |
| 
 | |
|        -f     Convert  all field-names from the .dbf-file to low-
 | |
| 	      ercase.
 | |
| 
 | |
|        -u     Convert the contents of all fields to uppercase.
 | |
| 
 | |
|        -l     Convert the contents of all fields to lowercase.
 | |
| 
 | |
|        -c     Create the table specified with -t.  If this  table
 | |
| 	      already exists, first DROP it.
 | |
| 
 | |
|        -D     Delete the contents of the table specified with -t.
 | |
| 	      Note that this table has to  exists.  An	error  is
 | |
| 	      returned if this is not the case.
 | |
| 
 | |
|        -W     Ask for password.
 | |
| 
 | |
|        -d database
 | |
| 	      Specify  the  database to use. An error is returned
 | |
| 	      if  this	database  does	not  exists.  Default  is
 | |
| 	      "test".
 | |
| 
 | |
|        -t table
 | |
| 	      Specify  the  table  to  insert  in.  An	error  is
 | |
| 	      returned if this table does not exists. Default  is
 | |
| 	      "test".
 | |
| 
 | |
|        -h host
 | |
| 	      Specify  the  host  to which to connect. Default is
 | |
| 	      "localhost".
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 								1
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 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.
 | |
| 
 | |
|        -e end Specify the last record-number in the xBase-file we
 | |
| 	      will insert.
 | |
| 
 | |
|        -B transaction_size
 | |
| 	      Specify  the  number  of	records  per transaction,
 | |
| 	      default is all records.
 | |
| 
 | |
|        -U username
 | |
| 	      Log as the specified user in the database.
 | |
| 
 | |
|        -F charset_from
 | |
| 	      If specified, it converts the data from the  speci-
 | |
| 	      fied charset. Example:
 | |
| 	      -F IBM437
 | |
| 	      Consult  your  system documentation to see the con-
 | |
| 	      versions available.  This requires iconv to be enabled
 | |
|               in the compile.
 | |
| 
 | |
|        -T charset_to
 | |
| 	      Together with -F charset_from  ,	it  converts  the
 | |
| 	      data   to   the	specified   charset.  Default  is
 | |
| 	      "ISO-8859-1".  This requires iconv to be enabled
 | |
|               in the compile.
 | |
| 
 | |
| ENVIRONMENT
 | |
|        This program is affected by the	environment-variables  as
 | |
|        used  by  "PostgresSQL."   See  the documentation of Post-
 | |
|        gresSQL for more info.  This program can optionally use iconv 
 | |
|        character set conversion routines.
 | |
| 
 | |
| BUGS
 | |
|        Fields larger than 8192 characters are not  supported  and
 | |
|        could break the program.
 | |
|        Some  charset  convertions  could  cause  the output to be
 | |
|        larger than the input and could break the program.
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 								2
 | |
| 
 | |
| 
 |