Author Topic: SQL Relay  (Read 246 times)

TimoVJL

  • Member
  • ***
  • Posts: 476
SQL Relay
« on: July 13, 2019, 01:15:31 AM »
An interesting system:
http://sqlrelay.sourceforge.net/index.html
https://sourceforge.net/projects/sqlrelay/

Has anyone tested it ?

I have problems with that ODBC driver, when using SQLDriverConnect() with non DSN connection strings. EDIT: it will be fixed in next versio :thup:

Have anyone tried it with oracle 11/12 ?

It has own client library, so you can do this
Code: [Select]
//#include <sqlrelay/sqlrclientwrapper.h>
#include <stdio.h>
#include <stdint.h>

#pragma comment(lib, "libsqlrclientwrapper.lib")

#define SQLRCLIENT_DLLSPEC __declspec(dllimport)

typedef struct sqlrconnection *sqlrcon;
typedef struct sqlrcursor *sqlrcur;

SQLRCLIENT_DLLSPEC sqlrcon sqlrcon_alloc(const char *server, uint16_t port, const char *socket, const char *user, const char *password, int32_t retrytime, int32_t tries);
SQLRCLIENT_DLLSPEC void sqlrcon_free(sqlrcon sqlrconref);
SQLRCLIENT_DLLSPEC sqlrcur sqlrcur_alloc(sqlrcon sqlrconref);
SQLRCLIENT_DLLSPEC void sqlrcur_free(sqlrcur sqlrcurref);
SQLRCLIENT_DLLSPEC int sqlrcur_sendQuery(sqlrcur sqlrcurref, const char *query);
SQLRCLIENT_DLLSPEC const char *sqlrcur_errorMessage(sqlrcur sqlrcurref);
SQLRCLIENT_DLLSPEC void sqlrcon_endSession(sqlrcon sqlrconref);
SQLRCLIENT_DLLSPEC uint32_t sqlrcur_colCount(sqlrcur sqlrcurref);
SQLRCLIENT_DLLSPEC uint64_t sqlrcur_rowCount(sqlrcur sqlrcurref);
SQLRCLIENT_DLLSPEC const char * const *sqlrcur_getRow(sqlrcur sqlrcurref, uint64_t row);

int __cdecl main(void)
{
sqlrcon con = sqlrcon_alloc("localhost", 9000, 0, "test", "test", 0, 1);
sqlrcur cur = sqlrcur_alloc(con);
if (!sqlrcur_sendQuery(cur, "SELECT * FROM test"))
{
printf("%s\n", sqlrcur_errorMessage(cur));
sqlrcon_endSession(con);
} else {
sqlrcon_endSession(con);
for (uint64_t row = 0; row < sqlrcur_rowCount(cur); row++)
{
char **rowarray = (char **)sqlrcur_getRow(cur, row);
for (uint64_t col = 0; col < sqlrcur_colCount(cur); col++)
printf("%s,", rowarray[col]);
printf("\n");
}
}
sqlrcur_free(cur);
sqlrcon_free(con);
return 0;
}
x64 dlls
Code: [Select]
librudiments.dll 475 648
libsqlrclient.dll 163 840
libsqlrclientwrapper.dll 26 112
« Last Edit: July 16, 2019, 01:08:09 AM by TimoVJL »
May the source be with you