pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problems with MFC AddNew
3+ messages / 2 participants
[nested] [flat]

* Problems with MFC AddNew
@ 2007-01-23 17:18 iklassen@phhpc.com
  2007-01-29 15:07 ` Re: Problems with MFC AddNew Ian Klassen <iklassen@phhpc.com>
  0 siblings, 1 reply; 3+ messages in thread

From: iklassen@phhpc.com @ 2007-01-23 17:18 UTC (permalink / raw)
  To: pgsql-odbc

Hello,

I'm having some difficulty with adding new records using the ODBC driver
with MFC.  This is only occurring is certain situations...

I created a simple table:

CREATE TABLE project (project_id INT PRIMARY KEY);

Using Visual Studio C++ I created a CRecordset class (CProject) to
exchange data with the project table.  I then execute the following code:

CDatabase database;
database.OpenEx(_T("DSN=PostgreSQL30"));
CProject project(&database);
project.Open();
project.AddNew();
project.m_project_id = 1;
project.Update();

I get an Access Violation on the Update().  The log file shows the
following error:

psqlodbc_3100.log:
conn=01104290, query='SELECT "project_id"  , "ctid", "project_id" FROM
"public"."project"'
    [ fetched 0 rows ]

mylog_3100.log:
[1800-4.186]extend_putdata_info: entering ... self=016C5EC4,
parameters_allocated=0, num_params=1
[1800-4.191]extend_putdata_info: unable to create 1 new pdata from 0 old
pdata

Now I've been able to get the Update() to work in the following situations:

- remove the primary key:
  CREATE TABLE project (project_id INT);

- change the int to bigint:
  CREATE TABLE project (project_id BIGINT PRIMARY KEY);

- make sure at least one record exists in the table:
  CREATE TABLE project (project_id INT PRIMARY KEY);
  INSERT INTO project (project_id) VALUES (2);

So what's going on?  I would like to use int, but if I have to I can
switch to bigint.  Thanks for your help.

Ian




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Problems with MFC AddNew
  2007-01-23 17:18 Problems with MFC AddNew iklassen@phhpc.com
@ 2007-01-29 15:07 ` Ian Klassen <iklassen@phhpc.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Ian Klassen @ 2007-01-29 15:07 UTC (permalink / raw)
  To: Hiroshi Inoue <inoue@tpf.co.jp>; +Cc: pgsql-odbc; martin.oberle@winntec.de

Hiroshi,

Yes, I was in debug mode.  Using the debug version of the DLL solved the 
problem.  Thank you for tracking that down.  Do you also have a debug 
version of the ANSI DLL?

Ian

Hiroshi Inoue wrote:
> Aren't you testing it with Debug mode ?
> I provided the Debug version trial driver
>    
> http://www.geocities.jp/inocchichichi/psqlodbc/trial/psqlodbc35wd.zip .
> Please try it.
>
> The differece among the 3 drivers are
> 1. The existent drivers     Release mode compiled with the option /MT.
> 2. The trial driver            Release mode compiled with the option /MD.
> 3. The trial debug driver  Debug mode compiled with the option /MDd




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Problems with MFC AddNew
@ 2007-01-26 20:29 Ian Klassen <iklassen@phhpc.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Ian Klassen @ 2007-01-26 20:29 UTC (permalink / raw)
  To: Oberle, Martin <martin.oberle@winntec.de>; pgsql-odbc

Hi,

That is an option, but I'm working with a large project with many 
AddNew's and I would prefer not having to update them all.

Hiroshi thinks it's a linking problem.  He's working on it...

Ian

Oberle, Martin wrote:
> Hello,
>
> I have the same problem. I think "addnew" does not work,
> when the recordset is empty (has no rows).
> I call SQLExecute(insert...) to add a new record.
>
> best regards
>
> Martin
>   



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-01-29 15:07 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-01-23 17:18 Problems with MFC AddNew iklassen@phhpc.com
2007-01-29 15:07 ` Ian Klassen <iklassen@phhpc.com>
2007-01-26 20:29 Re: Problems with MFC AddNew Ian Klassen <iklassen@phhpc.com>

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