[PATCHES] contrib/dbase

2004-09-09 Thread Laurent Ballester
Hello,

 Here is a patch for contrib/dbase module to allow it to be compiled under
win32 with mingw compiler.

On dbf.h, add a include to define u_char type
On dbf2pg.c, rename Escape type already defined on Windows by GDI (Graphic
Device Interface) layer to Escape_db.


Regards, Laurent


dbf2pg.c.diff
Description: Binary data


dbf.h.diff
Description: Binary data

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [PATCHES] eventlog fix

2004-06-20 Thread Laurent Ballester
Hello,

I downloaded and compiled all files you store in CVS pgevent directory and
it works.

Following the discusion posted yesterday, I made a test with SimpleMC a
alternative MC compiler ( http://www.volny.cz/xnavara/SimpleMC.zip) but
unfortunatelly it doesn't works MSG0001.bin file generated are differents
and consequently Messages are seing missing for Windows eventviewer.

regards
Laurent Ballester

- Original Message - 
From: Bruce Momjian [EMAIL PROTECTED]
To: Laurent Ballester [EMAIL PROTECTED]
Cc: Alvaro Herrera [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Sunday, June 20, 2004 3:33 AM
Subject: Re: [PATCHES] eventlog fix



 Patch applied, with doc additions I already posted.  Please test CVS and
 let me know how it works.  I added a README containing your explaination
 below for our later reference.  I added the MSG01.bin as a binary
 CVS checkin.



---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [PATCHES] eventlog fix

2004-06-19 Thread Laurent Ballester
Hello,

I just looking under CVS web interface what is stored in pgevent directory
and what is missing.

The files attached with this mail have to be stored in pgevent directory.
MSG01.bin is a bin files, result of Microsoft MC compiler. MC compiler
can be downloaded for free with MS Core SDK but it is not included with MSYS
tools and I didn't find a alternative way to compile MC file.

To summarize MC pgmsgevent.mc command generates pgmsgevent.h pgmsgevent.rc
and MSG1.bin files.
In MC file, we declare a string with %s format, so we can write anything we
want in the future without need to change the definition of this string.

To finish, because DllUnregisterServer and DllRegisterServer are system
defined entry point, we need to export these two functions with their names
without decoration, so we cannot uses auto generated .def files without
handy modifications.

regards
Laurent Ballester

- Original Message - 
From: Bruce Momjian [EMAIL PROTECTED]
To: Laurent Ballester [EMAIL PROTECTED]
Cc: Alvaro Herrera [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Saturday, June 19, 2004 7:13 AM
Subject: Re: [PATCHES] eventlog fix



 OK, I have created the following diff to document the pgevent
 installation instructions.  However, you didn't send me a Makefile for
 creating the DLL, and I am not sure how to do that.  Would you send me a
 `Makefile for src/bin/pgevent?  Thanks.

LANGUAGE 0x9,0x1
1 11 MSG1.bin


Makefile
Description: Binary data


MSG1.bin
Description: Binary data
/*-
 *
 * pgevent.c
 *  Defines the entry point for pgevent dll.
 *  The DLL defines event source for backend
 *
 *
 * IDENTIFICATION
 *$PostgreSQL$
 *
 *-
 */


#include windows.h
#include olectl.h
#include string.h

/* Global variables */
HANDLE g_module = NULL; /* hModule of DLL */

/* Prototypes */
STDAPI DllRegisterServer(void) ;
STDAPI DllUnregisterServer(void);
BOOL WINAPI DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved );

/*
 * DllRegisterServer --- Instructs DLL to create its registry entries 
 */

STDAPI DllRegisterServer(void) 
{
HKEY key; 
DWORD data; 
char buffer[_MAX_PATH]; 

/* Set the name of DLL full path name. */
if (!GetModuleFileName((HMODULE)g_module, buffer, sizeof(buffer)))
{
MessageBox(NULL, Could not retrieve DLL filename, PostgreSQL 
error, MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}

/* Add PostgreSQL source name as a subkey under the Application 
   key in the EventLog registry key. */
if ( RegCreateKey(HKEY_LOCAL_MACHINE, 
SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\PostgreSQL, key) ) 
{
MessageBox(NULL, Could not create the registry key., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}

 /* Add the name to the EventMessageFile subkey. */
if (RegSetValueEx(key,  
EventMessageFile, 
0,  
REG_EXPAND_SZ,
(LPBYTE) buffer,
strlen(buffer) + 1))
{
MessageBox(NULL, Could not set the event message file., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
 
/* Set the supported event types in the TypesSupported subkey. */
data = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; 
 
if (RegSetValueEx(key,  
TypesSupported,  
0, 
REG_DWORD, 
(LPBYTE) data,  
sizeof(DWORD)))
{
MessageBox(NULL, Could not set the supported types., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
 
RegCloseKey(key); 
return S_OK;
}

/*
 * DllUnregisterServer --- Instructs DLL to remove only those entries created through 
DllRegisterServer
 */

STDAPI DllUnregisterServer(void)
{
/* Remove PostgreSQL source name as a subkey under the Application 
   key in the EventLog registry key. */
 
if ( RegDeleteKey(HKEY_LOCAL_MACHINE, 
SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\PostgreSQL) )
{
MessageBox(NULL, Could not delete the registry key., PostgreSQL 
error, MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
return S_OK;
}

/*
 * DllMain --- is an optional entry point into a DLL.
 */

BOOL WINAPI DllMain( HANDLE hModule, 
 DWORD  ul_reason_for_call, 
 LPVOID lpReserved

Re: [PATCHES] eventlog fix

2004-06-16 Thread Laurent Ballester

 Would you send me documentation explaining how to register this DLL with
 the event logger on Win32?  Ideally you could send me a diff against
 installation.sgml.


Hello Bruce,



After the DLL was in it target directory (C:\msys\1.0\local\pgsql\lib with
make install)

You can register the DLL to windows event log with the command

Regsvr32 pgevent.dll or regsvr32 /s pgevent.dll whish is a silent mode.



To uninstall, regsvr32 /u pgevent.dll will delete key add by the DLL in
Windows registry.



The DLL create the following entry:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\P
ostgreSQL] with two values :

EventMessageFile wish contains full path of DLL
C:\msys\1.0\local\pgsql\lib\pgevent.dll

TypesSupported : error type message send by postgresql



Regsvr32 is a standard program located in %systemroot%\system32



Regards

Laurent Ballester




---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [PATCHES] eventlog fix

2004-06-02 Thread Laurent Ballester
Hello magnus,

 I assume you mean src/bin/pgevent, to be consistent with the naming used
 inside the program.

OK, I Modify Makefile subdir value. In fact I name it pg_event because many
directory under src/bin began with pg_ .

 Second, I'd register the source as PostgreSQL, not PostGreSQL. I
 don't think the captital-G is generally used, and it's specifically
 NOT what the backend uses. Sure, the key reading process is
 case-insensitive today, but it's still a good idea to keep things
 consistent :-)

I modify pgevent.c, for your both remarks: capital G are disappears from
source and I move GetModuleFilename() before RegCreateKey() call.

I sent full set file again, it will be easier to apply.

regards,

Laurent
LANGUAGE 0x9,0x1
1 11 MSG1.bin


Makefile
Description: Binary data


MSG1.bin
Description: Binary data
/*-
 *
 * pgevent.c
 *  Defines the entry point for pgevent dll.
 *  The DLL defines event source for backend
 *
 *
 * IDENTIFICATION
 *$PostgreSQL$
 *
 *-
 */


#include windows.h
#include olectl.h
#include string.h

/* Global variables */
HANDLE g_hModule = NULL;/* hModule of DLL */

/* Prototypes */
STDAPI DllRegisterServer(void) ;
STDAPI DllUnregisterServer(void);
BOOL WINAPI DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved );

/*
 * DllRegisterServer --- Instructs DLL to create its registry entries 
 */

STDAPI DllRegisterServer(void) 
{
HKEY hk; 
DWORD dwData; 
char szBuffer[_MAX_PATH]; 

/* Set the name of DLL full path name. */
if (!GetModuleFileName((HMODULE)g_hModule, szBuffer, sizeof(szBuffer)))
{
MessageBox(NULL, Could not retrieve DLL filename, PostgreSQL 
error, MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}

/* Add PostgreSQL source name as a subkey under the Application 
   key in the EventLog registry key. */
if ( RegCreateKey(HKEY_LOCAL_MACHINE, 
SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\PostgreSQL, hk) ) 
{
MessageBox(NULL, Could not create the registry key., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}

 /* Add the name to the EventMessageFile subkey. */
if (RegSetValueEx(hk,   
EventMessageFile, 
0,  
REG_EXPAND_SZ,
(LPBYTE) szBuffer,
strlen(szBuffer) + 1))
{
MessageBox(NULL, Could not set the event message file., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
 
/* Set the supported event types in the TypesSupported subkey. */
dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; 
 
if (RegSetValueEx(hk,  
TypesSupported,  
0, 
REG_DWORD, 
(LPBYTE) dwData,  
sizeof(DWORD)))
{
MessageBox(NULL, Could not set the supported types., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
 
RegCloseKey(hk); 
return S_OK;
}

/*
 * DllUnregisterServer --- Instructs DLL to remove only those entries created through 
DllRegisterServer
 */

STDAPI DllUnregisterServer(void)
{
/* Remove PostgreSQL source name as a subkey under the Application 
   key in the EventLog registry key. */
 
if ( RegDeleteKey(HKEY_LOCAL_MACHINE, 
SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\PostgreSQL) )
{
MessageBox(NULL, Could not delete the registry key., PostgreSQL 
error, MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
return S_OK;
}

/*
 * DllMain --- is an optional entry point into a DLL.
 */

BOOL WINAPI DllMain( HANDLE hModule, 
 DWORD  ul_reason_for_call, 
 LPVOID lpReserved
)
{
if ( ul_reason_for_call == DLL_PROCESS_ATTACH ) 
{
g_hModule = hModule;
}
return TRUE;
}

; dlltool --output-def pgevent.def pgevent.o pgmsgevent.o
EXPORTS
[EMAIL PROTECTED] @ 1; 
[EMAIL PROTECTED] @ 2; 
//
//  Values are 32 bit values layed out as follows:
//
//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//  +---+-+-+---+---+
//  |Sev|C|R| Facility  |   Code|
//  +---+-+-+---+---+
//
//  where
//
//