Skip to content
This repository
Browse code

Add a test for spi_exec

Currently fails for me with:
    No NCI thunk available for signature 'itil'
  • Loading branch information...
commit 141afe2730d2e0423092ba4e7c58a2fdf9700dae 1 parent 8fe697a
Duke Leto authored August 02, 2010

Showing 1 changed file with 9 additions and 1 deletion. Show diff stats Hide diff stats

  1. 10  t/sql/test.sql
10  t/sql/test.sql
@@ -15,7 +15,7 @@ BEGIN;
15 15
 \i plparrot.sql
16 16
 
17 17
 -- Plan the tests.
18  
-SELECT plan(31);
  18
+SELECT plan(33);
19 19
 
20 20
 CREATE OR REPLACE FUNCTION create_plparrot()
21 21
 RETURNS BOOLEAN
@@ -211,6 +211,13 @@ CREATE FUNCTION test_spi_elog() RETURNS void AS $$
211 211
     elog(18, 'elog works!') # no constants yet, 18 == NOTICE
212 212
 $$ LANGUAGE plparrot;
213 213
 
  214
+CREATE or replace FUNCTION test_spi_exec() RETURNS char AS $$
  215
+    .local pmc exec, res
  216
+    exec = get_root_global ['parrot';'PLParrot';'SPI'], 'SPI_execute'
  217
+    res = exec('insert into foo(a) values (1)', 0, 1)
  218
+    .return('ok')
  219
+$$ LANGUAGE plparrot;
  220
+
214 221
 
215 222
 
216 223
 select is(test_load_pir_library(), 5, 'we can .include PIR libraries included with Parrot');
@@ -271,6 +278,7 @@ select is(test_time_out('04:05:06'),'04:05:06','We can return a time');
271 278
 -- not loading io opcodes, they are deprecated
272 279
 --select isnt(test_open_plparrotu(), 42, 'open opcode is not mocked in plperlu');
273 280
 
  281
+select is(test_spi_exec(), 'ok', 'SPI: basic spi_exec');
274 282
 select is(test_spi_elog()::text, ''::text, 'SPI: elog');
275 283
 
276 284
 -- Finish the tests and clean up.

0 notes on commit 141afe2

Please sign in to comment.
Something went wrong with that request. Please try again.