
$Id: README.win32,v 1.3 2002/10/15 19:56:59 bmomjian Exp $


Here is a step-by-step procedure for getting DBD-Pg to work on Windows
NT. This Port has been done by Bob Kline <bkline@rksystems.com>. 


prerequisites:	(older versions might also work, but these are the 
--------------   versions I used)

	o Windows NT4 SP4
	o Visual Studio 6.0
	o ActivePerl-5_6_0_613 with DBI-1.13
	o postgresql-7.0.2
	o DBD-Pg-0.95

Here we assume, that perl and postgresql have been installed in C:\. Now
perform the following steps:


1. compile libpq
----------------

set POSTGRES_HOME=C:\postgresql-7.0.2
cd postgresql-7.0.2
mkdir lib
mkdir include
cd src
copy include\port\win32.h include\os.h
edit interfaces\libpq\fe-connect.c and add as first statement in connectDBStart() the following code:
  #ifdef WIN32
      static int WeHaveCalledWSAStartup;
      if (!WeHaveCalledWSAStartup) {
          WSADATA wsaData;
          if (WSAStartup(MAKEWORD(1, 1), &wsaData)) {
              printfPQExpBuffer(&conn->errorMessage, "WSAStartup failed: errno=%d\n", h_errno);
              goto connect_errReturn;
          }
          WeHaveCalledWSAStartup = 1;
      }
  #endif
edit interfaces\libpq\win32.mak and change the flag /ML to /MD:   CPP_PROJ=/nologo /MD ...
nmake /f win32.mak
cd ..
copy src\interfaces\libpq\Release\libpq.lib  lib
copy src\interfaces\libpq\libpq-fe.h         include
copy src\include\postgres_ext.h              include
cd ..


2. build DBD-Pg
---------------

cd DBD-Pg
perl Makefile.PL CAPI=TRUE
nmake
set the environment variable PGHOST to the name of the postgresql server: set PGHOST=myserver
add on the server a postgres user with the same name as the NT-User (eg Administrator)
make sure, that your pg_hba.conf on the server is configured, such that a connection from another host will be accepted
mkdir C:\tmp
nmake test   (expect to get errors concerning blobs)
nmake install
