SQLRelay
-
Topic author - Master
- Posts: 485
- Joined: Fri Apr 17, 2020 7:31 pm
- Reputation: 0
- Location: Rhode Island, USA
- Status: Offline
- Contact:
SQLRelay
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?
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?
-
Topic author - Master
- Posts: 485
- Joined: Fri Apr 17, 2020 7:31 pm
- Reputation: 0
- Location: Rhode Island, USA
- Status: Offline
- Contact:
Re: SQLRelay
I also tried the Pascal API.
And sqlr$cur_inputbindstring is giving me problem here.
And sqlr$cur_inputbindstring is giving me problem here.
-
- VSI Expert
- Visitor
- Posts: 1
- Joined: Tue May 18, 2021 3:12 am
- Reputation: 0
- Status: Offline
Re: SQLRelay
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.
-
Topic author - Master
- Posts: 485
- Joined: Fri Apr 17, 2020 7:31 pm
- Reputation: 0
- Location: Rhode Island, USA
- Status: Offline
- Contact:
Re: SQLRelay
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.
Added in 2 minutes 45 seconds:
Hmmm. https://vmssoftware.com/products/sql-relay/only has 1.9-0A.
-
- VSI Expert
- Active Contributor
- Posts: 25
- Joined: Mon Jun 24, 2019 9:51 am
- Reputation: 0
- Status: Offline
Re: SQLRelay
Arne, the kit has not yet been generally released. Contact me or VSI Support directly and we'll sort out getting you a copy.
-
Topic author - Master
- Posts: 485
- Joined: Fri Apr 17, 2020 7:31 pm
- Reputation: 0
- Location: Rhode Island, USA
- Status: Offline
- Contact:
Re: SQLRelay
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
With some help from VSI I got it working.
The result can be seen here:
https://www.vajhoej.dk/arne/articles/vmstd2.html