Page 1 of 1

SQLRelay

Posted: Fri May 14, 2021 1:53 pm
by arne_v
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?

Re: SQLRelay

Posted: Mon May 17, 2021 7:30 pm
by arne_v
I also tried the Pascal API.

And sqlr$cur_inputbindstring is giving me problem here.

:-(

Re: SQLRelay

Posted: Tue May 18, 2021 3:25 am
by anton.golovenko
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.

Re: SQLRelay

Posted: Tue May 18, 2021 7:31 am
by arne_v
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.

Re: SQLRelay

Posted: Tue May 18, 2021 2:41 pm
by brett.cameron
Arne, the kit has not yet been generally released. Contact me or VSI Support directly and we'll sort out getting you a copy.

Re: SQLRelay

Posted: Thu May 20, 2021 9:50 am
by arne_v
I would love a copy.

I sent you a DM.

Re: SQLRelay

Posted: Tue Jun 22, 2021 9:41 am
by arne_v
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