Skip to content

Commit

Permalink
uuid is added as result of execquote and insertorder
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierch committed Aug 10, 2012
1 parent a669a81 commit 53e884d
Show file tree
Hide file tree
Showing 12 changed files with 175 additions and 114 deletions.
Binary file modified doc/doc-ob.odt
Binary file not shown.
Binary file modified doc/doc-ob.pdf
Binary file not shown.
Binary file modified doc/paper-ob.odt
Binary file not shown.
Binary file modified doc/paper-ob.pdf
Binary file not shown.
32 changes: 32 additions & 0 deletions simu/testopt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/python
# -*- coding: utf8 -*-



from optparse import OptionParser

def main():
usage = "usage: %prog [options] arg"
parser = OptionParser(usage)
parser.add_option("-f", "--file", dest="filename",
help="read data from FILENAME")
parser.add_option("-v", "--verbose",
action="store_true", dest="verbose")
parser.add_option("-q", "--quiet",
action="store_false", dest="verbose")
parser.add_option("-r", "--reset",action="store_true", dest="reset",help="database is reset",default=False)
parser.add_option("--MAXTRY",type="int",dest="MAXTRY",help="reset MAXTRY")

(options, args) = parser.parse_args()
if len(args) != 1:
parser.error("incorrect number of arguments")
if options.verbose:
print "reading %s..." % options.filename
print options.reset
print options.MAXTRY
print "args %s" % args

if __name__ == "__main__":
main()


4 changes: 2 additions & 2 deletions src/expected/testflow_1.out
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ SET client_min_messages = warning;

(1 row)

psql:sql/model.sql:2105: INFO: market_status INITIALIZING->OPENED
psql:sql/model.sql:2105: INFO: The market is now opened for clients
psql:sql/model.sql:2132: INFO: market_status INITIALIZING->OPENED
psql:sql/model.sql:2132: INFO: The market is now opened for clients
fchangestatemarket
--------------------
OPENED
Expand Down
28 changes: 14 additions & 14 deletions src/expected/testflow_2.out
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ INFO: The market is opened for this user
select * from finsertorder('u',fq('b'),1000,1000,fq('a'));
INFO: owner u created
CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment
PL/pgSQL function "finsertorder" line 19 at assignment
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-------+---------+---------
1 | 1 | 2 | 1000 | 1 | 1000 | 0 | 0 | {} | |
PL/pgSQL function "finsertorder" line 20 at assignment
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-------
1 | 1-1 | 1 | 2 | 1000 | 1 | 1000 | 0 | 0 | {}
(1 row)

select * from finsertorder('v',fq('c'),1000,1000,fq('b'));
INFO: owner v created
CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment
PL/pgSQL function "finsertorder" line 19 at assignment
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-------+---------+---------
2 | 2 | 1 | 1000 | 3 | 1000 | 0 | 0 | {} | |
PL/pgSQL function "finsertorder" line 20 at assignment
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-------
2 | 1-2 | 2 | 1 | 1000 | 3 | 1000 | 0 | 0 | {}
(1 row)

select id,nr,qtt_requ,np,qtt_prov,qtt_in,qtt_out,flows from fgetquote('w',fq('a'),1000,1000,fq('c'));
Expand Down Expand Up @@ -69,15 +69,15 @@ select * from fremoveagreement(1);
(1 row)

select * from finsertorder('u',fq('b'),2000,1000,fq('a'));
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-------+---------+---------
4 | 1 | 2 | 1000 | 1 | 2000 | 0 | 0 | {} | |
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-------
4 | 1-4 | 1 | 2 | 1000 | 1 | 2000 | 0 | 0 | {}
(1 row)

select * from finsertorder('v',fq('c'),2000,1000,fq('b'));
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-------+---------+---------
5 | 2 | 1 | 1000 | 3 | 2000 | 0 | 0 | {} | |
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-------
5 | 1-5 | 2 | 1 | 1000 | 3 | 2000 | 0 | 0 | {}
(1 row)

select id,nr,qtt_requ,np,qtt_prov,qtt_in,qtt_out,flows from fgetquote('w',fq('a'),500,2000,fq('c'));
Expand Down
60 changes: 30 additions & 30 deletions src/expected/testflow_4.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
select * from finsertorder('x','b',160,40,'a');
INFO: owner x created
CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment
PL/pgSQL function "finsertorder" line 19 at assignment
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-------+---------+---------
8 | 4 | 5 | 40 | 4 | 160 | 0 | 0 | {} | |
PL/pgSQL function "finsertorder" line 20 at assignment
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-------
8 | 1-8 | 4 | 5 | 40 | 4 | 160 | 0 | 0 | {}
(1 row)

select * from finsertorder('y','c',160,80,'b');
INFO: owner y created
CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment
PL/pgSQL function "finsertorder" line 19 at assignment
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-------+---------+---------
9 | 5 | 4 | 80 | 6 | 160 | 0 | 0 | {} | |
PL/pgSQL function "finsertorder" line 20 at assignment
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-------
9 | 1-9 | 5 | 4 | 80 | 6 | 160 | 0 | 0 | {}
(1 row)

select * from finsertorder('t','c',100,100,'a');
INFO: owner t created
CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment
PL/pgSQL function "finsertorder" line 19 at assignment
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-------+---------+---------
10 | 6 | 5 | 100 | 6 | 100 | 0 | 0 | {} | |
PL/pgSQL function "finsertorder" line 20 at assignment
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-------
10 | 1-10 | 6 | 5 | 100 | 6 | 100 | 0 | 0 | {}
(1 row)

select * from fgetquote('z','a',20,0,'c'); -- expected (qtt_prov,qtt_requ)= (20,160)
Expand Down Expand Up @@ -68,9 +68,9 @@ select * from fgetquote('z','a',100,0,'c'); -- expected (qtt_in,qtt_out)= (100,1
(1 row)

select * from finsertorder('z','a',100,100,'c'); -- one agreements
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-----------------------------------------------------------------+---------+---------
12 | 7 | 6 | 100 | 5 | 100 | 100 | 100 | {"[(10, 6, 5, 100, 6, 100, 100),(12, 7, 6, 100, 5, 100, 100)]"} | |
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-----------------------------------------------------------------
12 | 1-12 | 7 | 6 | 100 | 5 | 100 | 100 | 100 | {"[(10, 6, 5, 100, 6, 100, 100),(12, 7, 6, 100, 5, 100, 100)]"}
(1 row)

select * from fgetagr(12) where _own='z'; -- expected as first quote
Expand All @@ -80,21 +80,21 @@ select * from fgetagr(12) where _own='z'; -- expected as first quote
(1 row)

select * from finsertorder('x','b2',160,40,'a2');
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-------+---------+---------
13 | 4 | 8 | 40 | 7 | 160 | 0 | 0 | {} | |
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-------
13 | 1-13 | 4 | 8 | 40 | 7 | 160 | 0 | 0 | {}
(1 row)

select * from finsertorder('y','c2',160,80,'b2');
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-------+---------+---------
14 | 5 | 7 | 80 | 9 | 160 | 0 | 0 | {} | |
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-------
14 | 1-14 | 5 | 7 | 80 | 9 | 160 | 0 | 0 | {}
(1 row)

select * from finsertorder('t','c2',90,10,'a2');
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-------+---------+---------
15 | 6 | 8 | 10 | 9 | 90 | 0 | 0 | {} | |
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-------
15 | 1-15 | 6 | 8 | 10 | 9 | 90 | 0 | 0 | {}
(1 row)

select * from fgetquote('z','a2',10,0,'c2');-- expected (qtt_in,qtt_out)= (90,10)
Expand All @@ -104,9 +104,9 @@ select * from fgetquote('z','a2',10,0,'c2');-- expected (qtt_in,qtt_out)= (90,10
(1 row)

select * from finsertorder('z','a2',10,90,'c2');
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+-----------------------------------------------------------+---------+---------
16 | 7 | 9 | 90 | 8 | 10 | 90 | 10 | {"[(15, 6, 8, 10, 9, 90, 90),(16, 7, 9, 90, 8, 10, 10)]"} | |
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+-----------------------------------------------------------
16 | 1-16 | 7 | 9 | 90 | 8 | 10 | 90 | 10 | {"[(15, 6, 8, 10, 9, 90, 90),(16, 7, 9, 90, 8, 10, 10)]"}
(1 row)

select * from fgetagr(14) where _own='z'; -- expected as first quote
Expand All @@ -122,9 +122,9 @@ select * from fgetquote('z','a2',20,0,'c2'); -- expected (qtt_in,qtt_out)= (160,
(1 row)

select * from finsertorder('z','a2',20,160,'c2');
id | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows | created | removed
----+-----+----+----------+----+----------+--------+---------+------------------------------------------------------------------------------------------+---------+---------
17 | 7 | 9 | 160 | 8 | 20 | 160 | 20 | {"[(13, 4, 8, 40, 7, 160, 160),(14, 5, 7, 80, 9, 160, 160),(17, 7, 9, 160, 8, 20, 20)]"} | |
id | uuid | own | nr | qtt_requ | np | qtt_prov | qtt_in | qtt_out | flows
----+------+-----+----+----------+----+----------+--------+---------+------------------------------------------------------------------------------------------
17 | 1-17 | 7 | 9 | 160 | 8 | 20 | 160 | 20 | {"[(13, 4, 8, 40, 7, 160, 160),(14, 5, 7, 80, 9, 160, 160),(17, 7, 9, 160, 8, 20, 20)]"}
(1 row)

select * from fgetagr(16) where _own='z'; -- expected as first quote
Expand Down
40 changes: 20 additions & 20 deletions src/expected/testflow_5.out
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ set role client;
select finsertorder('u','b',1000,1000,'a');
INFO: owner u created
CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment
PL/pgSQL function "finsertorder" line 19 at assignment
finsertorder
------------------------------
(1,1,2,1000,1,1000,0,0,{},,)
PL/pgSQL function "finsertorder" line 20 at assignment
finsertorder
--------------------------------
(1,2-1,1,2,1000,1,1000,0,0,{})
(1 row)

select finsertorder('v','c',1000,1000,'b');
INFO: owner v created
CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment
PL/pgSQL function "finsertorder" line 19 at assignment
finsertorder
------------------------------
(2,2,1,1000,3,1000,0,0,{},,)
PL/pgSQL function "finsertorder" line 20 at assignment
finsertorder
--------------------------------
(2,2-2,2,1,1000,3,1000,0,0,{})
(1 row)

select qtt_in,qtt_out from fgetquote('w','a',1000,0,'c');
Expand All @@ -93,9 +93,9 @@ PL/pgSQL function "fgetquote" line 36 at assignment
(1 row)

select finsertorder('w','a',1000,1000,'c');
finsertorder
----------------------------------------------------------------------------------------------------------------------------------------
(3,3,3,1000,2,1000,1000,1000,"{""[(1, 1, 2, 1000, 1, 1000, 1000),(2, 2, 1, 1000, 3, 1000, 1000),(3, 3, 3, 1000, 2, 1000, 1000)]""}",,)
finsertorder
------------------------------------------------------------------------------------------------------------------------------------------
(3,2-3,3,3,1000,2,1000,1000,1000,"{""[(1, 1, 2, 1000, 1, 1000, 1000),(2, 2, 1, 1000, 3, 1000, 1000),(3, 3, 3, 1000, 2, 1000, 1000)]""}")
(1 row)

select id,nb,oruuid,grp,provider,quality,qtt,receiver from vmvt;
Expand All @@ -121,15 +121,15 @@ select id,qtt from tquality;
(3 rows)

select finsertorder('u','b',2000,1000,'a');
finsertorder
------------------------------
(4,1,2,1000,1,2000,0,0,{},,)
finsertorder
--------------------------------
(4,2-4,1,2,1000,1,2000,0,0,{})
(1 row)

select finsertorder('v','c',2000,1000,'b');
finsertorder
------------------------------
(5,2,1,1000,3,2000,0,0,{},,)
finsertorder
--------------------------------
(5,2-5,2,1,1000,3,2000,0,0,{})
(1 row)

select qtt_in,qtt_out from fgetquote('w','a',500,0,'c');
Expand Down Expand Up @@ -172,9 +172,9 @@ select fgetquote('w','a',500,0,'b');
(1 row)

select finsertorder('w','a',500,1000,'b');
finsertorder
-----------------------------------------------------------------------------------------------------
(7,3,1,1000,2,500,1000,500,"{""[(4, 1, 2, 1000, 1, 2000, 1000),(7, 3, 1, 1000, 2, 500, 500)]""}",,)
finsertorder
-------------------------------------------------------------------------------------------------------
(7,2-7,3,1,1000,2,500,1000,500,"{""[(4, 1, 2, 1000, 1, 2000, 1000),(7, 3, 1, 1000, 2, 500, 500)]""}")
(1 row)

set role admin;
Expand Down
32 changes: 16 additions & 16 deletions src/expected/testflow_6.out
Original file line number Diff line number Diff line change
Expand Up @@ -71,31 +71,31 @@ INFO: The market is reset and opened
select finsertorder('A','z',200 ,200 ,'x');
INFO: owner A created
CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment
PL/pgSQL function "finsertorder" line 19 at assignment
finsertorder
----------------------------
(1,1,2,200,1,200,0,0,{},,)
PL/pgSQL function "finsertorder" line 20 at assignment
finsertorder
------------------------------
(1,4-1,1,2,200,1,200,0,0,{})
(1 row)

-- path (a)
-- select finsertorder('B','x',25 ,200 ,'y');
select finsertorder('B','y',200 ,25 ,'x');
INFO: owner B created
CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment
PL/pgSQL function "finsertorder" line 19 at assignment
finsertorder
---------------------------
(2,2,2,25,3,200,0,0,{},,)
PL/pgSQL function "finsertorder" line 20 at assignment
finsertorder
-----------------------------
(2,4-2,2,2,25,3,200,0,0,{})
(1 row)

--select finsertorder('C','y',100 ,100 ,'z');
select finsertorder('C','z',100 ,100 ,'y');
INFO: owner C created
CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment
PL/pgSQL function "finsertorder" line 19 at assignment
finsertorder
----------------------------
(3,3,3,100,1,100,0,0,{},,)
PL/pgSQL function "finsertorder" line 20 at assignment
finsertorder
------------------------------
(3,4-3,3,3,100,1,100,0,0,{})
(1 row)

-- no exchange
Expand All @@ -108,10 +108,10 @@ select id,nb,oruuid,grp,provider,quality,qtt,receiver from vmvt;
select finsertorder('D','x',250 ,250 ,'z');
INFO: owner D created
CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment
PL/pgSQL function "finsertorder" line 19 at assignment
finsertorder
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(4,4,1,250,2,250,300,250,"{""[(2, 2, 2, 25, 3, 200, 200),(3, 3, 3, 100, 1, 100, 100),(4, 4, 1, 250, 2, 250, 250)]"",""[(1, 1, 2, 200, 1, 200, 200),(4, 4, 1, 250, 2, 250, 200)]""}",,)
PL/pgSQL function "finsertorder" line 20 at assignment
finsertorder
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(4,4-4,4,1,250,2,250,300,250,"{""[(2, 2, 2, 25, 3, 200, 200),(3, 3, 3, 100, 1, 100, 100),(4, 4, 1, 250, 2, 250, 250)]"",""[(1, 1, 2, 200, 1, 200, 200),(4, 4, 1, 250, 2, 250, 200)]""}")
(1 row)

--two exchanges in a single transaction
Expand Down
Loading

0 comments on commit 53e884d

Please sign in to comment.