Hi all,

I'm new to PostgreSQL OLE DB (and PostgreSQL in general :) and I have a
problem with using OLE DB in my C++ code...

I'm porting some code from MS SQL to PostgreSQL... Here's an example of MS SQL
query class (insert_department procedure has two parameters: input string name
and output int4 id):

[
db_command(L"EXECUTE insert_department ?, ? OUTPUT")
]
class QInsertDepartment
{
public:
[ db_param(1, DBPARAMIO_INPUT) ] CComBSTR m_strName;
[ db_param(2, DBPARAMIO_OUTPUT, status=m_dwIDStatus) ] LONG m_lID;

DBSTATUS m_dwIDStatus;
};

I know how to execute a PostgreSQL stored procedure, so I had to change the
class for PostgreSQL a bit:

[
db_command(L"SELECT insert_department(?)")
]
class QInsertDepartment
{
public:
[ db_param(1, DBPARAMIO_INPUT) ] CComBSTR m_strName;
[ db_column(1, status=m_dwIDStatus) ] LONG m_lID;

DBSTATUS m_dwIDStatus;
};

Calling code looks something like this:

QInsertDepartment insertDepartment;

m_session.StartTransaction();

insertDepartment.m_strName = strName.c_str();

HRESULT hr = insertDepartment.Open(m_session);
if (FAILED(hr))
{
...
}
...

insertDepartment.Open() returns DB_E_PARAMNOTOPTIONAL. Here's the relevant
part of the log file (execution of Open):

IDBCreateCommandImpl::CreateCommand
IObjectWithSiteImpl::SetSite
CPgCommand::SetCommandText "SELECT insert_department(?)"
ICommandTextImpl::SetCommandText
CPgCommand::SetParameterInfo
CErrorLookupService::ClearErrorIAccessorImpl::CreateAccessor
CPgCommand::Execute
CErrorLookupService::ClearErrorCPgCommand::FillParams
CErrorLookupService::ClearErrorICommandTextImpl::GetCommandText
IObjectWithSiteImpl::GetSite
IAccessorImpl::GetBindingsCPgCommand::Execute error: FillinValues failed
CErrorLookupService::ReportCustomError HRES 80040e10:
FillinValues failed


My guess is that there is a problem with parsing input parameter(s), since
executing procedures without IN parmeters (just OUT) works ok.

Can anyone help me?

Thank you,
--
Marko Božiković
Tellus d.o.o.
Tel. +385 1 3691 975
Fax +385 1 3691 976
E-Mail: marko.bozikovic@tellus.hr
Ogrizovićeva 40a
10000 Zagreb
Hrvatska

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-interfaces @
categoriespostgresql
postedOct 18, '06 at 7:27a
activeOct 18, '06 at 7:27a
posts1
users1
websitepostgresql.org
irc#postgresql

1 user in discussion

Marko Bozikovic: 1 post

People

Translate

site design / logo © 2022 Grokbase