SQLRelay

Talk about commercial or opensource products that already exist for OpenVMS or may be available in the future.
Post Reply
User avatar

Topic author
arne_v
Master
Posts: 299
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

SQLRelay

Post by arne_v » Fri May 14, 2021 1:53 pm

I have started playing with SQLRelay.

And there is something that I cannot get to work.

That could of course just be because of a bug in the code I have written, but the code seems to work on Windows.

Code fragment:

/* prepare */
sprintf(sqlstr, "INSERT INTO t1 VALUES(%s, %s)", placeholder("1", "f1", "int"), placeholder("2", "f2", "text"));
sqlrcur_prepareQuery(curs, sqlstr);
/* bind parameters */
sqlrcur_inputBindLong(curs, bindname("1", "f1"), f1);
sqlrcur_inputBindString(curs, bindname("2", "f2"), f2);
/* execute */
stat = sqlrcur_executeQuery(curs);
if(!stat) curs_exit(curs);
n = sqlrcur_affectedRows(curs);

The INSERT get executed fine.

But the values inserted are not the expected 999 and 'XXX' but -2147483648 and 'XXX'.

Somehow the integer value does not get in correct.

The declaration of sqlrcur_inputBindLong seems to match:

/** @ingroup sqlrclientwrapper
* Defines a integer input bind variable. */
SQLRCLIENT_DLLSPEC
void sqlrcur_inputBindLong(sqlrcur sqlrcurref, const char *variable,
int64_t value);

Do not get confused by the placeholder and bindname functions.

/* standard (ODBC, DB2, MySQL) */
static char *std_ph(char *num, char *nam, char *typ)
{
return "?";
}

static char *std_bn(char *num, char *nam)
{
return num;
}

should be fine with the database tested (MySQL) and besides if they were wrong then I would get an error.

Any ideas?
Arne
arne@vajhoej.dk
VMS user since 1986

User avatar

Topic author
arne_v
Master
Posts: 299
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: SQLRelay

Post by arne_v » Mon May 17, 2021 7:30 pm

I also tried the Pascal API.

And sqlr$cur_inputbindstring is giving me problem here.

:-(
Arne
arne@vajhoej.dk
VMS user since 1986


anton.golovenko
VSI Expert
Visitor
Posts: 1
Joined: Tue May 18, 2021 3:12 am
Reputation: 0
Status: Offline

Re: SQLRelay

Post by anton.golovenko » Tue May 18, 2021 3:25 am

Which version of SQLRelay do you use? You can try to execute your code on SQLRelay V1.9-0B because in this version a similar bug has been fixed.

User avatar

Topic author
arne_v
Master
Posts: 299
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: SQLRelay

Post by arne_v » Tue May 18, 2021 7:31 am

1.9-0A - I will look for 1.9-0B. Thanks.,

Added in 2 minutes 45 seconds:
Hmmm. https://vmssoftware.com/products/sql-relay/only has 1.9-0A.
Arne
arne@vajhoej.dk
VMS user since 1986


brett.cameron
VSI Expert
Active Contributor
Posts: 25
Joined: Mon Jun 24, 2019 9:51 am
Reputation: 0
Status: Offline

Re: SQLRelay

Post by brett.cameron » Tue May 18, 2021 2:41 pm

Arne, the kit has not yet been generally released. Contact me or VSI Support directly and we'll sort out getting you a copy.

User avatar

Topic author
arne_v
Master
Posts: 299
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: SQLRelay

Post by arne_v » Thu May 20, 2021 9:50 am

I would love a copy.

I sent you a DM.
Arne
arne@vajhoej.dk
VMS user since 1986

User avatar

Topic author
arne_v
Master
Posts: 299
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: SQLRelay

Post by arne_v » Tue Jun 22, 2021 9:41 am

I forgot to followup here.

With some help from VSI I got it working.

The result can be seen here:

https://www.vajhoej.dk/arne/articles/vmstd2.html
Arne
arne@vajhoej.dk
VMS user since 1986

Post Reply