a firstworks project
SQL Relay
About Documentation Download Licensing Support News

Native API

The native SQL Relay client API currently supports C, C++, .NET languages, Java, Perl, Python, PHP, Ruby, TCL, Erlang, and node.js.

The native API is intuitive, consistent across languages, and supports powerful features not available when using a database abstraction layer like suspended sessions, result set caching and tuning options.

Programming guides with sample code and API references are available for each language:

Guides: C++, C, C#, Perl, PHP, Python, Ruby, Java, TCL, Erlang, node.js

References: C++, C, C#, Perl, PHP, Python, Ruby, Java, TCL, node.js

C++

#include <sqlrelay/sqlrclient.h>
#include <rudiments/stdio.h>

using namespace rudiments;

int main() {

	sqlrconnection	sqlrcon("examplehost",9000,
				"/tmp/example.socket",
				"exampleuser",
				"examplepassword",0,1);
	sqlrcursor	sqlrcur(&sqlrcon);

	sqlrcur.sendQuery("select * from exampletable");
	for (uint64_t row=0; row<sqlrcur.rowCount(); row++) {
		for (uint64_t col=0; col<sqlrcur.colCount(); col++) {
			stdoutput.printf("%s,",sqlrcur.getField(row,col));
		}
		stdoutput.printf("\n");
	}
}

Copyright 2017 - David Muse - Contact