Skip site navigation (1) Skip section navigation (2)

Problem with Postgres/ODBC Driver.

From: Robert Carbonari <robertC(at)opmr(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Problem with Postgres/ODBC Driver.
Date: 1999-08-31 17:35:48
Message-ID: 91E49E736688D21185F500A0C985C70516DE4F@DOOM (view raw or flat)
Thread:
Lists: pgsql-interfaces
Hello,
I wrote a script which copies information from an Outlook public folder into
a Postgres database and it didn't work until I made the following changes to
it and to the table under Postgres:
I had to change the names of nearly all the fields so that there were no
more capitals and spaces between fields.  I had originally given real names
the fields to reflect those given to a parallel table under MS SQL server
v.7. I had names like "Project Manager Name" which I entered into the table
with statements like:
CREATE TABLE table_name ("Project Manager Name" text, ...);
I had to alter these names using ALTER TABLE and not use double-quotes, so
that every field was automatically lower-case.
Next, my script has commands like the following (you can ignore all but the
underlined line if you want):
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = 1
'DSN USING POSTGRES/ODBC DRIVER FOR WIN32.
Const DSN = "PostgresContacts"
Call Main()
WScript.Quit (0)
Sub Main
	'SET OUTLOOK OBJECTS TO REFER TO ITEMS IN PUBLIC FOLDER
	Set objOutlook = Wscript.CreateObject ("Outlook.Application")
	Set objNameSpace = objOutlook.GetNameSpace("MAPI")
	Set objPublicFolders = objNameSpace.Folders("Public Folders")
	Set objAllPublicFolders = objPublicFolders.Folders("All Public
Folders")
	Set ContactItems = objAllPublicFolders..Folders("Some Contacts")
	varSQL =  "Select * From PMStoreContacts"
	varSQL_Del  =  "Delete  From PMStoreContacts "
	'CREATE ADO RECORDSET OBJECT 
	Set rsChains = WScript.CreateObject("ADODB.Recordset") 
	rsChains.open varSQL_Del, DSN, adOpenStatic, adLockOptimistic
	rsChains.open varSQL, DSN, adOpenStatic, adLockOptimistic
	For Each Item in ContactsItems	
		rsChains.addnew
		rsChains("Project Manager") = Item.SomeField
		...
		rsChains.Update
		rsChains.movenext
	next
	rsChains.Close
	'****SETTING OBJECTS FOR GETTING OUTLOOK INFORMATION TO NOTHING
TO RELEASE THEM FROM MEMORY (sort of...)****
	Set objOutlook = nothing
	Set objNameSpace = nothing
	Set objPublicFolders = nothing
	Set objAllPublicFolders = nothing
	Set ContactsItems = nothing
	'****SET RECORDSET OBJECT TO NOTHING********
	Set rsChains = Nothing
End Sub
Notice that there is a space in rsChains("Project Manager") =
Item.SomeField. 
I had to remove this space from my script to match the new field I created
on Postgres.
My question, then, is this: How can I access fields which have spaces and
Caps in them {CREATE TABLE table_name ("Project Manager Name" text,
...);...} from my VBScript (using the Windows Scripting Host) when I employ
the Postgres/ODBC driver from Insight?  
Is there some special way to pass these special field names to the driver so
that it can understand and properly translate them to Postgres (on Linux)?
Or must I resort to naming the fields in Postgres in the conventional way
and leave it at that?
Here is the driver information:
odbc driver version:  6.30.0250
postgresql database version: 6.4

Robert Carbonari
Programmer
Optimal Robotics Corp.
e-mail: robertc(at)optimal-robotics(dot)com
phone:  (514)738-8885 ext. 146



Responses

pgsql-interfaces by date

Next:From: harryDate: 1999-08-31 17:58:32
Subject: sex 8485
Previous:From: Jackson, DeJuanDate: 1999-08-31 16:18:39
Subject: RE: [INTERFACES] [INTERFACE] Need an example

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group