FUNCTION getodbcdriver

IF !("REGISTRY" $ SET("CLASS"))
	SET CLASSLIB TO (m.gcini_path+"libs\registry.vcx") ALIAS registry ADDITIVE
ENDIF
oreg=CREATEOBJECT("odbcreg")
nErrNum = oReg.GetODBCDrvrs(@aODBCData,.F.)
RELEASE oreg
RELEASE CLASSLIB registry
DO CASE 
	CASE ASCAN(aodbcdata,"PostgreSQL UNICODE",-1,-1,-1,13)>0
		RETURN aodbcdata(ASCAN(aodbcdata,"PostgreSQL UNICODE",-1,-1,-1,13))
	CASE ASCAN(aodbcdata,"PostgreSQL ODBC DRIVER(UNICODE)",-1,-1,-1,13)>0
		RETURN aodbcdata(ASCAN(aodbcdata,"PostgreSQL ODBC DRIVER(UNICODE)",-1,-1,-1,13))
	CASE ASCAN(aodbcdata,"PostgreSQL ANSI",-1,-1,-1,13)>0
		RETURN aodbcdata(ASCAN(aodbcdata,"PostgreSQL ANSI",-1,-1,-1,13))
	CASE ASCAN(aodbcdata,"PostgreSQL",-1,-1,-1,13)>0
		RETURN aodbcdata(ASCAN(aodbcdata,"PostgreSQL",-1,-1,-1,13))
	OTHERWISE 
		RETURN ""
ENDCASE 
