Skip to content

Commit 9712bab

Browse files
sql query preview
1 parent d34aba6 commit 9712bab

12 files changed

Lines changed: 746 additions & 271 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
SET PERSIST vsql_allow_preview_extensions = ON;
2+
INSTALL EXTENSION vsql_thread_worker_test;
3+
SET GLOBAL vsql_thread_worker_test.listener_enabled = ON;
4+
# Send QUERY SELECT 42
5+
SELECT vsql_thread_worker_test.active_port() INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/tw_sq_port.txt';
6+
# last_monitor_result should be 42
7+
SELECT vsql_thread_worker_test.last_monitor_result();
8+
vsql_thread_worker_test.last_monitor_result()
9+
42
10+
SET GLOBAL vsql_thread_worker_test.listener_enabled = OFF;
11+
UNINSTALL EXTENSION vsql_thread_worker_test;
12+
SET PERSIST vsql_allow_preview_extensions = OFF;
13+
RESET PERSIST vsql_allow_preview_extensions;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Test thread_worker sql_query capability.
2+
#
3+
# Verifies:
4+
# - Worker accepts "QUERY <sql>" commands over TCP
5+
# - Worker executes the SQL via the sql_query capability
6+
# - last_monitor_result() VDF returns the first column of the first row
7+
8+
SET PERSIST vsql_allow_preview_extensions = ON;
9+
10+
INSTALL EXTENSION vsql_thread_worker_test;
11+
12+
SET GLOBAL vsql_thread_worker_test.listener_enabled = ON;
13+
14+
--let $port_file = $MYSQLTEST_VARDIR/tmp/tw_sq_port.txt
15+
16+
--echo # Send QUERY SELECT 42
17+
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
18+
eval SELECT vsql_thread_worker_test.active_port() INTO OUTFILE '$port_file';
19+
--perl
20+
use IO::Socket::INET;
21+
open(my $fh, '<', $ENV{MYSQLTEST_VARDIR} . '/tmp/tw_sq_port.txt') or die $!;
22+
my $port = <$fh>; chomp $port;
23+
close($fh);
24+
my $sock = IO::Socket::INET->new(
25+
PeerAddr => "127.0.0.1",
26+
PeerPort => $port,
27+
Proto => "tcp",
28+
Timeout => 5,
29+
) or die "connect failed: $!";
30+
$sock->autoflush(1);
31+
print $sock "QUERY SELECT 42\n";
32+
shutdown($sock, 1);
33+
close($sock);
34+
EOF
35+
--remove_file $port_file
36+
37+
--let $wait_condition = SELECT vsql_thread_worker_test.last_monitor_result() = '42'
38+
--source include/wait_condition.inc
39+
40+
--echo # last_monitor_result should be 42
41+
SELECT vsql_thread_worker_test.last_monitor_result();
42+
43+
SET GLOBAL vsql_thread_worker_test.listener_enabled = OFF;
44+
45+
UNINSTALL EXTENSION vsql_thread_worker_test;
46+
47+
SET PERSIST vsql_allow_preview_extensions = OFF;
48+
RESET PERSIST vsql_allow_preview_extensions;

villagesql/examples/vsql-http-monitor/CMakeLists.txt

Lines changed: 0 additions & 54 deletions
This file was deleted.

villagesql/examples/vsql-http-monitor/manifest.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

villagesql/examples/vsql-http-monitor/src/extension.cc

Lines changed: 0 additions & 206 deletions
This file was deleted.

0 commit comments

Comments
 (0)