pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: daniel.machet@accenture.com
To: Mike.Relyea@xerox.com
To: pgsql-odbc@postgresql.org
Cc: alexander.moore@accenture.com
Subject: Re: Issue with Save and Release points
Date: Thu, 23 Jun 2016 21:26:46 +0000
Message-ID: <ac82d83e71df422480d65a4eed72afda@SN4PR4207MB0382.048d.mgd.msft.net> (raw)
In-Reply-To: <91A46FD6517A7941B6309C2F7CDD238F31505A3F@USA7109MB022.na.xerox.net>
References: <2469e362195c475898c777212b68b244@CO2PR4202MB0281.048d.mgd.msft.net>
	<0A3221C70F24FB45833433255569204D1F595BEB@G01JPEXMBYT05>
	<78e9da35a70c4ff1bfce5bde393934fc@SN4PR4207MB0382.048d.mgd.msft.net>
	<57647FB5.6020001@dream.email.ne.jp>
	<459e27de37af434388e31f95aca14b82@SN4PR4207MB0382.048d.mgd.msft.net>
	<5767F085.8050808@dream.email.ne.jp>
	<5ccb64c391ce49fc9ca27e7c0d23c156@SN4PR4207MB0382.048d.mgd.msft.net>
	<57687B46.9000400@dream.email.ne.jp>
	<d0607662edb44c6c9887f56e6d1f07bc@SN4PR4207MB0382.048d.mgd.msft.net>
	<576A6CF6.6030106@dream.email.ne.jp>
	<91A46FD6517A7941B6309C2F7CDD238F31505A3F@USA7109MB022.na.xerox.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

Thanks Mike, 

This is vba for Word, not sure if that makes any difference. Just tried rewriting the query using querydefs (as demonstrated below), issued the bulk sql insert statement as strSql but am still receiving 3137 Missing semicolon (;) at end of SQL statement.


This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy.

Accenture means Accenture (UK) Limited (registered number 4757301), registered in England and Wales with registered address at 30 Fenchurch Street, London EC3M 3BD.



-----Original Message-----
From: Relyea, Mike [mailto:Mike.Relyea@xerox.com] 
Sent: 22 June 2016 14:53
To: pgsql-odbc@postgresql.org
Cc: Machet, Daniel <daniel.machet@accenture.com>
Subject: RE: [ODBC] Issue with Save and Release points

>> On a separate note – another way to tackle this might be to issue 
>> bulk insert statements but my approach so far has been to issue bulk 
>> statements using the postgres syntax from vba
>>
>> i.e. to populate a string with an insert statement like
>> 
>> INSERT INTO tblA(field1, field2) VALUES (1, 999), (2, 888);
>> 
>> And to issue via the driver using following:
>> 
>> ThisDB.Execute strSQL, dbFailOnError
>> 
>> 
>> ThisDB is created using :
>> 
>> Set ThisDB = OpenDatabase("", False, False, DBName)
>> 
>> But I keep getting a syntax error for missing ; even though this 
>> exact query works on pgAdmin
>
> OpenDatabase() seems a DAO method.
> Unfortunately it seems DAO( or Access) doesn't allow to insert multiple rows.
>
> regards,
> Hiroshi Inoue

Daniel,

If this is an Access limitation, you may be able to work around it by creating a pass-through query to run your SQL.  I use this function to create a pass-through on the fly.  I then run the query and delete it when I'm done.

Function DefineQuery(strName As String, _
                    strConnect As String, _
                    intTimeout As Integer, _
                    strSql As String, _
                    boolReturnsRecords As Boolean _
                    )
'A function to create a query given the listed parameters On Error GoTo ErrorHandler Dim db As dao.Database Dim qrydef As dao.QueryDef Dim StsBar As Variant

Set db = CurrentDb

StsBar = SysCmd(acSysCmdSetStatus, "Defining the query...")

db.QueryDefs.Delete (strName) 'Delete the query first if it exists 'Create the query
create_query:
Set qrydef = db.CreateQueryDef(strName)
    qrydef.Connect = strConnect
    qrydef.ODBCTimeout = intTimeout
    qrydef.sql = strSql
    qrydef.ReturnsRecords = boolReturnsRecords

StsBar = SysCmd(acSysCmdClearStatus)
    
ErrorHandler:
Select Case Err.Number
    Case 0
        Err.Clear
    Case 2501
        Err.Clear
    Case 3125
        MsgBox "The query name " & strName & " is not valid.  Make sure it does not contain any punctuation and is not longer than 64 characters."
    Case 3141
        MsgBox "I couldn't define the query."
    Case 3265
        Err.Clear
        GoTo create_query
    Case 3151
        MsgBox "Connection to database was lost.  Please close and reopen this program."
    Case 3359
        MsgBox "I couldn't create the query properly.  Please close and reopen this program."
    Case Else
        Dim test As Variant
        Dim strCommand As String
        strCommand = "Define Query"
        test = EmailError(Err.Number, Err.Description, strCommand) End Select End Function


Mike

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc


view thread (16+ messages)  latest in thread

Message-ID: <ac82d83e71df422480d65a4eed72afda@SN4PR4207MB0382.048d.mgd.msft.net>
Permalink:  ../ac82d83e71df422480d65a4eed72afda@SN4PR4207MB0382.048d.mgd.msft.net/
Also on:    postgresql.org/message-id/ac82d83e71df422480d65a4eed72afda@SN4PR4207MB0382.048d.mgd.msft.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: daniel.machet@accenture.com, Mike.Relyea@xerox.com, alexander.moore@accenture.com
  Subject: Re: Issue with Save and Release points
  In-Reply-To: <ac82d83e71df422480d65a4eed72afda@SN4PR4207MB0382.048d.mgd.msft.net>
  References: <2469e362195c475898c777212b68b244@CO2PR4202MB0281.048d.mgd.msft.net> <0A3221C70F24FB45833433255569204D1F595BEB@G01JPEXMBYT05> <78e9da35a70c4ff1bfce5bde393934fc@SN4PR4207MB0382.048d.mgd.msft.net> <57647FB5.6020001@dream.email.ne.jp> <459e27de37af434388e31f95aca14b82@SN4PR4207MB0382.048d.mgd.msft.net> <5767F085.8050808@dream.email.ne.jp> <5ccb64c391ce49fc9ca27e7c0d23c156@SN4PR4207MB0382.048d.mgd.msft.net> <57687B46.9000400@dream.email.ne.jp> <d0607662edb44c6c9887f56e6d1f07bc@SN4PR4207MB0382.048d.mgd.msft.net> <576A6CF6.6030106@dream.email.ne.jp> <91A46FD6517A7941B6309C2F7CDD238F31505A3F@USA7109MB022.na.xerox.net> <ac82d83e71df422480d65a4eed72afda@SN4PR4207MB0382.048d.mgd.msft.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox