Issue with ODBC bind values in Prolog 7.2

Discussions related to Visual Prolog
Matthias Greving
Posts: 18
Joined: 21 Mar 2002 0:01

Issue with ODBC bind values in Prolog 7.2

Unread post by Matthias Greving » 18 May 2009 16:03

Hello,

I have a problem with the odbc module of Prolog 7.202. I recompiled a program which I had developed in Prolog 7.103 and it produces a runtime error. I have tracked down the issue to the bind variables for strings (the other data types probably work fine) of the insert statement I use.
I could fix this for me in putting a part of the 7.103 code into the 7.202 pfc, but I think this shoud be solved properly.

Here is the part from the pfc I changed (file odbcDeferredBuffer.pro):

Code: Select all

clauses     bindToParameter(Stmt, ParameterNumber, InputOutputType) :-         columnNumber := ParameterNumber,         Handle = Stmt:getStatementNativeHandle(),         PrologType = prologType,         ByteCount = byteCount,         SqlType = child:sqlType,         Buffer = getBufferArray(),         LengthArray = getLengthPointerArray(), %  : sql error %        RC = odbc_native::sQLBindParameter(Handle, ParameterNumber, InputOutputType, PrologType, SqlType, columnSize, 0, Buffer, ByteCount, LengthArray),         RC = odbc_native::sQLBindParameter(           Handle, ParameterNumber, InputOutputType, PrologType, SqlType, %          columnSize,           getColumnSize(),           0, Buffer, ByteCount, LengthArray         ), %  : sql error         FieldInfo = string::format("ParameterNumber = %, PrologType = %, ColumnSize = %, ByteCount = %", ParameterNumber, PrologType, columnSize, ByteCount),         Stmt:checkReturnCode(RC, "SQLBindParameter", FieldInfo).   %  : sql error predicates     getColumnSize : () -> columnSize ColumnSize. clauses     getColumnSize() = byteCount div sizeOfDomain(char) :-         SqlType = child:sqlType,         (SqlType = sql_wchar or SqlType = sql_wvarchar or SqlType = sql_wlongvarchar),         !.     getColumnSize() = convert(columnSize, byteCount). %  : sql error

User avatar
Thomas Linder Puls
VIP Member
Posts: 2447
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 19 May 2009 7:02

I think you are right about this, but I was unable to reproduce the problem.

Which Access version do you use?

Is it possible for you to create a little example (including a little Access database) and send it to support@visual-prolog.com?
Regards Thomas Linder Puls
PDC

User avatar
Thomas Linder Puls
VIP Member
Posts: 2447
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 19 May 2009 10:23

Please try the attached PFC files.

You can place the PFC directory in your project directory. That way the 4 replacement files will be included instead of the original PFC files. So you can make the test without changing your installation.
Attachments
pfc.zip
Updated ODBC files
(4.66 KiB) Downloaded 425 times
Regards Thomas Linder Puls
PDC

Matthias Greving
Posts: 18
Joined: 21 Mar 2002 0:01

Unread post by Matthias Greving » 19 May 2009 14:14

Hello Thomas,

I have tested your files, now it works fine. Thank you for your support.

mfg
Matthias

User avatar
Thomas Linder Puls
VIP Member
Posts: 2447
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 19 May 2009 16:57

Well, I thank you for pointing out the problem so precisely.
Regards Thomas Linder Puls
PDC

Post Reply