Skip to content
Snippets Groups Projects
Commit 2ca6cdb4 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Sql.rsql: Implemented generic proxy of functions.

parent 2d602246
No related branches found
No related tags found
No related merge requests found
...@@ -115,6 +115,11 @@ protected mixed do_request(int cmd, mixed|void arg, int|void noreconnect) ...@@ -115,6 +115,11 @@ protected mixed do_request(int cmd, mixed|void arg, int|void noreconnect)
} }
} }
protected mixed do_proxy(string cmd, array(mixed) args)
{
return do_request('P', ({ cmd, args }));
}
void select_db(string the_db) void select_db(string the_db)
{ {
do_request('D', the_db); do_request('D', the_db);
...@@ -285,6 +290,14 @@ void set_charset(string charset) ...@@ -285,6 +290,14 @@ void set_charset(string charset)
do_request('H', charset); do_request('H', charset);
} }
protected function|mixed `->(string cmd)
{
return ::`->(cmd) ||
lambda(mixed ... args) {
return do_proxy(cmd, args);
};
}
void create(string|void host, string|void db, string|void user, void create(string|void host, string|void db, string|void user,
string|void _pw, mapping|void options) string|void _pw, mapping|void options)
{ {
......
...@@ -278,6 +278,11 @@ class Connection ...@@ -278,6 +278,11 @@ class Connection
get_query(args[0])->seek(args[1]); get_query(args[0])->seek(args[1]);
} }
protected mixed cmd_proxy(array(string|mixed) cmd_args)
{
return predef::`->(sqlobj, cmd_args[0])(@cmd_args[1]);
}
protected string cmd_get_charset() protected string cmd_get_charset()
{ {
return sqlobj->get_charset(); return sqlobj->get_charset();
...@@ -311,6 +316,7 @@ class Connection ...@@ -311,6 +316,7 @@ class Connection
'H': cmd_set_charset, 'H': cmd_set_charset,
'I': cmd_srvinfo, 'I': cmd_srvinfo,
'N': cmd_numrows, 'N': cmd_numrows,
'P': cmd_proxy,
'Q': cmd_bigquery, 'Q': cmd_bigquery,
'R': cmd_fetchrow, 'R': cmd_fetchrow,
'S': cmd_seek, 'S': cmd_seek,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment