text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
set current_schema=postgis; --S1.验证操作符&& SELECT geom_point.the_geom && geom_line.the_geom AS result FROM geom_point, geom_line order by geom_point.name,geom_line.name limit 10; SELECT geom_multipoint.the_geom && geom_multilinestring.the_geom AS result FROM geom_multipoint, geom_multilinestring order by geom_multipoint.name,geom_multilinestring.name limit 10; --S2.验证操作符&&& SELECT geom_multipoint.the_geom &&& geom_multipolygon.the_geom AS overlaps_3d from geom_multipoint, geom_multipolygon order by geom_multipoint.name,geom_multipolygon.id limit 10; SELECT geom_multipoint.the_geom &&& geom_point.the_geom AS overlaps_3d from geom_multipoint, geom_point order by geom_point.name,geom_multipoint.name limit 10; --S3.验证操作符&< SELECT geom_polygon.the_geom &< geom_multilinestring.the_geom AS result FROM geom_polygon, geom_multilinestring order by geom_polygon.name, geom_multilinestring.id limit 10; --S4.验证操作符&<| SELECT geom_multipolygon.the_geom &< geom_multilinestring.the_geom AS result FROM geom_multipolygon, geom_multilinestring order by geom_multipolygon.id,geom_multilinestring.name limit 10; --S5.验证操作符&> SELECT geom_polygon.the_geom &> geom_multilinestring.the_geom AS result FROM geom_polygon, geom_multilinestring order by geom_polygon.name, geom_multilinestring.id limit 10; --S6.验证操作符<< SELECT geom_line.the_geom << geom_multilinestring.the_geom AS result from geom_line, geom_multilinestring order by geom_line.id, geom_multilinestring.id limit 10; --S8.验证操作符= SELECT 'LINESTRING(0 0, 0 1, 1 0)'::geometry = 'LINESTRING(1 1, 0 0)'::geometry; --S9.验证操作符>> SELECT geom_line.the_geom >> geom_multilinestring.the_geom AS result from geom_line, geom_multilinestring order by geom_line.id,geom_multipolygon.id limit 10; --S10.验证操作iii符@ SELECT geom_point.the_geom @ geom_multipolygon.the_geom AS result from geom_point, geom_multipolygon order by geom_point.id,geom_multipolygon.id limit 10; --S11.验证操作符|&> SELECT geom_point.the_geom |&> geom_multipolygon.the_geom AS result from geom_point, geom_multipolygon order by geom_point.id,geom_multipolygon.id limit 10; --S12.验证操作符|>> SELECT geom_point.the_geom |>> geom_multipolygon.the_geom AS result from geom_point, geom_multipolygon order by geom_point.id,geom_multipolygon.id limit 10; --S13.验证操作符~ SELECT geom_point.the_geom ~ geom_multipolygon.the_geom AS result from geom_point, geom_multipolygon order by geom_point.id,geom_multipolygon.id limit 10; --S14.验证操作符~= SELECT geom_point.the_geom ~= geom_multipolygon.the_geom AS result from geom_point, geom_multipolygon order by geom_point.id,geom_multipolygon.id limit 10; --S15.验证操作符<-> SELECT geom_point.the_geom <-> geom_multipolygon.the_geom AS result from geom_point, geom_multipolygon order by geom_point.id,geom_multipolygon.id limit 10; --S16.验证操作符<#> SELECT '<#>',geom_point.id, geom_point.the_geom <#> geom_multipolygon.the_geom AS result from geom_point, geom_multipolygon order by geom_point.id,geom_multipolygon.id limit 10; SELECT ST_AsText(ST_Union(ST_GeomFromText('POINT(1 2)'), ST_GeomFromText('POINT(-2 3)') ) ); SELECT ST_AsText(ST_Union(ST_GeomFromText('POINT(1 2)'), ST_GeomFromText('POINT(1 2)') ) ); SELECT ST_AsEWKT(st_union(the_geom)) FROM (SELECT ST_GeomFromEWKT('POLYGON((-7 4.2,-7.1 4.2,-7.1 4.3, -7 4.2))') as the_geom UNION ALL SELECT ST_GeomFromEWKT('POINT(5 5 5)') as the_geom UNION ALL SELECT ST_GeomFromEWKT('POINT(-2 3 1)') as the_geom UNION ALL SELECT ST_GeomFromEWKT('LINESTRING(5 5 5, 10 10 10)') as the_geom ) as foo; SELECT ST_AsText(ST_Union(ARRAY[ST_GeomFromText('LINESTRING(1 2, 3 4)'), ST_GeomFromText('LINESTRING(3 4, 4 5)')])) As wktunion; SELECT ST_AsText(ST_CollectionExtract(ST_GeomFromText('GEOMETRYCOLLECTION( GEOMETRYCOLLECTION(POINT(0 0)))'),1)); SELECT ST_AsText(ST_CollectionExtract(ST_GeomFromText('GEOMETRYCOLLECTION( GEOMETRYCOLLECTION(LINESTRING(0 0, 1 1)),LINESTRING(2 2, 3 3))'),2)); SELECT ST_AsEWKT(ST_PatchN(geom, 2)) As geomewkt FROM ( VALUES (ST_GeomFromEWKT('POLYHEDRALSURFACE( ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)), ((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)) )')) ) As foo(geom); SELECT ST_AsText( ST_PointFromWKB( ST_AsEWKB('POINT(2 5)'::geometry) ) ); SELECT ST_3DMakeBox(ST_MakePoint(-989502.1875, 528439.5625, 10), ST_MakePoint(-987121.375 ,529933.1875, 10)) As abb3d; SELECT ST_AsEWKT(ST_Force2D(ST_GeomFromEWKT('CIRCULARSTRING(1 1 2, 2 3 2, 4 5 2, 6 7 2, 5 6 2)'))); SELECT ST_AsEWKT(ST_Force2D('POLYGON((0 0 2,0 5 2,5 0 2,0 0 2),(1 1 2,3 1 2,1 3 2,1 1 2)) ')); SELECT tbl1.column1, tbl2.column1, tbl1.column2 ~ tbl2.column2 AS contains FROM ( VALUES (1, 'LINESTRING (0 0, 3 3)'::geometry)) AS tbl1, ( VALUES (2, 'LINESTRING (0 0, 4 4)'::geometry), (3, 'LINESTRING (1 1, 2 2)'::geometry), (4, 'LINESTRING (0 0, 3 3)'::geometry)) AS tbl2; SELECT ST_AsGML(ST_GeomFromText('POLYGON((0 0,0 1,1 1,1 0,0 0))',4326)); SELECT ST_AsGML(3, ST_GeomFromText('POINT(5.234234233242 6.34534534534)',4326), 5, 17); SELECT ST_AsGML(3, ST_GeomFromText('LINESTRING(1 2, 3 4, 10 20)',4326), 5, 32); SELECT ST_AsGML(3, ST_GeomFromText('LINESTRING(1 2, 3 4, 10 20)',4326), 5, 49); SELECT ST_AsText( ST_LongestLine('POINT(100 100)':: geometry, 'LINESTRING (20 80, 98 190, 110 180, 50 75 )'::geometry) ) As lline; SELECT ST_AsText( ST_LongestLine( ST_GeomFromText('POLYGON ((175 150, 20 40, 50 60, 125 100, 175 150))'), ST_Buffer(ST_GeomFromText ('POINT(110 170)'), 20) ) ) As llinewkt; SELECT ST_AsText(ST_LongestLine(c.the_geom, c.the_geom)) As llinewkt, ST_MaxDistance(c.the_geom,c.the_geom) As max_dist, ST_Length(ST_LongestLine(c.the_geom, c.the_geom)) As lenll FROM (SELECT ST_BuildArea(ST_Collect(the_geom)) As the_geom FROM (SELECT ST_Translate(ST_SnapToGrid(ST_Buffer(ST_Point(50 ,generate_series (50,190, 50) ),40, 'quad_segs=2'),1), x, 0) As the_geom FROM generate_series(1,100,50) As x) AS foo ) As c; SELECT ST_AsEWKT(ST_LocateBetweenElevations( ST_GeomFromEWKT('LINESTRING(1 2 3, 4 5 6)'),2,4)) As ewelev; SELECT ST_AsEWKT(ST_LocateBetweenElevations( ST_GeomFromEWKT('LINESTRING(1 2 6, 4 5 -1, 7 8 9)'),6,9)) As ewelev; SELECT ST_AsEWKT((ST_Dump(the_geom)).geom) FROM (SELECT ST_LocateBetweenElevations( ST_GeomFromEWKT('LINESTRING(1 2 6, 4 5 -1, 7 8 9)'),6,9) As the_geom) As foo; SELECT ST_LineFromText('LINESTRING(1 2, 3 4)') AS aline, ST_LineFromText('POINT(1 2)') AS null_return; SELECT ST_astext(ST_GeomFromEWKB(E'\\001\\002\\000\\000 \\255\\020\\000\\000\\003\\000\\000\\000\\344J=\\013B\\312Q\\300n\\303(\\010\\036!E@''\\277E''K\\312Q\\300\\366{b\\235*!E@\\225|\\354.P\\312Q\\300p\\231\\323e1!E@')); SELECT Box3D(ST_GeomFromEWKT('LINESTRING(1 2 3, 3 4 5, 5 6 5)')); SELECT Box3D(ST_GeomFromEWKT('CIRCULARSTRING(220268 150415 1,220227 150505 1,220227 150406 1)')); SELECT tbl1.column1, tbl2.column1, tbl1.column2 &> tbl2.column2 AS overright FROM ( VALUES (1, 'LINESTRING(1 2, 4 6)'::geometry)) AS tbl1, ( VALUES (2, 'LINESTRING(0 0, 3 3)'::geometry), (3, 'LINESTRING(0 1, 0 5)'::geometry), (4, 'LINESTRING(6 0, 6 1)'::geometry)) AS tbl2; SELECT ST_AsEWKT(ST_LineFromMultiPoint(ST_GeomFromEWKT('MULTIPOINT(1 2 3, 4 5 6, 7 8 9)'))); SELECT ST_AsText(ST_GeomFromGeoHash('9qqj7nmxncgyy4d0dbxqz0')); SELECT ST_AsText(ST_GeomFromGeoHash('9qqj7nmxncgyy4d0dbxqz0', 4)); SELECT ST_AsText(ST_GeomFromGeoHash('9qqj7nmxncgyy4d0dbxqz0', 10)); SELECT ST_AsEWKT(ST_RotateX(ST_GeomFromEWKT('LINESTRING(1 2 3, 1 1 1)'), pi()/2)); SELECT ST_AsEWKT(ST_Shift_Longitude(ST_GeomFromEWKT('SRID=4326;POINT(-118.58 38.38 10)'))) As geomA, ST_AsEWKT(ST_Shift_Longitude(ST_GeomFromEWKT('SRID=4326;POINT(241.42 38.38 10)'))) As geomb; SELECT ST_AsText(ST_Shift_Longitude(ST_GeomFromText('LINESTRING(-118.58 38.38, -118.20 38.45)'))); SELECT ST_Within(smallc,smallc) As smallinsmall, ST_Within(smallc, bigc) As smallinbig, ST_Within(bigc,smallc) As biginsmall, ST_Within(ST_Union(smallc, bigc), bigc) as unioninbig, ST_Within(bigc, ST_Union(smallc, bigc)) as biginunion, ST_Equals(bigc, ST_Union(smallc, bigc)) as bigisunion FROM ( SELECT ST_Buffer(ST_GeomFromText('POINT(50 50)'), 20) As smallc, ST_Buffer(ST_GeomFromText('POINT(50 50)'), 40) As bigc) As foo; SELECT ST_MPolyFromText('MULTIPOLYGON(((0 0 1,20 0 1,20 20 1,0 20 1,0 0 1),(5 5 3,5 7 3,7 7 3,7 5 3,5 5 3)))'); --I2.processing join测试 --S1.验证函数ST_BuildArea join功能 SELECT geom_line.id,ST_AsText(ST_BuildArea(ST_Collect(geom_line.the_geom,geom_polygon.the_geom))) from geom_line inner join geom_polygon on geom_line.id=geom_polygon.id order by id limit 20; --S2.验证函数ST_collect join功能 SELECT geom_point.id, ST_AsText(geom_point.the_geom), ST_AsText(geom_line.the_geom),ST_Astext(ST_Collect(ST_setsrid(geom_point.the_geom,4326), st_setsrid(geom_line.the_geom,4326))) from geom_point inner join geom_line on geom_point.id=geom_line.id order by id limit 10; --S5.验证函数ST_Intersection返回两个几何的共享部分 SELECT geom_point.id, ST_AsText(ST_Intersection(ST_setsrid(geom_point.the_geom,4326), st_setsrid(geom_line.the_geom,4326))) from geom_point join geom_line on geom_point.id=geom_line.id order by id limit 10; --S6.验证函数ST_SharedPaths返回包含由两个输入线或多边形的路径的集合 SELECT ST_AsText( ST_SharedPaths( ST_GeomFromText('LINESTRING(76 175,90 161,126 125,126 156.25,151 100)'), ST_GeomFromText('MULTILINESTRING((26 125,26 200,126 200,126 125,26 125), (51 150,101 150,76 175,51 150))') )) As wkt; SELECT ST_AsEWKT(ST_GeometryN(p_geom,3)) As geom_ewkt FROM (SELECT ST_GeomFromEWKT('POLYHEDRALSURFACE( ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)), ((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)) )') AS p_geom ) AS a; SELECT ST_GeoHash(ST_SetSRID(ST_MakePoint(-126,48),4326)); SELECT ST_GeoHash(ST_SetSRID(ST_MakePoint(-126,48),4326),5); SELECT ST_Relate(ST_GeometryFromText('POINT(1 2)'), ST_Buffer(ST_GeometryFromText('POINT(1 2)'),2)); SELECT ST_Relate(ST_GeometryFromText('LINESTRING(1 2, 3 4)'), ST_GeometryFromText(' LINESTRING(5 6, 7 8)')); SELECT ST_Relate(ST_GeometryFromText('POINT(1 2)'), ST_Buffer(ST_GeometryFromText('POINT(1 2)'),2), '0FFFFF212'); SELECT ST_Relate(ST_GeometryFromText('POINT(1 2)'), ST_Buffer(ST_GeometryFromText('POINT(1 2)'),2), '*FF*FF212'); SELECT ST_InterpolatePoint('LINESTRING M (0 0 0, 10 0 20)', 'POINT(5 5)'); SELECT ST_Extent(foo.the_geom) As b3extent FROM (SELECT ST_Translate(ST_Force_2D(ST_LineToCurve(ST_Buffer(ST_MakePoint(x,y),1))),0,0) As the_geom FROM generate_series(1,3) As x CROSS JOIN generate_series(1,2) As y ) As foo; SELECT ST_Extent(foo.the_geom) As b3extent FROM (SELECT ST_MakePoint(x,y) As the_geom FROM generate_series(1,3) As x CROSS JOIN generate_series(1,2) As y ) As foo; SELECT ST_LineCrossingDirection(foo.line1 , foo.line2) As l1_cross_l2 , ST_LineCrossingDirection(foo. line2, foo.line1) As l2_cross_l1 FROM ( SELECT ST_GeomFromText('LINESTRING(25 169,89 114,40 70,86 43)') As line1, ST_GeomFromText('LINESTRING(171 154,20 140,71 74,161 53)') As line2 ) As foo; SELECT ST_LineCrossingDirection(foo.line1 , foo.line2) As l1_cross_l2 , ST_LineCrossingDirection(foo. line2, foo.line1) As l2_cross_l1 FROM ( SELECT ST_GeomFromText('LINESTRING(25 169,89 114,40 70,86 43)') As line1, ST_GeomFromText('LINESTRING (171 154, 20 140, 71 74, 2.99 90.16)') As line2 ) As foo; SELECT ST_LineCrossingDirection(foo. line1, foo.line2) As l1_cross_l2 , ST_LineCrossingDirection(foo. line2, foo.line1) As l2_cross_l1 FROM ( SELECT ST_GeomFromText('LINESTRING(25 169,89 114,40 70,86 43)') As line1, ST_GeomFromText('LINESTRING (20 140, 71 74, 161 53)') As line2 ) As foo; SELECT ST_LineCrossingDirection(foo.line1 , foo.line2) As l1_cross_l2 , ST_LineCrossingDirection(foo. line2, foo.line1) As l2_cross_l1 FROM (SELECT ST_GeomFromText('LINESTRING(25 169,89 114,40 70,86 43)') As line1, ST_GeomFromText('LINESTRING(2.99 90.16,71 74,20 140,171 154)') As line2 ) As foo; SELECT ST_GMLToSQL(' <gml:LineString srsName="EPSG:4269"> <gml:coordinates> -71.16028,42.258729 -71.160837,42.259112 -71.161143,42.25932 </gml:coordinates> </gml:LineString>'); SELECT ST_ConcaveHull( ST_Union(ST_GeomFromText ('POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))'), ST_Buffer(ST_GeomFromText ('POINT(110 170)'), 20) ), 1) As convexhull; SELECT ST_ConcaveHull( ST_Union(ST_GeomFromText ('POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))'), ST_Buffer(ST_GeomFromText ('POINT(110 170)'), 20) ), 0.9) As target_90; SELECT ST_ConcaveHull(ST_Collect(geom), 0.99) FROM (SELECT (ST_DumpPoints(ST_GeomFromText( 'MULTIPOINT(14 14,34 14,54 14,74 14,94 14,114 14,134 14, 150 14,154 14,154 6,134 6,114 6,94 6,74 6,54 6,34 6, 14 6,10 6,8 6,7 7,6 8,6 10,6 30,6 50,6 70,6 90,6 110,6 130, 6 150,6 170,6 190,6 194,14 194,14 174,14 154,14 134,14 114, 14 94,14 74,14 54,14 34,14 14)'))).geom ) foo; SELECT ST_AsEWKT('0103000020E61000000100000005000000000000000000000000000000000000000000000000000000000000000000F03F000000000000F03F000000000000F03F000000000000F03F000000000000000000000000000000000000000000000000'::geometry); SELECT ST_AsEWKT('0108000080030000000000000060 E30A4100000000785C0241000000000000F03F0000000018E20A4100000000485F024100000000000000400000000018E20A4100000000305C02410000000000000840'); SELECT ST_AsText(ST_LineToCurve(foo.the_geom)) As curvedastext,ST_AsText(foo.the_geom) As non_curvedastext FROM (SELECT ST_Buffer('POINT(1 3)'::geometry, 3) As the_geom) As foo; SELECT ST_AsEWKT(ST_LineToCurve(ST_GeomFromEWKT('LINESTRING(1 2 3, 3 4 8, 5 6 4, 7 8 4, 9 10 4)'))); SELECT ST_BuildArea(ST_Collect(smallc,bigc)) FROM (SELECT ST_Buffer( ST_GeomFromText('POINT(100 90)'), 25) As smallc, ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50) As bigc) As foo; SELECT ST_BuildArea(ST_Collect(line,circle)) FROM (SELECT ST_Buffer( ST_MakeLine(ST_MakePoint(10, 10),ST_MakePoint(190, 190)), 5) As line, ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50) As circle) As foo; SELECT ST_BuildArea( ST_Collect(ST_ExteriorRing(line),ST_ExteriorRing(circle)) ) FROM (SELECT ST_Buffer( ST_MakeLine(ST_MakePoint(10, 10),ST_MakePoint(190, 190)) ,5) As line, ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50) As circle) As foo; SELECT ST_AsText(ST_MinimumBoundingCircle( ST_Collect( ST_GeomFromEWKT('LINESTRING(55 75,125 150)'), ST_Point(20, 80)), 8 )) As wktmbc; SELECT ST_AsEWKT( ST_ExteriorRing( ST_GeomFromEWKT('POLYGON((0 0 1, 1 1 1, 1 2 1, 1 1 1, 0 0 1))') ) ); SELECT tbl1.column1, tbl2.column1, tbl1.column2 <<| tbl2.column2 AS below FROM ( VALUES (1, 'LINESTRING (0 0, 4 3)'::geometry)) AS tbl1, ( VALUES (2, 'LINESTRING (1 4, 1 7)'::geometry), (3, 'LINESTRING (6 1, 6 5)'::geometry), (4, 'LINESTRING (2 3, 5 6)'::geometry)) AS tbl2; SELECT ST_IsValidReason('LINESTRING(220227 150406,2220227 150407,222020 150410)'); SELECT ST_AsEWKT(a.geom), ST_HasArc(a.geom) FROM ( SELECT (ST_Dump(p_geom)).geom AS geom FROM (SELECT ST_GeomFromEWKT('COMPOUNDCURVE(CIRCULARSTRING(0 0, 1 1, 1 0),(1 0, 0 1))') AS p_geom) AS b ) AS a; SELECT (a.p_geom).path[1] As path, ST_AsEWKT((a.p_geom).geom) As geom_ewkt FROM (SELECT ST_Dump(ST_GeomFromEWKT('POLYHEDRALSURFACE( ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)), ((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)))') ) AS p_geom ) AS a; SELECT (g.gdump).path, ST_AsEWKT((g.gdump).geom) as wkt FROM (SELECT ST_Dump( ST_GeomFromEWKT('TIN ((( 0 0 0, 0 0 1, 0 1 0, 0 0 0 )), (( 0 0 0, 0 1 0, 1 1 0, 0 0 0 )) )') ) AS gdump ) AS g; SELECT ST_Polygon(ST_GeomFromText('LINESTRING(75.15 29.53,77 29,77.6 29.5, 75.15 29.53)'), 4326); SELECT ST_AsEWKT(ST_Polygon(ST_GeomFromEWKT('LINESTRING(75.15 29.53 1,77 29 1,77.6 29.5 1, 75.15 29.53 1)'), 4326)); SELECT ST_3DDWithin( ST_Transform(ST_GeomFromEWKT('SRID=4326;POINT(-72.1235 42.3521 4)'),2163), ST_Transform(ST_GeomFromEWKT('SRID=4326;LINESTRING(-72.1260 42.45 15, -72.123 42.1546 20)'),2163), 126.8 ) As within_dist_3d, ST_DWithin( ST_Transform(ST_GeomFromEWKT('SRID=4326;POINT(-72.1235 42.3521 4)'),2163), ST_Transform(ST_GeomFromEWKT('SRID=4326;LINESTRING(-72.1260 42.45 15, -72.123 42.1546 20)'),2163), 126.8 ) As within_dist_2d; SELECT round(CAST(ST_Distance_Sphere(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)',4326)) As numeric),2) As dist_meters, round(CAST(ST_Distance(ST_Transform(ST_Centroid(the_geom),32611), ST_Transform(ST_GeomFromText('POINT(-118 38)', 4326),32611)) As numeric),2) As dist_utm11_meters, round(CAST(ST_Distance(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)', 4326)) As numeric),5) As dist_degrees, round(CAST(ST_Distance(ST_Transform(the_geom,32611), ST_Transform(ST_GeomFromText('POINT(-118 38)', 4326),32611)) As numeric),2) As min_dist_line_point_meters FROM (SELECT ST_GeomFromText('LINESTRING(-118.584 38.374,-118.583 38.5)', 4326) As the_geom) as foo; SELECT ST_AsEWKT(ST_RotateZ(ST_GeomFromEWKT('LINESTRING(1 2 3, 1 1 1)'), pi()/2)); SELECT ST_AsEWKT(ST_RotateZ(the_geom, pi()/2)) FROM (SELECT ST_LineToCurve(ST_Buffer(ST_GeomFromText('POINT(234 567)'), 3)) As the_geom) As foo; SELECT ST_NumPoints(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)')); SELECT ST_ContainsProperly(smallc, bigc) As smallcontainspropbig, ST_ContainsProperly(bigc,smallc) As bigcontainspropsmall, ST_ContainsProperly(bigc, ST_Union(smallc, bigc)) as bigcontainspropunion, ST_Equals(bigc, ST_Union(smallc, bigc)) as bigisunion, ST_Covers(bigc, ST_ExteriorRing(bigc)) As bigcoversexterior, ST_ContainsProperly(bigc, ST_ExteriorRing(bigc)) As bigcontainsexterior FROM (SELECT ST_Buffer(ST_GeomFromText('POINT(1 2)'), 10) As smallc, ST_Buffer(ST_GeomFromText('POINT(1 2)'), 20) As bigc) As foo;
the_stack
/* following scripts: latin, iceland, nordic */ /* ======================================================================= */ /* IBM-437 */ /* Dos Latin US - Standard CharSet for Western Script */ /* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ /* Convert-Tables: mappings/vendors/micsft/pc/cp437.txt from 04/24/96 Version 2.00 */ /* Last-Changes from us: */ /* ----------------------------------------------------------------------- */ #define IBM437UNI_START 0x80 #define IBM437UNI_END 0xFF static sal_uInt16 const aImplIBM437ToUniTab[IBM437UNI_END - IBM437UNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, /* 0x80 */ 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, /* 0x80 */ 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, /* 0x90 */ 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, /* 0x90 */ 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, /* 0xA0 */ 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, /* 0xA0 */ 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, /* 0xB0 */ 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, /* 0xB0 */ 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, /* 0xC0 */ 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, /* 0xC0 */ 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, /* 0xD0 */ 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, /* 0xD0 */ 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, /* 0xE0 */ 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, /* 0xE0 */ 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, /* 0xF0 */ 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ #define IBM437CHAR_START 0x00A0 #define IBM437CHAR_END 0x00FF static sal_uChar const aImplIBM437ToCharTab[IBM437CHAR_END - IBM437CHAR_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xFF, 0xAD, 0x9B, 0x9C, 0, 0x9D, 0, 0, /* 0x00A0 */ 0, 0, 0xA6, 0xAE, 0xAA, 0, 0, 0, /* 0x00A0 */ 0xF8, 0xF1, 0xFD, 0, 0, 0xE6, 0, 0xFA, /* 0x00B0 */ 0, 0, 0xA7, 0xAF, 0xAC, 0xAB, 0, 0xA8, /* 0x00B0 */ 0, 0, 0, 0, 0x8E, 0x8F, 0x92, 0x80, /* 0x00C0 */ 0, 0x90, 0, 0, 0, 0, 0, 0, /* 0x00C0 */ 0, 0xA5, 0, 0, 0, 0, 0x99, 0, /* 0x00D0 */ 0, 0, 0, 0, 0x9A, 0, 0, 0xE1, /* 0x00D0 */ 0x85, 0xA0, 0x83, 0, 0x84, 0x86, 0x91, 0x87, /* 0x00E0 */ 0x8A, 0x82, 0x88, 0x89, 0x8D, 0xA1, 0x8C, 0x8B, /* 0x00E0 */ 0, 0xA4, 0x95, 0xA2, 0x93, 0, 0x94, 0xF6, /* 0x00F0 */ 0, 0x97, 0xA3, 0x96, 0x81, 0, 0, 0x98 /* 0x00F0 */ }; /* ----------------------------------------------------------------------- */ #define IBM437TOCHARTABEX_COUNT 75 static ImplUniCharTabData const aImplIBM437ToCharTabEx[IBM437TOCHARTABEX_COUNT] = { { 0x0192, 0x9F, 0 }, { 0x0393, 0xE2, 0 }, { 0x0398, 0xE9, 0 }, { 0x03A3, 0xE4, 0 }, { 0x03A6, 0xE8, 0 }, { 0x03A9, 0xEA, 0 }, { 0x03B1, 0xE0, 0 }, { 0x03B4, 0xEB, 0 }, { 0x03B5, 0xEE, 0 }, { 0x03C0, 0xE3, 0 }, { 0x03C3, 0xE5, 0 }, { 0x03C4, 0xE7, 0 }, { 0x03C6, 0xED, 0 }, { 0x207F, 0xFC, 0 }, { 0x20A7, 0x9E, 0 }, { 0x2219, 0xF9, 0 }, { 0x221A, 0xFB, 0 }, { 0x221E, 0xEC, 0 }, { 0x2229, 0xEF, 0 }, { 0x2248, 0xF7, 0 }, { 0x2261, 0xF0, 0 }, { 0x2264, 0xF3, 0 }, { 0x2265, 0xF2, 0 }, { 0x2310, 0xA9, 0 }, { 0x2320, 0xF4, 0 }, { 0x2321, 0xF5, 0 }, { 0x2500, 0xC4, 0 }, { 0x2502, 0xB3, 0 }, { 0x250C, 0xDA, 0 }, { 0x2510, 0xBF, 0 }, { 0x2514, 0xC0, 0 }, { 0x2518, 0xD9, 0 }, { 0x251C, 0xC3, 0 }, { 0x2524, 0xB4, 0 }, { 0x252C, 0xC2, 0 }, { 0x2534, 0xC1, 0 }, { 0x253C, 0xC5, 0 }, { 0x2550, 0xCD, 0 }, { 0x2551, 0xBA, 0 }, { 0x2552, 0xD5, 0 }, { 0x2553, 0xD6, 0 }, { 0x2554, 0xC9, 0 }, { 0x2555, 0xB8, 0 }, { 0x2556, 0xB7, 0 }, { 0x2557, 0xBB, 0 }, { 0x2558, 0xD4, 0 }, { 0x2559, 0xD3, 0 }, { 0x255A, 0xC8, 0 }, { 0x255B, 0xBE, 0 }, { 0x255C, 0xBD, 0 }, { 0x255D, 0xBC, 0 }, { 0x255E, 0xC6, 0 }, { 0x255F, 0xC7, 0 }, { 0x2560, 0xCC, 0 }, { 0x2561, 0xB5, 0 }, { 0x2562, 0xB6, 0 }, { 0x2563, 0xB9, 0 }, { 0x2564, 0xD1, 0 }, { 0x2565, 0xD2, 0 }, { 0x2566, 0xCB, 0 }, { 0x2567, 0xCF, 0 }, { 0x2568, 0xD0, 0 }, { 0x2569, 0xCA, 0 }, { 0x256A, 0xD8, 0 }, { 0x256B, 0xD7, 0 }, { 0x256C, 0xCE, 0 }, { 0x2580, 0xDF, 0 }, { 0x2584, 0xDC, 0 }, { 0x2588, 0xDB, 0 }, { 0x258C, 0xDD, 0 }, { 0x2590, 0xDE, 0 }, { 0x2591, 0xB0, 0 }, { 0x2592, 0xB1, 0 }, { 0x2593, 0xB2, 0 }, { 0x25A0, 0xFE, 0 } }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplIBM437ByteCvtData = { aImplIBM437ToUniTab, NULL, IBM437UNI_START, IBM437UNI_END, NOTABUNI_START, NOTABUNI_END, aImplIBM437ToCharTab, NULL, aImplIBM437ToCharTabEx, IBM437CHAR_START, IBM437CHAR_END, NOTABCHAR_START, NOTABCHAR_END, IBM437TOCHARTABEX_COUNT }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplIBM437TextEncodingData = { { &aImplIBM437ByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-1", "ibm437", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_MIME }; /* DOS/OS2, SCRIPT_LATIN, pc code page 437 */ /* ======================================================================= */ /* IBM-850 */ /* Dos Standard CharSet for Western/Europa */ /* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ /* Convert-Tables: mappings/vendors/micsft/pc/cp850.txt from 04/24/96 Version 2.00 */ /* Last-Changes from us: */ /* D5 - geaendert auf EURO SIGN and 0x20AC added to D5 */ /* ----------------------------------------------------------------------- */ #define IBM850UNI_START 0x80 #define IBM850UNI_END 0xFF static sal_uInt16 const aImplIBM850ToUniTab[IBM850UNI_END - IBM850UNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, /* 0x80 */ 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, /* 0x80 */ 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, /* 0x90 */ 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, /* 0x90 */ 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, /* 0xA0 */ 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, /* 0xA0 */ 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, /* 0xB0 */ 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, /* 0xB0 */ 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, /* 0xC0 */ 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, /* 0xC0 */ 0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x20AC, 0x00CD, 0x00CE, /* 0xD0 */ 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, /* 0xD0 */ 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, /* 0xE0 */ 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, /* 0xE0 */ 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, /* 0xF0 */ 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ #define IBM850CHAR_START 0x00A0 #define IBM850CHAR_END 0x00FF static sal_uChar const aImplIBM850ToCharTab[IBM850CHAR_END - IBM850CHAR_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xFF, 0xAD, 0xBD, 0x9C, 0xCF, 0xBE, 0xDD, 0xF5, /* 0x00A0 */ 0xF9, 0xB8, 0xA6, 0xAE, 0xAA, 0xF0, 0xA9, 0xEE, /* 0x00A0 */ 0xF8, 0xF1, 0xFD, 0xFC, 0xEF, 0xE6, 0xF4, 0xFA, /* 0x00B0 */ 0xF7, 0xFB, 0xA7, 0xAF, 0xAC, 0xAB, 0xF3, 0xA8, /* 0x00B0 */ 0xB7, 0xB5, 0xB6, 0xC7, 0x8E, 0x8F, 0x92, 0x80, /* 0x00C0 */ 0xD4, 0x90, 0xD2, 0xD3, 0xDE, 0xD6, 0xD7, 0xD8, /* 0x00C0 */ 0xD1, 0xA5, 0xE3, 0xE0, 0xE2, 0xE5, 0x99, 0x9E, /* 0x00D0 */ 0x9D, 0xEB, 0xE9, 0xEA, 0x9A, 0xED, 0xE8, 0xE1, /* 0x00D0 */ 0x85, 0xA0, 0x83, 0xC6, 0x84, 0x86, 0x91, 0x87, /* 0x00E0 */ 0x8A, 0x82, 0x88, 0x89, 0x8D, 0xA1, 0x8C, 0x8B, /* 0x00E0 */ 0xD0, 0xA4, 0x95, 0xA2, 0x93, 0xE4, 0x94, 0xF6, /* 0x00F0 */ 0x9B, 0x97, 0xA3, 0x96, 0x81, 0xEC, 0xE7, 0x98 /* 0x00F0 */ }; /* ----------------------------------------------------------------------- */ #define IBM850TOCHARTABEX_COUNT 33 static ImplUniCharTabData const aImplIBM850ToCharTabEx[IBM850TOCHARTABEX_COUNT] = { { 0x0131, 0xD5, 0 }, { 0x0192, 0x9F, 0 }, { 0x2017, 0xF2, 0 }, { 0x20AC, 0xD5, 0 }, { 0x2500, 0xC4, 0 }, { 0x2502, 0xB3, 0 }, { 0x250C, 0xDA, 0 }, { 0x2510, 0xBF, 0 }, { 0x2514, 0xC0, 0 }, { 0x2518, 0xD9, 0 }, { 0x251C, 0xC3, 0 }, { 0x2524, 0xB4, 0 }, { 0x252C, 0xC2, 0 }, { 0x2534, 0xC1, 0 }, { 0x253C, 0xC5, 0 }, { 0x2550, 0xCD, 0 }, { 0x2551, 0xBA, 0 }, { 0x2554, 0xC9, 0 }, { 0x2557, 0xBB, 0 }, { 0x255A, 0xC8, 0 }, { 0x255D, 0xBC, 0 }, { 0x2560, 0xCC, 0 }, { 0x2563, 0xB9, 0 }, { 0x2566, 0xCB, 0 }, { 0x2569, 0xCA, 0 }, { 0x256C, 0xCE, 0 }, { 0x2580, 0xDF, 0 }, { 0x2584, 0xDC, 0 }, { 0x2588, 0xDB, 0 }, { 0x2591, 0xB0, 0 }, { 0x2592, 0xB1, 0 }, { 0x2593, 0xB2, 0 }, { 0x25A0, 0xFE, 0 } }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplIBM850ByteCvtData = { aImplIBM850ToUniTab, NULL, IBM850UNI_START, IBM850UNI_END, NOTABUNI_START, NOTABUNI_END, aImplIBM850ToCharTab, NULL, aImplIBM850ToCharTabEx, IBM850CHAR_START, IBM850CHAR_END, NOTABCHAR_START, NOTABCHAR_END, IBM850TOCHARTABEX_COUNT }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplIBM850TextEncodingData = { { &aImplIBM850ByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-1", "ibm850", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_MIME }; /* DOS/OS2, SCRIPT_LATIN, pc code page 850 */ /* ======================================================================= */ /* IBM-860 */ /* Dos Standard CharSet for Portugiese */ /* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ /* Convert-Tables: mappings/vendors/micsft/pc/cp860.txt from 04/24/96 Version 2.00 */ /* Last-Changes from us: */ /* ----------------------------------------------------------------------- */ #define IBM860UNI_START 0x80 #define IBM860UNI_END 0xFF static sal_uInt16 const aImplIBM860ToUniTab[IBM860UNI_END - IBM860UNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E3, 0x00E0, 0x00C1, 0x00E7, /* 0x80 */ 0x00EA, 0x00CA, 0x00E8, 0x00CD, 0x00D4, 0x00EC, 0x00C3, 0x00C2, /* 0x80 */ 0x00C9, 0x00C0, 0x00C8, 0x00F4, 0x00F5, 0x00F2, 0x00DA, 0x00F9, /* 0x90 */ 0x00CC, 0x00D5, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x20A7, 0x00D3, /* 0x90 */ 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, /* 0xA0 */ 0x00BF, 0x00D2, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, /* 0xA0 */ 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, /* 0xB0 */ 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, /* 0xB0 */ 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, /* 0xC0 */ 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, /* 0xC0 */ 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, /* 0xD0 */ 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, /* 0xD0 */ 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, /* 0xE0 */ 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, /* 0xE0 */ 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, /* 0xF0 */ 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ #define IBM860CHAR_START 0x00A0 #define IBM860CHAR_END 0x00FC static sal_uChar const aImplIBM860ToCharTab[IBM860CHAR_END - IBM860CHAR_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xFF, 0xAD, 0x9B, 0x9C, 0 , 0, 0, 0, /* 0x00A0 */ 0, 0, 0xA6, 0xAE, 0xAA, 0, 0, 0, /* 0x00A0 */ 0xF8, 0xF1, 0xFD, 0, 0, 0xE6, 0, 0xFA, /* 0x00B0 */ 0, 0, 0xA7, 0xAF, 0xAC, 0xAB, 0, 0xA8, /* 0x00B0 */ 0x91, 0x86, 0x8F, 0x8E, 0, 0, 0, 0x80, /* 0x00C0 */ 0x92, 0x90, 0x89, 0, 0x98, 0x8B, 0, 0, /* 0x00C0 */ 0, 0xA5, 0xA9, 0x9F, 0x8C, 0x99, 0, 0, /* 0x00D0 */ 0, 0x9D, 0x96, 0, 0x9A, 0, 0, 0xE1, /* 0x00D0 */ 0x85, 0xA0, 0x83, 0x84, 0, 0, 0, 0x87, /* 0x00E0 */ 0x8A, 0x82, 0x88, 0, 0x8D, 0xA1, 0, 0, /* 0x00E0 */ 0, 0xA4, 0x95, 0xA2, 0x93, 0x94, 0, 0xF6, /* 0x00F0 */ 0, 0x97, 0xA3, 0, 0x81 /* 0x00F0 */ }; /* ----------------------------------------------------------------------- */ #define IBM860TOCHARTABEX_COUNT 73 static ImplUniCharTabData const aImplIBM860ToCharTabEx[IBM860TOCHARTABEX_COUNT] = { { 0x0393, 0xE2, 0 }, { 0x0398, 0xE9, 0 }, { 0x03A3, 0xE4, 0 }, { 0x03A6, 0xE8, 0 }, { 0x03A9, 0xEA, 0 }, { 0x03B1, 0xE0, 0 }, { 0x03B4, 0xEB, 0 }, { 0x03B5, 0xEE, 0 }, { 0x03C0, 0xE3, 0 }, { 0x03C3, 0xE5, 0 }, { 0x03C4, 0xE7, 0 }, { 0x03C6, 0xED, 0 }, { 0x207F, 0xFC, 0 }, { 0x20A7, 0x9E, 0 }, { 0x2219, 0xF9, 0 }, { 0x221A, 0xFB, 0 }, { 0x221E, 0xEC, 0 }, { 0x2229, 0xEF, 0 }, { 0x2248, 0xF7, 0 }, { 0x2261, 0xF0, 0 }, { 0x2264, 0xF3, 0 }, { 0x2265, 0xF2, 0 }, { 0x2320, 0xF4, 0 }, { 0x2321, 0xF5, 0 }, { 0x2500, 0xC4, 0 }, { 0x2502, 0xB3, 0 }, { 0x250C, 0xDA, 0 }, { 0x2510, 0xBF, 0 }, { 0x2514, 0xC0, 0 }, { 0x2518, 0xD9, 0 }, { 0x251C, 0xC3, 0 }, { 0x2524, 0xB4, 0 }, { 0x252C, 0xC2, 0 }, { 0x2534, 0xC1, 0 }, { 0x253C, 0xC5, 0 }, { 0x2550, 0xCD, 0 }, { 0x2551, 0xBA, 0 }, { 0x2552, 0xD5, 0 }, { 0x2553, 0xD6, 0 }, { 0x2554, 0xC9, 0 }, { 0x2555, 0xB8, 0 }, { 0x2556, 0xB7, 0 }, { 0x2557, 0xBB, 0 }, { 0x2558, 0xD4, 0 }, { 0x2559, 0xD3, 0 }, { 0x255A, 0xC8, 0 }, { 0x255B, 0xBE, 0 }, { 0x255C, 0xBD, 0 }, { 0x255D, 0xBC, 0 }, { 0x255E, 0xC6, 0 }, { 0x255F, 0xC7, 0 }, { 0x2560, 0xCC, 0 }, { 0x2561, 0xB5, 0 }, { 0x2562, 0xB6, 0 }, { 0x2563, 0xB9, 0 }, { 0x2564, 0xD1, 0 }, { 0x2565, 0xD2, 0 }, { 0x2566, 0xCB, 0 }, { 0x2567, 0xCF, 0 }, { 0x2568, 0xD0, 0 }, { 0x2569, 0xCA, 0 }, { 0x256A, 0xD8, 0 }, { 0x256B, 0xD7, 0 }, { 0x256C, 0xCE, 0 }, { 0x2580, 0xDF, 0 }, { 0x2584, 0xDC, 0 }, { 0x2588, 0xDB, 0 }, { 0x258C, 0xDD, 0 }, { 0x2590, 0xDE, 0 }, { 0x2591, 0xB0, 0 }, { 0x2592, 0xB1, 0 }, { 0x2593, 0xB2, 0 }, { 0x25A0, 0xFE, 0 } }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplIBM860ByteCvtData = { aImplIBM860ToUniTab, NULL, IBM860UNI_START, IBM860UNI_END, NOTABUNI_START, NOTABUNI_END, aImplIBM860ToCharTab, NULL, aImplIBM860ToCharTabEx, IBM860CHAR_START, IBM860CHAR_END, NOTABCHAR_START, NOTABCHAR_END, IBM860TOCHARTABEX_COUNT }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplIBM860TextEncodingData = { { &aImplIBM860ByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-1", "IBM860", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_MIME }; /* DOS/OS2, SCRIPT_LATIN, pc code page 860 */ /* ======================================================================= */ /* IBM-861 */ /* Dos Standard CharSet for Icelandic */ /* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ /* Convert-Tables: mappings/vendors/micsft/pc/cp861.txt from 04/24/96 Version 2.00 */ /* Last-Changes from us: */ /* ----------------------------------------------------------------------- */ #define IBM861UNI_START 0x80 #define IBM861UNI_END 0xFF static sal_uInt16 const aImplIBM861ToUniTab[IBM861UNI_END - IBM861UNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, /* 0x80 */ 0x00EA, 0x00EB, 0x00E8, 0x00D0, 0x00F0, 0x00DE, 0x00C4, 0x00C5, /* 0x80 */ 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00FE, 0x00FB, 0x00DD, /* 0x90 */ 0x00FD, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192, /* 0x90 */ 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00C1, 0x00CD, 0x00D3, 0x00DA, /* 0xA0 */ 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, /* 0xA0 */ 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, /* 0xB0 */ 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, /* 0xB0 */ 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, /* 0xC0 */ 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, /* 0xC0 */ 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, /* 0xD0 */ 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, /* 0xD0 */ 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, /* 0xE0 */ 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, /* 0xE0 */ 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, /* 0xF0 */ 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ #define IBM861CHAR_START 0x00A0 #define IBM861CHAR_END 0x00FE static sal_uChar const aImplIBM861ToCharTab[IBM861CHAR_END - IBM861CHAR_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xFF, 0xAD, 0, 0x9C, 0, 0, 0, 0, /* 0x00A0 */ 0, 0, 0, 0xAE, 0xAA, 0, 0, 0, /* 0x00A0 */ 0xF8, 0xF1, 0xFD, 0, 0, 0xE6, 0, 0xFA, /* 0x00B0 */ 0, 0, 0, 0xAF, 0xAC, 0xAB, 0, 0xA8, /* 0x00B0 */ 0, 0xA4, 0, 0, 0x8E, 0x8F, 0x92, 0x80, /* 0x00C0 */ 0, 0x90, 0, 0, 0, 0xA5, 0, 0, /* 0x00C0 */ 0x8B, 0, 0, 0xA6, 0, 0, 0x99, 0, /* 0x00D0 */ 0x9D, 0, 0xA7, 0, 0x9A, 0x97, 0x8D, 0xE1, /* 0x00D0 */ 0x85, 0xA0, 0x83, 0, 0x84, 0x86, 0x91, 0x87, /* 0x00E0 */ 0x8A, 0x82, 0x88, 0x89, 0, 0xA1, 0, 0, /* 0x00E0 */ 0x8C, 0, 0, 0xA2, 0x93, 0, 0x94, 0xF6, /* 0x00F0 */ 0x9B, 0, 0xA3, 0x96, 0x81, 0x98, 0x95 /* 0x00F0 */ }; /* ----------------------------------------------------------------------- */ #define IBM861TOCHARTABEX_COUNT 75 static ImplUniCharTabData const aImplIBM861ToCharTabEx[IBM861TOCHARTABEX_COUNT] = { { 0x0192, 0x9F, 0 }, { 0x0393, 0xE2, 0 }, { 0x0398, 0xE9, 0 }, { 0x03A3, 0xE4, 0 }, { 0x03A6, 0xE8, 0 }, { 0x03A9, 0xEA, 0 }, { 0x03B1, 0xE0, 0 }, { 0x03B4, 0xEB, 0 }, { 0x03B5, 0xEE, 0 }, { 0x03C0, 0xE3, 0 }, { 0x03C3, 0xE5, 0 }, { 0x03C4, 0xE7, 0 }, { 0x03C6, 0xED, 0 }, { 0x207F, 0xFC, 0 }, { 0x20A7, 0x9E, 0 }, { 0x2219, 0xF9, 0 }, { 0x221A, 0xFB, 0 }, { 0x221E, 0xEC, 0 }, { 0x2229, 0xEF, 0 }, { 0x2248, 0xF7, 0 }, { 0x2261, 0xF0, 0 }, { 0x2264, 0xF3, 0 }, { 0x2265, 0xF2, 0 }, { 0x2310, 0xA9, 0 }, { 0x2320, 0xF4, 0 }, { 0x2321, 0xF5, 0 }, { 0x2500, 0xC4, 0 }, { 0x2502, 0xB3, 0 }, { 0x250C, 0xDA, 0 }, { 0x2510, 0xBF, 0 }, { 0x2514, 0xC0, 0 }, { 0x2518, 0xD9, 0 }, { 0x251C, 0xC3, 0 }, { 0x2524, 0xB4, 0 }, { 0x252C, 0xC2, 0 }, { 0x2534, 0xC1, 0 }, { 0x253C, 0xC5, 0 }, { 0x2550, 0xCD, 0 }, { 0x2551, 0xBA, 0 }, { 0x2552, 0xD5, 0 }, { 0x2553, 0xD6, 0 }, { 0x2554, 0xC9, 0 }, { 0x2555, 0xB8, 0 }, { 0x2556, 0xB7, 0 }, { 0x2557, 0xBB, 0 }, { 0x2558, 0xD4, 0 }, { 0x2559, 0xD3, 0 }, { 0x255A, 0xC8, 0 }, { 0x255B, 0xBE, 0 }, { 0x255C, 0xBD, 0 }, { 0x255D, 0xBC, 0 }, { 0x255E, 0xC6, 0 }, { 0x255F, 0xC7, 0 }, { 0x2560, 0xCC, 0 }, { 0x2561, 0xB5, 0 }, { 0x2562, 0xB6, 0 }, { 0x2563, 0xB9, 0 }, { 0x2564, 0xD1, 0 }, { 0x2565, 0xD2, 0 }, { 0x2566, 0xCB, 0 }, { 0x2567, 0xCF, 0 }, { 0x2568, 0xD0, 0 }, { 0x2569, 0xCA, 0 }, { 0x256A, 0xD8, 0 }, { 0x256B, 0xD7, 0 }, { 0x256C, 0xCE, 0 }, { 0x2580, 0xDF, 0 }, { 0x2584, 0xDC, 0 }, { 0x2588, 0xDB, 0 }, { 0x258C, 0xDD, 0 }, { 0x2590, 0xDE, 0 }, { 0x2591, 0xB0, 0 }, { 0x2592, 0xB1, 0 }, { 0x2593, 0xB2, 0 }, { 0x25A0, 0xFE, 0 } }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplIBM861ByteCvtData = { aImplIBM861ToUniTab, NULL, IBM861UNI_START, IBM861UNI_END, NOTABUNI_START, NOTABUNI_END, aImplIBM861ToCharTab, NULL, aImplIBM861ToCharTabEx, IBM861CHAR_START, IBM861CHAR_END, NOTABCHAR_START, NOTABCHAR_END, IBM861TOCHARTABEX_COUNT }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplIBM861TextEncodingData = { { &aImplIBM861ByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-1", "IBM861", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_MIME }; /* DOS/OS2, SCRIPT_LATIN, pc code page 861, mac encoding 37 */ /* ======================================================================= */ /* IBM-863 */ /* Dos Standard CharSet for Canada-France */ /* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ /* Convert-Tables: mappings/vendors/micsft/pc/cp863.txt from 04/24/96 Version 2.00 */ /* Last-Changes from us: */ /* ----------------------------------------------------------------------- */ #define IBM863UNI_START 0x80 #define IBM863UNI_END 0xFF static sal_uInt16 const aImplIBM863ToUniTab[IBM863UNI_END - IBM863UNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00C2, 0x00E0, 0x00B6, 0x00E7, /* 0x80 */ 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x2017, 0x00C0, 0x00A7, /* 0x80 */ 0x00C9, 0x00C8, 0x00CA, 0x00F4, 0x00CB, 0x00CF, 0x00FB, 0x00F9, /* 0x90 */ 0x00A4, 0x00D4, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x00DB, 0x0192, /* 0x90 */ 0x00A6, 0x00B4, 0x00F3, 0x00FA, 0x00A8, 0x00B8, 0x00B3, 0x00AF, /* 0xA0 */ 0x00CE, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00BE, 0x00AB, 0x00BB, /* 0xA0 */ 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, /* 0xB0 */ 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, /* 0xB0 */ 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, /* 0xC0 */ 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, /* 0xC0 */ 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, /* 0xD0 */ 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, /* 0xD0 */ 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, /* 0xE0 */ 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, /* 0xE0 */ 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, /* 0xF0 */ 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ #define IBM863CHAR_START 0x00A0 #define IBM863CHAR_END 0x00FC static sal_uChar const aImplIBM863ToCharTab[IBM863CHAR_END - IBM863CHAR_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xFF, 0, 0x9B, 0x9C, 0x98, 0, 0xA0, 0x8F, /* 0x00A0 */ 0xA4, 0, 0, 0xAE, 0xAA, 0, 0, 0xA7, /* 0x00A0 */ 0xF8, 0xF1, 0xFD, 0xA6, 0xA1, 0xE6, 0x86, 0xFA, /* 0x00B0 */ 0xA5, 0, 0, 0xAF, 0xAC, 0xAB, 0xAD, 0, /* 0x00B0 */ 0x8E, 0, 0x84, 0, 0, 0, 0, 0x80, /* 0x00C0 */ 0x91, 0x90, 0x92, 0x94, 0, 0, 0xA8, 0x95, /* 0x00C0 */ 0, 0, 0, 0, 0x99, 0, 0, 0, /* 0x00D0 */ 0, 0x9D, 0, 0x9E, 0x9A, 0, 0, 0xE1, /* 0x00D0 */ 0x85, 0, 0x83, 0, 0, 0, 0, 0x87, /* 0x00E0 */ 0x8A, 0x82, 0x88, 0x89, 0, 0, 0x8C, 0x8B, /* 0x00E0 */ 0, 0, 0, 0xA2, 0x93, 0, 0, 0xF6, /* 0x00F0 */ 0, 0x97, 0xA3, 0x96, 0x81 /* 0x00F0 */ }; /* ----------------------------------------------------------------------- */ #define IBM863TOCHARTABEX_COUNT 75 static ImplUniCharTabData const aImplIBM863ToCharTabEx[IBM863TOCHARTABEX_COUNT] = { { 0x0192, 0x9F, 0 }, { 0x0393, 0xE2, 0 }, { 0x0398, 0xE9, 0 }, { 0x03A3, 0xE4, 0 }, { 0x03A6, 0xE8, 0 }, { 0x03A9, 0xEA, 0 }, { 0x03B1, 0xE0, 0 }, { 0x03B4, 0xEB, 0 }, { 0x03B5, 0xEE, 0 }, { 0x03C0, 0xE3, 0 }, { 0x03C3, 0xE5, 0 }, { 0x03C4, 0xE7, 0 }, { 0x03C6, 0xED, 0 }, { 0x2017, 0x8D, 0 }, { 0x207F, 0xFC, 0 }, { 0x2219, 0xF9, 0 }, { 0x221A, 0xFB, 0 }, { 0x221E, 0xEC, 0 }, { 0x2229, 0xEF, 0 }, { 0x2248, 0xF7, 0 }, { 0x2261, 0xF0, 0 }, { 0x2264, 0xF3, 0 }, { 0x2265, 0xF2, 0 }, { 0x2310, 0xA9, 0 }, { 0x2320, 0xF4, 0 }, { 0x2321, 0xF5, 0 }, { 0x2500, 0xC4, 0 }, { 0x2502, 0xB3, 0 }, { 0x250C, 0xDA, 0 }, { 0x2510, 0xBF, 0 }, { 0x2514, 0xC0, 0 }, { 0x2518, 0xD9, 0 }, { 0x251C, 0xC3, 0 }, { 0x2524, 0xB4, 0 }, { 0x252C, 0xC2, 0 }, { 0x2534, 0xC1, 0 }, { 0x253C, 0xC5, 0 }, { 0x2550, 0xCD, 0 }, { 0x2551, 0xBA, 0 }, { 0x2552, 0xD5, 0 }, { 0x2553, 0xD6, 0 }, { 0x2554, 0xC9, 0 }, { 0x2555, 0xB8, 0 }, { 0x2556, 0xB7, 0 }, { 0x2557, 0xBB, 0 }, { 0x2558, 0xD4, 0 }, { 0x2559, 0xD3, 0 }, { 0x255A, 0xC8, 0 }, { 0x255B, 0xBE, 0 }, { 0x255C, 0xBD, 0 }, { 0x255D, 0xBC, 0 }, { 0x255E, 0xC6, 0 }, { 0x255F, 0xC7, 0 }, { 0x2560, 0xCC, 0 }, { 0x2561, 0xB5, 0 }, { 0x2562, 0xB6, 0 }, { 0x2563, 0xB9, 0 }, { 0x2564, 0xD1, 0 }, { 0x2565, 0xD2, 0 }, { 0x2566, 0xCB, 0 }, { 0x2567, 0xCF, 0 }, { 0x2568, 0xD0, 0 }, { 0x2569, 0xCA, 0 }, { 0x256A, 0xD8, 0 }, { 0x256B, 0xD7, 0 }, { 0x256C, 0xCE, 0 }, { 0x2580, 0xDF, 0 }, { 0x2584, 0xDC, 0 }, { 0x2588, 0xDB, 0 }, { 0x258C, 0xDD, 0 }, { 0x2590, 0xDE, 0 }, { 0x2591, 0xB0, 0 }, { 0x2592, 0xB1, 0 }, { 0x2593, 0xB2, 0 }, { 0x25A0, 0xFE, 0 } }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplIBM863ByteCvtData = { aImplIBM863ToUniTab, NULL, IBM863UNI_START, IBM863UNI_END, NOTABUNI_START, NOTABUNI_END, aImplIBM863ToCharTab, NULL, aImplIBM863ToCharTabEx, IBM863CHAR_START, IBM863CHAR_END, NOTABCHAR_START, NOTABCHAR_END, IBM863TOCHARTABEX_COUNT }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplIBM863TextEncodingData = { { &aImplIBM863ByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-1", "IBM863", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_MIME }; /* DOS/OS2, SCRIPT_LATIN, pc code page 863 */ /* ======================================================================= */ /* IBM-865 */ /* Dos Standard CharSet for Nordic */ /* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ /* Convert-Tables: mappings/vendors/micsft/pc/cp865.txt from 04/24/96 Version 2.00 */ /* Last-Changes from us: */ /* ----------------------------------------------------------------------- */ #define IBM865UNI_START 0x80 #define IBM865UNI_END 0xFF static sal_uInt16 const aImplIBM865ToUniTab[IBM865UNI_END - IBM865UNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, /* 0x80 */ 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, /* 0x80 */ 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, /* 0x90 */ 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192, /* 0x90 */ 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, /* 0xA0 */ 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00A4, /* 0xA0 */ 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, /* 0xB0 */ 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, /* 0xB0 */ 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, /* 0xC0 */ 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, /* 0xC0 */ 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, /* 0xD0 */ 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, /* 0xD0 */ 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, /* 0xE0 */ 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, /* 0xE0 */ 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, /* 0xF0 */ 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ #define IBM865CHAR_START 0x00A0 #define IBM865CHAR_END 0x00FF static sal_uChar const aImplIBM865ToCharTab[IBM865CHAR_END - IBM865CHAR_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xFF, 0xAD, 0, 0x9C, 0xAF, 0, 0, 0, /* 0x00A0 */ 0, 0, 0xA6, 0xAE, 0xAA, 0, 0, 0, /* 0x00A0 */ 0xF8, 0xF1, 0xFD, 0, 0, 0xE6, 0, 0xFA, /* 0x00B0 */ 0, 0, 0xA7, 0, 0xAC, 0xAB, 0, 0xA8, /* 0x00B0 */ 0, 0, 0, 0, 0x8E, 0x8F, 0x92, 0x80, /* 0x00C0 */ 0, 0x90, 0, 0, 0, 0, 0, 0, /* 0x00C0 */ 0, 0xA5, 0, 0, 0, 0, 0x99, 0, /* 0x00D0 */ 0x9D, 0, 0, 0, 0x9A, 0, 0, 0xE1, /* 0x00D0 */ 0x85, 0xA0, 0x83, 0, 0x84, 0x86, 0x91, 0x87, /* 0x00E0 */ 0x8A, 0x82, 0x88, 0x89, 0x8D, 0xA1, 0x8C, 0x8B, /* 0x00E0 */ 0, 0xA4, 0x95, 0xA2, 0x93, 0, 0x94, 0xF6, /* 0x00F0 */ 0x9B, 0x97, 0xA3, 0x96, 0x81, 0, 0, 0x98 /* 0x00F0 */ }; /* ----------------------------------------------------------------------- */ #define IBM865TOCHARTABEX_COUNT 75 static ImplUniCharTabData const aImplIBM865ToCharTabEx[IBM865TOCHARTABEX_COUNT] = { { 0x0192, 0x9F, 0 }, { 0x0393, 0xE2, 0 }, { 0x0398, 0xE9, 0 }, { 0x03A3, 0xE4, 0 }, { 0x03A6, 0xE8, 0 }, { 0x03A9, 0xEA, 0 }, { 0x03B1, 0xE0, 0 }, { 0x03B4, 0xEB, 0 }, { 0x03B5, 0xEE, 0 }, { 0x03C0, 0xE3, 0 }, { 0x03C3, 0xE5, 0 }, { 0x03C4, 0xE7, 0 }, { 0x03C6, 0xED, 0 }, { 0x207F, 0xFC, 0 }, { 0x20A7, 0x9E, 0 }, { 0x2219, 0xF9, 0 }, { 0x221A, 0xFB, 0 }, { 0x221E, 0xEC, 0 }, { 0x2229, 0xEF, 0 }, { 0x2248, 0xF7, 0 }, { 0x2261, 0xF0, 0 }, { 0x2264, 0xF3, 0 }, { 0x2265, 0xF2, 0 }, { 0x2310, 0xA9, 0 }, { 0x2320, 0xF4, 0 }, { 0x2321, 0xF5, 0 }, { 0x2500, 0xC4, 0 }, { 0x2502, 0xB3, 0 }, { 0x250C, 0xDA, 0 }, { 0x2510, 0xBF, 0 }, { 0x2514, 0xC0, 0 }, { 0x2518, 0xD9, 0 }, { 0x251C, 0xC3, 0 }, { 0x2524, 0xB4, 0 }, { 0x252C, 0xC2, 0 }, { 0x2534, 0xC1, 0 }, { 0x253C, 0xC5, 0 }, { 0x2550, 0xCD, 0 }, { 0x2551, 0xBA, 0 }, { 0x2552, 0xD5, 0 }, { 0x2553, 0xD6, 0 }, { 0x2554, 0xC9, 0 }, { 0x2555, 0xB8, 0 }, { 0x2556, 0xB7, 0 }, { 0x2557, 0xBB, 0 }, { 0x2558, 0xD4, 0 }, { 0x2559, 0xD3, 0 }, { 0x255A, 0xC8, 0 }, { 0x255B, 0xBE, 0 }, { 0x255C, 0xBD, 0 }, { 0x255D, 0xBC, 0 }, { 0x255E, 0xC6, 0 }, { 0x255F, 0xC7, 0 }, { 0x2560, 0xCC, 0 }, { 0x2561, 0xB5, 0 }, { 0x2562, 0xB6, 0 }, { 0x2563, 0xB9, 0 }, { 0x2564, 0xD1, 0 }, { 0x2565, 0xD2, 0 }, { 0x2566, 0xCB, 0 }, { 0x2567, 0xCF, 0 }, { 0x2568, 0xD0, 0 }, { 0x2569, 0xCA, 0 }, { 0x256A, 0xD8, 0 }, { 0x256B, 0xD7, 0 }, { 0x256C, 0xCE, 0 }, { 0x2580, 0xDF, 0 }, { 0x2584, 0xDC, 0 }, { 0x2588, 0xDB, 0 }, { 0x258C, 0xDD, 0 }, { 0x2590, 0xDE, 0 }, { 0x2591, 0xB0, 0 }, { 0x2592, 0xB1, 0 }, { 0x2593, 0xB2, 0 }, { 0x25A0, 0xFE, 0 } }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplIBM865ByteCvtData = { aImplIBM865ToUniTab, NULL, IBM865UNI_START, IBM865UNI_END, NOTABUNI_START, NOTABUNI_END, aImplIBM865ToCharTab, NULL, aImplIBM865ToCharTabEx, IBM865CHAR_START, IBM865CHAR_END, NOTABCHAR_START, NOTABCHAR_END, IBM865TOCHARTABEX_COUNT }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplIBM865TextEncodingData = { { &aImplIBM865ByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-1", "IBM865", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_MIME }; /* DOS/OS2, SCRIPT_LATIN, pc code page 865 */ /* ======================================================================= */ /* MS-1252 */ /* Windows Standard CharSet (ANSI) for Western Script */ /* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ /* Convert-Tables: mappings/vendors/micsft/windows/cp1252.txt from 04/15/98 Version 2.01 */ /* Last-Changes from us: */ /* ----------------------------------------------------------------------- */ #define MS1252UNI_START 0x80 #define MS1252UNI_END 0xFF static sal_uInt16 const aImplMS1252ToUniTab[MS1252UNI_END - MS1252UNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x20AC, 0, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, /* 0x80 */ 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0, 0x017D, 0, /* 0x80 */ 0, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, /* 0x90 */ 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0, 0x017E, 0x0178, /* 0x90 */ 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, /* 0xA0 */ 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, /* 0xA0 */ 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, /* 0xB0 */ 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, /* 0xB0 */ 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, /* 0xC0 */ 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, /* 0xC0 */ 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, /* 0xD0 */ 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, /* 0xD0 */ 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, /* 0xE0 */ 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, /* 0xE0 */ 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, /* 0xF0 */ 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ #define MS1252TOCHARTABEX_COUNT 27 static ImplUniCharTabData const aImplMS1252ToCharTabEx[MS1252TOCHARTABEX_COUNT] = { { 0x0152, 0x8C, 0 }, { 0x0153, 0x9C, 0 }, { 0x0160, 0x8A, 0 }, { 0x0161, 0x9A, 0 }, { 0x0178, 0x9F, 0 }, { 0x017D, 0x8E, 0 }, { 0x017E, 0x9E, 0 }, { 0x0192, 0x83, 0 }, { 0x02C6, 0x88, 0 }, { 0x02DC, 0x98, 0 }, { 0x2013, 0x96, 0 }, { 0x2014, 0x97, 0 }, { 0x2018, 0x91, 0 }, { 0x2019, 0x92, 0 }, { 0x201A, 0x82, 0 }, { 0x201C, 0x93, 0 }, { 0x201D, 0x94, 0 }, { 0x201E, 0x84, 0 }, { 0x2020, 0x86, 0 }, { 0x2021, 0x87, 0 }, { 0x2022, 0x95, 0 }, { 0x2026, 0x85, 0 }, { 0x2030, 0x89, 0 }, { 0x2039, 0x8B, 0 }, { 0x203A, 0x9B, 0 }, { 0x20AC, 0x80, 0 }, { 0x2122, 0x99, 0 }, }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplMS1252ByteCvtData = { aImplMS1252ToUniTab, NULL, MS1252UNI_START, MS1252UNI_END, NOTABUNI_START, NOTABUNI_END, aImplA0FFSameToCharTab, NULL, aImplMS1252ToCharTabEx, SAMEA0FFCHAR_START, SAMEA0FFCHAR_END, NOTABCHAR_START, NOTABCHAR_END, MS1252TOCHARTABEX_COUNT }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplMS1252TextEncodingData = { { &aImplMS1252ByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-1", "windows-1252", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_MIME }; /* WIN, SCRIPT_LATIN, pc code page 850 */ /* ======================================================================= */ /* ISO-8859-1 */ /* Unix Standard CharSet (Latin1) for Western Script */ /* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme, 0x80-0x9F Control-Caracter wie in Unicode */ /* Convert-Tables: mappings/iso8859/8859-1.txt from 07/27/99 Version 1.0 (based on Unicode 3.0) */ /* Last-Changes from us: */ #define ISO88591UNI_START 0xA0 #define ISO88591UNI_END 0xFF static sal_uInt16 const aImplISO88591ToUniTab[ISO88591UNI_END - ISO88591UNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, /* 0xA0 */ 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, /* 0xA0 */ 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, /* 0xB0 */ 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, /* 0xB0 */ 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, /* 0xC0 */ 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, /* 0xC0 */ 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, /* 0xD0 */ 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, /* 0xD0 */ 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, /* 0xE0 */ 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, /* 0xE0 */ 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, /* 0xF0 */ 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplISO88591ByteCvtData = { aImplISO88591ToUniTab, aImpl8090SameToUniTab, ISO88591UNI_START, ISO88591UNI_END, SAME8090UNI_START, SAME8090UNI_END, aImplA0FFSameToCharTab, aImpl8090SameToCharTab, NULL, SAMEA0FFCHAR_START, SAMEA0FFCHAR_END, SAME8090CHAR_START, SAME8090CHAR_END, 0 }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplISO88591TextEncodingData = { { &aImplISO88591ByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-1", "iso-8859-1", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_MIME }; /* SCRIPT_LATIN, pc code page 850 */ /* ======================================================================= */ /* ISO-8859-14 */ /* ungefaehr wie Latin1 */ /* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme, 0x80-0x9F Control-Caracter wie in Unicode */ /* Convert-Tables: mappings/iso8859/8859-14.txt from 07/27/99 Version 1.0 (based on Unicode 3.0) */ /* Last-Changes from us: */ #define ISO885914UNI_START 0xA0 #define ISO885914UNI_END 0xFF static sal_uInt16 const aImplISO885914ToUniTab[ISO885914UNI_END - ISO885914UNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7, /* 0xA0 */ 0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178, /* 0xA0 */ 0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56, /* 0xB0 */ 0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61, /* 0xB0 */ 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, /* 0xC0 */ 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, /* 0xC0 */ 0x0174, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x1E6A, /* 0xD0 */ 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x0176, 0x00DF, /* 0xD0 */ 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, /* 0xE0 */ 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, /* 0xE0 */ 0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B, /* 0xF0 */ 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ #define ISO885914CHAR_START 0x00C0 #define ISO885914CHAR_END 0x00FF static sal_uChar const aImplISO885914ToCharTab[ISO885914CHAR_END - ISO885914CHAR_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 0x00C0 */ 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, /* 0x00C0 */ 0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0, /* 0x00D0 */ 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0, 0xDF, /* 0x00D0 */ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, /* 0x00E0 */ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, /* 0x00E0 */ 0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0, /* 0x00F0 */ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0, 0xFF /* 0x00F0 */ }; /* ----------------------------------------------------------------------- */ #define ISO885914TOCHARTABEX_COUNT 38 static ImplUniCharTabData const aImplISO885914ToCharTabEx[ISO885914TOCHARTABEX_COUNT] = { { 0x00A0, 0xA0, 0 }, { 0x00A3, 0xA3, 0 }, { 0x00A7, 0xA7, 0 }, { 0x00A9, 0xA9, 0 }, { 0x00AD, 0xAD, 0 }, { 0x00AE, 0xAE, 0 }, { 0x00B6, 0xB6, 0 }, { 0x010A, 0xA4, 0 }, { 0x010B, 0xA5, 0 }, { 0x0120, 0xB2, 0 }, { 0x0121, 0xB3, 0 }, { 0x0174, 0xD0, 0 }, { 0x0175, 0xF0, 0 }, { 0x0176, 0xDE, 0 }, { 0x0177, 0xFE, 0 }, { 0x0178, 0xAF, 0 }, { 0x1E02, 0xA1, 0 }, { 0x1E03, 0xA2, 0 }, { 0x1E0A, 0xA6, 0 }, { 0x1E0B, 0xAB, 0 }, { 0x1E1E, 0xB0, 0 }, { 0x1E1F, 0xB1, 0 }, { 0x1E40, 0xB4, 0 }, { 0x1E41, 0xB5, 0 }, { 0x1E56, 0xB7, 0 }, { 0x1E57, 0xB9, 0 }, { 0x1E60, 0xBB, 0 }, { 0x1E61, 0xBF, 0 }, { 0x1E6A, 0xD7, 0 }, { 0x1E6B, 0xF7, 0 }, { 0x1E80, 0xA8, 0 }, { 0x1E81, 0xB8, 0 }, { 0x1E82, 0xAA, 0 }, { 0x1E83, 0xBA, 0 }, { 0x1E84, 0xBD, 0 }, { 0x1E85, 0xBE, 0 }, { 0x1EF2, 0xAC, 0 }, { 0x1EF3, 0xBC, 0 } }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplISO885914ByteCvtData = { aImplISO885914ToUniTab, aImpl8090SameToUniTab, ISO885914UNI_START, ISO885914UNI_END, SAME8090UNI_START, SAME8090UNI_END, aImplISO885914ToCharTab, aImpl8090SameToCharTab, aImplISO885914ToCharTabEx, ISO885914CHAR_START, ISO885914CHAR_END, SAME8090CHAR_START, SAME8090CHAR_END, ISO885914TOCHARTABEX_COUNT }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplISO885914TextEncodingData = { { &aImplISO885914ByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-14", "iso-8859-14", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_MIME }; /* SCRIPT_LATIN, pc code page 850 */ /* ======================================================================= */ /* ISO-8859-15 */ /* ungefaehr wie Latin1, jedoch mit Euro (ehemaliges CURRENCY-Symbol an A4) */ /* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme, 0x80-0x9F Control-Caracter wie in Unicode */ /* Convert-Tables: mappings/iso8859/8859-15.txt from 07/27/99 Version 1.0 (based on Unicode 3.0) */ /* Last-Changes from us: */ #define ISO885915UNI_START 0xA0 #define ISO885915UNI_END 0xFF static sal_uInt16 const aImplISO885915ToUniTab[ISO885915UNI_END - ISO885915UNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0160, 0x00A7, /* 0xA0 */ 0x0161, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, /* 0xA0 */ 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, 0x00B6, 0x00B7, /* 0xB0 */ 0x017E, 0x00B9, 0x00BA, 0x00BB, 0x0152, 0x0153, 0x0178, 0x00BF, /* 0xB0 */ 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, /* 0xC0 */ 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, /* 0xC0 */ 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, /* 0xD0 */ 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, /* 0xD0 */ 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, /* 0xE0 */ 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, /* 0xE0 */ 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, /* 0xF0 */ 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ #define ISO885915CHAR_START 0x00A0 #define ISO885915CHAR_END 0x00FF static sal_uChar const aImplISO885915ToCharTab[ISO885915CHAR_END - ISO885915CHAR_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA0, 0xA1, 0xA2, 0xA3, 0, 0xA5, 0, 0xA7, /* 0x00A0 */ 0, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, /* 0x00A0 */ 0xB0, 0xB1, 0xB2, 0xB3, 0, 0xB5, 0xB6, 0xB7, /* 0x00B0 */ 0, 0xB9, 0xBA, 0xBB, 0, 0, 0, 0xBF, /* 0x00B0 */ 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 0x00C0 */ 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, /* 0x00C0 */ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, /* 0x00D0 */ 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, /* 0x00D0 */ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, /* 0x00E0 */ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, /* 0x00E0 */ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, /* 0x00F0 */ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF /* 0x00F0 */ }; /* ----------------------------------------------------------------------- */ #define ISO885915TOCHARTABEX_COUNT 8 static ImplUniCharTabData const aImplISO885915ToCharTabEx[ISO885915TOCHARTABEX_COUNT] = { { 0x0152, 0xBC, 0 }, { 0x0153, 0xBD, 0 }, { 0x0160, 0xA6, 0 }, { 0x0161, 0xA8, 0 }, { 0x0178, 0xBE, 0 }, { 0x017D, 0xB4, 0 }, { 0x017E, 0xB8, 0 }, { 0x20AC, 0xA4, 0 } }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplISO885915ByteCvtData = { aImplISO885915ToUniTab, aImpl8090SameToUniTab, ISO885915UNI_START, ISO885915UNI_END, SAME8090UNI_START, SAME8090UNI_END, aImplISO885915ToCharTab, aImpl8090SameToCharTab, aImplISO885915ToCharTabEx, ISO885915CHAR_START, ISO885915CHAR_END, SAME8090CHAR_START, SAME8090CHAR_END, ISO885915TOCHARTABEX_COUNT }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplISO885915TextEncodingData = { { &aImplISO885915ByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-15", "iso-8859-15", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_MIME }; /* SCRIPT_LATIN, pc code page 850 */ /* ======================================================================= */ /* APPLE-Iceland */ /* Apple CharSet for Iceland */ /* 1-Byte, 0x00-0x7F ASCII, jedoch eigentich Sonderzeichen zwischen 0x00-0x1F */ /* die wir aber nicht beruecksichtigen */ /* Convert-Tables: mappings/vendors/apple/iceland.txt from 02/05/98 */ /* Last-Changes from us: */ #define APPLEICELANDUNI_START 0x80 #define APPLEICELANDUNI_END 0xFF static sal_uInt16 const aImplAPPLEICELANDToUniTab[APPLEICELANDUNI_END - APPLEICELANDUNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, /* 0x80 */ 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, /* 0x80 */ 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, /* 0x90 */ 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, /* 0x90 */ 0x00DD, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, /* 0xA0 */ 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, /* 0xA0 */ 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, /* 0xB0 */ 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, /* 0xB0 */ 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, /* 0xC0 */ 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, /* 0xC0 */ 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, /* 0xD0 */ 0x00FF, 0x0178, 0x2044, 0x00A4, 0x00D0, 0x00F0, 0x00DE, 0x00FE, /* 0xD0 */ 0x00FD, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, /* 0xE0 */ 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, /* 0xE0 */ 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, /* 0xF0 */ 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ #define APPLEICELANDCHAR_START 0x00A0 #define APPLEICELANDCHAR_END 0x00FF static sal_uChar const aImplAPPLEICELANDToCharTab[APPLEICELANDCHAR_END - APPLEICELANDCHAR_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xCA, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, 0, 0xA4, /* 0x00A0 */ 0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0, 0xA8, 0xF8, /* 0x00A0 */ 0xA1, 0xB1, 0, 0, 0xAB, 0xB5, 0xA6, 0xE1, /* 0x00B0 */ 0xFC, 0, 0xBC, 0xC8, 0, 0, 0, 0xC0, /* 0x00B0 */ 0xCB, 0xE7, 0xE5, 0xCC, 0x80, 0x81, 0xAE, 0x82, /* 0x00C0 */ 0xE9, 0x83, 0xE6, 0xE8, 0xED, 0xEA, 0xEB, 0xEC, /* 0x00C0 */ 0xDC, 0x84, 0xF1, 0xEE, 0xEF, 0xCD, 0x85, 0, /* 0x00D0 */ 0xAF, 0xF4, 0xF2, 0xF3, 0x86, 0xA0, 0xDE, 0xA7, /* 0x00D0 */ 0x88, 0x87, 0x89, 0x8B, 0x8A, 0x8C, 0xBE, 0x8D, /* 0x00E0 */ 0x8F, 0x8E, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95, /* 0x00E0 */ 0xDD, 0x96, 0x98, 0x97, 0x99, 0x9B, 0x9A, 0xD6, /* 0x00F0 */ 0xBF, 0x9D, 0x9C, 0x9E, 0x9F, 0xE0, 0xDF, 0xD8 /* 0x00F0 */ }; /* ----------------------------------------------------------------------- */ #define APPLEICELANDTOCHARTABEX_COUNT 41 static ImplUniCharTabData const aImplAPPLEICELANDToCharTabEx[APPLEICELANDTOCHARTABEX_COUNT] = { { 0x0131, 0xF5, 0 }, { 0x0152, 0xCE, 0 }, { 0x0153, 0xCF, 0 }, { 0x0178, 0xD9, 0 }, { 0x0192, 0xC4, 0 }, { 0x02C6, 0xF6, 0 }, { 0x02C7, 0xFF, 0 }, { 0x02D8, 0xF9, 0 }, { 0x02D9, 0xFA, 0 }, { 0x02DA, 0xFB, 0 }, { 0x02DB, 0xFE, 0 }, { 0x02DC, 0xF7, 0 }, { 0x02DD, 0xFD, 0 }, { 0x03A9, 0xBD, 0 }, { 0x03C0, 0xB9, 0 }, { 0x2013, 0xD0, 0 }, { 0x2014, 0xD1, 0 }, { 0x2018, 0xD4, 0 }, { 0x2019, 0xD5, 0 }, { 0x201A, 0xE2, 0 }, { 0x201C, 0xD2, 0 }, { 0x201D, 0xD3, 0 }, { 0x201E, 0xE3, 0 }, { 0x2022, 0xA5, 0 }, { 0x2026, 0xC9, 0 }, { 0x2030, 0xE4, 0 }, { 0x2044, 0xDA, 0 }, { 0x2122, 0xAA, 0 }, { 0x2202, 0xB6, 0 }, { 0x2206, 0xC6, 0 }, { 0x220F, 0xB8, 0 }, { 0x2211, 0xB7, 0 }, { 0x221A, 0xC3, 0 }, { 0x221E, 0xB0, 0 }, { 0x222B, 0xBA, 0 }, { 0x2248, 0xC5, 0 }, { 0x2260, 0xAD, 0 }, { 0x2264, 0xB2, 0 }, { 0x2265, 0xB3, 0 }, { 0x25CA, 0xD7, 0 }, { 0xF8FF, 0xF0, 0 } }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplAPPLEICELANDByteCvtData = { aImplAPPLEICELANDToUniTab, NULL, APPLEICELANDUNI_START, APPLEICELANDUNI_END, NOTABUNI_START, NOTABUNI_END, aImplAPPLEICELANDToCharTab, NULL, aImplAPPLEICELANDToCharTabEx, APPLEICELANDCHAR_START, APPLEICELANDCHAR_END, NOTABCHAR_START, NOTABCHAR_END, APPLEICELANDTOCHARTABEX_COUNT }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplAPPLEICELANDTextEncodingData = { { &aImplAPPLEICELANDByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-1", "iso-8859-1", RTL_TEXTENCODING_INFO_ASCII }; /* MAC, SCRIPT_LATIN, pc code page 861, mac encoding 37 */ /* ======================================================================= */ /* APPLE-Roman */ /* Standard Apple CharSet for Western */ /* 1-Byte, 0x00-0x7F ASCII, jedoch eigentich Sonderzeichen zwischen 0x00-0x1F */ /* die wir aber nicht beruecksichtigen */ /* Convert-Tables: mappings/vendors/apple/roman.txt from 08/18/98 */ /* Last-Changes from us: */ #define APPLEROMANUNI_START 0x80 #define APPLEROMANUNI_END 0xFF static sal_uInt16 const aImplAPPLEROMANToUniTab[APPLEROMANUNI_END - APPLEROMANUNI_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, /* 0x80 */ 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, /* 0x80 */ 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, /* 0x90 */ 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, /* 0x90 */ 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, /* 0xA0 */ 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, /* 0xA0 */ 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, /* 0xB0 */ 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, /* 0xB0 */ 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, /* 0xC0 */ 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, /* 0xC0 */ 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, /* 0xD0 */ 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02, /* 0xD0 */ 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, /* 0xE0 */ 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, /* 0xE0 */ 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, /* 0xF0 */ 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ #define APPLEROMANCHAR_START 0x00A0 #define APPLEROMANCHAR_END 0x00FF static sal_uChar const aImplAPPLEROMANToCharTab[APPLEROMANCHAR_END - APPLEROMANCHAR_START + 1] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xCA, 0xC1, 0xA2, 0xA3, 0, 0xB4, 0, 0xA4, /* 0x00A0 */ 0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0, 0xA8, 0xF8, /* 0x00A0 */ 0xA1, 0xB1, 0, 0, 0xAB, 0xB5, 0xA6, 0xE1, /* 0x00B0 */ 0xFC, 0, 0xBC, 0xC8, 0, 0, 0, 0xC0, /* 0x00B0 */ 0xCB, 0xE7, 0xE5, 0xCC, 0x80, 0x81, 0xAE, 0x82, /* 0x00C0 */ 0xE9, 0x83, 0xE6, 0xE8, 0xED, 0xEA, 0xEB, 0xEC, /* 0x00C0 */ 0, 0x84, 0xF1, 0xEE, 0xEF, 0xCD, 0x85, 0, /* 0x00D0 */ 0xAF, 0xF4, 0xF2, 0xF3, 0x86, 0, 0, 0xA7, /* 0x00D0 */ 0x88, 0x87, 0x89, 0x8B, 0x8A, 0x8C, 0xBE, 0x8D, /* 0x00E0 */ 0x8F, 0x8E, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95, /* 0x00E0 */ 0, 0x96, 0x98, 0x97, 0x99, 0x9B, 0x9A, 0xD6, /* 0x00F0 */ 0xBF, 0x9D, 0x9C, 0x9E, 0x9F, 0, 0, 0xD8 /* 0x00F0 */ }; /* ----------------------------------------------------------------------- */ #define APPLEROMANTOCHARTABEX_COUNT 48 static ImplUniCharTabData const aImplAPPLEROMANToCharTabEx[APPLEROMANTOCHARTABEX_COUNT] = { { 0x0131, 0xF5, 0 }, { 0x0152, 0xCE, 0 }, { 0x0153, 0xCF, 0 }, { 0x0178, 0xD9, 0 }, { 0x0192, 0xC4, 0 }, { 0x02C6, 0xF6, 0 }, { 0x02C7, 0xFF, 0 }, { 0x02D8, 0xF9, 0 }, { 0x02D9, 0xFA, 0 }, { 0x02DA, 0xFB, 0 }, { 0x02DB, 0xFE, 0 }, { 0x02DC, 0xF7, 0 }, { 0x02DD, 0xFD, 0 }, { 0x03A9, 0xBD, 0 }, { 0x03C0, 0xB9, 0 }, { 0x2013, 0xD0, 0 }, { 0x2014, 0xD1, 0 }, { 0x2018, 0xD4, 0 }, { 0x2019, 0xD5, 0 }, { 0x201A, 0xE2, 0 }, { 0x201C, 0xD2, 0 }, { 0x201D, 0xD3, 0 }, { 0x201E, 0xE3, 0 }, { 0x2020, 0xA0, 0 }, { 0x2021, 0xE0, 0 }, { 0x2022, 0xA5, 0 }, { 0x2026, 0xC9, 0 }, { 0x2030, 0xE4, 0 }, { 0x2039, 0xDC, 0 }, { 0x203A, 0xDD, 0 }, { 0x2044, 0xDA, 0 }, { 0x20AC, 0xDB, 0 }, { 0x2122, 0xAA, 0 }, { 0x2202, 0xB6, 0 }, { 0x2206, 0xC6, 0 }, { 0x220F, 0xB8, 0 }, { 0x2211, 0xB7, 0 }, { 0x221A, 0xC3, 0 }, { 0x221E, 0xB0, 0 }, { 0x222B, 0xBA, 0 }, { 0x2248, 0xC5, 0 }, { 0x2260, 0xAD, 0 }, { 0x2264, 0xB2, 0 }, { 0x2265, 0xB3, 0 }, { 0x25CA, 0xD7, 0 }, { 0xF8FF, 0xF0, 0 }, { 0xFB01, 0xDE, 0 }, { 0xFB02, 0xDF, 0 } }; /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplAPPLEROMANByteCvtData = { aImplAPPLEROMANToUniTab, NULL, APPLEROMANUNI_START, APPLEROMANUNI_END, NOTABUNI_START, NOTABUNI_END, aImplAPPLEROMANToCharTab, NULL, aImplAPPLEROMANToCharTabEx, APPLEROMANCHAR_START, APPLEROMANCHAR_END, NOTABCHAR_START, NOTABCHAR_END, APPLEROMANTOCHARTABEX_COUNT }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplAPPLEROMANTextEncodingData = { { &aImplAPPLEROMANByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 77, "iso8859-1", "macintosh", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_MIME }; /* MAC, SCRIPT_LATIN, pc code page 850 */ /* ======================================================================= */ /* US-ASCII */ /* 7-Bit ASCII */ /* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ /* For the import we use ISO-8859-1 with MS extension (MS-1252), because */ /* when the 8-Bit is set, the chance, that this is a ISO-8859-1 character */ /* is the greatest. For the export all chars greater than 127 are not */ /* converted and are replaced by the replacement character. */ /* Last-Changes from us: */ /* ----------------------------------------------------------------------- */ static ImplByteConvertData const aImplUSASCIIByteCvtData = { aImplMS1252ToUniTab, NULL, MS1252UNI_START, MS1252UNI_END, NOTABUNI_START, NOTABUNI_END, NULL, NULL, NULL, NOTABCHAR_START, NOTABCHAR_END, NOTABCHAR_START, NOTABCHAR_END, 0 }; /* ----------------------------------------------------------------------- */ static ImplTextEncodingData const aImplUSASCIITextEncodingData = { { &aImplUSASCIIByteCvtData, ImplCharToUnicode, ImplUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 0, "iso8859-1", "us-ascii", RTL_TEXTENCODING_INFO_ASCII | RTL_TEXTENCODING_INFO_7BIT | RTL_TEXTENCODING_INFO_MIME }; /* SCRIPT_LATIN, pc code page 437 */
the_stack
INSERT INTO "metadata" VALUES('NKG.SOURCE', 'https://github.com/NordicGeodesy/NordicTransformations'); INSERT INTO "metadata" VALUES('NKG.VERSION', '1.0.0'); INSERT INTO "metadata" VALUES('NKG.DATE', '2020-12-21'); -- extent for NKG2008 transformations INSERT INTO "extent" VALUES( 'NKG','EXTENT_2008', -- extend auth+code 'Nordic and Baltic countries', -- name 'Denmark; Estonia; Finland; Latvia; Lithuania; Norway; Sweden', -- description 53.0, -- south latitude 73.0, -- north latitude 3.0, -- west longitude 40.0, -- east longitude 0 ); -- extent for NKG2020 transformations INSERT INTO "extent" VALUES( 'NKG','EXTENT_2020', -- extend auth+code 'Nordic and Baltic countries', -- name 'Denmark; Estonia; Finland; Latvia; Lithuania; Norway; Sweden', -- description 50.0, -- south latitude 75.0, -- north latitude 0.0, -- west longitude 49.0, -- east longitude 0 ); -- Scope for both NKG2008 and NKG2020 transformations INSERT INTO "scope" VALUES ( 'NKG', 'SCOPE_GENERIC', -- scope auth+code 'Geodesy. High accuracy ETRS89 transformations', -- scope 0 --deprecated ); ------------------------------------------------------- -- DATUM+CRS: NKG_ETRF00 ------------------------------------------------------- INSERT INTO "geodetic_datum" VALUES ( 'NKG','DATUM_NKG_ETRF00', -- auth+code 'NKG_ETRF00', -- name NULL, -- description 'EPSG','7019', -- ellipsoid auth+code 'EPSG','8901', -- prime meridian auth+code '2016-03-16', -- publication date 2000.0, -- frame reference epoch NULL, -- ensemble accuracy NULL, -- anchor 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG','5007', 'geodetic_datum', 'NKG','DATUM_NKG_ETRF00', 'NKG','EXTENT_2008', -- extend auth+code 'NKG','SCOPE_GENERIC' -- scope auth+code ); -- Add CRS entry for NKG common frame ETRF_NKG00 INSERT INTO "geodetic_crs" VALUES( 'NKG','ETRF00', -- CRS auth+code 'NKG_ETRF00', -- name 'NKG Common reference frame 2000', -- description 'geocentric', -- type 'EPSG','6500', -- CRS type auth+code: ECEF 'NKG','DATUM_NKG_ETRF00', -- datum auth+code NULL, -- text definition 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5101', -- usage auth+code 'geodetic_crs', -- object_table_name 'NKG', 'ETRF00', -- object auth+code 'NKG', 'EXTENT_2008', -- extent auth+code 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- DATUM+CRS: NKG_ETRF14 ------------------------------------------------------- INSERT INTO "geodetic_datum" VALUES ( 'NKG','DATUM_NKG_ETRF14', -- auth+code 'NKG_ETRF14', -- name NULL, -- description 'EPSG','7019', -- ellipsoid auth+code 'EPSG','8901', -- prime meridian auth+code '2021-03-01', -- publication date 2000.0, -- frame reference epoch NULL, -- ensemble accuracy NULL, -- anchor 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG','5033', 'geodetic_datum', 'NKG','DATUM_NKG_ETRF14', 'NKG','EXTENT_2020', -- extend auth+code 'NKG','SCOPE_GENERIC' -- scope auth+code ); -- Add CRS entry for NKG common frame ETRF_NKG00 INSERT INTO "geodetic_crs" VALUES( 'NKG','ETRF14', -- CRS auth+code 'NKG_ETRF14', -- name 'NKG Common reference frame 2014', -- description 'geocentric', -- type 'EPSG','6500', -- CRS type auth+code: ECEF 'NKG','DATUM_NKG_ETRF14', -- datum auth+code NULL, -- text definition 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5102', -- usage auth+code 'geodetic_crs', -- object_table_name 'NKG', 'ETRF14', -- object auth+code 'NKG', 'EXTENT_2020', -- extent auth+code 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2000 -> NKG_ETRF00 ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2000_TO_NKG_ETRF00', -- operation auth+code 'ITRF2000 to NKG_ETRF00', -- name 'Time-dependent transformation from ITRF2000 to NKG_ETRF00', -- description 'EPSG', '4919', -- source_crs: ITRF2000 'NKG', 'ETRF00',-- target_crs: NKG_ETRF00 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG','NKG_ETRF00_TO_ETRF2000', -- operation auth+code 'NKG_ETRF00 to ETRF2000', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+code '+proj=deformation +t_epoch=2000.0 +grids=eur_nkg_nkgrf03vel_realigned.tif', 'NKG', 'ETRF00',-- source_crs: NKG_ETRF00 'EPSG','7930', -- target_crs: ETRF2000 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5003', -- usage auth+code 'other_transformation', -- object_table_name 'NKG','NKG_ETRF00_TO_ETRF2000', -- object auth+code 'NKG','EXTENT_2008', -- extent auth+code 'NKG','SCOPE_GENERIC' -- scope auth+code ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2000_TO_NKG_ETRF00', 2, 'EPSG', '7941'), -- ITRF2000 -> ETRF2000 ('NKG', 'ITRF2000_TO_NKG_ETRF00', 3, 'NKG', 'NKG_ETRF00_TO_ETRF2000') ; INSERT INTO "usage" VALUES ( 'NKG', '5001', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2000_TO_NKG_ETRF00', -- object auth+code 'NKG', 'EXTENT_2008', -- extent auth+code 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2014 -> NKG_ETRF14 ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2014_TO_NKG_ETRF14', -- operation auth+code 'ITRF2014 to NKG_ETRF14', -- name 'Time-dependent transformation from ITRF2014 to NKG_ETRF14', -- description 'EPSG', '7789', -- source_crs: ITRF2014 'NKG', 'ETRF14',-- target_crs: NKG_ETRF14 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG','NKG_ETRF14_TO_ETRF2014', -- operation auth+code 'NKG_ETRF14 to ETRF2014', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+code '+proj=deformation +t_epoch=2000.0 +grids=eur_nkg_nkgrf17vel.tif', 'NKG', 'ETRF14',-- source_crs: NKG_ETRF14 'EPSG','8401', -- target_crs: ETRF2014 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5034', -- usage auth+code 'other_transformation', -- object_table_name 'NKG','NKG_ETRF14_TO_ETRF2014', -- object auth+code 'NKG','EXTENT_2020', -- extent auth+code 'NKG','SCOPE_GENERIC' -- scope auth+code ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2014_TO_NKG_ETRF14', 2, 'EPSG', '8366'), -- ITRF2014 -> ETRF2014 ('NKG', 'ITRF2014_TO_NKG_ETRF14', 3, 'NKG', 'NKG_ETRF14_TO_ETRF2014') ; INSERT INTO "usage" VALUES ( 'NKG', '5035', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2014_TO_NKG_ETRF14', -- object auth+code 'NKG', 'EXTENT_2020', -- extent auth+code 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------------- -- Intermediate transformations: NKG_ETRF00 -> ETRFyy@2000.00 ------------------------------------------------------------- -- DK INSERT INTO "helmert_transformation" VALUES ( 'NKG','P1_2008_DK', -- operation auth+code 'NKG_ETRF00 to ETRF92@2000.0', -- name 'Transformation from NKG_ETRF00 to ETRF92, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF00', -- source auth+code 'EPSG','7920', -- target auth+code 0.005, -- accuracy 0.03863, -- x 0.147, -- y 0.02776, -- z 'EPSG','9001', 0.00617753, -- rx 5.064e-05, -- ry 4.729e-05, -- rz 'EPSG','9104', -0.009420, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2008', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5004', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','P1_2008_DK', -- object auth+code 'EPSG', '1080', -- extent: Denmark - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); -- EE INSERT INTO "helmert_transformation" VALUES ( 'NKG','P1_2008_EE', -- operation auth+code 'NKG_ETRF00 to ETRF96@2000.0', -- name 'Transformation from NKG_ETRF00 to ETRF96, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF00', -- source auth+code 'EPSG','7926', -- target auth+code 0.005, -- accuracy 0.12194, -- x 0.02225, -- y -0.03541, -- z 'EPSG','9001', 0.00227196, -- rx -0.00323934, -- ry 0.00247008, -- rz 'EPSG','9104', -0.005626, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2008', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5008', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','P1_2008_EE', -- object auth+code 'EPSG', '1090', -- extent: Estonia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); -- FI INSERT INTO "helmert_transformation" VALUES ( 'NKG','P1_2008_FI', -- operation auth+code 'NKG_ETRF00 to ETRF96@2000.0', -- name 'Transformation from NKG_ETRF00 to ETRF96, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF00', -- source auth+code 'EPSG','7926', -- target auth+code 0.005, -- accuracy 0.07251, -- x -0.13019, -- y -0.11323, -- z 'EPSG','9001', -0.00157399, -- rx -0.00308833, -- ry 0.00410332, -- rz 'EPSG','9104', 0.013012, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2008', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5009', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','P1_2008_FI', -- object auth+code 'EPSG', '1095', -- extent: Finland - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); -- LV INSERT INTO "helmert_transformation" VALUES ( 'NKG','P1_2008_LV', -- operation auth+code 'NKG_ETRF00 to ETRF89@2000.0', -- name 'Transformation from NKG_ETRF00 to ETRF89, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF00', -- source auth+code 'EPSG','7914', -- target auth+code 0.02, -- accuracy 0.41812, -- x -0.78105, -- y -0.01335, -- z 'EPSG','9001', -0.0216436, -- rx -0.0115184, -- ry 0.01719911, -- rz 'EPSG','9104', 0.000757, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2008', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5010', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','P1_2008_LV', -- object auth+code 'EPSG', '1139', -- extent: Latvia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); -- LT INSERT INTO "helmert_transformation" VALUES ( 'NKG','P1_2008_LT', -- operation auth+code 'NKG_ETRF00 to ETRF2000@2000.0', -- name 'Transformation from NKG_ETRF00 to ETRF2000, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF00', -- source auth+code 'EPSG','7930', -- target auth+code 0.01, -- accuracy 0.05692, -- x 0.115495, -- y -0.00078, -- z 'EPSG','9001', 0.00314291, -- rx -0.00147975, -- ry -0.00134758, -- rz 'EPSG','9104', -0.006182, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2008', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5011', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','P1_2008_LT', -- object auth+code 'EPSG', '1145', -- extent: Lithuania - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); -- NO INSERT INTO "helmert_transformation" VALUES ( 'NKG','P1_2008_NO', -- operation auth+code 'NKG_ETRF00 to ETRF93@2000.0', -- name 'Transformation from NKG_ETRF00 to ETRF93, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF00', -- source auth+code 'EPSG','7922', -- target auth+code 0.005, -- accuracy -0.13116, -- x -0.02817, -- y 0.02036, -- z 'EPSG','9001', -0.00038674, -- rx 0.00408947, -- ry 0.00103588, -- rz 'EPSG','9104', 0.006569, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2008', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5012', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','P1_2008_NO', -- object auth+code 'EPSG', '1352', -- extent: Norway - onshore 'NKG', 'SCOPE_GENERIC' -- scope ); -- SE INSERT INTO "helmert_transformation" VALUES ( 'NKG','P1_2008_SE', -- operation auth+code 'NKG_ETRF00 to ETRF97@2000.0', -- name 'Transformation from NKG_ETRF00 to ETRF97, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF00', -- source auth+code 'EPSG','7928', -- target auth+code 0.005, -- accuracy -0.01642, -- x -0.00064, -- y -0.0305, -- z 'EPSG','9001', 0.00187431, -- rx 0.00046382, -- ry 0.00228487, -- rz 'EPSG','9104', 0.001861, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2008', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5014', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','P1_2008_SE', -- object auth+code 'EPSG', '1225', -- extent: Sweden - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); ------------------------------------------------------------- -- Intermediate transformations: NKG_ETRF14 -> ETRFyy@2000.00 ------------------------------------------------------------- -- DK INSERT INTO "helmert_transformation" VALUES ( 'NKG','PAR_2020_DK', -- operation auth+code 'NKG_ETRF14 to ETRF92@2000.0', -- name 'Transformation from NKG_ETRF14 to ETRF92, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF14', -- source auth+code 'EPSG','7920', -- target auth+code 0.005, -- accuracy 0.66818, -- x 0.04453, -- y -0.45049, -- z 'EPSG','9001', 0.00312883, -- rx -0.02373423, -- ry 0.00442969, -- rz 'EPSG','9104', -0.003136, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2020', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5036', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','PAR_2020_DK', -- object auth+code 'EPSG', '1080', -- extent: Denmark - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); -- EE INSERT INTO "helmert_transformation" VALUES ( 'NKG','PAR_2020_EE', -- operation auth+code 'NKG_ETRF14 to ETRF96@2000.0', -- name 'Transformation from NKG_ETRF14 to ETRF96, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF14', -- source auth+code 'EPSG','7926', -- target auth+code 0.005, -- accuracy -0.05027, -- x -0.11595, -- y 0.03012, -- z 'EPSG','9001', -0.00310814, -- rx 0.00457237, -- ry 0.00472406, -- rz 'EPSG','9104', 0.003191, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2020', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5037', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','PAR_2020_EE', -- object auth+code 'EPSG', '1090', -- extent: Estonia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); -- FI INSERT INTO "helmert_transformation" VALUES ( 'NKG','PAR_2020_FI', -- operation auth+code 'NKG_ETRF14 to ETRF96@2000.0', -- name 'Transformation from NKG_ETRF14 to ETRF96, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF14', -- source auth+code 'EPSG','7926', -- target auth+code 0.005, -- accuracy 0.15651, -- x -0.10993, -- y -0.10935, -- z 'EPSG','9001', -0.00312861, -- rx -0.00378935, -- ry 0.00403512, -- rz 'EPSG','9104', 0.00529, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2020', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5038', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','PAR_2020_FI', -- object auth+code 'EPSG', '1095', -- extent: Finland - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); -- LV INSERT INTO "helmert_transformation" VALUES ( 'NKG','PAR_2020_LV', -- operation auth+code 'NKG_ETRF14 to ETRF89@2000.0', -- name 'Transformation from NKG_ETRF14 to ETRF89, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF14', -- source auth+code 'EPSG','7914', -- target auth+code 0.01, -- accuracy 0.09745, -- x -0.69388, -- y 0.52901, -- z 'EPSG','9001', -0.0192069, -- rx 0.01043272, -- ry 0.02327169, -- rz 'EPSG','9104', -0.049663, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2020', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5039', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','PAR_2020_LV', -- object auth+code 'EPSG', '1139', -- extent: Latvia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); -- LT INSERT INTO "helmert_transformation" VALUES ( 'NKG','PAR_2020_LT', -- operation auth+code 'NKG_ETRF14 to ETRF2000@2000.0', -- name 'Transformation from NKG_ETRF14 to ETRF2000, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF14', -- source auth+code 'EPSG','7930', -- target auth+code 0.015, -- accuracy 0.36749, -- x 0.14351, -- y -0.18472, -- z 'EPSG','9001', 0.0047914, -- rx -0.01027566, -- ry 0.00276102, -- rz 'EPSG','9104', -0.003684, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2020', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5040', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','PAR_2020_LT', -- object auth+code 'EPSG', '1145', -- extent: Lithuania - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); -- NO INSERT INTO "helmert_transformation" VALUES ( 'NKG','PAR_2020_NO', -- operation auth+code 'NKG_ETRF14 to ETRF93@2000.0', -- name 'Transformation from NKG_ETRF14 to ETRF93, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF14', -- source auth+code 'EPSG','7922', -- target auth+code 0.01, -- accuracy -0.05172, -- x 0.13747, -- y -0.01648, -- z 'EPSG','9001', 0.00268452, -- rx 0.00329165, -- ry -0.00116569, -- rz 'EPSG','9104', 0.002583, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2020', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5041', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','PAR_2020_NO', -- object auth+code 'EPSG', '1352', -- extent: Norway - onshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'NKG_ETRF14_ETRF93_2000', -- object auth+code 'NKG_ETRF14 to ETRF93@2000.0', -- name 'Transformation from NKG_ETRF14 to ETRF93, at transformation reference epoch 2000.0', -- description / remark 'PROJ', 'PROJString', '+proj=xyzgridshift +grids=no_kv_NKGETRF14_EPSG7922_2000.tif', 'NKG','ETRF14', -- source auth+code 'EPSG','7922', -- target auth+code 0.005, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5064', 'other_transformation', 'NKG', 'NKG_ETRF14_ETRF93_2000', 'EPSG', '1352', 'NKG', 'SCOPE_GENERIC' ); -- SE INSERT INTO "helmert_transformation" VALUES ( 'NKG','PAR_2020_SE', -- operation auth+code 'NKG_ETRF14 to ETRF97@2000.0', -- name 'Transformation from NKG_ETRF14 to ETRF97, at transformation reference epoch 2000.0', -- description / remark 'EPSG','1033', -- method auth+code 'Position Vector transformation (geocentric domain)', 'NKG','ETRF14', -- source auth+code 'EPSG','7928', -- target auth+code 0.005, -- accuracy 0.03054, -- x 0.04606, -- y -0.07944, -- z 'EPSG','9001', 0.00141958, -- rx 0.00015132, -- ry 0.00150337, -- rz 'EPSG','9104', 0.003002, -- s 'EPSG','9202', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 'NKG 2020', -- operation version 0 ); INSERT INTO "usage" VALUES ( 'NKG', '5042', -- usage auth+code 'helmert_transformation', -- object_table_name 'NKG','PAR_2020_SE', -- object auth+code 'EPSG', '1225', -- extent: Sweden - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); ------------------------------------------------------- -- Transformation: NKG_ETRF00 -> ETRF92@1994.704 (DK) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'ETRF92_2000_TO_ETRF92_1994',-- object auth+code 'ETRF92@2000.0 to ETRF92@1994.704', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=-5.296 +grids=eur_nkg_nkgrf03vel_realigned.tif', 'EPSG','7920', -- source_crs: ETRF92@2000.0 'EPSG','4936', -- target_crs: ETRS89 (DK) 0.005, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5005', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'ETRF92_2000_TO_ETRF92_1994', -- object auth+code 'EPSG', '1080', -- extent: Denmark - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF00_TO_DK', -- operation auth+code 'NKG_ETRF00 to ETRS89(DK)', -- name 'Transformation from NKG_ETRF00@2000.0 to ETRF92@1994.704', -- description 'NKG', 'ETRF00',-- source_crs: NKG_ETRF00 'EPSG','4936', -- target_crs: ETRS89 (DK) 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF00_TO_DK', 1, 'NKG', 'P1_2008_DK'), ('NKG', 'ETRF00_TO_DK', 2, 'NKG', 'ETRF92_2000_TO_ETRF92_1994') ; INSERT INTO "usage" VALUES ( 'NKG', '5006', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF00_TO_DK', -- object auth+code 'EPSG', '1080', -- extent: Denmark - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2000 -> ETRF92@1994.704 (DK) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2000_TO_DK', -- operation auth+code 'ITRF2000 to ETRS89(DK)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89(DK)', -- description 'EPSG', '4919', -- source_crs: ITRF2000 'EPSG', '4936', -- target_crs: ETRS89(DK) 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2000_TO_DK', 1, 'EPSG', '7941'), -- ITRF2000 -> ETRF2000 ('NKG', 'ITRF2000_TO_DK', 2, 'NKG', 'NKG_ETRF00_TO_ETRF2000'), ('NKG', 'ITRF2000_TO_DK', 3, 'NKG', 'P1_2008_DK'), ('NKG', 'ITRF2000_TO_DK', 4, 'NKG', 'ETRF92_2000_TO_ETRF92_1994') ; INSERT INTO "usage" VALUES ( 'NKG', '5013', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2000_TO_DK', -- object auth+code 'EPSG', '1080', -- extent: Denmark - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: NKG_ETRF00 -> ETRF96@1997.56 (EE) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'ETRF96_2000_TO_ETRF96_1997_56',-- object auth+code 'ETRF96@2000.0 to ETRF96@1997.56', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=-2.44 +grids=eur_nkg_nkgrf03vel_realigned.tif', 'EPSG','7926', -- source_crs: ETRF96@2000.0 'EPSG','4936', -- target_crs: ETRS89 (EE) 0.005, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5015', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'ETRF96_2000_TO_ETRF96_1997_56', -- object auth+code 'EPSG', '1090', -- extent: Estonia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF00_TO_EE', -- operation auth+code 'NKG_ETRF00 to ETRS89 (EUREF-EST97)', -- name 'Transformation from NKG_ETRF00@2000.0 to ETRF96@1997.56', -- description 'NKG', 'ETRF00',-- source_crs: NKG_ETRF00 'EPSG','4936', -- target_crs: ETRS89 (EE) 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF00_TO_EE', 1, 'NKG', 'P1_2008_EE'), ('NKG', 'ETRF00_TO_EE', 2, 'NKG', 'ETRF96_2000_TO_ETRF96_1997_56') ; INSERT INTO "usage" VALUES ( 'NKG', '5016', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF00_TO_EE', -- object auth+code 'EPSG', '1090', -- extent: Estonia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2000 -> ETRF96@1997.56 (EE) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2000_TO_EE', -- operation auth+code 'ITRF2000 to ETRS89(EE)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89 (EUREF-EST97)', -- description 'EPSG', '4919', -- source_crs: ITRF2000 'EPSG', '4936', -- target_crs: ETRS89(EE) 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2000_TO_EE', 1, 'EPSG', '7941'), -- ITRF2000 -> ETRF2000 ('NKG', 'ITRF2000_TO_EE', 2, 'NKG', 'NKG_ETRF00_TO_ETRF2000'), ('NKG', 'ITRF2000_TO_EE', 3, 'NKG', 'P1_2008_EE'), ('NKG', 'ITRF2000_TO_EE', 4, 'NKG', 'ETRF96_2000_TO_ETRF96_1997_56') ; INSERT INTO "usage" VALUES ( 'NKG', '5017', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2000_TO_EE', -- object auth+code 'EPSG', '1090', -- extent: Estonia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: NKG_ETRF00 -> ETRF96@1997.0 (FI) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'ETRF96_2000_TO_ETRF96_1997',-- object auth+code 'ETRF96@2000.0 to ETRF96@1997.0', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=-3.0 +grids=eur_nkg_nkgrf03vel_realigned.tif', 'EPSG','7926', -- source_crs: ETRF96@2000.0 'EPSG','4936', -- target_crs: ETRS89 (FI) 0.005, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5018', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'ETRF96_2000_TO_ETRF96_1997', -- object auth+code 'EPSG', '1095', -- extent: Finland - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF00_TO_FI', -- operation auth+code 'NKG_ETRF00 to ETRS89 (EUREF-FIN)', -- name 'Transformation from NKG_ETRF00@2000.0 to ETRF96@1997.0', -- description 'NKG', 'ETRF00',-- source_crs: NKG_ETRF00 'EPSG','4936', -- target_crs: ETRS89 (FI) 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF00_TO_FI', 1, 'NKG', 'P1_2008_FI'), ('NKG', 'ETRF00_TO_FI', 2, 'NKG', 'ETRF96_2000_TO_ETRF96_1997') ; INSERT INTO "usage" VALUES ( 'NKG', '5019', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF00_TO_FI', -- object auth+code 'EPSG', '1095', -- extent: Finland - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2000 -> ETRF96@1997.0 (FI) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2000_TO_FI', -- operation auth+code 'ITRF2000 to ETRS89 (EUREF-FIN)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89 (EUREF-FIN)', -- description 'EPSG', '4919', -- source_crs: ITRF2000 'EPSG', '4936', -- target_crs: ETRS89(FI) 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2000_TO_FI', 1, 'EPSG', '7941'), -- ITRF2000 -> ETRF2000 ('NKG', 'ITRF2000_TO_FI', 2, 'NKG', 'NKG_ETRF00_TO_ETRF2000'), ('NKG', 'ITRF2000_TO_FI', 3, 'NKG', 'P1_2008_FI'), ('NKG', 'ITRF2000_TO_FI', 4, 'NKG', 'ETRF96_2000_TO_ETRF96_1997') ; INSERT INTO "usage" VALUES ( 'NKG', '5020', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2000_TO_FI', -- object auth+code 'EPSG', '1095', -- extent: Finland - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: NKG_ETRF00 -> ETRF89@1992.75 (LV) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'ETRF89_2000_TO_ETRF89_1992',-- object auth+code 'ETRF89@2000.0 to ETRF89@1992.75', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=-7.25 +grids=eur_nkg_nkgrf03vel_realigned.tif', 'EPSG','7914', -- source_crs: ETRF89@2000.0 'EPSG','4948', -- target_crs: LKS-92 0.005, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5021', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'ETRF89_2000_TO_ETRF89_1992', -- object auth+code 'EPSG', '1139', -- extent: Latvia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF00_TO_LV', -- operation auth+code 'NKG_ETRF00 to ETRS89 (LKS-92)', -- name 'Transformation from NKG_ETRF00@2000.0 to ETRF89@1992.75', -- description 'NKG', 'ETRF00',-- source_crs: NKG_ETRF00 'EPSG','4948', -- target_crs: LKS-92 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF00_TO_LV', 1, 'NKG', 'P1_2008_LV'), ('NKG', 'ETRF00_TO_LV', 2, 'NKG', 'ETRF89_2000_TO_ETRF89_1992') ; INSERT INTO "usage" VALUES ( 'NKG', '5022', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF00_TO_LV', -- object auth+code 'EPSG', '1139', -- extent: Latvia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2000 -> ETRF89@1992.75 (LV) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2000_TO_LV', -- operation auth+code 'ITRF2000 to ETRS89 (LKS-92)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89 (LKS-92)', -- description 'EPSG', '4919', -- source_crs: ITRF2000 'EPSG', '4948', -- target_crs: LKS-92 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2000_TO_LV', 1, 'EPSG', '7941'), -- ITRF2000 -> ETRF2000 ('NKG', 'ITRF2000_TO_LV', 2, 'NKG', 'NKG_ETRF00_TO_ETRF2000'), ('NKG', 'ITRF2000_TO_LV', 3, 'NKG', 'P1_2008_LV'), ('NKG', 'ITRF2000_TO_LV', 4, 'NKG', 'ETRF89_2000_TO_ETRF89_1992') ; INSERT INTO "usage" VALUES ( 'NKG', '5023', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2000_TO_LV', -- object auth+code 'EPSG', '1139', -- extent: Latvia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: NKG_ETRF00 -> ETRF2000@2003.75 (LT) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'ETRF2000_2000_TO_ETRF_2000_2003',-- object auth+code 'ETRF2000@2000.0 to ETRF2000@2003.75', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=3.75 +grids=eur_nkg_nkgrf03vel_realigned.tif', 'EPSG','7930', -- source_crs: ETRF2000@2000.0 'EPSG','4950', -- target_crs: LKS94 0.005, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5024', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'ETRF2000_2000_TO_ETRF_2000_2003', -- object auth+code 'EPSG', '1145', -- extent: Lithuania - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF00_TO_LT', -- operation auth+code 'NKG_ETRF00 to LKS94', -- name 'Transformation from NKG_ETRF00@2000.0 to ETRF2000@2003.75', -- description 'NKG', 'ETRF00',-- source_crs: NKG_ETRF00 'EPSG','4950', -- target_crs: LKS94 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF00_TO_LT', 1, 'NKG', 'P1_2008_LT'), ('NKG', 'ETRF00_TO_LT', 2, 'NKG', 'ETRF2000_2000_TO_ETRF_2000_2003') ; INSERT INTO "usage" VALUES ( 'NKG', '5025', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF00_TO_LT', -- object auth+code 'EPSG', '1145', -- extent: Lithuania - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2000 -> ETRF2000@2003.75 (LT) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2000_TO_LT', -- operation auth+code 'ITRF2000 to ETRS89(LT)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89(LT)', -- description 'EPSG', '4919', -- source_crs: ITRF2000 'EPSG', '4950', -- target_crs: LKS94 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2000_TO_LT', 1, 'EPSG', '7941'), -- ITRF2000 -> ETRF2000 ('NKG', 'ITRF2000_TO_LT', 2, 'NKG', 'NKG_ETRF00_TO_ETRF2000'), ('NKG', 'ITRF2000_TO_LT', 3, 'NKG', 'P1_2008_LT'), ('NKG', 'ITRF2000_TO_LT', 4, 'NKG', 'ETRF2000_2000_TO_ETRF_2000_2003') ; INSERT INTO "usage" VALUES ( 'NKG', '5026', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2000_TO_LT', -- object auth+code 'EPSG', '1145', -- extent: Lithuania - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: NKG_ETRF00 -> ETRF93@1995.0 (NO) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'ETRF93_2000_TO_ETRF93_1995',-- object auth+code 'ETRF93@2000.0 to ETRF93@1995.0', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=-5 +grids=eur_nkg_nkgrf03vel_realigned.tif', 'EPSG','7922', -- source_crs: ETRF93@2000.0 'EPSG','4936', -- target_crs: ETRS89 (NO) 0.005, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5027', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'ETRF93_2000_TO_ETRF93_1995', -- object auth+code 'EPSG', '1352', -- extent: Norway - onshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF00_TO_NO', -- operation auth+code 'NKG_ETRF00 to ETRS89(NO)', -- name 'Transformation from NKG_ETRF00@2000.0 to ETRF93@1995.0', -- description 'NKG', 'ETRF00',-- source_crs: NKG_ETRF00 'EPSG','4936', -- target_crs: ETRS89 (NO) 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF00_TO_NO', 1, 'NKG', 'P1_2008_NO'), ('NKG', 'ETRF00_TO_NO', 2, 'NKG', 'ETRF93_2000_TO_ETRF93_1995') ; INSERT INTO "usage" VALUES ( 'NKG', '5028', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF00_TO_NO', -- object auth+code 'EPSG', '1352', -- extent: Norway - onshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2000 -> ETRF93@1995.0 (NO) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2000_TO_NO', -- operation auth+code 'ITRF2000 to ETRS89(NO)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89(NO)', -- description 'EPSG', '4919', -- source_crs: ITRF2000 'EPSG', '4936', -- target_crs: ETRS89(NO) 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2000_TO_NO', 1, 'EPSG', '7941'), -- ITRF2000 -> ETRF2000 ('NKG', 'ITRF2000_TO_NO', 2, 'NKG', 'NKG_ETRF00_TO_ETRF2000'), ('NKG', 'ITRF2000_TO_NO', 3, 'NKG', 'P1_2008_NO'), ('NKG', 'ITRF2000_TO_NO', 4, 'NKG', 'ETRF93_2000_TO_ETRF93_1995') ; INSERT INTO "usage" VALUES ( 'NKG', '5029', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2000_TO_NO', -- object auth+code 'EPSG', '1352', -- extent: Norway - onshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: NKG_ETRF00 -> ETRF97@1999.5 (SE) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'ETRF97_2000_TO_ETRF97_1999',-- object auth+code 'ETRF97@2000.0 to ETRF97@1999.5', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=-0.5 +grids=eur_nkg_nkgrf03vel_realigned.tif', 'EPSG','7928', -- source_crs: ETRF97@2000.0 'EPSG','4976', -- target_crs: SWEREF99 0.005, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5030', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'ETRF97_2000_TO_ETRF97_1999', -- object auth+code 'EPSG', '1225', -- extent: Sweden - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF00_TO_SE', -- operation auth+code 'NKG_ETRF00 to SWEREF99', -- name 'Transformation from NKG_ETRF00@2000.0 to ETRF97@1999.5', -- description 'NKG', 'ETRF00',-- source_crs: NKG_ETRF00 'EPSG','4976', -- target_crs: SWEREF99 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF00_TO_SE', 1, 'NKG', 'P1_2008_SE'), ('NKG', 'ETRF00_TO_SE', 2, 'NKG', 'ETRF97_2000_TO_ETRF97_1999') ; INSERT INTO "usage" VALUES ( 'NKG', '5031', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF00_TO_SE', -- object auth+code 'EPSG', '1225', -- extent: Sweden - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2000 -> ETRF97@1999.5 (SE) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2000_TO_SE', -- operation auth+code 'ITRF2000 to ETRS89(SE)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89(SE)', -- description 'EPSG', '4919', -- source_crs: ITRF2000 'EPSG', '4976', -- target_crs: SWEREF99 0.01, -- accuracy 'NKG 2008', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2000_TO_SE', 1, 'EPSG', '7941'), -- ITRF2000 -> ETRF2000 ('NKG', 'ITRF2000_TO_SE', 2, 'NKG', 'NKG_ETRF00_TO_ETRF2000'), ('NKG', 'ITRF2000_TO_SE', 3, 'NKG', 'P1_2008_SE'), ('NKG', 'ITRF2000_TO_SE', 4, 'NKG', 'ETRF97_2000_TO_ETRF97_1999') ; INSERT INTO "usage" VALUES ( 'NKG', '5032', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2000_TO_SE', -- object auth+code 'EPSG', '1225', -- extent: Sweden - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: NKG_ETRF14 -> ETRF92@1994.704 (DK) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'DK_2020_INTRAPLATE', -- object auth+code 'ETRF92@2000.0 to ETRF92@1994.704', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=15.829 +grids=eur_nkg_nkgrf17vel.tif', 'EPSG','7920', -- source_crs: ETRF92@2000.0 'EPSG','4936', -- target_crs: ETRS89 (DK) 0.005, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5043', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'DK_2020_INTRAPLATE', -- object auth+code 'EPSG', '1080', -- extent: Denmark - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF14_TO_DK', -- operation auth+code 'NKG_ETRF14 to ETRS89(DK)', -- name 'Transformation from NKG_ETRF14@2000.0 to ETRF92@1994.704', -- description 'NKG', 'ETRF14',-- source_crs: NKG_ETRF00 'EPSG','4936', -- target_crs: ETRS89 (DK) 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF14_TO_DK', 1, 'NKG', 'PAR_2020_DK'), ('NKG', 'ETRF14_TO_DK', 2, 'NKG', 'DK_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5044', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF14_TO_DK', -- object auth+code 'EPSG', '1080', -- extent: Denmark - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2014 -> ETRF92@1994.704 (DK) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2014_TO_DK', -- operation auth+code 'ITRF2014 to ETRS89(DK)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89(DK)', -- description 'EPSG', '7789', -- source_crs: ITRF2014 'EPSG', '4936', -- target_crs: ETRS89(DK) 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2014_TO_DK', 1, 'EPSG', '8366'), -- ITRF2014 -> ETRF2014 ('NKG', 'ITRF2014_TO_DK', 2, 'NKG', 'NKG_ETRF14_TO_ETRF2014'), ('NKG', 'ITRF2014_TO_DK', 3, 'NKG', 'PAR_2020_DK'), ('NKG', 'ITRF2014_TO_DK', 4, 'NKG', 'DK_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5045', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2014_TO_DK', -- object auth+code 'EPSG', '1080', -- extent: Denmark - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); INSERT INTO "supersession" VALUES ( 'concatenated_operation', 'NKG', 'ITRF2000_TO_DK', 'concatenated_operation', 'NKG', 'ITRF2014_TO_DK', 'NKG', 0 ); ------------------------------------------------------- -- Transformation: NKG_ETRF14 -> ETRF96@1997.56 (EE) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'EE_2020_INTRAPLATE',-- object auth+code 'ETRF96@2000.0 to ETRF96@1997.56', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=-2.44 +grids=eur_nkg_nkgrf17vel.tif', 'EPSG','7926', -- source_crs: ETRF96@2000.0 'EPSG','4936', -- target_crs: ETRS89 (EE) 0.005, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5046', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'EE_2020_INTRAPLATE', -- object auth+code 'EPSG', '1090', -- extent: Estonia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF14_TO_EE', -- operation auth+code 'NKG_ETRF14 to ETRS89 (EUREF-EST97)', -- name 'Transformation from NKG_ETRF14@2000.0 to ETRF96@1997.56', -- description 'NKG', 'ETRF14',-- source_crs: NKG_ETRF00 'EPSG','4936', -- target_crs: ETRS89 (EE) 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF14_TO_EE', 1, 'NKG', 'PAR_2020_EE'), ('NKG', 'ETRF14_TO_EE', 2, 'NKG', 'EE_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5047', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF14_TO_EE', -- object auth+code 'EPSG', '1090', -- extent: Estonia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2014 -> ETRF96@1997.56 (EE) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2014_TO_EE', -- operation auth+code 'ITRF2014 to ETRS89 (EUREF-EST97)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89 (EUREF-EST97)', -- description 'EPSG', '7789', -- source_crs: ITRF2014 'EPSG', '4936', -- target_crs: ETRS89(EE) 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2014_TO_EE', 1, 'EPSG', '8366'), -- ITRF2014 -> ETRF2014 ('NKG', 'ITRF2014_TO_EE', 2, 'NKG', 'NKG_ETRF14_TO_ETRF2014'), ('NKG', 'ITRF2014_TO_EE', 3, 'NKG', 'PAR_2020_EE'), ('NKG', 'ITRF2014_TO_EE', 4, 'NKG', 'EE_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5048', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2014_TO_EE', -- object auth+code 'EPSG', '1090', -- extent: Estonia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); INSERT INTO "supersession" VALUES ( 'concatenated_operation', 'NKG', 'ITRF2000_TO_EE', 'concatenated_operation', 'NKG', 'ITRF2014_TO_EE', 'NKG', 0 ); ------------------------------------------------------- -- Transformation: NKG_ETRF14 -> ETRF96@1997.0 (FI) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'FI_2020_INTRAPLATE',-- object auth+code 'ETRF96@2000.0 to ETRF96@1997.0', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=-3 +grids=eur_nkg_nkgrf17vel.tif', 'EPSG','7926', -- source_crs: ETRF96@2000.0 'EPSG','4936', -- target_crs: ETRS89 (FI) 0.005, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5049', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'FI_2020_INTRAPLATE', -- object auth+code 'EPSG', '1095', -- extent: Finland - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF14_TO_FI', -- operation auth+code 'NKG_ETRF14 to ETRS89 (EUREF-FIN)', -- name 'Transformation from NKG_ETRF14@2000.0 to ETRF96@1997.0', -- description 'NKG', 'ETRF14',-- source_crs: NKG_ETRF00 'EPSG','4936', -- target_crs: ETRS89 (FI) 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF14_TO_FI', 1, 'NKG', 'PAR_2020_FI'), ('NKG', 'ETRF14_TO_FI', 2, 'NKG', 'FI_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5050', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF14_TO_FI', -- object auth+code 'EPSG', '1095', -- extent: Finland - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2014 -> ETRF96@1997.0 (FI) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2014_TO_FI', -- operation auth+code 'ITRF2014 to ETRS89 (EUREF-FIN)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89 (EUREF-FIN)', -- description 'EPSG', '7789', -- source_crs: ITRF2014 'EPSG', '4936', -- target_crs: ETRS89(FI) 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2014_TO_FI', 1, 'EPSG', '8366'), -- ITRF2014 -> ETRF2014 ('NKG', 'ITRF2014_TO_FI', 2, 'NKG', 'NKG_ETRF14_TO_ETRF2014'), ('NKG', 'ITRF2014_TO_FI', 3, 'NKG', 'PAR_2020_FI'), ('NKG', 'ITRF2014_TO_FI', 4, 'NKG', 'FI_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5051', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2014_TO_FI', -- object auth+code 'EPSG', '1095', -- extent: Finland - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); INSERT INTO "supersession" VALUES ( 'concatenated_operation', 'NKG', 'ITRF2000_TO_FI', 'concatenated_operation', 'NKG', 'ITRF2014_TO_FI', 'NKG', 0 ); ------------------------------------------------------- -- Transformation: NKG_ETRF14 -> ETRF89@1992.75 (LV) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'LV_2020_INTRAPLATE', -- object auth+code 'ETRF89@2000.0 to ETRF89@1992.75 (LKS-92)', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=-7.25 +grids=eur_nkg_nkgrf17vel.tif', 'EPSG','7914', -- source_crs: ETRF89@2000.0 'EPSG','4948', -- target_crs: LKS-92 0.005, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5052', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'LV_2020_INTRAPLATE', -- object auth+code 'EPSG', '1139', -- extent: Latvia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF14_TO_LV', -- operation auth+code 'NKG_ETRF14 to ETRS89 (LKS-92)', -- name 'Transformation from NKG_ETRF14@2000.0 to ETRF89@1992.75', -- description 'NKG', 'ETRF14',-- source_crs: NKG_ETRF00 'EPSG','4948', -- target_crs: LKS-92 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF14_TO_LV', 1, 'NKG', 'PAR_2020_LV'), ('NKG', 'ETRF14_TO_LV', 2, 'NKG', 'LV_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5053', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF14_TO_LV', -- object auth+code 'EPSG', '1139', -- extent: Latvia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2014 -> ETRF89@1992.75 (LV) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2014_TO_LV', -- operation auth+code 'ITRF2014 to ETRS89 (LKS-92)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89 (LKS-92)', -- description 'EPSG', '7789', -- source_crs: ITRF2014 'EPSG', '4948', -- target_crs: LKS-92 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2014_TO_LV', 1, 'EPSG', '8366'), -- ITRF2014 -> ETRF2014 ('NKG', 'ITRF2014_TO_LV', 2, 'NKG', 'NKG_ETRF14_TO_ETRF2014'), ('NKG', 'ITRF2014_TO_LV', 3, 'NKG', 'PAR_2020_LV'), ('NKG', 'ITRF2014_TO_LV', 4, 'NKG', 'LV_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5054', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2014_TO_LV', -- object auth+code 'EPSG', '1139', -- extent: Latvia - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); INSERT INTO "supersession" VALUES ( 'concatenated_operation', 'NKG', 'ITRF2000_TO_LV', 'concatenated_operation', 'NKG', 'ITRF2014_TO_LV', 'NKG', 0 ); ------------------------------------------------------- -- Transformation: NKG_ETRF14 -> ETRF2000@2003.75 (LT) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'LT_2020_INTRAPLATE', -- object auth+code 'ETRF2000@2000.0 to ETRF2000@2003.75 (LKS94)', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=3.75 +grids=eur_nkg_nkgrf17vel.tif', 'EPSG','7930', -- source_crs: ETRF2000@2000.0 'EPSG','4950', -- target_crs: LKS94 0.005, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5055', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'LT_2020_INTRAPLATE', -- object auth+code 'EPSG', '1145', -- extent: Lithuania - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF14_TO_LT', -- operation auth+code 'NKG_ETRF14 to LKS94', -- name 'Transformation from NKG_ETRF14@2000.0 to ETRF2000@2003.75 (LKS94)', -- description 'NKG', 'ETRF14',-- source_crs: NKG_ETRF00 'EPSG','4950', -- target_crs: LKS94 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF14_TO_LT', 1, 'NKG', 'PAR_2020_LT'), ('NKG', 'ETRF14_TO_LT', 2, 'NKG', 'LT_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5056', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF14_TO_LT', -- object auth+code 'EPSG', '1145', -- extent: Lithuania - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2014 -> ETRF2000@2003.75 (LT) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2014_TO_LT', -- operation auth+code 'ITRF2014 to ETRS89(LT)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89(LT)', -- description 'EPSG', '7789', -- source_crs: ITRF2014 'EPSG', '4950', -- target_crs: LKS94 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2014_TO_LT', 1, 'EPSG', '8366'), -- ITRF2014 -> ETRF2014 ('NKG', 'ITRF2014_TO_LT', 2, 'NKG', 'NKG_ETRF14_TO_ETRF2014'), ('NKG', 'ITRF2014_TO_LT', 3, 'NKG', 'PAR_2020_LT'), ('NKG', 'ITRF2014_TO_LT', 4, 'NKG', 'LT_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5057', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2014_TO_LT', -- object auth+code 'EPSG', '1145', -- extent: Lithuania - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); INSERT INTO "supersession" VALUES ( 'concatenated_operation', 'NKG', 'ITRF2000_TO_LT', 'concatenated_operation', 'NKG', 'ITRF2014_TO_LT', 'NKG', 0 ); ------------------------------------------------------- -- Transformation: NKG_ETRF14 -> ETRF93@1995.0 (NO) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'NO_2020_INTRAPLATE', -- object auth+code 'ETRF93@2000.0 to ETRF93@1995.0', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=-5 +grids=eur_nkg_nkgrf17vel.tif', 'EPSG','7922', -- source_crs: ETRF93@2000.0 'EPSG','4936', -- target_crs: ETRS89 (NO) 0.005, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5058', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'NO_2020_INTRAPLATE', -- object auth+code 'EPSG', '1352', -- extent: Norway - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF14_TO_NO', -- operation auth+code 'NKG_ETRF14 to ETRS89(NO)', -- name 'Transformation from NKG_ETRF14@2000.0 to ETRF93@1995.0', -- description 'NKG', 'ETRF14',-- source_crs: NKG_ETRF00 'EPSG','4936', -- target_crs: ETRS89 (NO) 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF14_TO_NO', 1, 'NKG', 'PAR_2020_NO'), ('NKG', 'ETRF14_TO_NO', 2, 'NKG', 'NO_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5059', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF14_TO_NO', -- object auth+code 'EPSG', '1352', -- extent: Norway - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2014 -> ETRF93@1995.0 (NO) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2014_TO_NO', -- operation auth+code 'ITRF2014 to ETRS89(NO)', -- name 'Time-dependent transformation from ITRF2014 to ETRS89(NO)', -- description 'EPSG', '7789', -- source_crs: ITRF2014 'EPSG', '4936', -- target_crs: ETRS89(NO) 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2014_TO_NO', 1, 'EPSG', '8366'), -- ITRF2014 -> ETRF2014 ('NKG', 'ITRF2014_TO_NO', 2, 'NKG', 'NKG_ETRF14_TO_ETRF2014'), ('NKG', 'ITRF2014_TO_NO', 3, 'NKG', 'NKG_ETRF14_ETRF93_2000'), ('NKG', 'ITRF2014_TO_NO', 4, 'NKG', 'NO_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5060', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2014_TO_NO', -- object auth+code 'EPSG', '1352', -- extent: Norway - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); INSERT INTO "supersession" VALUES ( 'concatenated_operation', 'NKG', 'ITRF2000_TO_NO', 'concatenated_operation', 'NKG', 'ITRF2014_TO_NO', 'NKG', 0 ); ------------------------------------------------------- -- Transformation: NKG_ETRF14 -> ETRF97@1999.5 (SE) ------------------------------------------------------- INSERT INTO "other_transformation" ( auth_name, code, name, description, method_auth_name, method_code, method_name, source_crs_auth_name, source_crs_code, target_crs_auth_name, target_crs_code, accuracy, operation_version, deprecated ) VALUES( 'NKG', 'SE_2020_INTRAPLATE',-- object auth+code 'ETRF97@2000.0 to ETRF97@1999.5', -- name NULL, -- description 'PROJ', 'PROJString', -- method auth+cod '+proj=deformation +dt=-0.5 +grids=eur_nkg_nkgrf17vel.tif', 'EPSG','7928', -- source_crs: ETRF97@2000.0 'EPSG','4976', -- target_crs: SWEREF99 0.005, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "usage" VALUES ( 'NKG', '5061', -- usage auth+code 'other_transformation', -- object_table_name 'NKG', 'SE_2020_INTRAPLATE', -- object auth+code 'EPSG', '1225', -- extent: Sweden - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope ); INSERT INTO "concatenated_operation" VALUES( 'NKG', 'ETRF14_TO_SE', -- operation auth+code 'NKG_ETRF14 to SWEREF99', -- name 'Transformation from NKG_ETRF14@2000.0 to SWEREF99 (ETRF97@1999.5)', -- description 'NKG', 'ETRF14',-- source_crs: NKG_ETRF00 'EPSG','4976', -- target_crs: SWEREF99 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ETRF14_TO_SE', 1, 'NKG', 'PAR_2020_SE'), ('NKG', 'ETRF14_TO_SE', 2, 'NKG', 'SE_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5062', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ETRF14_TO_SE', -- object auth+code 'EPSG', '1225', -- extent: Sweden - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); ------------------------------------------------------- -- Transformation: ITRF2014 -> ETRF97@1999.5 (SE) ------------------------------------------------------- INSERT INTO "concatenated_operation" VALUES ( 'NKG', 'ITRF2014_TO_SE', -- operation auth+code 'ITRF2014 to ETRS89(SE)', -- name 'Time-dependent transformation from ITRF2014 to SWEREF99', -- description 'EPSG', '7789', -- source_crs: ITRF2014 'EPSG', '4976', -- target_crs: SWEREF99 0.01, -- accuracy 'NKG 2020', -- operation_version 0 -- deprecated ); INSERT INTO "concatenated_operation_step" ( operation_auth_name, operation_code, step_number, step_auth_name, step_code ) VALUES ('NKG', 'ITRF2014_TO_SE', 1, 'EPSG', '8366'), -- ITRF2014 -> ETRF2014 ('NKG', 'ITRF2014_TO_SE', 2, 'NKG', 'NKG_ETRF14_TO_ETRF2014'), ('NKG', 'ITRF2014_TO_SE', 3, 'NKG', 'PAR_2020_SE'), ('NKG', 'ITRF2014_TO_SE', 4, 'NKG', 'SE_2020_INTRAPLATE') ; INSERT INTO "usage" VALUES ( 'NKG', '5063', -- usage auth+code 'concatenated_operation', -- object_table_name 'NKG', 'ITRF2014_TO_SE', -- object auth+code 'EPSG', '1225', -- extent: Sweden - onshore and offshore 'NKG', 'SCOPE_GENERIC' -- scope auth+code ); INSERT INTO "supersession" VALUES ( 'concatenated_operation', 'NKG', 'ITRF2000_TO_SE', 'concatenated_operation', 'NKG', 'ITRF2014_TO_SE', 'NKG', 0 );
the_stack
DROP FUNCTION IF EXISTS de_metas_endcustomer_fresh_reports.Direct_Costing_Short_Version(Date Date); CREATE OR REPLACE FUNCTION de_metas_endcustomer_fresh_reports.Direct_Costing_Short_Version(Date Date) RETURNS TABLE ( seq text, margin text, Margin_Incr_1000 numeric, Margin_Incr_2000 numeric, Margin_Incr_100 numeric, Margin_Incr_150 numeric, Margin_Incr_other numeric, Margin_Incr_All numeric, L1_Value character varying, L1_Name character varying, isDisplayL1Sum boolean, L1_1000 numeric, L1_2000 numeric, L1_100 numeric, L1_150 numeric, L1_other numeric, L1_All numeric, L1_Multiplicator numeric, L2_Value character varying, L2_Name character varying, L2_1000 numeric, L2_2000 numeric, L2_100 numeric, L2_150 numeric, L2_other numeric, L2_All numeric, L2_Multiplicator numeric, L3_Value character varying, L3_Name character varying, Balance_1000 numeric, Balance_2000 numeric, Balance_100 numeric, Balance_150 numeric, Balance_other numeric, Balance numeric, L3_Multiplicator numeric, Margin_Budget_Incr_1000 numeric, Margin_Budget_Incr_2000 numeric, Margin_Budget_Incr_100 numeric, Margin_Budget_Incr_150 numeric, Margin_Budget_Incr_All numeric, L1_Budget_1000 numeric, L1_Budget_2000 numeric, L1_Budget_100 numeric, L1_Budget_150 numeric, L1_Budget_All numeric, L2_Budget_1000 numeric, L2_Budget_2000 numeric, L2_Budget_100 numeric, L2_Budget_150 numeric, L2_Budget_All numeric, Budget_1000 numeric, Budget_2000 numeric, Budget_100 numeric, Budget_150 numeric, Budget numeric, Margin_IncrLY_1000 numeric, Margin_IncrLY_2000 numeric, Margin_IncrLY_100 numeric, Margin_IncrLY_150 numeric, Margin_IncrLY_All numeric, L1_BalanceLY_1000 numeric, L1_BalanceLY_2000 numeric, L1_BalanceLY_100 numeric, L1_BalanceLY_150 numeric, L1_BalanceLY_All numeric, L2_BalanceLY_1000 numeric, L2_BalanceLY_2000 numeric, L2_BalanceLY_100 numeric, L2_BalanceLY_150 numeric, L2_BalanceLY_All numeric, BalanceLY_1000 numeric, BalanceLY_2000 numeric, BalanceLY_100 numeric, BalanceLY_150 numeric, BalanceLY numeric, ad_org_id numeric, ad_client_id numeric, Gross_1000 numeric, Gross_2000 numeric, Gross_100 numeric, Gross_150 numeric, Gross_All numeric, startdate date, enddate date, Margin_Percentage_all numeric, Margin_Budget_Percentage_all numeric, Margin_BalanceLY_Percentage_all numeric, L1_Percentage_All numeric, L1_Budget_Percentage_All numeric, L1_BalanceLY_Percentage_All numeric, L2_Percentage_All numeric, L2_Budget_Percentage_All numeric, L2_BalanceLY_Percentage_All numeric, L3_percentage_All numeric, L3_Budget_Percentage_All numeric, L3_BalanceLY_Percentage_All numeric, isDisplayMarginSum boolean, isDisplayOther boolean ) AS $BODY$ SELECT *, ROUND( Margin_Incr_all / Gross_all * 100, 2 ) AS Margin_Percentage_all, ROUND( Margin_Incr_all / NULLIF( Margin_Budget_Incr_All, 0 ) * 100, 2 ) AS Margin_Budget_Percentage_all, ROUND( Margin_IncrLY_all / NULLIF( Margin_IncrLY_All, 0 ) * 100, 2 ) AS Margin_BalanceLY_Percentage_all, ABS( ROUND( L1_All / Gross_All * 100, 2 ) ) AS L1_Percentage_All, ABS( ROUND( L1_All / NULLIF( L1_Budget_All, 0 ) * 100, 2 ) ) AS L1_Budget_Percentage_All, ABS( ROUND( L1_All / NULLIF( L1_BalanceLY_All, 0 ) * 100, 2 ) ) AS L1_BalanceLY_Percentage_All, ABS( ROUND( L2_All / Gross_All * 100, 2 ) ) AS L2_Percentage_All, ABS( ROUND( L2_All / NULLIF( L2_Budget_All, 0 ) * 100, 2 ) ) AS L2_Budget_Percentage_All, ABS( ROUND( L2_All / NULLIF( L2_BalanceLY_All, 0 ) * 100, 2 ) ) AS L2_BalanceLY_Percentage_All, ABS( ROUND( Balance / Gross_all * 100, 2 ) ) AS L3_percentage_All, ABS( ROUND( Balance / NULLIF( Budget, 0 ) * 100, 2 ) ) AS L3_Budget_Percentage_All, ABS( ROUND( Balance / NULLIF( BalanceLY, 0 ) * 100, 2 ) ) AS L3_BalanceLY_Percentage_All, -- If current Margin is the Last Margin, display the final sum group footer First_Agg( Margin ) OVER ( ORDER BY Seq Desc ) != Margin AS isDisplayMarginSum, -- If there are no Sums in the 'Other'-Column, don't display it SUM( Balance_Other ) OVER () != 0 AS isDisplayOther FROM ( SELECT *, -- Get initial profit to create the percentage of each line and/or sum NULLIF( First_agg ( L2_1000 ) OVER (ORDER BY Seq ), 0 ) AS Gross_1000, NULLIF( First_agg ( L2_2000 ) OVER (ORDER BY Seq ), 0 ) AS Gross_2000, NULLIF( First_agg ( L2_100 ) OVER (ORDER BY Seq ), 0 ) AS Gross_100, NULLIF( First_agg ( L2_150 ) OVER (ORDER BY Seq ), 0 ) AS Gross_150, NULLIF( First_agg ( L2_all ) OVER (ORDER BY Seq ), 0 ) AS Gross_All FROM ( SELECT seq, -- Margin margin, -- -- Balances -- Create an Incremental sum for the Margins. This sum will be Displayed in the report -- It is a requirement of the report that the sums are incremental over the margins -- Note: The window function Last_Value does not get the Last Value, but the maximum First_Agg( Incr_1000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_1000, First_Agg( Incr_2000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_2000, First_Agg( Incr_100 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_100, First_Agg( Incr_150 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_150, First_Agg( Incr_other ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_other, First_Agg( Incr ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_All, -- Level 1 L1_Value, L1_Name, isDisplayL1Sum, Sum ( Balance_1000 ) OVER ( PARTITION BY Margin, L1_Value) AS L1_1000, Sum ( Balance_2000 ) OVER ( PARTITION BY Margin, L1_Value) AS L1_2000, Sum ( Balance_100 ) OVER ( PARTITION BY Margin, L1_Value) AS L1_100, Sum ( Balance_150 ) OVER ( PARTITION BY Margin, L1_Value) AS L1_150, Sum ( Balance_other ) OVER ( PARTITION BY Margin, L1_Value) AS L1_other, Sum ( Balance ) OVER ( PARTITION BY Margin, L1_Value) AS L1_All, L1_Multiplicator, -- Level 2 L2_Value, L2_Name, Sum ( Balance_1000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_1000, Sum ( Balance_2000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_2000, Sum ( Balance_100 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_100, Sum ( Balance_150 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_150, Sum ( Balance_other ) OVER ( PARTITION BY Margin, L2_Value) AS L2_other, Sum ( Balance ) OVER ( PARTITION BY Margin, L2_Value) AS L2_All, L2_Multiplicator, -- Level 3 L3_Value, L3_Name, Balance_1000, Balance_2000, Balance_100, Balance_150, Balance_other, Balance, L3_Multiplicator, -- -- Budgets -- Margin First_Agg( Budget_Incr_1000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Budget_Incr_1000, First_Agg( Budget_Incr_2000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Budget_Incr_2000, First_Agg( Budget_Incr_100 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Budget_Incr_100, First_Agg( Budget_Incr_150 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Budget_Incr_150, First_Agg( Budget_Incr ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Budget_Incr_All, -- Level 1 Sum ( Budget_1000 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_Budget_1000, Sum ( Budget_2000 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_Budget_2000, Sum ( Budget_100 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_Budget_100, Sum ( Budget_150 ) OVER ( PARTITION BY Margin, L1_Value) AS L1_Budget_150, Sum ( Budget ) OVER ( PARTITION BY Margin, L1_Value) AS L1_Budget_All, -- Level 2 Sum ( Budget_1000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_Budget_1000, Sum ( Budget_2000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_Budget_2000, Sum ( Budget_100 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_Budget_100, Sum ( Budget_150 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_Budget_150, Sum ( Budget ) OVER ( PARTITION BY Margin, L2_Value) AS L2_Budget_All, -- Level 3 Budget_1000, Budget_2000, Budget_100, Budget_150, Budget, -- balance last year -- Margin First_Agg( IncrLY_1000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_IncrLY_1000, First_Agg( IncrLY_2000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_IncrLY_2000, First_Agg( IncrLY_100 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_IncrLY_100, First_Agg( IncrLY_150 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_IncrLY_150, First_Agg( IncrLY ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_IncrLY_All, -- Level 1 Sum ( BalanceLY_1000 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_BalanceLY_1000, Sum ( BalanceLY_2000 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_BalanceLY_2000, Sum ( BalanceLY_100 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_BalanceLY_100, Sum ( BalanceLY_150 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_BalanceLY_150, Sum ( BalanceLY ) OVER ( PARTITION BY Margin, L1_Value) AS L1_BalanceLY_All, -- Level 2 Sum ( BalanceLY_1000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_BalanceLY_1000, Sum ( BalanceLY_2000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_BalanceLY_2000, Sum ( BalanceLY_100 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_BalanceLY_100, Sum ( BalanceLY_150 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_BalanceLY_150, Sum ( BalanceLY ) OVER ( PARTITION BY Margin, L2_Value) AS L2_BalanceLY_All, -- Level 3 BalanceLY_1000, BalanceLY_2000, BalanceLY_100, BalanceLY_150, BalanceLY, x.ad_org_id, x.ad_client_id FROM ( SELECT seq, margin, L1_Name IS NOT NULL AND L1_Name != '' AS isDisplayL1Sum, L1_Value, L1_Name, L2_Value, L2_Name, L3_Value, L3_Name, -- Preparing an incremantal Sum over all lines, to later extract an incremental sum for margin level Balance_1000, SUM( Balance_1000 ) OVER ( ORDER BY Seq ) AS Incr_1000, Balance_2000, SUM( Balance_2000 ) OVER ( ORDER BY Seq ) AS Incr_2000, Balance_100, SUM( Balance_100 ) OVER (ORDER BY Seq ) AS Incr_100, Balance_150, SUM( Balance_150 ) OVER ( ORDER BY Seq ) AS Incr_150, Balance_other, SUM( Balance_other ) OVER (ORDER BY Seq ) AS Incr_other, Balance, SUM( Balance ) OVER ( ORDER BY Seq ) AS Incr, Budget_1000, SUM( Budget_1000 ) OVER ( ORDER BY Seq ) AS Budget_Incr_1000, Budget_2000, SUM( Budget_2000 ) OVER ( ORDER BY Seq ) AS Budget_Incr_2000, Budget_100, SUM( Budget_100 ) OVER ( ORDER BY Seq ) AS Budget_Incr_100, Budget_150, SUM( Budget_150 ) OVER (ORDER BY Seq ) AS Budget_Incr_150, Budget, SUM( Budget ) OVER ( ORDER BY Seq ) AS Budget_Incr, BalanceLY_1000, SUM( BalanceLY_1000 ) OVER (ORDER BY Seq ) AS IncrLY_1000, BalanceLY_2000, SUM( BalanceLY_2000 ) OVER (ORDER BY Seq ) AS IncrLY_2000, BalanceLY_100, SUM( BalanceLY_100 ) OVER ( ORDER BY Seq ) AS IncrLY_100, BalanceLY_150, SUM( BalanceLY_150 ) OVER (ORDER BY Seq ) AS IncrLY_150, BalanceLY_other, SUM( BalanceLY_other ) OVER (ORDER BY Seq ) AS IncrLY_other, BalanceLY, SUM( BalanceLY ) OVER ( ORDER BY Seq ) AS IncrLY, L3_Multiplicator, L2_Multiplicator, L1_Multiplicator, ad_org_id, ad_client_id FROM de_metas_endcustomer_fresh_reports.Direct_Costing_Raw_Data_Include_LastYear($1) ) x ) y ) z LEFT OUTER JOIN ( SELECT First_Agg ( StartDate::text ORDER BY PeriodNo )::Date AS StartDate, $1::date AS EndDate FROM C_Period WHERE C_Year_ID = (SELECT C_Year_ID FROM C_Period WHERE C_Period_ID = report.Get_Period( 1000000, $1::Date )) ) date ON true ORDER BY seq ; $BODY$ LANGUAGE sql STABLE ;
the_stack
-- 2021-01-27T17:50:54.807Z -- URL zum Konzept INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,578552,0,500008,541909,20,'PRINTER_OPTS_IsPrintTotals',TO_TIMESTAMP('2021-01-27 18:50:54','YYYY-MM-DD HH24:MI:SS'),100,'D',0,'Y','N','Y','N','N','N','Gesamtbeträge drucken',10,TO_TIMESTAMP('2021-01-27 18:50:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-01-27T17:50:54.812Z -- URL zum Konzept INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541909 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-01-27T17:51:39.194Z -- URL zum Konzept INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,578551,0,500009,541910,20,'PRINTER_OPTS_IsPrintLogo',TO_TIMESTAMP('2021-01-27 18:51:39','YYYY-MM-DD HH24:MI:SS'),100,'Y','de.metas.invoice',0,'Y','N','Y','N','N','N','Logo drucken',10,TO_TIMESTAMP('2021-01-27 18:51:39','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-01-27T17:51:39.197Z -- URL zum Konzept INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541910 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-01-27T17:52:03.931Z -- URL zum Konzept UPDATE AD_Process_Para SET AD_Element_ID=578551, ColumnName='PRINTER_OPTS_IsPrintLogo', DefaultValue='Y', EntityType='D', Name='Logo drucken',Updated=TO_TIMESTAMP('2021-01-27 18:52:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541909 ; -- 2021-02-02T13:16:18.460Z -- URL zum Konzept INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,578551,0,1000000,541922,20,'PRINTER_OPTS_IsPrintLogo',TO_TIMESTAMP('2021-02-02 14:16:18','YYYY-MM-DD HH24:MI:SS'),100,'Y','de.metas.dunning',0,'Y','N','Y','N','Y','N','Logo drucken',10,TO_TIMESTAMP('2021-02-02 14:16:18','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-02T13:16:18.462Z -- URL zum Konzept INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541922 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-02-02T13:17:09.694Z -- URL zum Konzept INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,578551,0,500010,541923,20,'PRINTER_OPTS_IsPrintLogo',TO_TIMESTAMP('2021-02-02 14:17:09','YYYY-MM-DD HH24:MI:SS'),100,'Y','D',0,'Y','N','Y','N','Y','N','Logo drucken',10,TO_TIMESTAMP('2021-02-02 14:17:09','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-02T13:17:09.695Z -- URL zum Konzept INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541923 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-02-02T13:17:31.355Z -- URL zum Konzept INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,578551,0,500012,541924,20,'PRINTER_OPTS_IsPrintLogo',TO_TIMESTAMP('2021-02-02 14:17:31','YYYY-MM-DD HH24:MI:SS'),100,'Y','D',0,'Y','N','Y','N','Y','N','Logo drucken',10,TO_TIMESTAMP('2021-02-02 14:17:31','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-02T13:17:31.356Z -- URL zum Konzept INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541924 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-02-02T13:18:15.418Z -- URL zum Konzept INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,578551,0,500011,541925,20,'PRINTER_OPTS_IsPrintLogo',TO_TIMESTAMP('2021-02-02 14:18:15','YYYY-MM-DD HH24:MI:SS'),100,'Y','D',0,'Y','N','Y','N','Y','N','Logo drucken',10,TO_TIMESTAMP('2021-02-02 14:18:15','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-02T13:18:15.421Z -- URL zum Konzept INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541925 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-02-02T13:19:10.664Z -- URL zum Konzept INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,578551,0,540528,541926,20,'PRINTER_OPTS_IsPrintLogo',TO_TIMESTAMP('2021-02-02 14:19:10','YYYY-MM-DD HH24:MI:SS'),100,'Y','de.metas.fresh',0,'Y','N','Y','N','Y','N','Logo drucken',20,TO_TIMESTAMP('2021-02-02 14:19:10','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-02T13:19:10.665Z -- URL zum Konzept INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541926 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-02-02T14:02:47.163Z -- URL zum Konzept UPDATE AD_Process_Para_Trl SET IsTranslated='Y', Name='Logo drucken',Updated=TO_TIMESTAMP('2021-02-02 15:02:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_Para_ID=541909 ; -- 2021-02-02T14:02:53.828Z -- URL zum Konzept UPDATE AD_Process_Para_Trl SET Name='Logo drucken',Updated=TO_TIMESTAMP('2021-02-02 15:02:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_Para_ID=541909 ; -- 2021-02-02T14:02:58.567Z -- URL zum Konzept UPDATE AD_Process_Para_Trl SET IsTranslated='Y', Name='Logo drucken',Updated=TO_TIMESTAMP('2021-02-02 15:02:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Process_Para_ID=541909 ; -- 2021-02-02T14:03:14.920Z -- URL zum Konzept UPDATE AD_Process_Para_Trl SET IsTranslated='Y', Name='Print Logo',Updated=TO_TIMESTAMP('2021-02-02 15:03:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_Para_ID=541909 ; -- 2021-02-02T14:03:40.922Z -- URL zum Konzept UPDATE AD_Process_Para SET IsMandatory='Y',Updated=TO_TIMESTAMP('2021-02-02 15:03:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541910 ; -- 2021-02-02T14:10:33.029Z -- URL zum Konzept UPDATE AD_Process_Para SET FieldLength=1,Updated=TO_TIMESTAMP('2021-02-02 15:10:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541910 ; -- 2021-02-02T14:37:01.923Z -- URL zum Konzept INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,578551,0,541030,541927,20,'PRINTER_OPTS_IsPrintLogo',TO_TIMESTAMP('2021-02-02 15:37:01','YYYY-MM-DD HH24:MI:SS'),100,'Y','de.metas.invoice',0,'Y','N','Y','N','Y','N','Logo drucken',10,TO_TIMESTAMP('2021-02-02 15:37:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-02T14:37:01.928Z -- URL zum Konzept INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541927 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ;
the_stack
-- Licensed to the Apache Software Foundation (ASF) under one or more -- contributor license agreements. See the NOTICE file distributed with -- this work for additional information regarding copyright ownership. -- The ASF licenses this file to You under the Apache License, Version 2.0 -- (the "License"); you may not use this file except in compliance with -- the License. You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. DROP TABLE IF EXISTS `vx_trx_log`; DROP VIEW IF EXISTS `vx_trx_log`; DROP TABLE IF EXISTS `x_audit_map`; DROP TABLE IF EXISTS `x_perm_map`; DROP TABLE IF EXISTS `x_trx_log`; DROP TABLE IF EXISTS `x_resource`; DROP TABLE IF EXISTS `x_policy_export_audit`; DROP TABLE IF EXISTS `x_group_users`; DROP TABLE IF EXISTS `x_user`; DROP TABLE IF EXISTS `x_group_groups`; DROP TABLE IF EXISTS `x_group`; DROP TABLE IF EXISTS `x_db_base`; DROP TABLE IF EXISTS `x_cred_store`; DROP TABLE IF EXISTS `x_auth_sess`; DROP TABLE IF EXISTS `x_asset`; DROP TABLE IF EXISTS `xa_access_audit`; DROP TABLE IF EXISTS `x_portal_user_role`; DROP TABLE IF EXISTS `x_portal_user`; CREATE TABLE `x_portal_user` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `first_name` varchar(1022) DEFAULT NULL, `last_name` varchar(1022) DEFAULT NULL, `pub_scr_name` varchar(2048) DEFAULT NULL, `login_id` varchar(767) DEFAULT NULL, `password` varchar(512) NOT NULL, `email` varchar(512) DEFAULT NULL, `status` int(11) NOT NULL DEFAULT '0', `user_src` int(11) NOT NULL DEFAULT '0', `notes` varchar(4000) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `x_portal_user_UK_login_id` (`login_id`), UNIQUE KEY `x_portal_user_UK_email` (`email`), KEY `x_portal_user_FK_added_by_id` (`added_by_id`), KEY `x_portal_user_FK_upd_by_id` (`upd_by_id`), KEY `x_portal_user_cr_time` (`create_time`), KEY `x_portal_user_up_time` (`update_time`), KEY `x_portal_user_name` (`first_name`(767)), KEY `x_portal_user_email` (`email`), CONSTRAINT `x_portal_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_portal_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`) )AUTO_INCREMENT=2 ROW_FORMAT=DYNAMIC; CREATE TABLE `x_portal_user_role` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `user_id` bigint(20) NOT NULL, `user_role` varchar(128) DEFAULT NULL, `status` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `x_portal_user_role_FK_added_by_id` (`added_by_id`), KEY `x_portal_user_role_FK_upd_by_id` (`upd_by_id`), KEY `x_portal_user_role_FK_user_id` (`user_id`), KEY `x_portal_user_role_cr_time` (`create_time`), KEY `x_portal_user_role_up_time` (`update_time`), CONSTRAINT `x_portal_user_role_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_portal_user_role_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_portal_user_role_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`) )AUTO_INCREMENT=2 ROW_FORMAT=DYNAMIC; CREATE TABLE `xa_access_audit` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `audit_type` int(11) NOT NULL DEFAULT '0', `access_result` int(11) DEFAULT '0', `access_type` varchar(255) DEFAULT NULL, `acl_enforcer` varchar(255) DEFAULT NULL, `agent_id` varchar(255) DEFAULT NULL, `client_ip` varchar(255) DEFAULT NULL, `client_type` varchar(255) DEFAULT NULL, `policy_id` bigint(20) DEFAULT '0', `repo_name` varchar(255) DEFAULT NULL, `repo_type` int(11) DEFAULT '0', `result_reason` varchar(255) DEFAULT NULL, `session_id` varchar(255) DEFAULT NULL, `event_time` datetime DEFAULT NULL, `request_user` varchar(255) DEFAULT NULL, `action` varchar(2000) DEFAULT NULL, `request_data` varchar(2000) DEFAULT NULL, `resource_path` varchar(2000) DEFAULT NULL, `resource_type` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `xa_access_audit_added_by_id` (`added_by_id`), KEY `xa_access_audit_upd_by_id` (`upd_by_id`), KEY `xa_access_audit_cr_time` (`create_time`), KEY `xa_access_audit_up_time` (`update_time`), KEY `xa_access_audit_event_time` (`event_time`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_asset` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `asset_name` varchar(1024) NOT NULL, `descr` varchar(4000) NOT NULL, `act_status` int(11) NOT NULL DEFAULT '0', `asset_type` int(11) NOT NULL DEFAULT '0', `config` text, `sup_native` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `x_asset_FK_added_by_id` (`added_by_id`), KEY `x_asset_FK_upd_by_id` (`upd_by_id`), KEY `x_asset_cr_time` (`create_time`), KEY `x_asset_up_time` (`update_time`), CONSTRAINT `x_asset_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_asset_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_auth_sess` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `login_id` varchar(767) NOT NULL, `user_id` bigint(20) DEFAULT NULL, `ext_sess_id` varchar(512) DEFAULT NULL, `auth_time` datetime NOT NULL, `auth_status` int(11) NOT NULL DEFAULT '0', `auth_type` int(11) NOT NULL DEFAULT '0', `auth_provider` int(11) NOT NULL DEFAULT '0', `device_type` int(11) NOT NULL DEFAULT '0', `req_ip` varchar(48) NOT NULL, `req_ua` varchar(1024) DEFAULT NULL, PRIMARY KEY (`id`), KEY `x_auth_sess_FK_added_by_id` (`added_by_id`), KEY `x_auth_sess_FK_upd_by_id` (`upd_by_id`), KEY `x_auth_sess_FK_user_id` (`user_id`), KEY `x_auth_sess_cr_time` (`create_time`), KEY `x_auth_sess_up_time` (`update_time`), CONSTRAINT `x_auth_sess_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_auth_sess_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_auth_sess_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_cred_store` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `store_name` varchar(1024) NOT NULL, `descr` varchar(4000) NOT NULL, PRIMARY KEY (`id`), KEY `x_cred_store_FK_added_by_id` (`added_by_id`), KEY `x_cred_store_FK_upd_by_id` (`upd_by_id`), KEY `x_cred_store_cr_time` (`create_time`), KEY `x_cred_store_up_time` (`update_time`), CONSTRAINT `x_cred_store_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_cred_store_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_db_base` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `x_db_base_FK_added_by_id` (`added_by_id`), KEY `x_db_base_FK_upd_by_id` (`upd_by_id`), KEY `x_db_base_cr_time` (`create_time`), KEY `x_db_base_up_time` (`update_time`), CONSTRAINT `x_db_base_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_db_base_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_group` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `group_name` varchar(1024) NOT NULL, `descr` varchar(4000) NOT NULL, `status` int(11) NOT NULL DEFAULT '0', `group_type` int(11) NOT NULL DEFAULT '0', `cred_store_id` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `x_group_FK_added_by_id` (`added_by_id`), KEY `x_group_FK_upd_by_id` (`upd_by_id`), KEY `x_group_FK_cred_store_id` (`cred_store_id`), KEY `x_group_cr_time` (`create_time`), KEY `x_group_up_time` (`update_time`), CONSTRAINT `x_group_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_group_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) REFERENCES `x_cred_store` (`id`), CONSTRAINT `x_group_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_group_groups` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `group_name` varchar(1024) NOT NULL, `p_group_id` bigint(20) DEFAULT NULL, `group_id` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `x_group_groups_FK_added_by_id` (`added_by_id`), KEY `x_group_groups_FK_upd_by_id` (`upd_by_id`), KEY `x_group_groups_FK_p_group_id` (`p_group_id`), KEY `x_group_groups_FK_group_id` (`group_id`), KEY `x_group_groups_cr_time` (`create_time`), KEY `x_group_groups_up_time` (`update_time`), CONSTRAINT `x_group_groups_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_group_groups_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`), CONSTRAINT `x_group_groups_FK_p_group_id` FOREIGN KEY (`p_group_id`) REFERENCES `x_group` (`id`), CONSTRAINT `x_group_groups_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_user` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `user_name` varchar(1024) NOT NULL, `descr` varchar(4000) NOT NULL, `status` int(11) NOT NULL DEFAULT '0', `cred_store_id` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `x_user_FK_added_by_id` (`added_by_id`), KEY `x_user_FK_upd_by_id` (`upd_by_id`), KEY `x_user_FK_cred_store_id` (`cred_store_id`), KEY `x_user_cr_time` (`create_time`), KEY `x_user_up_time` (`update_time`), CONSTRAINT `x_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_user_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) REFERENCES `x_cred_store` (`id`), CONSTRAINT `x_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_group_users` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `group_name` varchar(1024) NOT NULL, `p_group_id` bigint(20) DEFAULT NULL, `user_id` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `x_group_users_FK_added_by_id` (`added_by_id`), KEY `x_group_users_FK_upd_by_id` (`upd_by_id`), KEY `x_group_users_FK_p_group_id` (`p_group_id`), KEY `x_group_users_FK_user_id` (`user_id`), KEY `x_group_users_cr_time` (`create_time`), KEY `x_group_users_up_time` (`update_time`), CONSTRAINT `x_group_users_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_group_users_FK_p_group_id` FOREIGN KEY (`p_group_id`) REFERENCES `x_group` (`id`), CONSTRAINT `x_group_users_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_group_users_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_policy_export_audit` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `client_ip` varchar(255) NOT NULL, `agent_id` varchar(255) DEFAULT NULL, `req_epoch` bigint(20) NOT NULL, `last_updated` datetime DEFAULT NULL, `repository_name` varchar(1024) DEFAULT NULL, `exported_json` text, `http_ret_code` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `x_policy_export_audit_FK_added_by_id` (`added_by_id`), KEY `x_policy_export_audit_FK_upd_by_id` (`upd_by_id`), KEY `x_policy_export_audit_cr_time` (`create_time`), KEY `x_policy_export_audit_up_time` (`update_time`), CONSTRAINT `x_policy_export_audit_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_policy_export_audit_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_resource` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `res_name` varchar(4000) DEFAULT NULL, `descr` varchar(4000) DEFAULT NULL, `res_type` int(11) NOT NULL DEFAULT '0', `asset_id` bigint(20) NOT NULL, `parent_id` bigint(20) DEFAULT NULL, `parent_path` varchar(4000) DEFAULT NULL, `is_encrypt` int(11) NOT NULL DEFAULT '0', `is_recursive` int(11) NOT NULL DEFAULT '0', `res_group` varchar(1024) DEFAULT NULL, `res_dbs` text, `res_tables` text, `res_col_fams` text, `res_cols` text, `res_udfs` text, `res_status` int(11) NOT NULL DEFAULT '1', `table_type` int(11) NOT NULL DEFAULT '0', `col_type` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `x_resource_FK_added_by_id` (`added_by_id`), KEY `x_resource_FK_upd_by_id` (`upd_by_id`), KEY `x_resource_FK_asset_id` (`asset_id`), KEY `x_resource_FK_parent_id` (`parent_id`), KEY `x_resource_cr_time` (`create_time`), KEY `x_resource_up_time` (`update_time`), CONSTRAINT `x_resource_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_resource_FK_asset_id` FOREIGN KEY (`asset_id`) REFERENCES `x_asset` (`id`), CONSTRAINT `x_resource_FK_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `x_resource` (`id`), CONSTRAINT `x_resource_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_trx_log` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `class_type` int(11) NOT NULL DEFAULT '0', `object_id` bigint(20) DEFAULT NULL, `parent_object_id` bigint(20) DEFAULT NULL, `parent_object_class_type` int(11) NOT NULL DEFAULT '0', `parent_object_name` varchar(1024) DEFAULT NULL, `object_name` varchar(1024) DEFAULT NULL, `attr_name` varchar(255) DEFAULT NULL, `prev_val` varchar(1024) DEFAULT NULL, `new_val` varchar(1024) DEFAULT NULL, `trx_id` varchar(1024) DEFAULT NULL, `action` varchar(255) DEFAULT NULL, `sess_id` varchar(512) DEFAULT NULL, `req_id` varchar(30) DEFAULT NULL, `sess_type` varchar(30) DEFAULT NULL, PRIMARY KEY (`id`), KEY `x_trx_log_FK_added_by_id` (`added_by_id`), KEY `x_trx_log_FK_upd_by_id` (`upd_by_id`), KEY `x_trx_log_cr_time` (`create_time`), KEY `x_trx_log_up_time` (`update_time`), CONSTRAINT `x_trx_log_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_trx_log_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_perm_map` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `perm_group` varchar(1024) DEFAULT NULL, `res_id` bigint(20) DEFAULT NULL, `group_id` bigint(20) DEFAULT NULL, `user_id` bigint(20) DEFAULT NULL, `perm_for` int(11) NOT NULL DEFAULT '0', `perm_type` int(11) NOT NULL DEFAULT '0', `is_recursive` int(11) NOT NULL DEFAULT '0', `is_wild_card` tinyint(1) NOT NULL DEFAULT '1', `grant_revoke` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), KEY `x_perm_map_FK_added_by_id` (`added_by_id`), KEY `x_perm_map_FK_upd_by_id` (`upd_by_id`), KEY `x_perm_map_FK_res_id` (`res_id`), KEY `x_perm_map_FK_group_id` (`group_id`), KEY `x_perm_map_FK_user_id` (`user_id`), KEY `x_perm_map_cr_time` (`create_time`), KEY `x_perm_map_up_time` (`update_time`), CONSTRAINT `x_perm_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_perm_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`), CONSTRAINT `x_perm_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES `x_resource` (`id`), CONSTRAINT `x_perm_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_perm_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE TABLE `x_audit_map` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `res_id` bigint(20) DEFAULT NULL, `group_id` bigint(20) DEFAULT NULL, `user_id` bigint(20) DEFAULT NULL, `audit_type` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `x_audit_map_FK_added_by_id` (`added_by_id`), KEY `x_audit_map_FK_upd_by_id` (`upd_by_id`), KEY `x_audit_map_FK_res_id` (`res_id`), KEY `x_audit_map_FK_group_id` (`group_id`), KEY `x_audit_map_FK_user_id` (`user_id`), KEY `x_audit_map_cr_time` (`create_time`), KEY `x_audit_map_up_time` (`update_time`), CONSTRAINT `x_audit_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_audit_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`), CONSTRAINT `x_audit_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES `x_resource` (`id`), CONSTRAINT `x_audit_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`), CONSTRAINT `x_audit_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`) )ROW_FORMAT=DYNAMIC; CREATE VIEW vx_trx_log AS select x_trx_log.id AS id,x_trx_log.create_time AS create_time,x_trx_log.update_time AS update_time,x_trx_log.added_by_id AS added_by_id,x_trx_log.upd_by_id AS upd_by_id,x_trx_log.class_type AS class_type,x_trx_log.object_id AS object_id,x_trx_log.parent_object_id AS parent_object_id,x_trx_log.parent_object_class_type AS parent_object_class_type,x_trx_log.attr_name AS attr_name,x_trx_log.parent_object_name AS parent_object_name,x_trx_log.object_name AS object_name,x_trx_log.prev_val AS prev_val,x_trx_log.new_val AS new_val,x_trx_log.trx_id AS trx_id,x_trx_log.action AS action,x_trx_log.sess_id AS sess_id,x_trx_log.req_id AS req_id,x_trx_log.sess_type AS sess_type from x_trx_log where id in(select min(x_trx_log.id) from x_trx_log group by x_trx_log.trx_id); INSERT INTO `x_portal_user` VALUES (1,now(),now(),NULL,NULL,'Admin','','Admin','admin','ceb4f32325eda6142bd65215f4c0f371','',1,0,NULL); INSERT INTO `x_portal_user_role` VALUES (1,now(),now(),NULL,NULL,1,'ROLE_SYS_ADMIN',1);
the_stack
set polar_enable_px='on'; create extension faultinjector; create table fault_test(id int); insert into fault_test values(generate_series(1,10000)); create index t1 on fault_test(id); create table fault_test2(id int); insert into fault_test2 values(generate_series(1,10000)); create index t2 on fault_test2(id); -- px_disp_async.c select inject_fault('all', 'reset'); select inject_fault('px_check_dispatch_no_result', 'enable', '', '', 1, 3, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('px_dispatch_command_error', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('px_process_results_input', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('px_process_bad_connection', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- px_conn.c select inject_fault('all', 'reset'); select inject_fault('px_forward_notices_error', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('px_forward_notices_old_style', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- px_snapshot.c select inject_fault('all', 'reset'); select inject_fault('pxsh_snapshot_equal', 'enable', '', '', 1, 3, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxsh_snapshot1_xmin_smaller', 'enable', '', '', 1, 3, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxsh_snapshot1_xmin_bigger', 'enable', '', '', 1, 3, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxsh_snapshot1_xmax_smaller', 'enable', '', '', 1, 3, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxsh_snapshot1_xmax_bigger', 'enable', '', '', 1, 3, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxsh_snapshot1_subxcnt_more', 'enable', '', '', 1, 3, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxsh_snapshot1_subxcnt_same', 'enable', '', '', 1, 3, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxsh_snapshot1_subxcnt_less', 'enable', '', '', 1, 3, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- px_disp_query.c select inject_fault('all', 'reset'); select inject_fault('pxdisp_dispatch_slices', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxconn_disconnect', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxconn_entry_db', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('get_database_name', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('get_user_name', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- px_disp_async.c select inject_fault('all', 'reset'); select inject_fault('pxdisp_flush_nonblock', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxdisp_flush_nonblock', 'enable', '', '', 1, 1, 0); select inject_fault('pxdisp_nonblock_zero', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxdisp_flush_nonblock', 'enable', '', '', 1, 1, 0); select inject_fault('pxdisp_nonblock_over_zero', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pxdisp_flush_nonblock', 'enable', '', '', 1, 1, 0); select inject_fault('pxdisp_nonblock_less_zero', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('handle_poll_bad', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('nextval_inject', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pgres_polling_failed', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- ic_udpifc.c select inject_fault('all', 'reset'); select inject_fault('rx_thread_error', 'enable', '', '', 1, 3, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('prunce_cursor_ic_entry', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('check_alive', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('active_count_fake', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- ic_tcp.c select inject_fault('all', 'reset'); select inject_fault('px_flush_buffer', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('udp_listen_error', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('px_conn_not_null', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('px_handle_disorder_packet', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('send_status_query_message', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('set_socket_buffer_error', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('ic_buffer_list_null', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('ic_buffer_list_length_error', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('ic_buffer_list_length_error_2', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('ic_buffer_link_error', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('send_once_error', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('send_chunk_stop', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('set_udp_connect_error', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('miss_slice_table', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('miss_stats', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pkt_duplicate', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; select inject_fault('all', 'reset'); select inject_fault('pkt_disorder', 'enable', '', '', 1, 1, 0); select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- output is not always the same, ignore it. -- px_conn.c -- select inject_fault('all', 'reset'); -- select inject_fault('hostaddr_info', 'enable', '', '', 1, 1, 0); -- select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- this will make database core, ignore it. -- px_disp_async.c -- select inject_fault('all', 'reset'); -- select inject_fault('pxdisp_poll_fd', 'enable', '', '', 1, 1, 0); -- select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- this will make database core, ignore it. -- px_dispatchresult.c -- select inject_fault('all', 'reset'); -- select inject_fault('pxdisp_makeresult_error', 'enable', '', '', 1, 1, 0); -- select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- this will make database core, ignore it. -- px_gang.c -- select inject_fault('all', 'reset'); -- select inject_fault('pxdisp_makeresult_error', 'enable', '', '', 1, 3, 0); -- select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- select inject_fault('all', 'reset'); -- select inject_fault('px_build_gang_definition_error', 'enable', '', '', 1, 1, 0); -- select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id; -- this will make database core, ignore it. -- px_motion.c -- select inject_fault('all', 'reset'); -- select inject_fault('px_send_stop_msg', 'enable', '', '', 1, 1, 0); -- select count(*) from fault_test, fault_test2 where fault_test.id = fault_test2.id;
the_stack
-- 2019-12-09T12:05:33.081Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutoApplyValidationRule,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,569738,541366,0,19,259,'M_Tour_ID',TO_TIMESTAMP('2019-12-09 14:05:32','YYYY-MM-DD HH24:MI:SS'),100,'N','D',10,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Tour',0,0,TO_TIMESTAMP('2019-12-09 14:05:32','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2019-12-09T12:05:33.091Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Column_ID=569738 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2019-12-09T12:05:33.137Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_Column_Translation_From_AD_Element(541366) ; -- 2019-12-09T12:05:38.245Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('C_Order','ALTER TABLE public.C_Order ADD COLUMN M_Tour_ID NUMERIC(10)') ; -- 2019-12-09T12:05:39.532Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator ALTER TABLE C_Order ADD CONSTRAINT MTour_COrder FOREIGN KEY (M_Tour_ID) REFERENCES public.M_Tour DEFERRABLE INITIALLY DEFERRED ; -- 2019-12-09T12:06:14.429Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,569738,593493,0,186,0,TO_TIMESTAMP('2019-12-09 14:06:14','YYYY-MM-DD HH24:MI:SS'),100,0,'D',0,'Y','Y','Y','N','N','N','N','N','Tour',700,680,0,1,1,TO_TIMESTAMP('2019-12-09 14:06:14','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-12-09T12:06:14.433Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=593493 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2019-12-09T12:06:14.435Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(541366) ; -- 2019-12-09T12:06:14.449Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=593493 ; -- 2019-12-09T12:06:14.451Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(593493) ; -- 2019-12-09T12:06:54.262Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,593493,0,186,540005,564595,'F',TO_TIMESTAMP('2019-12-09 14:06:54','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','N',0,'Tour',180,0,0,TO_TIMESTAMP('2019-12-09 14:06:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-12-09T13:36:30.062Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutoApplyValidationRule,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,569739,541366,0,19,500221,'M_Tour_ID',TO_TIMESTAMP('2019-12-09 15:36:29','YYYY-MM-DD HH24:MI:SS'),100,'N','de.metas.inoutcandidate',10,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Tour',0,0,TO_TIMESTAMP('2019-12-09 15:36:29','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2019-12-09T13:36:30.068Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Column_ID=569739 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2019-12-09T13:36:30.070Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_Column_Translation_From_AD_Element(541366) ; -- 2019-12-09T13:36:32.715Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('M_ShipmentSchedule','ALTER TABLE public.M_ShipmentSchedule ADD COLUMN M_Tour_ID NUMERIC(10)') ; -- 2019-12-09T13:36:32.906Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator ALTER TABLE M_ShipmentSchedule ADD CONSTRAINT MTour_MShipmentSchedule FOREIGN KEY (M_Tour_ID) REFERENCES public.M_Tour DEFERRABLE INITIALLY DEFERRED ; -- 2019-12-09T13:37:12.275Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,569739,593494,0,500221,0,TO_TIMESTAMP('2019-12-09 15:37:12','YYYY-MM-DD HH24:MI:SS'),100,0,'de.metas.inoutcandidate',0,'Y','Y','Y','N','N','N','N','N','Tour',610,680,0,1,1,TO_TIMESTAMP('2019-12-09 15:37:12','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-12-09T13:37:12.277Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=593494 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2019-12-09T13:37:12.279Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(541366) ; -- 2019-12-09T13:37:12.284Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=593494 ; -- 2019-12-09T13:37:12.286Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(593494) ; -- 2019-12-09T13:38:19.050Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,593494,0,500221,540048,564596,'F',TO_TIMESTAMP('2019-12-09 15:38:18','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','N',0,'Tour',15,0,0,TO_TIMESTAMP('2019-12-09 15:38:18','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-12-10T07:00:07.502Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Reference_ID,FieldLength,Version,IsKey,IsParent,IsTranslated,IsIdentifier,SeqNo,AD_Client_ID,IsActive,Created,CreatedBy,IsUpdateable,DDL_NoForeignKey,IsSelectionColumn,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,IsEncrypted,Updated,UpdatedBy,IsAdvancedText,IsLazyLoading,AD_Table_ID,IsCalculated,AD_Column_ID,IsDimension,IsMandatory,IsStaleable,IsUseDocSequence,IsRangeFilter,IsShowFilterIncrementButtons,IsDLMPartitionBoundary,IsGenericZoomKeyColumn,SelectionColumnSeqNo,AD_Element_ID,IsForceIncludeInGeneratedModel,IsGenericZoomOrigin,ColumnName,IsAutoApplyValidationRule,Name,AD_Org_ID,EntityType) VALUES (19,10,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-12-10 09:00:07','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','N','N','N','Y','N',TO_TIMESTAMP('2019-12-10 09:00:07','YYYY-MM-DD HH24:MI:SS'),100,'N','N',319,'N',569742,'N','N','N','N','N','N','N','N',0,541366,'N','N','M_Tour_ID','N','Tour',0,'de.metas.swat') ; -- 2019-12-10T07:00:07.513Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Column_ID=569742 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2019-12-10T07:00:07.516Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_Column_Translation_From_AD_Element(541366) ; -- 2019-12-10T07:00:09.488Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('M_InOut','ALTER TABLE public.M_InOut ADD COLUMN M_Tour_ID NUMERIC(10)') ; -- 2019-12-10T07:00:10.129Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator ALTER TABLE M_InOut ADD CONSTRAINT MTour_MInOut FOREIGN KEY (M_Tour_ID) REFERENCES public.M_Tour DEFERRABLE INITIALLY DEFERRED ; -- 2019-12-10T07:02:21.307Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,569742,593497,0,257,0,TO_TIMESTAMP('2019-12-10 09:02:21','YYYY-MM-DD HH24:MI:SS'),100,0,'D',0,'Y','Y','Y','N','N','N','N','N','Tour',540,500,0,1,1,TO_TIMESTAMP('2019-12-10 09:02:21','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-12-10T07:02:21.311Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=593497 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2019-12-10T07:02:21.315Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(541366) ; -- 2019-12-10T07:02:21.358Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=593497 ; -- 2019-12-10T07:02:21.365Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(593497) ; -- 2019-12-10T07:02:53.724Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,593497,0,257,1000029,564599,'F',TO_TIMESTAMP('2019-12-10 09:02:53','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','N',0,'Tour',70,0,0,TO_TIMESTAMP('2019-12-10 09:02:53','YYYY-MM-DD HH24:MI:SS'),100) ;
the_stack
SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for admin_log -- ---------------------------- DROP TABLE IF EXISTS `admin_log`; CREATE TABLE `admin_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `url` varchar(255) NOT NULL, `method` varchar(10) NOT NULL, `ip` varchar(20) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `deleted_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `u_id` int(11) NOT NULL, `name` varchar(30) NOT NULL, `address` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4; -- ---------------------------- -- Records of admin_log -- ---------------------------- -- ---------------------------- -- Table structure for admin_permissions -- ---------------------------- DROP TABLE IF EXISTS `admin_permissions`; CREATE TABLE `admin_permissions` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '权限名', `icon` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT 'link' COMMENT '权限图标', `path` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '路径', `url` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '前端url', `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态1正常;2禁用', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `method` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT 'GET' COMMENT '方法名称', `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `p_id` int(11) DEFAULT '0' COMMENT '父节点', `hidden` tinyint(4) DEFAULT '2' COMMENT '是否隐藏 1:是 2否', `is_menu` tinyint(4) DEFAULT '2' COMMENT '是否为菜单 0是 1否', `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '前端路由名称', `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='权限表'; -- ---------------------------- -- Records of admin_permissions -- ---------------------------- BEGIN; INSERT INTO `admin_permissions` VALUES (1, '系统管理', 'fa fa-steam-square', '/admin', '/admin', 1, '2021-02-28 11:40:29', '*', '2021-02-28 13:08:30', 0, 1, 1, '系统管理', NULL); INSERT INTO `admin_permissions` VALUES (2, '权限管理', 'fa fa-pencil-square', '/permission', '/permission', 1, '2021-02-28 11:42:17', '*', '2021-02-28 12:12:08', 1, 1, 1, '权限管理', NULL); INSERT INTO `admin_permissions` VALUES (3, '角色管理', 'fa fa-user-secret', '/role', '/role', 1, '2021-02-28 11:43:15', '*', '2021-02-28 12:12:18', 1, 1, 1, '角色管理', NULL); INSERT INTO `admin_permissions` VALUES (4, '用户管理', 'fa fa-users', '/user', '/user', 1, '2021-02-28 11:43:59', '*', '2021-02-28 12:12:22', 1, 1, 1, '用户管理', NULL); INSERT INTO `admin_permissions` VALUES (5, '系统日志', 'fa fa-location-arrow', '/log', '/log', 1, '2021-03-01 07:02:04', '*', '2021-03-01 07:02:04', 1, 1, 1, '系统日志', NULL); INSERT INTO `admin_permissions` VALUES (6, '系统', NULL, NULL, 'api/admin', 1, '2021-03-03 02:08:23', '*', '2021-03-03 11:56:06', 0, 1, 0, '系统', NULL); INSERT INTO `admin_permissions` VALUES (7, '日志列表', NULL, NULL, 'api/admin/log', 1, '2021-03-03 02:19:14', 'GET', '2021-03-03 14:06:12', 6, 1, 0, '日志列表', NULL); INSERT INTO `admin_permissions` VALUES (8, '用户列表', NULL, NULL, 'api/admin/users', 1, '2021-03-03 05:33:21', 'GET', '2021-03-03 14:06:24', 6, 1, 0, '用户列表', NULL); INSERT INTO `admin_permissions` VALUES (9, '日志删除', NULL, NULL, 'api/admin/log/{id}', 1, '2021-03-03 05:44:09', 'DELETE', '2021-03-03 13:46:51', 6, 1, 0, '日志删除', NULL); INSERT INTO `admin_permissions` VALUES (10, '添加用户', NULL, NULL, 'api/admin/users', 1, '2021-03-03 06:03:04', 'POST', '2021-03-03 14:06:52', 6, 1, 0, '添加用户', NULL); INSERT INTO `admin_permissions` VALUES (11, '更新用户', NULL, NULL, 'api/admin/users/{id}', 1, '2021-03-03 06:05:41', 'PUT', '2021-03-03 06:05:41', 6, 1, 0, '更新用户', NULL); INSERT INTO `admin_permissions` VALUES (12, '权限列表', 'fa fa-user-secret', '*', '/api/admin/permissions', 1, '2021-03-13 12:51:32', '*', '2021-03-13 20:52:19', 6, 1, 1, '权限列表', '2021-03-13 20:52:19'); INSERT INTO `admin_permissions` VALUES (13, '权限列表', NULL, NULL, 'api/admin/permissions', 1, '2021-03-13 12:52:32', 'GET', '2021-03-13 20:56:41', 6, 1, 0, '权限列表', NULL); INSERT INTO `admin_permissions` VALUES (14, '角色列表', NULL, NULL, 'api/admin/roles', 1, '2021-03-13 12:53:58', 'GET', '2021-03-13 20:57:25', 6, 1, 0, '角色列表', NULL); INSERT INTO `admin_permissions` VALUES (15, '测试', 'fa fa-slack', '/test', '/api/test', 1, '2021-05-27 05:50:58', '*', '2021-05-27 14:17:08', 0, 1, 1, '测试', '2021-05-27 14:17:08'); INSERT INTO `admin_permissions` VALUES (16, '子节点', 'fa fa-italic', '/test/z-test', '/*', 1, '2021-05-27 05:51:45', '*', '2021-05-27 13:53:03', 15, 1, 1, '子节点', NULL); INSERT INTO `admin_permissions` VALUES (17, '测试', 'fa fa-slack', '/test-1', '*', 1, '2021-05-27 05:53:33', '*', '2021-05-27 13:55:37', 0, 1, 1, '测试', '2021-05-27 13:55:37'); INSERT INTO `admin_permissions` VALUES (18, '测试菜单', 'fa fa-arrows-alt', '/test', '/test', 1, '2021-05-27 06:18:06', '*', '2021-06-03 10:21:21', 0, 1, 1, '测试菜单', '2021-06-03 10:21:21'); INSERT INTO `admin_permissions` VALUES (19, '测试子菜单', 'fa fa-video-camera', '/z-test', '/z-test', 1, '2021-05-27 06:19:01', '*', '2021-05-27 14:32:51', 18, 1, 1, '测试子菜单', NULL); INSERT INTO `admin_permissions` VALUES (20, '测试子菜单2', 'fa fa-arrows-alt', '/z-test1', '/z-test1', 1, '2021-05-27 06:22:10', '*', '2021-05-27 14:24:06', 18, 1, 1, '测试子菜单2', '2021-05-27 14:24:06'); INSERT INTO `admin_permissions` VALUES (21, '系统信息', 'fa fa-sun-o', '/system', '/system', 1, '2021-05-31 08:03:30', '*', '2021-05-31 08:03:30', 1, 1, 1, '系统信息', NULL); INSERT INTO `admin_permissions` VALUES (22, '系统终端', 'fa fa-terminal', '/terminal', '/terminal', 1, '2021-06-01 02:05:37', '*', '2021-06-01 02:05:37', 1, 1, 1, '系统终端', NULL); INSERT INTO `admin_permissions` VALUES (23, '系统工具', 'fa fa-steam', '/systemTools', '/systemTools', 1, '2021-06-03 02:12:13', '*', '2021-06-03 10:14:45', 24, 1, 1, '系统工具', NULL); INSERT INTO `admin_permissions` VALUES (24, '系统工具', 'fa fa-dedent', '/Tools', '/Tools', 1, '2021-06-03 02:14:29', '*', '2021-06-03 10:33:31', 0, 1, 1, '系统工具', '2021-06-03 10:33:31'); INSERT INTO `admin_permissions` VALUES (25, '代码生成', 'fa fa-file-code-o', '/code', '/code', 1, '2021-06-03 02:15:20', '*', '2021-06-03 13:30:43', 1, 1, 1, '代码生成', '2021-06-03 13:30:43'); COMMIT; -- ---------------------------- -- Table structure for admin_roles -- ---------------------------- DROP TABLE IF EXISTS `admin_roles`; CREATE TABLE `admin_roles` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL COMMENT '角色名称', `description` varchar(255) NOT NULL COMMENT '描述', `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态 0正常 1 禁用', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4; -- ---------------------------- -- Records of admin_roles -- ---------------------------- BEGIN; INSERT INTO `admin_roles` VALUES (1, 'administrator', '超级管理员', 1, '2021-02-28 19:45:14', '2021-03-01 16:24:02', NULL); INSERT INTO `admin_roles` VALUES (2, '运营', '运营', 1, '2021-02-28 20:04:16', '2021-03-03 14:05:05', NULL); INSERT INTO `admin_roles` VALUES (3, '财务', '财务', 1, '2021-03-04 19:08:25', '2021-03-04 19:08:25', NULL); INSERT INTO `admin_roles` VALUES (4, 'demo-user', 'demo登录', 1, '2021-03-13 20:54:27', '2021-06-02 15:27:01', NULL); INSERT INTO `admin_roles` VALUES (5, 'test', '测试', 1, '2021-05-24 20:01:41', '2021-05-24 20:02:27', NULL); COMMIT; -- ---------------------------- -- Table structure for casbin_rules -- ---------------------------- DROP TABLE IF EXISTS `casbin_rules`; CREATE TABLE `casbin_rules` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `p_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `v0` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `v1` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `v2` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `v3` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `v4` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `v5` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=171 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of casbin_rules -- ---------------------------- BEGIN; INSERT INTO `casbin_rules` VALUES (48, 'p', 'permission_1', '/permission', '*', '2', NULL, NULL, '2021-03-01 19:06:41', '2021-03-01 19:06:41'); INSERT INTO `casbin_rules` VALUES (49, 'p', 'permission_1', '/admin', '*', '1', NULL, NULL, '2021-03-01 19:06:41', '2021-03-01 19:06:41'); INSERT INTO `casbin_rules` VALUES (50, 'p', 'permission_1', '/user', '*', '4', NULL, NULL, '2021-03-01 19:06:41', '2021-03-01 19:06:41'); INSERT INTO `casbin_rules` VALUES (51, 'p', 'permission_1', '/log', '*', '5', NULL, NULL, '2021-03-01 19:06:41', '2021-03-01 19:06:41'); INSERT INTO `casbin_rules` VALUES (111, 'p', 'permission_2', '/user', '*', '4', NULL, NULL, '2021-03-03 14:05:05', '2021-03-03 14:05:05'); INSERT INTO `casbin_rules` VALUES (112, 'p', 'permission_2', '/log', '*', '5', NULL, NULL, '2021-03-03 14:05:05', '2021-03-03 14:05:05'); INSERT INTO `casbin_rules` VALUES (113, 'p', 'permission_2', 'api/admin/log', 'GET', '7', NULL, NULL, '2021-03-03 14:05:05', '2021-03-03 14:05:05'); INSERT INTO `casbin_rules` VALUES (114, 'p', 'permission_2', 'api/admin/users', 'GET', '8', NULL, NULL, '2021-03-03 14:05:05', '2021-03-03 14:05:05'); INSERT INTO `casbin_rules` VALUES (115, 'p', 'permission_2', 'api/admin/log/{id}', 'DELETE', '9', NULL, NULL, '2021-03-03 14:05:05', '2021-03-03 14:05:05'); INSERT INTO `casbin_rules` VALUES (117, 'p', 'permission_3', '/log', '*', '5', NULL, NULL, '2021-03-04 19:08:25', '2021-03-04 19:08:25'); INSERT INTO `casbin_rules` VALUES (118, 'p', 'permission_3', 'api/admin/log', 'GET', '7', NULL, NULL, '2021-03-04 19:08:25', '2021-03-04 19:08:25'); INSERT INTO `casbin_rules` VALUES (119, 'g', 'roles_8', '3', '财务', NULL, NULL, NULL, '2021-03-04 19:08:35', '2021-03-04 19:08:35'); INSERT INTO `casbin_rules` VALUES (137, 'g', 'roles_9', '4', 'demo-user', NULL, NULL, NULL, '2021-03-13 20:55:03', '2021-03-13 20:55:03'); INSERT INTO `casbin_rules` VALUES (138, 'g', 'roles_1', '1', 'administrator', NULL, NULL, NULL, '2021-03-13 21:12:56', '2021-03-13 21:12:56'); INSERT INTO `casbin_rules` VALUES (144, 'g', 'roles_7', '5', 'test', NULL, NULL, NULL, '2021-05-24 20:01:53', '2021-05-24 20:01:53'); INSERT INTO `casbin_rules` VALUES (145, 'p', 'permission_5', '/user', '*', '4', NULL, NULL, '2021-05-24 20:02:27', '2021-05-24 20:02:27'); INSERT INTO `casbin_rules` VALUES (146, 'p', 'permission_5', '/log', '*', '5', NULL, NULL, '2021-05-24 20:02:27', '2021-05-24 20:02:27'); INSERT INTO `casbin_rules` VALUES (147, 'p', 'permission_5', 'api/admin/log', 'GET', '7', NULL, NULL, '2021-05-24 20:02:27', '2021-05-24 20:02:27'); INSERT INTO `casbin_rules` VALUES (148, 'p', 'permission_5', 'api/admin/users', 'GET', '8', NULL, NULL, '2021-05-24 20:02:27', '2021-05-24 20:02:27'); INSERT INTO `casbin_rules` VALUES (149, 'p', 'permission_4', '/permission', '*', '2', NULL, NULL, '2021-06-02 15:27:01', '2021-06-02 15:27:01'); INSERT INTO `casbin_rules` VALUES (150, 'p', 'permission_4', '/role', '*', '3', NULL, NULL, '2021-06-02 15:27:01', '2021-06-02 15:27:01'); INSERT INTO `casbin_rules` VALUES (151, 'p', 'permission_4', '/user', '*', '4', NULL, NULL, '2021-06-02 15:27:01', '2021-06-02 15:27:01'); INSERT INTO `casbin_rules` VALUES (152, 'p', 'permission_4', '/log', '*', '5', NULL, NULL, '2021-06-02 15:27:02', '2021-06-02 15:27:02'); INSERT INTO `casbin_rules` VALUES (153, 'p', 'permission_4', 'api/admin/log', 'GET', '7', NULL, NULL, '2021-06-02 15:27:02', '2021-06-02 15:27:02'); INSERT INTO `casbin_rules` VALUES (154, 'p', 'permission_4', 'api/admin/users', 'GET', '8', NULL, NULL, '2021-06-02 15:27:02', '2021-06-02 15:27:02'); INSERT INTO `casbin_rules` VALUES (155, 'p', 'permission_4', 'api/admin/log/{id}', 'DELETE', '9', NULL, NULL, '2021-06-02 15:27:02', '2021-06-02 15:27:02'); INSERT INTO `casbin_rules` VALUES (156, 'p', 'permission_4', 'api/admin/permissions', 'GET', '13', NULL, NULL, '2021-06-02 15:27:02', '2021-06-02 15:27:02'); INSERT INTO `casbin_rules` VALUES (157, 'p', 'permission_4', 'api/admin/roles', 'GET', '14', NULL, NULL, '2021-06-02 15:27:02', '2021-06-02 15:27:02'); INSERT INTO `casbin_rules` VALUES (158, 'p', 'permission_4', '/system', '*', '21', NULL, NULL, '2021-06-02 15:27:02', '2021-06-02 15:27:02'); INSERT INTO `casbin_rules` VALUES (159, 'p', 'permission_4', '/terminal', '*', '22', NULL, NULL, '2021-06-02 15:27:02', '2021-06-02 15:27:02'); INSERT INTO `casbin_rules` VALUES (160, 'g', 'roles_10', '5', 'test', NULL, NULL, NULL, '2021-06-03 16:45:35', '2021-06-03 16:45:35'); INSERT INTO `casbin_rules` VALUES (170, 'g', 'roles_37', '4', 'demo-user', NULL, NULL, NULL, '2021-06-03 20:07:07', '2021-06-03 20:07:07'); COMMIT; -- ---------------------------- -- Table structure for dings -- ---------------------------- DROP TABLE IF EXISTS `dings`; CREATE TABLE `dings` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `nick` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '昵称', `unionid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '唯一id', `openid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '当前应用id', `ding_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '钉钉id', `user_id` int(11) DEFAULT NULL COMMENT '管理员id', `ding_user_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '钉钉用户ID', `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of dings -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for failed_jobs -- ---------------------------- DROP TABLE IF EXISTS `failed_jobs`; CREATE TABLE `failed_jobs` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of failed_jobs -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for migrations -- ---------------------------- DROP TABLE IF EXISTS `migrations`; CREATE TABLE `migrations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of migrations -- ---------------------------- BEGIN; INSERT INTO `migrations` VALUES (1, '2014_10_12_000000_create_users_table', 1); INSERT INTO `migrations` VALUES (2, '2014_10_12_100000_create_password_resets_table', 1); INSERT INTO `migrations` VALUES (3, '2019_08_19_000000_create_failed_jobs_table', 1); INSERT INTO `migrations` VALUES (5, '2019_03_01_000000_create_rules_table', 2); COMMIT; -- ---------------------------- -- Table structure for password_resets -- ---------------------------- DROP TABLE IF EXISTS `password_resets`; CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, KEY `password_resets_email_index` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of password_resets -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for users -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `ding_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `oauth_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `oauth_type` tinyint(1) DEFAULT NULL COMMENT '1.微博 2钉钉', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of users -- ---------------------------- BEGIN; INSERT INTO `users` VALUES (1, 'admin', 'pltruenine@163.com', NULL, '$2y$10$f1Kf7DY1A8WJ5BpuRMu6yuOs3kOu1EoIjkhotApZxWHE30nF1nlvi', NULL, '2021-01-20 11:42:00', '2021-05-26 11:54:22', 'http://adminapi.test/storage/xXEmZMhpEARYImy1tfGW43poB4geC5MBQIABTrQH.jpg', NULL, NULL, NULL); INSERT INTO `users` VALUES (7, 'pan', '2540463097@qq.com', NULL, '$2y$10$/yLMOcd1wedOE..NQ271c.naLU9pltWnnkYy4EJKC6SYmySd8EQTW', NULL, '2021-02-26 10:23:14', '2021-05-27 13:47:56', 'http://financial_api.test/storage/tU0E3915YWsL3R7NSQaLTQ3dbAZtD1vUPbm9KyG2.jpg', NULL, NULL, NULL); INSERT INTO `users` VALUES (8, 'caiwu', 'caiwu@163.com', NULL, '$2y$10$dhimwV200FCTUYQmjdXkp.h4WNkKskSmF/xGc1BtxznQ0LBBJY3nW', NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO `users` VALUES (9, 'demo-user', 'admin@gmail.com', NULL, '$2y$10$hK42qF7ODa9IG9SyUqY4jOVNOtEkvIl.J3HrU0zJNgweok5Mvbyey', NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO `users` VALUES (10, '34343', 'pltruenine@1633.com', NULL, '$2y$10$0B4MaHcgq0a0CLD85GWljOMlDG3IR8sBlWSw7rFIvkp4is2nSqtXu', NULL, '2021-06-03 16:45:35', NULL, NULL, NULL, NULL, NULL); INSERT INTO `users` VALUES (37, 'Hi叫我李荣浩', '', NULL, '$2y$10$F7pwYD.K9b1r4/CPqS28DeRrPrsdDQlid3qZiog2c0uF9.MA/W6sq', NULL, '2021-06-03 19:50:31', '2021-06-03 19:50:31', 'https://tvax2.sinaimg.cn/crop.0.0.1002.1002.180/006pP2Laly8gqcj17wce9j30ru0ru0up.jpg?KID=imgbed,tva&Expires=1622731831&ssig=Xu7sPFw5ou', NULL, '5878370732', NULL); COMMIT; SET FOREIGN_KEY_CHECKS = 1;
the_stack
CREATE TEMP FUNCTION string_to_label_array(lables_str STRING) RETURNS ARRAY<STRUCT<key STRING, value STRING>> LANGUAGE js AS ''' return JSON.parse(lables_str); '''; CREATE TEMP FUNCTION commitmentSKUToNegationSKU(sku_desc STRING) RETURNS STRING AS ( IF(REGEXP_CONTAINS(sku_desc, r"[cC]ommitment v[0-9]: [a-zA-Z]+ in [a-zA-Z0-9\\-]+ for [0-9]+ [_a-zA-Z]+"), CONCAT( --prefix "Reattribution_Negation_CUD_", --number REGEXP_EXTRACT(sku_desc, r"[cC]ommitment v[0-9]: [a-zA-Z]+ in [a-zA-Z0-9\\-]+ for ([0-9]+) [_a-zA-Z]+"), --timeframe REGEXP_EXTRACT(sku_desc, r"[cC]ommitment v[0-9]: [a-zA-Z]+ in [a-zA-Z0-9\\-]+ for [0-9]+ ([_a-zA-Z]+)"), "_", --UPPER(type) UPPER(REGEXP_EXTRACT(sku_desc, r"[cC]ommitment v[0-9]: ([a-zA-Z]+) in [a-zA-Z0-9\\-]+ for [0-9]+ [_a-zA-Z]+")), "_COST_", --region REGEXP_EXTRACT(sku_desc, r"[cC]ommitment v[0-9]: [a-zA-Z]+ in ([a-zA-Z0-9\\-]+) for [0-9]+ [_a-zA-Z]+") ), NULL)); CREATE TEMP FUNCTION regionMapping(gcp_region STRING) RETURNS STRING AS ( CASE WHEN gcp_region IS NULL THEN NULL WHEN gcp_region LIKE "us-%" OR gcp_region LIKE "northamerica%" OR gcp_region LIKE "southamerica%" THEN "Americas" WHEN gcp_region LIKE "europe-%" THEN "EMEA" WHEN gcp_region LIKE "australia-%" OR gcp_region LIKE "asia-%" THEN"APAC" END); CREATE TEMP FUNCTION ratio(numerator float64, denominator float64) as (IF(denominator = 0, 0, numerator / denominator)); ( WITH billing_export_table AS ( SELECT * FROM `{{ params.billing_export_table_name }}` WHERE CAST(DATETIME(usage_start_time, "America/Los_Angeles") AS DATE) >= "2018-09-20"), correct_cud_costs AS ( SELECT billing_account_id AS billing_account_id, STRUCT ( service_id AS id, service_description AS description) AS service, STRUCT (CONCAT("Reattribution_Addition_CUD_", IF(LOWER(unit_type) LIKE "ram", "RAM_COST", "CORE_COST"), "_", regionMapping(region)) AS id, CONCAT("Reattribution_Addition_CUD_", IF(LOWER(unit_type) LIKE "ram", "RAM_COST", "CORE_COST"), "_", regionMapping(region)) AS description) AS sku, TIMESTAMP_ADD(TIMESTAMP(usage_date), INTERVAL ((3600*23)+3599) SECOND) AS usage_start_time, TIMESTAMP_ADD(TIMESTAMP(usage_date), INTERVAL ((3600*23)+3599) SECOND) AS usage_end_time, STRUCT (project_id AS id, project_name AS name, ARRAY<STRUCT<key STRING, value STRING>> [] AS labels, ancestry_numbers AS ancestry_numbers) AS project, string_to_label_array(d.labels) as labels, ARRAY<STRUCT<key STRING,value STRING>> [] AS system_labels, STRUCT ( "" AS location, "" AS country, region AS region, "" AS zone ) AS location, CURRENT_TIMESTAMP() AS export_time, P_alloc_commitment_cost_{{ params.cud_cost_attribution_option }} AS cost, "USD" AS currency, 1.0 AS currency_conversion_rate, STRUCT ( 0.0 AS amount, IF(LOWER(unit_type) LIKE "ram", "byte-seconds", "gibibyte hour") AS unit, 0.0 AS amount_in_pricing_units, IF(LOWER(unit_type) LIKE "ram", "seconds", "hour") AS pricing_unit ) AS usage, ARRAY<STRUCT<name STRING, amount FLOAT64, full_name STRING, id STRING, type STRING>> [] AS credits, STRUCT ( FORMAT_DATE("%Y%m", usage_date) AS month) AS invoice, cost_type FROM `{{ params.project_id }}.{{ params.corrected_dataset_id }}.{{ params.distribute_commitments_table }}` d WHERE {{ params.enable_cud_cost_attribution }} AND P_alloc_commitment_cost_{{ params.cud_cost_attribution_option }} <> 0 ), correct_cud_credits AS ( SELECT billing_account_id AS billing_account_id, STRUCT ( service_id AS id, service_description AS description) AS service, STRUCT ( CONCAT("Reattribution_Addition_CUD_", IF(LOWER(unit_type) LIKE "ram","RAM", "CORE"), "_CREDIT_", regionMapping(region)) AS id, CONCAT("Reattribution_Addition_CUD_", IF(LOWER(unit_type) LIKE "ram","RAM", "CORE"), "_CREDIT_", regionMapping(region)) AS description) AS sku, TIMESTAMP_ADD(TIMESTAMP(usage_date), INTERVAL ((3600*23)+3599) SECOND) AS usage_start_time, TIMESTAMP_ADD(TIMESTAMP(usage_date), INTERVAL ((3600*23)+3599) SECOND) AS usage_end_time, STRUCT ( project_id AS id, project_name AS name, ARRAY<STRUCT<key STRING,value STRING>> [] AS labels, ancestry_numbers AS ancestry_numbers) AS project, string_to_label_array(d.labels) as labels, ARRAY<STRUCT<key STRING,value STRING>> [] AS system_labels, STRUCT ( region AS location, "" AS country, region AS region, "" AS zone ) AS location, CURRENT_TIMESTAMP() AS export_time, 0.0 AS cost, "USD" AS currency, 1.0 AS currency_conversion_rate, STRUCT ( 0.0 AS amount, IF(LOWER(unit_type) LIKE "ram", "byte-seconds", "seconds") AS unit, 0.0 AS amount_in_pricing_units, IF(LOWER(unit_type) LIKE "ram", "byte-seconds", "seconds") AS pricing_unit ) AS usage, ARRAY<STRUCT<name STRING, amount FLOAT64, full_name STRING, id STRING, type STRING>>[(IF(LOWER(unit_type) LIKE "ram", "Committed Usage Discount: RAM", "Committed Usage Discount: CPU"), P_alloc_cud_credit_cost, "", "", "" )] AS credits, STRUCT ( FORMAT_DATE("%Y%m", usage_date) AS month) AS invoice, cost_type FROM `{{ params.project_id }}.{{ params.corrected_dataset_id }}.{{ params.distribute_commitments_table }}` d WHERE P_alloc_cud_credit_cost <> 0 ), cancelled_credits AS ( SELECT billing_account_id, service AS service, sku, usage_start_time, usage_end_time, project AS project, labels, system_labels, location AS location, export_time, 0.0 AS cost, currency, currency_conversion_rate, STRUCT( 0.0 AS amount, usage.unit AS unit, 0.0 AS amount_in_pricing_units, usage.pricing_unit AS pricing_unit) AS usage, ARRAY<STRUCT<name STRING, amount FLOAT64, full_name STRING, id STRING, type STRING>> [(cs.name, -1*cs.amount, "", "", "")] AS credits, invoice, cost_type FROM billing_export_table, UNNEST(credits) AS cs WHERE service.description = "Compute Engine" AND ( FALSE OR (LOWER(sku.description) LIKE "%instance%" OR LOWER(sku.description) LIKE "% intel %") OR LOWER(sku.description) LIKE "%memory optimized core%" OR LOWER(sku.description) LIKE "%memory optimized ram%" OR LOWER(sku.description) LIKE "%commitment%") -- Filter out Sole Tenancy skus that do not represent billable compute instance usage AND NOT ( FALSE -- the VMs that run on sole tenancy nodes are not actually billed. Just the sole tenant node is OR LOWER(sku.description) LIKE "%hosted on sole tenancy%" -- sole tenancy premium charge is not eligible instance usage OR LOWER(sku.description) LIKE "sole tenancy premium%" ) and (LOWER(cs.name) LIKE "%committed%" OR LOWER(cs.name) LIKE "%sustained%") ), cancelled_cud_costs AS ( SELECT billing_account_id, service AS service, STRUCT ( commitmentSKUToNegationSKU(sku.description ) AS id, commitmentSKUToNegationSKU(sku.description) AS description ) AS sku, usage_start_time, usage_end_time, project AS project, labels, system_labels, location AS location, export_time, -1.0*cost AS cost, currency, currency_conversion_rate, STRUCT( 0.0 AS amount, usage.unit AS unit, 0.0 AS amount_in_pricing_units, usage.pricing_unit AS pricing_unit) AS usage, ARRAY<STRUCT<name STRING, amount FLOAT64, full_name STRING, id STRING, type STRING>> [] AS credits, invoice, cost_type FROM billing_export_table WHERE {{ params.enable_cud_cost_attribution }} AND service.description = "Compute Engine" AND LOWER(sku.description) LIKE "%commitment%" AND cost <> 0 ), correct_sud_credits AS ( SELECT billing_account_id AS billing_account_id, STRUCT ( service_id AS id, service_description AS description) AS service, STRUCT ( "Reattribution_Addition_SUD_CREDIT" AS id, "Reattribution_Addition_SUD_CREDIT" AS description) AS sku, TIMESTAMP_ADD(TIMESTAMP(usage_date), INTERVAL ((3600*23)+3599) SECOND) AS usage_start_time, TIMESTAMP_ADD(TIMESTAMP(usage_date), INTERVAL ((3600*23)+3599) SECOND) AS usage_end_time, STRUCT ( project_id AS id, project_name AS name, ARRAY<STRUCT<key STRING, value STRING>> [] AS labels, ancestry_numbers AS ancestry_numbers) AS project, string_to_label_array(d.labels) as labels, ARRAY<STRUCT<key STRING, value STRING>> [] AS system_labels, STRUCT ( "" AS location, "" AS country, region AS region, "" AS zone ) AS location, CURRENT_TIMESTAMP() AS export_time, 0.0 AS cost, "USD" AS currency, 1.0 AS currency_conversion_rate, STRUCT ( 0.0 AS amount, IF(LOWER(unit_type) LIKE "ram", "byte-seconds", "seconds") AS unit, 0.0 AS amount_in_pricing_units, IF(LOWER(unit_type) LIKE "ram", "byte-seconds", "seconds") AS pricing_unit ) AS usage, ARRAY<STRUCT<name STRING, amount FLOAT64, full_name STRING, id STRING, type STRING>> [("Sustained Usage Discount", P_alloc_sud_credit_cost, "", "", "")] AS credits, STRUCT ( FORMAT_DATE("%Y%m", usage_date) AS month) AS invoice, cost_type FROM `{{ params.project_id }}.{{ params.corrected_dataset_id }}.{{ params.distribute_commitments_table }}` d WHERE P_alloc_sud_credit_cost <> 0) SELECT * FROM correct_sud_credits UNION ALL SELECT * FROM correct_cud_credits UNION ALL SELECT * FROM cancelled_credits UNION ALL SELECT * FROM correct_cud_costs UNION ALL SELECT * FROM cancelled_cud_costs UNION ALL SELECT * FROM `{{ params.billing_export_table_name }}` )
the_stack
------ Cards & Subjects -------------------------------------------------- -- TODO given a subject, calculate its parents and children -- Allow end users to make subjects: create function sg_private.update_version_status() returns trigger as $$ declare role text; begin role := current_setting('jwt.claims.role')::text; if (role = 'sg_admin') then return new; end if; if (old.user_id <> current_setting('jwt.claims.user_id')) then raise exception 'A user may only change their own version status.' using errcode = '61C7AC84'; end if; if (new.status <> 'declined') then raise exception 'A user may only change the version status to declined.' using errcode = '05F2D0E1'; end if; if (old.status = 'accepted') then raise exception 'A user cannot change an accepted version.' using errcode = '62CF3D42'; end if; return new; end; $$ language plpgsql strict security definer; comment on function sg_private.update_version_status() is 'A user may only change their own version status to declined.'; create trigger update_subject_version_status before update on sg_public.subject_version for each row execute procedure sg_private.update_version_status(); comment on trigger update_subject_version_status on sg_public.subject_version is 'A user may only decline their own un-accepted subject version.'; create trigger update_card_version_status before update on sg_public.card_version for each row execute procedure sg_private.update_version_status(); comment on trigger update_card_version_status on sg_public.card_version is 'A user may only decline their own un-accepted card version.'; create function sg_private.insert_subject_version_parent_child_cycle() returns trigger as $$ begin if exists( with recursive graph (entity_id, path, cycle) as ( select sv.entity_id, array[sv.entity_id, new.entity_id], sv.entity_id = new.entity_id from sg_public.subject_version sv where new.version_id = sv.version_id union all select s.entity_id, g.path || s.entity_id, s.entity = any(g.path) from graph g, sg_public.subject_version_parent_child svpc, sg_public.subject s where g.entity_id = svpc.before_entity_id and svpc.version_id = s.version_id and not g.cycle ) select * ) then raise exception 'Subject parent/child cannot form a cycle.' using errcode = '7876F332'; else return new; end if; end; $$ language plpgsql strict security definer; create trigger insert_subject_version_parent_child_cycle before insert on sg_public.subject_version for each row execute procedure sg_private.insert_subject_version_parent_child_cycle(); comment on function sg_private.insert_subject_version_parent_child_cycle() is 'Ensure subject parent/child relations don''t form a cycle.'; comment on trigger insert_subject_version_parent_child_cycle on sg_public.subject_version is 'Ensure subject parent/child relations don''t form a cycle.'; create function sg_private.insert_subject_version_before_after_cycle() returns trigger as $$ begin if exists( with recursive graph (entity_id, path, cycle) as ( select sv.entity_id, array[sv.entity_id, new.entity_id], sv.entity_id = new.entity_id from sg_public.subject_version sv where new.version_id = sv.version_id union all select s.entity_id, g.path || s.entity_id, s.entity = any(g.path) from graph g, sg_public.subject_version_before_after svba, sg_public.subject s where g.entity_id = svba.before_entity_id and svba.version_id = s.version_id and not g.cycle ) select * ) then raise exception 'Subject before/after cannot form a cycle.' using errcode = 'D8182DC8'; else return new; end if; end; $$ language plpgsql strict security definer; create trigger insert_subject_version_before_after_cycle before insert on sg_public.subject_version for each row execute procedure sg_private.insert_subject_version_before_after_cycle(); comment on function sg_private.insert_subject_version_before_after_cycle() is 'Ensure subject before/after relations don''t form a cycle.'; comment on trigger insert_subject_version_before_after_cycle on sg_public.subject_version is 'Ensure subject before/after relations don''t form a cycle.'; -- Update & delete card and subject: admin. grant update, delete on table sg_public.subject_version to sg_admin; grant update (status) on table sg_public.subject_version to sg_user; grant update, delete on table sg_public.subject_version_parent_child to sg_admin; grant update, delete on table sg_public.subject_version_before_after to sg_admin; grant update, delete on table sg_public.card_version to sg_admin; grant update (status) on table sg_public.card_version to sg_user; ------ Topics & Posts ---------------------------------------------------------- create function sg_private.vote_to_status() returns trigger as $$ if new.kind <> 'proposal' and new.kind <> 'vote' then return new; end if; if old and (old.status = 'accepted' or old.status = 'declined') then return new; end if; if new.response = false then return new; end if; -- For now, just accept update sg_public.card_version set status = 'accepted' where version_id in ( select version_id from sg_public.post_entity_version where post_id = new.id and entity_kind = 'card' ); update sg_public.subject_version set status = 'accepted' where version_id in ( select version_id from sg_public.post_entity_version where post_id = new.id and entity_kind = 'subject' ); -- Later version: -- get all the users who voted on the proposal -- count the number of accepted versions total per user: points -- assign a score of 0->1 (non-linear) to each user: 1 - e ^ (-points / 40) (computed column?) -- determine the number of learners impacted (computed column?) -- -- for a subject, get all subjects upward + current, then sum the user_subject counts -- -- for a card, get the immediate subject, then subject procedure -- if numLearners > 0 and sum(noVotes) > log100(numLearners), change the status to blocked -- if sum(yesVotes) > log5(numLearners), change the status to accepted -- else, change the status to pending $$ language 'plpgsql'; comment on function sg_private.vote_to_status() is 'When a new proposal or vote happens, change entity status if possible'; create trigger vote_to_status after insert, update on sg_public.post for each row execute sg_private.vote_to_status(); comment on trigger vote_to_status on sg_public.post is 'When a new proposal or vote happens, change entity status if possible'; ------ Notices & Follows ------------------------------------------------------- ------ Notices & Follows > Types ----------------------------------------------- create type sg_public.notice_kind as enum( 'version_pending', 'version_blocked', 'version_declined', 'version_accepted', 'insert_topic', 'insert_post' ); comment on type sg_public.notice_kind is 'The kinds of notices. Expanding.'; ------ Notices & Follows > Tables ---------------------------------------------- create table sg_public.notice ( id uuid primary key default uuid_generate_v4(), created timestamp not null default current_timestamp, modified timestamp not null default current_timestamp, user_id uuid not null references sg_public.user (id) on delete cascade, read boolean not null default false, kind sg_public.notice_kind not null, entity_id uuid not null, entity_kind sg_public.entity_kind not null, foreign key (entity_id, entity_kind) references sg_public.entity (entity_id, entity_kind) ); comment on table sg_public.notice is 'A notice is a message that an entity has recent activity.'; comment on column table sg_public.notice.id is 'The ID of the notice.'; comment on column table sg_public.notice.created is 'When the system created the notice.'; comment on column table sg_public.notice.modified is 'When the notice last changed.'; comment on column table sg_public.notice.user_id is 'Which user the notice belongs to.'; comment on column table sg_public.notice.kind is 'The kind of notice.'; comment on column sg_public.notice.entity_id is 'The entity the notice informs.'; comment on column sg_public.notice.entity_kind is 'The kind of entity notice informs.'; comment on column table sg_public.notice.read is 'Whether or not the user has read the notice.'; create table sg_public.follow ( id uuid primary key default uuid_generate_v4(), created timestamp not null default current_timestamp, modified timestamp not null default current_timestamp, user_id uuid not null references sg_public.user (id) on delete cascade, entity_id uuid not null, entity_kind sg_public.entity_kind not null, unique (user_id, entity_id), foreign key (entity_id, entity_kind) references sg_public.entity (entity_id, entity_kind) ); comment on table sg_public.follow is 'A follow is an association between a user and an entity. ' 'The user indicates they want notices for the entity.' comment on column sg_public.follow.id is 'The ID of the follow.'; comment on column sg_public.follow.created is 'When the user or system created the follow.'; comment on column sg_public.follow.modified is 'When the user or system modified the follow.'; comment on column sg_public.follow.user_id is 'The user the follow belongs to.'; comment on column sg_public.follow.entity_id is 'The entity the follow belongs to.'; comment on column sg_public.follow.entity_kind is 'The kind of entity the follow belongs to.'; ------ Notices & Follows > Indexes --------------------------------------------- ------ Notices & Follows > Functions ------------------------------------------- ------ Notices & Follows > Triggers -------------------------------------------- create trigger insert_follow_user_id before insert on sg_public.follow for each row execute procedure sg_private.insert_user_id_column(); comment on trigger insert_follow_user_id on sg_public.follow is 'Whenever I make a new follow, auto fill the `user_id` column'; create trigger update_notice_modified before update on sg_public.notice for each row execute procedure sg_private.update_modified_column(); comment on trigger update_notice_modified on sg_public.notice is 'Whenever a notice changes, update the `modified` column.'; create trigger update_follow_modified before update on sg_public.follow for each row execute procedure sg_private.update_modified_column(); comment on trigger update_follow_modified on sg_public.follow is 'Whenever a follow changes, update the `modified` column.'; ------ Notices & Follows > Permissions ----------------------------------------- -- Enable RLS. alter table sg_public.notice enable row level security; alter table sg_public.follow enable row level security; -- Select follow: user or admin self. grant select on table sg_public.follow to sg_user, sg_admin; create policy select_follow on sg_public.follow for select to sg_user, sg_admin using (user_id = nullif(current_setting('jwt.claims.user_id', true), '')::uuid); comment on policy select_follow on sg_public.follow is 'A user or admin can select their own follows.'; -- Insert follow: user or admin. grant insert (entity_id, entity_kind) on table sg_public.follow to sg_user, sg_admin; create policy insert_follow on sg_public.follow for insert (entity_id, entity_kind) to sg_user, sg_admin with check (true); -- Update follow: none. -- Delete follow: user or admin self. grant delete on table sg_public.follow to sg_user, sg_admin; create policy delete_follow on sg_public.follow for select to sg_user, sg_admin using (user_id = nullif(current_setting('jwt.claims.user_id', true), '')::uuid); comment on policy delete_follow on sg_public.follow is 'A user or admin can delete their own follows.'; -- Select notice: user or admin self. grant select on table sg_public.notice to sg_user, sg_admin; create policy select_notice on sg_public.notice for select to sg_user, sg_admin using (user_id = nullif(current_setting('jwt.claims.user_id', true), '')::uuid); comment on policy select_notice on sg_public.notice is 'A user or admin can select their own notices.'; -- Insert notice: none. -- Update notice: user or admin self (read). grant update on table sg_public.notice to sg_user, sg_admin; create policy update_notice on sg_public.notice for update (read) to sg_user, sg_admin using (nullif(current_setting('jwt.claims.user_id', true), '')::uuid); comment on policy update_notice on sg_public.notice is 'A user or admin can mark a notice as read or unread.'; -- Delete notice: user or admin self. grant delete on table sg_public.notice to sg_user, sg_admin; create policy delete_notice on sg_public.notice for delete to sg_user, sg_admin using (nullif(current_setting('jwt.claims.user_id', true), '')::uuid); comment on policy delete_notice on sg_public.notice is 'A user or admin can delete their own notices.'; create function sg_private.insert_version_notice() returns trigger as $$ insert into sg_public.notice (user_id, kind, entity_kind, entity_id) select ( unnest( select distinct user_id from sg_public.follow where new.entity_id = sg_public.follow.entity_id ), 'version_pending', replace(tg_table_name, '_version', ''), new.entity_id ); $$ language 'plpgsql'; comment on function sg_private.insert_version_notice() is 'After I insert a new version, notify followers.'; create function sg_private.update_version_notice() returns trigger as $$ if (new.status <> old.status) then insert into sg_public.notice (user_id, kind, entity_kind, entity_id) select ( unnest( select distinct user_id from sg_public.follow where new.entity_id = sg_public.follow.entity_id ), 'version_' || new.status, replace(tg_table_name, '_version', ''), new.entity_id ); end if; $$ language 'plpgsql'; comment on function sg_private.update_version_notice() is 'After I update a version status, notify followers.'; create trigger insert_subject_version_notice after insert on sg_public.subject_version for each row execute procedure sg_private.insert_version_notice(); comment on trigger insert_subject_version_notice on sg_public.subject_version is 'After I insert a new subject version, notify followers.'; create trigger insert_card_version_notice after insert on sg_public.card_version for each row execute procedure sg_private.insert_version_notice(); comment on trigger insert_card_version_notice on sg_public.card_version is 'After I insert a new card version, notify followers.'; create trigger update_subject_version_notice after update on sg_public.subject_version for each row execute procedure sg_private.update_version_notice(); comment on trigger update_subject_version_notice on sg_public.subject_version is 'After I update a subject version, notify followers.'; create trigger update_card_version_notice after update on sg_public.card_version for each row execute procedure sg_private.update_version_notice(); comment on trigger update_card_version_notice on sg_public.card_version is 'After I update a card version, notify followers.'; create function sg_private.insert_topic_notice() returns trigger as $$ insert into sg_public.notice (user_id, kind, entity_kind, entity_id) select ( unnest( select distinct user_id from sg_public.follow where new.entity_id = sg_public.follow.entity_id ), 'insert_topic', new.entity_kind, new.entity_id ); $$ language 'plpgsql'; comment on function sg_private.insert_topic_notice() is 'After I insert a new topic, notify followers.'; create trigger insert_topic_notice after insert on sg_public.topic for each row execute procedure sg_private.insert_topic_notice(); comment on trigger insert_topic_notice on sg_public.topic is 'After I insert a new topic, notify followers.' create function sg_private.insert_post_notice() returns trigger as $$ declare topic sg_public.topic; begin topic := ( select * from sg_public.topic where id = new.topic_id limit 1; ); insert into sg_public.notice (user_id, kind, entity_kind, entity_id) select ( unnest( select distinct user_id from sg_public.follow where topic.entity_id = sg_public.follow.entity_id ), 'insert_post', topic.entity_kind, topic.entity_id ); end; $$ language 'plpgsql'; comment on function sg_private.insert_post_notice() is 'After I insert a new post, notify followers.'; create trigger insert_post_notice after insert on sg_public.post for each row execute procedure sg_private.insert_post_notice(); comment on trigger insert_post_notice on sg_public.post is 'After I insert a new post, notify followers.'; create function sg_private.follow_own_topic() returns trigger as $$ insert into sg_public.follow (entity_id, entity_kind) values (new.entity_id, new.entity_kind) on conflict do nothing; $$ language 'plpgsql'; comment on function sg_private.follow_own_topic() is 'When I create a topic, I follow the entity.'; create trigger follow_own_topic after insert on sg_public.topic for each row execute procedure sg_private.follow_own_topic(); comment on trigger follow_own_topic on sg_public.topic is 'When I create a topic, I follow the entity.'; create function sg_private.follow_own_post() returns trigger as $$ declare topic sg_public.topic; begin topic := ( select * from sg_public.topic where id = new.topic_id limit 1; ); insert into sg_public.follow (entity_id, entity_kind) values (topic.entity_id, topic.entity_kind) on conflict do nothing; end; $$ language 'plpgsql'; comment on function sg_private.follow_own_post() is 'When I create a post, I follow the entity.'; create trigger follow_own_post after insert on sg_public.post for each row execute procedure sg_private.follow_own_post(); comment on trigger follow_own_post on sg_public.post is 'When I create a post, I follow the entity.';
the_stack
SELECT * FROM pglogical_regress_variables() \gset \c :provider_dsn CREATE TABLE public.test_publicschema(id serial primary key, data text); \c :subscriber_dsn CREATE TABLE public.test_publicschema(data text, id serial primary key); \c :provider_dsn SELECT pglogical.replicate_ddl_command($$ CREATE SCHEMA "strange.schema-IS"; CREATE TABLE public.test_nosync(id serial primary key, data text); CREATE TABLE "strange.schema-IS".test_strangeschema(id serial primary key, "S0m3th1ng" timestamptz DEFAULT '1993-01-01 00:00:00 CET'); CREATE TABLE "strange.schema-IS".test_diff_repset(id serial primary key, data text DEFAULT ''); $$); SELECT pglogical.wait_slot_confirm_lsn(NULL, NULL); -- create some replication sets SELECT * FROM pglogical.create_replication_set('repset_test'); -- move tables to replication set that is not subscribed SELECT * FROM pglogical.replication_set_add_table('repset_test', 'test_publicschema'); SELECT * FROM pglogical.replication_set_add_table('repset_test', 'test_nosync'); SELECT * FROM pglogical.replication_set_add_table('repset_test', '"strange.schema-IS".test_strangeschema'); SELECT * FROM pglogical.replication_set_add_table('repset_test', '"strange.schema-IS".test_diff_repset'); SELECT * FROM pglogical.replication_set_add_all_sequences('repset_test', '{public}'); SELECT * FROM pglogical.replication_set_add_sequence('repset_test', pg_get_serial_sequence('"strange.schema-IS".test_strangeschema', 'id')); SELECT * FROM pglogical.replication_set_add_sequence('repset_test', pg_get_serial_sequence('"strange.schema-IS".test_diff_repset', 'id')); SELECT * FROM pglogical.replication_set_add_all_sequences('default', '{public}'); SELECT * FROM pglogical.replication_set_add_sequence('default', pg_get_serial_sequence('"strange.schema-IS".test_strangeschema', 'id')); SELECT * FROM pglogical.replication_set_add_sequence('default', pg_get_serial_sequence('"strange.schema-IS".test_diff_repset', 'id')); INSERT INTO public.test_publicschema(data) VALUES('a'); INSERT INTO public.test_publicschema(data) VALUES('b'); INSERT INTO public.test_nosync(data) VALUES('a'); INSERT INTO public.test_nosync(data) VALUES('b'); INSERT INTO "strange.schema-IS".test_strangeschema VALUES(DEFAULT, DEFAULT); INSERT INTO "strange.schema-IS".test_strangeschema VALUES(DEFAuLT, DEFAULT); SELECT pglogical.wait_slot_confirm_lsn(NULL, NULL); \c :subscriber_dsn SELECT * FROM public.test_publicschema; \c :provider_dsn -- move tables back to the subscribed replication set SELECT * FROM pglogical.replication_set_add_table('default', 'test_publicschema', true); SELECT * FROM pglogical.replication_set_add_table('default', 'test_nosync', false); SELECT * FROM pglogical.replication_set_add_table('default', '"strange.schema-IS".test_strangeschema', true); \c :subscriber_dsn SET statement_timeout = '20s'; SELECT pglogical.wait_for_table_sync_complete('test_subscription', 'test_publicschema'); SELECT pglogical.wait_for_table_sync_complete('test_subscription', '"strange.schema-IS".test_strangeschema'); RESET statement_timeout; SELECT sync_kind, sync_subid, sync_nspname, sync_relname, sync_status IN ('y', 'r') FROM pglogical.local_sync_status ORDER BY 2,3,4; \c :provider_dsn DO $$ -- give it 10 seconds to synchronize the tables BEGIN FOR i IN 1..100 LOOP IF (SELECT count(1) FROM pg_replication_slots) = 1 THEN RETURN; END IF; PERFORM pg_sleep(0.1); END LOOP; END; $$; SELECT count(1) FROM pg_replication_slots; INSERT INTO public.test_publicschema VALUES(3, 'c'); INSERT INTO public.test_publicschema VALUES(4, 'd'); INSERT INTO "strange.schema-IS".test_strangeschema VALUES(3, DEFAULT); INSERT INTO "strange.schema-IS".test_strangeschema VALUES(4, DEFAULT); SELECT pglogical.synchronize_sequence(c.oid) FROM pg_class c, pg_namespace n WHERE c.relkind = 'S' AND c.relnamespace = n.oid AND n.nspname IN ('public', 'strange.schema-IS'); SELECT pglogical.wait_slot_confirm_lsn(NULL, NULL); \c :subscriber_dsn SELECT * FROM public.test_publicschema; SELECT * FROM "strange.schema-IS".test_strangeschema; SELECT * FROM pglogical.alter_subscription_synchronize('test_subscription'); BEGIN; SET statement_timeout = '20s'; SELECT pglogical.wait_for_table_sync_complete('test_subscription', 'test_nosync'); COMMIT; SELECT sync_kind, sync_subid, sync_nspname, sync_relname, sync_status IN ('y', 'r') FROM pglogical.local_sync_status ORDER BY 2,3,4; SELECT * FROM public.test_nosync; DELETE FROM public.test_publicschema WHERE id > 1; SELECT * FROM public.test_publicschema; SELECT * FROM pglogical.alter_subscription_resynchronize_table('test_subscription', 'test_publicschema'); BEGIN; SET statement_timeout = '20s'; SELECT pglogical.wait_for_table_sync_complete('test_subscription', 'test_publicschema'); COMMIT; SELECT sync_kind, sync_subid, sync_nspname, sync_relname, sync_status IN ('y', 'r') FROM pglogical.local_sync_status ORDER BY 2,3,4; SELECT * FROM public.test_publicschema; \x SELECT nspname, relname, status IN ('synchronized', 'replicating') FROM pglogical.show_subscription_table('test_subscription', 'test_publicschema'); \x BEGIN; SELECT * FROM pglogical.alter_subscription_add_replication_set('test_subscription', 'repset_test'); SELECT * FROM pglogical.alter_subscription_remove_replication_set('test_subscription', 'default'); COMMIT; DO $$ BEGIN FOR i IN 1..100 LOOP IF EXISTS (SELECT 1 FROM pglogical.show_subscription_status() WHERE status = 'replicating') THEN RETURN; END IF; PERFORM pg_sleep(0.1); END LOOP; END; $$; \c :provider_dsn SELECT * FROM pglogical.replication_set_remove_table('repset_test', '"strange.schema-IS".test_strangeschema'); INSERT INTO "strange.schema-IS".test_diff_repset VALUES(1); INSERT INTO "strange.schema-IS".test_diff_repset VALUES(2); INSERT INTO "strange.schema-IS".test_strangeschema VALUES(5, DEFAULT); INSERT INTO "strange.schema-IS".test_strangeschema VALUES(6, DEFAULT); SELECT pglogical.wait_slot_confirm_lsn(NULL, NULL); \c :subscriber_dsn SELECT * FROM "strange.schema-IS".test_diff_repset; SELECT * FROM "strange.schema-IS".test_strangeschema; \c :provider_dsn SELECT * FROM pglogical.alter_replication_set('repset_test', replicate_insert := false, replicate_update := false, replicate_delete := false, replicate_truncate := false); INSERT INTO "strange.schema-IS".test_diff_repset VALUES(3); INSERT INTO "strange.schema-IS".test_diff_repset VALUES(4); UPDATE "strange.schema-IS".test_diff_repset SET data = 'data'; DELETE FROM "strange.schema-IS".test_diff_repset WHERE id < 3; TRUNCATE "strange.schema-IS".test_diff_repset; SELECT pglogical.wait_slot_confirm_lsn(NULL, NULL); \c :subscriber_dsn SELECT * FROM "strange.schema-IS".test_diff_repset; \c :provider_dsn SELECT * FROM pglogical.alter_replication_set('repset_test', replicate_insert := true, replicate_truncate := true); INSERT INTO "strange.schema-IS".test_diff_repset VALUES(5); INSERT INTO "strange.schema-IS".test_diff_repset VALUES(6); SELECT pglogical.wait_slot_confirm_lsn(NULL, NULL); \c :subscriber_dsn SELECT * FROM "strange.schema-IS".test_diff_repset; \c :provider_dsn TRUNCATE "strange.schema-IS".test_diff_repset; SELECT pglogical.wait_slot_confirm_lsn(NULL, NULL); \c :subscriber_dsn SELECT * FROM "strange.schema-IS".test_diff_repset; SELECT * FROM pglogical.alter_subscription_add_replication_set('test_subscription', 'default'); DO $$ BEGIN FOR i IN 1..100 LOOP IF EXISTS (SELECT 1 FROM pglogical.show_subscription_status() WHERE status = 'replicating') THEN RETURN; END IF; PERFORM pg_sleep(0.1); END LOOP; END; $$; SELECT N.nspname AS schemaname, C.relname AS tablename, (nextval(C.oid) > 1000) as synced FROM pg_class C JOIN pg_namespace N ON (N.oid = C.relnamespace) WHERE C.relkind = 'S' AND N.nspname IN ('public', 'strange.schema-IS') ORDER BY 1, 2; \c :provider_dsn DO $$ BEGIN FOR i IN 1..100 LOOP IF EXISTS (SELECT 1 FROM pg_stat_replication) THEN RETURN; END IF; PERFORM pg_sleep(0.1); END LOOP; END; $$; \set VERBOSITY terse SELECT pglogical.replicate_ddl_command($$ DROP TABLE public.test_publicschema CASCADE; DROP TABLE public.test_nosync CASCADE; DROP SCHEMA "strange.schema-IS" CASCADE; $$); SELECT pglogical.replicate_ddl_command($$ CREATE TABLE public.synctest(a int primary key, b text); $$); SELECT * FROM pglogical.replication_set_add_table('repset_test', 'synctest', synchronize_data := false); INSERT INTO synctest VALUES (1, '1'); -- no way to see if this worked currently, but if one can manually check -- if there is conflict in log or not (conflict = bad here) SELECT pglogical.replicate_ddl_command($$ SELECT pg_sleep(5); UPDATE public.synctest SET b = md5(a::text); $$); INSERT INTO synctest VALUES (2, '2'); \c :subscriber_dsn SELECT * FROM pglogical.alter_subscription_resynchronize_table('test_subscription', 'synctest'); BEGIN; SET statement_timeout = '20s'; SELECT pglogical.wait_for_table_sync_complete('test_subscription', 'synctest'); COMMIT; \c :provider_dsn SELECT pglogical.wait_slot_confirm_lsn(NULL, NULL); SELECT * FROM synctest; \c :subscriber_dsn SELECT * FROM synctest; \c :provider_dsn \set VERBOSITY terse SELECT pglogical.replicate_ddl_command($$ DROP TABLE public.synctest CASCADE; $$); \c :subscriber_dsn -- this is to reorder repsets to default order BEGIN; SELECT * FROM pglogical.alter_subscription_remove_replication_set('test_subscription', 'default'); SELECT * FROM pglogical.alter_subscription_remove_replication_set('test_subscription', 'ddl_sql'); SELECT * FROM pglogical.alter_subscription_remove_replication_set('test_subscription', 'default_insert_only'); SELECT * FROM pglogical.alter_subscription_remove_replication_set('test_subscription', 'repset_test'); SELECT * FROM pglogical.alter_subscription_add_replication_set('test_subscription', 'default'); SELECT * FROM pglogical.alter_subscription_add_replication_set('test_subscription', 'default_insert_only'); SELECT * FROM pglogical.alter_subscription_add_replication_set('test_subscription', 'ddl_sql'); COMMIT;
the_stack
LOAD 'pg_hint_plan'; SET pg_hint_plan.enable_hint TO on; SET pg_hint_plan.debug_print TO on; SET client_min_messages TO LOG; SET search_path TO public; SET max_parallel_workers_per_gather TO 0; EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; ---- ---- No. J-1-1 specified pattern of the object name ---- -- No. J-1-1-1 /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-1-1-2 /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1; -- No. J-1-1-3 /*+HashJoin(t_1 t_2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1; ---- ---- No. J-1-2 specified schema name in the hint option ---- -- No. J-1-2-1 /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-1-2-2 /*+HashJoin(s1.t1 s1.t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; ---- ---- No. J-1-3 table doesn't exist in the hint option ---- -- No. J-1-3-1 /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-1-3-2 /*+HashJoin(t3 t4)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; ---- ---- No. J-1-4 conflict table name ---- -- No. J-1-4-1 /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-1-4-2 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1; /*+HashJoin(t1 t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1; /*+HashJoin(s1.t1 s2.t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1; EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1; /*+HashJoin(t1 s2t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1; -- No. J-1-4-3 EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+NestLoop(st1 st2)HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT *, (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; ---- ---- No. J-1-5 conflict table name ---- -- No. J-1-5-1 /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-1-5-2 /*+HashJoin(t1 t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-1-5-3 /*+HashJoin(t1 t1)HashJoin(t2 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1; /*+HashJoin(t1 t2 t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1; ---- ---- No. J-1-6 object type for the hint ---- -- No. J-1-6-1 /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-1-6-2 EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1; /*+NestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1; -- No. J-1-6-3 EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1; /*+NestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1; -- No. J-1-6-4 CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL); EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1; /*+NestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1; -- No. J-1-6-5 EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid; /*+NestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid; -- No. J-1-6-6 -- refer ut-fdw.sql -- No. J-1-6-7 EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1; /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1; -- No. J-1-6-8 EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1; /*+NestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1; /*+NestLoop(*VALUES* t2)*/ EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1; -- No. J-1-6-9 EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1; /*+NestLoop(t1 t2)HashJoin(t1 c1)*/ EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1; -- No. J-1-6-10 EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1; /*+NestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1; /*+NestLoop(v1t1 v1t1_)*/ EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2 WHERE t1.c1 = t2.c1; -- No. J-1-6-11 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1); \o results/ut-J.tmpout /*+MergeJoin(t1 t2)NestLoop(st1 st2)*/ EXPLAIN (COSTS true) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1); \o \! sql/maskout.sh results/ut-J.tmpout -- -- There are cases where difference in the measured value and predicted value -- depending upon the version of PostgreSQL -- EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1; /*+HashJoin(t1 st2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1; /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1; ---- ---- No. J-2-1 some complexity query blocks ---- -- No. J-2-1-1 EXPLAIN (COSTS false) SELECT max(bmt1.c1), ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' ; /*+ Leading(bmt1 bmt2 bmt3 bmt4) Leading(b1t2 b1t3 b1t4 b1t1) Leading(b2t3 b2t4 b2t1 b2t2) MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4) MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1) MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1), ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' ; -- No. J-2-1-2 EXPLAIN (COSTS false) SELECT max(bmt1.c1), ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ), ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' ; /*+ Leading(bmt1 bmt2 bmt3 bmt4) Leading(b1t2 b1t3 b1t4 b1t1) Leading(b2t3 b2t4 b2t1 b2t2) Leading(b3t4 b3t1 b3t2 b3t3) MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4) MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1) MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2) MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1), ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ), ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' ; -- No. J-2-1-3 EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)'; /*+ Leading(bmt4 bmt3 bmt2 bmt1) MergeJoin(bmt4 bmt3)HashJoin(bmt4 bmt3 bmt2)NestLoop(bmt1 bmt2 bmt3 bmt4) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)'; -- No. J-2-1-4 EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)'; /*+ Leading(bmt4 bmt3 bmt2 bmt1) MergeJoin(bmt4 bmt3)HashJoin(bmt4 bmt3 bmt2)NestLoop(bmt1 bmt2 bmt3 bmt4) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)'; -- No. J-2-1-5 EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 <> ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) AND bmt1.c1 <> ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) ; /*+ Leading(bmt1 bmt2 bmt3 bmt4) Leading(b1t2 b1t3 b1t4 b1t1) Leading(b2t3 b2t4 b2t1 b2t2) MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4) MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1) MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 <> ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) AND bmt1.c1 <> ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) ; -- No. J-2-1-6 EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 <> ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) AND bmt1.c1 <> ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)' ) ; /*+ Leading(bmt1 bmt2 bmt3 bmt4) Leading(b1t2 b1t3 b1t4 b1t1) Leading(b2t3 b2t4 b2t1 b2t2) Leading(b3t4 b3t1 b3t2 b3t3) MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4) MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1) MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2) MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 <> ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) AND bmt1.c1 <> ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)' ) ; -- No. J-2-1-7 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) , c2 (c1) AS ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 , c1, c2 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 = c2.c1 ; /*+ Leading(c2 c1 bmt1 bmt2 bmt3 bmt4) Leading(b1t2 b1t3 b1t4 b1t1) Leading(b2t3 b2t4 b2t1 b2t2) MergeJoin(c2 c1)HashJoin(c2 c1 bmt1)NestLoop(c2 c1 bmt1 bmt2)MergeJoin(c2 c1 bmt1 bmt2 bmt3)HashJoin(c2 c1 bmt1 bmt2 bmt3 bmt4) MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1) MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) , c2 (c1) AS ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 , c1, c2 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 = c2.c1 ; -- No. J-2-1-8 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) , c2 (c1) AS ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) , c3 (c1) AS ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)' ) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 , c1, c2, c3 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 = c2.c1 AND bmt1.c1 = c3.c1 ; /*+ Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4) Leading(b1t2 b1t3 b1t4 b1t1) Leading(b2t3 b2t4 b2t1 b2t2) Leading(b3t4 b3t1 b3t2 b3t3) MergeJoin(c3 c2)HashJoin(c3 c2 c1)NestLoop(c3 c2 c1 bmt1)MergeJoin(c3 c2 c1 bmt1 bmt2)HashJoin(c3 c2 c1 bmt1 bmt2 bmt3)NestLoop(c3 c2 c1 bmt1 bmt2 bmt3 bmt4) MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1) MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2) MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) , c2 (c1) AS ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) , c3 (c1) AS ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)' ) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 , c1, c2, c3 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 = c2.c1 AND bmt1.c1 = c3.c1 ; ---- ---- No. J-2-2 the number of the tables per quiry block ---- -- No. J-2-2-1 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1 ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1 ) FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1 AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1 ) ; /*+ Leading(c1 bmt1) HashJoin(bmt1 c1) HashJoin(b1t1 c1) HashJoin(b2t1 c1) HashJoin(b3t1 c1) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1 ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1 ) FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1 AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1 ) ; -- No. J-2-2-2 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' ) ; /*+ Leading(c1 bmt2 bmt1) Leading(b1t2 b1t1) Leading(b2t2 b2t1) Leading(b3t2 b3t1) MergeJoin(c1 bmt2) HashJoin(c1 bmt1 bmt2) MergeJoin(b1t1 b1t2) MergeJoin(b2t1 b2t2) MergeJoin(b3t1 b3t2) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' ) ; -- No. J-2-2-3 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)' ) ; /*+ Leading(c1 bmt4 bmt3 bmt2 bmt1) Leading(b1t4 b1t3 b1t2 b1t1) Leading(b2t4 b2t3 b2t2 b2t1) Leading(b3t4 b3t3 b3t2 b3t1) MergeJoin(c1 bmt4) HashJoin(c1 bmt4 bmt3) NestLoop(c1 bmt4 bmt3 bmt2) MergeJoin(c1 bmt4 bmt3 bmt2 bmt1) HashJoin(b1t4 b1t3) NestLoop(b1t4 b1t3 b1t2) MergeJoin(b1t4 b1t3 b1t2 b1t1) HashJoin(b2t4 b2t3) NestLoop(b2t4 b2t3 b2t2) MergeJoin(b2t4 b2t3 b2t2 b2t1) HashJoin(b3t4 b3t3) NestLoop(b3t4 b3t3 b3t2) MergeJoin(b3t4 b3t3 b3t2 b3t1) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)' ) ; -- No. J-2-2-4 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1 ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' ) ; /*+ Leading(c1 bmt4 bmt3 bmt2 bmt1) Leading(b1t4 b1t3 b1t2 b1t1) MergeJoin(c1 bmt4) HashJoin(c1 bmt4 bmt3) NestLoop(c1 bmt4 bmt3 bmt2) MergeJoin(c1 bmt4 bmt3 bmt2 bmt1) MergeJoin(b1t4 b1t3) HashJoin(b1t4 b1t3 b1t2) NestLoop(b1t4 b1t3 b1t2 b1t1) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1 ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' ) ; ---- ---- No. J-2-3 RULE or VIEW ---- -- No. J-2-3-1 EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+ Leading(t4 t3 t2 t1 r1) MergeJoin(t4 t3 t2 t1 r1) HashJoin(t4 t3 t2 t1) NestLoop(t4 t3 t2) MergeJoin(t4 t3) */ EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+ Leading(b1t4 b1t3 b1t2 b1t1 r1_) MergeJoin(b1t4 b1t3 b1t2 b1t1 r1_) HashJoin(b1t4 b1t3 b1t2 b1t1) NestLoop(b1t4 b1t3 b1t2) MergeJoin(b1t4 b1t3) */ EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. J-2-3-2 EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+ Leading(t4 t3 t2 t1 r2) MergeJoin(t4 t3 t2 t1 r2) HashJoin(t4 t3 t2 t1) NestLoop(t4 t3 t2) MergeJoin(t4 t3) */ EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+ Leading(b1t1 b1t2 b1t3 b1t4 r2_) Leading(b2t1 b2t2 b2t3 b2t4 r2_) MergeJoin(b1t1 b1t2) HashJoin(b1t1 b1t2 b1t3) NestLoop(b1t1 b1t2 b1t3 b1t4) MergeJoin(b1t1 b1t2 b1t3 b1t4 r2_) MergeJoin(b2t1 b2t2) HashJoin(b2t1 b2t2 b2t3) NestLoop(b2t1 b2t2 b2t3 b2t4) MergeJoin(b2t1 b2t2 b2t3 b2t4 r2_) */ EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. J-2-3-3 EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+ Leading(t4 t3 t2 t1 r3) MergeJoin(t4 t3 t2 t1 r3) HashJoin(t4 t3 t2 t1) NestLoop(t4 t3 t2) MergeJoin(t4 t3) */ EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+ Leading(b1t1 b1t2 b1t3 b1t4 r3_) Leading(b2t1 b2t2 b2t3 b2t4 r3_) Leading(b3t1 b3t2 b3t3 b3t4 r3_) MergeJoin(b1t1 b1t2) HashJoin(b1t1 b1t2 b1t3) NestLoop(b1t1 b1t2 b1t3 b1t4) MergeJoin(b1t1 b1t2 b1t3 b1t4 r3_) MergeJoin(b2t1 b2t2) HashJoin(b2t1 b2t2 b2t3) NestLoop(b2t1 b2t2 b2t3 b2t4) MergeJoin(b2t1 b2t2 b2t3 b2t4 r3_) MergeJoin(b3t1 b3t2) HashJoin(b3t1 b3t2 b3t3) NestLoop(b3t1 b3t2 b3t3 b3t4) MergeJoin(b3t1 b3t2 b3t3 b3t4 r3_) */ EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. J-2-3-4 EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1; /*+HashJoin(v1t1 v1t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1; -- No. J-2-3-5 EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1; /*+NestLoop(v1t1 v1t1_)*/ EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1; -- No. J-2-3-6 EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1; /*+HashJoin(r4t1 r4t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1; -- No. J-2-3-7 EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1; /*+NestLoop(r4t1 r5t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1; ---- ---- No. J-2-4 VALUES clause ---- -- No. J-2-4-1 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1; /*+ Leading(t3 t1 t2) HashJoin(t3 t1)NestLoop(t3 t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1; /*+ Leading(*VALUES* t1 t2) HashJoin(*VALUES* t1)NestLoop(*VALUES* t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1; -- No. J-2-4-2 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1; /*+ Leading(t4 t3 t2 t1) NestLoop(t4 t3)HashJoin(t4 t3 t2)MergeJoin(t4 t3 t2 t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1; /*+ Leading(*VALUES* t3 t2 t1) NestLoop(t4 t3)HashJoin(*VALUES* t3 t2)MergeJoin(*VALUES* t3 t2 t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1; ---- ---- No. J-3-1 join method hint ---- -- No. J-3-1-1~6 SET enable_nestloop TO on; SET enable_mergejoin TO off; SET enable_hashjoin TO off; EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+NestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+MergeJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; SET enable_mergejoin TO on; EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';; /*+NoNestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';; SET enable_mergejoin TO off; /*+NoHashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+NoMergeJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-3-1-7~12 SET enable_nestloop TO off; SET enable_mergejoin TO off; SET enable_hashjoin TO on; EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+NestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+MergeJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+NoNestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+NoHashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+NoMergeJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-3-1-13~18 SET enable_nestloop TO off; SET enable_mergejoin TO on; SET enable_hashjoin TO off; EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+NestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+HashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+MergeJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+NoNestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+NoHashJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; /*+NoMergeJoin(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; SET enable_nestloop TO on; SET enable_mergejoin TO on; SET enable_hashjoin TO on; ---- ---- No. J-3-2 join inherit tables ---- EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1; -- No. J-3-2-1 /*+MergeJoin(p1 p2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1; -- No. J-3-2-2 /*+MergeJoin(p1c1 p2c1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1; ---- ---- No. J-3-2-2 join partitioned tables ---- EXPLAIN (COSTS false) SELECT * FROM s1.pt1, s1.p2 WHERE pt1.c1 = p2.c1; /*+MergeJoin(pt1 p2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.pt1, s1.p2 WHERE pt1.c1 = p2.c1; /*+MergeJoin(pt1_c1 p2c1)*/ /* will ignored */ EXPLAIN (COSTS false) SELECT * FROM s1.pt1, s1.p2 WHERE pt1.c1 = p2.c1; ---- ---- No. J-3-3 conflict join method hint ---- EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-3-3-1 /*+HashJoin(t1 t2)NestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-3-3-2 /*+MergeJoin(t1 t2)HashJoin(t1 t2)NestLoop(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-3-3-3 /*+HashJoin(t1 t2)NestLoop(t2 t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; -- No. J-3-3-4 /*+MergeJoin(t2 t1)HashJoin(t1 t2)NestLoop(t2 t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1; ---- ---- No. J-3-4 hint state output ---- -- No. J-3-4-1 /*+NestLoop(t1 t2)*/ SELECT * FROM s1.t1, s1.t2 WHERE false; -- No. J-3-4-2 /*+HashJoin(t1 t2)*/ SELECT * FROM s1.t1, s1.t2 WHERE false; -- No. J-3-4-3 /*+MergeJoin(t1 t2)*/ SELECT * FROM s1.t1, s1.t2 WHERE false; -- No. J-3-4-4 /*+NoNestLoop(t1 t2)*/ SELECT * FROM s1.t1, s1.t2 WHERE false; -- No. J-3-4-5 /*+NoHashJoin(t1 t2)*/ SELECT * FROM s1.t1, s1.t2 WHERE false; -- No. J-3-4-6 /*+NoMergeJoin(t1 t2)*/ SELECT * FROM s1.t1, s1.t2 WHERE false; -- No. J-3-4-7 /*+NestLoop()*/ SELECT * FROM s1.t1 WHERE false; -- No. J-3-4-8 /*+NestLoop(t1)*/ SELECT * FROM s1.t1 WHERE false; -- No. J-3-4-9 /*+NestLoop(t1 t2)*/ SELECT * FROM s1.t1, s1.t2 WHERE false; -- No. J-3-4-10 /*+NestLoop(t1 t2 t3)*/ SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE false; ---- ---- No. J-3-5 not used hint ---- -- No. J-3-5-1 EXPLAIN (COSTS false) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c1); \o results/ut-J.tmpout /*+NestLoop(t1 t2)*/ EXPLAIN (COSTS true) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c1); \o \! sql/maskout.sh results/ut-J.tmpout \! rm results/ut-J.tmpout -- Memoize EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.val = t2.val and t2.id = t3.id; /*+ nomemoize(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.val = t2.val and t2.id = t3.id; -- doesn't work /*+ nomemoize(t1 t2 t3)*/ EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.val = t2.val and t2.id = t3.id;
the_stack
SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for auth_group -- ---------------------------- DROP TABLE IF EXISTS `auth_group`; CREATE TABLE `auth_group` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(150) COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- -- Records of auth_group -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for auth_group_permissions -- ---------------------------- DROP TABLE IF EXISTS `auth_group_permissions`; CREATE TABLE `auth_group_permissions` ( `id` int(11) NOT NULL AUTO_INCREMENT, `group_id` int(11) NOT NULL, `permission_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `auth_group_permissions_group_id_permission_id_0cd325b0_uniq` (`group_id`,`permission_id`), KEY `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` (`permission_id`), CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- -- Records of auth_group_permissions -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for auth_permission -- ---------------------------- DROP TABLE IF EXISTS `auth_permission`; CREATE TABLE `auth_permission` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL, `content_type_id` int(11) NOT NULL, `codename` varchar(100) COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `auth_permission_content_type_id_codename_01ab375a_uniq` (`content_type_id`,`codename`), CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- -- Records of auth_permission -- ---------------------------- BEGIN; INSERT INTO `auth_permission` VALUES (1, 'Can add permission', 1, 'add_permission'); INSERT INTO `auth_permission` VALUES (2, 'Can change permission', 1, 'change_permission'); INSERT INTO `auth_permission` VALUES (3, 'Can delete permission', 1, 'delete_permission'); INSERT INTO `auth_permission` VALUES (4, 'Can view permission', 1, 'view_permission'); INSERT INTO `auth_permission` VALUES (5, 'Can add group', 2, 'add_group'); INSERT INTO `auth_permission` VALUES (6, 'Can change group', 2, 'change_group'); INSERT INTO `auth_permission` VALUES (7, 'Can delete group', 2, 'delete_group'); INSERT INTO `auth_permission` VALUES (8, 'Can view group', 2, 'view_group'); INSERT INTO `auth_permission` VALUES (9, 'Can add content type', 3, 'add_contenttype'); INSERT INTO `auth_permission` VALUES (10, 'Can change content type', 3, 'change_contenttype'); INSERT INTO `auth_permission` VALUES (11, 'Can delete content type', 3, 'delete_contenttype'); INSERT INTO `auth_permission` VALUES (12, 'Can view content type', 3, 'view_contenttype'); INSERT INTO `auth_permission` VALUES (13, 'Can add session', 4, 'add_session'); INSERT INTO `auth_permission` VALUES (14, 'Can change session', 4, 'change_session'); INSERT INTO `auth_permission` VALUES (15, 'Can delete session', 4, 'delete_session'); INSERT INTO `auth_permission` VALUES (16, 'Can view session', 4, 'view_session'); INSERT INTO `auth_permission` VALUES (17, 'Can add 用户信息', 5, 'add_userprofile'); INSERT INTO `auth_permission` VALUES (18, 'Can change 用户信息', 5, 'change_userprofile'); INSERT INTO `auth_permission` VALUES (19, 'Can delete 用户信息', 5, 'delete_userprofile'); INSERT INTO `auth_permission` VALUES (20, 'Can view 用户信息', 5, 'view_userprofile'); INSERT INTO `auth_permission` VALUES (21, 'Can add 关键词word2vec', 6, 'add_keyword2vec'); INSERT INTO `auth_permission` VALUES (22, 'Can change 关键词word2vec', 6, 'change_keyword2vec'); INSERT INTO `auth_permission` VALUES (23, 'Can delete 关键词word2vec', 6, 'delete_keyword2vec'); INSERT INTO `auth_permission` VALUES (24, 'Can view 关键词word2vec', 6, 'view_keyword2vec'); COMMIT; -- ---------------------------- -- Table structure for django_content_type -- ---------------------------- DROP TABLE IF EXISTS `django_content_type`; CREATE TABLE `django_content_type` ( `id` int(11) NOT NULL AUTO_INCREMENT, `app_label` varchar(100) COLLATE utf8mb4_general_ci NOT NULL, `model` varchar(100) COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `django_content_type_app_label_model_76bd3d3b_uniq` (`app_label`,`model`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- -- Records of django_content_type -- ---------------------------- BEGIN; INSERT INTO `django_content_type` VALUES (2, 'auth', 'group'); INSERT INTO `django_content_type` VALUES (1, 'auth', 'permission'); INSERT INTO `django_content_type` VALUES (3, 'contenttypes', 'contenttype'); INSERT INTO `django_content_type` VALUES (4, 'sessions', 'session'); INSERT INTO `django_content_type` VALUES (6, 'user', 'keyword2vec'); INSERT INTO `django_content_type` VALUES (5, 'user', 'userprofile'); COMMIT; -- ---------------------------- -- Table structure for django_migrations -- ---------------------------- DROP TABLE IF EXISTS `django_migrations`; CREATE TABLE `django_migrations` ( `id` int(11) NOT NULL AUTO_INCREMENT, `app` varchar(255) COLLATE utf8mb4_general_ci NOT NULL, `name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL, `applied` datetime(6) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- -- Records of django_migrations -- ---------------------------- BEGIN; INSERT INTO `django_migrations` VALUES (1, 'contenttypes', '0001_initial', '2020-10-09 11:28:52.168164'); INSERT INTO `django_migrations` VALUES (2, 'contenttypes', '0002_remove_content_type_name', '2020-10-09 11:28:52.193721'); INSERT INTO `django_migrations` VALUES (3, 'auth', '0001_initial', '2020-10-09 11:28:52.224033'); INSERT INTO `django_migrations` VALUES (4, 'auth', '0002_alter_permission_name_max_length', '2020-10-09 11:28:52.286536'); INSERT INTO `django_migrations` VALUES (5, 'auth', '0003_alter_user_email_max_length', '2020-10-09 11:28:52.290729'); INSERT INTO `django_migrations` VALUES (6, 'auth', '0004_alter_user_username_opts', '2020-10-09 11:28:52.295986'); INSERT INTO `django_migrations` VALUES (7, 'auth', '0005_alter_user_last_login_null', '2020-10-09 11:28:52.300359'); INSERT INTO `django_migrations` VALUES (8, 'auth', '0006_require_contenttypes_0002', '2020-10-09 11:28:52.301588'); INSERT INTO `django_migrations` VALUES (9, 'auth', '0007_alter_validators_add_error_messages', '2020-10-09 11:28:52.305658'); INSERT INTO `django_migrations` VALUES (10, 'auth', '0008_alter_user_username_max_length', '2020-10-09 11:28:52.310277'); INSERT INTO `django_migrations` VALUES (11, 'auth', '0009_alter_user_last_name_max_length', '2020-10-09 11:28:52.314661'); INSERT INTO `django_migrations` VALUES (12, 'auth', '0010_alter_group_name_max_length', '2020-10-09 11:28:52.322570'); INSERT INTO `django_migrations` VALUES (13, 'auth', '0011_update_proxy_permissions', '2020-10-09 11:28:52.327047'); INSERT INTO `django_migrations` VALUES (14, 'auth', '0012_alter_user_first_name_max_length', '2020-10-09 11:28:52.331585'); INSERT INTO `django_migrations` VALUES (15, 'sessions', '0001_initial', '2020-10-09 11:28:52.340615'); INSERT INTO `django_migrations` VALUES (16, 'user', '0001_initial', '2020-10-09 11:28:52.388988'); INSERT INTO `django_migrations` VALUES (17, 'user', '0002_auto_20190408_1440', '2020-10-09 11:28:52.612008'); INSERT INTO `django_migrations` VALUES (18, 'user', '0003_auto_20190408_1441', '2020-10-09 11:28:52.616821'); INSERT INTO `django_migrations` VALUES (19, 'user', '0004_auto_20190408_1444', '2020-10-09 11:28:52.631422'); INSERT INTO `django_migrations` VALUES (20, 'user', '0005_auto_20201009_1128', '2020-10-09 11:28:52.652815'); COMMIT; -- ---------------------------- -- Table structure for django_session -- ---------------------------- DROP TABLE IF EXISTS `django_session`; CREATE TABLE `django_session` ( `session_key` varchar(40) COLLATE utf8mb4_general_ci NOT NULL, `session_data` longtext COLLATE utf8mb4_general_ci NOT NULL, `expire_date` datetime(6) NOT NULL, PRIMARY KEY (`session_key`), KEY `django_session_expire_date_a5c62663` (`expire_date`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- -- Records of django_session -- ---------------------------- BEGIN; INSERT INTO `django_session` VALUES ('pmeeqwno92kppesvqj9gyglat89j7j1i', '.eJxVjEEOwiAQRe_C2pACQwGX7j0DGZhBqoYmpV0Z765NutDtf-_9l4i4rTVunZc4kTgLJU6_W8L84LYDumO7zTLPbV2mJHdFHrTL60z8vBzu30HFXr-1ZwdWD4kNICNTMbYoKsUwBC7OjwMlFUYk1AkMZM1KW8wIPkDh7MT7Awo8OPQ:1kQr17:KK5gZrygr6BTpsCwiHHNoC9IFGwe0wdmQ0J71cvQlhU', '2020-10-23 11:56:57.418092'); COMMIT; -- ---------------------------- -- Table structure for user_keyword2vec -- ---------------------------- DROP TABLE IF EXISTS `user_keyword2vec`; CREATE TABLE `user_keyword2vec` ( `id` int(11) NOT NULL AUTO_INCREMENT, `keyword` varchar(128) COLLATE utf8mb4_general_ci NOT NULL, `keyword_word2vec` varchar(256) COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- -- Records of user_keyword2vec -- ---------------------------- BEGIN; INSERT INTO `user_keyword2vec` VALUES (1, '老公', '过,妈妈,发现,丑,讲'); COMMIT; -- ---------------------------- -- Table structure for user_userprofile -- ---------------------------- DROP TABLE IF EXISTS `user_userprofile`; CREATE TABLE `user_userprofile` ( `id` int(11) NOT NULL AUTO_INCREMENT, `password` varchar(128) COLLATE utf8mb4_general_ci NOT NULL, `last_login` datetime(6) DEFAULT NULL, `is_superuser` tinyint(1) NOT NULL, `username` varchar(150) COLLATE utf8mb4_general_ci NOT NULL, `first_name` varchar(150) COLLATE utf8mb4_general_ci NOT NULL, `last_name` varchar(150) COLLATE utf8mb4_general_ci NOT NULL, `email` varchar(254) COLLATE utf8mb4_general_ci NOT NULL, `is_staff` tinyint(1) NOT NULL, `is_active` tinyint(1) NOT NULL, `date_joined` datetime(6) NOT NULL, `history` varchar(128) COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- -- Records of user_userprofile -- ---------------------------- BEGIN; INSERT INTO `user_userprofile` VALUES (1, 'pbkdf2_sha256$216000$A1lGhuOOsxRn$71PJYSoFW6dtnwxPi8rLfM8Nzeki48zz4J+x3y77fps=', '2020-10-09 11:56:57.416118', 0, '1147727180@qq.com', '', '', '1147727180@qq.com', 0, 1, '2020-10-09 11:56:51.609500', ',老公,如何看待华为 HR 胡玲于 2019-10-30 在华为内部论坛心声社,Apple,如何看待 2019 年 12 月 17 日我国第一艘国产航母「山东舰」'); COMMIT; -- ---------------------------- -- Table structure for user_userprofile_groups -- ---------------------------- DROP TABLE IF EXISTS `user_userprofile_groups`; CREATE TABLE `user_userprofile_groups` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userprofile_id` int(11) NOT NULL, `group_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `user_userprofile_groups_userprofile_id_group_id_52847a61_uniq` (`userprofile_id`,`group_id`), KEY `user_userprofile_groups_group_id_98cc4038_fk_auth_group_id` (`group_id`), CONSTRAINT `user_userprofile_gro_userprofile_id_49724c40_fk_user_user` FOREIGN KEY (`userprofile_id`) REFERENCES `user_userprofile` (`id`), CONSTRAINT `user_userprofile_groups_group_id_98cc4038_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- -- Records of user_userprofile_groups -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for user_userprofile_user_permissions -- ---------------------------- DROP TABLE IF EXISTS `user_userprofile_user_permissions`; CREATE TABLE `user_userprofile_user_permissions` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userprofile_id` int(11) NOT NULL, `permission_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `user_userprofile_user_pe_userprofile_id_permissio_2e86ceca_uniq` (`userprofile_id`,`permission_id`), KEY `user_userprofile_use_permission_id_7f559b23_fk_auth_perm` (`permission_id`), CONSTRAINT `user_userprofile_use_permission_id_7f559b23_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), CONSTRAINT `user_userprofile_use_userprofile_id_68dc814c_fk_user_user` FOREIGN KEY (`userprofile_id`) REFERENCES `user_userprofile` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- -- Records of user_userprofile_user_permissions -- ---------------------------- BEGIN; COMMIT; SET FOREIGN_KEY_CHECKS = 1;
the_stack
BEGIN TRANSACTION; -- -- Extension: Platformus.Core -- Version: 2.5.0 -- INSERT INTO public."Users" ("Id","Name","Created") VALUES (1,'Administrator','2017-01-01 00:00:00.000000'); ALTER SEQUENCE "Users_Id_seq" RESTART WITH 2; INSERT INTO public."CredentialTypes" ("Id","Code","Name","Position") VALUES (1,'Email','Email',1); ALTER SEQUENCE "CredentialTypes_Id_seq" RESTART WITH 2; INSERT INTO public."Credentials" ("Id","UserId","CredentialTypeId","Identifier","Secret","Extra") VALUES (1,1,1,'admin@platformus.net','8lE3xN2Ijiv/Y/aIGwaZLrbcqrt/1jDmzPTdudKbVD0=','0O/ZGwhScZRGbsmiUEckOg=='); ALTER SEQUENCE "Credentials_Id_seq" RESTART WITH 2; INSERT INTO public."Roles" ("Id","Code","Name","Position") VALUES (1,'Developer','Developer',100); INSERT INTO public."Roles" ("Id","Code","Name","Position") VALUES (2,'Administrator','Administrator',200); INSERT INTO public."Roles" ("Id","Code","Name","Position") VALUES (3,'ContentManager','Content manager',300); ALTER SEQUENCE "Roles_Id_seq" RESTART WITH 4; INSERT INTO public."UserRoles" ("UserId","RoleId") VALUES (1,1); INSERT INTO public."UserRoles" ("UserId","RoleId") VALUES (1,2); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (1,'DoAnything','Do anything',100); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (2,'ManagePermissions','Manage permissions',200); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (3,'ManageRoles','Manage roles',300); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (4,'ManageUsers','Manage users',400); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (5,'ManageConfigurations','Manage configurations',500); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (6,'ManageCultures','Manage cultures',600); ALTER SEQUENCE "Permissions_Id_seq" RESTART WITH 27; INSERT INTO public."RolePermissions" ("RoleId","PermissionId") VALUES (1,1); INSERT INTO public."RolePermissions" ("RoleId","PermissionId") VALUES (2,1); INSERT INTO public."Configurations" ("Id","Code","Name") VALUES (1,'Email','Email'); INSERT INTO public."Configurations" ("Id","Code","Name") VALUES (2,'Globalization','Globalization'); ALTER SEQUENCE "Configurations_Id_seq" RESTART WITH 3; INSERT INTO public."Variables" ("Id","ConfigurationId","Code","Name","Value","Position") VALUES (1,1,'SmtpServer','SMTP server','test',1); INSERT INTO public."Variables" ("Id","ConfigurationId","Code","Name","Value","Position") VALUES (2,1,'SmtpPort','SMTP port','25',2); INSERT INTO public."Variables" ("Id","ConfigurationId","Code","Name","Value","Position") VALUES (3,1,'SmtpUseSsl','SMTP use SSL','no',3); INSERT INTO public."Variables" ("Id","ConfigurationId","Code","Name","Value","Position") VALUES (4,1,'SmtpLogin','SMTP login','test',4); INSERT INTO public."Variables" ("Id","ConfigurationId","Code","Name","Value","Position") VALUES (5,1,'SmtpPassword','SMTP password','test',5); INSERT INTO public."Variables" ("Id","ConfigurationId","Code","Name","Value","Position") VALUES (6,1,'SmtpSenderEmail','SMTP sender email','test',6); INSERT INTO public."Variables" ("Id","ConfigurationId","Code","Name","Value","Position") VALUES (7,1,'SmtpSenderName','SMTP sender name','test',7); INSERT INTO public."Variables" ("Id","ConfigurationId","Code","Name","Value","Position") VALUES (8,2,'SpecifyCultureInUrl','Specify culture in URL','yes',1); ALTER SEQUENCE "Variables_Id_seq" RESTART WITH 8; INSERT INTO public."Cultures" ("Id","Name","IsNeutral","IsFrontendDefault","IsBackendDefault") VALUES ('__','Neutral',TRUE,FALSE,FALSE); INSERT INTO public."Cultures" ("Id","Name","IsNeutral","IsFrontendDefault","IsBackendDefault") VALUES ('en','English',FALSE,TRUE,TRUE); -- -- Extension: Platformus.Website -- Version: 2.5.0 -- INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (7,'ManageEndpoints','Manage endpoints',700); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (8,'ManageObjects','Manage objects',800); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (9,'ManageDataTypes','Manage data types',900); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (10,'ManageClasses','Manage classes',1000); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (11,'ManageMenus','Manage menus',1100); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (12,'ManageForms','Manage forms',1200); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (13,'ManageFileManager','Manage file manager',1300); INSERT INTO public."RolePermissions" ("RoleId","PermissionId") VALUES (3,8); INSERT INTO public."RolePermissions" ("RoleId","PermissionId") VALUES (3,11); INSERT INTO public."RolePermissions" ("RoleId","PermissionId") VALUES (3,12); INSERT INTO public."RolePermissions" ("RoleId","PermissionId") VALUES (3,13); INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (1,'string','singleLinePlainText','Single line plain text',1); INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (2,'string','multilinePlainText','Multiline plain text',2); INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (3,'string','html','Html',3); INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (4,'integer','integerNumber','Integer number',4); INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (5,'decimal','decimalNumber','Decimal number',5); INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (6,'integer','booleanFlag','Boolean flag',6); INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (7,'datetime','date','Date',7); INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (8,'datetime','dateTime','DateTime',8); INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (9,'string','image','Image',9); INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (10,'string','sourceCode','Source code',10); ALTER SEQUENCE "DataTypes_Id_seq" RESTART WITH 9; INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (1,1,'checkbox','IsRequired','Is required'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (2,1,'numericTextBox','MaxLength','Max length'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (3,2,'checkbox','IsRequired','Is required'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (4,2,'numericTextBox','MaxLength','Max length'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (5,4,'checkbox','IsRequired','Is required'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (6,4,'numericTextBox','MinValue','Min value'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (7,4,'numericTextBox','MaxValue','Max value'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (8,5,'checkbox','IsRequired','Is required'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (9,5,'numericTextBox','MinValue','Min value'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (10,5,'numericTextBox','MaxValue','Max value'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (11,7,'checkbox','IsRequired','Is required'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (12,8,'numericTextBox','Width','Width'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (13,8,'numericTextBox','Height','Height'); INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (14,9,'textBox','Mode','Mode'); ALTER SEQUENCE "DataTypeParameters_Id_seq" RESTART WITH 8; INSERT INTO public."FieldTypes" ("Id","Code","Name","Position","ValidatorCSharpClassName") VALUES (1,'TextBox','Text box',1,NULL); INSERT INTO public."FieldTypes" ("Id","Code","Name","Position","ValidatorCSharpClassName") VALUES (2,'TextArea','Text area',2,NULL); INSERT INTO public."FieldTypes" ("Id","Code","Name","Position","ValidatorCSharpClassName") VALUES (3,'Checkbox','Checkbox',3,NULL); INSERT INTO public."FieldTypes" ("Id","Code","Name","Position","ValidatorCSharpClassName") VALUES (4,'RadioButtonList','Radio button list',4,NULL); INSERT INTO public."FieldTypes" ("Id","Code","Name","Position","ValidatorCSharpClassName") VALUES (5,'DropDownList','Drop down list',5,NULL); INSERT INTO public."FieldTypes" ("Id","Code","Name","Position","ValidatorCSharpClassName") VALUES (6,'FileUpload','File upload',6,NULL); INSERT INTO public."FieldTypes" ("Id","Code","Name","Position","ValidatorCSharpClassName") VALUES (7,'ReCAPTCHA','ReCAPTCHA',7,'Platformus.Website.Frontend.FieldValidators.ReCaptchaFieldValidator'); ALTER SEQUENCE "FieldTypes_Id_seq" RESTART WITH 8; -- -- Extension: Platformus.ECommerce -- Version: 2.5.0 -- INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (14,'ManageCategories','Manage categories',1400); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (15,'ManageProducts','Manage products',1500); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (16,'ManageOrderStates','Manage order states',1600); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (17,'ManagePaymentMethods','Manage payment methods',1700); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (18,'ManageDeliveryMethods','Manage delivery methods',1800); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (19,'ManageCarts','Manage carts',1900); INSERT INTO public."Permissions" ("Id","Code","Name","Position") VALUES (20,'ManageOrders','Manage orders',2000); COMMIT;
the_stack
-- 2020-02-27T15:24:14.250Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2020-02-27 16:24:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=570068 ; -- 2020-02-27T15:24:16.917Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO t_alter_column values('c_hierarchycommissionsettings','C_Commission_Product_ID','NUMERIC(10)',null,null) ; -- 2020-02-27T15:24:16.920Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO t_alter_column values('c_hierarchycommissionsettings','C_Commission_Product_ID',null,'NOT NULL',null) ; -- 2020-02-27T15:09:53.880Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2020-02-27 16:09:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=570067 ; -- 2020-02-27T15:09:54.209Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO t_alter_column values('c_commission_share','C_Commission_Product_ID','NUMERIC(10)',null,null) ; -- 2020-02-27T15:09:54.212Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO t_alter_column values('c_commission_share','C_Commission_Product_ID',null,'NOT NULL',null) ; -- 2020-02-27T15:27:05.876Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='Commission_Product_ID',Updated=TO_TIMESTAMP('2020-02-27 16:27:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577568 ; -- 2020-02-27T15:27:05.880Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='Commission_Product_ID', Name='Provisionsprodukt', Description='Produkt in dessen Einheit Provisionspunkte geführt und abgerechnet werden', Help='' WHERE AD_Element_ID=577568 ; -- 2020-02-27T15:27:05.881Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Commission_Product_ID', Name='Provisionsprodukt', Description='Produkt in dessen Einheit Provisionspunkte geführt und abgerechnet werden', Help='', AD_Element_ID=577568 WHERE UPPER(ColumnName)='COMMISSION_PRODUCT_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-27T15:27:05.882Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Commission_Product_ID', Name='Provisionsprodukt', Description='Produkt in dessen Einheit Provisionspunkte geführt und abgerechnet werden', Help='' WHERE AD_Element_ID=577568 AND IsCentrallyMaintained='Y' ; ALTER TABLE c_hierarchycommissionsettings RENAME COLUMN C_Commission_Product_ID TO Commission_Product_ID; ALTER TABLE c_commission_share RENAME COLUMN C_Commission_Product_ID TO Commission_Product_ID; -- 2020-02-27T15:56:51.390Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,570068,598428,0,542066,TO_TIMESTAMP('2020-02-27 16:56:51','YYYY-MM-DD HH24:MI:SS'),100,'Produkt in dessen Einheit Provisionspunkte geführt und abgerechnet werden',10,'de.metas.contracts.commission','','Y','N','N','N','N','N','N','N','Provisionsprodukt',TO_TIMESTAMP('2020-02-27 16:56:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-27T15:56:51.392Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=598428 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2020-02-27T15:56:51.394Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(577568) ; -- 2020-02-27T15:56:51.402Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=598428 ; -- 2020-02-27T15:56:51.403Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(598428) ; -- 2020-02-27T15:57:49.957Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,598428,0,542066,543076,566551,'F',TO_TIMESTAMP('2020-02-27 16:57:49','YYYY-MM-DD HH24:MI:SS'),100,'','Y','N','N','Y','N','N','N',0,'Commission_Product_ID',90,0,0,TO_TIMESTAMP('2020-02-27 16:57:49','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-27T15:57:58.362Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2020-02-27 16:57:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=566551 ; -- 2020-02-27T15:57:58.366Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2020-02-27 16:57:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=563248 ; -- 2020-02-27T15:57:58.370Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2020-02-27 16:57:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=563731 ; -- 2020-02-27T15:57:58.374Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2020-02-27 16:57:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=563244 ; -- 2020-02-27T15:57:58.377Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2020-02-27 16:57:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=563243 ; -- 2020-02-27T15:58:22.210Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=20,Updated=TO_TIMESTAMP('2020-02-27 16:58:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=570068 ; -- 2020-02-27T15:58:22.215Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=30,Updated=TO_TIMESTAMP('2020-02-27 16:58:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=569215 ; -- 2020-02-27T15:58:22.219Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=40,Updated=TO_TIMESTAMP('2020-02-27 16:58:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=569284 ; -- 2020-02-27T15:58:22.223Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=50,Updated=TO_TIMESTAMP('2020-02-27 16:58:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=569205 ; -- 2020-02-27T15:58:53.521Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,570067,598429,0,541943,TO_TIMESTAMP('2020-02-27 16:58:53','YYYY-MM-DD HH24:MI:SS'),100,'Produkt in dessen Einheit Provisionspunkte geführt und abgerechnet werden',10,'de.metas.contracts.commission','','Y','Y','N','N','N','N','N','Provisionsprodukt',TO_TIMESTAMP('2020-02-27 16:58:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-27T15:58:53.522Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=598429 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2020-02-27T15:58:53.524Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(577568) ; -- 2020-02-27T15:58:53.527Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=598429 ; -- 2020-02-27T15:58:53.529Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(598429) ; -- 2020-02-27T16:00:03.097Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,598429,0,541943,542899,566552,'F',TO_TIMESTAMP('2020-02-27 17:00:02','YYYY-MM-DD HH24:MI:SS'),100,'','Y','N','N','Y','N','N','N',0,'Commission_Product_ID',40,0,0,TO_TIMESTAMP('2020-02-27 17:00:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-27T16:00:27.003Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2020-02-27 17:00:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=598429 ;
the_stack
-- Schema migration script for upgrading from 1.0-M4 to 1.0-M5. -- -- NB: This has been written to work with PostgreSQL and will probably need -- tweaked slightly to work with other databases. BEGIN WORK; -- Add support for individual candidate comments in item_delivery_settings ALTER TABLE item_delivery_settings ADD allow_candidate_comment boolean; UPDATE item_delivery_settings SET allow_candidate_comment = FALSE; ALTER TABLE item_delivery_settings ALTER allow_candidate_comment SET NOT NULL; -- Moved 'prompt' down to item_delivery_settings ALTER TABLE item_delivery_settings ADD prompt text; UPDATE item_delivery_settings ids SET prompt = ds.prompt FROM delivery_settings ds WHERE ds.dsid = ids.dsid; ALTER TABLE delivery_settings DROP prompt; -- Ended up removing 'allow result' & 'allow source' completely in DEV29. -- (This functionality is now merged into author_mode) ALTER TABLE item_delivery_settings DROP allow_source; ALTER TABLE item_delivery_settings DROP allow_result; -- Rename some columns in item_delivery_settings... -- allow_close -> allow_end ALTER TABLE item_delivery_settings ADD allow_end boolean; UPDATE item_delivery_settings SET allow_end = allow_close; ALTER TABLE item_delivery_settings ALTER allow_end SET NOT NULL; ALTER TABLE item_delivery_settings DROP allow_close; -- allow_reset_when_interacting -> allow_soft_reset_when_open ALTER TABLE item_delivery_settings ADD allow_soft_reset_when_open boolean; UPDATE item_delivery_settings SET allow_soft_reset_when_open = allow_reset_when_interacting; ALTER TABLE item_delivery_settings ALTER allow_soft_reset_when_open SET NOT NULL; ALTER TABLE item_delivery_settings DROP allow_reset_when_interacting; -- allow_reset_when_closed -> allow_soft_reset_when_ended ALTER TABLE item_delivery_settings ADD allow_soft_reset_when_ended boolean; UPDATE item_delivery_settings SET allow_soft_reset_when_ended = allow_reset_when_closed; ALTER TABLE item_delivery_settings ALTER allow_soft_reset_when_ended SET NOT NULL; ALTER TABLE item_delivery_settings DROP allow_reset_when_closed; -- allow_reinit_when_interacting -> allow_hard_reset_when_open ALTER TABLE item_delivery_settings ADD allow_hard_reset_when_open boolean; UPDATE item_delivery_settings SET allow_hard_reset_when_open = allow_reinit_when_interacting; ALTER TABLE item_delivery_settings ALTER allow_hard_reset_when_open SET NOT NULL; ALTER TABLE item_delivery_settings DROP allow_reinit_when_interacting; -- allow_reinit_when_closed -> allow_hard_reset_when_ended ALTER TABLE item_delivery_settings ADD allow_hard_reset_when_ended boolean; UPDATE item_delivery_settings SET allow_hard_reset_when_ended = allow_reinit_when_closed; ALTER TABLE item_delivery_settings ALTER allow_hard_reset_when_ended SET NOT NULL; ALTER TABLE item_delivery_settings DROP allow_reinit_when_closed; -- allow_solution_when_interacting -> allow_solution_when_open ALTER TABLE item_delivery_settings ADD allow_solution_when_open boolean; UPDATE item_delivery_settings SET allow_solution_when_open = allow_solution_when_interacting; ALTER TABLE item_delivery_settings ALTER allow_solution_when_open SET NOT NULL; ALTER TABLE item_delivery_settings DROP allow_solution_when_interacting; -- allow_solution_when_closed -> allow_solution_when_ended ALTER TABLE item_delivery_settings ADD allow_solution_when_ended boolean; UPDATE item_delivery_settings SET allow_solution_when_ended = allow_solution_when_closed; ALTER TABLE item_delivery_settings ALTER allow_solution_when_ended SET NOT NULL; ALTER TABLE item_delivery_settings DROP allow_solution_when_closed; -- Turn author_mode back on for all public delivery settings -- (DEV29 also did this for individual users' defaults, but this is probably -- risky so I won't do it here.) UPDATE delivery_settings SET author_mode = true WHERE public IS TRUE; -- The template_processing_limit column should be optional ALTER TABLE delivery_settings ALTER template_processing_limit DROP NOT NULL; UPDATE delivery_settings SET template_processing_limit = NULL WHERE template_processing_limit <= 0; -- Change to Assessment -> AssessmentPackage relationships. -- First change is setting selected package to be the newest one for each row in assessments ALTER TABLE assessments ADD selected_apid bigint REFERENCES assessment_packages(apid); UPDATE assessments a SET selected_apid = (SELECT MAX(apid) FROM assessment_packages WHERE aid=a.aid); ALTER TABLE assessments ALTER selected_apid SET NOT NULL; ALTER TABLE assessment_packages ALTER aid DROP NOT NULL; -- New columns in assessment_package. We'll set these to defaults for now; -- an Engine Manager action should be run to fill in the data appropriately afterwards ALTER TABLE assessment_packages ADD launchable boolean; ALTER TABLE assessment_packages ADD error_count int; ALTER TABLE assessment_packages ADD warning_count int; UPDATE assessment_packages SET launchable=valid, error_count=0, warning_count=0; ALTER TABLE assessment_packages ALTER launchable SET NOT NULL; ALTER TABLE assessment_packages ALTER error_count SET NOT NULL; ALTER TABLE assessment_packages ALTER warning_count SET NOT NULL; -- Some changes to item and test candidate event names ALTER TABLE candidate_events ALTER item_event_type SET DATA TYPE VARCHAR(32); ALTER TABLE candidate_events ALTER test_event_type SET DATA TYPE VARCHAR(32); UPDATE candidate_events SET item_event_type='ENTER' WHERE item_event_type='INIT'; UPDATE candidate_events SET item_event_type='END' WHERE item_event_type='CLOSE'; UPDATE candidate_events SET item_event_type='EXIT' WHERE item_event_type='TERMINATE'; UPDATE candidate_events SET test_event_type='ENTER_TEST' WHERE test_event_type='INIT'; UPDATE candidate_events SET test_event_type='ADVANCE_TEST_PART' WHERE test_event_type='EXIT_TEST_PART'; UPDATE candidate_events SET test_event_type='EXIT_TEST' WHERE test_event_type='EXIT_MULTI_PART_TEST'; -- Addition of 'exploded' column to candidate_sessions ALTER TABLE candidate_sessions ADD exploded boolean; UPDATE candidate_sessions SET exploded=false; ALTER TABLE candidate_sessions ALTER exploded SET NOT NULL; -- Add columns to candidate_session_outcomes ALTER TABLE candidate_session_outcomes ADD base_type VARCHAR(14); ALTER TABLE candidate_session_outcomes ADD cardinality VARCHAR(8); UPDATE candidate_session_outcomes SET base_type = 'STRING'; UPDATE candidate_session_outcomes SET cardinality = 'SINGLE'; ALTER TABLE candidate_session_outcomes ALTER cardinality SET NOT NULL; -- Move 'author_mode' flag from delivery_settings to candidate_sessions ALTER TABLE delivery_settings DROP author_mode; ALTER TABLE candidate_sessions ADD author_mode BOOLEAN; UPDATE candidate_sessions SET author_mode = FALSE; ALTER TABLE candidate_sessions ALTER author_mode SET NOT NULL; -- Changes to base users table ALTER TABLE users ADD user_role VARCHAR(10); UPDATE users SET user_role=user_type; UPDATE users SET user_type='ANONYMOUS' where user_role='ANONYMOUS'; UPDATE users SET user_type='SYSTEM' where user_role='INSTRUCTOR'; UPDATE users SET user_type='LTI', user_role='CANDIDATE' where user_role='LTI'; ALTER TABLE users ALTER user_role SET NOT NULL; -- Rename of instructor_users table ALTER TABLE instructor_users RENAME TO system_users; -- Add lti_domains table CREATE TABLE lti_domains ( ldid BIGINT PRIMARY KEY NOT NULL, creation_time TIMESTAMP WITHOUT TIME ZONE NOT NULL, disabled BOOLEAN NOT NULL, consumer_key VARCHAR(256) UNIQUE NOT NULL, consumer_secret VARCHAR(32) NOT NULL ); CREATE SEQUENCE lti_domain_sequence START WITH 1 INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1; -- Link lti_users to lti_domains and deliveries ALTER TABLE lti_users ADD lti_launch_type VARCHAR(6); UPDATE lti_users SET lti_launch_type = 'LINK'; ALTER TABLE lti_users ALTER lti_launch_type SET NOT NULL; ALTER TABLE lti_users ADD did BIGINT REFERENCES deliveries(did); ALTER TABLE lti_users ADD ldid BIGINT REFERENCES lti_domains(ldid); ALTER TABLE lti_users ALTER logical_key SET DATA TYPE VARCHAR(300); -- Add lti_contexts table and sequence CREATE TABLE lti_contexts ( lcid BIGINT PRIMARY KEY NOT NULL, creation_time TIMESTAMP WITHOUT TIME ZONE NOT NULL, ldid BIGINT NOT NULL REFERENCES lti_domains(ldid), context_id VARCHAR(256), context_label VARCHAR(256), context_title TEXT, fallback_resource_link_id VARCHAR(256) ); CREATE SEQUENCE lti_context_sequence START WITH 1 INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1; -- Add lti_resources table and sequence CREATE TABLE lti_resources ( lrid BIGINT PRIMARY KEY NOT NULL, creation_time TIMESTAMP WITHOUT TIME ZONE NOT NULL, creator_uid BIGINT NOT NULL REFERENCES users(uid), lcid BIGINT NOT NULL REFERENCES lti_contexts(lcid), did BIGINT REFERENCES deliveries(did), resource_link_id VARCHAR(256) NOT NULL, resource_link_title TEXT, resource_link_description TEXT, tool_consumer_info_product_family_code VARCHAR(256), tool_consumer_info_version VARCHAR(256), tool_consumer_instance_name TEXT, tool_consumer_instance_description TEXT ); CREATE SEQUENCE lti_resource_sequence START WITH 1 INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1; -- Change deliveries table to allow lazy association to assessments & delivery_settings ALTER TABLE deliveries ALTER aid DROP NOT NULL; ALTER TABLE deliveries ALTER dsid DROP NOT NULL; DELETE FROM item_delivery_settings WHERE dsid IN (SELECT dsid FROM delivery_settings WHERE owner_uid IN (SELECT uid FROM users WHERE user_type='ANONYMOUS')); DELETE FROM test_delivery_settings WHERE dsid IN (SELECT dsid FROM delivery_settings WHERE owner_uid IN (SELECT uid FROM users WHERE user_type='ANONYMOUS')); DELETE FROM delivery_settings WHERE owner_uid IN (SELECT uid FROM users WHERE user_type='ANONYMOUS'); -- We never really used default delivery settings for assessments ALTER TABLE assessments DROP default_dsid; -- Add references to lti_contexts table to assessments & delivery_settings ALTER TABLE assessments ADD owner_lcid BIGINT REFERENCES lti_contexts(lcid); ALTER TABLE delivery_settings ADD owner_lcid BIGINT REFERENCES lti_contexts(lcid); -- Add LTI outcomes stuff to candidate_sessions table ALTER TABLE candidate_sessions ADD lis_outcome_service_url TEXT; ALTER TABLE candidate_sessions ADD lis_result_sourcedid TEXT; ALTER TABLE candidate_sessions ADD lis_score DOUBLE PRECISION; ALTER TABLE candidate_sessions ADD lis_reporting_status VARCHAR(24); -- Add LTI outcomes stuff to assessments table ALTER TABLE assessments ADD lti_result_outcome_identifier TEXT; ALTER TABLE assessments ADD lti_result_minimum DOUBLE PRECISION; ALTER TABLE assessments ADD lti_result_maximum DOUBLE PRECISION; -- Add queued_lti_outcomes table CREATE TABLE queued_lti_outcomes ( qoid BIGINT PRIMARY KEY NOT NULL, xid BIGINT NOT NULL REFERENCES candidate_sessions(xid), creation_time TIMESTAMP WITHOUT TIME ZONE NOT NULL, failure_count INTEGER NOT NULL, retry_time TIMESTAMP WITHOUT TIME ZONE, score DOUBLE PRECISION NOT NULL ); CREATE SEQUENCE queued_lti_outcome_sequence START WITH 1 INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1; -- Add lock_version columns to other tables for consistency ALTER TABLE deliveries ADD lock_version BIGINT; UPDATE deliveries SET lock_version = 1; ALTER TABLE deliveries ALTER lock_version SET NOT NULL; ALTER TABLE delivery_settings ADD lock_version BIGINT; UPDATE delivery_settings SET lock_version = 1; ALTER TABLE delivery_settings ALTER lock_version SET NOT NULL; -- Simplification to assessment naming ALTER TABLE assessment_packages ADD file_name VARCHAR(64); ALTER TABLE assessment_packages ADD title VARCHAR(256); UPDATE assessment_packages ap SET title=(SELECT a.title FROM assessments a WHERE ap.apid=a.selected_apid), file_name=(SELECT a.name FROM assessments a WHERE ap.apid=a.selected_apid); UPDATE assessment_packages SET title='Title' WHERE title IS NULL; -- (This package will end up being deleted) UPDATE assessment_packages SET file_name='file_name' WHERE file_name IS NULL; -- (Ditto) ALTER TABLE assessment_packages ALTER title SET NOT NULL; ALTER TABLE assessment_packages ALTER file_name SET NOT NULL; ALTER TABLE assessments DROP name; ALTER TABLE assessments DROP title; -- Finally, we delete ALL candidate session data from the database. -- (The filesystem site of things is deleted separately later...) DELETE FROM candidate_session_outcomes; DELETE FROM candidate_event_notifications; DELETE FROM candidate_string_response_items; DELETE FROM candidate_responses; DELETE FROM candidate_file_submissions; DELETE FROM candidate_events; DELETE FROM candidate_sessions; COMMIT WORK;
the_stack
-- 2017-07-26T15:51:15.428 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=1.000000000000,Updated=TO_TIMESTAMP('2017-07-26 15:51:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1018 ; -- 2017-07-26T15:52:26.823 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-07-26 15:52:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1033 ; -- 2017-07-26T15:53:17.178 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-07-26 15:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=1000018 ; -- 2017-07-26T15:55:00.636 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='N', SeqNo=999,Updated=TO_TIMESTAMP('2017-07-26 15:55:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000110 ; -- 2017-07-26T15:55:10.705 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-26 15:55:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000111 ; -- 2017-07-26T15:55:13.533 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-26 15:55:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000113 ; -- 2017-07-26T15:55:16.383 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-26 15:55:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000114 ; -- 2017-07-26T15:55:21.695 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-26 15:55:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000115 ; -- 2017-07-26T15:55:28.304 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-26 15:55:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000116 ; -- 2017-07-26T15:55:32.016 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-26 15:55:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000117 ; -- 2017-07-26T15:55:36.334 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-26 15:55:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000112 ; -- 2017-07-26T15:55:39.087 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-07-26 15:55:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000109 ; -- 2017-07-26T15:55:44.847 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-07-26 15:55:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000108 ; -- 2017-07-26T15:55:56.709 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-26 15:55:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000110 ; -- 2017-07-26T16:00:53.149 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=1.000000000000,Updated=TO_TIMESTAMP('2017-07-26 16:00:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=553956 ; -- 2017-07-26T16:01:07.004 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-07-26 16:01:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=1000019 ; -- 2017-07-26T16:02:09.557 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-07-26 16:02:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=553956 ; -- 2017-07-26T16:02:19.916 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=-1.000000000000,Updated=TO_TIMESTAMP('2017-07-26 16:02:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=553009 ; -- 2017-07-26T16:03:10.396 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-26 16:03:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000130 ; -- 2017-07-26T16:03:16.328 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-26 16:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000122 ; -- 2017-07-26T16:03:18.649 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-26 16:03:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000124 ; -- 2017-07-26T16:03:22.628 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-26 16:03:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000125 ; -- 2017-07-26T16:03:26.221 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-26 16:03:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000129 ; -- 2017-07-26T16:03:29.670 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-26 16:03:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000128 ; -- 2017-07-26T16:03:34.808 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-26 16:03:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000126 ; -- 2017-07-26T16:03:39.206 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-26 16:03:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000129 ; -- 2017-07-26T16:03:41.408 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-26 16:03:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000128 ; -- 2017-07-26T16:03:52.178 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-26 16:03:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000131 ; -- 2017-07-26T16:03:54.517 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-26 16:03:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000130 ; -- 2017-07-26T16:03:56.317 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-26 16:03:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000122 ; -- 2017-07-26T16:03:58.076 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-26 16:03:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000124 ; -- 2017-07-26T16:04:00.454 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-26 16:04:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000125 ; -- 2017-07-26T16:04:04.811 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-26 16:04:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000126 ; -- 2017-07-26T16:04:06.668 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-26 16:04:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000129 ; -- 2017-07-26T16:04:09.227 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-07-26 16:04:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000128 ; -- 2017-07-26T16:04:22.779 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='N',Updated=TO_TIMESTAMP('2017-07-26 16:04:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000120 ; -- 2017-07-26T16:04:40.163 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-07-26 16:04:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000127 ; -- 2017-07-26T16:04:43.973 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-07-26 16:04:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000119 ; -- 2017-07-26T16:04:48.467 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-07-26 16:04:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000118 ; -- 2017-07-26T16:04:54.506 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-07-26 16:04:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000121 ; -- 2017-07-26T16:04:56.308 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-07-26 16:04:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000119 ; -- 2017-07-26T16:04:58.187 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-07-26 16:04:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000118 ; -- 2017-07-26T16:05:02.402 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=130,Updated=TO_TIMESTAMP('2017-07-26 16:05:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000123 ; -- 2017-07-26T16:05:40.462 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-26 16:05:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000128 ; -- 2017-07-26T16:05:51.915 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-07-26 16:05:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000129 ; -- 2017-07-26T16:08:17.523 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-07-26 16:08:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000131 ; -- 2017-07-26T16:08:17.525 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-26 16:08:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000122 ; -- 2017-07-26T16:08:17.526 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-26 16:08:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000125 ; -- 2017-07-26T16:08:17.528 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-26 16:08:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000126 ; -- 2017-07-26T16:08:17.529 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-26 16:08:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000124 ; -- 2017-07-26T16:08:17.533 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-26 16:08:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000127 ; -- 2017-07-26T16:08:17.534 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-26 16:08:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000128 ; -- 2017-07-26T16:08:17.536 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-07-26 16:08:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000129 ; -- 2017-07-26T16:08:17.537 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-07-26 16:08:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000130 ; -- 2017-07-26T16:08:17.538 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-07-26 16:08:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000119 ; -- 2017-07-26T16:08:32.464 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-07-26 16:08:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000111 ; -- 2017-07-26T16:08:32.465 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-26 16:08:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000113 ; -- 2017-07-26T16:08:32.466 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-26 16:08:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000114 ; -- 2017-07-26T16:08:32.467 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-26 16:08:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000115 ; -- 2017-07-26T16:08:32.468 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-26 16:08:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000117 ; -- 2017-07-26T16:08:32.469 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-26 16:08:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000116 ; -- 2017-07-26T16:08:32.470 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-26 16:08:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000109 ; -- 2017-07-26T16:09:59.595 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='N',Updated=TO_TIMESTAMP('2017-07-26 16:09:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000132 ; -- 2017-07-26T16:10:12.932 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-26 16:10:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000133 ; -- 2017-07-26T16:10:22.880 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-26 16:10:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000134 ; -- 2017-07-26T16:10:29.240 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-26 16:10:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000140 ; -- 2017-07-26T16:10:47.210 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-26 16:10:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000138 ; -- 2017-07-26T16:10:49.113 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-26 16:10:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000137 ; -- 2017-07-26T16:10:52.050 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-26 16:10:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000138 ; -- 2017-07-26T16:11:23.657 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-26 16:11:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000136 ; -- 2017-07-26T16:11:25.752 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-26 16:11:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000141 ; -- 2017-07-26T16:11:27.704 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-07-26 16:11:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000142 ; -- 2017-07-26T16:11:30.764 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-07-26 16:11:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000139 ; -- 2017-07-26T16:11:33.960 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-07-26 16:11:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000135 ; -- 2017-07-26T16:11:46.067 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-07-26 16:11:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=1000020 ; -- 2017-07-26T16:30:20.269 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-07-26 16:30:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=1000021 ; -- 2017-07-26T16:31:21.930 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-26 16:31:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000153 ; -- 2017-07-26T16:31:26.546 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-26 16:31:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000152 ; -- 2017-07-26T16:31:34.324 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-26 16:31:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000151 ; -- 2017-07-26T16:38:24.470 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-26 16:38:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000146 ; -- 2017-07-26T16:38:29.743 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-26 16:38:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000148 ; -- 2017-07-26T16:38:33.251 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-26 16:38:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000155 ; -- 2017-07-26T16:38:54.314 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-26 16:38:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000156 ; -- 2017-07-26T16:39:05.840 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-26 16:39:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000149 ; -- 2017-07-26T16:39:08.396 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-26 16:39:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000155 ; -- 2017-07-26T16:39:23.382 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-07-26 16:39:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000156 ; -- 2017-07-26T16:39:31.679 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-26 16:39:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000150 ; -- 2017-07-26T16:39:34.470 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-07-26 16:39:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000155 ; -- 2017-07-26T16:39:37.087 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-07-26 16:39:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000156 ; -- 2017-07-26T16:39:55.465 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-07-26 16:39:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000160 ; -- 2017-07-26T16:39:58.712 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-07-26 16:39:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000162 ; -- 2017-07-26T16:40:05.079 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-07-26 16:40:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000158 ; -- 2017-07-26T16:40:09.853 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=130,Updated=TO_TIMESTAMP('2017-07-26 16:40:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000154 ; -- 2017-07-26T16:40:14.591 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=140,Updated=TO_TIMESTAMP('2017-07-26 16:40:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000161 ; -- 2017-07-26T16:40:33.490 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-07-26 16:40:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000159 ; -- 2017-07-26T16:40:36.064 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=130,Updated=TO_TIMESTAMP('2017-07-26 16:40:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000158 ; -- 2017-07-26T16:40:38.686 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=140,Updated=TO_TIMESTAMP('2017-07-26 16:40:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000154 ; -- 2017-07-26T16:40:41.921 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=150,Updated=TO_TIMESTAMP('2017-07-26 16:40:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000161 ; -- 2017-07-26T16:40:50.311 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=160,Updated=TO_TIMESTAMP('2017-07-26 16:40:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000147 ; -- 2017-07-26T16:40:53.711 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=170,Updated=TO_TIMESTAMP('2017-07-26 16:40:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000144 ; -- 2017-07-26T16:40:56.907 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=180,Updated=TO_TIMESTAMP('2017-07-26 16:40:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000143 ; -- 2017-07-26T16:41:00.430 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=190,Updated=TO_TIMESTAMP('2017-07-26 16:41:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000157 ; -- 2017-07-26T16:41:34.326 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='N',Updated=TO_TIMESTAMP('2017-07-26 16:41:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000145 ; -- 2017-07-26T16:42:15.489 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-26 16:42:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000152 ; -- 2017-07-26T16:42:17.984 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-26 16:42:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000146 ; -- 2017-07-26T16:54:38.007 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-07-26 16:54:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=1000022 ; -- 2017-07-26T16:55:56.703 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=1.000000000000,Updated=TO_TIMESTAMP('2017-07-26 16:55:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=552668 ; -- 2017-07-26T17:10:20.827 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='N',Updated=TO_TIMESTAMP('2017-07-26 17:10:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000166 ; -- 2017-07-26T17:10:41.369 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-26 17:10:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000163 ; -- 2017-07-26T17:10:45.482 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-26 17:10:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000167 ; -- 2017-07-26T17:10:47.924 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-26 17:10:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000170 ; -- 2017-07-26T17:10:50.761 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-26 17:10:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000178 ; -- 2017-07-26T17:10:53.571 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-26 17:10:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000179 ; -- 2017-07-26T17:10:55.778 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-26 17:10:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000180 ; -- 2017-07-26T17:10:57.645 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-26 17:10:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000181 ; -- 2017-07-26T17:10:59.175 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-07-26 17:10:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000182 ; -- 2017-07-26T17:11:02.528 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-07-26 17:11:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000171 ; -- 2017-07-26T17:11:05.331 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-07-26 17:11:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000172 ; -- 2017-07-26T17:11:07.497 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-07-26 17:11:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000173 ; -- 2017-07-26T17:11:09.202 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-07-26 17:11:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000175 ; -- 2017-07-26T17:11:11.473 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=130,Updated=TO_TIMESTAMP('2017-07-26 17:11:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000177 ; -- 2017-07-26T17:11:13.418 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=140,Updated=TO_TIMESTAMP('2017-07-26 17:11:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000183 ; -- 2017-07-26T17:11:15.828 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=150,Updated=TO_TIMESTAMP('2017-07-26 17:11:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000184 ; -- 2017-07-26T17:11:17.706 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=160,Updated=TO_TIMESTAMP('2017-07-26 17:11:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000185 ; -- 2017-07-26T17:11:19.762 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=170,Updated=TO_TIMESTAMP('2017-07-26 17:11:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000186 ; -- 2017-07-26T17:11:21.471 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=180,Updated=TO_TIMESTAMP('2017-07-26 17:11:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000187 ; -- 2017-07-26T17:11:23.662 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=190,Updated=TO_TIMESTAMP('2017-07-26 17:11:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000188 ; -- 2017-07-26T17:11:25.403 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=200,Updated=TO_TIMESTAMP('2017-07-26 17:11:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000190 ; -- 2017-07-26T17:11:27.458 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=210,Updated=TO_TIMESTAMP('2017-07-26 17:11:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000189 ; -- 2017-07-26T17:11:29.552 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=220,Updated=TO_TIMESTAMP('2017-07-26 17:11:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000169 ; -- 2017-07-26T17:11:31.597 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=230,Updated=TO_TIMESTAMP('2017-07-26 17:11:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000174 ; -- 2017-07-26T17:11:34.251 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=240,Updated=TO_TIMESTAMP('2017-07-26 17:11:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000176 ; -- 2017-07-26T17:11:41.523 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=250,Updated=TO_TIMESTAMP('2017-07-26 17:11:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000164 ; -- 2017-07-26T17:11:44.056 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=260,Updated=TO_TIMESTAMP('2017-07-26 17:11:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000165 ; -- 2017-07-26T17:11:48.321 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=270,Updated=TO_TIMESTAMP('2017-07-26 17:11:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000168 ; -- 2017-07-26T17:13:30.525 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-07-26 17:13:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=1000024 ; -- 2017-07-26T17:13:46.731 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-26 17:13:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000203 ; -- 2017-07-26T17:13:49.472 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-26 17:13:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000204 ; -- 2017-07-26T17:13:52.167 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-26 17:13:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000205 ; -- 2017-07-26T17:13:55.134 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-26 17:13:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000206 ; -- 2017-07-26T17:14:00.134 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='N',Updated=TO_TIMESTAMP('2017-07-26 17:14:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000201 ; -- 2017-07-26T17:14:09.923 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-26 17:14:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000200 ; -- 2017-07-26T17:14:34.270 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,57410,0,53246,1000024,547174,TO_TIMESTAMP('2017-07-26 17:14:34','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Client',60,0,0,TO_TIMESTAMP('2017-07-26 17:14:34','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-07-26T17:14:47.327 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-26 17:14:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000202 ; -- 2017-07-26T17:17:35.990 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='N',Updated=TO_TIMESTAMP('2017-07-26 17:17:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000208 ; -- 2017-07-26T17:17:46.246 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-26 17:17:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000207 ; -- 2017-07-26T17:17:49.686 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-26 17:17:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000209 ; -- 2017-07-26T17:17:56.652 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-07-26 17:17:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=1000025 ; -- 2017-07-26T17:21:46.378 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-07-26 17:21:46','YYYY-MM-DD HH24:MI:SS'),Name='Is Produced' WHERE AD_Field_ID=556296 AND AD_Language='en_US' ; -- 2017-07-26T17:22:11.761 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-07-26 17:22:11','YYYY-MM-DD HH24:MI:SS'),Name='Produced' WHERE AD_Field_ID=556296 AND AD_Language='en_US' ; -- 2017-07-26T17:23:25.978 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-07-26 17:23:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000146 ; -- 2017-07-26T17:23:25.985 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-26 17:23:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000148 ; -- 2017-07-26T17:23:25.989 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-26 17:23:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000149 ; -- 2017-07-26T17:23:25.996 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-26 17:23:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000150 ; -- 2017-07-26T17:23:26 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-26 17:23:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000154 ; -- 2017-07-26T17:23:26.004 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-26 17:23:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000153 ; -- 2017-07-26T17:23:26.007 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-26 17:23:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000151 ; -- 2017-07-26T17:23:26.011 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-07-26 17:23:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000158 ; -- 2017-07-26T17:23:26.014 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-07-26 17:23:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000159 ; -- 2017-07-26T17:23:26.017 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-07-26 17:23:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000160 ; -- 2017-07-26T17:23:26.021 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-07-26 17:23:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000162 ; -- 2017-07-26T17:23:26.024 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-07-26 17:23:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000144 ; -- 2017-07-26T17:23:39.708 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000166 ; -- 2017-07-26T17:23:39.712 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000167 ; -- 2017-07-26T17:23:39.716 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000168 ; -- 2017-07-26T17:23:39.720 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000169 ; -- 2017-07-26T17:23:39.723 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000170 ; -- 2017-07-26T17:23:39.727 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000171 ; -- 2017-07-26T17:23:39.730 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000172 ; -- 2017-07-26T17:23:39.733 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000173 ; -- 2017-07-26T17:23:39.736 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000174 ; -- 2017-07-26T17:23:39.739 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000175 ; -- 2017-07-26T17:23:39.740 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000176 ; -- 2017-07-26T17:23:39.742 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000177 ; -- 2017-07-26T17:23:39.746 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000178 ; -- 2017-07-26T17:23:39.749 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000179 ; -- 2017-07-26T17:23:39.750 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=160,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000180 ; -- 2017-07-26T17:23:39.751 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=170,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000181 ; -- 2017-07-26T17:23:39.752 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=180,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000182 ; -- 2017-07-26T17:23:39.753 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=190,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000183 ; -- 2017-07-26T17:23:39.754 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=200,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000184 ; -- 2017-07-26T17:23:39.755 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=210,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000185 ; -- 2017-07-26T17:23:39.757 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=220,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000186 ; -- 2017-07-26T17:23:39.758 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=230,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000187 ; -- 2017-07-26T17:23:39.759 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=240,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000188 ; -- 2017-07-26T17:23:39.760 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=250,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000189 ; -- 2017-07-26T17:23:39.761 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=260,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000190 ; -- 2017-07-26T17:23:39.762 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=270,Updated=TO_TIMESTAMP('2017-07-26 17:23:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000165 ; -- 2017-07-26T17:23:48.031 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-07-26 17:23:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000193 ; -- 2017-07-26T17:23:48.032 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-26 17:23:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000194 ; -- 2017-07-26T17:23:48.034 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-26 17:23:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000195 ; -- 2017-07-26T17:23:48.035 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-26 17:23:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000196 ; -- 2017-07-26T17:23:48.035 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-26 17:23:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000197 ; -- 2017-07-26T17:23:48.036 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-26 17:23:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000198 ; -- 2017-07-26T17:23:48.037 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-26 17:23:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000199 ; -- 2017-07-26T17:23:48.038 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-07-26 17:23:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000192 ; -- 2017-07-26T17:23:58.705 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-07-26 17:23:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000203 ; -- 2017-07-26T17:23:58.707 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-26 17:23:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000205 ; -- 2017-07-26T17:23:58.708 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-26 17:23:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000204 ; -- 2017-07-26T17:23:58.709 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-26 17:23:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000206 ; -- 2017-07-26T17:23:58.710 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-26 17:23:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000200 ; -- 2017-07-26T17:24:09.137 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-07-26 17:24:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000209 ; -- 2017-07-26T17:24:09.143 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-26 17:24:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000207 ; -- 2017-07-26T17:25:41.374 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-07-26 17:25:41','YYYY-MM-DD HH24:MI:SS'),Name='For Customer' WHERE AD_Field_ID=552670 AND AD_Language='en_US' ; -- 2017-07-26T17:25:52.166 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-07-26 17:25:52','YYYY-MM-DD HH24:MI:SS'),Name='For Vendor' WHERE AD_Field_ID=552671 AND AD_Language='en_US' ; -- 2017-07-27T13:09:17.600 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-27 13:09:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000112 ; -- 2017-07-27T13:09:17.603 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-07-27 13:09:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000109 ; -- 2017-07-27T13:10:33.188 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-27 13:10:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000130 ; -- 2017-07-27T13:10:33.190 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-27 13:10:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000122 ; -- 2017-07-27T13:10:33.192 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-27 13:10:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000124 ; -- 2017-07-27T13:10:33.193 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-27 13:10:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000125 ; -- 2017-07-27T13:10:33.194 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-27 13:10:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000126 ; -- 2017-07-27T13:10:33.196 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-07-27 13:10:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000127 ; -- 2017-07-27T13:10:33.198 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-07-27 13:10:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000121 ; -- 2017-07-27T13:10:33.199 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-07-27 13:10:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000119 ; -- 2017-07-27T13:12:19.724 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-27 13:12:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000141 ; -- 2017-07-27T13:12:19.726 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-27 13:12:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000139 ; -- 2017-07-27T13:12:19.728 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-27 13:12:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000142 ; -- 2017-07-27T13:12:19.729 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-27 13:12:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000140 ; -- 2017-07-27T13:12:19.730 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-27 13:12:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000137 ; -- 2017-07-27T13:12:19.737 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-27 13:12:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000138 ; -- 2017-07-27T13:12:19.738 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-27 13:12:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000136 ; -- 2017-07-27T13:12:19.740 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-27 13:12:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000135 ; -- 2017-07-27T13:14:50.459 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-07-27 13:14:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000153 ; -- 2017-07-27T13:14:50.460 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-27 13:14:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000154 ; -- 2017-07-27T13:14:50.462 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-27 13:14:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000151 ; -- 2017-07-27T13:14:50.463 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-27 13:14:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000146 ; -- 2017-07-27T13:14:50.464 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-27 13:14:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000148 ; -- 2017-07-27T13:14:50.466 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-27 13:14:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000149 ; -- 2017-07-27T13:14:50.467 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-27 13:14:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000150 ; -- 2017-07-27T13:16:49.850 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-27 13:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000154 ; -- 2017-07-27T13:16:49.851 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-27 13:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000158 ; -- 2017-07-27T13:16:49.853 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-27 13:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000160 ; -- 2017-07-27T13:16:49.855 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-27 13:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000162 ; -- 2017-07-27T13:16:49.858 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-27 13:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000159 ; -- 2017-07-27T13:16:49.860 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-27 13:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000146 ; -- 2017-07-27T13:16:49.862 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-27 13:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000152 ; -- 2017-07-27T13:16:49.864 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-07-27 13:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000155 ; -- 2017-07-27T13:16:49.865 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-07-27 13:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000147 ; -- 2017-07-27T13:16:49.867 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-07-27 13:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000144 ; -- 2017-07-27T13:17:14.644 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=95,Updated=TO_TIMESTAMP('2017-07-27 13:17:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000147 ; -- 2017-07-27T13:17:19.050 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=96,Updated=TO_TIMESTAMP('2017-07-27 13:17:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000144 ; -- 2017-07-27T13:17:22.874 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=97,Updated=TO_TIMESTAMP('2017-07-27 13:17:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000143 ; -- 2017-07-27T13:17:37.730 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-07-27 13:17:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000147 ; -- 2017-07-27T13:17:39.667 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-07-27 13:17:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000144 ; -- 2017-07-27T13:17:41.477 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-07-27 13:17:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000143 ; -- 2017-07-27T13:17:43.036 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=130,Updated=TO_TIMESTAMP('2017-07-27 13:17:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000160 ; -- 2017-07-27T13:17:44.776 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=140,Updated=TO_TIMESTAMP('2017-07-27 13:17:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000162 ; -- 2017-07-27T13:17:46.564 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=150,Updated=TO_TIMESTAMP('2017-07-27 13:17:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000159 ; -- 2017-07-27T13:17:48.204 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=160,Updated=TO_TIMESTAMP('2017-07-27 13:17:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000158 ; -- 2017-07-27T13:17:49.924 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=170,Updated=TO_TIMESTAMP('2017-07-27 13:17:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000154 ; -- 2017-07-27T13:17:51.365 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=180,Updated=TO_TIMESTAMP('2017-07-27 13:17:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000161 ; -- 2017-07-27T13:19:26.859 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=250,Updated=TO_TIMESTAMP('2017-07-27 13:19:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000168 ; -- 2017-07-27T13:19:30.099 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=270,Updated=TO_TIMESTAMP('2017-07-27 13:19:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000164 ; -- 2017-07-27T13:19:47.233 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000169 ; -- 2017-07-27T13:19:47.234 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000170 ; -- 2017-07-27T13:19:47.236 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000171 ; -- 2017-07-27T13:19:47.237 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000172 ; -- 2017-07-27T13:19:47.238 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000173 ; -- 2017-07-27T13:19:47.240 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000174 ; -- 2017-07-27T13:19:47.241 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000175 ; -- 2017-07-27T13:19:47.243 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000176 ; -- 2017-07-27T13:19:47.244 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000177 ; -- 2017-07-27T13:19:47.245 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000178 ; -- 2017-07-27T13:19:47.246 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000179 ; -- 2017-07-27T13:19:47.247 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000180 ; -- 2017-07-27T13:19:47.249 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=160,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000181 ; -- 2017-07-27T13:19:47.250 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=170,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000182 ; -- 2017-07-27T13:19:47.251 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=180,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000183 ; -- 2017-07-27T13:19:47.252 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=190,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000184 ; -- 2017-07-27T13:19:47.253 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=200,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000185 ; -- 2017-07-27T13:19:47.254 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=210,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000186 ; -- 2017-07-27T13:19:47.256 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=220,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000187 ; -- 2017-07-27T13:19:47.257 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=230,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000188 ; -- 2017-07-27T13:19:47.257 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=240,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000189 ; -- 2017-07-27T13:19:47.258 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=250,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000190 ; -- 2017-07-27T13:19:47.259 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=260,Updated=TO_TIMESTAMP('2017-07-27 13:19:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000168 ; -- 2017-07-27T13:20:03.273 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000166 ; -- 2017-07-27T13:20:03.275 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000167 ; -- 2017-07-27T13:20:03.276 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000169 ; -- 2017-07-27T13:20:03.278 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000170 ; -- 2017-07-27T13:20:03.279 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000171 ; -- 2017-07-27T13:20:03.280 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000172 ; -- 2017-07-27T13:20:03.281 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000173 ; -- 2017-07-27T13:20:03.283 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000174 ; -- 2017-07-27T13:20:03.284 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000175 ; -- 2017-07-27T13:20:03.285 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000176 ; -- 2017-07-27T13:20:03.287 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000177 ; -- 2017-07-27T13:20:03.288 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000178 ; -- 2017-07-27T13:20:03.289 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000179 ; -- 2017-07-27T13:20:03.290 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000180 ; -- 2017-07-27T13:20:03.291 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000181 ; -- 2017-07-27T13:20:03.293 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=160,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000182 ; -- 2017-07-27T13:20:03.294 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=170,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000183 ; -- 2017-07-27T13:20:03.295 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=180,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000184 ; -- 2017-07-27T13:20:03.297 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=190,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000185 ; -- 2017-07-27T13:20:03.298 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=200,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000186 ; -- 2017-07-27T13:20:03.299 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=210,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000187 ; -- 2017-07-27T13:20:03.300 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=220,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000188 ; -- 2017-07-27T13:20:03.302 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=230,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000189 ; -- 2017-07-27T13:20:03.303 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=240,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000190 ; -- 2017-07-27T13:20:03.304 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=250,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000168 ; -- 2017-07-27T13:20:03.306 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=260,Updated=TO_TIMESTAMP('2017-07-27 13:20:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000165 ; -- 2017-07-27T13:22:56.601 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-27 13:22:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000202 ; -- 2017-07-27T13:22:56.603 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-27 13:22:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000200 ; -- 2017-07-27T13:23:32.922 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-27 13:23:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000202 ; -- 2017-07-27T13:23:35.593 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-27 13:23:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000200 ; -- 2017-07-27T13:23:38.483 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-27 13:23:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547174 ; -- 2017-07-27T13:24:27.260 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-27 13:24:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000208 ; -- 2017-07-27T13:24:27.261 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-27 13:24:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000207 ; -- 2017-07-27T13:24:49.626 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-27 13:24:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000209 ; -- 2017-07-27T13:24:53.134 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-27 13:24:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000207 ;
the_stack
----------------------------------------------------------------------- -- Oracle Machine Learning for SQL (OML4SQL) 21c -- -- Classification - Random Forest Algorithm - dmrfdemo.sql -- -- Copyright (c) 2021 Oracle Corporation and/or its affilitiates. -- -- The Universal Permissive License (UPL), Version 1.0 -- -- https://oss.oracle.com/licenses/upl/ ----------------------------------------------------------------------- SET serveroutput ON SET trimspool ON SET pages 10000 SET linesize 420 SET echo ON SET long 2000000000 ----------------------------------------------------------------------- -- SAMPLE PROBLEM ----------------------------------------------------------------------- -- Given demographic data about a set of customers, predict the -- customer response to an affinity card program using a classifier -- based on Random Forests algorithm. ----------------------------------------------------------------------- -- SET UP AND ANALYZE THE DATA ----------------------------------------------------------------------- -- The data for this sample is composed from base tables in SH Schema -- (See Sample Schema Documentation) and presented through these views: -- mining_data_build_parallel_v (build data) -- mining_data_test_parallel_v (test data) -- mining_data_apply_parallel_v (apply data) -- (See dmsh.sql for view definitions). ----------- -- ANALYSIS ----------- -- These are the factors to consider for data analysis in random forest: -- -- 1. Missing Value Treatment for Predictors -- -- Decision Tree implementation in ODM handles missing predictor -- values (by penalizing predictors which have missing values) -- and missing target values (by simply discarding records with -- missing target values). -- Other options can be specified by using the ODMS_MISSING_VALUE_TREATMENT -- setting. -- -- 2. Binning high cardinality data -- No data preparation for the types we accept is necessary - even -- for high cardinality predictors. Preprocessing to reduce the -- cardinality (e.g., binning) can improve the performance of the build. -- -- This demo is similar to the Decision Tree demo. But instead of building a -- decision tree, we build a random forest.We need some additional settings for -- building the random forest. The build and score steps for random forest -- and decision tree are identical. -- ----------------------------------------------------------------------- -- BUILD THE MODEL ----------------------------------------------------------------------- -- Cleanup old model with same name for repeat runs BEGIN DBMS_DATA_MINING.DROP_MODEL('RF_SH_Clas_Sample'); EXCEPTION WHEN OTHERS THEN NULL; END; / -------------------------------- -- PREPARE BUILD (TRAINING) DATA -- -- The decision tree algorithm is very capable of handling data which -- has not been specially prepared. For this example, no data preparation -- will be performed. -- ------------------- -- SPECIFY SETTINGS -- -- Cleanup old settings table objects for repeat runs BEGIN EXECUTE IMMEDIATE 'DROP TABLE rf_sh_sample_settings'; EXCEPTION WHEN OTHERS THEN NULL; END; / BEGIN EXECUTE IMMEDIATE 'DROP TABLE rf_sh_sample_cost'; EXCEPTION WHEN OTHERS THEN NULL; END; / -------------------------- -- CREATE A SETTINGS TABLE -- -- The default classification algorithm is Naive Bayes. In order to override -- this, create and populate a settings table to be used as input for -- CREATE_MODEL. -- set echo off CREATE TABLE rf_sh_sample_settings ( setting_name VARCHAR2(30), setting_value VARCHAR2(4000)); set echo on -- CREATE AND POPULATE A COST MATRIX TABLE -- -- A cost matrix is used to influence the weighting of misclassification -- during model creation (and scoring). -- See Oracle Data Mining Concepts Guide for more details. -- CREATE TABLE rf_sh_sample_cost ( actual_target_value NUMBER, predicted_target_value NUMBER, cost NUMBER); INSERT INTO rf_sh_sample_cost VALUES (0,0,0); INSERT INTO rf_sh_sample_cost VALUES (0,1,1); INSERT INTO rf_sh_sample_cost VALUES (1,0,8); INSERT INTO rf_sh_sample_cost VALUES (1,1,0); BEGIN -- Populate settings table INSERT INTO rf_sh_sample_settings VALUES (dbms_data_mining.algo_name, dbms_data_mining.algo_random_forest); INSERT INTO rf_sh_sample_settings VALUES (dbms_data_mining.clas_cost_table_name, 'rf_sh_sample_cost'); INSERT INTO rf_sh_sample_settings VALUES (dbms_data_mining.rfor_num_trees, 25); -- Examples of other possible settings are: --(dbms_data_mining.rfor_mtry, 5) ; -- rfor_mtry specifies the number of attributes that are to be -- randomly chosen for computing splits at each node of the trees in -- the forest. --(dbms_data_mining.rfor_sampling_ratio, 0.5); --(dbms_data_mining.odms_random_seed, 41); --(dbms_data_mining.tree_impurity_metric, 'TREE_IMPURITY_ENTROPY') --(dbms_data_mining.tree_term_max_depth, 5) --(dbms_data_mining.tree_term_minrec_split, 5) --(dbms_data_mining.tree_term_minpct_split, 2) --(dbms_data_mining.tree_term_minrec_node, 5) --(dbms_data_mining.tree_term_minpct_node, 0.05) END; / --------------------- -- CREATE A NEW MODEL -- -- Build a RF model BEGIN DBMS_DATA_MINING.CREATE_MODEL( model_name => 'RF_SH_Clas_Sample', mining_function => dbms_data_mining.classification, data_table_name => 'mining_data_build_parallel_v', case_id_column_name => 'cust_id', target_column_name => 'affinity_card', settings_table_name => 'rf_sh_sample_settings'); END; / ------------------------- -- DISPLAY MODEL SETTINGS -- column setting_name format a30 column setting_value format a30 SELECT setting_name, setting_value FROM user_mining_model_settings WHERE model_name = 'RF_SH_CLAS_SAMPLE' ORDER BY setting_name; -------------------------- -- DISPLAY MODEL SIGNATURE -- column attribute_name format a40 column attribute_type format a20 SELECT attribute_name, attribute_type FROM user_mining_model_attributes WHERE model_name = 'RF_SH_CLAS_SAMPLE' ORDER BY attribute_name; -------------------------- -- DISPLAY MODEL VIEWS -- -- Get a list of model views col view_name format a30 col view_type format a50 SELECT view_name, view_type FROM user_mining_model_views WHERE model_name='RF_SH_CLAS_SAMPLE' ORDER BY view_name; ------------------------ -- DISPLAY MODEL metdata -- column string_value format a12 column setting_name format a12 column setting_value format a14 select name, numeric_value, string_value from DM$VGRF_SH_CLAS_SAMPLE order by name; -- Get computed settings -- select setting_name, setting_value from DM$VSRF_SH_CLAS_SAMPLE; --Get variable importance for the forest -- column attribute_name format a30 select attribute_name, attribute_importance from DM$VARF_SH_CLAS_SAMPLE order by attribute_importance desc, attribute_name asc; ----------------------------------------------------------------------- -- TEST THE MODEL ----------------------------------------------------------------------- -------------------- -- PREPARE TEST DATA -- -- If the data for model creation has been prepared, then the data used -- for testing the model must be prepared to the same scale in order to -- obtain meaningful results. -- In this case, no data preparation is necessary since model creation -- was performed on the raw (unprepared) input. -- ------------------------------------ -- COMPUTE METRICS TO TEST THE MODEL -- -- Other demo programs demonstrate how to use the PL/SQL API to -- compute a number of metrics, including lift and ROC. This demo -- only computes a confusion matrix and accuracy, but it does so -- using the SQL data mining functions. -- -- In this example, we experiment with using the cost matrix -- that was provided to the create routine. In this example, the -- cost matrix reduces the problematic misclassifications, but also -- negatively impacts the overall model accuracy. -- DISPLAY CONFUSION MATRIX WITHOUT APPLYING COST MATRIX -- SELECT affinity_card AS actual_target_value, PREDICTION(RF_SH_Clas_Sample USING *) AS predicted_target_value, COUNT(*) AS value FROM mining_data_test_parallel_v GROUP BY affinity_card, PREDICTION(RF_SH_Clas_Sample USING *) ORDER BY 1,2; -- DISPLAY CONFUSION MATRIX APPLYING THE COST MATRIX -- SELECT affinity_card AS actual_target_value, PREDICTION(RF_SH_Clas_Sample COST MODEL USING *) AS predicted_target_value, COUNT(*) AS value FROM mining_data_test_parallel_v GROUP BY affinity_card, PREDICTION(RF_SH_Clas_Sample COST MODEL USING *) ORDER BY 1,2; -- DISPLAY ACCURACY WITHOUT APPLYING COST MATRIX -- SELECT ROUND(SUM(correct)/COUNT(*),4) AS accuracy FROM (SELECT DECODE(affinity_card, PREDICTION(RF_SH_Clas_Sample USING *), 1, 0) AS correct FROM mining_data_test_parallel_v); -- DISPLAY ACCURACY APPLYING THE COST MATRIX -- SELECT ROUND(SUM(correct)/COUNT(*),4) AS accuracy FROM (SELECT DECODE(affinity_card, PREDICTION(RF_SH_Clas_Sample COST MODEL USING *), 1, 0) AS correct FROM mining_data_test_parallel_v); ----------------------------------------------------------------------- -- APPLY THE MODEL ----------------------------------------------------------------------- ------------------ -- BUSINESS CASE 1 -- Find the 10 customers who live in Italy that are least expensive -- to be convinced to use an affinity card. -- SELECT cust_id FROM (SELECT cust_id, rank() over (order by PREDICTION_COST(RF_SH_Clas_Sample, 1 COST MODEL USING *) ASC, cust_id) rnk FROM mining_data_apply_parallel_v WHERE country_name = 'Italy') where rnk <= 10 order by rnk; ------------------ -- BUSINESS CASE 2 -- Find the average age of customers who are likely to use an -- affinity card. -- Include the build-time cost matrix in the prediction. -- Only take into account CUST_MARITAL_STATUS, EDUCATION, and -- HOUSEHOLD_SIZE as predictors. -- Break out the results by gender. -- column cust_gender format a12 SELECT cust_gender, COUNT(*) AS cnt, ROUND(AVG(age)) AS avg_age FROM mining_data_apply_parallel_v WHERE PREDICTION(rf_sh_clas_sample COST MODEL USING cust_marital_status, education, household_size) = 1 GROUP BY cust_gender ORDER BY cust_gender; ------------------ -- BUSINESS CASE 3 -- List ten customers (ordered by their id) along with likelihood and cost -- to use or reject the affinity card (Note: while this example has a -- binary target, such a query is useful in multi-class classification - -- Low, Med, High for example). -- column prediction format 9; column probability format 9.999999999 column cost format 9.999999999 SELECT T.cust_id, S.prediction, S.probability, S.cost FROM (SELECT cust_id, PREDICTION_SET(rf_sh_clas_sample COST MODEL USING *) pset FROM mining_data_apply_parallel_v WHERE cust_id < 100011) T, TABLE(T.pset) S ORDER BY cust_id, S.prediction; ------------------ -- BUSINESS CASE 4 -- Find the segmentation (prediction and rule) for customers who -- work in Tech support and are under 25. -- set long 20000 set line 300 set pagesize 100 column education format a30; SELECT cust_id, education, PREDICTION_DETAILS(rf_sh_clas_sample USING *) prediction_details FROM mining_data_apply_parallel_v WHERE occupation = 'TechSup' AND age < 25 ORDER BY cust_id;
the_stack
-- To Demo Cursors, Need Table With Data CREATE TABLE endangered_species ( common_name VARCHAR2 (100), species_name VARCHAR2 (100) ); BEGIN /* https://www.worldwildlife.org/species/directory?direction=desc&sort=extinction_status */ INSERT INTO endangered_species VALUES ('Amur Leopard', 'Panthera pardus orientalis'); INSERT INTO endangered_species VALUES ('Hawksbill Turtle', 'Eretmochelys imbricata'); INSERT INTO endangered_species VALUES ('Javan Rhino', 'Rhinoceros sondaicus'); COMMIT; END; / -- Implicit Cursor (aka, SELECT-INTO) /* Perfect for single row lookups. Raises NO_DATA_FOUND if no row found. Raises TOO_MANY_ROWS if > 1 row found. You should decide when using SELECT-INTO if NO_DATA_FOUND is an actual error (a row SHOULD exist) or simply a data condition. */ DECLARE l_common_name endangered_species.common_name%TYPE; BEGIN SELECT common_name INTO l_common_name FROM endangered_species WHERE species_name = 'Rhinoceros sondaicus'; EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.put_line ('Error or data condition?'); WHEN TOO_MANY_ROWS THEN DBMS_OUTPUT.put_line ('Error if primary key/unique index lookup!'); END; / -- Bulk Implicit Cursor (aka, SELECT BULK COLLECT INTO) /* You can add BULK COLLECT to your INTO clause and then return multiple rows with a single fetch, into a collection. In fact, you can add "BULK COLLECT" to any INTO (SELECT-INTO, FETCH-INTO, EXECUTE IMMEDIATE-INTO) clause. I won't show that below. */ DECLARE TYPE species_nt IS TABLE OF endangered_species%ROWTYPE; l_species species_nt; BEGIN SELECT * BULK COLLECT INTO l_species FROM endangered_species ORDER BY common_name; DBMS_OUTPUT.put_line (l_species.COUNT); END; / -- Explicit Cursor (aka, CURSOR cursor_name IS SELECT....) /* You associate a SELECT statement with an explicitly-declared cursor. Then you get to control all aspects: open, fetch, close. If that's what you want. Generally do not use explicit cursors for single row lookups; implicits are simpler and faster. */ DECLARE CURSOR species_cur IS SELECT * FROM endangered_species ORDER BY common_name; l_species species_cur%ROWTYPE; BEGIN OPEN species_cur; FETCH species_cur INTO l_species; CLOSE species_cur; END; / -- Parameterize Explicit Cursors -- You can define a cursor once, and use it in multiple places. DECLARE CURSOR species_cur (filter_in IN VARCHAR2) IS SELECT * FROM endangered_species WHERE species_name LIKE filter_in ORDER BY common_name; l_species species_cur%ROWTYPE; BEGIN OPEN species_cur ('%u%'); FETCH species_cur INTO l_species; CLOSE species_cur; /* Use same cursor a second time, avoiding copy-paste of SQL */ OPEN species_cur ('%e%'); FETCH species_cur INTO l_species; CLOSE species_cur; /* I can even use it in a cursor FOR loop */ FOR rec IN species_cur ('%u%') LOOP DBMS_OUTPUT.PUT_LINE (rec.common_name); END LOOP; END; / -- Explicit Cursor in Package Specification, SQL Hidden /* One really nice feature of an explicit cursor is to declare the cursor in the specification, but not show the SQL. Then you define the cursor (including the SELECT) in the package body - as shown in next step. This way, you hide the details of the query and "force" the user of the cursor to simply rely on its documented specification. */ CREATE PACKAGE species_pkg IS CURSOR species_cur RETURN endangered_species%ROWTYPE; END; / -- Hide SELECT in Package Body CREATE PACKAGE BODY species_pkg IS CURSOR species_cur RETURN endangered_species%ROWTYPE IS SELECT * FROM endangered_species ORDER BY common_name; END; / -- Cursor FOR Loop with Embedded SELECT /* The cursor FOR Loop is one of my favorite PL/SQL features. No need to open, fetch, close. Just tell the PL/SQL engine you want to work with each row returned by the query. Plus, with your optimization level set to 2 (the default) or higher, this code is automatically optimized to return 100 rows with each fetch (similar to BULK COLLECT). */ BEGIN FOR rec IN ( SELECT * FROM endangered_species ORDER BY common_name) LOOP DBMS_OUTPUT.put_line (rec.common_name); END LOOP; END; / -- Cursor FOR Loop with Explicit Cursor /* As mentioned above, you can declare the cursor once, then use it multiple times. Here, in two different cursor FOR loops. */ DECLARE CURSOR species_cur IS SELECT * FROM endangered_species ORDER BY common_name; PROCEDURE start_conservation_effort IS BEGIN DBMS_OUTPUT.put_line ('Remove human presence'); END; BEGIN FOR rec IN species_cur LOOP DBMS_OUTPUT.put_line (rec.common_name); END LOOP; FOR rec IN species_cur LOOP start_conservation_effort; END LOOP; END; / -- Cursor Variables Based on Strong and Weak Ref Cursor Types /* A cursor variable is, well, just that: a variable pointing back to a cursor/result set. Some really nice aspects of cursor variables, demonstrated in this package: you can associate a query with a cursor variable at runtime (useful with both static and dynamic SQL); you can pass the cursor variable as a parameter or function RETURN value (specifically: you can pass a cursor variable back to a host l anguage like Java for consumption). */ CREATE OR REPLACE PACKAGE refcursor_pkg IS /* Use this "strong" REF CURSOR to declare cursor variables whose queries return data from the endangered_species table. */ TYPE endangered_species_t IS REF CURSOR RETURN endangered_species%ROWTYPE; /* Use a "weak" REF CURSOR to declare cursor variables whose queries return any number of columns. Or use the pre-defined SYS_REFCURSOR, see example below. */ TYPE weak_t IS REF CURSOR; FUNCTION filtered_species_cv (filter_in IN VARCHAR2) RETURN endangered_species_t; /* Return data from whatever query is passed as an argument. */ FUNCTION data_from_any_query_cv (query_in IN VARCHAR2) RETURN weak_t; /* Return data from whatever query is passed as an argument. But this time, use the predefined weak type. */ FUNCTION data_from_any_query_cv2 (query_in IN VARCHAR2) RETURN SYS_REFCURSOR; END refcursor_pkg; / CREATE OR REPLACE PACKAGE BODY refcursor_pkg IS FUNCTION filtered_species_cv (filter_in IN VARCHAR2) RETURN endangered_species_t IS l_cursor_variable endangered_species_t; BEGIN IF filter_in IS NULL THEN OPEN l_cursor_variable FOR SELECT * FROM endangered_species; ELSE OPEN l_cursor_variable FOR SELECT * FROM endangered_species WHERE common_name LIKE filter_in; END IF; RETURN l_cursor_variable; END filtered_species_cv; FUNCTION data_from_any_query_cv (query_in IN VARCHAR2) RETURN weak_t IS l_cursor_variable weak_t; BEGIN OPEN l_cursor_variable FOR query_in; RETURN l_cursor_variable; END data_from_any_query_cv; FUNCTION data_from_any_query_cv2 (query_in IN VARCHAR2) RETURN SYS_REFCURSOR IS l_cursor_variable SYS_REFCURSOR; BEGIN OPEN l_cursor_variable FOR query_in; RETURN l_cursor_variable; END data_from_any_query_cv2; END refcursor_pkg; / -- Using Standard Cursor Operations with Cursor Variables /* Once you've got a cursor variable, you can use all the familiar features of explicit cursors with them: fetch, close, check cursor attribute values. */ DECLARE l_objects refcursor_pkg.endangered_species_t; l_object endangered_species%ROWTYPE; BEGIN l_objects := refcursor_pkg.filtered_species_cv ('%u%'); LOOP FETCH l_objects INTO l_object; EXIT WHEN l_objects%NOTFOUND; DBMS_OUTPUT.put_line (l_object.common_name); END LOOP; CLOSE l_objects; END; / -- Cursor Variable for Dynamic Query /* Just pass whatever query you want, OPEN FOR that query, and pass back the cursor variable. The tricky part is figuring out how many columns and their types in that dynamic query. DBMS_SQL.DESCRIBE_COLUMNS, in conjunction with DBMS_SQL.to_cursor_number, can help there. */ DECLARE l_objects SYS_REFCURSOR; l_object endangered_species%ROWTYPE; BEGIN l_objects := refcursor_pkg.data_from_any_query_cv2 ( 'SELECT * FROM endangered_species WHERE common_name LIKE ''%u%'''); LOOP FETCH l_objects INTO l_object; EXIT WHEN l_objects%NOTFOUND; DBMS_OUTPUT.put_line (l_object.common_name); END LOOP; CLOSE l_objects; END; / -- Cursor Expressions /* Taking a break from endangered species and a shift to HR to show you how you can use the CURSOR expression to convert a result set into a cursor variable. Also useful with pipelined table functions. */ DECLARE /* Notes on CURSOR expression: 1. The query returns only 2 columns, but the second column is a cursor that lets us traverse a set of related information. 2. Queries in CURSOR expression that find no rows do NOT raise NO_DATA_FOUND. */ CURSOR all_in_one_cur IS SELECT l.city, CURSOR (SELECT d.department_name, CURSOR (SELECT e.last_name FROM hr.employees e WHERE e.department_id = d.department_id) AS ename FROM hr.departments d WHERE l.location_id = d.location_id) AS dname FROM hr.locations l WHERE l.location_id = 1700; department_cur sys_refcursor; employee_cur sys_refcursor; v_city hr.locations.city%TYPE; v_dname hr.departments.department_name%TYPE; v_ename hr.employees.last_name%TYPE; BEGIN OPEN all_in_one_cur; LOOP FETCH all_in_one_cur INTO v_city, department_cur; EXIT WHEN all_in_one_cur%NOTFOUND; -- Now I can loop through deartments and I do NOT need to -- explicitly open that cursor. Oracle did it for me. LOOP FETCH department_cur INTO v_dname, employee_cur; EXIT WHEN department_cur%NOTFOUND; -- Now I can loop through employee for that department. -- Again, I do need to open the cursor explicitly. LOOP FETCH employee_cur INTO v_ename; EXIT WHEN employee_cur%NOTFOUND; DBMS_OUTPUT.put_line (v_city || ' ' || v_dname || ' ' || v_ename); END LOOP; CLOSE employee_cur; END LOOP; CLOSE department_cur; END LOOP; CLOSE all_in_one_cur; END; / -- DBMS_SQL Cursor Handle /* Most dynamic SQL requirements can be met with EXECUTE IMMEDIATE (native dynamic SQL). Some of the more complicated scenarios, however, like method 4 dynamic SQL (variable number of elements in SELECT list and/or variable number of bind variables) are best implemented by DBMS_SQL. You allocate a cursor handle and then all subsequent operations reference that cursor handle. */ CREATE OR REPLACE PROCEDURE show_common_names (table_in IN VARCHAR2) IS l_cursor PLS_INTEGER := DBMS_SQL.open_cursor (); l_feedback PLS_INTEGER; l_name endangered_species.common_name%TYPE; BEGIN DBMS_SQL.parse (l_cursor, 'select common_name from ' || table_in, DBMS_SQL.native); DBMS_SQL.define_column (l_cursor, 1, 'a', 100); l_feedback := DBMS_SQL.execute (l_cursor); DBMS_OUTPUT.put_line ('Result=' || l_feedback); LOOP EXIT WHEN DBMS_SQL.fetch_rows (l_cursor) = 0; DBMS_SQL.COLUMN_VALUE (l_cursor, 1, l_name); DBMS_OUTPUT.put_line (l_name); END LOOP; DBMS_SQL.close_cursor (l_cursor); END; / BEGIN show_common_names ('ENDANGERED_SPECIES'); END; /
the_stack
-- 2017-09-14T11:18:46.367 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543417,0,'IsShipToContact_Default',TO_TIMESTAMP('2017-09-14 11:18:46','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ShipTo Contact Default','ShipTo Contact Default',TO_TIMESTAMP('2017-09-14 11:18:46','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-09-14T11:18:46.393 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543417 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2017-09-14T11:19:16.809 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543418,0,'IsBillToContact_Default',TO_TIMESTAMP('2017-09-14 11:19:16','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','BillTo Contact Default','BillTo Contact Default',TO_TIMESTAMP('2017-09-14 11:19:16','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-09-14T11:19:16.811 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543418 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2017-09-14T11:19:44.924 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,DefaultValue,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsSelectionColumn,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,ReadOnlyLogic,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,557164,543418,0,20,114,'N','IsBillToContact_Default',TO_TIMESTAMP('2017-09-14 11:19:44','YYYY-MM-DD HH24:MI:SS'),100,'N','N','D',1,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','Y','N','N','N','N','N','Y','N','BillTo Contact Default','',0,0,TO_TIMESTAMP('2017-09-14 11:19:44','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2017-09-14T11:19:44.936 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=557164 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2017-09-14T11:19:47.432 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('ad_user','ALTER TABLE public.AD_User ADD COLUMN IsBillToContact_Default CHAR(1) DEFAULT ''N'' CHECK (IsBillToContact_Default IN (''Y'',''N'')) NOT NULL') ; -- 2017-09-14T11:20:11.882 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,DefaultValue,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsSelectionColumn,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,ReadOnlyLogic,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,557165,543417,0,20,114,'N','IsShipToContact_Default',TO_TIMESTAMP('2017-09-14 11:20:11','YYYY-MM-DD HH24:MI:SS'),100,'N','N','D',1,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','Y','N','N','N','N','N','Y','N','ShipTo Contact Default','',0,0,TO_TIMESTAMP('2017-09-14 11:20:11','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2017-09-14T11:20:11.884 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=557165 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2017-09-14T11:20:14.866 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('ad_user','ALTER TABLE public.AD_User ADD COLUMN IsShipToContact_Default CHAR(1) DEFAULT ''N'' CHECK (IsShipToContact_Default IN (''Y'',''N'')) NOT NULL') ; -- 2017-09-14T11:37:44.043 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Index_Table (AD_Client_ID,AD_Index_Table_ID,AD_Org_ID,AD_Table_ID,BeforeChangeCode,BeforeChangeCodeType,BeforeChangeWarning,Created,CreatedBy,EntityType,ErrorMsg,IsActive,IsUnique,Name,Processing,Updated,UpdatedBy,WhereClause) VALUES (0,540407,0,114,'IsBillContact_Default=''N''','SQLS','Möchten sie wirklich die Standard Verkaufskontakt ändern?',TO_TIMESTAMP('2017-09-14 11:37:43','YYYY-MM-DD HH24:MI:SS'),100,'D','Es darf nur eine Standard Verkaufskontakt aktiviert sein. Bei Änderung wird bei der vorherigen Standard Verkaufskontakt automatisch der Haken entfernt.','Y','Y','AD_User_IsBillContact_Default','N',TO_TIMESTAMP('2017-09-14 11:37:43','YYYY-MM-DD HH24:MI:SS'),100,'C_BPartner_ID IS NOT NULL AND IsBillContact_Default=''Y'' AND IsActive=''Y''') ; -- 2017-09-14T11:37:44.047 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Index_Table_Trl (AD_Language,AD_Index_Table_ID, ErrorMsg, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Index_Table_ID, t.ErrorMsg, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Index_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Index_Table_ID=540407 AND NOT EXISTS (SELECT 1 FROM AD_Index_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Index_Table_ID=t.AD_Index_Table_ID) ; -- 2017-09-14T11:38:03.192 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Index_Column (AD_Client_ID,AD_Column_ID,AD_Index_Column_ID,AD_Index_Table_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,5844,540811,540407,0,TO_TIMESTAMP('2017-09-14 11:38:03','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',10,TO_TIMESTAMP('2017-09-14 11:38:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-09-14T11:38:18.170 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Index_Column (AD_Client_ID,AD_Column_ID,AD_Index_Column_ID,AD_Index_Table_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,557164,540812,540407,0,TO_TIMESTAMP('2017-09-14 11:38:18','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',20,TO_TIMESTAMP('2017-09-14 11:38:18','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-09-14T11:41:51.348 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Index_Table SET BeforeChangeCode='IsBillToContact_Default=''N''', WhereClause='C_BPartner_ID IS NOT NULL AND IsBillToContact_Default=''Y'' AND IsActive=''Y''',Updated=TO_TIMESTAMP('2017-09-14 11:41:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Index_Table_ID=540407 ; -- 2017-09-14T11:41:58.611 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator CREATE UNIQUE INDEX AD_User_IsBillContact_Default ON AD_User (C_BPartner_ID,IsBillToContact_Default) WHERE C_BPartner_ID IS NOT NULL AND IsBillToContact_Default='Y' AND IsActive='Y' ; -- 2017-09-14T11:41:58.623 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator CREATE OR REPLACE FUNCTION AD_User_IsBillContact_Default_tgfn() RETURNS TRIGGER AS $AD_User_IsBillContact_Default_tg$ BEGIN IF TG_OP='INSERT' THEN UPDATE AD_User SET IsBillToContact_Default='N', Updated=NEW.Updated, UpdatedBy=NEW.UpdatedBy WHERE 1=1 AND C_BPartner_ID=NEW.C_BPartner_ID AND IsBillToContact_Default=NEW.IsBillToContact_Default AND AD_User_ID<>NEW.AD_User_ID AND C_BPartner_ID IS NOT NULL AND IsBillToContact_Default='Y' AND IsActive='Y'; ELSE IF OLD.C_BPartner_ID<>NEW.C_BPartner_ID OR OLD.IsBillToContact_Default<>NEW.IsBillToContact_Default THEN UPDATE AD_User SET IsBillToContact_Default='N', Updated=NEW.Updated, UpdatedBy=NEW.UpdatedBy WHERE 1=1 AND C_BPartner_ID=NEW.C_BPartner_ID AND IsBillToContact_Default=NEW.IsBillToContact_Default AND AD_User_ID<>NEW.AD_User_ID AND C_BPartner_ID IS NOT NULL AND IsBillToContact_Default='Y' AND IsActive='Y'; END IF; END IF; RETURN NEW; END; $AD_User_IsBillContact_Default_tg$ LANGUAGE plpgsql; ; -- 2017-09-14T11:41:58.636 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DROP TRIGGER IF EXISTS AD_User_IsBillContact_Default_tg ON AD_User ; -- 2017-09-14T11:41:58.637 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator CREATE TRIGGER AD_User_IsBillContact_Default_tg BEFORE INSERT OR UPDATE ON AD_User FOR EACH ROW EXECUTE PROCEDURE AD_User_IsBillContact_Default_tgfn() ; -- 2017-09-14T11:44:10.898 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Index_Table (AD_Client_ID,AD_Index_Table_ID,AD_Org_ID,AD_Table_ID,BeforeChangeCode,BeforeChangeCodeType,BeforeChangeWarning,Created,CreatedBy,EntityType,ErrorMsg,IsActive,IsUnique,Name,Processing,Updated,UpdatedBy,WhereClause) VALUES (0,540408,0,114,'_IsShipToContact_Default=''N''','SQLS','Möchten sie wirklich die Standard ShipTo ändern?',TO_TIMESTAMP('2017-09-14 11:44:10','YYYY-MM-DD HH24:MI:SS'),100,'D','','Y','Y','AD_User_IsShipToContact_Default','N',TO_TIMESTAMP('2017-09-14 11:44:10','YYYY-MM-DD HH24:MI:SS'),100,'C_BPartner_ID IS NOT NULL AND _IsShipToContact_Default=''Y'' AND IsActive=''Y''') ; -- 2017-09-14T11:44:10.902 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Index_Table_Trl (AD_Language,AD_Index_Table_ID, ErrorMsg, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Index_Table_ID, t.ErrorMsg, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Index_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Index_Table_ID=540408 AND NOT EXISTS (SELECT 1 FROM AD_Index_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Index_Table_ID=t.AD_Index_Table_ID) ; -- 2017-09-14T11:44:18.935 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Index_Column (AD_Client_ID,AD_Column_ID,AD_Index_Column_ID,AD_Index_Table_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,5844,540813,540408,0,TO_TIMESTAMP('2017-09-14 11:44:18','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',10,TO_TIMESTAMP('2017-09-14 11:44:18','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-09-14T11:44:33.653 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Index_Column (AD_Client_ID,AD_Column_ID,AD_Index_Column_ID,AD_Index_Table_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,557165,540814,540408,0,TO_TIMESTAMP('2017-09-14 11:44:33','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',20,TO_TIMESTAMP('2017-09-14 11:44:33','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-09-14T11:44:50.411 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Index_Table SET BeforeChangeCode='IsShipToContact_Default=''N''', WhereClause='C_BPartner_ID IS NOT NULL AND IsShipToContact_Default=''Y'' AND IsActive=''Y''',Updated=TO_TIMESTAMP('2017-09-14 11:44:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Index_Table_ID=540408 ; -- 2017-09-14T11:44:52.273 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator CREATE UNIQUE INDEX AD_User_IsShipToContact_Default ON AD_User (C_BPartner_ID,IsShipToContact_Default) WHERE C_BPartner_ID IS NOT NULL AND IsShipToContact_Default='Y' AND IsActive='Y' ; -- 2017-09-14T11:44:52.281 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator CREATE OR REPLACE FUNCTION AD_User_IsShipToContact_Default_tgfn() RETURNS TRIGGER AS $AD_User_IsShipToContact_Default_tg$ BEGIN IF TG_OP='INSERT' THEN UPDATE AD_User SET IsShipToContact_Default='N', Updated=NEW.Updated, UpdatedBy=NEW.UpdatedBy WHERE 1=1 AND C_BPartner_ID=NEW.C_BPartner_ID AND IsShipToContact_Default=NEW.IsShipToContact_Default AND AD_User_ID<>NEW.AD_User_ID AND C_BPartner_ID IS NOT NULL AND IsShipToContact_Default='Y' AND IsActive='Y'; ELSE IF OLD.C_BPartner_ID<>NEW.C_BPartner_ID OR OLD.IsShipToContact_Default<>NEW.IsShipToContact_Default THEN UPDATE AD_User SET IsShipToContact_Default='N', Updated=NEW.Updated, UpdatedBy=NEW.UpdatedBy WHERE 1=1 AND C_BPartner_ID=NEW.C_BPartner_ID AND IsShipToContact_Default=NEW.IsShipToContact_Default AND AD_User_ID<>NEW.AD_User_ID AND C_BPartner_ID IS NOT NULL AND IsShipToContact_Default='Y' AND IsActive='Y'; END IF; END IF; RETURN NEW; END; $AD_User_IsShipToContact_Default_tg$ LANGUAGE plpgsql; ; -- 2017-09-14T11:44:52.285 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DROP TRIGGER IF EXISTS AD_User_IsShipToContact_Default_tg ON AD_User ; -- 2017-09-14T11:44:52.285 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator CREATE TRIGGER AD_User_IsShipToContact_Default_tg BEFORE INSERT OR UPDATE ON AD_User FOR EACH ROW EXECUTE PROCEDURE AD_User_IsShipToContact_Default_tgfn() ; -- 2017-09-14T11:45:18.992 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Index_Table SET BeforeChangeWarning='Möchten sie wirklich die default BillTo ändern?',Updated=TO_TIMESTAMP('2017-09-14 11:45:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Index_Table_ID=540407 ; -- 2017-09-14T11:45:28.441 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Index_Table SET ErrorMsg='darf nur eine Standard Verkaufskontakt aktiviert sein. Bei Änderung wird bei der vorherigen Standard Verkaufskontakt automatisch der Haken entfernt.',Updated=TO_TIMESTAMP('2017-09-14 11:45:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Index_Table_ID=540407 ; -- 2017-09-14T11:46:05.978 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Index_Table SET ErrorMsg='Only one default BillTo contact may be activated. If changed, the previous standard sales contact automatically removes the hook.',Updated=TO_TIMESTAMP('2017-09-14 11:46:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Index_Table_ID=540407 ; -- 2017-09-14T11:46:13.554 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Index_Table SET ErrorMsg='Only one default ShipTo contact may be activated. If changed, the previous standard sales contact automatically removes the hook.',Updated=TO_TIMESTAMP('2017-09-14 11:46:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Index_Table_ID=540408 ; -- 2017-09-14T11:47:40.211 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,557164,559901,0,496,0,TO_TIMESTAMP('2017-09-14 11:47:40','YYYY-MM-DD HH24:MI:SS'),100,0,'D',0,'Y','Y','Y','Y','N','N','N','N','N','BillTo Contact Default',290,285,0,1,1,TO_TIMESTAMP('2017-09-14 11:47:40','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-09-14T11:47:40.217 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559901 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2017-09-14T11:47:52.052 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,557165,559902,0,496,0,TO_TIMESTAMP('2017-09-14 11:47:51','YYYY-MM-DD HH24:MI:SS'),100,0,'D',0,'Y','Y','Y','Y','N','N','N','N','Y','ShipTo Contact Default',290,285,0,1,1,TO_TIMESTAMP('2017-09-14 11:47:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-09-14T11:47:52.054 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559902 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2017-09-14T12:08:40.939 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Element_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayed_SideList,IsDisplayedGrid,Name,SeqNo,SeqNo_SideList,SeqNoGrid,Updated,UpdatedBy) VALUES (0,559901,0,496,548438,1000035,TO_TIMESTAMP('2017-09-14 12:08:40','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','BillTo Contact',12,0,0,TO_TIMESTAMP('2017-09-14 12:08:40','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-09-14T12:09:21.414 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Element_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayed_SideList,IsDisplayedGrid,Name,SeqNo,SeqNo_SideList,SeqNoGrid,Updated,UpdatedBy) VALUES (0,559902,0,496,548439,1000035,TO_TIMESTAMP('2017-09-14 12:09:21','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','ShipTo Contact Default',12,0,0,TO_TIMESTAMP('2017-09-14 12:09:21','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-09-14T12:09:45.496 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-09-14 12:09:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000312 ; -- 2017-09-14T12:09:53.175 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-09-14 12:09:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548438 ; -- 2017-09-14T12:09:58.294 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-09-14 12:09:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548439 ; -- 2017-09-14T12:10:01.366 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-09-14 12:10:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000316 ; -- 2017-09-14T12:10:04.582 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-09-14 12:10:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544832 ; -- 2017-09-14T12:10:08.293 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-09-14 12:10:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000313 ; -- 2017-09-14T12:10:11.454 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-09-14 12:10:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000317 ; -- 2017-09-14T12:10:14.336 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-09-14 12:10:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544833 ; -- 2017-09-14T12:10:19.414 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-09-14 12:10:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000320 ; -- 2017-09-14T12:10:25.624 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-09-14 12:10:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000309 ; -- 2017-09-14T12:11:15.386 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Rechnungskontakt',Updated=TO_TIMESTAMP('2017-09-14 12:11:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548438 ; -- 2017-09-14T12:11:26.618 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Lieferkontakt',Updated=TO_TIMESTAMP('2017-09-14 12:11:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548439 ; -- 2017-09-14T12:11:43.032 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Lieferkontakt',Updated=TO_TIMESTAMP('2017-09-14 12:11:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559902 ; -- 2017-09-14T12:13:27.887 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Rechnungskontakt',Updated=TO_TIMESTAMP('2017-09-14 12:13:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559901 ; -- 2017-09-14T12:14:11.478 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET Name='Rechnungskontakt', PrintName='Rechnungskontakt',Updated=TO_TIMESTAMP('2017-09-14 12:14:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543418 ; -- 2017-09-14T12:14:11.481 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='IsBillToContact_Default', Name='Rechnungskontakt', Description=NULL, Help=NULL WHERE AD_Element_ID=543418 ; -- 2017-09-14T12:14:11.514 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsBillToContact_Default', Name='Rechnungskontakt', Description=NULL, Help=NULL, AD_Element_ID=543418 WHERE UPPER(ColumnName)='ISBILLTOCONTACT_DEFAULT' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2017-09-14T12:14:11.519 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsBillToContact_Default', Name='Rechnungskontakt', Description=NULL, Help=NULL WHERE AD_Element_ID=543418 AND IsCentrallyMaintained='Y' ; -- 2017-09-14T12:14:11.520 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Rechnungskontakt', Description=NULL, Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=543418) AND IsCentrallyMaintained='Y' ; -- 2017-09-14T12:14:11.534 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Rechnungskontakt', Name='Rechnungskontakt' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=543418) ; -- 2017-09-14T12:14:30.234 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET Name='Lieferkontakt', PrintName='Lieferkontakt',Updated=TO_TIMESTAMP('2017-09-14 12:14:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543417 ; -- 2017-09-14T12:14:30.237 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='IsShipToContact_Default', Name='Lieferkontakt', Description=NULL, Help=NULL WHERE AD_Element_ID=543417 ; -- 2017-09-14T12:14:30.248 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsShipToContact_Default', Name='Lieferkontakt', Description=NULL, Help=NULL, AD_Element_ID=543417 WHERE UPPER(ColumnName)='ISSHIPTOCONTACT_DEFAULT' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2017-09-14T12:14:30.249 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsShipToContact_Default', Name='Lieferkontakt', Description=NULL, Help=NULL WHERE AD_Element_ID=543417 AND IsCentrallyMaintained='Y' ; -- 2017-09-14T12:14:30.250 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Lieferkontakt', Description=NULL, Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=543417) AND IsCentrallyMaintained='Y' ; -- 2017-09-14T12:14:30.262 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Lieferkontakt', Name='Lieferkontakt' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=543417) ;
the_stack
-- 2020-04-14T14:18:43.799Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID, AD_Org_ID, AD_Process_ID, AD_Process_Para_ID, AD_Reference_ID, ColumnName, Created, CreatedBy, DefaultValue, EntityType, FieldLength, IsActive, IsAutocomplete, IsCentrallyMaintained, IsEncrypted, IsMandatory, IsRange, Name, SeqNo, Updated, UpdatedBy) VALUES (0, 0, 540399, 541797, 20, 'show_only_pricelist_instructions', TO_TIMESTAMP('2020-04-14 17:18:43', 'YYYY-MM-DD HH24:MI:SS'), 100, 'Y', 'U', 0, 'Y', 'N', 'Y', 'N', 'N', 'N', 'p_show_only_pricelist_instructions', 50, TO_TIMESTAMP('2020-04-14 17:18:43', 'YYYY-MM-DD HH24:MI:SS'), 100) ; -- 2020-04-14T14:18:43.802Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language, AD_Process_Para_ID, Description, Help, Name, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description, t.Help, t.Name, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y' AND l.IsBaseLanguage = 'N') AND t.AD_Process_Para_ID = 541797 AND NOT EXISTS(SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Process_Para_ID = t.AD_Process_Para_ID) ; -- 2020-04-14T14:18:58.484Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET EntityType='de.metas.fresh', Updated=TO_TIMESTAMP('2020-04-14 17:18:58', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Process_Para_ID = 541797 ; -- 2020-04-14T14:52:17.606Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID, AD_Element_ID, AD_Org_ID, Created, CreatedBy, EntityType, IsActive, Name, PrintName, Updated, UpdatedBy) VALUES (0, 577666, 0, TO_TIMESTAMP('2020-04-14 17:52:17', 'YYYY-MM-DD HH24:MI:SS'), 100, 'U', 'Y', 'Show Only Packing Instructions With Price', 'Show Only Packing Instructions With Price', TO_TIMESTAMP('2020-04-14 17:52:17', 'YYYY-MM-DD HH24:MI:SS'), 100) ; -- 2020-04-14T14:52:17.610Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language, AD_Element_ID, CommitWarning, Description, Help, Name, PO_Description, PO_Help, PO_Name, PO_PrintName, PrintName, WEBUI_NameBrowse, WEBUI_NameNew, WEBUI_NameNewBreadcrumb, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning, t.Description, t.Help, t.Name, t.PO_Description, t.PO_Help, t.PO_Name, t.PO_PrintName, t.PrintName, t.WEBUI_NameBrowse, t.WEBUI_NameNew, t.WEBUI_NameNewBreadcrumb, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y' OR l.IsBaseLanguage = 'Y') AND t.AD_Element_ID = 577666 AND NOT EXISTS(SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Element_ID = t.AD_Element_ID) ; -- 2020-04-14T14:52:23.296Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name=' Nur Packanweisungen mit Preis anzeigen', PrintName=' Nur Packanweisungen mit Preis anzeigen', Updated=TO_TIMESTAMP('2020-04-14 17:52:23', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 AND AD_Language = 'de_CH' ; -- 2020-04-14T14:52:23.336Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666, 'de_CH') ; -- 2020-04-14T14:52:25.983Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name=' Nur Packanweisungen mit Preis anzeigen', PrintName=' Nur Packanweisungen mit Preis anzeigen', Updated=TO_TIMESTAMP('2020-04-14 17:52:25', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 AND AD_Language = 'de_DE' ; -- 2020-04-14T14:52:25.985Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666, 'de_DE') ; -- 2020-04-14T14:52:26.019Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577666, 'de_DE') ; -- 2020-04-14T14:52:26.021Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName=NULL, Name=' Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-14T14:52:26.021Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName=NULL, Name=' Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 AND IsCentrallyMaintained = 'Y' ; -- 2020-04-14T14:52:26.022Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name=' Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID = 577666) AND AD_Name_ID IS NULL) OR (AD_Name_ID = 577666) ; -- 2020-04-14T14:52:26.039Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName=' Nur Packanweisungen mit Preis anzeigen', Name=' Nur Packanweisungen mit Preis anzeigen' WHERE IsCentrallyMaintained = 'Y' AND EXISTS(SELECT * FROM AD_Column c WHERE c.AD_Column_ID = pi.AD_Column_ID AND c.AD_Element_ID = 577666) ; -- 2020-04-14T14:52:26.044Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name=' Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-14T14:52:26.045Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name=' Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-14T14:52:26.045Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = ' Nur Packanweisungen mit Preis anzeigen', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-14T14:52:29.324Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Updated=TO_TIMESTAMP('2020-04-14 17:52:29', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 AND AD_Language = 'de_DE' ; -- 2020-04-14T14:52:29.325Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666, 'de_DE') ; -- 2020-04-14T14:52:29.333Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577666, 'de_DE') ; -- 2020-04-14T14:52:47.852Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Nur Packanweisungen mit Preis anzeigen', PrintName='Nur Packanweisungen mit Preis anzeigen', Updated=TO_TIMESTAMP('2020-04-14 17:52:47', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 AND AD_Language = 'de_CH' ; -- 2020-04-14T14:52:47.853Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666, 'de_CH') ; -- 2020-04-14T14:52:52.754Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Nur Packanweisungen mit Preis anzeigen', PrintName='Nur Packanweisungen mit Preis anzeigen', Updated=TO_TIMESTAMP('2020-04-14 17:52:52', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 AND AD_Language = 'de_DE' ; -- 2020-04-14T14:52:52.755Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666, 'de_DE') ; -- 2020-04-14T14:52:52.760Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577666, 'de_DE') ; -- 2020-04-14T14:52:52.762Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName=NULL, Name='Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-14T14:52:52.762Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName=NULL, Name='Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 AND IsCentrallyMaintained = 'Y' ; -- 2020-04-14T14:52:52.763Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID = 577666) AND AD_Name_ID IS NULL) OR (AD_Name_ID = 577666) ; -- 2020-04-14T14:52:52.774Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Nur Packanweisungen mit Preis anzeigen', Name='Nur Packanweisungen mit Preis anzeigen' WHERE IsCentrallyMaintained = 'Y' AND EXISTS(SELECT * FROM AD_Column c WHERE c.AD_Column_ID = pi.AD_Column_ID AND c.AD_Element_ID = 577666) ; -- 2020-04-14T14:52:52.775Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-14T14:52:52.776Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-14T14:52:52.776Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Nur Packanweisungen mit Preis anzeigen', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-14T14:53:05.901Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='show_only_pricelist_instructions', Updated=TO_TIMESTAMP('2020-04-14 17:53:05', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 ; -- 2020-04-14T14:53:05.903Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='show_only_pricelist_instructions', Name='Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-14T14:53:05.903Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='show_only_pricelist_instructions', Name='Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL, AD_Element_ID=577666 WHERE UPPER(ColumnName) = 'SHOW_ONLY_PRICELIST_INSTRUCTIONS' AND IsCentrallyMaintained = 'Y' AND AD_Element_ID IS NULL ; -- 2020-04-14T14:53:05.904Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='show_only_pricelist_instructions', Name='Nur Packanweisungen mit Preis anzeigen', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 AND IsCentrallyMaintained = 'Y' ; -- 2020-04-14T14:54:21.472Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.fresh', Updated=TO_TIMESTAMP('2020-04-14 17:54:21', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 ; -- 2020-04-14T14:55:29.100Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID, AD_Element_ID, AD_Org_ID, AD_Process_ID, AD_Process_Para_ID, AD_Reference_ID, ColumnName, Created, CreatedBy, DefaultValue, EntityType, FieldLength, IsActive, IsAutocomplete, IsCentrallyMaintained, IsEncrypted, IsMandatory, IsRange, Name, SeqNo, Updated, UpdatedBy) VALUES (0, 577666, 0, 540407, 541798, 20, 'show_only_pricelist_instructions', TO_TIMESTAMP('2020-04-14 17:55:28', 'YYYY-MM-DD HH24:MI:SS'), 100, 'Y', 'de.metas.fresh', 0, 'Y', 'N', 'Y', 'N', 'N', 'N', 'Nur Packanweisungen mit Preis anzeigen', 60, TO_TIMESTAMP('2020-04-14 17:55:28', 'YYYY-MM-DD HH24:MI:SS'), 100) ; -- 2020-04-14T14:55:29.103Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language, AD_Process_Para_ID, Description, Help, Name, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description, t.Help, t.Name, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y' AND l.IsBaseLanguage = 'N') AND t.AD_Process_Para_ID = 541798 AND NOT EXISTS(SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Process_Para_ID = t.AD_Process_Para_ID) ; -- 2020-04-14T14:55:53.399Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID, AD_Element_ID, AD_Org_ID, AD_Process_ID, AD_Process_Para_ID, AD_Reference_ID, ColumnName, Created, CreatedBy, DefaultValue, EntityType, FieldLength, IsActive, IsAutocomplete, IsCentrallyMaintained, IsEncrypted, IsMandatory, IsRange, Name, SeqNo, Updated, UpdatedBy) VALUES (0, 577666, 0, 584673, 541799, 20, 'show_only_pricelist_instructions', TO_TIMESTAMP('2020-04-14 17:55:53', 'YYYY-MM-DD HH24:MI:SS'), 100, 'Y', 'de.metas.fresh', 0, 'Y', 'N', 'Y', 'N', 'N', 'N', 'Nur Packanweisungen mit Preis anzeigen', 60, TO_TIMESTAMP('2020-04-14 17:55:53', 'YYYY-MM-DD HH24:MI:SS'), 100) ; -- 2020-04-14T14:55:53.400Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language, AD_Process_Para_ID, Description, Help, Name, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description, t.Help, t.Name, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y' AND l.IsBaseLanguage = 'N') AND t.AD_Process_Para_ID = 541799 AND NOT EXISTS(SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Process_Para_ID = t.AD_Process_Para_ID) ; -- 2020-04-14T15:32:28.026Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID, AD_Element_ID, AD_Org_ID, AD_Process_ID, AD_Process_Para_ID, AD_Reference_ID, ColumnName, Created, CreatedBy, DefaultValue, EntityType, FieldLength, IsActive, IsAutocomplete, IsCentrallyMaintained, IsEncrypted, IsMandatory, IsRange, Name, SeqNo, Updated, UpdatedBy) VALUES (0, 577666, 0, 584659, 541800, 20, 'show_only_pricelist_instructions', TO_TIMESTAMP('2020-04-14 18:32:27', 'YYYY-MM-DD HH24:MI:SS'), 100, 'Y', 'de.metas.fresh', 0, 'Y', 'N', 'Y', 'N', 'N', 'N', 'Nur Packanweisungen mit Preis anzeigen', 60, TO_TIMESTAMP('2020-04-14 18:32:27', 'YYYY-MM-DD HH24:MI:SS'), 100) ; -- 2020-04-14T15:32:28.030Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language, AD_Process_Para_ID, Description, Help, Name, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description, t.Help, t.Name, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y' AND l.IsBaseLanguage = 'N') AND t.AD_Process_Para_ID = 541800 AND NOT EXISTS(SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Process_Para_ID = t.AD_Process_Para_ID) ; -- 2020-04-14T15:34:06.840Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM report.fresh_pricelist_details_template_report(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/NULL@, @show_only_pricelist_instructions@) where show_only_pricelist_instructions = ''N'' UNION ALL SELECT * FROM report.fresh_pricelist_details_template_report_2(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/NULL@, @show_only_pricelist_instructions@) where show_only_pricelist_instructions = ''Y'';', Updated=TO_TIMESTAMP('2020-04-14 18:34:06', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Process_ID = 584659 ; -- 2020-04-14T15:45:41.450Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM report.fresh_pricelist_details_template_report(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/0@, @show_only_pricelist_instructions@) where show_only_pricelist_instructions = ''N'' UNION ALL SELECT * FROM report.fresh_pricelist_details_template_report_2(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/0@, @show_only_pricelist_instructions@) where show_only_pricelist_instructions = ''Y'';', Updated=TO_TIMESTAMP('2020-04-14 18:45:41', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Process_ID = 584659 ; -- 2020-04-14T15:46:48.526Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM report.fresh_pricelist_details_template_report(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/0@, @show_only_pricelist_instructions@)', Updated=TO_TIMESTAMP('2020-04-14 18:46:48', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Process_ID = 584659 ; -- 2020-04-14T15:46:52.631Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM report.fresh_pricelist_details_template_report(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/0@, @show_only_pricelist_instructions@);', Updated=TO_TIMESTAMP('2020-04-14 18:46:52', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Process_ID = 584659 ; -- 2020-04-14T15:47:05.870Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM report.fresh_pricelist_details_template_report(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/NULL@, @show_only_pricelist_instructions@);', Updated=TO_TIMESTAMP('2020-04-14 18:47:05', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Process_ID = 584659 ; -- 2020-04-14T15:47:28.167Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM report.fresh_pricelist_details_template_report(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/0@, @show_only_pricelist_instructions@) where show_only_pricelist_instructions = ''N'' UNION ALL SELECT * FROM report.fresh_pricelist_details_template_report_2(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/0@, @show_only_pricelist_instructions@) where show_only_pricelist_instructions = ''Y'';', Updated=TO_TIMESTAMP('2020-04-14 18:47:28', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Process_ID = 584659 ; -- 2020-04-15T09:14:19.776Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='All packing instructions', PrintName='All packing instructions', Updated=TO_TIMESTAMP('2020-04-15 12:14:19', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 AND AD_Language = 'en_US' ; -- 2020-04-15T09:14:19.812Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666, 'en_US') ; -- 2020-04-15T09:14:37.933Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='All Packing Instructions', PrintName='All Packing Instructions', Updated=TO_TIMESTAMP('2020-04-15 12:14:37', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 AND AD_Language = 'en_US' ; -- 2020-04-15T09:14:37.935Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666, 'en_US') ; -- 2020-04-15T09:14:46.581Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Alle Packvorschriften', PrintName='Alle Packvorschriften', Updated=TO_TIMESTAMP('2020-04-15 12:14:46', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 AND AD_Language = 'nl_NL' ; -- 2020-04-15T09:14:46.582Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666, 'nl_NL') ; -- 2020-04-15T09:14:50.109Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Alle Packvorschriften', PrintName='Alle Packvorschriften', Updated=TO_TIMESTAMP('2020-04-15 12:14:50', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 AND AD_Language = 'de_DE' ; -- 2020-04-15T09:14:50.111Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666, 'de_DE') ; -- 2020-04-15T09:14:50.123Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577666, 'de_DE') ; -- 2020-04-15T09:14:50.130Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='show_only_pricelist_instructions', Name='Alle Packvorschriften', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-15T09:14:50.131Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='show_only_pricelist_instructions', Name='Alle Packvorschriften', Description=NULL, Help=NULL, AD_Element_ID=577666 WHERE UPPER(ColumnName) = 'SHOW_ONLY_PRICELIST_INSTRUCTIONS' AND IsCentrallyMaintained = 'Y' AND AD_Element_ID IS NULL ; -- 2020-04-15T09:14:50.134Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='show_only_pricelist_instructions', Name='Alle Packvorschriften', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 AND IsCentrallyMaintained = 'Y' ; -- 2020-04-15T09:14:50.135Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Alle Packvorschriften', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID = 577666) AND AD_Name_ID IS NULL) OR (AD_Name_ID = 577666) ; -- 2020-04-15T09:14:50.162Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Alle Packvorschriften', Name='Alle Packvorschriften' WHERE IsCentrallyMaintained = 'Y' AND EXISTS(SELECT * FROM AD_Column c WHERE c.AD_Column_ID = pi.AD_Column_ID AND c.AD_Element_ID = 577666) ; -- 2020-04-15T09:14:50.165Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Alle Packvorschriften', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-15T09:14:50.166Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Alle Packvorschriften', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-15T09:14:50.167Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Alle Packvorschriften', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-15T09:14:54.949Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='All Packing Instructions', PrintName='All Packing Instructions', Updated=TO_TIMESTAMP('2020-04-15 12:14:54', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 AND AD_Language = 'nl_NL' ; -- 2020-04-15T09:14:54.951Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666, 'nl_NL') ; -- 2020-04-15T09:15:11.109Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Alle Packvorschriften', PrintName='Alle Packvorschriften', Updated=TO_TIMESTAMP('2020-04-15 12:15:11', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 AND AD_Language = 'de_CH' ; -- 2020-04-15T09:15:11.111Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666, 'de_CH') ; -- 2020-04-15T09:19:27.461Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='p_show_product_price_pi_flag', Updated=TO_TIMESTAMP('2020-04-15 12:19:27', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 577666 ; -- 2020-04-15T09:19:27.463Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='p_show_product_price_pi_flag', Name='Alle Packvorschriften', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-15T09:19:27.464Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='p_show_product_price_pi_flag', Name='Alle Packvorschriften', Description=NULL, Help=NULL, AD_Element_ID=577666 WHERE UPPER(ColumnName) = 'P_SHOW_PRODUCT_PRICE_PI_FLAG' AND IsCentrallyMaintained = 'Y' AND AD_Element_ID IS NULL ; -- 2020-04-15T09:19:27.465Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='p_show_product_price_pi_flag', Name='Alle Packvorschriften', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 AND IsCentrallyMaintained = 'Y' ; -- 2020-04-15T09:52:10.139Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM report.fresh_pricelist_details_template_report(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/0@, @p_show_product_price_pi_flag@) where show_product_price_pi_flag = ''N'' UNION ALL SELECT * FROM report.fresh_pricelist_details_template_report_2(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/0@, @p_show_product_price_pi_flag@) where show_product_price_pi_flag = ''Y'';', Updated=TO_TIMESTAMP('2020-04-15 12:52:10', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Process_ID = 584659 ; -- 2020-04-15T10:30:02.724Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM report.fresh_pricelist_details_template_report(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/0@, @p_show_product_price_pi_flag@) where show_product_price_pi_flag = ''N'' UNION ALL SELECT * FROM report.fresh_pricelist_details_template_report_With_PP_PI(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/0@, @p_show_product_price_pi_flag@) where show_product_price_pi_flag = ''Y'';', Updated=TO_TIMESTAMP('2020-04-15 13:30:02', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Process_ID = 584659 ; -- 2020-04-15T10:53:11.089Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM report.fresh_pricelist_details_template_report(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/NULL@, @p_show_product_price_pi_flag/NULL@) where show_product_price_pi_flag = ''N'' UNION ALL SELECT * FROM report.fresh_pricelist_details_template_report_With_PP_PI(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/NULL@, @p_show_product_price_pi_flag/NULL@) where show_product_price_pi_flag = ''Y'';', Updated=TO_TIMESTAMP('2020-04-15 13:53:11', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Process_ID = 584659 ; -- 2020-04-15T10:53:52.353Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID, AD_Element_ID, AD_Org_ID, AD_Process_ID, AD_Process_Para_ID, AD_Reference_ID, ColumnName, Created, CreatedBy, DefaultValue, EntityType, FieldLength, IsActive, IsAutocomplete, IsCentrallyMaintained, IsEncrypted, IsMandatory, IsRange, Name, SeqNo, Updated, UpdatedBy) VALUES (0, 577666, 0, 584680, 541801, 20, 'p_show_product_price_pi_flag', TO_TIMESTAMP('2020-04-15 13:53:52', 'YYYY-MM-DD HH24:MI:SS'), 100, 'Y', 'de.metas.fresh', 0, 'Y', 'N', 'Y', 'N', 'N', 'N', 'Alle Packvorschriften', 40, TO_TIMESTAMP('2020-04-15 13:53:52', 'YYYY-MM-DD HH24:MI:SS'), 100) ; -- 2020-04-15T10:53:52.359Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language, AD_Process_Para_ID, Description, Help, Name, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description, t.Help, t.Name, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y' AND l.IsBaseLanguage = 'N') AND t.AD_Process_Para_ID = 541801 AND NOT EXISTS(SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Process_Para_ID = t.AD_Process_Para_ID) ; -- 2020-04-15T10:54:36.028Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID, AD_Element_ID, AD_Org_ID, AD_Process_ID, AD_Process_Para_ID, AD_Reference_ID, ColumnName, Created, CreatedBy, EntityType, FieldLength, IsActive, IsAutocomplete, IsCentrallyMaintained, IsEncrypted, IsMandatory, IsRange, Name, SeqNo, Updated, UpdatedBy, VFormat) VALUES (0, 577666, 0, 541230, 541802, 20, 'p_show_product_price_pi_flag', TO_TIMESTAMP('2020-04-15 13:54:35', 'YYYY-MM-DD HH24:MI:SS'), 100, 'de.metas.fresh', 0, 'Y', 'N', 'Y', 'N', 'N', 'N', 'Alle Packvorschriften', 40, TO_TIMESTAMP('2020-04-15 13:54:35', 'YYYY-MM-DD HH24:MI:SS'), 100, 'Y') ; -- 2020-04-15T10:54:36.029Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language, AD_Process_Para_ID, Description, Help, Name, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description, t.Help, t.Name, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y' AND l.IsBaseLanguage = 'N') AND t.AD_Process_Para_ID = 541802 AND NOT EXISTS(SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Process_Para_ID = t.AD_Process_Para_ID) ; -- 2020-04-15T13:56:23.601Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM report.fresh_pricelist_details_template_report(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/NULL@, ''@p_show_product_price_pi_flag/NULL@'') where show_product_price_pi_flag = ''N'' UNION ALL SELECT * FROM report.fresh_pricelist_details_template_report_With_PP_PI(@C_BPartner_ID/NULL@, @M_PriceList_Version_ID/NULL@,''@#AD_Language@'',@C_BPartner_Location_ID/NULL@, ''@p_show_product_price_pi_flag/NULL@'') where show_product_price_pi_flag = ''Y'';',Updated=TO_TIMESTAMP('2020-04-15 16:56:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584659 ; -- 2020-04-15T14:34:35.508Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Preisliste Packvorschriften', PrintName='Preisliste Packvorschriften',Updated=TO_TIMESTAMP('2020-04-15 17:34:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577666 AND AD_Language='de_CH' ; -- 2020-04-15T14:34:35.545Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666,'de_CH') ; -- 2020-04-15T14:34:40.563Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Preisliste Packvorschriften', PrintName='Preisliste Packvorschriften',Updated=TO_TIMESTAMP('2020-04-15 17:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577666 AND AD_Language='de_DE' ; -- 2020-04-15T14:34:40.564Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666,'de_DE') ; -- 2020-04-15T14:34:40.590Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577666,'de_DE') ; -- 2020-04-15T14:34:40.596Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='p_show_product_price_pi_flag', Name='Preisliste Packvorschriften', Description=NULL, Help=NULL WHERE AD_Element_ID=577666 ; -- 2020-04-15T14:34:40.597Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='p_show_product_price_pi_flag', Name='Preisliste Packvorschriften', Description=NULL, Help=NULL, AD_Element_ID=577666 WHERE UPPER(ColumnName)='P_SHOW_PRODUCT_PRICE_PI_FLAG' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-04-15T14:34:40.598Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='p_show_product_price_pi_flag', Name='Preisliste Packvorschriften', Description=NULL, Help=NULL WHERE AD_Element_ID=577666 AND IsCentrallyMaintained='Y' ; -- 2020-04-15T14:34:40.598Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Preisliste Packvorschriften', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577666) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577666) ; -- 2020-04-15T14:34:40.610Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Preisliste Packvorschriften', Name='Preisliste Packvorschriften' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577666) ; -- 2020-04-15T14:34:40.611Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Preisliste Packvorschriften', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-15T14:34:40.612Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Preisliste Packvorschriften', Description=NULL, Help=NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-15T14:34:40.613Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Preisliste Packvorschriften', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577666 ; -- 2020-04-15T14:34:51.028Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Pricelist Instructions', PrintName='Pricelist Instructions',Updated=TO_TIMESTAMP('2020-04-15 17:34:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577666 AND AD_Language='en_US' ; -- 2020-04-15T14:34:51.029Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666,'en_US') ; -- 2020-04-15T14:40:53.161Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Pricelist Packing Instructions', PrintName='Pricelist Packing Instructions',Updated=TO_TIMESTAMP('2020-04-15 17:40:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577666 AND AD_Language='en_US' ; -- 2020-04-15T14:40:53.162Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577666,'en_US') ; DROP VIEW IF EXISTS rv_fresh_pricelist; DROP VIEW IF EXISTS RV_fresh_PriceList_Comparison; CREATE OR REPLACE VIEW RV_fresh_PriceList_Comparison AS SELECT pp.AD_Org_ID, pp.AD_Client_ID, pp.Created, pp.CreatedBy, pp.Updated, pp.UpdatedBy, pp.IsActive, -- Displayed pricelist data pc.Name AS ProductCategory, pc.value AS ProductCategoryValue, p.M_Product_ID, p.Value, p.Name AS ProductName, pp.IsSeasonFixedPrice, hupip.Name AS ItemProductName, pm.Name AS PackingMaterialName, ROUND(COALESCE(ppa.PriceStd, pp.PriceStd), coalesce(pl.priceprecision, 2)) AS PriceStd, ROUND(pp2.PriceStd, coalesce(pl2.priceprecision, 2)) AS AltPriceStd, CASE WHEN pp2.PriceStd IS NULL THEN 0 ELSE 1 END AS hasaltprice, uom.UOMSymbol, COALESCE(ppa.Attributes, '') as attributes, pp.seqNo, -- Filter Columns bp.C_BPartner_ID, plv.M_Pricelist_Version_ID, plv2.M_Pricelist_Version_ID AS Alt_PriceList_Version_ID, -- Additional internal infos to be used pp.M_ProductPrice_ID, ppa.m_attributesetinstance_ID, bp_ip.M_HU_PI_Item_Product_ID as M_HU_PI_Item_Product_ID, uom.X12DE355 as UOM_X12DE355, hupip.Qty as QtyCUsPerTU, it.m_hu_pi_version_id AS m_hu_pi_version_id, c.iso_code as currency, c2.iso_code as currency2 FROM M_ProductPrice pp INNER JOIN M_Product p ON pp.M_Product_ID = p.M_Product_ID AND p.isActive = 'Y' /** Get all BPartner and Product combinations. * IMPORTANT: Never use the query without BPartner Filter active */ INNER JOIN C_BPartner bp ON TRUE INNER JOIN M_Product_Category pc ON p.M_Product_Category_ID = pc.M_Product_Category_ID AND pc.isActive = 'Y' INNER JOIN C_UOM uom ON pp.C_UOM_ID = uom.C_UOM_ID AND uom.isActive = 'Y' /* * We know if there are packing instructions limited to the BPartner/product-combination. If so, * we will use only those. If not, we will use only the non limited ones */ LEFT OUTER JOIN LATERAL ( SELECT vip.M_HU_PI_Item_Product_ID, vip.hasPartner FROM Report.Valid_PI_Item_Product_V vip /* WHERE isInfiniteCapacity = 'N' task 09045/09788: we can also export PiiPs with infinite capacity */ WHERE p.M_Product_ID = vip.M_Product_ID AND CASE WHEN EXISTS(select 0 from Report.Valid_PI_Item_Product_V v where p.M_Product_ID = v.M_Product_ID AND v.hasPartner is true and bp.C_BPartner_ID = v.C_BPartner_ID) THEN vip.C_BPartner_ID = bp.C_BPartner_ID else vip.C_BPartner_ID IS NULL END ) bp_ip ON TRUE LEFT OUTER JOIN LATERAL ( SELECT M_ProductPrice_ID, M_Attributesetinstance_ID, PriceStd, IsActive, M_HU_PI_Item_Product_ID, Attributes, Signature FROM report.fresh_AttributePrice ppa WHERE ppa.isActive = 'Y' AND ppa.M_ProductPrice_ID = pp.M_ProductPrice_ID AND (ppa.m_hu_pi_item_product_id = bp_ip.m_hu_pi_item_product_id OR ppa.m_hu_pi_item_product_id IS NULL) AND ppa.m_pricelist_version_id = pp.m_pricelist_version_id ) ppa on true LEFT OUTER JOIN m_hu_pi_item_product hupip ON bp_ip.m_hu_pi_item_product_ID = hupip.m_hu_pi_item_product_id and hupip.isActive = 'Y' LEFT OUTER JOIN m_hu_pi_item it ON hupip.M_HU_PI_Item_ID = it.M_HU_PI_Item_ID AND it.isActive = 'Y' LEFT OUTER JOIN m_hu_pi_item pmit ON it.m_hu_pi_version_id = pmit.m_hu_pi_version_id AND pmit.itemtype::TEXT = 'PM'::TEXT AND pmit.isActive = 'Y' LEFT OUTER JOIN m_hu_packingmaterial pm ON pmit.m_hu_packingmaterial_id = pm.m_hu_packingmaterial_id AND pm.isActive = 'Y' INNER JOIN M_PriceList_Version plv ON pp.M_PriceList_Version_ID = plv.M_PriceList_Version_ID AND plv.IsActive = 'Y' /* Get Comparison Prices */ /* Get all PriceList_Versions of the PriceList (we need all available PriceList_Version_IDs for outside filtering) limited to the same PriceList because the Parameter validation rule is enforcing this */ LEFT JOIN M_PriceList_Version plv2 ON plv.M_PriceList_ID = plv2.M_PriceList_ID AND plv2.IsActive = 'Y' LEFT OUTER JOIN LATERAL ( SELECT COALESCE(ppa2.PriceStd, pp2.PriceStd) AS PriceStd, ppa2.signature FROM M_ProductPrice pp2 /* Joining attribute prices */ INNER JOIN report.fresh_AttributePrice ppa2 ON pp2.M_ProductPrice_ID = ppa2.M_ProductPrice_ID AND ppa2.m_pricelist_version_id = pp2.m_pricelist_version_id WHERE p.M_Product_ID = pp2.M_Product_ID AND pp2.M_Pricelist_Version_ID = plv2.M_Pricelist_Version_ID AND pp2.IsActive = 'Y' AND (pp2.m_hu_pi_item_product_ID = pp.m_hu_pi_item_product_ID OR (pp2.m_hu_pi_item_product_ID is null and pp.m_hu_pi_item_product_ID is null)) AND pp2.isAttributeDependant = pp.isAttributeDependant --avoid comparing different prices in same pricelist AND (CASE WHEN pp2.M_PriceList_Version_ID = pp.M_PriceList_Version_ID THEN pp2.M_ProductPrice_ID = pp.M_ProductPrice_ID ELSE TRUE END) /* we have to make sure that only prices with the same attributes and packing instructions are compared. Note: * - If there is an Existing Attribute Price but no signature related columns are filled the signature will be '' * - If there are no Attribute Prices the signature will be null * This is important, because otherwise an empty attribute price will be compared to the regular price AND the alternate attribute price */ AND (ppa.signature = ppa2.signature) AND ppa2.IsActive = 'Y' AND (ppa2.m_hu_pi_item_product_id = bp_ip.m_hu_pi_item_product_id OR ppa2.m_hu_pi_item_product_id IS NULL) ) pp2 ON true INNER JOIN M_Pricelist pl ON plv.M_Pricelist_ID = pl.M_PriceList_ID AND pl.isActive = 'Y' LEFT JOIN M_Pricelist pl2 ON plv2.M_PriceList_ID = pl2.M_Pricelist_ID AND pl2.isActive = 'Y' INNER JOIN C_Currency c ON pl.C_Currency_ID = c.C_Currency_ID AND c.isActive = 'Y' LEFT JOIN C_Currency c2 ON pl2.C_Currency_ID = c2.C_CUrrency_ID AND c2.isActive = 'Y' WHERE pp.isActive = 'Y' AND (pp.M_Attributesetinstance_ID = ppa.M_Attributesetinstance_ID OR pp.M_Attributesetinstance_ID is null) AND (pp.M_HU_PI_Item_Product_ID = bp_ip.M_HU_PI_Item_Product_ID OR pp.M_HU_PI_Item_Product_ID is null) AND (case when plv2.M_PriceList_Version_ID = plv.M_PriceList_Version_ID THEN ppa.signature = pp2.signature ELSE true end) ; COMMENT ON VIEW RV_fresh_PriceList_Comparison IS '06042 Preisliste Drucken Preisänderung (100373416918) Refactored in Tasks 07833 and 07915 A view for a report that displays the same data as RV_fresh_PriceList but imroved to be able to filter by two Price list versions, to be able to compare them'; CREATE OR REPLACE VIEW RV_fresh_PriceList AS SELECT -- Mandatory Columns plc.AD_Org_ID, plc.AD_Client_ID, plc.Created, plc.CreatedBy, plc.Updated, plc.UpdatedBy, plc.IsActive, -- Displayed pricelist data plc.ProductCategory, plc.ProductCategoryValue, plc.M_Product_ID, plc.Value, plc.ProductName, plc.IsSeasonFixedPrice, plc.ItemProductName, plc.PackingMaterialName, plc.PriceStd, plc.AltPriceStd, plc.HasAltPrice, plc.UOMSymbol, plc.Attributes, -- Filter Columns plc.C_BPartner_ID, plc.M_Pricelist_Version_ID, plc.M_ProductPrice_ID FROM RV_fresh_PriceList_Comparison plc WHERE plc.M_Pricelist_Version_ID = plc.Alt_PriceList_Version_ID ; COMMENT ON VIEW RV_fresh_PriceList IS '05956 Printformat for Pricelist (109054740508) Refactored in Task 07833 and 07915 A view for a report that displays all product prices of a BPartner, including the attribute prices and CU:TU relation'; DROP VIEW IF EXISTS RV_fresh_PriceList_Comparison_With_PP_PI; CREATE OR REPLACE VIEW RV_fresh_PriceList_Comparison_With_PP_PI AS SELECT pp.AD_Org_ID, pp.AD_Client_ID, pp.Created, pp.CreatedBy, pp.Updated, pp.UpdatedBy, pp.IsActive, -- Displayed pricelist data pc.Name AS ProductCategory, pc.value AS ProductCategoryValue, p.M_Product_ID, p.Value, p.Name AS ProductName, pp.IsSeasonFixedPrice, hupip.Name AS ItemProductName, pm.Name AS PackingMaterialName, ROUND(COALESCE(ppa.PriceStd, pp.PriceStd), coalesce(pl.priceprecision, 2)) AS PriceStd, ROUND(pp2.PriceStd, coalesce(pl2.priceprecision, 2)) AS AltPriceStd, CASE WHEN pp2.PriceStd IS NULL THEN 0 ELSE 1 END AS hasaltprice, uom.UOMSymbol, COALESCE(ppa.Attributes, '') as attributes, pp.seqNo, -- Filter Columns bp.C_BPartner_ID, plv.M_Pricelist_Version_ID, plv2.M_Pricelist_Version_ID AS Alt_PriceList_Version_ID, -- Additional internal infos to be used pp.M_ProductPrice_ID, ppa.m_attributesetinstance_ID, -- pp.m_hu_pi_item_product_id as PP_M_HU_PI_Item_Product_ID, pp.M_HU_PI_Item_Product_ID as M_HU_PI_Item_Product_ID, uom.X12DE355 as UOM_X12DE355, hupip.Qty as QtyCUsPerTU, it.m_hu_pi_version_id AS m_hu_pi_version_id, c.iso_code as currency, c2.iso_code as currency2 FROM M_ProductPrice pp INNER JOIN M_Product p ON pp.M_Product_ID = p.M_Product_ID AND p.isActive = 'Y' /** Get all BPartner and Product combinations. * IMPORTANT: Never use the query without BPartner Filter active */ INNER JOIN C_BPartner bp ON TRUE INNER JOIN M_Product_Category pc ON p.M_Product_Category_ID = pc.M_Product_Category_ID AND pc.isActive = 'Y' INNER JOIN C_UOM uom ON pp.C_UOM_ID = uom.C_UOM_ID AND uom.isActive = 'Y' /* * We know if there are packing instructions limited to the BPartner/product-combination. If so, * we will use only those. If not, we will use only the non limited ones */ LEFT OUTER JOIN LATERAL ( SELECT vip.M_HU_PI_Item_Product_ID, vip.hasPartner FROM Report.Valid_PI_Item_Product_V vip /* WHERE isInfiniteCapacity = 'N' task 09045/09788: we can also export PiiPs with infinite capacity */ WHERE p.M_Product_ID = vip.M_Product_ID AND CASE WHEN EXISTS(select 0 from Report.Valid_PI_Item_Product_V v where p.M_Product_ID = v.M_Product_ID AND v.hasPartner is true and bp.C_BPartner_ID = v.C_BPartner_ID) THEN vip.C_BPartner_ID = bp.C_BPartner_ID else vip.C_BPartner_ID IS NULL END ) bp_ip ON TRUE LEFT OUTER JOIN LATERAL ( SELECT M_ProductPrice_ID, M_Attributesetinstance_ID, PriceStd, IsActive, M_HU_PI_Item_Product_ID, Attributes, Signature FROM report.fresh_AttributePrice ppa WHERE ppa.isActive = 'Y' AND ppa.M_ProductPrice_ID = pp.M_ProductPrice_ID AND (ppa.m_hu_pi_item_product_id = bp_ip.m_hu_pi_item_product_id OR ppa.m_hu_pi_item_product_id IS NULL) AND ppa.m_pricelist_version_id = pp.m_pricelist_version_id ) ppa on true LEFT OUTER JOIN m_hu_pi_item_product hupip ON pp.m_hu_pi_item_product_ID = hupip.m_hu_pi_item_product_id and hupip.isActive = 'Y' LEFT OUTER JOIN m_hu_pi_item it ON hupip.M_HU_PI_Item_ID = it.M_HU_PI_Item_ID AND it.isActive = 'Y' LEFT OUTER JOIN m_hu_pi_item pmit ON it.m_hu_pi_version_id = pmit.m_hu_pi_version_id AND pmit.itemtype::TEXT = 'PM'::TEXT AND pmit.isActive = 'Y' LEFT OUTER JOIN m_hu_packingmaterial pm ON pmit.m_hu_packingmaterial_id = pm.m_hu_packingmaterial_id AND pm.isActive = 'Y' INNER JOIN M_PriceList_Version plv ON pp.M_PriceList_Version_ID = plv.M_PriceList_Version_ID AND plv.IsActive = 'Y' /* Get Comparison Prices */ /* Get all PriceList_Versions of the PriceList (we need all available PriceList_Version_IDs for outside filtering) limited to the same PriceList because the Parameter validation rule is enforcing this */ LEFT JOIN M_PriceList_Version plv2 ON plv.M_PriceList_ID = plv2.M_PriceList_ID AND plv2.IsActive = 'Y' LEFT OUTER JOIN LATERAL ( SELECT COALESCE(ppa2.PriceStd, pp2.PriceStd) AS PriceStd, ppa2.signature FROM M_ProductPrice pp2 /* Joining attribute prices */ INNER JOIN report.fresh_AttributePrice ppa2 ON pp2.M_ProductPrice_ID = ppa2.M_ProductPrice_ID AND ppa2.m_pricelist_version_id = pp2.m_pricelist_version_id WHERE p.M_Product_ID = pp2.M_Product_ID AND pp2.M_Pricelist_Version_ID = plv2.M_Pricelist_Version_ID AND pp2.IsActive = 'Y' AND (pp2.m_hu_pi_item_product_ID = pp.m_hu_pi_item_product_ID OR (pp2.m_hu_pi_item_product_ID is null and pp.m_hu_pi_item_product_ID is null)) AND pp2.isAttributeDependant = pp.isAttributeDependant --avoid comparing different prices in same pricelist AND (CASE WHEN pp2.M_PriceList_Version_ID = pp.M_PriceList_Version_ID THEN pp2.M_ProductPrice_ID = pp.M_ProductPrice_ID ELSE TRUE END) /* we have to make sure that only prices with the same attributes and packing instructions are compared. Note: * - If there is an Existing Attribute Price but no signature related columns are filled the signature will be '' * - If there are no Attribute Prices the signature will be null * This is important, because otherwise an empty attribute price will be compared to the regular price AND the alternate attribute price */ AND (ppa.signature = ppa2.signature) AND ppa2.IsActive = 'Y' AND (ppa2.m_hu_pi_item_product_id = bp_ip.m_hu_pi_item_product_id OR ppa2.m_hu_pi_item_product_id IS NULL) ) pp2 ON true INNER JOIN M_Pricelist pl ON plv.M_Pricelist_ID = pl.M_PriceList_ID AND pl.isActive = 'Y' LEFT JOIN M_Pricelist pl2 ON plv2.M_PriceList_ID = pl2.M_Pricelist_ID AND pl2.isActive = 'Y' INNER JOIN C_Currency c ON pl.C_Currency_ID = c.C_Currency_ID AND c.isActive = 'Y' LEFT JOIN C_Currency c2 ON pl2.C_Currency_ID = c2.C_CUrrency_ID AND c2.isActive = 'Y' WHERE pp.isActive = 'Y' AND (pp.M_Attributesetinstance_ID = ppa.M_Attributesetinstance_ID OR pp.M_Attributesetinstance_ID is null) AND (pp.M_HU_PI_Item_Product_ID = bp_ip.M_HU_PI_Item_Product_ID OR pp.M_HU_PI_Item_Product_ID is null) AND (case when plv2.M_PriceList_Version_ID = plv.M_PriceList_Version_ID THEN ppa.signature = pp2.signature ELSE true end) GROUP BY pp.M_ProductPrice_ID, pp.AD_Client_ID, pp.Created, pp.CreatedBy, pp.Updated, pp.UpdatedBy, pp.IsActive, pc.Name, pc.value, p.M_Product_ID, p.Value, p.Name, pp.IsSeasonFixedPrice, hupip.Name, pm.Name, ROUND(COALESCE(ppa.PriceStd, pp.PriceStd), coalesce(pl.priceprecision, 2)), ROUND(pp2.PriceStd, coalesce(pl2.priceprecision, 2)), CASE WHEN pp2.PriceStd IS NULL THEN 0 ELSE 1 END, uom.UOMSymbol, COALESCE(ppa.Attributes, ''), pp.seqNo, bp.C_BPartner_ID, plv.M_Pricelist_Version_ID, plv2.M_Pricelist_Version_ID, pp.AD_Org_ID, ppa.m_attributesetinstance_ID, pp.M_HU_PI_Item_Product_ID, uom.X12DE355, hupip.Qty, it.m_hu_pi_version_id, c.iso_code, c2.iso_code ; DROP FUNCTION IF EXISTS report.fresh_PriceList_Details_Report(numeric, numeric, numeric, character varying) ; DROP FUNCTION IF EXISTS report.fresh_PriceList_Details_Report(numeric, numeric, numeric, character varying, text) ; CREATE OR REPLACE FUNCTION report.fresh_pricelist_details_report(IN p_c_bpartner_id numeric, IN p_m_pricelist_version_id numeric, IN p_alt_pricelist_version_id numeric, IN p_ad_language character varying, IN p_show_product_price_pi_flag text) RETURNS TABLE ( bp_value text, bp_name text, productcategory text, m_product_id integer, value text, customerproductnumber text, productname text, isseasonfixedprice character, itemproductname character varying, qtycuspertu numeric, packingmaterialname text, pricestd numeric, altpricestd numeric, hasaltprice integer, uomsymbol text, uom_x12de355 text, attributes text, m_productprice_id integer, m_attributesetinstance_id integer, m_hu_pi_item_product_id integer, currency character(3), currency2 character(3), show_product_price_pi_flag text ) AS $BODY$ -- SELECT -- bp.value AS BP_Value, bp.name AS BP_Name, plc.ProductCategory, plc.M_Product_ID::integer, plc.Value, bpp.ProductNo AS CustomerProductNumber, COALESCE(pt.name, plc.ProductName) AS ProductName, plc.IsSeasonFixedPrice, CASE WHEN plc.m_hu_pi_version_id = 101 THEN NULL ELSE plc.ItemProductName END AS ItemProductName, plc.QtyCUsPerTU, plc.PackingMaterialName, plc.PriceStd, plc.AltPriceStd, plc.HasAltPrice, plc.UOMSymbol, plc.UOM_X12DE355::text, CASE WHEN p_ad_language = 'fr_CH' THEN Replace(plc.Attributes, 'AdR', 'DLR') ELSE plc.Attributes END AS Attributes, plc.M_ProductPrice_ID::integer, plc.M_AttributeSetInstance_ID::integer, plc.M_HU_PI_Item_Product_ID::integer, plc.currency AS currency, plc.currency2 AS currency2, p_show_product_price_pi_flag as show_product_price_pi_flag FROM RV_fresh_PriceList_Comparison plc LEFT OUTER JOIN M_Product_Trl pt ON plc.M_Product_ID = pt.M_Product_ID AND AD_Language = p_ad_language AND pt.isActive = 'Y' LEFT OUTER JOIN C_BPartner bp ON plc.C_BPartner_ID = bp.C_BPartner_ID AND bp.isActive = 'Y' LEFT OUTER JOIN C_BPartner_Product bpp ON bp.C_BPartner_ID = bpp.C_BPartner_ID AND plc.M_Product_ID = bpp.M_Product_ID AND bpp.isActive = 'Y' WHERE TRUE AND plc.C_BPartner_ID = p_c_bpartner_id AND plc.M_Pricelist_Version_ID = p_m_pricelist_version_id AND plc.Alt_Pricelist_Version_ID = coalesce(p_alt_pricelist_version_id, plc.m_pricelist_version_id) AND CASE WHEN p_alt_pricelist_version_id IS NOT NULL THEN PriceStd != 0 ELSE PriceStd != 0 OR AltPriceStd != 0 END ORDER BY plc.ProductCategoryValue, plc.ProductName, plc.seqNo, plc.attributes, plc.ItemProductName; -- $BODY$ LANGUAGE sql STABLE COST 100 ROWS 1000 ; DROP FUNCTION IF EXISTS report.fresh_PriceList_Details_Report_With_PP_PI(numeric, numeric, numeric, character varying, text) ; CREATE OR REPLACE FUNCTION report.fresh_pricelist_details_report_With_PP_PI(IN p_c_bpartner_id numeric, IN p_m_pricelist_version_id numeric, IN p_alt_pricelist_version_id numeric, IN p_ad_language character varying, IN p_show_product_price_pi_flag text) RETURNS TABLE ( bp_value text, bp_name text, productcategory text, m_product_id integer, value text, customerproductnumber text, productname text, isseasonfixedprice character, itemproductname character varying, qtycuspertu numeric, packingmaterialname text, pricestd numeric, altpricestd numeric, hasaltprice integer, uomsymbol text, uom_x12de355 text, attributes text, m_productprice_id integer, m_attributesetinstance_id integer, m_hu_pi_item_product_id integer, currency character(3), currency2 character(3), show_product_price_pi_flag text ) AS $BODY$ -- SELECT -- bp.value AS BP_Value, bp.name AS BP_Name, plc.ProductCategory, plc.M_Product_ID::integer, plc.Value, bpp.ProductNo AS CustomerProductNumber, COALESCE(pt.name, plc.ProductName) AS ProductName, plc.IsSeasonFixedPrice, CASE WHEN plc.m_hu_pi_version_id = 101 THEN NULL ELSE plc.ItemProductName END AS ItemProductName, plc.QtyCUsPerTU, plc.PackingMaterialName, plc.PriceStd, plc.AltPriceStd, plc.HasAltPrice, plc.UOMSymbol, plc.UOM_X12DE355::text, CASE WHEN p_ad_language = 'fr_CH' THEN Replace(plc.Attributes, 'AdR', 'DLR') ELSE plc.Attributes END AS Attributes, plc.M_ProductPrice_ID::integer, plc.M_AttributeSetInstance_ID::integer, plc.M_HU_PI_Item_Product_ID::integer, plc.currency AS currency, plc.currency2 AS currency2, p_show_product_price_pi_flag as show_product_price_pi_flag FROM RV_fresh_PriceList_Comparison_With_PP_PI plc LEFT OUTER JOIN M_Product_Trl pt ON plc.M_Product_ID = pt.M_Product_ID AND AD_Language = p_ad_language AND pt.isActive = 'Y' LEFT OUTER JOIN C_BPartner bp ON plc.C_BPartner_ID = bp.C_BPartner_ID AND bp.isActive = 'Y' LEFT OUTER JOIN C_BPartner_Product bpp ON bp.C_BPartner_ID = bpp.C_BPartner_ID AND plc.M_Product_ID = bpp.M_Product_ID AND bpp.isActive = 'Y' WHERE TRUE AND plc.C_BPartner_ID = p_c_bpartner_id AND plc.M_Pricelist_Version_ID = p_m_pricelist_version_id AND plc.Alt_Pricelist_Version_ID = coalesce(p_alt_pricelist_version_id, plc.m_pricelist_version_id) AND CASE WHEN p_alt_pricelist_version_id IS NOT NULL THEN PriceStd != 0 ELSE PriceStd != 0 OR AltPriceStd != 0 END ORDER BY plc.ProductCategoryValue, plc.ProductName, plc.seqNo, plc.attributes, plc.ItemProductName; -- $BODY$ LANGUAGE sql STABLE COST 100 ROWS 1000 ; DROP FUNCTION IF EXISTS report.fresh_pricelist_details_template_report(NUMERIC, NUMERIC, CHARACTER VARYING, NUMERIC); DROP FUNCTION IF EXISTS report.fresh_pricelist_details_template_report(NUMERIC, NUMERIC, CHARACTER VARYING, NUMERIC, text); CREATE OR REPLACE FUNCTION report.fresh_pricelist_details_template_report(IN p_c_bpartner_id numeric, IN p_m_pricelist_version_id numeric, IN p_ad_language character varying, IN p_c_bpartner_location_id numeric, IN p_show_product_price_pi_flag text) RETURNS TABLE ( prodvalue text, customerproductnumber text, productcategory text, productname text, attributes text, itemproductname text, qty numeric, uomsymbol text, pricestd text, m_productprice_id integer, c_bpartner_id numeric, m_hu_pi_item_product_id integer, uom_x12de355 text, c_bpartner_location_id numeric, qtycuspertu numeric, m_product_id integer, bp_value text, bp_name text, reportfilename text, show_product_price_pi_flag text ) AS $BODY$ -- SELECT plc.value AS prodvalue, plc.customerproductnumber as customerproductnumber, plc.productcategory as productcategory, plc.productname as productname, plc.attributes as attributes, replace(hupip.name, hupiv.name, pi.Name) as itemproductname, NULL::numeric as qty, plc.uomsymbol as uomsymbol, to_char(plc.pricestd, getPricePattern(prl.priceprecision::integer)) as pricestd, plc.M_ProductPrice_ID as m_productprice_id, p_c_bpartner_id as c_bpartner_id, plc.M_HU_PI_Item_Product_ID as m_hu_pi_item_product_id, case when plc.m_hu_pi_item_product_id is not null then 'COLI' else plc.uom_x12de355 end as uom_x12de355, p_c_bpartner_location_id as c_bpartner_location_id, plc.qtycuspertu as qtycuspertu, plc.m_product_id as m_product_id, plc.BP_Value as bp_value, plc.BP_Name as bp_name, CONCAT(bp_value, '_', bp_name, '_', case when prlv.isactive = 'Y' then prlv.validfrom::date else null end, '.xls') as reportfilename, p_show_product_price_pi_flag as show_product_price_pi_flag FROM report.fresh_PriceList_Details_Report(p_c_bpartner_id, p_m_pricelist_version_id, NULL, p_ad_language, p_show_product_price_pi_flag) plc LEFT OUTER JOIN M_HU_PI_Item_Product hupip on hupip.M_HU_PI_Item_Product_ID = plc.M_HU_PI_Item_Product_ID LEFT OUTER JOIN M_HU_PI_Item hupii on hupii.M_HU_PI_Item_ID = hupip.M_HU_PI_Item_ID LEFT OUTER JOIN M_HU_PI_Version hupiv on hupiv.M_HU_PI_Version_ID = hupii.M_HU_PI_Version_ID LEFT OUTER JOIN M_HU_PI pi on pi.M_HU_PI_ID = hupiv.M_HU_PI_ID LEFT OUTER JOIN M_Pricelist_Version prlv on prlv.m_pricelist_version_id = p_m_pricelist_version_id LEFT OUTER JOIN M_Pricelist prl on prlv.m_pricelist_id = prl.m_pricelist_id LEFT OUTER JOIN M_HU_PackingMaterial pmt on plc.m_product_id = pmt.m_product_id LEFT OUTER JOIN M_ProductPrice ppr on ppr.m_product_id = pmt.m_product_id $BODY$ LANGUAGE sql STABLE; DROP FUNCTION IF EXISTS report.fresh_pricelist_details_template_report_With_PP_PI(NUMERIC, NUMERIC, CHARACTER VARYING, NUMERIC, text); CREATE OR REPLACE FUNCTION report.fresh_pricelist_details_template_report_With_PP_PI(IN p_c_bpartner_id numeric, IN p_m_pricelist_version_id numeric, IN p_ad_language character varying, IN p_c_bpartner_location_id numeric, IN p_show_product_price_pi_flag text) RETURNS TABLE ( prodvalue text, customerproductnumber text, productcategory text, productname text, attributes text, itemproductname text, qty numeric, uomsymbol text, pricestd text, m_productprice_id integer, c_bpartner_id numeric, m_hu_pi_item_product_id integer, uom_x12de355 text, c_bpartner_location_id numeric, qtycuspertu numeric, m_product_id integer, bp_value text, bp_name text, reportfilename text, show_product_price_pi_flag text ) AS $BODY$ -- SELECT plc.value AS prodvalue, plc.customerproductnumber as customerproductnumber, plc.productcategory as productcategory, plc.productname as productname, plc.attributes as attributes, replace(hupip.name, hupiv.name, pi.Name) as itemproductname, NULL::numeric as qty, plc.uomsymbol as uomsymbol, to_char(plc.pricestd, getPricePattern(prl.priceprecision::integer)) as pricestd, plc.M_ProductPrice_ID as m_productprice_id, p_c_bpartner_id as c_bpartner_id, plc.M_HU_PI_Item_Product_ID as m_hu_pi_item_product_id, case when plc.m_hu_pi_item_product_id is not null then 'COLI' else plc.uom_x12de355 end as uom_x12de355, p_c_bpartner_location_id as c_bpartner_location_id, plc.qtycuspertu as qtycuspertu, plc.m_product_id as m_product_id, plc.BP_Value as bp_value, plc.BP_Name as bp_name, CONCAT(bp_value, '_', bp_name, '_', case when prlv.isactive = 'Y' then prlv.validfrom::date else null end, '.xls') as reportfilename, p_show_product_price_pi_flag as show_product_price_pi_flag FROM report.fresh_PriceList_Details_Report_With_PP_PI(p_c_bpartner_id, p_m_pricelist_version_id, NULL, p_ad_language, p_show_product_price_pi_flag) plc LEFT OUTER JOIN M_HU_PI_Item_Product hupip on hupip.M_HU_PI_Item_Product_ID = plc.M_HU_PI_Item_Product_ID LEFT OUTER JOIN M_HU_PI_Item hupii on hupii.M_HU_PI_Item_ID = hupip.M_HU_PI_Item_ID LEFT OUTER JOIN M_HU_PI_Version hupiv on hupiv.M_HU_PI_Version_ID = hupii.M_HU_PI_Version_ID LEFT OUTER JOIN M_HU_PI pi on pi.M_HU_PI_ID = hupiv.M_HU_PI_ID LEFT OUTER JOIN M_Pricelist_Version prlv on prlv.m_pricelist_version_id = p_m_pricelist_version_id LEFT OUTER JOIN M_Pricelist prl on prlv.m_pricelist_id = prl.m_pricelist_id LEFT OUTER JOIN M_HU_PackingMaterial pmt on plc.m_product_id = pmt.m_product_id LEFT OUTER JOIN M_ProductPrice ppr on ppr.m_product_id = pmt.m_product_id $BODY$ LANGUAGE sql STABLE; DROP FUNCTION IF EXISTS report.Current_Vs_Previous_Pricelist_Comparison_Report(p_C_BPartner_ID numeric, p_C_BP_Group_ID numeric, p_IsSoTrx text, p_AD_Language text) ; DROP FUNCTION IF EXISTS report.Current_Vs_Previous_Pricelist_Comparison_Report(p_C_BPartner_ID numeric, p_C_BP_Group_ID numeric, p_IsSoTrx text, p_AD_Language text, p_show_product_price_pi_flag text) ; CREATE OR REPLACE FUNCTION report.Current_Vs_Previous_Pricelist_Comparison_Report(p_C_BPartner_ID numeric = NULL, p_C_BP_Group_ID numeric = NULL, p_IsSoTrx text = 'Y', p_AD_Language TEXT = 'en_US', p_show_product_price_pi_flag text = 'Y') RETURNS TABLE ( bp_value text, bp_name text, ProductCategory text, M_Product_ID integer, value text, CustomerProductNumber text, ProductName text, IsSeasonFixedPrice text, ItemProductName text, qtycuspertu numeric, packingmaterialname text, pricestd numeric, altpricestd numeric, hasaltprice integer, uomsymbol text, uom_x12de355 text, Attributes text, m_productprice_id integer, m_attributesetinstance_id integer, m_hu_pi_item_product_id integer, currency text, currency2 text, validFromPLV1 timestamp, validFromPLV2 timestamp, namePLV1 text, namePLV2 text, c_bpartner_location_id numeric, AD_Org_ID numeric, show_product_price_pi_flag text ) AS $$ WITH PriceListVersionsByValidFrom AS ( SELECT t.* FROM (SELECT -- plv.c_bpartner_id, plv.m_pricelist_version_id, plv.validfrom, plv.name, row_number() OVER (PARTITION BY plv.c_bpartner_id ORDER BY plv.validfrom DESC, plv.m_pricelist_version_id DESC) rank FROM Report.Fresh_PriceList_Version_Val_Rule plv WHERE TRUE AND plv.validfrom <= now() AND plv.issotrx = p_IsSoTrx AND (p_C_BPartner_ID IS NULL OR plv.c_bpartner_id = p_C_BPartner_ID) AND (p_C_BP_Group_ID IS NULL OR plv.c_bpartner_id IN (SELECT DISTINCT b.c_bpartner_id FROM c_bpartner b WHERE b.c_bp_group_id = p_C_BP_Group_ID)) ORDER BY TRUE, plv.validfrom DESC, plv.m_pricelist_version_id DESC) t WHERE t.rank <= 2 ), currentAndPreviousPLV AS ( -- implementation detail: all these sub-selects would be better implemented with a pivot. Unfortunately i cant understand how pivots work. SELECT DISTINCT -- plvv.c_bpartner_id, (SELECT plvv2.m_pricelist_version_id FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 1 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) PLV1_ID, (SELECT plvv2.m_pricelist_version_id FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 2 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) PLV2_ID, (SELECT plvv2.validfrom FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 1 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) validFromPLV1, (SELECT plvv2.validfrom FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 2 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) validFromPLV2, (SELECT plvv2.name FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 1 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) namePLV1, (SELECT plvv2.name FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 2 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) namePLV2 FROM PriceListVersionsByValidFrom plvv ORDER BY plvv.c_bpartner_id ), result AS ( SELECT t.*, plv.validFromPLV1, plv.validFromPLV2, plv.namePLV1, plv.namePLV2, (SELECT bpl.c_bpartner_location_id FROM c_bpartner_location bpl WHERE bpl.c_bpartner_id = plv.c_bpartner_id ORDER BY bpl.isbilltodefault DESC LIMIT 1) c_bpartner_location_id, (SELECT plv2.ad_org_id FROM m_pricelist_version plv2 WHERE plv2.m_pricelist_version_id = plv.PLV1_ID) AD_Org_ID FROM currentAndPreviousPLV plv INNER JOIN LATERAL report.fresh_PriceList_Details_Report( plv.c_bpartner_id, plv.PLV1_ID, plv.PLV2_ID, p_AD_Language, p_show_product_price_pi_flag ) AS t ON TRUE ) SELECT -- r.bp_value, r.bp_name, r.productcategory, r.m_product_id, r.value, r.customerproductnumber, r.productname, r.isseasonfixedprice::text, r.itemproductname, r.qtycuspertu, r.packingmaterialname, r.pricestd, r.altpricestd, r.hasaltprice, r.uomsymbol, r.uom_x12de355, r.attributes, r.m_productprice_id, r.m_attributesetinstance_id, r.m_hu_pi_item_product_id, r.currency::text, r.currency2::text, r.validFromPLV1, r.validFromPLV2, r.namePLV1, r.namePLV2, r.c_bpartner_location_id, r.AD_Org_ID, p_show_product_price_pi_flag as show_product_price_pi_flag FROM result r ORDER BY TRUE, r.bp_value, r.productCategory, r.value $$ LANGUAGE sql STABLE ; /* How to run - All Bpartners SELECT * FROM report.Current_Vs_Previous_Pricelist_Comparison_Report() ; - Specific Bpartner SELECT * FROM report.Current_Vs_Previous_Pricelist_Comparison_Report(2156515) ; */ DROP FUNCTION IF EXISTS report.Current_Vs_Previous_Pricelist_Comparison_Report_With_PP_PI(p_C_BPartner_ID numeric, p_C_BP_Group_ID numeric, p_IsSoTrx text, p_AD_Language text, p_show_product_price_pi_flag text) ; CREATE OR REPLACE FUNCTION report.Current_Vs_Previous_Pricelist_Comparison_Report_With_PP_PI(p_C_BPartner_ID numeric = NULL, p_C_BP_Group_ID numeric = NULL, p_IsSoTrx text = 'Y', p_AD_Language TEXT = 'en_US', p_show_product_price_pi_flag text = 'Y') RETURNS TABLE ( bp_value text, bp_name text, ProductCategory text, M_Product_ID integer, value text, CustomerProductNumber text, ProductName text, IsSeasonFixedPrice text, ItemProductName text, qtycuspertu numeric, packingmaterialname text, pricestd numeric, altpricestd numeric, hasaltprice integer, uomsymbol text, uom_x12de355 text, Attributes text, m_productprice_id integer, m_attributesetinstance_id integer, m_hu_pi_item_product_id integer, currency text, currency2 text, validFromPLV1 timestamp, validFromPLV2 timestamp, namePLV1 text, namePLV2 text, c_bpartner_location_id numeric, AD_Org_ID numeric, show_product_price_pi_flag text ) AS $$ WITH PriceListVersionsByValidFrom AS ( SELECT t.* FROM (SELECT -- plv.c_bpartner_id, plv.m_pricelist_version_id, plv.validfrom, plv.name, row_number() OVER (PARTITION BY plv.c_bpartner_id ORDER BY plv.validfrom DESC, plv.m_pricelist_version_id DESC) rank FROM Report.Fresh_PriceList_Version_Val_Rule plv WHERE TRUE AND plv.validfrom <= now() AND plv.issotrx = p_IsSoTrx AND (p_C_BPartner_ID IS NULL OR plv.c_bpartner_id = p_C_BPartner_ID) AND (p_C_BP_Group_ID IS NULL OR plv.c_bpartner_id IN (SELECT DISTINCT b.c_bpartner_id FROM c_bpartner b WHERE b.c_bp_group_id = p_C_BP_Group_ID)) ORDER BY TRUE, plv.validfrom DESC, plv.m_pricelist_version_id DESC) t WHERE t.rank <= 2 ), currentAndPreviousPLV AS ( -- implementation detail: all these sub-selects would be better implemented with a pivot. Unfortunately i cant understand how pivots work. SELECT DISTINCT -- plvv.c_bpartner_id, (SELECT plvv2.m_pricelist_version_id FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 1 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) PLV1_ID, (SELECT plvv2.m_pricelist_version_id FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 2 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) PLV2_ID, (SELECT plvv2.validfrom FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 1 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) validFromPLV1, (SELECT plvv2.validfrom FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 2 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) validFromPLV2, (SELECT plvv2.name FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 1 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) namePLV1, (SELECT plvv2.name FROM PriceListVersionsByValidFrom plvv2 WHERE plvv2.rank = 2 AND plvv2.c_bpartner_id = plvv.c_bpartner_id) namePLV2 FROM PriceListVersionsByValidFrom plvv ORDER BY plvv.c_bpartner_id ), result AS ( SELECT t.*, plv.validFromPLV1, plv.validFromPLV2, plv.namePLV1, plv.namePLV2, (SELECT bpl.c_bpartner_location_id FROM c_bpartner_location bpl WHERE bpl.c_bpartner_id = plv.c_bpartner_id ORDER BY bpl.isbilltodefault DESC LIMIT 1) c_bpartner_location_id, (SELECT plv2.ad_org_id FROM m_pricelist_version plv2 WHERE plv2.m_pricelist_version_id = plv.PLV1_ID) AD_Org_ID FROM currentAndPreviousPLV plv INNER JOIN LATERAL report.fresh_PriceList_Details_Report_With_PP_PI( plv.c_bpartner_id, plv.PLV1_ID, plv.PLV2_ID, p_AD_Language, p_show_product_price_pi_flag ) AS t ON TRUE ) SELECT -- r.bp_value, r.bp_name, r.productcategory, r.m_product_id, r.value, r.customerproductnumber, r.productname, r.isseasonfixedprice::text, r.itemproductname, r.qtycuspertu, r.packingmaterialname, r.pricestd, r.altpricestd, r.hasaltprice, r.uomsymbol, r.uom_x12de355, r.attributes, r.m_productprice_id, r.m_attributesetinstance_id, r.m_hu_pi_item_product_id, r.currency::text, r.currency2::text, r.validFromPLV1, r.validFromPLV2, r.namePLV1, r.namePLV2, r.c_bpartner_location_id, r.AD_Org_ID, p_show_product_price_pi_flag as show_product_price_pi_flag FROM result r ORDER BY TRUE, r.bp_value, r.productCategory, r.value $$ LANGUAGE sql STABLE ; /* How to run - All Bpartners SELECT * FROM report.Current_Vs_Previous_Pricelist_Comparison_Report_With_PP_PI() ; - Specific Bpartner SELECT * FROM report.Current_Vs_Previous_Pricelist_Comparison_Report_With_PP_PI(2156515) ; */
the_stack
-- 2018-02-21T06:56:17.724 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Menu_ID,AD_Org_ID,AD_Window_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsCreateNew,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy,WEBUI_NameBrowse) VALUES ('W',0,541041,0,540414,TO_TIMESTAMP('2018-02-21 06:56:17','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.datev','_Buchungen_Export_Format','Y','N','N','N','N','Buchungen Export Format',TO_TIMESTAMP('2018-02-21 06:56:17','YYYY-MM-DD HH24:MI:SS'),100,'Buchungen Export Format') ; -- 2018-02-21T06:56:17.734 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Menu_ID, t.Description,t.Name,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=541041 AND NOT EXISTS (SELECT 1 FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID) ; -- 2018-02-21T06:56:17.737 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 541041, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=541041) ; -- 2018-02-21T06:56:18.349 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=541000 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.350 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=541001 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.351 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=541008 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.351 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=541002 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.352 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=541003 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.352 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540956 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.353 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540881 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.354 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540882 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.354 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540842 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.354 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540843 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.355 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540810 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.355 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540812 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.355 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540813 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.356 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540780 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:18.356 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000072, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=541041 AND AD_Tree_ID=10 ; -- 2018-02-21T06:56:41.994 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Window SET Name='Buchungen Export Format',Updated=TO_TIMESTAMP('2018-02-21 06:56:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=540414 ; -- 2018-02-21T06:56:42.009 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Description=NULL, IsActive='Y', Name='Buchungen Export Format',Updated=TO_TIMESTAMP('2018-02-21 06:56:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=541039 ; -- 2018-02-21T06:59:56.454 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,541039,540662,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'main') ; -- 2018-02-21T06:59:56.455 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540662 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID) ; -- 2018-02-21T06:59:56.492 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540882,540662,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.525 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540883,540662,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y',20,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.566 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540882,541471,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.613 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562770,0,541039,541471,551017,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Alphanumeric identifier of the entity','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.','Y','N','Y','Y','N','Name',10,10,0,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.649 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562774,0,541039,541471,551018,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','Y','N','Beschreibung',20,20,0,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.682 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562771,0,541039,541471,551019,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','Y','N','CSV Encoding',30,30,0,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.718 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562772,0,541039,541471,551020,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','Y','N','CSV Field Delimiter',40,40,0,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.755 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562773,0,541039,541471,551021,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','Y','N','CSV Field Quote',50,50,0,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.795 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562785,0,541039,541471,551022,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','Y','N','Decimal Separator',60,60,0,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.839 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562784,0,541039,541471,551023,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','Y','N','Number Grouping Separator',70,70,0,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.879 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,541040,540663,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'main') ; -- 2018-02-21T06:59:56.882 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540663 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID) ; -- 2018-02-21T06:59:56.922 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540884,540663,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.956 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540884,541472,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:56.993 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562782,0,541040,541472,551024,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst','"Reihenfolge" bestimmt die Reihenfolge der Einträge','Y','N','N','Y','N','Reihenfolge',0,10,0,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:57.030 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562781,0,541040,541472,551025,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100,'Alphanumeric identifier of the entity','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.','Y','N','N','Y','N','Name',0,20,0,TO_TIMESTAMP('2018-02-21 06:59:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:57.068 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562780,0,541040,541472,551026,TO_TIMESTAMP('2018-02-21 06:59:57','YYYY-MM-DD HH24:MI:SS'),100,'Spalte in der Tabelle','Verbindung zur Spalte der Tabelle','Y','N','N','Y','N','Spalte',0,30,0,TO_TIMESTAMP('2018-02-21 06:59:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T06:59:57.109 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562783,0,541040,541472,551027,TO_TIMESTAMP('2018-02-21 06:59:57','YYYY-MM-DD HH24:MI:SS'),100,'The pattern used to format a number or date.','A string complying with either Java SimpleDateFormat or DecimalFormat pattern syntax used to override the default presentation format of a date or number type field.','Y','N','N','Y','N','Format Pattern',0,40,0,TO_TIMESTAMP('2018-02-21 06:59:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:01:54.692 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540882,541473,TO_TIMESTAMP('2018-02-21 07:01:54','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2018-02-21 07:01:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:02:02.794 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET Name='defaultadvanced edit', SeqNo=90,Updated=TO_TIMESTAMP('2018-02-21 07:02:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=541471 ; -- 2018-02-21T07:02:46.734 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET Name='advanced edit',Updated=TO_TIMESTAMP('2018-02-21 07:02:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=541471 ; -- 2018-02-21T07:02:59.248 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541473, SeqNo=10,Updated=TO_TIMESTAMP('2018-02-21 07:02:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551017 ; -- 2018-02-21T07:03:06.360 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541473, SeqNo=20,Updated=TO_TIMESTAMP('2018-02-21 07:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551019 ; -- 2018-02-21T07:03:12.265 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541473, SeqNo=30,Updated=TO_TIMESTAMP('2018-02-21 07:03:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551020 ; -- 2018-02-21T07:03:58.490 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540883,541474,TO_TIMESTAMP('2018-02-21 07:03:58','YYYY-MM-DD HH24:MI:SS'),100,'Y','rest',10,TO_TIMESTAMP('2018-02-21 07:03:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:04:03.560 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540883,541475,TO_TIMESTAMP('2018-02-21 07:04:03','YYYY-MM-DD HH24:MI:SS'),100,'Y','org',20,TO_TIMESTAMP('2018-02-21 07:04:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:04:28.722 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562767,0,541039,541475,551028,'F',TO_TIMESTAMP('2018-02-21 07:04:28','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2018-02-21 07:04:28','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:04:37.768 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562766,0,541039,541475,551029,'F',TO_TIMESTAMP('2018-02-21 07:04:37','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2018-02-21 07:04:37','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:05:10.735 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540882,541476,TO_TIMESTAMP('2018-02-21 07:05:10','YYYY-MM-DD HH24:MI:SS'),100,'Y','description',20,TO_TIMESTAMP('2018-02-21 07:05:10','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:05:20.229 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541476, SeqNo=10,Updated=TO_TIMESTAMP('2018-02-21 07:05:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551018 ; -- 2018-02-21T07:05:58.250 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541474, SeqNo=10,Updated=TO_TIMESTAMP('2018-02-21 07:05:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551021 ; -- 2018-02-21T07:06:04.337 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541474, SeqNo=20,Updated=TO_TIMESTAMP('2018-02-21 07:06:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551022 ; -- 2018-02-21T07:06:11.184 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541474, SeqNo=30,Updated=TO_TIMESTAMP('2018-02-21 07:06:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551023 ; -- 2018-02-21T07:06:43.103 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_ElementGroup WHERE AD_UI_ElementGroup_ID=541471 ; -- 2018-02-21T07:09:52.178 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET SeqNo=20,Updated=TO_TIMESTAMP('2018-02-21 07:09:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=541474 ; -- 2018-02-21T07:10:02.531 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET Name='flags', SeqNo=10,Updated=TO_TIMESTAMP('2018-02-21 07:10:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=541474 ; -- 2018-02-21T07:10:10.637 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541476, SeqNo=20,Updated=TO_TIMESTAMP('2018-02-21 07:10:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551023 ; -- 2018-02-21T07:10:16.879 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541476, SeqNo=30,Updated=TO_TIMESTAMP('2018-02-21 07:10:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551022 ; -- 2018-02-21T07:10:23.040 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541476, SeqNo=40,Updated=TO_TIMESTAMP('2018-02-21 07:10:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551021 ; -- 2018-02-21T07:10:36.385 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562768,0,541039,541474,551030,'F',TO_TIMESTAMP('2018-02-21 07:10:36','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','Aktiv',10,0,0,TO_TIMESTAMP('2018-02-21 07:10:36','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:11:50.723 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540883,541477,TO_TIMESTAMP('2018-02-21 07:11:50','YYYY-MM-DD HH24:MI:SS'),100,'Y','rest',20,TO_TIMESTAMP('2018-02-21 07:11:50','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:11:52.948 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET SeqNo=30,Updated=TO_TIMESTAMP('2018-02-21 07:11:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=541475 ; -- 2018-02-21T07:12:11.583 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541477, SeqNo=10,Updated=TO_TIMESTAMP('2018-02-21 07:12:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551022 ; -- 2018-02-21T07:12:18.417 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541477, SeqNo=20,Updated=TO_TIMESTAMP('2018-02-21 07:12:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551023 ; -- 2018-02-21T07:15:33.657 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562776,0,541040,541472,551031,'F',TO_TIMESTAMP('2018-02-21 07:15:33','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2018-02-21 07:15:33','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:15:47.979 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562775,0,541040,541472,551032,'F',TO_TIMESTAMP('2018-02-21 07:15:47','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2018-02-21 07:15:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:16:02.062 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,562777,0,541040,541472,551033,'F',TO_TIMESTAMP('2018-02-21 07:16:02','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','Aktiv',30,0,0,TO_TIMESTAMP('2018-02-21 07:16:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-02-21T07:16:10.125 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2018-02-21 07:16:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551033 ; -- 2018-02-21T07:16:10.133 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2018-02-21 07:16:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551031 ; -- 2018-02-21T07:16:21.757 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2018-02-21 07:16:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551031 ; -- 2018-02-21T07:17:04.135 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2018-02-21 07:17:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551024 ; -- 2018-02-21T07:17:05.878 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2018-02-21 07:17:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551025 ; -- 2018-02-21T07:17:07.571 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2018-02-21 07:17:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551026 ; -- 2018-02-21T07:17:09.920 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2018-02-21 07:17:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551027 ; -- 2018-02-21T07:17:11.880 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2018-02-21 07:17:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551033 ; -- 2018-02-21T07:17:13.839 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2018-02-21 07:17:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551031 ; -- 2018-02-21T07:17:15.556 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2018-02-21 07:17:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551032 ; -- 2018-02-21T07:17:18.125 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-02-21 07:17:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551024 ; -- 2018-02-21T07:17:18.492 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-02-21 07:17:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551025 ; -- 2018-02-21T07:17:18.875 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-02-21 07:17:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551026 ; -- 2018-02-21T07:17:20.743 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-02-21 07:17:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551027 ; -- 2018-02-21T07:18:01.871 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2018-02-21 07:18:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551031 ; -- 2018-02-21T07:18:09.701 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2018-02-21 07:18:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551032 ; -- 2018-02-21T07:18:13.715 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2018-02-21 07:18:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551024 ; -- 2018-02-21T07:18:22.062 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='L',Updated=TO_TIMESTAMP('2018-02-21 07:18:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551025 ; -- 2018-02-21T07:18:25.047 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='L',Updated=TO_TIMESTAMP('2018-02-21 07:18:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551026 ; -- 2018-02-21T07:18:32.443 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2018-02-21 07:18:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551027 ; -- 2018-02-21T07:21:51.552 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540969 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.553 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540892 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.554 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540914 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.554 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540915 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.554 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=150 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.555 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=147 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.555 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=145 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.555 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=144 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.556 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540743 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.556 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540784 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.556 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540826 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.556 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540898 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.557 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540895 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.557 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540827 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.557 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=540828 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.558 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=15, Updated=now(), UpdatedBy=100 WHERE Node_ID=540849 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.558 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=16, Updated=now(), UpdatedBy=100 WHERE Node_ID=540911 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.558 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=17, Updated=now(), UpdatedBy=100 WHERE Node_ID=540912 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.558 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=18, Updated=now(), UpdatedBy=100 WHERE Node_ID=540913 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.559 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=19, Updated=now(), UpdatedBy=100 WHERE Node_ID=540894 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.559 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=20, Updated=now(), UpdatedBy=100 WHERE Node_ID=540917 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.559 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=21, Updated=now(), UpdatedBy=100 WHERE Node_ID=540982 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.560 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=22, Updated=now(), UpdatedBy=100 WHERE Node_ID=540919 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.560 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=23, Updated=now(), UpdatedBy=100 WHERE Node_ID=541041 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.560 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=24, Updated=now(), UpdatedBy=100 WHERE Node_ID=540983 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.560 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=25, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000099 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.561 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=26, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000100 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.561 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=27, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000101 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:51.561 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=28, Updated=now(), UpdatedBy=100 WHERE Node_ID=540901 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.237 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540969 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.238 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540892 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.238 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540914 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.239 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540915 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.239 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=150 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.239 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=147 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.240 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=145 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.240 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=144 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.240 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540743 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.241 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540784 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.241 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540826 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.241 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540898 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.242 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540895 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.242 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540827 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.242 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=540828 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.243 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=15, Updated=now(), UpdatedBy=100 WHERE Node_ID=540849 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.243 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=16, Updated=now(), UpdatedBy=100 WHERE Node_ID=540911 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.243 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=17, Updated=now(), UpdatedBy=100 WHERE Node_ID=540912 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.243 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=18, Updated=now(), UpdatedBy=100 WHERE Node_ID=540913 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.244 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=19, Updated=now(), UpdatedBy=100 WHERE Node_ID=540894 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.244 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=20, Updated=now(), UpdatedBy=100 WHERE Node_ID=540917 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.244 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=21, Updated=now(), UpdatedBy=100 WHERE Node_ID=540982 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.245 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=22, Updated=now(), UpdatedBy=100 WHERE Node_ID=540919 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.245 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=23, Updated=now(), UpdatedBy=100 WHERE Node_ID=540983 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.245 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=24, Updated=now(), UpdatedBy=100 WHERE Node_ID=541041 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.246 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=25, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000099 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.246 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=26, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000100 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.246 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=27, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000101 AND AD_Tree_ID=10 ; -- 2018-02-21T07:21:53.247 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000098, SeqNo=28, Updated=now(), UpdatedBy=100 WHERE Node_ID=540901 AND AD_Tree_ID=10 ; -- 2018-02-21T07:30:27.957 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-02-21 07:30:27','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Active',Description='',Help='' WHERE AD_Field_ID=562777 AND AD_Language='en_US' ; -- 2018-02-21T07:30:39.689 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-02-21 07:30:39','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Client',Description='',Help='' WHERE AD_Field_ID=562775 AND AD_Language='en_US' ; -- 2018-02-21T07:30:54.450 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-02-21 07:30:54','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Organisation',Description='',Help='' WHERE AD_Field_ID=562776 AND AD_Language='en_US' ; -- 2018-02-21T07:31:14.652 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-02-21 07:31:14','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Active',Description='',Help='' WHERE AD_Field_ID=562768 AND AD_Language='en_US' ; -- 2018-02-21T07:31:25.667 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-02-21 07:31:25','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Organisation',Description='',Help='' WHERE AD_Field_ID=562767 AND AD_Language='en_US' ; -- 2018-02-21T07:31:35.006 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-02-21 07:31:35','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Client',Description='',Help='' WHERE AD_Field_ID=562766 AND AD_Language='en_US' ; -- 2018-02-21T07:32:03.392 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-02-21 07:32:03','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Description' WHERE AD_Field_ID=562774 AND AD_Language='en_US' ; -- 2018-02-21T07:32:37.648 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-02-21 07:32:37','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='SeqNo',Description='',Help='' WHERE AD_Field_ID=562782 AND AD_Language='en_US' ; -- 2018-02-21T07:32:52.355 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-02-21 07:32:52','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Column',Description='',Help='' WHERE AD_Field_ID=562780 AND AD_Language='en_US' ; -- 2018-02-21T07:34:31.304 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='CSV Feld Trenner',Updated=TO_TIMESTAMP('2018-02-21 07:34:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=562772 ; -- 2018-02-21T07:34:58.224 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='CSV Feld Textzeichen',Updated=TO_TIMESTAMP('2018-02-21 07:34:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=562773 ; -- 2018-02-21T07:35:10.914 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Dezimalzeichen',Updated=TO_TIMESTAMP('2018-02-21 07:35:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=562785 ; -- 2018-02-21T07:35:33.927 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Nummer Gruppen Trenner',Updated=TO_TIMESTAMP('2018-02-21 07:35:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=562784 ; -- 2018-02-21T07:35:49.821 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Format Muster',Updated=TO_TIMESTAMP('2018-02-21 07:35:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=562783 ;
the_stack
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com -- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions. -------------------------------------------------------------------------------- -- -- File name: snapper.sql -- Purpose: An easy to use Oracle session-level performance measurement tool -- which does NOT require any database changes nor creation of any -- database objects! -- -- This is very useful for ad-hoc performance diagnosis in environments -- with restrictive change management processes, where creating -- even temporary tables and PL/SQL packages is not allowed or would -- take too much time to get approved. -- -- All processing is done by a few sqlplus commands and an anonymous -- PL/SQL block, all that's needed is SQLPLUS access (and if you want -- to output data to server-side tracefile then execute rights on -- DBMS_SYSTEM). Snapper only queries some V$ views (and in advanced -- mode some X$ fixed tables, but it does not enable any traces nor -- use oradebug. -- -- The output is formatted the way it could be easily post-processed -- by either Unix string manipulation tools or loaded to spreadsheet. -- -- Snapper v4 works on Oracle 10.1 onwards. If you need Snapper for -- older database versions, then Snapper v3 works on Oracle versions -- starting from Oracle 9.2, but it does not have GV$ view, manual -- snapshot support and the useful averages are limited to wait events -- only -- -- Note1: The "ASH" functionality in Snapper just samples V$SESSION view, -- so you do NOT need Diagnostics Pack licenses to use Snapper's -- "ASH" output -- -- Note2: Snapper just reports you performance metric deltas in a snapsphot -- and does not attempt to solve any performance problems for you. -- You still need to interpret and understand these standard Oracle -- metrics yourself -- -- Author: Tanel Poder (tanel@tanelpoder.com) -- Copyright: (c) Tanel Poder - http://blog.tanelpoder.com - All rights reserved. -- -- Disclaimer: This script is provided "as is", so no warranties or guarantees are -- made about its correctness, reliability and safety. Use it at your -- own risk! -- -- License: 1) You may use this script for your (or your businesses) purposes for free -- 2) You may modify this script as you like for your own (or your businesses) purpose, -- but you must always leave this script header (the entire comment section), including the -- author, copyright and license sections as the first thing in the beginning of this file -- 3) You may NOT publish or distribute this script or any variation of it PUBLICLY -- (including, but not limited to uploading it to your public website or ftp server), -- instead just link to its location in blog.tanelpoder.com -- 4) You may distribute this script INTERNALLY in your company, for internal use only, -- for example when building a standard DBA toolset to be deployed to all -- servers or DBA workstations -- -- -- Thanks to: Adrian Billington, Jamey Johnston and Marcus Mönnig for bugfixes, -- additions and improvements -- -------------------------------------------------------------------------------- -- -- The Session Snapper v3.64 -- (c) Tanel Poder ( http://blog.tanelpoder.com ) -- -- -- +-----=====O=== Welcome to The Session Snapper! (Yes, you are looking at a cheap ASCII -- / imitation of a fish and a fishing rod. -- | Nevertheless the PL/SQL code below the -- | fish itself should be helpful for quick -- | catching of relevant Oracle performance -- | information. -- | So I wish you happy... um... snapping? -- | ) -- | ...... -- | iittii,,.... -- ¿ iiffffjjjjtttt,, -- ..;;ttffLLLLffLLLLLLffjjtt;;.. -- ..ttLLGGGGGGLLffLLLLLLLLLLLLLLffjjii,, ..ii,, -- ffGGffLLLLLLjjttjjjjjjjjffLLLLLLLLLLjjii.. ..iijj;;.... -- ffGGLLiittjjttttttiittttttttttffLLLLLLGGffii.. ;;LLLLii;;;;.. -- ffEEGGffiittiittttttttttiiiiiiiittjjjjffLLGGLLii.. iiLLLLLLttiiii,, -- ;;ffDDLLiiiitt,,ttttttttttttiiiiiiiijjjjjjffLLLLffttiiiiffLLGGLLjjtttt;;.. -- ..ttttjjiitt,,iiiiiittttttttjjjjttttttttjjjjttttjjttttjjjjffLLDDGGLLttii.. -- iittiitttt, ;;iittttttttjjjjjjjjjjttjjjjjjffffffjjjjjjjjjjLLDDGGLLtt;;.. -- jjjjttttii:. ..iiiiffLLGGLLLLLLLLffffffLLLLLLLLLLLLLLLLffffffLLLLLLfftt,, -- iittttii,,;;,,ttiiiiLLLLffffffjjffffLLLLLLLLffLLffjjttttttttttjjjjffjjii.. -- ,,iiiiiiiiiittttttiiiiiiiiiijjffffLLLLLLLLffLLffttttttii;;;;iiiitttttttt;;.. -- ..iittttttffffttttiiiiiiiiiittttffjjjjffffffffttiittii:: ....,,;;iittii;; -- ..;;iittttttttttttttttiiiiiittttttttttjjjjjjtttttt;; ..;;ii;;.. -- ..;;;;iittttttjjttiittttttttttttttjjttttttttii.. .... -- ....;;;;ttjjttttiiiiii;;;;;;iittttiiii.. -- ..;;ttttii;;.... ..;;;;.... -- ..iiii;;.. -- ..;;,, -- .... -- -- -- Usage: -- -- snapper.sql <ash[1-3]|stats|all>[,out][,trace][,pagesize=X][,gather=[s][t][w][l][e][b][a]]> <seconds_in_snap> <snapshot_count> <sid(s)_to_snap> -- -- ash - sample session activity ASH style, waits and SQL_IDs from v$session and -- print a TOP SQL/wait report from these samples (this is the default from -- Snapper 3.0). The columns chosen for TOP calculation are defined in CONFIG -- section below. -- -- ash=sql_id+event+wait_class -- - the above example illustrates that you can also specify the v$session -- columns for TOP report yourself. The above example will show a TOP -- activity report grouped by SQL_ID + EVENT + WAIT_CLASS -- Note that the columns are separated by a "+" sign (as comma is a snapper -- parameter separator, not ASH column separator) -- -- ash1 -- ash2 -- ash3 - in addition to "ash" report you can have 3 more reported during the same -- snapper sampling snapshot. Just include ash1=col1+col2,ash2=col3+col4,... -- parameters if you want multiple TOP reports per Snapper snapshot -- -- stats - sample v$sesstat,v$sess_time_model,v$session_event performance counters -- and report how much these stats increased (deltas) during Snapper run -- all - report both ASH and stats sections -- -- out - use dbms_output.put_line() for output. output will be seen only when -- Snapper run completes due to dbms_output limitations. This is the default. -- trace - write output to server process tracefile -- (you must have execute permission on sys.dbms_system.ksdwrt() for that, -- you can use both out and trace parameters together if you like ) -- -- pagesize - display header lines after X snapshots. if pagesize=0 don't display -- any headers. pagesize=-1 will display a terse header only once -- -- gather - if omitted, gathers s,t,w statistics (see below) -- - if specified, then gather following: -- -- Session-level stats: -- s - Session Statistics from v$sesstat -- t - Session Time model info from v$sess_time_model -- w - Session Wait statistics from v$session_event and v$session_wait -- -- Instance-level stats: -- l - instance Latch get statistics ( gets + immediate_gets ) -- e - instance Enqueue lock get statistics -- b - buffer get Where statistics -- useful in versions up to 10.2.x -- a - All above -- -- sinclude - if specified, then show only V$SESSTAT stats which match the -- LIKE pattern of sinclude (REGEXP_LIKE in 10g+) -- linclude - if specified, then show only V$LATCH latch stats which match the -- LIKE pattern of linclude (REGEXP_LIKE in 10g+) -- tinclude - if specified, then show only V$SESS_TIME_MODEL stats which match the -- LIKE pattern of tinclude (REGEXP_LIKE in 10g+) -- winclude - if specified, then show only V$SESSION_EVENT wait stats which match the -- LIKE pattern of winclude (REGEXP_LIKE in 10g+) -- -- you can combine above parameters in any order, separate them by commas -- !!!don't use spaces as otherwise they are treated as next parameters by sqlplus !!! -- !!!if you want to use spaces, enclose the whole sqlplus parameter in doublequotes !!! -- -- <seconds_in_snap> - the number of seconds between taking snapshots -- <snapshot_count> - the number of snapshots to take ( maximum value is power(2,31)-1 ) -- -- <sids_to_snap> can be either one sessionid, multiple sessionids separated by -- commas or a SQL statement which returns a list of SIDs (if you need spaces -- in that parameter text, enclose it in double quotes). -- -- if you want to snap ALL sids, use "all" as value for -- <sids_to_snap> parameter -- -- alternatively you can used "select sid from v$session" as value for <sids_to_snap> -- parameter to capture all SIDs. you can write any query (with multiple and/or) -- conditions to specify complex rules for capturing only the SIDs you want -- -- starting from version 3.0 there are further session_id selection options available in -- instead of sid you can write such expressions for snapper's <sids_to_snap> parameter: -- -- sid=123 -- take sid 123 only (the same as just writing 123) -- user=tanel -- take all sessions where username is 'tanel' (case insensitive) -- -- this is the same as writing following subquery for the -- -- <sids_to_snap> parameter: -- select sid from v$session where lower(username) like lower('tanel') -- -- user=tanel% -- take all sessions where username begins with 'tanel%' (case insensitive) -- -- the = means actually LIKE in SQL terms in this script -- -- spid=1234 -- all these 3 parameters do the same thing: -- ospid=1234 -- they look up the sessions(s) where the processes OS PID=1234 -- pid=1234 -- this is useful for quickly looking up what some OS process is doing -- -- if it consumes too much of some resource -- qc=123 -- qcsid=123 -- show query coordinator and all PX slave sessions -- -- program=sqlplus% -- the following examples filter by corresponding v$session coulmns -- machine=linux01 -- machine -- osuser=oracle -- os username -- module=HR -- module -- "action=Find Order" -- note the quotes because there is a space inside the parameter -- -- value -- client_id=tanelpoder -- show only sessions where client_identifier is set to tanelpoder -- -- this is very useful in cases with (properly instrumented) -- -- connection pools -- -- -- Note that if you want to change some "advanced" snapper configuration parameters -- or default values then search for CONFIG in this file to see configurable -- variable section -- -- -- Examples: -- NB! Read the online examples, these are more detailed and list script output too! -- -- http://tech.e2sn.com/oracle-scripts-and-tools/session-snapper -- -- @snapper ash,stats 1 1 515 -- (Output one 1-second snapshot of session 515 using dbms_output and exit -- Wait, v$sesstat and v$sess_time_model statistics are reported by default -- Starting from V3 the ASH style session activity report is shown as well) -- -- @snapper stats,gather=w 1 1 515 -- (Output one 1-second snapshot of session 515 using dbms_output and exit -- only Wait event statistics are reported, no ASH) -- -- @snapper ash,gather=st 1 1 515 -- (Output one 1-second snapshot of session 515 using dbms_output and exit -- only v$sesstat and v$sess_Time_model statistics are gathered + ASH) -- -- @snapper trace,ash,gather=stw,pagesize=0 10 90 117,210,313 -- (Write 90 10-second snapshots into tracefile for session IDs 117,210,313 -- all statistics are reported, do not print any headers) -- -- @snapper trace,ash 900 999999999 "select sid from v$session" -- (Take a snapshot of ALL sessions every 15 minutes and write the output to trace, -- loop (almost) forever ) -- -- @snapper out,trace 300 12 "select sid from v$session where username='APPS'" -- (Take 12 5-minute snapshots of all sessions belonging to APPS user, write -- output to both dbms_output and tracefile) -- -- Notes: -- -- Snapper does not currently detect if a session with given SID has -- ended and been recreated between snapshots, thus it may report bogus -- statistics for such sessions. The check and warning for that will be -- implemented in a future version. -- -------------------------------------------------------------------------------- set termout off tab off verify off linesize 999 trimspool on trimout on null "" -- Get parameters define snapper_options="&1" define snapper_sleep="&2" define snapper_count="&3" define snapper_sid="&4" -- The following code is required for making this script "dynamic" as due to -- different Oracle versions, script parameters or granted privileges some -- statements might not compile if not adjusted properly. define _IF_ORA9="" define _IF_ORA9206_OR_LOWER="" define _IF_ORA9207_OR_HIGHER="" define _IF_ORA10_OR_HIGHER="" define _IF_ORA10_OR_HIGHER="--" define _IF_ORA11_OR_HIGHER="--" define _IF_LOWER_THAN_ORA11="--" define _IF_DBMS_SYSTEM_ACCESSIBLE="/* dbms_system is not accessible" -- /*dummy*/ -- it's here to avoid vim syntax highlighter from going crazy define _IF_X_ACCESSIBLE="--" -- plsql_object_id columns available in v$session (from 10.2.0.3) define _YES_PLSQL_OBJ_ID="--" define _NO_PLSQL_OBJ_ID="" -- blocking_instance available in v$session (from 10.2) define _YES_BLK_INST="--" define _NO_BLK_INST="" -- set the noprint's value to "noprint" if you don't want these temporary variables to show up in a sqlplus spool file DEF noprint="" col snapper_ora9 &noprint new_value _IF_ORA9 col snapper_ora9206lower &noprint new_value _IF_ORA9206_OR_LOWER col snapper_ora9207higher &noprint new_value _IF_ORA9207_OR_HIGHER col snapper_ora10higher &noprint new_value _IF_ORA10_OR_HIGHER col snapper_ora11higher &noprint new_value _IF_ORA11_OR_HIGHER col snapper_ora11lower &noprint new_value _IF_LOWER_THAN_ORA11 col dbms_system_accessible &noprint new_value _IF_DBMS_SYSTEM_ACCESSIBLE col x_accessible &noprint new_value _IF_X_ACCESSIBLE col no_plsql_obj_id &noprint new_value _NO_PLSQL_OBJ_ID col yes_plsql_obj_id &noprint new_value _YES_PLSQL_OBJ_ID col no_blk_inst &noprint new_value _NO_BLK_INST col yes_blk_inst &noprint new_value _YES_BLK_INST col snapper_sid &noprint new_value snapper_sid -- this block determines whether dbms_system.ksdwrt is accessible to us -- dbms_describe is required as all_procedures/all_objects may show this object -- even if its not executable by us (thanks to o7_dictionary_accessibility=false) var v varchar2(100) var x varchar2(10) declare o sys.dbms_describe.number_table; p sys.dbms_describe.number_table; l sys.dbms_describe.number_table; a sys.dbms_describe.varchar2_table; dty sys.dbms_describe.number_table; def sys.dbms_describe.number_table; inout sys.dbms_describe.number_table; len sys.dbms_describe.number_table; prec sys.dbms_describe.number_table; scal sys.dbms_describe.number_table; rad sys.dbms_describe.number_table; spa sys.dbms_describe.number_table; tmp number; begin begin execute immediate 'select count(*) from x$kcbwh where rownum = 1' into tmp; :x:= ' '; -- x$ tables are accessible, so dont comment any lines out exception when others then null; end; sys.dbms_describe.describe_procedure( 'DBMS_SYSTEM.KSDWRT', null, null, o, p, l, a, dty, def, inout, len, prec, scal, rad, spa ); -- we never get to following statement if dbms_system is not accessible -- as sys.dbms_describe will raise an exception :v:= '-- dbms_system is accessible'; exception when others then null; end; / -- this is here for a reason -- im extracting the first word of the snapper_sid (if its a complex expression, not just a single SID) -- by relying on how DEF and & assignment treat spaces in strings def ssid_begin=&snapper_sid select snapper_sid from ( select case when trim(lower('&ssid_begin')) like 'sid=%' then trim(replace('&ssid_begin','sid=','')) when trim(lower('&ssid_begin')) like 'user=%' then 'select sid from v$session where lower(username) like '''||lower(trim(replace('&ssid_begin','user=','')))||'''' when trim(lower('&ssid_begin')) like 'username=%' then 'select sid from v$session where lower(username) like '''||lower(trim(replace('&ssid_begin','username=','')))||'''' when trim(lower('&ssid_begin')) like 'machine=%' then 'select sid from v$session where lower(machine) like '''||lower(trim(replace('&ssid_begin','machine=','')))||'''' when trim(lower('&ssid_begin')) like 'program=%' then 'select sid from v$session where lower(program) like '''||lower(trim(replace('&ssid_begin','program=','')))||'''' when trim(lower('&ssid_begin')) like 'service=%' then 'select sid from v$session where lower(service_name) like '''||lower(trim(replace('&ssid_begin','service=','')))||'''' when trim(lower('&ssid_begin')) like 'module=%' then 'select sid from v$session where lower(module) like '''||lower(trim(replace('&ssid_begin','module=','')))||'''' when trim(lower('&ssid_begin')) like 'action=%' then 'select sid from v$session where lower(action) like '''||lower(trim(replace('&ssid_begin','action=','')))||'''' when trim(lower('&ssid_begin')) like 'osuser=%' then 'select sid from v$session where lower(osuser) like '''||lower(trim(replace('&ssid_begin','osuser=','')))||'''' when trim(lower('&ssid_begin')) like 'client_id=%' then 'select sid from v$session where lower(client_identifier) like '''||lower(trim(replace('&ssid_begin','client_id=','')))||'''' when trim(lower('&ssid_begin')) like 'spid=%' then 'select sid from v$session where paddr in (select addr from v$process where spid in ('||lower(trim(replace('&ssid_begin','spid=','')))||'))' when trim(lower('&ssid_begin')) like 'ospid=%' then 'select sid from v$session where paddr in (select addr from v$process where spid in ('||lower(trim(replace('&ssid_begin','ospid=','')))||'))' when trim(lower('&ssid_begin')) like 'pid=%' then 'select sid from v$session where paddr in (select addr from v$process where spid in ('||lower(trim(replace('&ssid_begin','pid=','')))||'))' when trim(lower('&ssid_begin')) like 'qcsid=%' then 'select sid from v$px_session where qcsid in ('||lower(trim(replace('&ssid_begin','qcsid=','')))||')' when trim(lower('&ssid_begin')) like 'qc=%' then 'select sid from v$px_session where qcsid in ('||lower(trim(replace('&ssid_begin','qc=','')))||')' when trim(lower('&ssid_begin')) = 'all' then 'select sid from v$session' when trim(lower('&ssid_begin')) = 'bg' then 'select sid from v$session where type=''BACKGROUND''' when trim(lower('&ssid_begin')) = 'fg' then 'select sid from v$session where type=''USER''' when trim(lower('&ssid_begin')) = 'lgwr' then 'select sid from v$session where program like ''%(LGWR)%''' when trim(lower('&ssid_begin')) = 'dbwr' then 'select sid from v$session where program like ''%(DBW%)%''' when trim(lower('&ssid_begin')) like 'select%' then null when trim(lower('&ssid_begin')) like 'with%' then null else null end snapper_sid -- put the result back to snapper_sid sqlplus value (if its not null) from dual ) where snapper_sid is not null -- snapper_sid sqlplus variable value will not be replaced if this query doesnt return any rows / -- this query populates some sqlplus variables required for dynamic compilation used below with mod_banner as ( select replace(banner,'9.','09.') banner from v$version where rownum = 1 ) select decode(substr(banner, instr(banner, 'Release ')+8,2), '09', '--', '') snapper_ora10lower, decode(substr(banner, instr(banner, 'Release ')+8,2), '09', '', '--') snapper_ora9, decode(substr(banner, instr(banner, 'Release ')+8,1), '1', '', '--') snapper_ora10higher, CASE WHEN substr(banner, instr(banner, 'Release ')+8,2) >= '11' THEN '' ELSE '--' END snapper_ora11higher, CASE WHEN substr(banner, instr(banner, 'Release ')+8,2) < '11' THEN '' ELSE '--' END snapper_ora11lower, nvl(:v, '/* dbms_system is not accessible') dbms_system_accessible, nvl(:x, '--') x_accessible, case when substr( banner, instr(banner, 'Release ')+8, instr(substr(banner,instr(banner,'Release ')+8),' ') ) >= '10.2' then '' else '--' end yes_blk_inst, case when substr( banner, instr(banner, 'Release ')+8, instr(substr(banner,instr(banner,'Release ')+8),' ') ) >= '10.2' then '--' else '' end no_blk_inst, case when substr( banner, instr(banner, 'Release ')+8, instr(substr(banner,instr(banner,'Release ')+8),' ') ) >= '10.2.0.3' then '' else '--' end yes_plsql_obj_id, case when substr( banner, instr(banner, 'Release ')+8, instr(substr(banner,instr(banner,'Release ')+8),' ') ) >= '10.2.0.3' then '--' else '' end no_plsql_obj_id, case when substr( banner, instr(banner, 'Release ')+8, instr(substr(banner,instr(banner,'Release ')+8),' ') ) < '09.2.0.7' then '' else '--' end snapper_ora9206lower, case when substr( banner, instr(banner, 'Release ')+8, instr(substr(banner,instr(banner,'Release ')+8),' ') ) >= '09.2.0.7' then '' else '--' end snapper_ora9207higher from mod_banner / set termout on serveroutput on size 1000000 format wrapped prompt Sampling SID &4 with interval &snapper_sleep seconds, taking &snapper_count snapshots... -- main() -- let the Snapping start!!! declare -- Snapper start -- forward declarations procedure output(p_txt in varchar2); procedure fout; function tptformat( p_num in number, p_stype in varchar2 default 'STAT', p_precision in number default 2, p_base in number default 10, p_grouplen in number default 3 ) return varchar2; function getopt( p_parvalues in varchar2, p_extract in varchar2, p_delim in varchar2 default ',' ) return varchar2; -- type, constant, variable declarations -- trick for holding 32bit UNSIGNED event and stat_ids in 32bit SIGNED PLS_INTEGER pls_adjust constant number(10,0) := power(2,31) - 1; type srec is record (stype varchar2(4), sid number, statistic# number, value number, event_count number ); type stab is table of srec index by pls_integer; s1 stab; s2 stab; type snrec is record (stype varchar2(4), statistic# number, name varchar2(100)); type sntab is table of snrec index by pls_integer; sn_tmp sntab; sn sntab; &_IF_ORA10_OR_HIGHER type sestab is table of v$session%rowtype index by pls_integer; --For ORA9 we can't just declare this with a table type, since we need to join V$SESSION with V$SESSION_WAIT &_IF_ORA9 TYPE sestab_rec IS RECORD ( &_IF_ORA9 SADDR RAW(8), &_IF_ORA9 SID NUMBER, &_IF_ORA9 SERIAL# NUMBER, &_IF_ORA9 AUDSID NUMBER, &_IF_ORA9 PADDR RAW(8), &_IF_ORA9 USER# NUMBER, &_IF_ORA9 USERNAME VARCHAR2(30), &_IF_ORA9 COMMAND NUMBER, &_IF_ORA9 OWNERID NUMBER, &_IF_ORA9 TADDR VARCHAR2(16), &_IF_ORA9 LOCKWAIT VARCHAR2(16), &_IF_ORA9 STATUS VARCHAR2(8), &_IF_ORA9 SERVER VARCHAR2(9), &_IF_ORA9 SCHEMA# NUMBER, &_IF_ORA9 SCHEMANAME VARCHAR2(30), &_IF_ORA9 OSUSER VARCHAR2(30), &_IF_ORA9 PROCESS VARCHAR2(12), &_IF_ORA9 MACHINE VARCHAR2(64), &_IF_ORA9 TERMINAL VARCHAR2(30), &_IF_ORA9 PROGRAM VARCHAR2(64), &_IF_ORA9 TYPE VARCHAR2(10), &_IF_ORA9 SQL_ADDRESS RAW(8), &_IF_ORA9 SQL_HASH_VALUE NUMBER, &_IF_ORA9 PREV_SQL_ADDR RAW(8), &_IF_ORA9 PREV_HASH_VALUE NUMBER, &_IF_ORA9 MODULE VARCHAR2(48), &_IF_ORA9 MODULE_HASH NUMBER, &_IF_ORA9 ACTION VARCHAR2(32), &_IF_ORA9 ACTION_HASH NUMBER, &_IF_ORA9 CLIENT_INFO VARCHAR2(64), &_IF_ORA9 FIXED_TABLE_SEQUENCE NUMBER, &_IF_ORA9 ROW_WAIT_OBJ# NUMBER, &_IF_ORA9 ROW_WAIT_FILE# NUMBER, &_IF_ORA9 ROW_WAIT_BLOCK# NUMBER, &_IF_ORA9 ROW_WAIT_ROW# NUMBER, &_IF_ORA9 LOGON_TIME DATE, &_IF_ORA9 LAST_CALL_ET NUMBER, &_IF_ORA9 PDML_ENABLED VARCHAR2(3), &_IF_ORA9 FAILOVER_TYPE VARCHAR2(13), &_IF_ORA9 FAILOVER_METHOD VARCHAR2(10), &_IF_ORA9 FAILED_OVER VARCHAR2(3), &_IF_ORA9 RESOURCE_CONSUMER_GROUP VARCHAR2(32), &_IF_ORA9 PDML_STATUS VARCHAR2(8), &_IF_ORA9 PDDL_STATUS VARCHAR2(8), &_IF_ORA9 PQ_STATUS VARCHAR2(8), &_IF_ORA9 CURRENT_QUEUE_DURATION NUMBER, &_IF_ORA9 CLIENT_IDENTIFIER VARCHAR2(64), &_IF_ORA9 SID2 NUMBER, &_IF_ORA9 SEQ# NUMBER, &_IF_ORA9 EVENT VARCHAR2(64), &_IF_ORA9 P1TEXT VARCHAR2(64), &_IF_ORA9 P1 NUMBER, &_IF_ORA9 P1RAW RAW(8), &_IF_ORA9 P2TEXT VARCHAR2(64), &_IF_ORA9 P2 NUMBER, &_IF_ORA9 P2RAW RAW(8), &_IF_ORA9 P3TEXT VARCHAR2(64), &_IF_ORA9 P3 NUMBER, &_IF_ORA9 P3RAW RAW(8), &_IF_ORA9 WAIT_TIME NUMBER, &_IF_ORA9 SECONDS_IN_WAIT NUMBER, &_IF_ORA9 STATE VARCHAR2(19) &_IF_ORA9 ); &_IF_ORA9 type sestab is table of sestab_rec index by pls_integer; g_sessions sestab; g_empty_sessions sestab; type hc_tab is table of number index by pls_integer; -- index is sql hash value type ses_hash_tab is table of hc_tab index by pls_integer; -- index is SID g_ses_hash_tab ses_hash_tab; g_empty_ses_hash_tab ses_hash_tab; -- dbms_debug_vc2coll is a built-in collection present in every oracle db g_ash sys.dbms_debug_vc2coll := new sys.dbms_debug_vc2coll(); g_empty_ash sys.dbms_debug_vc2coll := new sys.dbms_debug_vc2coll(); g_ash_samples_taken number := 0; g_count_statname number; g_count_eventname number; g_mysid number; i number; a number; b number; c number; delta number; evcnt number; changed_values number; pagesize number:=99999999999999; missing_values_s1 number := 0; missing_values_s2 number := 0; disappeared_sid number := 0; lv_curr_sid number := 0; -- used for determining whether to print an empty line between session stats d1 date; d2 date; ash_date1 date; ash_date2 date; lv_gather varchar2(1000); gv_header_string varchar2(1000); lv_data_string varchar2(1000); lv_ash varchar2(1000); lv_stats varchar2(1000); gather_stats number := 0; gather_ash number := 0; -- CONFIGURABLE STUFF -- -- this sets what are the default ash sample TOP reporting group by columns &_IF_ORA10_OR_HIGHER g_ash_columns varchar2(1000) := 'sql_id + sql_child_number + event + wait_class'; &_IF_ORA10_OR_HIGHER g_ash_columns1 varchar2(1000) := 'event + wait_class'; &_IF_ORA10_OR_HIGHER g_ash_columns2 varchar2(1000) := 'sid + sql_id + event + wait_class'; &_IF_ORA10_OR_HIGHER g_ash_columns3 varchar2(1000) := 'plsql_object_id + plsql_subprogram_id + sql_id'; &_IF_ORA9 g_ash_columns varchar2(1000) := 'sql_hash_value + event'; &_IF_ORA9 g_ash_columns1 varchar2(1000) := 'event'; &_IF_ORA9 g_ash_columns2 varchar2(1000) := 'sid + sql_hash_value + event'; &_IF_ORA9 g_ash_columns3 varchar2(1000) := 'plsql_object_id + plsql_subprogram_id + sql_hash_value'; -- output column configuration output_header number := 0; -- 1=true 0=false output_username number := 1; -- v$session.username output_sid number := 1; -- sid output_time number := 0; -- time of snapshot start output_seconds number := 0; -- seconds in snapshot (shown in footer of each snapshot too) output_stype number := 1; -- statistic type (WAIT,STAT,TIME,ENQG,LATG,...) output_sname number := 1; -- statistic name output_delta number := 1; -- raw delta output_delta_s number := 0; -- raw delta normalized to per second output_hdelta number := 0; -- human readable delta output_hdelta_s number := 1; -- human readable delta normalized to per second output_percent number := 1; -- percent of total time/samples output_eventcnt number := 1; -- wait event count output_eventcnt_s number := 1; -- wait event count output_eventavg number := 1; -- average wait duration &_IF_ORA9206_OR_LOWER output_pcthist number := 0; -- percent of total visual bar (histogram) -- 9.2.0.6 or lower - does not work - jbj2 &_IF_ORA9207_OR_HIGHER output_pcthist number := 1; -- percent of total visual bar (histogram) -- Histograms seem to work for me on 9.2.0.7 + - JBJ2) -- column widths in ASH report output w_sid number := 6; w_username number := 20; w_machine number := 20; w_terminal number := 20; w_program number := 25; w_event number := 35; w_wait_class number := 15; w_state number := 8; w_p1 number := 20; w_p2 number := 20; w_p3 number := 20; w_row_wait_obj# number := 10; w_row_wait_file# number := 6; w_row_wait_block# number := 10; w_row_wait_row# number := 6; w_blocking_session_status number := 15; w_blocking_instance number := 12; w_blocking_session number := 12; w_sql_hash_value number := 12; w_sql_id number := 15; w_sql_child_number number := 9; w_plsql_entry_object_id number := 10; w_plsql_entry_subprogram_id number := 10; w_plsql_object_id number := 10; w_plsql_subprogram_id number := 10; w_module number := 25; w_action number := 25; w_client_identifier number := 25; w_service_name number := 25; w_activity_pct number := 7; -- END CONFIGURABLE STUFF -- -- constants for ash collection extraction from the vc2 collection s_sid constant number := 1 ; s_username constant number := 2 ; s_machine constant number := 3 ; s_terminal constant number := 4 ; s_program constant number := 5 ; s_event constant number := 6 ; s_wait_class constant number := 7 ; s_state constant number := 8 ; s_p1 constant number := 9 ; s_p2 constant number := 10 ; s_p3 constant number := 11 ; s_row_wait_obj# constant number := 12 ; s_row_wait_file# constant number := 13 ; s_row_wait_block# constant number := 14 ; s_row_wait_row# constant number := 15 ; s_blocking_session_status constant number := 16 ; s_blocking_instance constant number := 17 ; s_blocking_session constant number := 18 ; s_sql_hash_value constant number := 19 ; s_sql_id constant number := 20 ; s_sql_child_number constant number := 21 ; s_plsql_entry_object_id constant number := 22 ; s_plsql_entry_subprogram_id constant number := 23 ; s_plsql_object_id constant number := 24 ; s_plsql_subprogram_id constant number := 25 ; s_module constant number := 26 ; s_action constant number := 27 ; s_client_identifier constant number := 28 ; s_service_name constant number := 29 ; -- constants for ash collection reporting, which columns to show in report c_sid constant number := power(2, s_sid ); c_username constant number := power(2, s_username ); c_machine constant number := power(2, s_machine ); c_terminal constant number := power(2, s_terminal ); c_program constant number := power(2, s_program ); c_event constant number := power(2, s_event ); c_wait_class constant number := power(2, s_wait_class ); c_state constant number := power(2, s_state ); c_p1 constant number := power(2, s_p1 ); c_p2 constant number := power(2, s_p2 ); c_p3 constant number := power(2, s_p3 ); c_row_wait_obj# constant number := power(2, s_row_wait_obj# ); c_row_wait_file# constant number := power(2, s_row_wait_file# ); c_row_wait_block# constant number := power(2, s_row_wait_block# ); c_row_wait_row# constant number := power(2, s_row_wait_row# ); c_blocking_session_status constant number := power(2, s_blocking_session_status ); c_blocking_instance constant number := power(2, s_blocking_instance ); c_blocking_session constant number := power(2, s_blocking_session ); c_sql_hash_value constant number := power(2, s_sql_hash_value ); c_sql_id constant number := power(2, s_sql_id ); c_sql_child_number constant number := power(2, s_sql_child_number ); c_plsql_entry_object_id constant number := power(2, s_plsql_entry_object_id ); c_plsql_entry_subprogram_id constant number := power(2, s_plsql_entry_subprogram_id); c_plsql_object_id constant number := power(2, s_plsql_object_id ); c_plsql_subprogram_id constant number := power(2, s_plsql_subprogram_id ); c_module constant number := power(2, s_module ); c_action constant number := power(2, s_action ); c_client_identifier constant number := power(2, s_client_identifier ); c_service_name constant number := power(2, s_service_name ); -- bitfield specifying which columns to group by in sampled session activity (ASH) g_ash_grouping number := 63; -- test /*--------------------------------------------------- -- proc for outputting data to trace or dbms_output ---------------------------------------------------*/ procedure output(p_txt in varchar2) is begin if (getopt('&snapper_options', 'out') is not null) or (getopt('&snapper_options', 'out') is null and getopt('&snapper_options', 'trace') is null) then dbms_output.put_line(p_txt); end if; -- The block below is a sqlplus trick for conditionally commenting out PL/SQL code &_IF_DBMS_SYSTEM_ACCESSIBLE if getopt('&snapper_options', 'trace') is not null then sys.dbms_system.ksdwrt(1, p_txt); sys.dbms_system.ksdfls; end if; -- */ end; -- output /*--------------------------------------------------- -- proc for outputting data, utilizing global vars ---------------------------------------------------*/ procedure fout is l_output_username VARCHAR2(100); begin --if s2(b).stype='WAIT' then output( 'DEBUG WAIT ' || sn(s2(b).statistic#).name || ' ' || delta ); end if; --output( 'DEBUG, Entering fout(), b='||to_char(b)||' sn(s2(b).statistic#='||s2(b).statistic# ); --output( 'DEBUG, In fout(), a='||to_char(a)||' b='||to_char(b)||' s1.count='||s1.count||' s2.count='||s2.count||' s2.count='||s2.count); if output_username = 1 then begin l_output_username := nvl( g_sessions(s2(b).sid).username, substr(g_sessions(s2(b).sid).program, instr(g_sessions(s2(b).sid).program,'(')) ); exception when no_data_found then l_output_username := 'error'; when others then raise; end; end if; output( CASE WHEN output_header = 1 THEN 'SID= ' END || CASE WHEN output_sid = 1 THEN to_char(s2(b).sid,'999999')||', ' END || CASE WHEN output_username = 1 THEN rpad(CASE s2(b).sid WHEN -1 THEN ' ' ELSE NVL(l_output_username, ' ') END, 10)||', ' END || CASE WHEN output_time = 1 THEN to_char(d1, 'YYYYMMDD HH24:MI:SS')||', ' END || CASE WHEN output_seconds = 1 THEN to_char(case (d2-d1) when 0 then &snapper_sleep else (d2-d1) * 86400 end, '9999999')||', ' END || CASE WHEN output_stype = 1 THEN s2(b).stype||', ' END || CASE WHEN output_sname = 1 THEN rpad(sn(s2(b).statistic#).name, 58, ' ')||', ' END || CASE WHEN output_delta = 1 THEN to_char(delta, '999999999999')||', ' END || CASE WHEN output_delta_s = 1 THEN to_char(delta/(case (d2-d1) when 0 then &snapper_sleep else (d2-d1) * 86400 end),'999999999')||', ' END || CASE WHEN output_hdelta = 1 THEN lpad(tptformat(delta, s2(b).stype), 10, ' ')||', ' END || CASE WHEN output_hdelta_s = 1 THEN lpad(tptformat(delta/(case (d2-d1) when 0 then &snapper_sleep else (d2-d1)* 86400 end ), s2(b).stype), 10, ' ')||', ' END || CASE WHEN output_percent = 1 THEN CASE WHEN s2(b).stype IN ('TIME','WAIT') THEN to_char(delta/CASE (d2-d1) WHEN 0 THEN &snapper_sleep ELSE (d2-d1) * 86400 END / 10000, '9999.9')||'%' ELSE ' ' END END||', ' || CASE WHEN output_pcthist = 1 THEN CASE WHEN s2(b).stype IN ('TIME','WAIT') THEN rpad(rpad('[', ceil(round(delta/CASE (d2-d1) WHEN 0 THEN &snapper_sleep ELSE (d2-d1) * 86400 END / 100000,1))+1, CASE WHEN s2(b).stype IN ('WAIT') THEN 'W' WHEN sn(s2(b).statistic#).name = 'DB CPU' THEN '@' ELSE '#' END),11,' ')||']' ELSE ' ' END END||', ' || CASE WHEN output_eventcnt = 1 THEN CASE WHEN s2(b).stype IN ('WAIT') THEN to_char(evcnt, '99999999') ELSE ' ' END END||', ' || CASE WHEN output_eventcnt_s = 1 THEN CASE WHEN s2(b).stype IN ('WAIT') THEN lpad(tptformat((evcnt / case (d2-d1) when 0 then &snapper_sleep else (d2-d1)* 86400 end ), 'STAT' ), 10, ' ') ELSE ' ' END END||', ' || CASE WHEN output_eventavg = 1 THEN CASE WHEN s2(b).stype IN ('WAIT') THEN lpad(tptformat(delta / CASE WHEN evcnt = 0 THEN 1 ELSE evcnt END, s2(b).stype), 10, ' ') ELSE ' ' END END ); end; /*--------------------------------------------------- -- function for converting large numbers to human-readable format ---------------------------------------------------*/ function tptformat( p_num in number, p_stype in varchar2 default 'STAT', p_precision in number default 2, p_base in number default 10, -- for KiB/MiB formatting use p_grouplen in number default 3 -- p_base=2 and p_grouplen=10 ) return varchar2 is begin if p_num = 0 then return '0'; end if; if p_stype in ('WAIT','TIME') then return round( p_num / power( p_base , trunc(log(p_base,abs(p_num)))-trunc(mod(log(p_base,abs(p_num)),p_grouplen)) ), p_precision ) || case trunc(log(p_base,abs(p_num)))-trunc(mod(log(p_base,abs(p_num)),p_grouplen)) when 0 then 'us' when 1 then 'us' when p_grouplen*1 then 'ms' when p_grouplen*2 then 's' when p_grouplen*3 then 'ks' when p_grouplen*4 then 'Ms' else '*'||p_base||'^'||to_char( trunc(log(p_base,abs(p_num)))-trunc(mod(log(p_base,abs(p_num)),p_grouplen)) )||' us' end; else return round( p_num / power( p_base , trunc(log(p_base,abs(p_num)))-trunc(mod(log(p_base,abs(p_num)),p_grouplen)) ), p_precision ) || case trunc(log(p_base,abs(p_num)))-trunc(mod(log(p_base,abs(p_num)),p_grouplen)) when 0 then '' when 1 then '' when p_grouplen*1 then 'k' when p_grouplen*2 then 'M' when p_grouplen*3 then 'G' when p_grouplen*4 then 'T' when p_grouplen*5 then 'P' when p_grouplen*6 then 'E' else '*'||p_base||'^'||to_char( trunc(log(p_base,abs(p_num)))-trunc(mod(log(p_base,abs(p_num)),p_grouplen)) ) end; end if; end; -- tptformat /*--------------------------------------------------- -- simple function for parsing arguments from parameter string ---------------------------------------------------*/ function getopt( p_parvalues in varchar2, p_extract in varchar2, p_delim in varchar2 default ',' ) return varchar2 is ret varchar(1000) := NULL; begin -- dbms_output.put('p_parvalues = ['||p_parvalues||'] ' ); -- dbms_output.put('p_extract = ['||p_extract||'] ' ); if lower(p_parvalues) like lower(p_extract)||'%' or lower(p_parvalues) like '%'||p_delim||lower(p_extract)||'%' then ret := nvl ( substr(p_parvalues, instr(p_parvalues, p_extract)+length(p_extract), case instr( substr(p_parvalues, instr(p_parvalues, p_extract)+length(p_extract) ) , p_delim ) when 0 then length(p_parvalues) else instr( substr(p_parvalues, instr(p_parvalues, p_extract)+length(p_extract) ) , p_delim ) - 1 end ) , chr(0) -- in case parameter was specified but with no value ); else ret := null; -- no parameter found end if; -- dbms_output.put_line('ret = ['||replace(ret,chr(0),'\0')||']'); return ret; end; -- getopt /*--------------------------------------------------- -- proc for getting session list with username, osuser, machine etc ---------------------------------------------------*/ procedure get_sessions is tmp_sessions sestab; begin select &_IF_ORA9 s.SADDR &_IF_ORA9 , s.SID &_IF_ORA9 , s.SERIAL# &_IF_ORA9 , s.AUDSID &_IF_ORA9 , s.PADDR &_IF_ORA9 , s.USER# &_IF_ORA9 , s.USERNAME &_IF_ORA9 , s.COMMAND &_IF_ORA9 , s.OWNERID &_IF_ORA9 , s.TADDR &_IF_ORA9 , s.LOCKWAIT &_IF_ORA9 , s.STATUS &_IF_ORA9 , s.SERVER &_IF_ORA9 , s.SCHEMA# &_IF_ORA9 , s.SCHEMANAME &_IF_ORA9 , s.OSUSER &_IF_ORA9 , s.PROCESS &_IF_ORA9 , s.MACHINE &_IF_ORA9 , s.TERMINAL &_IF_ORA9 , CASE WHEN s.PROGRAM = 'ORACLE.EXE' THEN '('||bg.name||')' ELSE s.program END program &_IF_ORA9 , s.TYPE &_IF_ORA9 , s.SQL_ADDRESS &_IF_ORA9 , s.SQL_HASH_VALUE &_IF_ORA9 , s.PREV_SQL_ADDR &_IF_ORA9 , s.PREV_HASH_VALUE &_IF_ORA9 , s.MODULE &_IF_ORA9 , s.MODULE_HASH &_IF_ORA9 , s.ACTION &_IF_ORA9 , s.ACTION_HASH &_IF_ORA9 , s.CLIENT_INFO &_IF_ORA9 , s.FIXED_TABLE_SEQUENCE &_IF_ORA9 , s.ROW_WAIT_OBJ# &_IF_ORA9 , s.ROW_WAIT_FILE# &_IF_ORA9 , s.ROW_WAIT_BLOCK# &_IF_ORA9 , s.ROW_WAIT_ROW# &_IF_ORA9 , s.LOGON_TIME &_IF_ORA9 , s.LAST_CALL_ET &_IF_ORA9 , s.PDML_ENABLED &_IF_ORA9 , s.FAILOVER_TYPE &_IF_ORA9 , s.FAILOVER_METHOD &_IF_ORA9 , s.FAILED_OVER &_IF_ORA9 , s.RESOURCE_CONSUMER_GROUP &_IF_ORA9 , s.PDML_STATUS &_IF_ORA9 , s.PDDL_STATUS &_IF_ORA9 , s.PQ_STATUS &_IF_ORA9 , s.CURRENT_QUEUE_DURATION &_IF_ORA9 , s.CLIENT_IDENTIFIER &_IF_ORA9 , sw.sid SID2 &_IF_ORA9 , sw.SEQ# &_IF_ORA9 , sw.EVENT &_IF_ORA9 , sw.P1TEXT &_IF_ORA9 , sw.P1 &_IF_ORA9 , sw.P1RAW &_IF_ORA9 , sw.P2TEXT &_IF_ORA9 , sw.P2 &_IF_ORA9 , sw.P2RAW &_IF_ORA9 , sw.P3TEXT &_IF_ORA9 , sw.P3 &_IF_ORA9 , sw.P3RAW &_IF_ORA9 , sw.WAIT_TIME &_IF_ORA9 , sw.SECONDS_IN_WAIT &_IF_ORA9 , sw.STATE &_IF_ORA10_OR_HIGHER * bulk collect into tmp_sessions from &_IF_ORA9 v$session s, v$session_wait sw, v$bgprocess bg, v$process p &_IF_ORA10_OR_HIGHER v$session where &_IF_ORA9 s.sid in (&snapper_sid) and s.sid=sw.sid and p.addr = s.paddr and s.paddr = bg.paddr(+); &_IF_ORA10_OR_HIGHER sid in (&snapper_sid); g_sessions := g_empty_sessions; for i in 1..tmp_sessions.count loop g_sessions(tmp_sessions(i).sid) := tmp_sessions(i); end loop; end; -- get_sessions /*--------------------------------------------------- -- function for getting session list with username, osuser, machine etc -- this func does not update the g_sessions global array but returns session info as return value ---------------------------------------------------*/ function get_sessions return sestab is tmp_sessions sestab; l_return_sessions sestab; begin select &_IF_ORA9 s.*,sw.* &_IF_ORA10_OR_HIGHER * bulk collect into tmp_sessions from &_IF_ORA9 v$session s, v$session_wait sw &_IF_ORA10_OR_HIGHER v$session where &_IF_ORA9 s.sid in (&snapper_sid) and s.sid=sw.sid; &_IF_ORA10_OR_HIGHER sid in (&snapper_sid); for i in 1..tmp_sessions.count loop --output('get_sessions i='||i||' sid='||tmp_sessions(i).sid); l_return_sessions(tmp_sessions(i).sid) := tmp_sessions(i); end loop; return l_return_sessions; end; -- get_sessions /*--------------------------------------------------- -- functions for extracting and converting v$session -- records to varchar2 ---------------------------------------------------*/ function sitem(p in varchar2) return varchar2 as begin return '<'||translate(p, '<>', '__')||'>'; end; -- sitem varchar2 function sitem(p in number) return varchar2 as begin return '<'||to_char(p)||'>'; end; -- sitem number function sitem(p in date) return varchar2 as begin return '<'||to_char(p, 'YYYY-MM-DD HH24:MI:SS')||'>'; end; -- sitem date function sitem_raw(p in raw) return varchar2 as begin return '<'||upper(rawtohex(p))||'>'; end; -- sitem_raw /*--------------------------------------------------- -- proc for resetting the snapper ash array ---------------------------------------------------*/ procedure reset_ash is begin g_ash_samples_taken := 0; -- clear g_ash g_ash := new sys.dbms_debug_vc2coll(); end; -- reset_ash /*--------------------------------------------------- -- proc for getting ash style samples from v$session -- (and v$session_wait in 9i) ---------------------------------------------------*/ procedure extract_ash is ash_i number; &_IF_ORA10_OR_HIGHER s v$session%rowtype; &_IF_ORA9 s sestab_rec; begin -- keep track how many times we sampled v$session so we could calculate averages later on g_ash_samples_taken := g_ash_samples_taken + 1; --output('g_sessions.count='||g_sessions.count); ash_i := g_sessions.first; while ash_i is not null loop s := g_sessions(ash_i); -- only extract active sessions, TODO: get rid of wait_class for 9i compatibility if -- active, on cpu (s.status = 'ACTIVE' and s.state != 'WAITING' and s.sid != g_mysid) or -- active, waiting for non-idle wait &_IF_ORA10_OR_HIGHER (s.status = 'ACTIVE' and s.state = 'WAITING' and s.wait_class != 'Idle' and s.sid != g_mysid) &_IF_ORA9 (s.status = 'ACTIVE' and s.state = 'WAITING' &_IF_ORA9 -- Use a fixed list of idle wait events on 9i, since wait_class is not available &_IF_ORA9 and lower(s.event) not in ( &_IF_ORA9 'smon timer' -- idle events from 9i &_IF_ORA9 , 'pmon timer' &_IF_ORA9 , 'rdbms ipc message' &_IF_ORA9 , 'null event' &_IF_ORA9 , 'parallel query dequeue' &_IF_ORA9 , 'pipe get' &_IF_ORA9 , 'client message' &_IF_ORA9 , 'sql*net message from client' &_IF_ORA9 , 'dispatcher timer' &_IF_ORA9 , 'virtual circuit status' &_IF_ORA9 , 'lock manager wait for remote message' &_IF_ORA9 , 'px idle wait' &_IF_ORA9 , 'px deq: execution msg' &_IF_ORA9 , 'px deq: table q normal' &_IF_ORA9 , 'wakeup time manager' &_IF_ORA9 , 'slave wait' &_IF_ORA9 , 'i/o slave wait' &_IF_ORA9 , 'jobq slave wait' &_IF_ORA9 , 'null event' &_IF_ORA9 , 'gcs remote message' &_IF_ORA9 , 'gcs for action' &_IF_ORA9 , 'ges remote message' &_IF_ORA9 , 'queue messages' &_IF_ORA9 , 'pmon timer' -- from 11.2.0.2 v$event_name &_IF_ORA9 , 'vktm logical idle wait' &_IF_ORA9 , 'vktm init wait for gsga' &_IF_ORA9 , 'iorm scheduler slave idle wait' &_IF_ORA9 , 'rdbms ipc message' &_IF_ORA9 , 'i/o slave wait' &_IF_ORA9 , 'vkrm idle' &_IF_ORA9 , 'wait for unread message on broadcast channel' &_IF_ORA9 , 'wait for unread message on multiple broadcast channels' &_IF_ORA9 , 'class slave wait' &_IF_ORA9 , 'ksv master wait' &_IF_ORA9 , 'ping' &_IF_ORA9 , 'watchdog main loop' &_IF_ORA9 , 'diag idle wait' &_IF_ORA9 , 'ges remote message' &_IF_ORA9 , 'gcs remote message' &_IF_ORA9 , 'heartbeat monitor sleep' &_IF_ORA9 , 'gcr sleep' &_IF_ORA9 , 'sga: mman sleep for component shrink' &_IF_ORA9 , 'mrp redo arrival' &_IF_ORA9 , 'lns async archive log' &_IF_ORA9 , 'lns async dest activation' &_IF_ORA9 , 'lns async end of log' &_IF_ORA9 , 'simulated log write delay' &_IF_ORA9 , 'lgwr real time apply sync' &_IF_ORA9 , 'parallel recovery slave idle wait' &_IF_ORA9 , 'logminer builder: idle' &_IF_ORA9 , 'logminer builder: branch' &_IF_ORA9 , 'logminer preparer: idle' &_IF_ORA9 , 'logminer reader: log (idle)' &_IF_ORA9 , 'logminer reader: redo (idle)' &_IF_ORA9 , 'logminer client: transaction' &_IF_ORA9 , 'logminer: other' &_IF_ORA9 , 'logminer: activate' &_IF_ORA9 , 'logminer: reset' &_IF_ORA9 , 'logminer: find session' &_IF_ORA9 , 'logminer: internal' &_IF_ORA9 , 'logical standby apply delay' &_IF_ORA9 , 'parallel recovery coordinator waits for slave cleanup' &_IF_ORA9 , 'parallel recovery control message reply' &_IF_ORA9 , 'parallel recovery slave next change' &_IF_ORA9 , 'px deq: txn recovery start' &_IF_ORA9 , 'px deq: txn recovery reply' &_IF_ORA9 , 'fbar timer' &_IF_ORA9 , 'smon timer' &_IF_ORA9 , 'px deq: metadata update' &_IF_ORA9 , 'space manager: slave idle wait' &_IF_ORA9 , 'px deq: index merge reply' &_IF_ORA9 , 'px deq: index merge execute' &_IF_ORA9 , 'px deq: index merge close' &_IF_ORA9 , 'px deq: kdcph_mai' &_IF_ORA9 , 'px deq: kdcphc_ack' &_IF_ORA9 , 'shared server idle wait' &_IF_ORA9 , 'dispatcher timer' &_IF_ORA9 , 'cmon timer' &_IF_ORA9 , 'pool server timer' &_IF_ORA9 , 'jox jit process sleep' &_IF_ORA9 , 'jobq slave wait' &_IF_ORA9 , 'pipe get' &_IF_ORA9 , 'px deque wait' &_IF_ORA9 , 'px idle wait' &_IF_ORA9 , 'px deq: join ack' &_IF_ORA9 , 'px deq credit: need buffer' &_IF_ORA9 , 'px deq credit: send blkd' &_IF_ORA9 , 'px deq: msg fragment' &_IF_ORA9 , 'px deq: parse reply' &_IF_ORA9 , 'px deq: execute reply' &_IF_ORA9 , 'px deq: execution msg' &_IF_ORA9 , 'px deq: table q normal' &_IF_ORA9 , 'px deq: table q sample' &_IF_ORA9 , 'streams fetch slave: waiting for txns' &_IF_ORA9 , 'streams: waiting for messages' &_IF_ORA9 , 'streams capture: waiting for archive log' &_IF_ORA9 , 'single-task message' &_IF_ORA9 , 'sql*net message from client' &_IF_ORA9 , 'sql*net vector message from client' &_IF_ORA9 , 'sql*net vector message from dblink' &_IF_ORA9 , 'pl/sql lock timer' &_IF_ORA9 , 'streams aq: emn coordinator idle wait' &_IF_ORA9 , 'emon slave idle wait' &_IF_ORA9 , 'streams aq: waiting for messages in the queue' &_IF_ORA9 , 'streams aq: waiting for time management or cleanup tasks' &_IF_ORA9 , 'streams aq: delete acknowledged messages' &_IF_ORA9 , 'streams aq: deallocate messages from streams pool' &_IF_ORA9 , 'streams aq: qmn coordinator idle wait' &_IF_ORA9 , 'streams aq: qmn slave idle wait' &_IF_ORA9 , 'streams aq: rac qmn coordinator idle wait' &_IF_ORA9 , 'hs message to agent' &_IF_ORA9 , 'asm background timer' &_IF_ORA9 , 'auto-sqltune: wait graph update' &_IF_ORA9 , 'wcr: replay client notify' &_IF_ORA9 , 'wcr: replay clock' &_IF_ORA9 , 'wcr: replay paused' &_IF_ORA9 , 'js external job' &_IF_ORA9 , 'cell worker idle') &_IF_ORA9 and s.sid != g_mysid) then --output('extract_ash: i='||i||' sid='||s.sid||' hv='||s.sql_hash_value||' sqlid='||s.sql_id); -- if not actually waiting for anything, clear the past wait event details if s.state != 'WAITING' then s.state:='ON CPU'; s.event:='ON CPU'; &_IF_ORA10_OR_HIGHER s.wait_class:='ON CPU'; --TODO: What do we need to do for 9i here? s.p1:=NULL; s.p2:=NULL; s.p3:=NULL; end if; g_ash.extend; -- max length 1000 bytes (due to dbms_debug_vc2coll) g_ash(g_ash.count) := substr( sitem(s.sid) -- 1 ||sitem(s.username) -- 2 -- 30 bytes ||sitem(s.machine) -- 3 -- 64 bytes ||sitem(s.terminal) -- 4 -- 30 bytes ||sitem(s.program) -- 5 -- 48 bytes ||sitem(s.event) -- 6 -- 64 bytes &_IF_ORA10_OR_HIGHER ||sitem(s.wait_class) -- 7 -- 64 bytes, 10g+ &_IF_ORA9 ||sitem('N/A') -- 7 ||sitem(s.state) -- 8 ||sitem(s.p1) -- 9 ||sitem(s.p2) -- 10 ||sitem(s.p3) -- 11 ||sitem(s.row_wait_obj#) -- 12 ||sitem(s.row_wait_file#) -- 13 ||sitem(s.row_wait_block#) -- 14 ||sitem(s.row_wait_row#) -- 15 &_IF_ORA10_OR_HIGHER ||sitem(s.blocking_session_status) -- 16 -- 10g+ &_IF_ORA9 ||sitem('N/A') -- 16 -- 10g+ -- 16 &_NO_BLK_INST ||sitem('N/A') -- 17 -- 10gR2+ &_YES_BLK_INST ||sitem(s.blocking_instance) -- 17 -- 10gR2+ &_IF_ORA10_OR_HIGHER ||sitem(s.blocking_session) -- 18 -- 10g+ &_IF_ORA9 ||sitem('N/A') -- 18 -- 10g+ ||sitem(s.sql_hash_value) -- 19 &_IF_ORA10_OR_HIGHER ||sitem(s.sql_id) -- 20 -- 10g+ &_IF_ORA9 ||sitem(to_char(s.sql_hash_value)) -- 20 -- 9i, let's just put hash_value into sql_id &_IF_ORA10_OR_HIGHER ||sitem(s.sql_child_number) -- 21 -- 10g+ &_IF_ORA9 ||sitem('N/A') -- 21 -- 10g+ &_NO_PLSQL_OBJ_ID ||sitem('N/A') -- 22 &_NO_PLSQL_OBJ_ID ||sitem('N/A') -- 23 &_NO_PLSQL_OBJ_ID ||sitem('N/A') -- 24 &_NO_PLSQL_OBJ_ID ||sitem('N/A') -- 25 &_YES_PLSQL_OBJ_ID ||sitem(s.plsql_entry_object_id) -- 22 &_YES_PLSQL_OBJ_ID ||sitem(s.plsql_entry_subprogram_id) -- 23 &_YES_PLSQL_OBJ_ID ||sitem(s.plsql_object_id) -- 24 &_YES_PLSQL_OBJ_ID ||sitem(s.plsql_subprogram_id) -- 25 ||sitem(s.module) -- 26 -- 48 bytes ||sitem(s.action) -- 27 -- 32 bytes ||sitem(s.client_identifier) -- 28 -- 64 bytes &_IF_ORA10_OR_HIGHER ||sitem(s.service_name) -- 29 -- 64 bytes, 10g+ &_IF_ORA9 ||sitem('N/A') -- 29 , 1, 1000); end if; -- sample is of an active session ash_i := g_sessions.next(ash_i); end loop; exception when no_data_found then output('error in extract_ash(): no_data_found for item '||i); end; -- extract_ash /*--------------------------------------------------- -- proc for querying performance data into collections ---------------------------------------------------*/ procedure snap( p_snapdate in out date, p_stats in out stab ) is lv_include_stat varchar2(1000) := nvl( lower(getopt('&snapper_options', 'sinclude=' )), '%'); lv_include_latch varchar2(1000) := nvl( lower(getopt('&snapper_options', 'linclude=' )), '%'); lv_include_time varchar2(1000) := nvl( lower(getopt('&snapper_options', 'tinclude=' )), '%'); lv_include_wait varchar2(1000) := nvl( lower(getopt('&snapper_options', 'winclude=' )), '%'); begin p_snapdate := sysdate; select * bulk collect into p_stats from ( select 'STAT' stype, sid, statistic# - pls_adjust statistic#, value, null event_count from v$sesstat where sid in (&snapper_sid) and (lv_gather like '%s%' or lv_gather like '%a%') and statistic# in (select /*+ no_unnest */ statistic# from v$statname where lower(name) like '%'||lv_include_stat||'%' &_IF_ORA10_OR_HIGHER or regexp_like (name, lv_include_stat, 'i') ) -- union all select 'WAIT', sw.sid, en.event# + (select count(*) from v$statname) + 1 - pls_adjust, nvl(se.time_waited_micro,0) + ( decode(se.event||sw.state, sw.event||'WAITING', sw.seconds_in_wait, 0) * 1000000 ) value, total_waits event_count from v$session_wait sw, v$session_event se, v$event_name en where sw.sid = se.sid and se.event = en.name and se.sid in (&snapper_sid) and (lv_gather like '%w%' or lv_gather like '%a%') and event# in (select event# from v$event_name where lower(name) like '%'||lv_include_wait||'%' &_IF_ORA10_OR_HIGHER or regexp_like (name, lv_include_wait, 'i') ) -- &_IF_ORA10_OR_HIGHER union all &_IF_ORA10_OR_HIGHER select 'TIME' stype, sid, stat_id - pls_adjust statistic#, value, null event_count &_IF_ORA10_OR_HIGHER from v$sess_time_model &_IF_ORA10_OR_HIGHER where sid in (&snapper_sid) &_IF_ORA10_OR_HIGHER and (lv_gather like '%t%' or lv_gather like '%a%') &_IF_ORA10_OR_HIGHER and stat_id in (select stat_id from v$sys_time_model &_IF_ORA10_OR_HIGHER where lower(stat_name) like '%'||lv_include_time||'%' &_IF_ORA10_OR_HIGHER or regexp_like (stat_name, lv_include_time, 'i') &_IF_ORA10_OR_HIGHER ) -- union all select 'LATG', -1 sid, l.latch# + (select count(*) from v$statname) + (select count(*) from v$event_name) + 1 - pls_adjust statistic#, l.gets + l.immediate_gets value, null event_count from v$latch l where (lv_gather like '%l%' or lv_gather like '%a%') and latch# in (select latch# from v$latchname where lower(name) like '%'||lv_include_latch||'%' &_IF_ORA10_OR_HIGHER or regexp_like (name, lv_include_latch, 'i') ) -- &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 union all &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 select 'BUFG', -1 sid, &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 s.indx + &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 (select count(*) from v$statname) + &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 (select count(*) from v$event_name) + &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 (select count(*) from v$latch) + &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 1 - pls_adjust statistic#, &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 s.why0+s.why1+s.why2 value, null event_count &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 from x$kcbsw s, x$kcbwh w &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 where &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 s.indx = w.indx &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 and s.why0+s.why1+s.why2 > 0 &_IF_X_ACCESSIBLE &_IF_LOWER_THAN_ORA11 and (lv_gather like '%b%' or lv_gather like '%a%') -- &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER union all &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER select 'BUFG', -1 sid, &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER sw.indx + &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER (select count(*) from v$statname) + &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER (select count(*) from v$event_name) + &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER (select count(*) from v$latch) + &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER 1 - pls_adjust statistic#, &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER why.why0+why.why1+why.why2+sw.other_wait value, null event_count &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER from &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER x$kcbuwhy why, &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER x$kcbwh dsc, &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER x$kcbsw sw &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER where &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER why.indx = dsc.indx &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER and why.why0 + why.why1 + why.why2 + sw.other_wait > 0 &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER and dsc.indx = sw.indx &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER and why.indx = sw.indx &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER -- deliberate cartesian join &_IF_X_ACCESSIBLE &_IF_ORA11_OR_HIGHER and (lv_gather like '%b%' or lv_gather like '%a%') -- union all select 'ENQG', -1 sid, ascii(substr(e.eq_type,1,1))*256 + ascii(substr(e.eq_type,2,1)) + (select count(*) from v$statname) + (select count(*) from v$event_name) + (select count(*) from v$latch) + &_IF_X_ACCESSIBLE (select count(*) from x$kcbwh) + 1 - pls_adjust statistic#, e.total_req# value, null event_count from v$enqueue_stat e where (lv_gather like '%e%' or lv_gather like '%a%') ) snapper_stats order by sid, stype, statistic#; end snap; /*--------------------------------------------------- -- proc for dumping ASH data out in grouped -- and ordered fashion ---------------------------------------------------*/ procedure out_ash( p_ash_columns in varchar2, p_topn in number := 10 ) as -- whether to print given column or not p_sid number := 0; p_username number := 0; p_machine number := 0; p_terminal number := 0; p_program number := 0; p_event number := 0; p_wait_class number := 0; p_state number := 0; p_p1 number := 0; p_p2 number := 0; p_p3 number := 0; p_row_wait_obj# number := 0; p_row_wait_file# number := 0; p_row_wait_block# number := 0; p_row_wait_row# number := 0; p_blocking_session_status number := 0; p_blocking_instance number := 0; p_blocking_session number := 0; p_sql_hash_value number := 0; p_sql_id number := 0; p_sql_child_number number := 0; p_plsql_entry_object_id number := 0; p_plsql_entry_subprogram_id number := 0; p_plsql_object_id number := 0; p_plsql_subprogram_id number := 0; p_module number := 0; p_action number := 0; p_client_identifier number := 0; p_service_name number := 0; -- temporary variables for holding session details (for later formatting) o_sid varchar2(100); o_username varchar2(100); o_machine varchar2(100); o_terminal varchar2(100); o_program varchar2(100); o_event varchar2(100); o_wait_class varchar2(100); o_state varchar2(100); o_p1 varchar2(100); o_p2 varchar2(100); o_p3 varchar2(100); o_row_wait_obj# varchar2(100); o_row_wait_file# varchar2(100); o_row_wait_block# varchar2(100); o_row_wait_row# varchar2(100); o_blocking_session_status varchar2(100); o_blocking_instance varchar2(100); o_blocking_session varchar2(100); o_sql_hash_value varchar2(100); o_sql_id varchar2(100); o_sql_child_number varchar2(100); o_plsql_entry_object_id varchar2(100); o_plsql_entry_subprogram_id varchar2(100); o_plsql_object_id varchar2(100); o_plsql_subprogram_id varchar2(100); o_module varchar2(100); o_action varchar2(100); o_client_identifier varchar2(100); o_service_name varchar2(100); -- helper local vars l_ash_grouping number := 0; l_output_line varchar2(4000); l_ash_header_line varchar2(4000); begin -- bail out if no ASH samples recorded if g_ash.count = 0 then output(' <No active sessions captured during the sampling period>'); return; end if; l_ash_header_line := 'Active%'; -- ash,ash1,ash2,ash3 parameter column group tokenizer for s in ( -- ORA9 SQL*Plus returns only a single row with CONNECT BY LEVEL; An additonal outer SELECT * from (...) fixes this &_IF_ORA9 select * from ( SELECT LEVEL , SUBSTR ( TOKEN , DECODE(LEVEL, 1, 1, INSTR(TOKEN, DELIMITER, 1, LEVEL-1)+1) , INSTR(TOKEN, DELIMITER, 1, LEVEL) - DECODE(LEVEL, 1, 1, INSTR(TOKEN, DELIMITER, 1, LEVEL-1)+1) ) TOKEN FROM ( SELECT REPLACE( LOWER(p_ash_columns) ,' ','')||'+' AS TOKEN , '+' AS DELIMITER FROM DUAL ) CONNECT BY INSTR(TOKEN, DELIMITER, 1, LEVEL)>0 &_IF_ORA9 ) ORDER BY LEVEL ASC ) loop case s.token -- actual column names in v$session when 'sid' then l_ash_grouping := l_ash_grouping + c_sid ; l_ash_header_line := l_ash_header_line || ' | ' || lpad('SID' , w_sid , ' '); when 'username' then l_ash_grouping := l_ash_grouping + c_username ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('USERNAME' , w_username , ' '); when 'machine' then l_ash_grouping := l_ash_grouping + c_machine ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('MACHINE' , w_machine , ' '); when 'terminal' then l_ash_grouping := l_ash_grouping + c_terminal ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('TERMINAL' , w_terminal , ' '); when 'program' then l_ash_grouping := l_ash_grouping + c_program ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('PROGRAM' , w_program , ' '); when 'event' then l_ash_grouping := l_ash_grouping + c_event ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('EVENT' , w_event , ' '); when 'wait_class' then l_ash_grouping := l_ash_grouping + c_wait_class ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('WAIT_CLASS' , w_wait_class , ' '); when 'state' then l_ash_grouping := l_ash_grouping + c_state ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('STATE' , w_state , ' '); when 'p1' then l_ash_grouping := l_ash_grouping + c_p1 ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('P1' , w_p1 , ' '); when 'p2' then l_ash_grouping := l_ash_grouping + c_p2 ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('P2' , w_p2 , ' '); when 'p3' then l_ash_grouping := l_ash_grouping + c_p3 ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('P3' , w_p3 , ' '); when 'row_wait_obj#' then l_ash_grouping := l_ash_grouping + c_row_wait_obj# ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('ROW_WAIT_OBJ#' , w_row_wait_obj# , ' '); when 'row_wait_file#' then l_ash_grouping := l_ash_grouping + c_row_wait_file# ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('ROW_WAIT_FILE#' , w_row_wait_file# , ' '); when 'row_wait_block#' then l_ash_grouping := l_ash_grouping + c_row_wait_block# ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('ROW_WAIT_BLOCK#' , w_row_wait_block# , ' '); when 'row_wait_row#' then l_ash_grouping := l_ash_grouping + c_row_wait_row# ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('ROW_WAIT_ROW#' , w_row_wait_row# , ' '); when 'blocking_session_status' then l_ash_grouping := l_ash_grouping + c_blocking_session_status ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('BLOCKING_SESSION_STATUS' , w_blocking_session_status , ' '); when 'blocking_instance' then l_ash_grouping := l_ash_grouping + c_blocking_instance ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('BLOCKING_INSTANCE' , w_blocking_instance , ' '); when 'blocking_session' then l_ash_grouping := l_ash_grouping + c_blocking_session ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('BLOCKING_SESSION' , w_blocking_session , ' '); when 'sql_hash_value' then l_ash_grouping := l_ash_grouping + c_sql_hash_value ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('SQL_HASH_VALUE' , w_sql_hash_value , ' '); when 'sql_id' then l_ash_grouping := l_ash_grouping + c_sql_id ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('SQL_ID' , w_sql_id , ' '); when 'sql_child_number' then l_ash_grouping := l_ash_grouping + c_sql_child_number ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('SQL_CHILD_NUMBER' , w_sql_child_number , ' '); when 'plsql_entry_object_id' then l_ash_grouping := l_ash_grouping + c_plsql_entry_object_id ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('PLSQL_ENTRY_OBJECT_ID' , w_plsql_entry_object_id , ' '); when 'plsql_entry_subprogram_id' then l_ash_grouping := l_ash_grouping + c_plsql_entry_subprogram_id; l_ash_header_line := l_ash_header_line || ' | ' || rpad('PLSQL_ENTRY_SUBPROGRAM_ID' , w_plsql_entry_subprogram_id, ' '); when 'plsql_object_id' then l_ash_grouping := l_ash_grouping + c_plsql_object_id ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('PLSQL_OBJECT_ID' , w_plsql_object_id , ' '); when 'plsql_subprogram_id' then l_ash_grouping := l_ash_grouping + c_plsql_subprogram_id ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('PLSQL_SUBPROGRAM_ID' , w_plsql_subprogram_id , ' '); when 'module' then l_ash_grouping := l_ash_grouping + c_module ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('MODULE' , w_module , ' '); when 'action' then l_ash_grouping := l_ash_grouping + c_action ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('ACTION' , w_action , ' '); when 'client_identifier' then l_ash_grouping := l_ash_grouping + c_client_identifier ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('CLIENT_IDENTIFIER' , w_client_identifier , ' '); when 'service_name' then l_ash_grouping := l_ash_grouping + c_service_name ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('SERVICE_NAME' , w_service_name , ' '); -- aliases for convenience (only either real name or alias should be used together at the same time) , ' '); when 'user' then l_ash_grouping := l_ash_grouping + c_username ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('USERNAME' , w_username , ' '); when 'obj' then l_ash_grouping := l_ash_grouping + c_row_wait_obj# ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('ROW_WAIT_OBJ#' , w_row_wait_obj# , ' '); when 'file' then l_ash_grouping := l_ash_grouping + c_row_wait_file# ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('ROW_WAIT_FILE#' , w_row_wait_file# , ' '); when 'block' then l_ash_grouping := l_ash_grouping + c_row_wait_block# ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('ROW_WAIT_BLOCK#' , w_row_wait_block# , ' '); when 'row' then l_ash_grouping := l_ash_grouping + c_row_wait_row# ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('ROW_WAIT_ROW#' , w_row_wait_row# , ' '); when 'bss' then l_ash_grouping := l_ash_grouping + c_blocking_session_status ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('BLOCKING_SESSION_STATUS' , w_blocking_session_status , ' '); when 'bsi' then l_ash_grouping := l_ash_grouping + c_blocking_instance ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('BLOCKING_INSTANCE' , w_blocking_instance , ' '); when 'bs' then l_ash_grouping := l_ash_grouping + c_blocking_session ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('BLOCKING_SESSION' , w_blocking_session , ' '); when 'sql' then l_ash_grouping := l_ash_grouping + c_sql_hash_value ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('SQL_HASH_VALUE' , w_sql_hash_value , ' '); when 'sqlid' then l_ash_grouping := l_ash_grouping + c_sql_id ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('SQL_ID' , w_sql_id , ' '); when 'child' then l_ash_grouping := l_ash_grouping + c_sql_child_number ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('SQL_CHILD_NUMBER' , w_sql_child_number , ' '); when 'plsql_eoid' then l_ash_grouping := l_ash_grouping + c_plsql_entry_object_id ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('PLSQL_ENTRY_OBJECT_ID' , w_plsql_entry_object_id , ' '); when 'plsql_esubpid' then l_ash_grouping := l_ash_grouping + c_plsql_entry_subprogram_id; l_ash_header_line := l_ash_header_line || ' | ' || rpad('PLSQL_ENTRY_SUBPROGRAM_ID' , w_plsql_entry_subprogram_id, ' '); when 'plsql_oid' then l_ash_grouping := l_ash_grouping + c_plsql_object_id ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('PLSQL_OBJECT_ID' , w_plsql_object_id , ' '); when 'plsql_subpid' then l_ash_grouping := l_ash_grouping + c_plsql_subprogram_id ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('PLSQL_SUBPROGRAM_ID' , w_plsql_subprogram_id , ' '); when 'mod' then l_ash_grouping := l_ash_grouping + c_module ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('MODULE' , w_module , ' '); when 'act' then l_ash_grouping := l_ash_grouping + c_action ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('ACTION' , w_action , ' '); when 'cid' then l_ash_grouping := l_ash_grouping + c_client_identifier ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('CLIENT_IDENTIFIER' , w_client_identifier , ' '); when 'service' then l_ash_grouping := l_ash_grouping + c_service_name ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('SERVICE_NAME' , w_service_name , ' '); when 'wait_event' then l_ash_grouping := l_ash_grouping + c_event ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('EVENT' , w_event , ' '); when 'wait_state' then l_ash_grouping := l_ash_grouping + c_state ; l_ash_header_line := l_ash_header_line || ' | ' || rpad('STATE' , w_state , ' '); else null; -- raise_application_error(-20000, 'Invalid ASH column name'); end case; -- case s.token end loop; -- tokenizer output(' '); output(lpad('-',length(l_ash_header_line),'-')); output(l_ash_header_line); output(lpad('-',length(l_ash_header_line),'-')); -- this is needed for "easy" sorting and group by ops (without any custom stored object types!) for i in ( with raw_records as ( select column_value rec from table(cast(g_ash as sys.dbms_debug_vc2coll)) ), ash_records as ( select substr(r.rec, instr(r.rec, '<', 1, 1)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 1)+1), '>')-1) sid , substr(r.rec, instr(r.rec, '<', 1, 2)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 2)+1), '>')-1) username , substr(r.rec, instr(r.rec, '<', 1, 3)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 3)+1), '>')-1) machine , substr(r.rec, instr(r.rec, '<', 1, 4)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 4)+1), '>')-1) terminal , substr(r.rec, instr(r.rec, '<', 1, 5)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 5)+1), '>')-1) program , substr(r.rec, instr(r.rec, '<', 1, 6)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 6)+1), '>')-1) event , substr(r.rec, instr(r.rec, '<', 1, 7)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 7)+1), '>')-1) wait_class , substr(r.rec, instr(r.rec, '<', 1, 8)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 8)+1), '>')-1) state , substr(r.rec, instr(r.rec, '<', 1, 9)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 9)+1), '>')-1) p1 , substr(r.rec, instr(r.rec, '<', 1, 10)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 10)+1), '>')-1) p2 , substr(r.rec, instr(r.rec, '<', 1, 11)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 11)+1), '>')-1) p3 , substr(r.rec, instr(r.rec, '<', 1, 12)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 12)+1), '>')-1) row_wait_obj# , substr(r.rec, instr(r.rec, '<', 1, 13)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 13)+1), '>')-1) row_wait_file# , substr(r.rec, instr(r.rec, '<', 1, 14)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 14)+1), '>')-1) row_wait_block# , substr(r.rec, instr(r.rec, '<', 1, 15)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 15)+1), '>')-1) row_wait_row# , substr(r.rec, instr(r.rec, '<', 1, 16)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 16)+1), '>')-1) blocking_session_status , substr(r.rec, instr(r.rec, '<', 1, 17)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 17)+1), '>')-1) blocking_instance , substr(r.rec, instr(r.rec, '<', 1, 18)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 18)+1), '>')-1) blocking_session , substr(r.rec, instr(r.rec, '<', 1, 19)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 19)+1), '>')-1) sql_hash_value , substr(r.rec, instr(r.rec, '<', 1, 20)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 20)+1), '>')-1) sql_id , substr(r.rec, instr(r.rec, '<', 1, 21)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 21)+1), '>')-1) sql_child_number , substr(r.rec, instr(r.rec, '<', 1, 22)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 22)+1), '>')-1) plsql_entry_object_id , substr(r.rec, instr(r.rec, '<', 1, 23)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 23)+1), '>')-1) plsql_entry_subprogram_id , substr(r.rec, instr(r.rec, '<', 1, 24)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 24)+1), '>')-1) plsql_object_id , substr(r.rec, instr(r.rec, '<', 1, 25)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 25)+1), '>')-1) plsql_subprogram_id , substr(r.rec, instr(r.rec, '<', 1, 26)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 26)+1), '>')-1) module , substr(r.rec, instr(r.rec, '<', 1, 27)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 27)+1), '>')-1) action , substr(r.rec, instr(r.rec, '<', 1, 28)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 28)+1), '>')-1) client_identifier , substr(r.rec, instr(r.rec, '<', 1, 29)+1, instr (substr(r.rec, instr(r.rec, '<', 1, 29)+1), '>')-1) service_name from raw_records r ) select * from ( select decode(bitand(l_ash_grouping, power(2, s_sid )), 0, chr(0), sid ) as sid , decode(bitand(l_ash_grouping, power(2, s_username )), 0, chr(0), username ) as username , decode(bitand(l_ash_grouping, power(2, s_machine )), 0, chr(0), machine ) as machine , decode(bitand(l_ash_grouping, power(2, s_terminal )), 0, chr(0), terminal ) as terminal , decode(bitand(l_ash_grouping, power(2, s_program )), 0, chr(0), program ) as program , decode(bitand(l_ash_grouping, power(2, s_event )), 0, chr(0), event ) as event , decode(bitand(l_ash_grouping, power(2, s_wait_class )), 0, chr(0), wait_class ) as wait_class , decode(bitand(l_ash_grouping, power(2, s_state )), 0, chr(0), state ) as state , decode(bitand(l_ash_grouping, power(2, s_p1 )), 0, chr(0), p1 ) as p1 , decode(bitand(l_ash_grouping, power(2, s_p2 )), 0, chr(0), p2 ) as p2 , decode(bitand(l_ash_grouping, power(2, s_p3 )), 0, chr(0), p3 ) as p3 , decode(bitand(l_ash_grouping, power(2, s_row_wait_obj# )), 0, chr(0), row_wait_obj# ) as row_wait_obj# , decode(bitand(l_ash_grouping, power(2, s_row_wait_file# )), 0, chr(0), row_wait_file# ) as row_wait_file# , decode(bitand(l_ash_grouping, power(2, s_row_wait_block# )), 0, chr(0), row_wait_block# ) as row_wait_block# , decode(bitand(l_ash_grouping, power(2, s_row_wait_row# )), 0, chr(0), row_wait_row# ) as row_wait_row# , decode(bitand(l_ash_grouping, power(2, s_blocking_session_status )), 0, chr(0), blocking_session_status ) as blocking_session_status , decode(bitand(l_ash_grouping, power(2, s_blocking_instance )), 0, chr(0), blocking_instance ) as blocking_instance , decode(bitand(l_ash_grouping, power(2, s_blocking_session )), 0, chr(0), blocking_session ) as blocking_session , decode(bitand(l_ash_grouping, power(2, s_sql_hash_value )), 0, chr(0), sql_hash_value ) as sql_hash_value , decode(bitand(l_ash_grouping, power(2, s_sql_id )), 0, chr(0), sql_id ) as sql_id , decode(bitand(l_ash_grouping, power(2, s_sql_child_number )), 0, chr(0), sql_child_number ) as sql_child_number , decode(bitand(l_ash_grouping, power(2, s_plsql_entry_object_id )), 0, chr(0), plsql_entry_object_id ) as plsql_entry_object_id , decode(bitand(l_ash_grouping, power(2, s_plsql_entry_subprogram_id )), 0, chr(0), plsql_entry_subprogram_id ) as plsql_entry_subprogram_id , decode(bitand(l_ash_grouping, power(2, s_plsql_object_id )), 0, chr(0), plsql_object_id ) as plsql_object_id , decode(bitand(l_ash_grouping, power(2, s_plsql_subprogram_id )), 0, chr(0), plsql_subprogram_id ) as plsql_subprogram_id , decode(bitand(l_ash_grouping, power(2, s_module )), 0, chr(0), module ) as module , decode(bitand(l_ash_grouping, power(2, s_action )), 0, chr(0), action ) as action , decode(bitand(l_ash_grouping, power(2, s_client_identifier )), 0, chr(0), client_identifier ) as client_identifier , decode(bitand(l_ash_grouping, power(2, s_service_name )), 0, chr(0), service_name ) as service_name , count(*)/g_ash_samples_taken average_active_samples from ash_records a group by decode(bitand(l_ash_grouping, power(2, s_sid )), 0, chr(0), sid ) -- sid , decode(bitand(l_ash_grouping, power(2, s_username )), 0, chr(0), username ) -- username , decode(bitand(l_ash_grouping, power(2, s_machine )), 0, chr(0), machine ) -- machine , decode(bitand(l_ash_grouping, power(2, s_terminal )), 0, chr(0), terminal ) -- terminal , decode(bitand(l_ash_grouping, power(2, s_program )), 0, chr(0), program ) -- program , decode(bitand(l_ash_grouping, power(2, s_event )), 0, chr(0), event ) -- event , decode(bitand(l_ash_grouping, power(2, s_wait_class )), 0, chr(0), wait_class ) -- wait_class , decode(bitand(l_ash_grouping, power(2, s_state )), 0, chr(0), state ) -- state , decode(bitand(l_ash_grouping, power(2, s_p1 )), 0, chr(0), p1 ) -- p1 , decode(bitand(l_ash_grouping, power(2, s_p2 )), 0, chr(0), p2 ) -- p2 , decode(bitand(l_ash_grouping, power(2, s_p3 )), 0, chr(0), p3 ) -- p3 , decode(bitand(l_ash_grouping, power(2, s_row_wait_obj# )), 0, chr(0), row_wait_obj# ) -- row_wait_obj# , decode(bitand(l_ash_grouping, power(2, s_row_wait_file# )), 0, chr(0), row_wait_file# ) -- row_wait_file# , decode(bitand(l_ash_grouping, power(2, s_row_wait_block# )), 0, chr(0), row_wait_block# ) -- row_wait_block# , decode(bitand(l_ash_grouping, power(2, s_row_wait_row# )), 0, chr(0), row_wait_row# ) -- row_wait_row# , decode(bitand(l_ash_grouping, power(2, s_blocking_session_status )), 0, chr(0), blocking_session_status ) -- blocking_session_status , decode(bitand(l_ash_grouping, power(2, s_blocking_instance )), 0, chr(0), blocking_instance ) -- blocking_instance , decode(bitand(l_ash_grouping, power(2, s_blocking_session )), 0, chr(0), blocking_session ) -- blocking_session , decode(bitand(l_ash_grouping, power(2, s_sql_hash_value )), 0, chr(0), sql_hash_value ) -- sql_hash_value , decode(bitand(l_ash_grouping, power(2, s_sql_id )), 0, chr(0), sql_id ) -- sql_id , decode(bitand(l_ash_grouping, power(2, s_sql_child_number )), 0, chr(0), sql_child_number ) -- sql_child_number , decode(bitand(l_ash_grouping, power(2, s_plsql_entry_object_id )), 0, chr(0), plsql_entry_object_id ) -- plsql_entry_object_id , decode(bitand(l_ash_grouping, power(2, s_plsql_entry_subprogram_id )), 0, chr(0), plsql_entry_subprogram_id ) -- plsql_entry_subprogram_id , decode(bitand(l_ash_grouping, power(2, s_plsql_object_id )), 0, chr(0), plsql_object_id ) -- plsql_object_id , decode(bitand(l_ash_grouping, power(2, s_plsql_subprogram_id )), 0, chr(0), plsql_subprogram_id ) -- plsql_subprogram_id , decode(bitand(l_ash_grouping, power(2, s_module )), 0, chr(0), module ) -- module , decode(bitand(l_ash_grouping, power(2, s_action )), 0, chr(0), action ) -- action , decode(bitand(l_ash_grouping, power(2, s_client_identifier )), 0, chr(0), client_identifier ) -- client_identifier , decode(bitand(l_ash_grouping, power(2, s_service_name )), 0, chr(0), service_name ) -- service_name order by count(*)/g_ash_samples_taken desc ) where rownum <= p_topn ) loop l_output_line := ''; o_sid := CASE WHEN i.sid = chr(0) THEN null ELSE nvl(i.sid , ' ') END; o_username := CASE WHEN i.username = chr(0) THEN null ELSE nvl(i.username , ' ') END; o_machine := CASE WHEN i.machine = chr(0) THEN null ELSE nvl(i.machine , ' ') END; o_terminal := CASE WHEN i.terminal = chr(0) THEN null ELSE nvl(i.terminal , ' ') END; o_program := CASE WHEN i.program = chr(0) THEN null ELSE nvl(i.program , ' ') END; o_event := CASE WHEN i.event = chr(0) THEN null ELSE nvl(i.event , ' ') END; o_wait_class := CASE WHEN i.wait_class = chr(0) THEN null ELSE nvl(i.wait_class , ' ') END; o_state := CASE WHEN i.state = chr(0) THEN null ELSE nvl(i.state , ' ') END; o_p1 := CASE WHEN i.p1 = chr(0) THEN null ELSE nvl(i.p1 , ' ') END; o_p2 := CASE WHEN i.p2 = chr(0) THEN null ELSE nvl(i.p2 , ' ') END; o_p3 := CASE WHEN i.p3 = chr(0) THEN null ELSE nvl(i.p3 , ' ') END; o_row_wait_obj# := CASE WHEN i.row_wait_obj# = chr(0) THEN null ELSE nvl(i.row_wait_obj# , ' ') END; o_row_wait_file# := CASE WHEN i.row_wait_file# = chr(0) THEN null ELSE nvl(i.row_wait_file# , ' ') END; o_row_wait_block# := CASE WHEN i.row_wait_block# = chr(0) THEN null ELSE nvl(i.row_wait_block# , ' ') END; o_row_wait_row# := CASE WHEN i.row_wait_row# = chr(0) THEN null ELSE nvl(i.row_wait_row# , ' ') END; o_blocking_session_status := CASE WHEN i.blocking_session_status = chr(0) THEN null ELSE nvl(i.blocking_session_status , ' ') END; o_blocking_instance := CASE WHEN i.blocking_instance = chr(0) THEN null ELSE nvl(i.blocking_instance , ' ') END; o_blocking_session := CASE WHEN i.blocking_session = chr(0) THEN null ELSE nvl(i.blocking_session , ' ') END; o_sql_hash_value := CASE WHEN i.sql_hash_value = chr(0) THEN null ELSE nvl(i.sql_hash_value , ' ') END; o_sql_id := CASE WHEN i.sql_id = chr(0) THEN null ELSE nvl(i.sql_id , ' ') END; o_sql_child_number := CASE WHEN i.sql_child_number = chr(0) THEN null ELSE nvl(i.sql_child_number , ' ') END; o_plsql_entry_object_id := CASE WHEN i.plsql_entry_object_id = chr(0) THEN null ELSE nvl(i.plsql_entry_object_id , ' ') END; o_plsql_entry_subprogram_id := CASE WHEN i.plsql_entry_subprogram_id = chr(0) THEN null ELSE nvl(i.plsql_entry_subprogram_id , ' ') END; o_plsql_object_id := CASE WHEN i.plsql_object_id = chr(0) THEN null ELSE nvl(i.plsql_object_id , ' ') END; o_plsql_subprogram_id := CASE WHEN i.plsql_subprogram_id = chr(0) THEN null ELSE nvl(i.plsql_subprogram_id , ' ') END; o_module := CASE WHEN i.module = chr(0) THEN null ELSE nvl(i.module , ' ') END; o_action := CASE WHEN i.action = chr(0) THEN null ELSE nvl(i.action , ' ') END; o_client_identifier := CASE WHEN i.client_identifier = chr(0) THEN null ELSE nvl(i.client_identifier , ' ') END; o_service_name := CASE WHEN i.service_name = chr(0) THEN null ELSE nvl(i.service_name , ' ') END; -- print the activity % as the first column l_output_line := lpad(to_char(round(i.average_active_samples*100))||'%', w_activity_pct, ' '); -- loop through ash columns to find what to print and in which order for s in ( -- ORA9 SQL*Plus returns only a single row with CONNECT BY LEVEL; An additonal outer SELECT * from (...) fixes this &_IF_ORA9 select * from ( SELECT LEVEL , SUBSTR ( TOKEN , DECODE(LEVEL, 1, 1, INSTR(TOKEN, DELIMITER, 1, LEVEL-1)+1) , INSTR(TOKEN, DELIMITER, 1, LEVEL) - DECODE(LEVEL, 1, 1, INSTR(TOKEN, DELIMITER, 1, LEVEL-1)+1) ) TOKEN FROM ( SELECT REPLACE( LOWER(p_ash_columns) ,' ','')||'+' AS TOKEN , '+' AS DELIMITER FROM DUAL ) CONNECT BY INSTR(TOKEN, DELIMITER, 1, LEVEL)>0 &_IF_ORA9 ) ORDER BY LEVEL ASC ) loop l_output_line := l_output_line || ' | ' || case s.token -- actual column names in v$session when 'sid' then lpad(o_sid , w_sid , ' ') when 'username' then rpad(o_username , w_username , ' ') when 'machine' then rpad(o_machine , w_machine , ' ') when 'terminal' then rpad(o_terminal , w_terminal , ' ') when 'program' then rpad(o_program , w_program , ' ') when 'event' then rpad(o_event , w_event , ' ') when 'wait_class' then rpad(o_wait_class , w_wait_class , ' ') when 'state' then rpad(o_state , w_state , ' ') when 'p1' then rpad(o_p1 , w_p1 , ' ') when 'p2' then rpad(o_p2 , w_p2 , ' ') when 'p3' then rpad(o_p3 , w_p3 , ' ') when 'row_wait_obj#' then rpad(o_row_wait_obj# , w_row_wait_obj# , ' ') when 'row_wait_file#' then rpad(o_row_wait_file# , w_row_wait_file# , ' ') when 'row_wait_block#' then rpad(o_row_wait_block# , w_row_wait_block# , ' ') when 'row_wait_row#' then rpad(o_row_wait_row# , w_row_wait_row# , ' ') when 'blocking_session_status' then rpad(o_blocking_session_status , w_blocking_session_status , ' ') when 'blocking_instance' then rpad(o_blocking_instance , w_blocking_instance , ' ') when 'blocking_session' then rpad(o_blocking_session , w_blocking_session , ' ') when 'sql_hash_value' then rpad(o_sql_hash_value , w_sql_hash_value , ' ') when 'sql_id' then rpad(o_sql_id , w_sql_id , ' ') when 'sql_child_number' then rpad(o_sql_child_number , w_sql_child_number , ' ') when 'plsql_entry_object_id' then rpad(o_plsql_entry_object_id , w_plsql_entry_object_id , ' ') when 'plsql_entry_subprogram_id' then rpad(o_plsql_entry_subprogram_id , w_plsql_entry_subprogram_id, ' ') when 'plsql_object_id' then rpad(o_plsql_object_id , w_plsql_object_id , ' ') when 'plsql_subprogram_id' then rpad(o_plsql_subprogram_id , w_plsql_subprogram_id , ' ') when 'module' then rpad(o_module , w_module , ' ') when 'action' then rpad(o_action , w_action , ' ') when 'client_identifier' then rpad(o_client_identifier , w_client_identifier , ' ') when 'service_name' then rpad(o_service_name , w_service_name , ' ') -- aliases for convenience (only either real name or alias should be used together at the same time) when 'user' then rpad(o_username , w_username , ' ') when 'obj' then rpad(o_row_wait_obj# , w_row_wait_obj# , ' ') when 'file' then rpad(o_row_wait_file# , w_row_wait_file# , ' ') when 'block' then rpad(o_row_wait_block# , w_row_wait_block# , ' ') when 'row' then rpad(o_row_wait_row# , w_row_wait_row# , ' ') when 'bss' then rpad(o_blocking_session_status , w_blocking_session_status , ' ') when 'bsi' then rpad(o_blocking_instance , w_blocking_instance , ' ') when 'bs' then rpad(o_blocking_session , w_blocking_session , ' ') when 'sql' then rpad(o_sql_hash_value , w_sql_hash_value , ' ') when 'sqlid' then rpad(o_sql_id , w_sql_id , ' ') when 'child' then rpad(o_sql_child_number , w_sql_child_number , ' ') when 'plsql_eoid' then rpad(o_plsql_entry_object_id , w_plsql_entry_object_id , ' ') when 'plsql_esubpid' then rpad(o_plsql_entry_subprogram_id , w_plsql_entry_subprogram_id, ' ') when 'plsql_oid' then rpad(o_plsql_object_id , w_plsql_object_id , ' ') when 'plsql_subpid' then rpad(o_plsql_subprogram_id , w_plsql_subprogram_id , ' ') when 'mod' then rpad(o_module , w_module , ' ') when 'act' then rpad(o_action , w_action , ' ') when 'cid' then rpad(o_client_identifier , w_client_identifier , ' ') when 'service' then rpad(o_service_name , w_service_name , ' ') when 'wait_event' then rpad(o_event , w_event , ' ') when 'wait_state' then rpad(o_state , w_state , ' ') else '' end; -- case s.token end loop; -- ash parameter tokenizer output(l_output_line); end loop; -- grouped ash samples end out_ash; -- and it begins!!! begin -- get snappers own sid into g_mysid select sid into g_mysid from v$mystat where rownum = 1; pagesize := nvl( getopt('&snapper_options', 'pagesize=' ), pagesize); --output ( 'Pagesize='||pagesize ); lv_ash := getopt('&snapper_options', 'ash'); lv_stats := getopt('&snapper_options', 'stat'); if lv_ash is not null then gather_ash := 1; end if; if lv_stats is not null then gather_stats := 1; end if; --output('all='||case when getopt('&snapper_options', 'all') = chr(0) then 'chr(0)' when getopt('&snapper_options', 'all') is null then 'null' else (getopt('&snapper_options','all')) end); -- some additional default value logic if getopt('&snapper_options', 'all') is not null then --output('setting stats to all due to option = all'); gather_stats := 1; gather_ash := 1; else if (lv_ash is null and lv_stats is null) then gather_stats := 0; gather_ash := 1; end if; end if; -- determine which performance counters and stats to collect lv_gather := case nvl( lower(getopt ('&snapper_options', 'gather=')), 'stw') when 'all' then 'stw' else nvl( lower(getopt ('&snapper_options', 'gather=')), 'stw') end; --lv_gather:=getopt ('&snapper_options', 'gather='); --output('lv_gather='||lv_gather); if pagesize > 0 then output(' '); output('-- Session Snapper v3.64 by Tanel Poder ( http://blog.tanelpoder.com )'); output(' '); end if; -- initialize statistic and event name array -- fetch statistic names with their adjusted IDs select * bulk collect into sn_tmp from ( select 'STAT' stype, statistic# - pls_adjust statistic#, name from v$statname where (lv_gather like '%s%' or lv_gather like '%a%') -- union all select 'WAIT', event# + (select count(*) from v$statname) + 1 - pls_adjust, name from v$event_name where (lv_gather like '%w%' or lv_gather like '%a%') -- &_IF_ORA10_OR_HIGHER union all &_IF_ORA10_OR_HIGHER select 'TIME' stype, stat_id - pls_adjust statistic#, stat_name name &_IF_ORA10_OR_HIGHER from v$sys_time_model &_IF_ORA10_OR_HIGHER where (lv_gather like '%t%' or lv_gather like '%a%') -- union all select 'LATG', l.latch# + (select count(*) from v$statname) + (select count(*) from v$event_name) + 1 - pls_adjust statistic#, name from v$latch l where (lv_gather like '%l%' or lv_gather like '%a%') -- &_IF_X_ACCESSIBLE union all &_IF_X_ACCESSIBLE select 'BUFG', &_IF_X_ACCESSIBLE indx + &_IF_X_ACCESSIBLE (select count(*) from v$statname) + &_IF_X_ACCESSIBLE (select count(*) from v$event_name) + &_IF_X_ACCESSIBLE (select count(*) from v$latch) + &_IF_X_ACCESSIBLE 1 - pls_adjust statistic#, &_IF_X_ACCESSIBLE kcbwhdes name &_IF_X_ACCESSIBLE from x$kcbwh &_IF_X_ACCESSIBLE where (lv_gather like '%b%' or lv_gather like '%a%') -- union all select 'ENQG', ascii(substr(e.eq_type,1,1))*256 + ascii(substr(e.eq_type,2,1)) + (select count(*) from v$statname) + (select count(*) from v$event_name) + (select count(*) from v$latch) + &_IF_X_ACCESSIBLE (select count(*) from x$kcbwh) + 1 - pls_adjust statistic#, eq_type from ( select es.eq_type &_IF_ORA10_OR_HIGHER ||' - '||lt.name eq_type, total_req# from v$enqueue_stat es &_IF_ORA10_OR_HIGHER , v$lock_type lt &_IF_ORA10_OR_HIGHER where es.eq_type = lt.type ) e where (lv_gather like '%e%' or lv_gather like '%a%') ) snapper_statnames order by stype, statistic#; -- store these into an index_by array organized by statistic# for fast lookup --output('sn_tmp.count='||sn_tmp.count); --output('lv_gather='||lv_gather); for i in 1..sn_tmp.count loop -- output('i='||i||' statistic#='||sn_tmp(i).statistic#); sn(sn_tmp(i).statistic#) := sn_tmp(i); end loop; -- main sampling loop for c in 1..&snapper_count loop -- sesstat and other performance counter sampling if gather_stats = 1 then -- print header if required gv_header_string := CASE WHEN output_header = 1 THEN 'HEAD,' END || CASE WHEN output_sid = 1 THEN ' SID,' END || CASE WHEN output_username = 1 THEN ' USERNAME ,' END || CASE WHEN output_time = 1 THEN ' SNAPSHOT START ,' END || CASE WHEN output_seconds = 1 THEN ' SECONDS,' END || CASE WHEN output_stype = 1 THEN ' TYPE,' END || CASE WHEN output_sname = 1 THEN rpad(' STATISTIC',59,' ')||',' END || CASE WHEN output_delta = 1 THEN ' DELTA,' END || CASE WHEN output_delta_s = 1 THEN ' DELTA/SEC,' END || CASE WHEN output_hdelta = 1 THEN ' HDELTA,' END || CASE WHEN output_hdelta_s = 1 THEN ' HDELTA/SEC,' END || CASE WHEN output_percent = 1 THEN ' %TIME,' END || CASE WHEN output_pcthist = 1 THEN ' GRAPH ,' END || CASE WHEN output_eventcnt = 1 THEN ' NUM_WAITS,' END || CASE WHEN output_eventcnt_s = 1 THEN ' WAITS/SEC,' END || CASE WHEN output_eventavg = 1 THEN ' AVERAGES' END ; if pagesize > 0 and mod(c-1, pagesize) = 0 then output(rpad('-',length(gv_header_string),'-')); output(gv_header_string); output(rpad('-',length(gv_header_string),'-')); else if pagesize = -1 and c = 1 then output(gv_header_string); end if; end if; if c = 1 then get_sessions; snap(d1,s1); else get_sessions; d1 := d2; s1 := s2; end if; -- c = 1 -- output('snapper_sleep='||to_char(&snapper_sleep - (sysdate - d1)*86400)); -- dbms_lock.sleep( (&snapper_sleep - (sysdate - d1)) ); -- dbms_lock.sleep( (&snapper_sleep - (sysdate - d1))*1000/1024 ); end if; -- gather_stats = 1 -- ASH style sampling ash_date1 := sysdate; if gather_ash = 1 then while sysdate < (ash_date1 + (&snapper_sleep/86400)) loop -- get active session records from g_sessions get_sessions; extract_ash(); -- sleep timeout backoff depending on the duration sampled (for up to 10 seconds total sampling time will get max 100 Hz sampling) -- for longer duration sampling the algorithm will back off and for long durations (over 100 sec) the sampling rate will stabilize -- at 1Hz dbms_lock.sleep( greatest(0.1,(least(1,&snapper_sleep*&snapper_count/100))) ); end loop; else dbms_lock.sleep( ((ash_date1+(&snapper_sleep/86400)) - sysdate)*86400 ); end if; ash_date2 := sysdate; -- sesstat new sample and delta calculation if gather_stats = 1 then get_sessions; snap(d2,s2); -- manually coded nested loop outer join for calculating deltas: -- why not use a SQL join? this would require creation of PL/SQL -- collection object types, but Snapper does not require any changes -- to the database, so any custom object types are out! changed_values := 0; missing_values_s1 := 0; missing_values_s2 := 0; -- remember last disappeared SID so we wouldn't need to output a warning -- message for each statistic row of that disappeared sid disappeared_sid := 0; i :=1; -- iteration counter (for debugging) a :=1; -- s1 array index b :=1; -- s2 array index if s2.count > 0 then lv_curr_sid := s2(a).sid; end if; while ( a <= s1.count and b <= s2.count ) loop if lv_curr_sid != 0 and lv_curr_sid != s2(a).sid then if pagesize > 0 and mod(c-1, pagesize) = 0 then output(' '); output(rpad('-',length(gv_header_string),'-')); output(gv_header_string); output(rpad('-',length(gv_header_string),'-')); else output(' '); end if; lv_curr_sid := s2(a).sid; end if; delta := 0; -- don't print case when s1(a).sid = s2(b).sid then case when s1(a).statistic# = s2(b).statistic# then delta := s2(b).value - s1(a).value; evcnt := s2(b).event_count - s1(a).event_count; if delta != 0 then fout(); end if; a := a + 1; b := b + 1; when s1(a).statistic# > s2(b).statistic# then delta := s2(b).value; evcnt := s2(b).event_count; if delta != 0 then fout(); end if; b := b + 1; when s1(a).statistic# < s2(b).statistic# then output('ERROR, s1(a).statistic# < s2(b).statistic#, a='||to_char(a)||' b='||to_char(b)||' s1.count='||s1.count||' s2.count='||s2.count||' s2.count='||s2.count); a := a + 1; b := b + 1; else output('ERROR, s1(a).statistic# ? s2(b).statistic#, a='||to_char(a)||' b='||to_char(b)||' s1.count='||s1.count||' s2.count='||s2.count||' s2.count='||s2.count); a := a + 1; b := b + 1; end case; -- s1(a).statistic# ... s2(b).statistic# when s1(a).sid > s2(b).sid then delta := s2(b).value; evcnt := s2(b).event_count; if delta != 0 then fout(); end if; b := b + 1; when s1(a).sid < s2(b).sid then if disappeared_sid != s2(b).sid then output('WARN, Session has disappeared during snapshot, ignoring SID='||to_char(s2(b).sid)||' debug(a='||to_char(a)||' b='||to_char(b)||' s1.count='||s1.count||' s2.count='||s2.count||' s2.count='||s2.count||')'); end if; disappeared_sid := s2(b).sid; a := a + 1; else output('ERROR, Should not be here, SID='||to_char(s2(b).sid)||' a='||to_char(a)||' b='||to_char(b)||' s1.count='||s1.count||' s2.count='||s2.count||' s2.count='||s2.count); end case; -- s1(a).sid ... s2(b).sid i:=i+1; if delta != 0 then changed_values := changed_values + 1; end if; -- delta != 0 end loop; -- while ( a <= s1.count and b <= s2.count ) if pagesize > 0 and changed_values > 0 then output(' '); --output('-- End of Stats snap '||to_char(c)||', end='||to_char(d2, 'YYYY-MM-DD HH24:MI:SS')||', seconds='||to_char(case (d2-d1) when 0 then &snapper_sleep else round((d2-d1) * 86400, 1) end)); output('-- End of Stats snap '||to_char(c)||', end='||to_char(d2, 'YYYY-MM-DD HH24:MI:SS')||', seconds='||to_char(round((d2-d1) * 86400, 1))); end if; output(' '); end if; -- gather_stats = 1 if gather_ash = 1 then -- get ASH sample grouping details g_ash_columns := nvl( getopt('&snapper_options', 'ash=' ), g_ash_columns ); -- optional additional ASH groupings g_ash_columns1 := case when getopt('&snapper_options', 'ash1' ) is null then null when getopt('&snapper_options', 'ash1' ) = chr(0) then g_ash_columns1 else getopt('&snapper_options', 'ash1=' ) end; g_ash_columns2 := case when getopt('&snapper_options', 'ash2' ) is null then null when getopt('&snapper_options', 'ash2' ) = chr(0) then g_ash_columns2 else getopt('&snapper_options', 'ash2=' ) end; g_ash_columns3 := case when getopt('&snapper_options', 'ash3' ) is null then null when getopt('&snapper_options', 'ash3' ) = chr(0) then g_ash_columns3 else getopt('&snapper_options', 'ash3=' ) end; -- group ASH records and print report out_ash( g_ash_columns, 10 ); -- group and print optional ASH reports if g_ash_columns1 is not null then out_ash( g_ash_columns1, 10 ); end if; if g_ash_columns2 is not null then out_ash( g_ash_columns2, 10 ); end if; if g_ash_columns3 is not null then out_ash( g_ash_columns3, 10 ); end if; if pagesize > 0 then output(' '); output('-- End of ASH snap '||to_char(c)||', end='||to_char(ash_date2, 'YYYY-MM-DD HH24:MI:SS')||', seconds='||to_char(round((ash_date2-ash_date1) * 86400, 1))||', samples_taken='||g_ash_samples_taken); --output('-- End of ASH snap '||to_char(c)||', end='||to_char(ash_date2, 'YYYY-MM-DD HH24:MI:SS')||', seconds='||to_char(case (ash_date2-ash_date1) when 0 then &snapper_sleep else round((ash_date2-ash_date1) * 86400, 1) end)||', samples_taken='||g_ash_samples_taken); output(' '); end if; reset_ash(); end if; -- gather_ash = 1 end loop; -- for c in 1..snapper_count end; / undefine snapper_oraversion undefine snapper_sleep undefine snapper_count undefine snapper_sid undefine ssid_begin -- undefine _IF_ORA10_OR_HIGHER -- undefine _IF_ORA9 -- undefine _IF_ORA11_OR_HIGHER -- undefine _IF_LOWER_THAN_ORA11 -- undefine _NO_BLK_INST -- undefine _YES_BLK_INST -- undefine _NO_PLSQL_OBJ_ID -- undefine _YES_PLSQL_OBJ_ID -- undefine _IF_DBMS_SYSTEM_ACCESSIBLE -- undefine _IF_X_ACCESSIBLE col snapper_ora10higher clear col snapper_ora11higher clear col snapper_ora11lower clear col dbms_system_accessible clear set serveroutput off
the_stack
-- /*************************************************************************** -- (c) Copyright IBM Corp. 2011 All rights reserved. -- -- The following sample of source code ("Sample") is owned by International -- Business Machines Corporation or one of its subsidiaries ("IBM") and is -- copyrighted and licensed, not sold. You may use, copy, modify, and -- distribute the Sample in any form without payment to IBM, for the purpose of -- assisting you in the development of your applications. -- -- The Sample code is provided to you on an "AS IS" basis, without warranty of -- any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR -- IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do -- not allow for the exclusion or limitation of implied warranties, so the above -- limitations or exclusions may not apply to you. IBM shall not be liable for -- any damages you suffer as a result of using, copying, modifying or -- distributing the Sample, even if IBM has been advised of the possibility of -- such damages. -- **************************************************************************** -- -- SOURCE FILE NAME : temporal_stt.db2 -- -- PURPOSE : This sample demonstrates: -- 1. Creation of System-Period Temporal Table (STT) -- 2. Migration of a regular table to a STT -- 3. Insertion of a record into a STT -- 4. Querying a STT -- 5. Update records in a STT -- 6. Delete records in a STT -- 7. Create views over a STT -- 8. Usage of the Current Temporal System_Time -- special register -- -- EXECUTION : db2 -tvf temporal_stt.db2 -- -- SQL STATEMENTS USED : -- CREATE TABLE -- CREATE VIEW -- ALTER TABLE -- INSERT -- SELECT -- UPDATE -- DELETE -- DROP VIEW -- DROP TABLE -- -- **************************************************************************** -- -- USAGE SCENARIO : -- The usage scenario pertains to a banking organization. The -- database of the bank contains a table called 'loan_accounts' that stores -- details of different loan accounts of its customers like type of loan, -- rate of interest, balance, etc. The accounts information keeps changing -- due to variations in the rate of interest and balance columns. It is -- critical to maintain historical records of this table for audit and -- compliance initiatives. The table is also frequently queried based on -- customer requests to retrieve various accounts information. -- -- **************************************************************************** -- -- For more information about the command line processor (CLP) scripts, -- see the README file. -- -- For information on using SQL statements, see the SQL Reference. -- -- For the latest information on programming, building, and running DB2 -- applications, visit the DB2 application development website: -- -- http://www.ibm.com/software/data/db2/ad/ -- -- ***************************************************************************/ -- Connect to 'sample' database CONNECT TO sample ; echo ************************************************************************* ; echo CREATE SYSTEM-PERIOD TEMPORAL TABLE (STT) ; echo ; echo A system-period temporal table allows you to maintain ; echo historical versions of the rows in a table. ; echo ************************************************************************* ; echo ; -- /*************************************************************************** -- Creating a system-period temporal table is a three step process : -- **************************************************************************** -- 1. Create table 'loan_accounts' with a 'SYSTEM_TIME' period definition. -- This captures the start, SYSTEM_BEGIN, and end, SYSTEM_END, times of -- each row of the table. Values in these columns are automatically set by -- DB2. The 'trans_start' timestamp is generated in case of transactions -- making multiple updates to the same row in order to avoid conflicts -- that could lead to transaction aborts. -- -- NOTE: The system time periods are defined as IMPLICITLY HIDDEN. This means -- that the column will be unavailable unless it is explicitly referenced in -- SELECT or INSERT statements. -- -- 2. Create the history table 'loan_accounts_history' in the same schema -- as the 'loan_accounts' table. -- -- 3. Enable versioning for the base table 'loan_accounts' to use the -- history table 'loan_accounts_history'. -- ***************************************************************************/ DROP TABLE loan_accounts ; DROP TABLE loan_accounts_history ; -- Create a SYSTEM-PERIOD TEMPORAL TABLE 'loan_accounts' that contains -- details of loan accounts held by customers in the bank. CREATE TABLE loan_accounts ( account_number INTEGER NOT NULL, loan_type VARCHAR(10), rate_of_interest DECIMAL(5,2) NOT NULL, balance DECIMAL (10,2), system_begin TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW BEGIN IMPLICITLY HIDDEN, system_end TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW END IMPLICITLY HIDDEN, trans_start TIMESTAMP(12) GENERATED ALWAYS AS TRANSACTION START ID IMPLICITLY HIDDEN, PERIOD SYSTEM_TIME (system_begin, system_end) ) ; -- Create the 'loan_accounts_history' table that stores historical -- versions of data in the 'loan_accounts' table. CREATE TABLE loan_accounts_history LIKE loan_accounts ; -- Enable the 'loan_accounts' table for versioning to use the -- 'loan_accounts_history' table. ALTER TABLE loan_accounts ADD VERSIONING USE HISTORY TABLE loan_accounts_history ; echo ************************************************************************* ; echo CREATE PRE-EXISTING BASE AND HISTORY TABLES ; echo ************************************************************************* ; echo ; -- /*************************************************************************** -- NOTE: For the purpose of demonstration of this feature, it is required to -- have pre-existing data in order to be able to query 'historical' data. -- Hence, the scenario of pre-existing tables and their migration to -- temporal tables is shown in this sample. -- ***************************************************************************/ -- /*************************************************************************** -- An existing table can be migrated to a system-period temporal table. -- -- The banking organization already has data in pre-existing base and history -- tables. This needs to be migrated to a system-period temporal table. -- ***************************************************************************/ DROP TABLE loan_accounts ; -- Create a pre-existing 'loan_accounts' table with two timestamp columns, -- namely system_begin and system_end columns. CREATE TABLE loan_accounts ( account_number INTEGER NOT NULL, loan_type VARCHAR(10), rate_of_interest DECIMAL(5,2) NOT NULL, balance DECIMAL (10,2), system_begin TIMESTAMP(12) NOT NULL, system_end TIMESTAMP(12) NOT NULL ) ; -- Create the 'loan_accounts_history' table that stores records of all -- historical transactions of the 'loan_accounts' table. CREATE TABLE loan_accounts_history LIKE loan_accounts ; -- Insert pre-existing data into the 'loan_accounts' table. INSERT INTO loan_accounts (account_number, loan_type, rate_of_interest, balance, system_begin, system_end) VALUES (2111, 'A21', 9.5, 559500, '2010-02-01-05.45.02', '9999-12-30-00.00.00.000000000000'), (2112, 'A10', 12, 450320, '2010-02-02-03.21.18', '9999-12-30-00.00.00.000000000000'), (2113, 'A21', 9, 100000, '2010-02-06-13.15.06', '9999-12-30-00.00.00.000000000000'), (2114, 'A15', 10, 200000, '2010-02-07-22.20.15', '9999-12-30-00.00.00.000000000000') ; -- Insert pre-existing data into the 'loan_accounts_history' table that reflects -- historical records of the 'loan_accounts' table. INSERT INTO loan_accounts_history (account_number, loan_type, rate_of_interest, balance, system_begin, system_end) VALUES (2111, 'A21', 8, 669000, '2009-09-01-23.45.01', '2009-10-01-14.33.08'), (2111, 'A21', 8, 648000, '2009-10-01-14.33.08', '2009-11-01-09.56.17'), (2111, 'A21', 9.5, 625875, '2009-11-01-09.56.17', '2009-12-01-07.03.18'), (2111, 'A21', 9.5, 603750, '2009-12-01-07.03.18', '2010-01-01-00.00.00'), (2111, 'A21', 9.5, 581625, '2010-01-01-00.00.00', '2010-02-01-05.45.02'), (2112, 'A10', 12, 468000, '2010-01-02-09.04.16', '2010-02-02-03.21.18') ; echo ************************************************************************ ; echo MIGRATE TO SYSTEM-PERIOD TEMPORAL TABLE AND ENABLE VERSIONING ; echo ************************************************************************ ; echo ; -- Migrate the regular 'loan_accounts' table into a SYSTEM-PERIOD TEMPORAL -- TABLE by adding the SYSTEM_TIME period definition and enable it for -- versioning to use the 'loan_accounts_history' table. ALTER TABLE loan_accounts ALTER COLUMN system_begin SET GENERATED AS ROW BEGIN ; -- Optional step ALTER TABLE loan_accounts ALTER COLUMN system_begin SET IMPLICITLY HIDDEN ; ALTER TABLE loan_accounts ALTER COLUMN system_end SET GENERATED AS ROW END ; -- Optional step ALTER TABLE loan_accounts ALTER COLUMN system_end SET IMPLICITLY HIDDEN ; ALTER TABLE loan_accounts ADD PERIOD SYSTEM_TIME (system_begin, system_end) ; ALTER TABLE loan_accounts ADD COLUMN trans_start TIMESTAMP(12) GENERATED AS TRANSACTION START ID IMPLICITLY HIDDEN ; ALTER TABLE loan_accounts_history ADD COLUMN trans_start TIMESTAMP(12) IMPLICITLY HIDDEN ; -- If IMPLICITLY HIDDEN is set above, then must set it for history table ALTER TABLE loan_accounts_history ALTER COLUMN system_begin SET IMPLICITLY HIDDEN ; -- If IMPLICITLY HIDDEN is set above, then must set it for history table ALTER TABLE loan_accounts_history ALTER COLUMN system_end SET IMPLICITLY HIDDEN ; ALTER TABLE loan_accounts ADD VERSIONING USE HISTORY TABLE loan_accounts_history ; echo ************************************************************************ ; echo INSERT DATA INTO THE SYSTEM-PERIOD TEMPORAL TABLE ; echo ************************************************************************ ; echo ; -- Insert a new record into the 'loan_accounts' table. -- Values for the 'system_begin' and 'system_end' columnns are generated -- automatically and need not be specified by the user. INSERT INTO loan_accounts (account_number, loan_type, rate_of_interest, balance) VALUES (2115, 'A20', 11, 300000) ; -- Display the automatically generated 'system_begin' and 'system_end' values -- for the newly generated row. SELECT account_number, loan_type, rate_of_interest, balance, system_begin, system_end FROM loan_accounts WHERE account_number = 2115 ; echo ************************************************************************ ; echo QUERY THE SYSTEM-PERIOD TEMPORAL TABLE ; echo ************************************************************************ ; echo ; -- /*************************************************************************** -- The bank admin needs to query the system-period temporal table for -- historical records during an audit. -- -- DB2 provides SQL extensions to the SELECT statement to query the STT. Using -- these SQL extensions signals DB2 to automatically route the query and -- retrieve the relevant data from both the base and history tables. -- ***************************************************************************/ -- Regular query against the system-period temporal table. SELECT account_number, rate_of_interest, system_begin, system_end FROM loan_accounts WHERE account_number = 2111 ; -- Query the rate of interest as of 1st October, 2009 for customer with account -- number '2111'. -- To query a record for a certain point in time, use the -- 'FOR SYSTEM_TIME AS OF' clause in the SELECT statement. SELECT account_number, rate_of_interest, system_begin, system_end FROM loan_accounts FOR SYSTEM_TIME AS OF '2009-10-01' WHERE account_number = 2111 ; -- To query a record for a certain period of time, use the -- 'FOR SYSTEM_TIME FROM...TO' clause in the SELECT statement to retrieve -- records exclusive of the end date specified. -- Query the loan statement from 1st November, 2009 to 1st January, 2010. SELECT account_number, rate_of_interest, balance, system_begin, system_end FROM loan_accounts FOR SYSTEM_TIME FROM '2009-11-01' TO '2010-01-01' WHERE account_number = 2111 ; -- To query a record for a certain period of time, use the -- 'FOR SYSTEM_TIME BETWEEN...TO' clause in the SELECT statement to retrieve -- records inclusive of the end date specified. -- Query the loan statement between 1st November, 2009 and 1st January, 2010. SELECT account_number, rate_of_interest, balance, system_begin, system_end FROM loan_accounts FOR SYSTEM_TIME BETWEEN '2009-11-01' AND '2010-01-01' WHERE account_number = 2111 ; -- Compare the difference between the BETWEEN..AND and FROM..TO results above. SELECT account_number, rate_of_interest, balance, system_begin, system_end FROM loan_accounts FOR SYSTEM_TIME BETWEEN '2009-11-01' AND '2010-01-01' WHERE account_number = 2111 EXCEPT SELECT account_number, rate_of_interest, balance, system_begin, system_end FROM loan_accounts FOR SYSTEM_TIME FROM '2009-11-01' TO '2010-01-01' WHERE account_number = 2111 ; echo ************************************************************************ ; echo UPDATE A RECORD IN THE SYSTEM-PERIOD TEMPORAL TABLE ; echo ************************************************************************ ; echo ; -- /*************************************************************************** -- A customer has made his monthly loan installment payment. The bank admin -- needs to update this information in the 'loan_accounts' table and also -- store the previous value. -- -- The STT makes change management easy by automatically maintaining different -- versions of data. -- ***************************************************************************/ -- Update the 'balance' column for the account to reflect the monthly loan -- installment payment. UPDATE loan_accounts SET balance = 603750 WHERE account_number = 2111 ; -- Verify the update for the account in the 'loan_accounts' table. SELECT account_number, balance, system_begin, system_end FROM loan_accounts WHERE account_number = 2111 ; -- On updation of a record in the system-period temporal table 'loan_accounts', -- a copy of the previous record is automatically moved to the associated -- history table 'loan_accounts_history' by DB2. -- Query the history table to verify the above. SELECT account_number, balance, system_begin, system_end FROM loan_accounts_history WHERE account_number = 2111 ; -- Display all records for the particular account i.e both current and -- historical records. Use the 'FOR SYSTEM_TIME FROM...TO' clause to query and -- retrieve data from both the base and history tables. SELECT account_number, balance, system_begin, system_end FROM loan_accounts FOR SYSTEM_TIME FROM '0001-01-01' TO '9999-12-31' WHERE account_number = 2111 ; echo ************************************************************************ ; echo DELETE A RECORD IN THE SYSTEM-PERIOD TEMPORAL TABLE ; echo ************************************************************************ ; echo ; -- /*************************************************************************** -- The bank admin realises he has performed an incorrect update of the balance -- for the customer. He needs to revert the base table back to its original -- state and correct the error. -- ***************************************************************************/ -- Delete the wrongly updated row from the 'loan_accounts' table. DELETE FROM loan_accounts WHERE account_number = 2111 ; -- The deleted record information is automatically moved to the history table. -- Query the history table to verify this. SELECT account_number, loan_type, rate_of_interest, balance, system_begin, system_end FROM loan_accounts_history WHERE account_number = 2111 ; -- Recover the previous(wrongly updated) record from the 'loan_accounts_history' -- table and insert into the 'loan_accounts' table. INSERT INTO loan_accounts (account_number, loan_type, rate_of_interest, balance) SELECT account_number, loan_type, rate_of_interest, balance FROM loan_accounts FOR SYSTEM_TIME AS OF '2010-02-02' WHERE account_number = 2111 ; -- Update the balance correctly. UPDATE loan_accounts SET balance = 537375 WHERE account_number = 2111 ; -- Verify the above update in the 'loan_accounts' table. SELECT account_number, loan_type, rate_of_interest, balance, system_begin, system_end FROM loan_accounts WHERE account_number = 2111 ; echo ************************************************************************ ; echo CREATE VIEWS OVER THE SYSTEM-PERIOD TEMPORAL TABLE ; echo ************************************************************************ ; echo ; -- /*************************************************************************** -- The rate of interest keeps varying due to market conditions. The loan -- balance varies owing to monthly loan installment payments made by customers. -- Customers frequently request for the loan account statement for a specific -- period of time or for information on the rate of interest at a certain time -- in the past. -- -- The bank admin creates two views over the STT to retrive frequently queried -- information faster. With the STT, you can create views over a specific -- period of time as well using the SQL extensions provided. -- ***************************************************************************/ DROP VIEW view_interest ; DROP VIEW view_statement ; -- Create a view that stores information on varying interest rates for -- different loan accounts. CREATE VIEW view_interest AS SELECT account_number, rate_of_interest, system_begin, system_end FROM loan_accounts ; -- Query the view to find the rate of interest as on 1st October, 2009 for -- customer with account number '2111'. SELECT account_number, rate_of_interest, system_begin, system_end FROM view_interest FOR SYSTEM_TIME AS OF '2009-10-01' WHERE account_number = 2111 ; -- Update the rate of interest for account '2111' using the view. The update -- on the view is automatically reflected in the base table 'loan_accounts'. UPDATE view_interest SET rate_of_interest = 10 WHERE account_number = 2111 ; -- Verify the update for the customer in the 'loan_accounts' table. SELECT account_number, rate_of_interest, system_begin, system_end FROM loan_accounts WHERE account_number = 2111 ; -- The previous record is moved to the history table after an update on the -- 'loan_accounts' table. Query the history table to verify the same. SELECT account_number, rate_of_interest, system_begin, system_end FROM loan_accounts_history WHERE account_number = 2111 ; -- Create another view that stores loan accounts statement for the period from -- 1st Jan, 2010 to 1st Jan, 2011. CREATE VIEW view_statement AS SELECT account_number, loan_type, rate_of_interest, balance, system_begin, system_end FROM loan_accounts FOR SYSTEM_TIME FROM '2010-01-01' TO '2011-01-01' ; -- Query the view to obtain the loan account statement for the above period -- for the customer with account number '2111'. SELECT account_number, rate_of_interest, balance, system_begin, system_end FROM view_statement WHERE account_number = 2111 ; echo ************************************************************************ ; echo CURRENT TEMPORAL SYSTEM_TIME SPECIAL REGISTER ; echo ************************************************************************ ; echo ; -- /*************************************************************************** -- The 'current temporal system_time' special register is used to 'set the -- clock back' to a specific time for a given session. This helps promote code -- reuse. -- -- Customers frequently request for their rate of interest information. Instead -- of modifying the query every time, the 'current temporal system_time' -- special register can be set to the requested time. Any queries issued -- against the STT after this retrieves values for the set time. -- ***************************************************************************/ -- Set the CURRENT TEMPORAL SYSTEM_TIME special register to 2nd February, 2010. SET CURRENT TEMPORAL SYSTEM_TIME = '2010-01-01-00.00.00.000000000000' ; -- Query the rate of interest for a customer as of 2nd February, 2010. SELECT account_number, rate_of_interest, system_begin, system_end FROM loan_accounts WHERE account_number = 2111 ; -- Query against the view also returns the same result. SELECT account_number, rate_of_interest, system_begin, system_end FROM view_interest WHERE account_number = 2111 ; -- The above queries will be implicitly converted to : -- SELECT account_number, rate_of_interest, system_begin, system_end -- FROM loan_accounts FOR SYSTEM_TIME AS OF '2010-01-01-00.00.00.000000000000' SET CURRENT TEMPORAL SYSTEM_TIME = NULL ; echo ************************************************************************ ; echo DROP ALL OBJECTS CREATED ; echo ************************************************************************ ; echo ; DROP VIEW view_interest ; DROP VIEW view_statement ; DROP TABLE loan_accounts ;
the_stack
/* japanese charsets: JIS201, JIS208, JIS212 */ /* For compatibility reasons, the Shift-JIS row 8740--879E as defined in http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP932.TXT ("Table version: 2.01," "Date: 04/15/98") is used as the 13th row (i.e., ISO-2022-JP 2D21--2D7E) of JIS X 0208 (officially, that 13th row contains no characters). */ /* ======================================================================= */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_21[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x3000, 0x3001, 0x3002, 0xFF0C, 0xFF0E, 0x30FB, 0xFF1A, /* 0x20 */ 0xFF1B, 0xFF1F, 0xFF01, 0x309B, 0x309C, 0x00B4, 0xFF40, 0x00A8, /* 0x20 */ 0xFF3E, 0xFFE3, 0xFF3F, 0x30FD, 0x30FE, 0x309D, 0x309E, 0x3003, /* 0x30 */ 0x4EDD, 0x3005, 0x3006, 0x3007, 0x30FC, 0x2015, 0x2010, 0xFF0F, /* 0x30 */ 0x005C, 0x301C, 0x2016, 0xFF5C, 0x2026, 0x2025, 0x2018, 0x2019, /* 0x40 */ 0x201C, 0x201D, 0xFF08, 0xFF09, 0x3014, 0x3015, 0xFF3B, 0xFF3D, /* 0x40 */ 0xFF5B, 0xFF5D, 0x3008, 0x3009, 0x300A, 0x300B, 0x300C, 0x300D, /* 0x50 */ 0x300E, 0x300F, 0x3010, 0x3011, 0xFF0B, 0x2212, 0x00B1, 0x00D7, /* 0x50 */ 0x00F7, 0xFF1D, 0x2260, 0xFF1C, 0xFF1E, 0x2266, 0x2267, 0x221E, /* 0x60 */ 0x2234, 0x2642, 0x2640, 0x00B0, 0x2032, 0x2033, 0x2103, 0xFFE5, /* 0x60 */ 0xFF04, 0x00A2, 0x00A3, 0xFF05, 0xFF03, 0xFF06, 0xFF0A, 0xFF20, /* 0x70 */ 0x00A7, 0x2606, 0x2605, 0x25CB, 0x25CF, 0x25CE, 0x25C7 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_22[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x25C6, 0x25A1, 0x25A0, 0x25B3, 0x25B2, 0x25BD, 0x25BC, /* 0x20 */ 0x203B, 0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0x2208, 0x220B, 0x2286, 0x2287, 0x2282, 0x2283, /* 0x30 */ 0x222A, 0x2229, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0x2227, 0x2228, 0x00AC, 0x21D2, 0x21D4, 0x2200, /* 0x40 */ 0x2203, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0x2220, 0x22A5, 0x2312, 0x2202, /* 0x50 */ 0x2207, 0x2261, 0x2252, 0x226A, 0x226B, 0x221A, 0x223D, 0x221D, /* 0x60 */ 0x2235, 0x222B, 0x222C, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0x212B, 0x2030, 0x266F, 0x266D, 0x266A, 0x2020, /* 0x70 */ 0x2021, 0x00B6, 0, 0, 0, 0, 0x25EF /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_23[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15, 0xFF16, 0xFF17, /* 0x30 */ 0xFF18, 0xFF19, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0xFF21, 0xFF22, 0xFF23, 0xFF24, 0xFF25, 0xFF26, 0xFF27, /* 0x40 */ 0xFF28, 0xFF29, 0xFF2A, 0xFF2B, 0xFF2C, 0xFF2D, 0xFF2E, 0xFF2F, /* 0x40 */ 0xFF30, 0xFF31, 0xFF32, 0xFF33, 0xFF34, 0xFF35, 0xFF36, 0xFF37, /* 0x50 */ 0xFF38, 0xFF39, 0xFF3A, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0xFF41, 0xFF42, 0xFF43, 0xFF44, 0xFF45, 0xFF46, 0xFF47, /* 0x60 */ 0xFF48, 0xFF49, 0xFF4A, 0xFF4B, 0xFF4C, 0xFF4D, 0xFF4E, 0xFF4F, /* 0x60 */ 0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57, /* 0x70 */ 0xFF58, 0xFF59, 0xFF5A /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_24[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, /* 0x20 */ 0x3048, 0x3049, 0x304A, 0x304B, 0x304C, 0x304D, 0x304E, 0x304F, /* 0x20 */ 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, /* 0x30 */ 0x3058, 0x3059, 0x305A, 0x305B, 0x305C, 0x305D, 0x305E, 0x305F, /* 0x30 */ 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, /* 0x40 */ 0x3068, 0x3069, 0x306A, 0x306B, 0x306C, 0x306D, 0x306E, 0x306F, /* 0x40 */ 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, /* 0x50 */ 0x3078, 0x3079, 0x307A, 0x307B, 0x307C, 0x307D, 0x307E, 0x307F, /* 0x50 */ 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, /* 0x60 */ 0x3088, 0x3089, 0x308A, 0x308B, 0x308C, 0x308D, 0x308E, 0x308F, /* 0x60 */ 0x3090, 0x3091, 0x3092, 0x3093 /* 0x70 */ /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_25[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x30A1, 0x30A2, 0x30A3, 0x30A4, 0x30A5, 0x30A6, 0x30A7, /* 0x20 */ 0x30A8, 0x30A9, 0x30AA, 0x30AB, 0x30AC, 0x30AD, 0x30AE, 0x30AF, /* 0x20 */ 0x30B0, 0x30B1, 0x30B2, 0x30B3, 0x30B4, 0x30B5, 0x30B6, 0x30B7, /* 0x30 */ 0x30B8, 0x30B9, 0x30BA, 0x30BB, 0x30BC, 0x30BD, 0x30BE, 0x30BF, /* 0x30 */ 0x30C0, 0x30C1, 0x30C2, 0x30C3, 0x30C4, 0x30C5, 0x30C6, 0x30C7, /* 0x40 */ 0x30C8, 0x30C9, 0x30CA, 0x30CB, 0x30CC, 0x30CD, 0x30CE, 0x30CF, /* 0x40 */ 0x30D0, 0x30D1, 0x30D2, 0x30D3, 0x30D4, 0x30D5, 0x30D6, 0x30D7, /* 0x50 */ 0x30D8, 0x30D9, 0x30DA, 0x30DB, 0x30DC, 0x30DD, 0x30DE, 0x30DF, /* 0x50 */ 0x30E0, 0x30E1, 0x30E2, 0x30E3, 0x30E4, 0x30E5, 0x30E6, 0x30E7, /* 0x60 */ 0x30E8, 0x30E9, 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EE, 0x30EF, /* 0x60 */ 0x30F0, 0x30F1, 0x30F2, 0x30F3, 0x30F4, 0x30F5, 0x30F6 /* 0x70 */ /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_26[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x20 */ 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, /* 0x20 */ 0x03A0, 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, /* 0x30 */ 0x03A9, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, /* 0x40 */ 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, /* 0x40 */ 0x03C0, 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, /* 0x50 */ 0x03C9 /* 0x50 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_27[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, /* 0x20 */ 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, /* 0x20 */ 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, /* 0x30 */ 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, /* 0x30 */ 0x042E, 0x042F, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, /* 0x50 */ 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, /* 0x50 */ 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, /* 0x60 */ 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, /* 0x60 */ 0x044E, 0x044F /* 0x70 */ /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_28[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x2500, 0x2502, 0x250C, 0x2510, 0x2518, 0x2514, 0x251C, /* 0x20 */ 0x252C, 0x2524, 0x2534, 0x253C, 0x2501, 0x2503, 0x250F, 0x2513, /* 0x20 */ 0x251B, 0x2517, 0x2523, 0x2533, 0x252B, 0x253B, 0x254B, 0x2520, /* 0x30 */ 0x252F, 0x2528, 0x2537, 0x253F, 0x251D, 0x2530, 0x2525, 0x2538, /* 0x30 */ 0x2542 /* 0x40 */ /* 0x40 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_2D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, /* 0x20 */ 0x2467, 0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E, /* 0x20 */ 0x246F, 0x2470, 0x2471, 0x2472, 0x2473, 0x2160, 0x2161, 0x2162, /* 0x30 */ 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0, /* 0x30 */ 0x3349, 0x3314, 0x3322, 0x334D, 0x3318, 0x3327, 0x3303, 0x3336, /* 0x40 */ 0x3351, 0x3357, 0x330D, 0x3326, 0x3323, 0x332B, 0x334A, 0x333B, /* 0x40 */ 0x339C, 0x339D, 0x339E, 0x338E, 0x338F, 0x33C4, 0x33A1, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0x337B, /* 0x50 */ 0x301D, 0x301F, 0x2116, 0x33CD, 0x2121, 0x32A4, 0x32A5, 0x32A6, /* 0x60 */ 0x32A7, 0x32A8, 0x3231, 0x3232, 0x3239, 0x337E, 0x337D, 0x337C, /* 0x60 */ 0x2252, 0x2261, 0x222B, 0x222E, 0x2211, 0x221A, 0x22A5, 0x2220, /* 0x70 */ 0x221F, 0x22BF, 0x2235, 0x2229, 0x222A /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_30[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x4E9C, 0x5516, 0x5A03, 0x963F, 0x54C0, 0x611B, 0x6328, /* 0x20 */ 0x59F6, 0x9022, 0x8475, 0x831C, 0x7A50, 0x60AA, 0x63E1, 0x6E25, /* 0x20 */ 0x65ED, 0x8466, 0x82A6, 0x9BF5, 0x6893, 0x5727, 0x65A1, 0x6271, /* 0x30 */ 0x5B9B, 0x59D0, 0x867B, 0x98F4, 0x7D62, 0x7DBE, 0x9B8E, 0x6216, /* 0x30 */ 0x7C9F, 0x88B7, 0x5B89, 0x5EB5, 0x6309, 0x6697, 0x6848, 0x95C7, /* 0x40 */ 0x978D, 0x674F, 0x4EE5, 0x4F0A, 0x4F4D, 0x4F9D, 0x5049, 0x56F2, /* 0x40 */ 0x5937, 0x59D4, 0x5A01, 0x5C09, 0x60DF, 0x610F, 0x6170, 0x6613, /* 0x50 */ 0x6905, 0x70BA, 0x754F, 0x7570, 0x79FB, 0x7DAD, 0x7DEF, 0x80C3, /* 0x50 */ 0x840E, 0x8863, 0x8B02, 0x9055, 0x907A, 0x533B, 0x4E95, 0x4EA5, /* 0x60 */ 0x57DF, 0x80B2, 0x90C1, 0x78EF, 0x4E00, 0x58F1, 0x6EA2, 0x9038, /* 0x60 */ 0x7A32, 0x8328, 0x828B, 0x9C2F, 0x5141, 0x5370, 0x54BD, 0x54E1, /* 0x70 */ 0x56E0, 0x59FB, 0x5F15, 0x98F2, 0x6DEB, 0x80E4, 0x852D /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_31[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9662, 0x9670, 0x96A0, 0x97FB, 0x540B, 0x53F3, 0x5B87, /* 0x20 */ 0x70CF, 0x7FBD, 0x8FC2, 0x96E8, 0x536F, 0x9D5C, 0x7ABA, 0x4E11, /* 0x20 */ 0x7893, 0x81FC, 0x6E26, 0x5618, 0x5504, 0x6B1D, 0x851A, 0x9C3B, /* 0x30 */ 0x59E5, 0x53A9, 0x6D66, 0x74DC, 0x958F, 0x5642, 0x4E91, 0x904B, /* 0x30 */ 0x96F2, 0x834F, 0x990C, 0x53E1, 0x55B6, 0x5B30, 0x5F71, 0x6620, /* 0x40 */ 0x66F3, 0x6804, 0x6C38, 0x6CF3, 0x6D29, 0x745B, 0x76C8, 0x7A4E, /* 0x40 */ 0x9834, 0x82F1, 0x885B, 0x8A60, 0x92ED, 0x6DB2, 0x75AB, 0x76CA, /* 0x50 */ 0x99C5, 0x60A6, 0x8B01, 0x8D8A, 0x95B2, 0x698E, 0x53AD, 0x5186, /* 0x50 */ 0x5712, 0x5830, 0x5944, 0x5BB4, 0x5EF6, 0x6028, 0x63A9, 0x63F4, /* 0x60 */ 0x6CBF, 0x6F14, 0x708E, 0x7114, 0x7159, 0x71D5, 0x733F, 0x7E01, /* 0x60 */ 0x8276, 0x82D1, 0x8597, 0x9060, 0x925B, 0x9D1B, 0x5869, 0x65BC, /* 0x70 */ 0x6C5A, 0x7525, 0x51F9, 0x592E, 0x5965, 0x5F80, 0x5FDC /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_32[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x62BC, 0x65FA, 0x6A2A, 0x6B27, 0x6BB4, 0x738B, 0x7FC1, /* 0x20 */ 0x8956, 0x9D2C, 0x9D0E, 0x9EC4, 0x5CA1, 0x6C96, 0x837B, 0x5104, /* 0x20 */ 0x5C4B, 0x61B6, 0x81C6, 0x6876, 0x7261, 0x4E59, 0x4FFA, 0x5378, /* 0x30 */ 0x6069, 0x6E29, 0x7A4F, 0x97F3, 0x4E0B, 0x5316, 0x4EEE, 0x4F55, /* 0x30 */ 0x4F3D, 0x4FA1, 0x4F73, 0x52A0, 0x53EF, 0x5609, 0x590F, 0x5AC1, /* 0x40 */ 0x5BB6, 0x5BE1, 0x79D1, 0x6687, 0x679C, 0x67B6, 0x6B4C, 0x6CB3, /* 0x40 */ 0x706B, 0x73C2, 0x798D, 0x79BE, 0x7A3C, 0x7B87, 0x82B1, 0x82DB, /* 0x50 */ 0x8304, 0x8377, 0x83EF, 0x83D3, 0x8766, 0x8AB2, 0x5629, 0x8CA8, /* 0x50 */ 0x8FE6, 0x904E, 0x971E, 0x868A, 0x4FC4, 0x5CE8, 0x6211, 0x7259, /* 0x60 */ 0x753B, 0x81E5, 0x82BD, 0x86FE, 0x8CC0, 0x96C5, 0x9913, 0x99D5, /* 0x60 */ 0x4ECB, 0x4F1A, 0x89E3, 0x56DE, 0x584A, 0x58CA, 0x5EFB, 0x5FEB, /* 0x70 */ 0x602A, 0x6094, 0x6062, 0x61D0, 0x6212, 0x62D0, 0x6539 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_33[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9B41, 0x6666, 0x68B0, 0x6D77, 0x7070, 0x754C, 0x7686, /* 0x20 */ 0x7D75, 0x82A5, 0x87F9, 0x958B, 0x968E, 0x8C9D, 0x51F1, 0x52BE, /* 0x20 */ 0x5916, 0x54B3, 0x5BB3, 0x5D16, 0x6168, 0x6982, 0x6DAF, 0x788D, /* 0x30 */ 0x84CB, 0x8857, 0x8A72, 0x93A7, 0x9AB8, 0x6D6C, 0x99A8, 0x86D9, /* 0x30 */ 0x57A3, 0x67FF, 0x86CE, 0x920E, 0x5283, 0x5687, 0x5404, 0x5ED3, /* 0x40 */ 0x62E1, 0x64B9, 0x683C, 0x6838, 0x6BBB, 0x7372, 0x78BA, 0x7A6B, /* 0x40 */ 0x899A, 0x89D2, 0x8D6B, 0x8F03, 0x90ED, 0x95A3, 0x9694, 0x9769, /* 0x50 */ 0x5B66, 0x5CB3, 0x697D, 0x984D, 0x984E, 0x639B, 0x7B20, 0x6A2B, /* 0x50 */ 0x6A7F, 0x68B6, 0x9C0D, 0x6F5F, 0x5272, 0x559D, 0x6070, 0x62EC, /* 0x60 */ 0x6D3B, 0x6E07, 0x6ED1, 0x845B, 0x8910, 0x8F44, 0x4E14, 0x9C39, /* 0x60 */ 0x53F6, 0x691B, 0x6A3A, 0x9784, 0x682A, 0x515C, 0x7AC3, 0x84B2, /* 0x70 */ 0x91DC, 0x938C, 0x565B, 0x9D28, 0x6822, 0x8305, 0x8431 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_34[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7CA5, 0x5208, 0x82C5, 0x74E6, 0x4E7E, 0x4F83, 0x51A0, /* 0x20 */ 0x5BD2, 0x520A, 0x52D8, 0x52E7, 0x5DFB, 0x559A, 0x582A, 0x59E6, /* 0x20 */ 0x5B8C, 0x5B98, 0x5BDB, 0x5E72, 0x5E79, 0x60A3, 0x611F, 0x6163, /* 0x30 */ 0x61BE, 0x63DB, 0x6562, 0x67D1, 0x6853, 0x68FA, 0x6B3E, 0x6B53, /* 0x30 */ 0x6C57, 0x6F22, 0x6F97, 0x6F45, 0x74B0, 0x7518, 0x76E3, 0x770B, /* 0x40 */ 0x7AFF, 0x7BA1, 0x7C21, 0x7DE9, 0x7F36, 0x7FF0, 0x809D, 0x8266, /* 0x40 */ 0x839E, 0x89B3, 0x8ACC, 0x8CAB, 0x9084, 0x9451, 0x9593, 0x9591, /* 0x50 */ 0x95A2, 0x9665, 0x97D3, 0x9928, 0x8218, 0x4E38, 0x542B, 0x5CB8, /* 0x50 */ 0x5DCC, 0x73A9, 0x764C, 0x773C, 0x5CA9, 0x7FEB, 0x8D0B, 0x96C1, /* 0x60 */ 0x9811, 0x9854, 0x9858, 0x4F01, 0x4F0E, 0x5371, 0x559C, 0x5668, /* 0x60 */ 0x57FA, 0x5947, 0x5B09, 0x5BC4, 0x5C90, 0x5E0C, 0x5E7E, 0x5FCC, /* 0x70 */ 0x63EE, 0x673A, 0x65D7, 0x65E2, 0x671F, 0x68CB, 0x68C4 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_35[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6A5F, 0x5E30, 0x6BC5, 0x6C17, 0x6C7D, 0x757F, 0x7948, /* 0x20 */ 0x5B63, 0x7A00, 0x7D00, 0x5FBD, 0x898F, 0x8A18, 0x8CB4, 0x8D77, /* 0x20 */ 0x8ECC, 0x8F1D, 0x98E2, 0x9A0E, 0x9B3C, 0x4E80, 0x507D, 0x5100, /* 0x30 */ 0x5993, 0x5B9C, 0x622F, 0x6280, 0x64EC, 0x6B3A, 0x72A0, 0x7591, /* 0x30 */ 0x7947, 0x7FA9, 0x87FB, 0x8ABC, 0x8B70, 0x63AC, 0x83CA, 0x97A0, /* 0x40 */ 0x5409, 0x5403, 0x55AB, 0x6854, 0x6A58, 0x8A70, 0x7827, 0x6775, /* 0x40 */ 0x9ECD, 0x5374, 0x5BA2, 0x811A, 0x8650, 0x9006, 0x4E18, 0x4E45, /* 0x50 */ 0x4EC7, 0x4F11, 0x53CA, 0x5438, 0x5BAE, 0x5F13, 0x6025, 0x6551, /* 0x50 */ 0x673D, 0x6C42, 0x6C72, 0x6CE3, 0x7078, 0x7403, 0x7A76, 0x7AAE, /* 0x60 */ 0x7B08, 0x7D1A, 0x7CFE, 0x7D66, 0x65E7, 0x725B, 0x53BB, 0x5C45, /* 0x60 */ 0x5DE8, 0x62D2, 0x62E0, 0x6319, 0x6E20, 0x865A, 0x8A31, 0x8DDD, /* 0x70 */ 0x92F8, 0x6F01, 0x79A6, 0x9B5A, 0x4EA8, 0x4EAB, 0x4EAC /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_36[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x4F9B, 0x4FA0, 0x50D1, 0x5147, 0x7AF6, 0x5171, 0x51F6, /* 0x20 */ 0x5354, 0x5321, 0x537F, 0x53EB, 0x55AC, 0x5883, 0x5CE1, 0x5F37, /* 0x20 */ 0x5F4A, 0x602F, 0x6050, 0x606D, 0x631F, 0x6559, 0x6A4B, 0x6CC1, /* 0x30 */ 0x72C2, 0x72ED, 0x77EF, 0x80F8, 0x8105, 0x8208, 0x854E, 0x90F7, /* 0x30 */ 0x93E1, 0x97FF, 0x9957, 0x9A5A, 0x4EF0, 0x51DD, 0x5C2D, 0x6681, /* 0x40 */ 0x696D, 0x5C40, 0x66F2, 0x6975, 0x7389, 0x6850, 0x7C81, 0x50C5, /* 0x40 */ 0x52E4, 0x5747, 0x5DFE, 0x9326, 0x65A4, 0x6B23, 0x6B3D, 0x7434, /* 0x50 */ 0x7981, 0x79BD, 0x7B4B, 0x7DCA, 0x82B9, 0x83CC, 0x887F, 0x895F, /* 0x50 */ 0x8B39, 0x8FD1, 0x91D1, 0x541F, 0x9280, 0x4E5D, 0x5036, 0x53E5, /* 0x60 */ 0x533A, 0x72D7, 0x7396, 0x77E9, 0x82E6, 0x8EAF, 0x99C6, 0x99C8, /* 0x60 */ 0x99D2, 0x5177, 0x611A, 0x865E, 0x55B0, 0x7A7A, 0x5076, 0x5BD3, /* 0x70 */ 0x9047, 0x9685, 0x4E32, 0x6ADB, 0x91E7, 0x5C51, 0x5C48 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_37[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6398, 0x7A9F, 0x6C93, 0x9774, 0x8F61, 0x7AAA, 0x718A, /* 0x20 */ 0x9688, 0x7C82, 0x6817, 0x7E70, 0x6851, 0x936C, 0x52F2, 0x541B, /* 0x20 */ 0x85AB, 0x8A13, 0x7FA4, 0x8ECD, 0x90E1, 0x5366, 0x8888, 0x7941, /* 0x30 */ 0x4FC2, 0x50BE, 0x5211, 0x5144, 0x5553, 0x572D, 0x73EA, 0x578B, /* 0x30 */ 0x5951, 0x5F62, 0x5F84, 0x6075, 0x6176, 0x6167, 0x61A9, 0x63B2, /* 0x40 */ 0x643A, 0x656C, 0x666F, 0x6842, 0x6E13, 0x7566, 0x7A3D, 0x7CFB, /* 0x40 */ 0x7D4C, 0x7D99, 0x7E4B, 0x7F6B, 0x830E, 0x834A, 0x86CD, 0x8A08, /* 0x50 */ 0x8A63, 0x8B66, 0x8EFD, 0x981A, 0x9D8F, 0x82B8, 0x8FCE, 0x9BE8, /* 0x50 */ 0x5287, 0x621F, 0x6483, 0x6FC0, 0x9699, 0x6841, 0x5091, 0x6B20, /* 0x60 */ 0x6C7A, 0x6F54, 0x7A74, 0x7D50, 0x8840, 0x8A23, 0x6708, 0x4EF6, /* 0x60 */ 0x5039, 0x5026, 0x5065, 0x517C, 0x5238, 0x5263, 0x55A7, 0x570F, /* 0x70 */ 0x5805, 0x5ACC, 0x5EFA, 0x61B2, 0x61F8, 0x62F3, 0x6372 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_38[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x691C, 0x6A29, 0x727D, 0x72AC, 0x732E, 0x7814, 0x786F, /* 0x20 */ 0x7D79, 0x770C, 0x80A9, 0x898B, 0x8B19, 0x8CE2, 0x8ED2, 0x9063, /* 0x20 */ 0x9375, 0x967A, 0x9855, 0x9A13, 0x9E78, 0x5143, 0x539F, 0x53B3, /* 0x30 */ 0x5E7B, 0x5F26, 0x6E1B, 0x6E90, 0x7384, 0x73FE, 0x7D43, 0x8237, /* 0x30 */ 0x8A00, 0x8AFA, 0x9650, 0x4E4E, 0x500B, 0x53E4, 0x547C, 0x56FA, /* 0x40 */ 0x59D1, 0x5B64, 0x5DF1, 0x5EAB, 0x5F27, 0x6238, 0x6545, 0x67AF, /* 0x40 */ 0x6E56, 0x72D0, 0x7CCA, 0x88B4, 0x80A1, 0x80E1, 0x83F0, 0x864E, /* 0x50 */ 0x8A87, 0x8DE8, 0x9237, 0x96C7, 0x9867, 0x9F13, 0x4E94, 0x4E92, /* 0x50 */ 0x4F0D, 0x5348, 0x5449, 0x543E, 0x5A2F, 0x5F8C, 0x5FA1, 0x609F, /* 0x60 */ 0x68A7, 0x6A8E, 0x745A, 0x7881, 0x8A9E, 0x8AA4, 0x8B77, 0x9190, /* 0x60 */ 0x4E5E, 0x9BC9, 0x4EA4, 0x4F7C, 0x4FAF, 0x5019, 0x5016, 0x5149, /* 0x70 */ 0x516C, 0x529F, 0x52B9, 0x52FE, 0x539A, 0x53E3, 0x5411 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_39[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x540E, 0x5589, 0x5751, 0x57A2, 0x597D, 0x5B54, 0x5B5D, /* 0x20 */ 0x5B8F, 0x5DE5, 0x5DE7, 0x5DF7, 0x5E78, 0x5E83, 0x5E9A, 0x5EB7, /* 0x20 */ 0x5F18, 0x6052, 0x614C, 0x6297, 0x62D8, 0x63A7, 0x653B, 0x6602, /* 0x30 */ 0x6643, 0x66F4, 0x676D, 0x6821, 0x6897, 0x69CB, 0x6C5F, 0x6D2A, /* 0x30 */ 0x6D69, 0x6E2F, 0x6E9D, 0x7532, 0x7687, 0x786C, 0x7A3F, 0x7CE0, /* 0x40 */ 0x7D05, 0x7D18, 0x7D5E, 0x7DB1, 0x8015, 0x8003, 0x80AF, 0x80B1, /* 0x40 */ 0x8154, 0x818F, 0x822A, 0x8352, 0x884C, 0x8861, 0x8B1B, 0x8CA2, /* 0x50 */ 0x8CFC, 0x90CA, 0x9175, 0x9271, 0x783F, 0x92FC, 0x95A4, 0x964D, /* 0x50 */ 0x9805, 0x9999, 0x9AD8, 0x9D3B, 0x525B, 0x52AB, 0x53F7, 0x5408, /* 0x60 */ 0x58D5, 0x62F7, 0x6FE0, 0x8C6A, 0x8F5F, 0x9EB9, 0x514B, 0x523B, /* 0x60 */ 0x544A, 0x56FD, 0x7A40, 0x9177, 0x9D60, 0x9ED2, 0x7344, 0x6F09, /* 0x70 */ 0x8170, 0x7511, 0x5FFD, 0x60DA, 0x9AA8, 0x72DB, 0x8FBC /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_3A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6B64, 0x9803, 0x4ECA, 0x56F0, 0x5764, 0x58BE, 0x5A5A, /* 0x20 */ 0x6068, 0x61C7, 0x660F, 0x6606, 0x6839, 0x68B1, 0x6DF7, 0x75D5, /* 0x20 */ 0x7D3A, 0x826E, 0x9B42, 0x4E9B, 0x4F50, 0x53C9, 0x5506, 0x5D6F, /* 0x30 */ 0x5DE6, 0x5DEE, 0x67FB, 0x6C99, 0x7473, 0x7802, 0x8A50, 0x9396, /* 0x30 */ 0x88DF, 0x5750, 0x5EA7, 0x632B, 0x50B5, 0x50AC, 0x518D, 0x6700, /* 0x40 */ 0x54C9, 0x585E, 0x59BB, 0x5BB0, 0x5F69, 0x624D, 0x63A1, 0x683D, /* 0x40 */ 0x6B73, 0x6E08, 0x707D, 0x91C7, 0x7280, 0x7815, 0x7826, 0x796D, /* 0x50 */ 0x658E, 0x7D30, 0x83DC, 0x88C1, 0x8F09, 0x969B, 0x5264, 0x5728, /* 0x50 */ 0x6750, 0x7F6A, 0x8CA1, 0x51B4, 0x5742, 0x962A, 0x583A, 0x698A, /* 0x60 */ 0x80B4, 0x54B2, 0x5D0E, 0x57FC, 0x7895, 0x9DFA, 0x4F5C, 0x524A, /* 0x60 */ 0x548B, 0x643E, 0x6628, 0x6714, 0x67F5, 0x7A84, 0x7B56, 0x7D22, /* 0x70 */ 0x932F, 0x685C, 0x9BAD, 0x7B39, 0x5319, 0x518A, 0x5237 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_3B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5BDF, 0x62F6, 0x64AE, 0x64E6, 0x672D, 0x6BBA, 0x85A9, /* 0x20 */ 0x96D1, 0x7690, 0x9BD6, 0x634C, 0x9306, 0x9BAB, 0x76BF, 0x6652, /* 0x20 */ 0x4E09, 0x5098, 0x53C2, 0x5C71, 0x60E8, 0x6492, 0x6563, 0x685F, /* 0x30 */ 0x71E6, 0x73CA, 0x7523, 0x7B97, 0x7E82, 0x8695, 0x8B83, 0x8CDB, /* 0x30 */ 0x9178, 0x9910, 0x65AC, 0x66AB, 0x6B8B, 0x4ED5, 0x4ED4, 0x4F3A, /* 0x40 */ 0x4F7F, 0x523A, 0x53F8, 0x53F2, 0x55E3, 0x56DB, 0x58EB, 0x59CB, /* 0x40 */ 0x59C9, 0x59FF, 0x5B50, 0x5C4D, 0x5E02, 0x5E2B, 0x5FD7, 0x601D, /* 0x50 */ 0x6307, 0x652F, 0x5B5C, 0x65AF, 0x65BD, 0x65E8, 0x679D, 0x6B62, /* 0x50 */ 0x6B7B, 0x6C0F, 0x7345, 0x7949, 0x79C1, 0x7CF8, 0x7D19, 0x7D2B, /* 0x60 */ 0x80A2, 0x8102, 0x81F3, 0x8996, 0x8A5E, 0x8A69, 0x8A66, 0x8A8C, /* 0x60 */ 0x8AEE, 0x8CC7, 0x8CDC, 0x96CC, 0x98FC, 0x6B6F, 0x4E8B, 0x4F3C, /* 0x70 */ 0x4F8D, 0x5150, 0x5B57, 0x5BFA, 0x6148, 0x6301, 0x6642 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_3C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6B21, 0x6ECB, 0x6CBB, 0x723E, 0x74BD, 0x75D4, 0x78C1, /* 0x20 */ 0x793A, 0x800C, 0x8033, 0x81EA, 0x8494, 0x8F9E, 0x6C50, 0x9E7F, /* 0x20 */ 0x5F0F, 0x8B58, 0x9D2B, 0x7AFA, 0x8EF8, 0x5B8D, 0x96EB, 0x4E03, /* 0x30 */ 0x53F1, 0x57F7, 0x5931, 0x5AC9, 0x5BA4, 0x6089, 0x6E7F, 0x6F06, /* 0x30 */ 0x75BE, 0x8CEA, 0x5B9F, 0x8500, 0x7BE0, 0x5072, 0x67F4, 0x829D, /* 0x40 */ 0x5C61, 0x854A, 0x7E1E, 0x820E, 0x5199, 0x5C04, 0x6368, 0x8D66, /* 0x40 */ 0x659C, 0x716E, 0x793E, 0x7D17, 0x8005, 0x8B1D, 0x8ECA, 0x906E, /* 0x50 */ 0x86C7, 0x90AA, 0x501F, 0x52FA, 0x5C3A, 0x6753, 0x707C, 0x7235, /* 0x50 */ 0x914C, 0x91C8, 0x932B, 0x82E5, 0x5BC2, 0x5F31, 0x60F9, 0x4E3B, /* 0x60 */ 0x53D6, 0x5B88, 0x624B, 0x6731, 0x6B8A, 0x72E9, 0x73E0, 0x7A2E, /* 0x60 */ 0x816B, 0x8DA3, 0x9152, 0x9996, 0x5112, 0x53D7, 0x546A, 0x5BFF, /* 0x70 */ 0x6388, 0x6A39, 0x7DAC, 0x9700, 0x56DA, 0x53CE, 0x5468 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_3D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5B97, 0x5C31, 0x5DDE, 0x4FEE, 0x6101, 0x62FE, 0x6D32, /* 0x20 */ 0x79C0, 0x79CB, 0x7D42, 0x7E4D, 0x7FD2, 0x81ED, 0x821F, 0x8490, /* 0x20 */ 0x8846, 0x8972, 0x8B90, 0x8E74, 0x8F2F, 0x9031, 0x914B, 0x916C, /* 0x30 */ 0x96C6, 0x919C, 0x4EC0, 0x4F4F, 0x5145, 0x5341, 0x5F93, 0x620E, /* 0x30 */ 0x67D4, 0x6C41, 0x6E0B, 0x7363, 0x7E26, 0x91CD, 0x9283, 0x53D4, /* 0x40 */ 0x5919, 0x5BBF, 0x6DD1, 0x795D, 0x7E2E, 0x7C9B, 0x587E, 0x719F, /* 0x40 */ 0x51FA, 0x8853, 0x8FF0, 0x4FCA, 0x5CFB, 0x6625, 0x77AC, 0x7AE3, /* 0x50 */ 0x821C, 0x99FF, 0x51C6, 0x5FAA, 0x65EC, 0x696F, 0x6B89, 0x6DF3, /* 0x50 */ 0x6E96, 0x6F64, 0x76FE, 0x7D14, 0x5DE1, 0x9075, 0x9187, 0x9806, /* 0x60 */ 0x51E6, 0x521D, 0x6240, 0x6691, 0x66D9, 0x6E1A, 0x5EB6, 0x7DD2, /* 0x60 */ 0x7F72, 0x66F8, 0x85AF, 0x85F7, 0x8AF8, 0x52A9, 0x53D9, 0x5973, /* 0x70 */ 0x5E8F, 0x5F90, 0x6055, 0x92E4, 0x9664, 0x50B7, 0x511F /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_3E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x52DD, 0x5320, 0x5347, 0x53EC, 0x54E8, 0x5546, 0x5531, /* 0x20 */ 0x5617, 0x5968, 0x59BE, 0x5A3C, 0x5BB5, 0x5C06, 0x5C0F, 0x5C11, /* 0x20 */ 0x5C1A, 0x5E84, 0x5E8A, 0x5EE0, 0x5F70, 0x627F, 0x6284, 0x62DB, /* 0x30 */ 0x638C, 0x6377, 0x6607, 0x660C, 0x662D, 0x6676, 0x677E, 0x68A2, /* 0x30 */ 0x6A1F, 0x6A35, 0x6CBC, 0x6D88, 0x6E09, 0x6E58, 0x713C, 0x7126, /* 0x40 */ 0x7167, 0x75C7, 0x7701, 0x785D, 0x7901, 0x7965, 0x79F0, 0x7AE0, /* 0x40 */ 0x7B11, 0x7CA7, 0x7D39, 0x8096, 0x83D6, 0x848B, 0x8549, 0x885D, /* 0x50 */ 0x88F3, 0x8A1F, 0x8A3C, 0x8A54, 0x8A73, 0x8C61, 0x8CDE, 0x91A4, /* 0x50 */ 0x9266, 0x937E, 0x9418, 0x969C, 0x9798, 0x4E0A, 0x4E08, 0x4E1E, /* 0x60 */ 0x4E57, 0x5197, 0x5270, 0x57CE, 0x5834, 0x58CC, 0x5B22, 0x5E38, /* 0x60 */ 0x60C5, 0x64FE, 0x6761, 0x6756, 0x6D44, 0x72B6, 0x7573, 0x7A63, /* 0x70 */ 0x84B8, 0x8B72, 0x91B8, 0x9320, 0x5631, 0x57F4, 0x98FE /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_3F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x62ED, 0x690D, 0x6B96, 0x71ED, 0x7E54, 0x8077, 0x8272, /* 0x20 */ 0x89E6, 0x98DF, 0x8755, 0x8FB1, 0x5C3B, 0x4F38, 0x4FE1, 0x4FB5, /* 0x20 */ 0x5507, 0x5A20, 0x5BDD, 0x5BE9, 0x5FC3, 0x614E, 0x632F, 0x65B0, /* 0x30 */ 0x664B, 0x68EE, 0x699B, 0x6D78, 0x6DF1, 0x7533, 0x75B9, 0x771F, /* 0x30 */ 0x795E, 0x79E6, 0x7D33, 0x81E3, 0x82AF, 0x85AA, 0x89AA, 0x8A3A, /* 0x40 */ 0x8EAB, 0x8F9B, 0x9032, 0x91DD, 0x9707, 0x4EBA, 0x4EC1, 0x5203, /* 0x40 */ 0x5875, 0x58EC, 0x5C0B, 0x751A, 0x5C3D, 0x814E, 0x8A0A, 0x8FC5, /* 0x50 */ 0x9663, 0x976D, 0x7B25, 0x8ACF, 0x9808, 0x9162, 0x56F3, 0x53A8, /* 0x50 */ 0x9017, 0x5439, 0x5782, 0x5E25, 0x63A8, 0x6C34, 0x708A, 0x7761, /* 0x60 */ 0x7C8B, 0x7FE0, 0x8870, 0x9042, 0x9154, 0x9310, 0x9318, 0x968F, /* 0x60 */ 0x745E, 0x9AC4, 0x5D07, 0x5D69, 0x6570, 0x67A2, 0x8DA8, 0x96DB, /* 0x70 */ 0x636E, 0x6749, 0x6919, 0x83C5, 0x9817, 0x96C0, 0x88FE /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_40[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6F84, 0x647A, 0x5BF8, 0x4E16, 0x702C, 0x755D, 0x662F, /* 0x20 */ 0x51C4, 0x5236, 0x52E2, 0x59D3, 0x5F81, 0x6027, 0x6210, 0x653F, /* 0x20 */ 0x6574, 0x661F, 0x6674, 0x68F2, 0x6816, 0x6B63, 0x6E05, 0x7272, /* 0x30 */ 0x751F, 0x76DB, 0x7CBE, 0x8056, 0x58F0, 0x88FD, 0x897F, 0x8AA0, /* 0x30 */ 0x8A93, 0x8ACB, 0x901D, 0x9192, 0x9752, 0x9759, 0x6589, 0x7A0E, /* 0x40 */ 0x8106, 0x96BB, 0x5E2D, 0x60DC, 0x621A, 0x65A5, 0x6614, 0x6790, /* 0x40 */ 0x77F3, 0x7A4D, 0x7C4D, 0x7E3E, 0x810A, 0x8CAC, 0x8D64, 0x8DE1, /* 0x50 */ 0x8E5F, 0x78A9, 0x5207, 0x62D9, 0x63A5, 0x6442, 0x6298, 0x8A2D, /* 0x50 */ 0x7A83, 0x7BC0, 0x8AAC, 0x96EA, 0x7D76, 0x820C, 0x8749, 0x4ED9, /* 0x60 */ 0x5148, 0x5343, 0x5360, 0x5BA3, 0x5C02, 0x5C16, 0x5DDD, 0x6226, /* 0x60 */ 0x6247, 0x64B0, 0x6813, 0x6834, 0x6CC9, 0x6D45, 0x6D17, 0x67D3, /* 0x70 */ 0x6F5C, 0x714E, 0x717D, 0x65CB, 0x7A7F, 0x7BAD, 0x7DDA /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_41[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7E4A, 0x7FA8, 0x817A, 0x821B, 0x8239, 0x85A6, 0x8A6E, /* 0x20 */ 0x8CCE, 0x8DF5, 0x9078, 0x9077, 0x92AD, 0x9291, 0x9583, 0x9BAE, /* 0x20 */ 0x524D, 0x5584, 0x6F38, 0x7136, 0x5168, 0x7985, 0x7E55, 0x81B3, /* 0x30 */ 0x7CCE, 0x564C, 0x5851, 0x5CA8, 0x63AA, 0x66FE, 0x66FD, 0x695A, /* 0x30 */ 0x72D9, 0x758F, 0x758E, 0x790E, 0x7956, 0x79DF, 0x7C97, 0x7D20, /* 0x40 */ 0x7D44, 0x8607, 0x8A34, 0x963B, 0x9061, 0x9F20, 0x50E7, 0x5275, /* 0x40 */ 0x53CC, 0x53E2, 0x5009, 0x55AA, 0x58EE, 0x594F, 0x723D, 0x5B8B, /* 0x50 */ 0x5C64, 0x531D, 0x60E3, 0x60F3, 0x635C, 0x6383, 0x633F, 0x63BB, /* 0x50 */ 0x64CD, 0x65E9, 0x66F9, 0x5DE3, 0x69CD, 0x69FD, 0x6F15, 0x71E5, /* 0x60 */ 0x4E89, 0x75E9, 0x76F8, 0x7A93, 0x7CDF, 0x7DCF, 0x7D9C, 0x8061, /* 0x60 */ 0x8349, 0x8358, 0x846C, 0x84BC, 0x85FB, 0x88C5, 0x8D70, 0x9001, /* 0x70 */ 0x906D, 0x9397, 0x971C, 0x9A12, 0x50CF, 0x5897, 0x618E /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_42[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x81D3, 0x8535, 0x8D08, 0x9020, 0x4FC3, 0x5074, 0x5247, /* 0x20 */ 0x5373, 0x606F, 0x6349, 0x675F, 0x6E2C, 0x8DB3, 0x901F, 0x4FD7, /* 0x20 */ 0x5C5E, 0x8CCA, 0x65CF, 0x7D9A, 0x5352, 0x8896, 0x5176, 0x63C3, /* 0x30 */ 0x5B58, 0x5B6B, 0x5C0A, 0x640D, 0x6751, 0x905C, 0x4ED6, 0x591A, /* 0x30 */ 0x592A, 0x6C70, 0x8A51, 0x553E, 0x5815, 0x59A5, 0x60F0, 0x6253, /* 0x40 */ 0x67C1, 0x8235, 0x6955, 0x9640, 0x99C4, 0x9A28, 0x4F53, 0x5806, /* 0x40 */ 0x5BFE, 0x8010, 0x5CB1, 0x5E2F, 0x5F85, 0x6020, 0x614B, 0x6234, /* 0x50 */ 0x66FF, 0x6CF0, 0x6EDE, 0x80CE, 0x817F, 0x82D4, 0x888B, 0x8CB8, /* 0x50 */ 0x9000, 0x902E, 0x968A, 0x9EDB, 0x9BDB, 0x4EE3, 0x53F0, 0x5927, /* 0x60 */ 0x7B2C, 0x918D, 0x984C, 0x9DF9, 0x6EDD, 0x7027, 0x5353, 0x5544, /* 0x60 */ 0x5B85, 0x6258, 0x629E, 0x62D3, 0x6CA2, 0x6FEF, 0x7422, 0x8A17, /* 0x70 */ 0x9438, 0x6FC1, 0x8AFE, 0x8338, 0x51E7, 0x86F8, 0x53EA /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_43[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x53E9, 0x4F46, 0x9054, 0x8FB0, 0x596A, 0x8131, 0x5DFD, /* 0x20 */ 0x7AEA, 0x8FBF, 0x68DA, 0x8C37, 0x72F8, 0x9C48, 0x6A3D, 0x8AB0, /* 0x20 */ 0x4E39, 0x5358, 0x5606, 0x5766, 0x62C5, 0x63A2, 0x65E6, 0x6B4E, /* 0x30 */ 0x6DE1, 0x6E5B, 0x70AD, 0x77ED, 0x7AEF, 0x7BAA, 0x7DBB, 0x803D, /* 0x30 */ 0x80C6, 0x86CB, 0x8A95, 0x935B, 0x56E3, 0x58C7, 0x5F3E, 0x65AD, /* 0x40 */ 0x6696, 0x6A80, 0x6BB5, 0x7537, 0x8AC7, 0x5024, 0x77E5, 0x5730, /* 0x40 */ 0x5F1B, 0x6065, 0x667A, 0x6C60, 0x75F4, 0x7A1A, 0x7F6E, 0x81F4, /* 0x50 */ 0x8718, 0x9045, 0x99B3, 0x7BC9, 0x755C, 0x7AF9, 0x7B51, 0x84C4, /* 0x50 */ 0x9010, 0x79E9, 0x7A92, 0x8336, 0x5AE1, 0x7740, 0x4E2D, 0x4EF2, /* 0x60 */ 0x5B99, 0x5FE0, 0x62BD, 0x663C, 0x67F1, 0x6CE8, 0x866B, 0x8877, /* 0x60 */ 0x8A3B, 0x914E, 0x92F3, 0x99D0, 0x6A17, 0x7026, 0x732A, 0x82E7, /* 0x70 */ 0x8457, 0x8CAF, 0x4E01, 0x5146, 0x51CB, 0x558B, 0x5BF5 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_44[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5E16, 0x5E33, 0x5E81, 0x5F14, 0x5F35, 0x5F6B, 0x5FB4, /* 0x20 */ 0x61F2, 0x6311, 0x66A2, 0x671D, 0x6F6E, 0x7252, 0x753A, 0x773A, /* 0x20 */ 0x8074, 0x8139, 0x8178, 0x8776, 0x8ABF, 0x8ADC, 0x8D85, 0x8DF3, /* 0x30 */ 0x929A, 0x9577, 0x9802, 0x9CE5, 0x52C5, 0x6357, 0x76F4, 0x6715, /* 0x30 */ 0x6C88, 0x73CD, 0x8CC3, 0x93AE, 0x9673, 0x6D25, 0x589C, 0x690E, /* 0x40 */ 0x69CC, 0x8FFD, 0x939A, 0x75DB, 0x901A, 0x585A, 0x6802, 0x63B4, /* 0x40 */ 0x69FB, 0x4F43, 0x6F2C, 0x67D8, 0x8FBB, 0x8526, 0x7DB4, 0x9354, /* 0x50 */ 0x693F, 0x6F70, 0x576A, 0x58F7, 0x5B2C, 0x7D2C, 0x722A, 0x540A, /* 0x50 */ 0x91E3, 0x9DB4, 0x4EAD, 0x4F4E, 0x505C, 0x5075, 0x5243, 0x8C9E, /* 0x60 */ 0x5448, 0x5824, 0x5B9A, 0x5E1D, 0x5E95, 0x5EAD, 0x5EF7, 0x5F1F, /* 0x60 */ 0x608C, 0x62B5, 0x633A, 0x63D0, 0x68AF, 0x6C40, 0x7887, 0x798E, /* 0x70 */ 0x7A0B, 0x7DE0, 0x8247, 0x8A02, 0x8AE6, 0x8E44, 0x9013 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_45[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x90B8, 0x912D, 0x91D8, 0x9F0E, 0x6CE5, 0x6458, 0x64E2, /* 0x20 */ 0x6575, 0x6EF4, 0x7684, 0x7B1B, 0x9069, 0x93D1, 0x6EBA, 0x54F2, /* 0x20 */ 0x5FB9, 0x64A4, 0x8F4D, 0x8FED, 0x9244, 0x5178, 0x586B, 0x5929, /* 0x30 */ 0x5C55, 0x5E97, 0x6DFB, 0x7E8F, 0x751C, 0x8CBC, 0x8EE2, 0x985B, /* 0x30 */ 0x70B9, 0x4F1D, 0x6BBF, 0x6FB1, 0x7530, 0x96FB, 0x514E, 0x5410, /* 0x40 */ 0x5835, 0x5857, 0x59AC, 0x5C60, 0x5F92, 0x6597, 0x675C, 0x6E21, /* 0x40 */ 0x767B, 0x83DF, 0x8CED, 0x9014, 0x90FD, 0x934D, 0x7825, 0x783A, /* 0x50 */ 0x52AA, 0x5EA6, 0x571F, 0x5974, 0x6012, 0x5012, 0x515A, 0x51AC, /* 0x50 */ 0x51CD, 0x5200, 0x5510, 0x5854, 0x5858, 0x5957, 0x5B95, 0x5CF6, /* 0x60 */ 0x5D8B, 0x60BC, 0x6295, 0x642D, 0x6771, 0x6843, 0x68BC, 0x68DF, /* 0x60 */ 0x76D7, 0x6DD8, 0x6E6F, 0x6D9B, 0x706F, 0x71C8, 0x5F53, 0x75D8, /* 0x70 */ 0x7977, 0x7B49, 0x7B54, 0x7B52, 0x7CD6, 0x7D71, 0x5230 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_46[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8463, 0x8569, 0x85E4, 0x8A0E, 0x8B04, 0x8C46, 0x8E0F, /* 0x20 */ 0x9003, 0x900F, 0x9419, 0x9676, 0x982D, 0x9A30, 0x95D8, 0x50CD, /* 0x20 */ 0x52D5, 0x540C, 0x5802, 0x5C0E, 0x61A7, 0x649E, 0x6D1E, 0x77B3, /* 0x30 */ 0x7AE5, 0x80F4, 0x8404, 0x9053, 0x9285, 0x5CE0, 0x9D07, 0x533F, /* 0x30 */ 0x5F97, 0x5FB3, 0x6D9C, 0x7279, 0x7763, 0x79BF, 0x7BE4, 0x6BD2, /* 0x40 */ 0x72EC, 0x8AAD, 0x6803, 0x6A61, 0x51F8, 0x7A81, 0x6934, 0x5C4A, /* 0x40 */ 0x9CF6, 0x82EB, 0x5BC5, 0x9149, 0x701E, 0x5678, 0x5C6F, 0x60C7, /* 0x50 */ 0x6566, 0x6C8C, 0x8C5A, 0x9041, 0x9813, 0x5451, 0x66C7, 0x920D, /* 0x50 */ 0x5948, 0x90A3, 0x5185, 0x4E4D, 0x51EA, 0x8599, 0x8B0E, 0x7058, /* 0x60 */ 0x637A, 0x934B, 0x6962, 0x99B4, 0x7E04, 0x7577, 0x5357, 0x6960, /* 0x60 */ 0x8EDF, 0x96E3, 0x6C5D, 0x4E8C, 0x5C3C, 0x5F10, 0x8FE9, 0x5302, /* 0x70 */ 0x8CD1, 0x8089, 0x8679, 0x5EFF, 0x65E5, 0x4E73, 0x5165 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_47[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5982, 0x5C3F, 0x97EE, 0x4EFB, 0x598A, 0x5FCD, 0x8A8D, /* 0x20 */ 0x6FE1, 0x79B0, 0x7962, 0x5BE7, 0x8471, 0x732B, 0x71B1, 0x5E74, /* 0x20 */ 0x5FF5, 0x637B, 0x649A, 0x71C3, 0x7C98, 0x4E43, 0x5EFC, 0x4E4B, /* 0x30 */ 0x57DC, 0x56A2, 0x60A9, 0x6FC3, 0x7D0D, 0x80FD, 0x8133, 0x81BF, /* 0x30 */ 0x8FB2, 0x8997, 0x86A4, 0x5DF4, 0x628A, 0x64AD, 0x8987, 0x6777, /* 0x40 */ 0x6CE2, 0x6D3E, 0x7436, 0x7834, 0x5A46, 0x7F75, 0x82AD, 0x99AC, /* 0x40 */ 0x4FF3, 0x5EC3, 0x62DD, 0x6392, 0x6557, 0x676F, 0x76C3, 0x724C, /* 0x50 */ 0x80CC, 0x80BA, 0x8F29, 0x914D, 0x500D, 0x57F9, 0x5A92, 0x6885, /* 0x50 */ 0x6973, 0x7164, 0x72FD, 0x8CB7, 0x58F2, 0x8CE0, 0x966A, 0x9019, /* 0x60 */ 0x877F, 0x79E4, 0x77E7, 0x8429, 0x4F2F, 0x5265, 0x535A, 0x62CD, /* 0x60 */ 0x67CF, 0x6CCA, 0x767D, 0x7B94, 0x7C95, 0x8236, 0x8584, 0x8FEB, /* 0x70 */ 0x66DD, 0x6F20, 0x7206, 0x7E1B, 0x83AB, 0x99C1, 0x9EA6 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_48[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x51FD, 0x7BB1, 0x7872, 0x7BB8, 0x8087, 0x7B48, 0x6AE8, /* 0x20 */ 0x5E61, 0x808C, 0x7551, 0x7560, 0x516B, 0x9262, 0x6E8C, 0x767A, /* 0x20 */ 0x9197, 0x9AEA, 0x4F10, 0x7F70, 0x629C, 0x7B4F, 0x95A5, 0x9CE9, /* 0x30 */ 0x567A, 0x5859, 0x86E4, 0x96BC, 0x4F34, 0x5224, 0x534A, 0x53CD, /* 0x30 */ 0x53DB, 0x5E06, 0x642C, 0x6591, 0x677F, 0x6C3E, 0x6C4E, 0x7248, /* 0x40 */ 0x72AF, 0x73ED, 0x7554, 0x7E41, 0x822C, 0x85E9, 0x8CA9, 0x7BC4, /* 0x40 */ 0x91C6, 0x7169, 0x9812, 0x98EF, 0x633D, 0x6669, 0x756A, 0x76E4, /* 0x50 */ 0x78D0, 0x8543, 0x86EE, 0x532A, 0x5351, 0x5426, 0x5983, 0x5E87, /* 0x50 */ 0x5F7C, 0x60B2, 0x6249, 0x6279, 0x62AB, 0x6590, 0x6BD4, 0x6CCC, /* 0x60 */ 0x75B2, 0x76AE, 0x7891, 0x79D8, 0x7DCB, 0x7F77, 0x80A5, 0x88AB, /* 0x60 */ 0x8AB9, 0x8CBB, 0x907F, 0x975E, 0x98DB, 0x6A0B, 0x7C38, 0x5099, /* 0x70 */ 0x5C3E, 0x5FAE, 0x6787, 0x6BD8, 0x7435, 0x7709, 0x7F8E /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_49[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9F3B, 0x67CA, 0x7A17, 0x5339, 0x758B, 0x9AED, 0x5F66, /* 0x20 */ 0x819D, 0x83F1, 0x8098, 0x5F3C, 0x5FC5, 0x7562, 0x7B46, 0x903C, /* 0x20 */ 0x6867, 0x59EB, 0x5A9B, 0x7D10, 0x767E, 0x8B2C, 0x4FF5, 0x5F6A, /* 0x30 */ 0x6A19, 0x6C37, 0x6F02, 0x74E2, 0x7968, 0x8868, 0x8A55, 0x8C79, /* 0x30 */ 0x5EDF, 0x63CF, 0x75C5, 0x79D2, 0x82D7, 0x9328, 0x92F2, 0x849C, /* 0x40 */ 0x86ED, 0x9C2D, 0x54C1, 0x5F6C, 0x658C, 0x6D5C, 0x7015, 0x8CA7, /* 0x40 */ 0x8CD3, 0x983B, 0x654F, 0x74F6, 0x4E0D, 0x4ED8, 0x57E0, 0x592B, /* 0x50 */ 0x5A66, 0x5BCC, 0x51A8, 0x5E03, 0x5E9C, 0x6016, 0x6276, 0x6577, /* 0x50 */ 0x65A7, 0x666E, 0x6D6E, 0x7236, 0x7B26, 0x8150, 0x819A, 0x8299, /* 0x60 */ 0x8B5C, 0x8CA0, 0x8CE6, 0x8D74, 0x961C, 0x9644, 0x4FAE, 0x64AB, /* 0x60 */ 0x6B66, 0x821E, 0x8461, 0x856A, 0x90E8, 0x5C01, 0x6953, 0x98A8, /* 0x70 */ 0x847A, 0x8557, 0x4F0F, 0x526F, 0x5FA9, 0x5E45, 0x670D /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_4A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x798F, 0x8179, 0x8907, 0x8986, 0x6DF5, 0x5F17, 0x6255, /* 0x20 */ 0x6CB8, 0x4ECF, 0x7269, 0x9B92, 0x5206, 0x543B, 0x5674, 0x58B3, /* 0x20 */ 0x61A4, 0x626E, 0x711A, 0x596E, 0x7C89, 0x7CDE, 0x7D1B, 0x96F0, /* 0x30 */ 0x6587, 0x805E, 0x4E19, 0x4F75, 0x5175, 0x5840, 0x5E63, 0x5E73, /* 0x30 */ 0x5F0A, 0x67C4, 0x4E26, 0x853D, 0x9589, 0x965B, 0x7C73, 0x9801, /* 0x40 */ 0x50FB, 0x58C1, 0x7656, 0x78A7, 0x5225, 0x77A5, 0x8511, 0x7B86, /* 0x40 */ 0x504F, 0x5909, 0x7247, 0x7BC7, 0x7DE8, 0x8FBA, 0x8FD4, 0x904D, /* 0x50 */ 0x4FBF, 0x52C9, 0x5A29, 0x5F01, 0x97AD, 0x4FDD, 0x8217, 0x92EA, /* 0x50 */ 0x5703, 0x6355, 0x6B69, 0x752B, 0x88DC, 0x8F14, 0x7A42, 0x52DF, /* 0x60 */ 0x5893, 0x6155, 0x620A, 0x66AE, 0x6BCD, 0x7C3F, 0x83E9, 0x5023, /* 0x60 */ 0x4FF8, 0x5305, 0x5446, 0x5831, 0x5949, 0x5B9D, 0x5CF0, 0x5CEF, /* 0x70 */ 0x5D29, 0x5E96, 0x62B1, 0x6367, 0x653E, 0x65B9, 0x670B /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_4B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6CD5, 0x6CE1, 0x70F9, 0x7832, 0x7E2B, 0x80DE, 0x82B3, /* 0x20 */ 0x840C, 0x84EC, 0x8702, 0x8912, 0x8A2A, 0x8C4A, 0x90A6, 0x92D2, /* 0x20 */ 0x98FD, 0x9CF3, 0x9D6C, 0x4E4F, 0x4EA1, 0x508D, 0x5256, 0x574A, /* 0x30 */ 0x59A8, 0x5E3D, 0x5FD8, 0x5FD9, 0x623F, 0x66B4, 0x671B, 0x67D0, /* 0x30 */ 0x68D2, 0x5192, 0x7D21, 0x80AA, 0x81A8, 0x8B00, 0x8C8C, 0x8CBF, /* 0x40 */ 0x927E, 0x9632, 0x5420, 0x982C, 0x5317, 0x50D5, 0x535C, 0x58A8, /* 0x40 */ 0x64B2, 0x6734, 0x7267, 0x7766, 0x7A46, 0x91E6, 0x52C3, 0x6CA1, /* 0x50 */ 0x6B86, 0x5800, 0x5E4C, 0x5954, 0x672C, 0x7FFB, 0x51E1, 0x76C6, /* 0x50 */ 0x6469, 0x78E8, 0x9B54, 0x9EBB, 0x57CB, 0x59B9, 0x6627, 0x679A, /* 0x60 */ 0x6BCE, 0x54E9, 0x69D9, 0x5E55, 0x819C, 0x6795, 0x9BAA, 0x67FE, /* 0x60 */ 0x9C52, 0x685D, 0x4EA6, 0x4FE3, 0x53C8, 0x62B9, 0x672B, 0x6CAB, /* 0x70 */ 0x8FC4, 0x4FAD, 0x7E6D, 0x9EBF, 0x4E07, 0x6162, 0x6E80 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_4C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6F2B, 0x8513, 0x5473, 0x672A, 0x9B45, 0x5DF3, 0x7B95, /* 0x20 */ 0x5CAC, 0x5BC6, 0x871C, 0x6E4A, 0x84D1, 0x7A14, 0x8108, 0x5999, /* 0x20 */ 0x7C8D, 0x6C11, 0x7720, 0x52D9, 0x5922, 0x7121, 0x725F, 0x77DB, /* 0x30 */ 0x9727, 0x9D61, 0x690B, 0x5A7F, 0x5A18, 0x51A5, 0x540D, 0x547D, /* 0x30 */ 0x660E, 0x76DF, 0x8FF7, 0x9298, 0x9CF4, 0x59EA, 0x725D, 0x6EC5, /* 0x40 */ 0x514D, 0x68C9, 0x7DBF, 0x7DEC, 0x9762, 0x9EBA, 0x6478, 0x6A21, /* 0x40 */ 0x8302, 0x5984, 0x5B5F, 0x6BDB, 0x731B, 0x76F2, 0x7DB2, 0x8017, /* 0x50 */ 0x8499, 0x5132, 0x6728, 0x9ED9, 0x76EE, 0x6762, 0x52FF, 0x9905, /* 0x50 */ 0x5C24, 0x623B, 0x7C7E, 0x8CB0, 0x554F, 0x60B6, 0x7D0B, 0x9580, /* 0x60 */ 0x5301, 0x4E5F, 0x51B6, 0x591C, 0x723A, 0x8036, 0x91CE, 0x5F25, /* 0x60 */ 0x77E2, 0x5384, 0x5F79, 0x7D04, 0x85AC, 0x8A33, 0x8E8D, 0x9756, /* 0x70 */ 0x67F3, 0x85AE, 0x9453, 0x6109, 0x6108, 0x6CB9, 0x7652 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_4D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8AED, 0x8F38, 0x552F, 0x4F51, 0x512A, 0x52C7, 0x53CB, /* 0x20 */ 0x5BA5, 0x5E7D, 0x60A0, 0x6182, 0x63D6, 0x6709, 0x67DA, 0x6E67, /* 0x20 */ 0x6D8C, 0x7336, 0x7337, 0x7531, 0x7950, 0x88D5, 0x8A98, 0x904A, /* 0x30 */ 0x9091, 0x90F5, 0x96C4, 0x878D, 0x5915, 0x4E88, 0x4F59, 0x4E0E, /* 0x30 */ 0x8A89, 0x8F3F, 0x9810, 0x50AD, 0x5E7C, 0x5996, 0x5BB9, 0x5EB8, /* 0x40 */ 0x63DA, 0x63FA, 0x64C1, 0x66DC, 0x694A, 0x69D8, 0x6D0B, 0x6EB6, /* 0x40 */ 0x7194, 0x7528, 0x7AAF, 0x7F8A, 0x8000, 0x8449, 0x84C9, 0x8981, /* 0x50 */ 0x8B21, 0x8E0A, 0x9065, 0x967D, 0x990A, 0x617E, 0x6291, 0x6B32, /* 0x50 */ 0x6C83, 0x6D74, 0x7FCC, 0x7FFC, 0x6DC0, 0x7F85, 0x87BA, 0x88F8, /* 0x60 */ 0x6765, 0x83B1, 0x983C, 0x96F7, 0x6D1B, 0x7D61, 0x843D, 0x916A, /* 0x60 */ 0x4E71, 0x5375, 0x5D50, 0x6B04, 0x6FEB, 0x85CD, 0x862D, 0x89A7, /* 0x70 */ 0x5229, 0x540F, 0x5C65, 0x674E, 0x68A8, 0x7406, 0x7483 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_4E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x75E2, 0x88CF, 0x88E1, 0x91CC, 0x96E2, 0x9678, 0x5F8B, /* 0x20 */ 0x7387, 0x7ACB, 0x844E, 0x63A0, 0x7565, 0x5289, 0x6D41, 0x6E9C, /* 0x20 */ 0x7409, 0x7559, 0x786B, 0x7C92, 0x9686, 0x7ADC, 0x9F8D, 0x4FB6, /* 0x30 */ 0x616E, 0x65C5, 0x865C, 0x4E86, 0x4EAE, 0x50DA, 0x4E21, 0x51CC, /* 0x30 */ 0x5BEE, 0x6599, 0x6881, 0x6DBC, 0x731F, 0x7642, 0x77AD, 0x7A1C, /* 0x40 */ 0x7CE7, 0x826F, 0x8AD2, 0x907C, 0x91CF, 0x9675, 0x9818, 0x529B, /* 0x40 */ 0x7DD1, 0x502B, 0x5398, 0x6797, 0x6DCB, 0x71D0, 0x7433, 0x81E8, /* 0x50 */ 0x8F2A, 0x96A3, 0x9C57, 0x9E9F, 0x7460, 0x5841, 0x6D99, 0x7D2F, /* 0x50 */ 0x985E, 0x4EE4, 0x4F36, 0x4F8B, 0x51B7, 0x52B1, 0x5DBA, 0x601C, /* 0x60 */ 0x73B2, 0x793C, 0x82D3, 0x9234, 0x96B7, 0x96F6, 0x970A, 0x9E97, /* 0x60 */ 0x9F62, 0x66A6, 0x6B74, 0x5217, 0x52A3, 0x70C8, 0x88C2, 0x5EC9, /* 0x70 */ 0x604B, 0x6190, 0x6F23, 0x7149, 0x7C3E, 0x7DF4, 0x806F /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_4F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x84EE, 0x9023, 0x932C, 0x5442, 0x9B6F, 0x6AD3, 0x7089, /* 0x20 */ 0x8CC2, 0x8DEF, 0x9732, 0x52B4, 0x5A41, 0x5ECA, 0x5F04, 0x6717, /* 0x20 */ 0x697C, 0x6994, 0x6D6A, 0x6F0F, 0x7262, 0x72FC, 0x7BED, 0x8001, /* 0x30 */ 0x807E, 0x874B, 0x90CE, 0x516D, 0x9E93, 0x7984, 0x808B, 0x9332, /* 0x30 */ 0x8AD6, 0x502D, 0x548C, 0x8A71, 0x6B6A, 0x8CC4, 0x8107, 0x60D1, /* 0x40 */ 0x67A0, 0x9DF2, 0x4E99, 0x4E98, 0x9C10, 0x8A6B, 0x85C1, 0x8568, /* 0x40 */ 0x6900, 0x6E7E, 0x7897, 0x8155 /* 0x50 */ /* 0x50 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_50[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5F0C, 0x4E10, 0x4E15, 0x4E2A, 0x4E31, 0x4E36, 0x4E3C, /* 0x20 */ 0x4E3F, 0x4E42, 0x4E56, 0x4E58, 0x4E82, 0x4E85, 0x8C6B, 0x4E8A, /* 0x20 */ 0x8212, 0x5F0D, 0x4E8E, 0x4E9E, 0x4E9F, 0x4EA0, 0x4EA2, 0x4EB0, /* 0x30 */ 0x4EB3, 0x4EB6, 0x4ECE, 0x4ECD, 0x4EC4, 0x4EC6, 0x4EC2, 0x4ED7, /* 0x30 */ 0x4EDE, 0x4EED, 0x4EDF, 0x4EF7, 0x4F09, 0x4F5A, 0x4F30, 0x4F5B, /* 0x40 */ 0x4F5D, 0x4F57, 0x4F47, 0x4F76, 0x4F88, 0x4F8F, 0x4F98, 0x4F7B, /* 0x40 */ 0x4F69, 0x4F70, 0x4F91, 0x4F6F, 0x4F86, 0x4F96, 0x5118, 0x4FD4, /* 0x50 */ 0x4FDF, 0x4FCE, 0x4FD8, 0x4FDB, 0x4FD1, 0x4FDA, 0x4FD0, 0x4FE4, /* 0x50 */ 0x4FE5, 0x501A, 0x5028, 0x5014, 0x502A, 0x5025, 0x5005, 0x4F1C, /* 0x60 */ 0x4FF6, 0x5021, 0x5029, 0x502C, 0x4FFE, 0x4FEF, 0x5011, 0x5006, /* 0x60 */ 0x5043, 0x5047, 0x6703, 0x5055, 0x5050, 0x5048, 0x505A, 0x5056, /* 0x70 */ 0x506C, 0x5078, 0x5080, 0x509A, 0x5085, 0x50B4, 0x50B2 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_51[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x50C9, 0x50CA, 0x50B3, 0x50C2, 0x50D6, 0x50DE, 0x50E5, /* 0x20 */ 0x50ED, 0x50E3, 0x50EE, 0x50F9, 0x50F5, 0x5109, 0x5101, 0x5102, /* 0x20 */ 0x5116, 0x5115, 0x5114, 0x511A, 0x5121, 0x513A, 0x5137, 0x513C, /* 0x30 */ 0x513B, 0x513F, 0x5140, 0x5152, 0x514C, 0x5154, 0x5162, 0x7AF8, /* 0x30 */ 0x5169, 0x516A, 0x516E, 0x5180, 0x5182, 0x56D8, 0x518C, 0x5189, /* 0x40 */ 0x518F, 0x5191, 0x5193, 0x5195, 0x5196, 0x51A4, 0x51A6, 0x51A2, /* 0x40 */ 0x51A9, 0x51AA, 0x51AB, 0x51B3, 0x51B1, 0x51B2, 0x51B0, 0x51B5, /* 0x50 */ 0x51BD, 0x51C5, 0x51C9, 0x51DB, 0x51E0, 0x8655, 0x51E9, 0x51ED, /* 0x50 */ 0x51F0, 0x51F5, 0x51FE, 0x5204, 0x520B, 0x5214, 0x520E, 0x5227, /* 0x60 */ 0x522A, 0x522E, 0x5233, 0x5239, 0x524F, 0x5244, 0x524B, 0x524C, /* 0x60 */ 0x525E, 0x5254, 0x526A, 0x5274, 0x5269, 0x5273, 0x527F, 0x527D, /* 0x70 */ 0x528D, 0x5294, 0x5292, 0x5271, 0x5288, 0x5291, 0x8FA8 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_52[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8FA7, 0x52AC, 0x52AD, 0x52BC, 0x52B5, 0x52C1, 0x52CD, /* 0x20 */ 0x52D7, 0x52DE, 0x52E3, 0x52E6, 0x98ED, 0x52E0, 0x52F3, 0x52F5, /* 0x20 */ 0x52F8, 0x52F9, 0x5306, 0x5308, 0x7538, 0x530D, 0x5310, 0x530F, /* 0x30 */ 0x5315, 0x531A, 0x5323, 0x532F, 0x5331, 0x5333, 0x5338, 0x5340, /* 0x30 */ 0x5346, 0x5345, 0x4E17, 0x5349, 0x534D, 0x51D6, 0x535E, 0x5369, /* 0x40 */ 0x536E, 0x5918, 0x537B, 0x5377, 0x5382, 0x5396, 0x53A0, 0x53A6, /* 0x40 */ 0x53A5, 0x53AE, 0x53B0, 0x53B6, 0x53C3, 0x7C12, 0x96D9, 0x53DF, /* 0x50 */ 0x66FC, 0x71EE, 0x53EE, 0x53E8, 0x53ED, 0x53FA, 0x5401, 0x543D, /* 0x50 */ 0x5440, 0x542C, 0x542D, 0x543C, 0x542E, 0x5436, 0x5429, 0x541D, /* 0x60 */ 0x544E, 0x548F, 0x5475, 0x548E, 0x545F, 0x5471, 0x5477, 0x5470, /* 0x60 */ 0x5492, 0x547B, 0x5480, 0x5476, 0x5484, 0x5490, 0x5486, 0x54C7, /* 0x70 */ 0x54A2, 0x54B8, 0x54A5, 0x54AC, 0x54C4, 0x54C8, 0x54A8 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_53[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x54AB, 0x54C2, 0x54A4, 0x54BE, 0x54BC, 0x54D8, 0x54E5, /* 0x20 */ 0x54E6, 0x550F, 0x5514, 0x54FD, 0x54EE, 0x54ED, 0x54FA, 0x54E2, /* 0x20 */ 0x5539, 0x5540, 0x5563, 0x554C, 0x552E, 0x555C, 0x5545, 0x5556, /* 0x30 */ 0x5557, 0x5538, 0x5533, 0x555D, 0x5599, 0x5580, 0x54AF, 0x558A, /* 0x30 */ 0x559F, 0x557B, 0x557E, 0x5598, 0x559E, 0x55AE, 0x557C, 0x5583, /* 0x40 */ 0x55A9, 0x5587, 0x55A8, 0x55DA, 0x55C5, 0x55DF, 0x55C4, 0x55DC, /* 0x40 */ 0x55E4, 0x55D4, 0x5614, 0x55F7, 0x5616, 0x55FE, 0x55FD, 0x561B, /* 0x50 */ 0x55F9, 0x564E, 0x5650, 0x71DF, 0x5634, 0x5636, 0x5632, 0x5638, /* 0x50 */ 0x566B, 0x5664, 0x562F, 0x566C, 0x566A, 0x5686, 0x5680, 0x568A, /* 0x60 */ 0x56A0, 0x5694, 0x568F, 0x56A5, 0x56AE, 0x56B6, 0x56B4, 0x56C2, /* 0x60 */ 0x56BC, 0x56C1, 0x56C3, 0x56C0, 0x56C8, 0x56CE, 0x56D1, 0x56D3, /* 0x70 */ 0x56D7, 0x56EE, 0x56F9, 0x5700, 0x56FF, 0x5704, 0x5709 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_54[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5708, 0x570B, 0x570D, 0x5713, 0x5718, 0x5716, 0x55C7, /* 0x20 */ 0x571C, 0x5726, 0x5737, 0x5738, 0x574E, 0x573B, 0x5740, 0x574F, /* 0x20 */ 0x5769, 0x57C0, 0x5788, 0x5761, 0x577F, 0x5789, 0x5793, 0x57A0, /* 0x30 */ 0x57B3, 0x57A4, 0x57AA, 0x57B0, 0x57C3, 0x57C6, 0x57D4, 0x57D2, /* 0x30 */ 0x57D3, 0x580A, 0x57D6, 0x57E3, 0x580B, 0x5819, 0x581D, 0x5872, /* 0x40 */ 0x5821, 0x5862, 0x584B, 0x5870, 0x6BC0, 0x5852, 0x583D, 0x5879, /* 0x40 */ 0x5885, 0x58B9, 0x589F, 0x58AB, 0x58BA, 0x58DE, 0x58BB, 0x58B8, /* 0x50 */ 0x58AE, 0x58C5, 0x58D3, 0x58D1, 0x58D7, 0x58D9, 0x58D8, 0x58E5, /* 0x50 */ 0x58DC, 0x58E4, 0x58DF, 0x58EF, 0x58FA, 0x58F9, 0x58FB, 0x58FC, /* 0x60 */ 0x58FD, 0x5902, 0x590A, 0x5910, 0x591B, 0x68A6, 0x5925, 0x592C, /* 0x60 */ 0x592D, 0x5932, 0x5938, 0x593E, 0x7AD2, 0x5955, 0x5950, 0x594E, /* 0x70 */ 0x595A, 0x5958, 0x5962, 0x5960, 0x5967, 0x596C, 0x5969 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_55[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5978, 0x5981, 0x599D, 0x4F5E, 0x4FAB, 0x59A3, 0x59B2, /* 0x20 */ 0x59C6, 0x59E8, 0x59DC, 0x598D, 0x59D9, 0x59DA, 0x5A25, 0x5A1F, /* 0x20 */ 0x5A11, 0x5A1C, 0x5A09, 0x5A1A, 0x5A40, 0x5A6C, 0x5A49, 0x5A35, /* 0x30 */ 0x5A36, 0x5A62, 0x5A6A, 0x5A9A, 0x5ABC, 0x5ABE, 0x5ACB, 0x5AC2, /* 0x30 */ 0x5ABD, 0x5AE3, 0x5AD7, 0x5AE6, 0x5AE9, 0x5AD6, 0x5AFA, 0x5AFB, /* 0x40 */ 0x5B0C, 0x5B0B, 0x5B16, 0x5B32, 0x5AD0, 0x5B2A, 0x5B36, 0x5B3E, /* 0x40 */ 0x5B43, 0x5B45, 0x5B40, 0x5B51, 0x5B55, 0x5B5A, 0x5B5B, 0x5B65, /* 0x50 */ 0x5B69, 0x5B70, 0x5B73, 0x5B75, 0x5B78, 0x6588, 0x5B7A, 0x5B80, /* 0x50 */ 0x5B83, 0x5BA6, 0x5BB8, 0x5BC3, 0x5BC7, 0x5BC9, 0x5BD4, 0x5BD0, /* 0x60 */ 0x5BE4, 0x5BE6, 0x5BE2, 0x5BDE, 0x5BE5, 0x5BEB, 0x5BF0, 0x5BF6, /* 0x60 */ 0x5BF3, 0x5C05, 0x5C07, 0x5C08, 0x5C0D, 0x5C13, 0x5C20, 0x5C22, /* 0x70 */ 0x5C28, 0x5C38, 0x5C39, 0x5C41, 0x5C46, 0x5C4E, 0x5C53 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_56[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5C50, 0x5C4F, 0x5B71, 0x5C6C, 0x5C6E, 0x4E62, 0x5C76, /* 0x20 */ 0x5C79, 0x5C8C, 0x5C91, 0x5C94, 0x599B, 0x5CAB, 0x5CBB, 0x5CB6, /* 0x20 */ 0x5CBC, 0x5CB7, 0x5CC5, 0x5CBE, 0x5CC7, 0x5CD9, 0x5CE9, 0x5CFD, /* 0x30 */ 0x5CFA, 0x5CED, 0x5D8C, 0x5CEA, 0x5D0B, 0x5D15, 0x5D17, 0x5D5C, /* 0x30 */ 0x5D1F, 0x5D1B, 0x5D11, 0x5D14, 0x5D22, 0x5D1A, 0x5D19, 0x5D18, /* 0x40 */ 0x5D4C, 0x5D52, 0x5D4E, 0x5D4B, 0x5D6C, 0x5D73, 0x5D76, 0x5D87, /* 0x40 */ 0x5D84, 0x5D82, 0x5DA2, 0x5D9D, 0x5DAC, 0x5DAE, 0x5DBD, 0x5D90, /* 0x50 */ 0x5DB7, 0x5DBC, 0x5DC9, 0x5DCD, 0x5DD3, 0x5DD2, 0x5DD6, 0x5DDB, /* 0x50 */ 0x5DEB, 0x5DF2, 0x5DF5, 0x5E0B, 0x5E1A, 0x5E19, 0x5E11, 0x5E1B, /* 0x60 */ 0x5E36, 0x5E37, 0x5E44, 0x5E43, 0x5E40, 0x5E4E, 0x5E57, 0x5E54, /* 0x60 */ 0x5E5F, 0x5E62, 0x5E64, 0x5E47, 0x5E75, 0x5E76, 0x5E7A, 0x9EBC, /* 0x70 */ 0x5E7F, 0x5EA0, 0x5EC1, 0x5EC2, 0x5EC8, 0x5ED0, 0x5ECF /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_57[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5ED6, 0x5EE3, 0x5EDD, 0x5EDA, 0x5EDB, 0x5EE2, 0x5EE1, /* 0x20 */ 0x5EE8, 0x5EE9, 0x5EEC, 0x5EF1, 0x5EF3, 0x5EF0, 0x5EF4, 0x5EF8, /* 0x20 */ 0x5EFE, 0x5F03, 0x5F09, 0x5F5D, 0x5F5C, 0x5F0B, 0x5F11, 0x5F16, /* 0x30 */ 0x5F29, 0x5F2D, 0x5F38, 0x5F41, 0x5F48, 0x5F4C, 0x5F4E, 0x5F2F, /* 0x30 */ 0x5F51, 0x5F56, 0x5F57, 0x5F59, 0x5F61, 0x5F6D, 0x5F73, 0x5F77, /* 0x40 */ 0x5F83, 0x5F82, 0x5F7F, 0x5F8A, 0x5F88, 0x5F91, 0x5F87, 0x5F9E, /* 0x40 */ 0x5F99, 0x5F98, 0x5FA0, 0x5FA8, 0x5FAD, 0x5FBC, 0x5FD6, 0x5FFB, /* 0x50 */ 0x5FE4, 0x5FF8, 0x5FF1, 0x5FDD, 0x60B3, 0x5FFF, 0x6021, 0x6060, /* 0x50 */ 0x6019, 0x6010, 0x6029, 0x600E, 0x6031, 0x601B, 0x6015, 0x602B, /* 0x60 */ 0x6026, 0x600F, 0x603A, 0x605A, 0x6041, 0x606A, 0x6077, 0x605F, /* 0x60 */ 0x604A, 0x6046, 0x604D, 0x6063, 0x6043, 0x6064, 0x6042, 0x606C, /* 0x70 */ 0x606B, 0x6059, 0x6081, 0x608D, 0x60E7, 0x6083, 0x609A /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_58[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6084, 0x609B, 0x6096, 0x6097, 0x6092, 0x60A7, 0x608B, /* 0x20 */ 0x60E1, 0x60B8, 0x60E0, 0x60D3, 0x60B4, 0x5FF0, 0x60BD, 0x60C6, /* 0x20 */ 0x60B5, 0x60D8, 0x614D, 0x6115, 0x6106, 0x60F6, 0x60F7, 0x6100, /* 0x30 */ 0x60F4, 0x60FA, 0x6103, 0x6121, 0x60FB, 0x60F1, 0x610D, 0x610E, /* 0x30 */ 0x6147, 0x613E, 0x6128, 0x6127, 0x614A, 0x613F, 0x613C, 0x612C, /* 0x40 */ 0x6134, 0x613D, 0x6142, 0x6144, 0x6173, 0x6177, 0x6158, 0x6159, /* 0x40 */ 0x615A, 0x616B, 0x6174, 0x616F, 0x6165, 0x6171, 0x615F, 0x615D, /* 0x50 */ 0x6153, 0x6175, 0x6199, 0x6196, 0x6187, 0x61AC, 0x6194, 0x619A, /* 0x50 */ 0x618A, 0x6191, 0x61AB, 0x61AE, 0x61CC, 0x61CA, 0x61C9, 0x61F7, /* 0x60 */ 0x61C8, 0x61C3, 0x61C6, 0x61BA, 0x61CB, 0x7F79, 0x61CD, 0x61E6, /* 0x60 */ 0x61E3, 0x61F6, 0x61FA, 0x61F4, 0x61FF, 0x61FD, 0x61FC, 0x61FE, /* 0x70 */ 0x6200, 0x6208, 0x6209, 0x620D, 0x620C, 0x6214, 0x621B /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_59[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x621E, 0x6221, 0x622A, 0x622E, 0x6230, 0x6232, 0x6233, /* 0x20 */ 0x6241, 0x624E, 0x625E, 0x6263, 0x625B, 0x6260, 0x6268, 0x627C, /* 0x20 */ 0x6282, 0x6289, 0x627E, 0x6292, 0x6293, 0x6296, 0x62D4, 0x6283, /* 0x30 */ 0x6294, 0x62D7, 0x62D1, 0x62BB, 0x62CF, 0x62FF, 0x62C6, 0x64D4, /* 0x30 */ 0x62C8, 0x62DC, 0x62CC, 0x62CA, 0x62C2, 0x62C7, 0x629B, 0x62C9, /* 0x40 */ 0x630C, 0x62EE, 0x62F1, 0x6327, 0x6302, 0x6308, 0x62EF, 0x62F5, /* 0x40 */ 0x6350, 0x633E, 0x634D, 0x641C, 0x634F, 0x6396, 0x638E, 0x6380, /* 0x50 */ 0x63AB, 0x6376, 0x63A3, 0x638F, 0x6389, 0x639F, 0x63B5, 0x636B, /* 0x50 */ 0x6369, 0x63BE, 0x63E9, 0x63C0, 0x63C6, 0x63E3, 0x63C9, 0x63D2, /* 0x60 */ 0x63F6, 0x63C4, 0x6416, 0x6434, 0x6406, 0x6413, 0x6426, 0x6436, /* 0x60 */ 0x651D, 0x6417, 0x6428, 0x640F, 0x6467, 0x646F, 0x6476, 0x644E, /* 0x70 */ 0x652A, 0x6495, 0x6493, 0x64A5, 0x64A9, 0x6488, 0x64BC /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_5A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x64DA, 0x64D2, 0x64C5, 0x64C7, 0x64BB, 0x64D8, 0x64C2, /* 0x20 */ 0x64F1, 0x64E7, 0x8209, 0x64E0, 0x64E1, 0x62AC, 0x64E3, 0x64EF, /* 0x20 */ 0x652C, 0x64F6, 0x64F4, 0x64F2, 0x64FA, 0x6500, 0x64FD, 0x6518, /* 0x30 */ 0x651C, 0x6505, 0x6524, 0x6523, 0x652B, 0x6534, 0x6535, 0x6537, /* 0x30 */ 0x6536, 0x6538, 0x754B, 0x6548, 0x6556, 0x6555, 0x654D, 0x6558, /* 0x40 */ 0x655E, 0x655D, 0x6572, 0x6578, 0x6582, 0x6583, 0x8B8A, 0x659B, /* 0x40 */ 0x659F, 0x65AB, 0x65B7, 0x65C3, 0x65C6, 0x65C1, 0x65C4, 0x65CC, /* 0x50 */ 0x65D2, 0x65DB, 0x65D9, 0x65E0, 0x65E1, 0x65F1, 0x6772, 0x660A, /* 0x50 */ 0x6603, 0x65FB, 0x6773, 0x6635, 0x6636, 0x6634, 0x661C, 0x664F, /* 0x60 */ 0x6644, 0x6649, 0x6641, 0x665E, 0x665D, 0x6664, 0x6667, 0x6668, /* 0x60 */ 0x665F, 0x6662, 0x6670, 0x6683, 0x6688, 0x668E, 0x6689, 0x6684, /* 0x70 */ 0x6698, 0x669D, 0x66C1, 0x66B9, 0x66C9, 0x66BE, 0x66BC /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_5B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x66C4, 0x66B8, 0x66D6, 0x66DA, 0x66E0, 0x663F, 0x66E6, /* 0x20 */ 0x66E9, 0x66F0, 0x66F5, 0x66F7, 0x670F, 0x6716, 0x671E, 0x6726, /* 0x20 */ 0x6727, 0x9738, 0x672E, 0x673F, 0x6736, 0x6741, 0x6738, 0x6737, /* 0x30 */ 0x6746, 0x675E, 0x6760, 0x6759, 0x6763, 0x6764, 0x6789, 0x6770, /* 0x30 */ 0x67A9, 0x677C, 0x676A, 0x678C, 0x678B, 0x67A6, 0x67A1, 0x6785, /* 0x40 */ 0x67B7, 0x67EF, 0x67B4, 0x67EC, 0x67B3, 0x67E9, 0x67B8, 0x67E4, /* 0x40 */ 0x67DE, 0x67DD, 0x67E2, 0x67EE, 0x67B9, 0x67CE, 0x67C6, 0x67E7, /* 0x50 */ 0x6A9C, 0x681E, 0x6846, 0x6829, 0x6840, 0x684D, 0x6832, 0x684E, /* 0x50 */ 0x68B3, 0x682B, 0x6859, 0x6863, 0x6877, 0x687F, 0x689F, 0x688F, /* 0x60 */ 0x68AD, 0x6894, 0x689D, 0x689B, 0x6883, 0x6AAE, 0x68B9, 0x6874, /* 0x60 */ 0x68B5, 0x68A0, 0x68BA, 0x690F, 0x688D, 0x687E, 0x6901, 0x68CA, /* 0x70 */ 0x6908, 0x68D8, 0x6922, 0x6926, 0x68E1, 0x690C, 0x68CD /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_5C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x68D4, 0x68E7, 0x68D5, 0x6936, 0x6912, 0x6904, 0x68D7, /* 0x20 */ 0x68E3, 0x6925, 0x68F9, 0x68E0, 0x68EF, 0x6928, 0x692A, 0x691A, /* 0x20 */ 0x6923, 0x6921, 0x68C6, 0x6979, 0x6977, 0x695C, 0x6978, 0x696B, /* 0x30 */ 0x6954, 0x697E, 0x696E, 0x6939, 0x6974, 0x693D, 0x6959, 0x6930, /* 0x30 */ 0x6961, 0x695E, 0x695D, 0x6981, 0x696A, 0x69B2, 0x69AE, 0x69D0, /* 0x40 */ 0x69BF, 0x69C1, 0x69D3, 0x69BE, 0x69CE, 0x5BE8, 0x69CA, 0x69DD, /* 0x40 */ 0x69BB, 0x69C3, 0x69A7, 0x6A2E, 0x6991, 0x69A0, 0x699C, 0x6995, /* 0x50 */ 0x69B4, 0x69DE, 0x69E8, 0x6A02, 0x6A1B, 0x69FF, 0x6B0A, 0x69F9, /* 0x50 */ 0x69F2, 0x69E7, 0x6A05, 0x69B1, 0x6A1E, 0x69ED, 0x6A14, 0x69EB, /* 0x60 */ 0x6A0A, 0x6A12, 0x6AC1, 0x6A23, 0x6A13, 0x6A44, 0x6A0C, 0x6A72, /* 0x60 */ 0x6A36, 0x6A78, 0x6A47, 0x6A62, 0x6A59, 0x6A66, 0x6A48, 0x6A38, /* 0x70 */ 0x6A22, 0x6A90, 0x6A8D, 0x6AA0, 0x6A84, 0x6AA2, 0x6AA3 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_5D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6A97, 0x8617, 0x6ABB, 0x6AC3, 0x6AC2, 0x6AB8, 0x6AB3, /* 0x20 */ 0x6AAC, 0x6ADE, 0x6AD1, 0x6ADF, 0x6AAA, 0x6ADA, 0x6AEA, 0x6AFB, /* 0x20 */ 0x6B05, 0x8616, 0x6AFA, 0x6B12, 0x6B16, 0x9B31, 0x6B1F, 0x6B38, /* 0x30 */ 0x6B37, 0x76DC, 0x6B39, 0x98EE, 0x6B47, 0x6B43, 0x6B49, 0x6B50, /* 0x30 */ 0x6B59, 0x6B54, 0x6B5B, 0x6B5F, 0x6B61, 0x6B78, 0x6B79, 0x6B7F, /* 0x40 */ 0x6B80, 0x6B84, 0x6B83, 0x6B8D, 0x6B98, 0x6B95, 0x6B9E, 0x6BA4, /* 0x40 */ 0x6BAA, 0x6BAB, 0x6BAF, 0x6BB2, 0x6BB1, 0x6BB3, 0x6BB7, 0x6BBC, /* 0x50 */ 0x6BC6, 0x6BCB, 0x6BD3, 0x6BDF, 0x6BEC, 0x6BEB, 0x6BF3, 0x6BEF, /* 0x50 */ 0x9EBE, 0x6C08, 0x6C13, 0x6C14, 0x6C1B, 0x6C24, 0x6C23, 0x6C5E, /* 0x60 */ 0x6C55, 0x6C62, 0x6C6A, 0x6C82, 0x6C8D, 0x6C9A, 0x6C81, 0x6C9B, /* 0x60 */ 0x6C7E, 0x6C68, 0x6C73, 0x6C92, 0x6C90, 0x6CC4, 0x6CF1, 0x6CD3, /* 0x70 */ 0x6CBD, 0x6CD7, 0x6CC5, 0x6CDD, 0x6CAE, 0x6CB1, 0x6CBE /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_5E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6CBA, 0x6CDB, 0x6CEF, 0x6CD9, 0x6CEA, 0x6D1F, 0x884D, /* 0x20 */ 0x6D36, 0x6D2B, 0x6D3D, 0x6D38, 0x6D19, 0x6D35, 0x6D33, 0x6D12, /* 0x20 */ 0x6D0C, 0x6D63, 0x6D93, 0x6D64, 0x6D5A, 0x6D79, 0x6D59, 0x6D8E, /* 0x30 */ 0x6D95, 0x6FE4, 0x6D85, 0x6DF9, 0x6E15, 0x6E0A, 0x6DB5, 0x6DC7, /* 0x30 */ 0x6DE6, 0x6DB8, 0x6DC6, 0x6DEC, 0x6DDE, 0x6DCC, 0x6DE8, 0x6DD2, /* 0x40 */ 0x6DC5, 0x6DFA, 0x6DD9, 0x6DE4, 0x6DD5, 0x6DEA, 0x6DEE, 0x6E2D, /* 0x40 */ 0x6E6E, 0x6E2E, 0x6E19, 0x6E72, 0x6E5F, 0x6E3E, 0x6E23, 0x6E6B, /* 0x50 */ 0x6E2B, 0x6E76, 0x6E4D, 0x6E1F, 0x6E43, 0x6E3A, 0x6E4E, 0x6E24, /* 0x50 */ 0x6EFF, 0x6E1D, 0x6E38, 0x6E82, 0x6EAA, 0x6E98, 0x6EC9, 0x6EB7, /* 0x60 */ 0x6ED3, 0x6EBD, 0x6EAF, 0x6EC4, 0x6EB2, 0x6ED4, 0x6ED5, 0x6E8F, /* 0x60 */ 0x6EA5, 0x6EC2, 0x6E9F, 0x6F41, 0x6F11, 0x704C, 0x6EEC, 0x6EF8, /* 0x70 */ 0x6EFE, 0x6F3F, 0x6EF2, 0x6F31, 0x6EEF, 0x6F32, 0x6ECC /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_5F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6F3E, 0x6F13, 0x6EF7, 0x6F86, 0x6F7A, 0x6F78, 0x6F81, /* 0x20 */ 0x6F80, 0x6F6F, 0x6F5B, 0x6FF3, 0x6F6D, 0x6F82, 0x6F7C, 0x6F58, /* 0x20 */ 0x6F8E, 0x6F91, 0x6FC2, 0x6F66, 0x6FB3, 0x6FA3, 0x6FA1, 0x6FA4, /* 0x30 */ 0x6FB9, 0x6FC6, 0x6FAA, 0x6FDF, 0x6FD5, 0x6FEC, 0x6FD4, 0x6FD8, /* 0x30 */ 0x6FF1, 0x6FEE, 0x6FDB, 0x7009, 0x700B, 0x6FFA, 0x7011, 0x7001, /* 0x40 */ 0x700F, 0x6FFE, 0x701B, 0x701A, 0x6F74, 0x701D, 0x7018, 0x701F, /* 0x40 */ 0x7030, 0x703E, 0x7032, 0x7051, 0x7063, 0x7099, 0x7092, 0x70AF, /* 0x50 */ 0x70F1, 0x70AC, 0x70B8, 0x70B3, 0x70AE, 0x70DF, 0x70CB, 0x70DD, /* 0x50 */ 0x70D9, 0x7109, 0x70FD, 0x711C, 0x7119, 0x7165, 0x7155, 0x7188, /* 0x60 */ 0x7166, 0x7162, 0x714C, 0x7156, 0x716C, 0x718F, 0x71FB, 0x7184, /* 0x60 */ 0x7195, 0x71A8, 0x71AC, 0x71D7, 0x71B9, 0x71BE, 0x71D2, 0x71C9, /* 0x70 */ 0x71D4, 0x71CE, 0x71E0, 0x71EC, 0x71E7, 0x71F5, 0x71FC /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_60[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x71F9, 0x71FF, 0x720D, 0x7210, 0x721B, 0x7228, 0x722D, /* 0x20 */ 0x722C, 0x7230, 0x7232, 0x723B, 0x723C, 0x723F, 0x7240, 0x7246, /* 0x20 */ 0x724B, 0x7258, 0x7274, 0x727E, 0x7282, 0x7281, 0x7287, 0x7292, /* 0x30 */ 0x7296, 0x72A2, 0x72A7, 0x72B9, 0x72B2, 0x72C3, 0x72C6, 0x72C4, /* 0x30 */ 0x72CE, 0x72D2, 0x72E2, 0x72E0, 0x72E1, 0x72F9, 0x72F7, 0x500F, /* 0x40 */ 0x7317, 0x730A, 0x731C, 0x7316, 0x731D, 0x7334, 0x732F, 0x7329, /* 0x40 */ 0x7325, 0x733E, 0x734E, 0x734F, 0x9ED8, 0x7357, 0x736A, 0x7368, /* 0x50 */ 0x7370, 0x7378, 0x7375, 0x737B, 0x737A, 0x73C8, 0x73B3, 0x73CE, /* 0x50 */ 0x73BB, 0x73C0, 0x73E5, 0x73EE, 0x73DE, 0x74A2, 0x7405, 0x746F, /* 0x60 */ 0x7425, 0x73F8, 0x7432, 0x743A, 0x7455, 0x743F, 0x745F, 0x7459, /* 0x60 */ 0x7441, 0x745C, 0x7469, 0x7470, 0x7463, 0x746A, 0x7476, 0x747E, /* 0x70 */ 0x748B, 0x749E, 0x74A7, 0x74CA, 0x74CF, 0x74D4, 0x73F1 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_61[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x74E0, 0x74E3, 0x74E7, 0x74E9, 0x74EE, 0x74F2, 0x74F0, /* 0x20 */ 0x74F1, 0x74F8, 0x74F7, 0x7504, 0x7503, 0x7505, 0x750C, 0x750E, /* 0x20 */ 0x750D, 0x7515, 0x7513, 0x751E, 0x7526, 0x752C, 0x753C, 0x7544, /* 0x30 */ 0x754D, 0x754A, 0x7549, 0x755B, 0x7546, 0x755A, 0x7569, 0x7564, /* 0x30 */ 0x7567, 0x756B, 0x756D, 0x7578, 0x7576, 0x7586, 0x7587, 0x7574, /* 0x40 */ 0x758A, 0x7589, 0x7582, 0x7594, 0x759A, 0x759D, 0x75A5, 0x75A3, /* 0x40 */ 0x75C2, 0x75B3, 0x75C3, 0x75B5, 0x75BD, 0x75B8, 0x75BC, 0x75B1, /* 0x50 */ 0x75CD, 0x75CA, 0x75D2, 0x75D9, 0x75E3, 0x75DE, 0x75FE, 0x75FF, /* 0x50 */ 0x75FC, 0x7601, 0x75F0, 0x75FA, 0x75F2, 0x75F3, 0x760B, 0x760D, /* 0x60 */ 0x7609, 0x761F, 0x7627, 0x7620, 0x7621, 0x7622, 0x7624, 0x7634, /* 0x60 */ 0x7630, 0x763B, 0x7647, 0x7648, 0x7646, 0x765C, 0x7658, 0x7661, /* 0x70 */ 0x7662, 0x7668, 0x7669, 0x766A, 0x7667, 0x766C, 0x7670 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_62[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7672, 0x7676, 0x7678, 0x767C, 0x7680, 0x7683, 0x7688, /* 0x20 */ 0x768B, 0x768E, 0x7696, 0x7693, 0x7699, 0x769A, 0x76B0, 0x76B4, /* 0x20 */ 0x76B8, 0x76B9, 0x76BA, 0x76C2, 0x76CD, 0x76D6, 0x76D2, 0x76DE, /* 0x30 */ 0x76E1, 0x76E5, 0x76E7, 0x76EA, 0x862F, 0x76FB, 0x7708, 0x7707, /* 0x30 */ 0x7704, 0x7729, 0x7724, 0x771E, 0x7725, 0x7726, 0x771B, 0x7737, /* 0x40 */ 0x7738, 0x7747, 0x775A, 0x7768, 0x776B, 0x775B, 0x7765, 0x777F, /* 0x40 */ 0x777E, 0x7779, 0x778E, 0x778B, 0x7791, 0x77A0, 0x779E, 0x77B0, /* 0x50 */ 0x77B6, 0x77B9, 0x77BF, 0x77BC, 0x77BD, 0x77BB, 0x77C7, 0x77CD, /* 0x50 */ 0x77D7, 0x77DA, 0x77DC, 0x77E3, 0x77EE, 0x77FC, 0x780C, 0x7812, /* 0x60 */ 0x7926, 0x7820, 0x792A, 0x7845, 0x788E, 0x7874, 0x7886, 0x787C, /* 0x60 */ 0x789A, 0x788C, 0x78A3, 0x78B5, 0x78AA, 0x78AF, 0x78D1, 0x78C6, /* 0x70 */ 0x78CB, 0x78D4, 0x78BE, 0x78BC, 0x78C5, 0x78CA, 0x78EC /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_63[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x78E7, 0x78DA, 0x78FD, 0x78F4, 0x7907, 0x7912, 0x7911, /* 0x20 */ 0x7919, 0x792C, 0x792B, 0x7940, 0x7960, 0x7957, 0x795F, 0x795A, /* 0x20 */ 0x7955, 0x7953, 0x797A, 0x797F, 0x798A, 0x799D, 0x79A7, 0x9F4B, /* 0x30 */ 0x79AA, 0x79AE, 0x79B3, 0x79B9, 0x79BA, 0x79C9, 0x79D5, 0x79E7, /* 0x30 */ 0x79EC, 0x79E1, 0x79E3, 0x7A08, 0x7A0D, 0x7A18, 0x7A19, 0x7A20, /* 0x40 */ 0x7A1F, 0x7980, 0x7A31, 0x7A3B, 0x7A3E, 0x7A37, 0x7A43, 0x7A57, /* 0x40 */ 0x7A49, 0x7A61, 0x7A62, 0x7A69, 0x9F9D, 0x7A70, 0x7A79, 0x7A7D, /* 0x50 */ 0x7A88, 0x7A97, 0x7A95, 0x7A98, 0x7A96, 0x7AA9, 0x7AC8, 0x7AB0, /* 0x50 */ 0x7AB6, 0x7AC5, 0x7AC4, 0x7ABF, 0x9083, 0x7AC7, 0x7ACA, 0x7ACD, /* 0x60 */ 0x7ACF, 0x7AD5, 0x7AD3, 0x7AD9, 0x7ADA, 0x7ADD, 0x7AE1, 0x7AE2, /* 0x60 */ 0x7AE6, 0x7AED, 0x7AF0, 0x7B02, 0x7B0F, 0x7B0A, 0x7B06, 0x7B33, /* 0x70 */ 0x7B18, 0x7B19, 0x7B1E, 0x7B35, 0x7B28, 0x7B36, 0x7B50 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_64[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7B7A, 0x7B04, 0x7B4D, 0x7B0B, 0x7B4C, 0x7B45, 0x7B75, /* 0x20 */ 0x7B65, 0x7B74, 0x7B67, 0x7B70, 0x7B71, 0x7B6C, 0x7B6E, 0x7B9D, /* 0x20 */ 0x7B98, 0x7B9F, 0x7B8D, 0x7B9C, 0x7B9A, 0x7B8B, 0x7B92, 0x7B8F, /* 0x30 */ 0x7B5D, 0x7B99, 0x7BCB, 0x7BC1, 0x7BCC, 0x7BCF, 0x7BB4, 0x7BC6, /* 0x30 */ 0x7BDD, 0x7BE9, 0x7C11, 0x7C14, 0x7BE6, 0x7BE5, 0x7C60, 0x7C00, /* 0x40 */ 0x7C07, 0x7C13, 0x7BF3, 0x7BF7, 0x7C17, 0x7C0D, 0x7BF6, 0x7C23, /* 0x40 */ 0x7C27, 0x7C2A, 0x7C1F, 0x7C37, 0x7C2B, 0x7C3D, 0x7C4C, 0x7C43, /* 0x50 */ 0x7C54, 0x7C4F, 0x7C40, 0x7C50, 0x7C58, 0x7C5F, 0x7C64, 0x7C56, /* 0x50 */ 0x7C65, 0x7C6C, 0x7C75, 0x7C83, 0x7C90, 0x7CA4, 0x7CAD, 0x7CA2, /* 0x60 */ 0x7CAB, 0x7CA1, 0x7CA8, 0x7CB3, 0x7CB2, 0x7CB1, 0x7CAE, 0x7CB9, /* 0x60 */ 0x7CBD, 0x7CC0, 0x7CC5, 0x7CC2, 0x7CD8, 0x7CD2, 0x7CDC, 0x7CE2, /* 0x70 */ 0x9B3B, 0x7CEF, 0x7CF2, 0x7CF4, 0x7CF6, 0x7CFA, 0x7D06 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_65[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7D02, 0x7D1C, 0x7D15, 0x7D0A, 0x7D45, 0x7D4B, 0x7D2E, /* 0x20 */ 0x7D32, 0x7D3F, 0x7D35, 0x7D46, 0x7D73, 0x7D56, 0x7D4E, 0x7D72, /* 0x20 */ 0x7D68, 0x7D6E, 0x7D4F, 0x7D63, 0x7D93, 0x7D89, 0x7D5B, 0x7D8F, /* 0x30 */ 0x7D7D, 0x7D9B, 0x7DBA, 0x7DAE, 0x7DA3, 0x7DB5, 0x7DC7, 0x7DBD, /* 0x30 */ 0x7DAB, 0x7E3D, 0x7DA2, 0x7DAF, 0x7DDC, 0x7DB8, 0x7D9F, 0x7DB0, /* 0x40 */ 0x7DD8, 0x7DDD, 0x7DE4, 0x7DDE, 0x7DFB, 0x7DF2, 0x7DE1, 0x7E05, /* 0x40 */ 0x7E0A, 0x7E23, 0x7E21, 0x7E12, 0x7E31, 0x7E1F, 0x7E09, 0x7E0B, /* 0x50 */ 0x7E22, 0x7E46, 0x7E66, 0x7E3B, 0x7E35, 0x7E39, 0x7E43, 0x7E37, /* 0x50 */ 0x7E32, 0x7E3A, 0x7E67, 0x7E5D, 0x7E56, 0x7E5E, 0x7E59, 0x7E5A, /* 0x60 */ 0x7E79, 0x7E6A, 0x7E69, 0x7E7C, 0x7E7B, 0x7E83, 0x7DD5, 0x7E7D, /* 0x60 */ 0x8FAE, 0x7E7F, 0x7E88, 0x7E89, 0x7E8C, 0x7E92, 0x7E90, 0x7E93, /* 0x70 */ 0x7E94, 0x7E96, 0x7E8E, 0x7E9B, 0x7E9C, 0x7F38, 0x7F3A /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_66[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7F45, 0x7F4C, 0x7F4D, 0x7F4E, 0x7F50, 0x7F51, 0x7F55, /* 0x20 */ 0x7F54, 0x7F58, 0x7F5F, 0x7F60, 0x7F68, 0x7F69, 0x7F67, 0x7F78, /* 0x20 */ 0x7F82, 0x7F86, 0x7F83, 0x7F88, 0x7F87, 0x7F8C, 0x7F94, 0x7F9E, /* 0x30 */ 0x7F9D, 0x7F9A, 0x7FA3, 0x7FAF, 0x7FB2, 0x7FB9, 0x7FAE, 0x7FB6, /* 0x30 */ 0x7FB8, 0x8B71, 0x7FC5, 0x7FC6, 0x7FCA, 0x7FD5, 0x7FD4, 0x7FE1, /* 0x40 */ 0x7FE6, 0x7FE9, 0x7FF3, 0x7FF9, 0x98DC, 0x8006, 0x8004, 0x800B, /* 0x40 */ 0x8012, 0x8018, 0x8019, 0x801C, 0x8021, 0x8028, 0x803F, 0x803B, /* 0x50 */ 0x804A, 0x8046, 0x8052, 0x8058, 0x805A, 0x805F, 0x8062, 0x8068, /* 0x50 */ 0x8073, 0x8072, 0x8070, 0x8076, 0x8079, 0x807D, 0x807F, 0x8084, /* 0x60 */ 0x8086, 0x8085, 0x809B, 0x8093, 0x809A, 0x80AD, 0x5190, 0x80AC, /* 0x60 */ 0x80DB, 0x80E5, 0x80D9, 0x80DD, 0x80C4, 0x80DA, 0x80D6, 0x8109, /* 0x70 */ 0x80EF, 0x80F1, 0x811B, 0x8129, 0x8123, 0x812F, 0x814B /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_67[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x968B, 0x8146, 0x813E, 0x8153, 0x8151, 0x80FC, 0x8171, /* 0x20 */ 0x816E, 0x8165, 0x8166, 0x8174, 0x8183, 0x8188, 0x818A, 0x8180, /* 0x20 */ 0x8182, 0x81A0, 0x8195, 0x81A4, 0x81A3, 0x815F, 0x8193, 0x81A9, /* 0x30 */ 0x81B0, 0x81B5, 0x81BE, 0x81B8, 0x81BD, 0x81C0, 0x81C2, 0x81BA, /* 0x30 */ 0x81C9, 0x81CD, 0x81D1, 0x81D9, 0x81D8, 0x81C8, 0x81DA, 0x81DF, /* 0x40 */ 0x81E0, 0x81E7, 0x81FA, 0x81FB, 0x81FE, 0x8201, 0x8202, 0x8205, /* 0x40 */ 0x8207, 0x820A, 0x820D, 0x8210, 0x8216, 0x8229, 0x822B, 0x8238, /* 0x50 */ 0x8233, 0x8240, 0x8259, 0x8258, 0x825D, 0x825A, 0x825F, 0x8264, /* 0x50 */ 0x8262, 0x8268, 0x826A, 0x826B, 0x822E, 0x8271, 0x8277, 0x8278, /* 0x60 */ 0x827E, 0x828D, 0x8292, 0x82AB, 0x829F, 0x82BB, 0x82AC, 0x82E1, /* 0x60 */ 0x82E3, 0x82DF, 0x82D2, 0x82F4, 0x82F3, 0x82FA, 0x8393, 0x8303, /* 0x70 */ 0x82FB, 0x82F9, 0x82DE, 0x8306, 0x82DC, 0x8309, 0x82D9 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_68[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8335, 0x8334, 0x8316, 0x8332, 0x8331, 0x8340, 0x8339, /* 0x20 */ 0x8350, 0x8345, 0x832F, 0x832B, 0x8317, 0x8318, 0x8385, 0x839A, /* 0x20 */ 0x83AA, 0x839F, 0x83A2, 0x8396, 0x8323, 0x838E, 0x8387, 0x838A, /* 0x30 */ 0x837C, 0x83B5, 0x8373, 0x8375, 0x83A0, 0x8389, 0x83A8, 0x83F4, /* 0x30 */ 0x8413, 0x83EB, 0x83CE, 0x83FD, 0x8403, 0x83D8, 0x840B, 0x83C1, /* 0x40 */ 0x83F7, 0x8407, 0x83E0, 0x83F2, 0x840D, 0x8422, 0x8420, 0x83BD, /* 0x40 */ 0x8438, 0x8506, 0x83FB, 0x846D, 0x842A, 0x843C, 0x855A, 0x8484, /* 0x50 */ 0x8477, 0x846B, 0x84AD, 0x846E, 0x8482, 0x8469, 0x8446, 0x842C, /* 0x50 */ 0x846F, 0x8479, 0x8435, 0x84CA, 0x8462, 0x84B9, 0x84BF, 0x849F, /* 0x60 */ 0x84D9, 0x84CD, 0x84BB, 0x84DA, 0x84D0, 0x84C1, 0x84C6, 0x84D6, /* 0x60 */ 0x84A1, 0x8521, 0x84FF, 0x84F4, 0x8517, 0x8518, 0x852C, 0x851F, /* 0x70 */ 0x8515, 0x8514, 0x84FC, 0x8540, 0x8563, 0x8558, 0x8548 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_69[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8541, 0x8602, 0x854B, 0x8555, 0x8580, 0x85A4, 0x8588, /* 0x20 */ 0x8591, 0x858A, 0x85A8, 0x856D, 0x8594, 0x859B, 0x85EA, 0x8587, /* 0x20 */ 0x859C, 0x8577, 0x857E, 0x8590, 0x85C9, 0x85BA, 0x85CF, 0x85B9, /* 0x30 */ 0x85D0, 0x85D5, 0x85DD, 0x85E5, 0x85DC, 0x85F9, 0x860A, 0x8613, /* 0x30 */ 0x860B, 0x85FE, 0x85FA, 0x8606, 0x8622, 0x861A, 0x8630, 0x863F, /* 0x40 */ 0x864D, 0x4E55, 0x8654, 0x865F, 0x8667, 0x8671, 0x8693, 0x86A3, /* 0x40 */ 0x86A9, 0x86AA, 0x868B, 0x868C, 0x86B6, 0x86AF, 0x86C4, 0x86C6, /* 0x50 */ 0x86B0, 0x86C9, 0x8823, 0x86AB, 0x86D4, 0x86DE, 0x86E9, 0x86EC, /* 0x50 */ 0x86DF, 0x86DB, 0x86EF, 0x8712, 0x8706, 0x8708, 0x8700, 0x8703, /* 0x60 */ 0x86FB, 0x8711, 0x8709, 0x870D, 0x86F9, 0x870A, 0x8734, 0x873F, /* 0x60 */ 0x8737, 0x873B, 0x8725, 0x8729, 0x871A, 0x8760, 0x875F, 0x8778, /* 0x70 */ 0x874C, 0x874E, 0x8774, 0x8757, 0x8768, 0x876E, 0x8759 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_6A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8753, 0x8763, 0x876A, 0x8805, 0x87A2, 0x879F, 0x8782, /* 0x20 */ 0x87AF, 0x87CB, 0x87BD, 0x87C0, 0x87D0, 0x96D6, 0x87AB, 0x87C4, /* 0x20 */ 0x87B3, 0x87C7, 0x87C6, 0x87BB, 0x87EF, 0x87F2, 0x87E0, 0x880F, /* 0x30 */ 0x880D, 0x87FE, 0x87F6, 0x87F7, 0x880E, 0x87D2, 0x8811, 0x8816, /* 0x30 */ 0x8815, 0x8822, 0x8821, 0x8831, 0x8836, 0x8839, 0x8827, 0x883B, /* 0x40 */ 0x8844, 0x8842, 0x8852, 0x8859, 0x885E, 0x8862, 0x886B, 0x8881, /* 0x40 */ 0x887E, 0x889E, 0x8875, 0x887D, 0x88B5, 0x8872, 0x8882, 0x8897, /* 0x50 */ 0x8892, 0x88AE, 0x8899, 0x88A2, 0x888D, 0x88A4, 0x88B0, 0x88BF, /* 0x50 */ 0x88B1, 0x88C3, 0x88C4, 0x88D4, 0x88D8, 0x88D9, 0x88DD, 0x88F9, /* 0x60 */ 0x8902, 0x88FC, 0x88F4, 0x88E8, 0x88F2, 0x8904, 0x890C, 0x890A, /* 0x60 */ 0x8913, 0x8943, 0x891E, 0x8925, 0x892A, 0x892B, 0x8941, 0x8944, /* 0x70 */ 0x893B, 0x8936, 0x8938, 0x894C, 0x891D, 0x8960, 0x895E /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_6B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8966, 0x8964, 0x896D, 0x896A, 0x896F, 0x8974, 0x8977, /* 0x20 */ 0x897E, 0x8983, 0x8988, 0x898A, 0x8993, 0x8998, 0x89A1, 0x89A9, /* 0x20 */ 0x89A6, 0x89AC, 0x89AF, 0x89B2, 0x89BA, 0x89BD, 0x89BF, 0x89C0, /* 0x30 */ 0x89DA, 0x89DC, 0x89DD, 0x89E7, 0x89F4, 0x89F8, 0x8A03, 0x8A16, /* 0x30 */ 0x8A10, 0x8A0C, 0x8A1B, 0x8A1D, 0x8A25, 0x8A36, 0x8A41, 0x8A5B, /* 0x40 */ 0x8A52, 0x8A46, 0x8A48, 0x8A7C, 0x8A6D, 0x8A6C, 0x8A62, 0x8A85, /* 0x40 */ 0x8A82, 0x8A84, 0x8AA8, 0x8AA1, 0x8A91, 0x8AA5, 0x8AA6, 0x8A9A, /* 0x50 */ 0x8AA3, 0x8AC4, 0x8ACD, 0x8AC2, 0x8ADA, 0x8AEB, 0x8AF3, 0x8AE7, /* 0x50 */ 0x8AE4, 0x8AF1, 0x8B14, 0x8AE0, 0x8AE2, 0x8AF7, 0x8ADE, 0x8ADB, /* 0x60 */ 0x8B0C, 0x8B07, 0x8B1A, 0x8AE1, 0x8B16, 0x8B10, 0x8B17, 0x8B20, /* 0x60 */ 0x8B33, 0x97AB, 0x8B26, 0x8B2B, 0x8B3E, 0x8B28, 0x8B41, 0x8B4C, /* 0x70 */ 0x8B4F, 0x8B4E, 0x8B49, 0x8B56, 0x8B5B, 0x8B5A, 0x8B6B /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_6C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8B5F, 0x8B6C, 0x8B6F, 0x8B74, 0x8B7D, 0x8B80, 0x8B8C, /* 0x20 */ 0x8B8E, 0x8B92, 0x8B93, 0x8B96, 0x8B99, 0x8B9A, 0x8C3A, 0x8C41, /* 0x20 */ 0x8C3F, 0x8C48, 0x8C4C, 0x8C4E, 0x8C50, 0x8C55, 0x8C62, 0x8C6C, /* 0x30 */ 0x8C78, 0x8C7A, 0x8C82, 0x8C89, 0x8C85, 0x8C8A, 0x8C8D, 0x8C8E, /* 0x30 */ 0x8C94, 0x8C7C, 0x8C98, 0x621D, 0x8CAD, 0x8CAA, 0x8CBD, 0x8CB2, /* 0x40 */ 0x8CB3, 0x8CAE, 0x8CB6, 0x8CC8, 0x8CC1, 0x8CE4, 0x8CE3, 0x8CDA, /* 0x40 */ 0x8CFD, 0x8CFA, 0x8CFB, 0x8D04, 0x8D05, 0x8D0A, 0x8D07, 0x8D0F, /* 0x50 */ 0x8D0D, 0x8D10, 0x9F4E, 0x8D13, 0x8CCD, 0x8D14, 0x8D16, 0x8D67, /* 0x50 */ 0x8D6D, 0x8D71, 0x8D73, 0x8D81, 0x8D99, 0x8DC2, 0x8DBE, 0x8DBA, /* 0x60 */ 0x8DCF, 0x8DDA, 0x8DD6, 0x8DCC, 0x8DDB, 0x8DCB, 0x8DEA, 0x8DEB, /* 0x60 */ 0x8DDF, 0x8DE3, 0x8DFC, 0x8E08, 0x8E09, 0x8DFF, 0x8E1D, 0x8E1E, /* 0x70 */ 0x8E10, 0x8E1F, 0x8E42, 0x8E35, 0x8E30, 0x8E34, 0x8E4A /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_6D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8E47, 0x8E49, 0x8E4C, 0x8E50, 0x8E48, 0x8E59, 0x8E64, /* 0x20 */ 0x8E60, 0x8E2A, 0x8E63, 0x8E55, 0x8E76, 0x8E72, 0x8E7C, 0x8E81, /* 0x20 */ 0x8E87, 0x8E85, 0x8E84, 0x8E8B, 0x8E8A, 0x8E93, 0x8E91, 0x8E94, /* 0x30 */ 0x8E99, 0x8EAA, 0x8EA1, 0x8EAC, 0x8EB0, 0x8EC6, 0x8EB1, 0x8EBE, /* 0x30 */ 0x8EC5, 0x8EC8, 0x8ECB, 0x8EDB, 0x8EE3, 0x8EFC, 0x8EFB, 0x8EEB, /* 0x40 */ 0x8EFE, 0x8F0A, 0x8F05, 0x8F15, 0x8F12, 0x8F19, 0x8F13, 0x8F1C, /* 0x40 */ 0x8F1F, 0x8F1B, 0x8F0C, 0x8F26, 0x8F33, 0x8F3B, 0x8F39, 0x8F45, /* 0x50 */ 0x8F42, 0x8F3E, 0x8F4C, 0x8F49, 0x8F46, 0x8F4E, 0x8F57, 0x8F5C, /* 0x50 */ 0x8F62, 0x8F63, 0x8F64, 0x8F9C, 0x8F9F, 0x8FA3, 0x8FAD, 0x8FAF, /* 0x60 */ 0x8FB7, 0x8FDA, 0x8FE5, 0x8FE2, 0x8FEA, 0x8FEF, 0x9087, 0x8FF4, /* 0x60 */ 0x9005, 0x8FF9, 0x8FFA, 0x9011, 0x9015, 0x9021, 0x900D, 0x901E, /* 0x70 */ 0x9016, 0x900B, 0x9027, 0x9036, 0x9035, 0x9039, 0x8FF8 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_6E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x904F, 0x9050, 0x9051, 0x9052, 0x900E, 0x9049, 0x903E, /* 0x20 */ 0x9056, 0x9058, 0x905E, 0x9068, 0x906F, 0x9076, 0x96A8, 0x9072, /* 0x20 */ 0x9082, 0x907D, 0x9081, 0x9080, 0x908A, 0x9089, 0x908F, 0x90A8, /* 0x30 */ 0x90AF, 0x90B1, 0x90B5, 0x90E2, 0x90E4, 0x6248, 0x90DB, 0x9102, /* 0x30 */ 0x9112, 0x9119, 0x9132, 0x9130, 0x914A, 0x9156, 0x9158, 0x9163, /* 0x40 */ 0x9165, 0x9169, 0x9173, 0x9172, 0x918B, 0x9189, 0x9182, 0x91A2, /* 0x40 */ 0x91AB, 0x91AF, 0x91AA, 0x91B5, 0x91B4, 0x91BA, 0x91C0, 0x91C1, /* 0x50 */ 0x91C9, 0x91CB, 0x91D0, 0x91D6, 0x91DF, 0x91E1, 0x91DB, 0x91FC, /* 0x50 */ 0x91F5, 0x91F6, 0x921E, 0x91FF, 0x9214, 0x922C, 0x9215, 0x9211, /* 0x60 */ 0x925E, 0x9257, 0x9245, 0x9249, 0x9264, 0x9248, 0x9295, 0x923F, /* 0x60 */ 0x924B, 0x9250, 0x929C, 0x9296, 0x9293, 0x929B, 0x925A, 0x92CF, /* 0x70 */ 0x92B9, 0x92B7, 0x92E9, 0x930F, 0x92FA, 0x9344, 0x932E /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_6F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9319, 0x9322, 0x931A, 0x9323, 0x933A, 0x9335, 0x933B, /* 0x20 */ 0x935C, 0x9360, 0x937C, 0x936E, 0x9356, 0x93B0, 0x93AC, 0x93AD, /* 0x20 */ 0x9394, 0x93B9, 0x93D6, 0x93D7, 0x93E8, 0x93E5, 0x93D8, 0x93C3, /* 0x30 */ 0x93DD, 0x93D0, 0x93C8, 0x93E4, 0x941A, 0x9414, 0x9413, 0x9403, /* 0x30 */ 0x9407, 0x9410, 0x9436, 0x942B, 0x9435, 0x9421, 0x943A, 0x9441, /* 0x40 */ 0x9452, 0x9444, 0x945B, 0x9460, 0x9462, 0x945E, 0x946A, 0x9229, /* 0x40 */ 0x9470, 0x9475, 0x9477, 0x947D, 0x945A, 0x947C, 0x947E, 0x9481, /* 0x50 */ 0x947F, 0x9582, 0x9587, 0x958A, 0x9594, 0x9596, 0x9598, 0x9599, /* 0x50 */ 0x95A0, 0x95A8, 0x95A7, 0x95AD, 0x95BC, 0x95BB, 0x95B9, 0x95BE, /* 0x60 */ 0x95CA, 0x6FF6, 0x95C3, 0x95CD, 0x95CC, 0x95D5, 0x95D4, 0x95D6, /* 0x60 */ 0x95DC, 0x95E1, 0x95E5, 0x95E2, 0x9621, 0x9628, 0x962E, 0x962F, /* 0x70 */ 0x9642, 0x964C, 0x964F, 0x964B, 0x9677, 0x965C, 0x965E /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_70[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x965D, 0x965F, 0x9666, 0x9672, 0x966C, 0x968D, 0x9698, /* 0x20 */ 0x9695, 0x9697, 0x96AA, 0x96A7, 0x96B1, 0x96B2, 0x96B0, 0x96B4, /* 0x20 */ 0x96B6, 0x96B8, 0x96B9, 0x96CE, 0x96CB, 0x96C9, 0x96CD, 0x894D, /* 0x30 */ 0x96DC, 0x970D, 0x96D5, 0x96F9, 0x9704, 0x9706, 0x9708, 0x9713, /* 0x30 */ 0x970E, 0x9711, 0x970F, 0x9716, 0x9719, 0x9724, 0x972A, 0x9730, /* 0x40 */ 0x9739, 0x973D, 0x973E, 0x9744, 0x9746, 0x9748, 0x9742, 0x9749, /* 0x40 */ 0x975C, 0x9760, 0x9764, 0x9766, 0x9768, 0x52D2, 0x976B, 0x9771, /* 0x50 */ 0x9779, 0x9785, 0x977C, 0x9781, 0x977A, 0x9786, 0x978B, 0x978F, /* 0x50 */ 0x9790, 0x979C, 0x97A8, 0x97A6, 0x97A3, 0x97B3, 0x97B4, 0x97C3, /* 0x60 */ 0x97C6, 0x97C8, 0x97CB, 0x97DC, 0x97ED, 0x9F4F, 0x97F2, 0x7ADF, /* 0x60 */ 0x97F6, 0x97F5, 0x980F, 0x980C, 0x9838, 0x9824, 0x9821, 0x9837, /* 0x70 */ 0x983D, 0x9846, 0x984F, 0x984B, 0x986B, 0x986F, 0x9870 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_71[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9871, 0x9874, 0x9873, 0x98AA, 0x98AF, 0x98B1, 0x98B6, /* 0x20 */ 0x98C4, 0x98C3, 0x98C6, 0x98E9, 0x98EB, 0x9903, 0x9909, 0x9912, /* 0x20 */ 0x9914, 0x9918, 0x9921, 0x991D, 0x991E, 0x9924, 0x9920, 0x992C, /* 0x30 */ 0x992E, 0x993D, 0x993E, 0x9942, 0x9949, 0x9945, 0x9950, 0x994B, /* 0x30 */ 0x9951, 0x9952, 0x994C, 0x9955, 0x9997, 0x9998, 0x99A5, 0x99AD, /* 0x40 */ 0x99AE, 0x99BC, 0x99DF, 0x99DB, 0x99DD, 0x99D8, 0x99D1, 0x99ED, /* 0x40 */ 0x99EE, 0x99F1, 0x99F2, 0x99FB, 0x99F8, 0x9A01, 0x9A0F, 0x9A05, /* 0x50 */ 0x99E2, 0x9A19, 0x9A2B, 0x9A37, 0x9A45, 0x9A42, 0x9A40, 0x9A43, /* 0x50 */ 0x9A3E, 0x9A55, 0x9A4D, 0x9A5B, 0x9A57, 0x9A5F, 0x9A62, 0x9A65, /* 0x60 */ 0x9A64, 0x9A69, 0x9A6B, 0x9A6A, 0x9AAD, 0x9AB0, 0x9ABC, 0x9AC0, /* 0x60 */ 0x9ACF, 0x9AD1, 0x9AD3, 0x9AD4, 0x9ADE, 0x9ADF, 0x9AE2, 0x9AE3, /* 0x70 */ 0x9AE6, 0x9AEF, 0x9AEB, 0x9AEE, 0x9AF4, 0x9AF1, 0x9AF7 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_72[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9AFB, 0x9B06, 0x9B18, 0x9B1A, 0x9B1F, 0x9B22, 0x9B23, /* 0x20 */ 0x9B25, 0x9B27, 0x9B28, 0x9B29, 0x9B2A, 0x9B2E, 0x9B2F, 0x9B32, /* 0x20 */ 0x9B44, 0x9B43, 0x9B4F, 0x9B4D, 0x9B4E, 0x9B51, 0x9B58, 0x9B74, /* 0x30 */ 0x9B93, 0x9B83, 0x9B91, 0x9B96, 0x9B97, 0x9B9F, 0x9BA0, 0x9BA8, /* 0x30 */ 0x9BB4, 0x9BC0, 0x9BCA, 0x9BB9, 0x9BC6, 0x9BCF, 0x9BD1, 0x9BD2, /* 0x40 */ 0x9BE3, 0x9BE2, 0x9BE4, 0x9BD4, 0x9BE1, 0x9C3A, 0x9BF2, 0x9BF1, /* 0x40 */ 0x9BF0, 0x9C15, 0x9C14, 0x9C09, 0x9C13, 0x9C0C, 0x9C06, 0x9C08, /* 0x50 */ 0x9C12, 0x9C0A, 0x9C04, 0x9C2E, 0x9C1B, 0x9C25, 0x9C24, 0x9C21, /* 0x50 */ 0x9C30, 0x9C47, 0x9C32, 0x9C46, 0x9C3E, 0x9C5A, 0x9C60, 0x9C67, /* 0x60 */ 0x9C76, 0x9C78, 0x9CE7, 0x9CEC, 0x9CF0, 0x9D09, 0x9D08, 0x9CEB, /* 0x60 */ 0x9D03, 0x9D06, 0x9D2A, 0x9D26, 0x9DAF, 0x9D23, 0x9D1F, 0x9D44, /* 0x70 */ 0x9D15, 0x9D12, 0x9D41, 0x9D3F, 0x9D3E, 0x9D46, 0x9D48 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_73[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9D5D, 0x9D5E, 0x9D64, 0x9D51, 0x9D50, 0x9D59, 0x9D72, /* 0x20 */ 0x9D89, 0x9D87, 0x9DAB, 0x9D6F, 0x9D7A, 0x9D9A, 0x9DA4, 0x9DA9, /* 0x20 */ 0x9DB2, 0x9DC4, 0x9DC1, 0x9DBB, 0x9DB8, 0x9DBA, 0x9DC6, 0x9DCF, /* 0x30 */ 0x9DC2, 0x9DD9, 0x9DD3, 0x9DF8, 0x9DE6, 0x9DED, 0x9DEF, 0x9DFD, /* 0x30 */ 0x9E1A, 0x9E1B, 0x9E1E, 0x9E75, 0x9E79, 0x9E7D, 0x9E81, 0x9E88, /* 0x40 */ 0x9E8B, 0x9E8C, 0x9E92, 0x9E95, 0x9E91, 0x9E9D, 0x9EA5, 0x9EA9, /* 0x40 */ 0x9EB8, 0x9EAA, 0x9EAD, 0x9761, 0x9ECC, 0x9ECE, 0x9ECF, 0x9ED0, /* 0x50 */ 0x9ED4, 0x9EDC, 0x9EDE, 0x9EDD, 0x9EE0, 0x9EE5, 0x9EE8, 0x9EEF, /* 0x50 */ 0x9EF4, 0x9EF6, 0x9EF7, 0x9EF9, 0x9EFB, 0x9EFC, 0x9EFD, 0x9F07, /* 0x60 */ 0x9F08, 0x76B7, 0x9F15, 0x9F21, 0x9F2C, 0x9F3E, 0x9F4A, 0x9F52, /* 0x60 */ 0x9F54, 0x9F63, 0x9F5F, 0x9F60, 0x9F61, 0x9F66, 0x9F67, 0x9F6C, /* 0x70 */ 0x9F6A, 0x9F77, 0x9F72, 0x9F76, 0x9F95, 0x9F9C, 0x9FA0 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0208_74[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x582F, 0x69C7, 0x9059, 0x7464, 0x51DC, 0x7199 /* 0x20 */ /* 0x20 */ }; /* ======================================================================= */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_22[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ /* 0x20 */ 0x02D8, /* 0x20 */ 0x02C7, 0x00B8, 0x02D9, 0x02DD, 0x00AF, 0x02DB, 0x02DA, 0x007E, /* 0x30 */ 0x0384, 0x0385, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0x00A1, 0x00A6, 0x00BF, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0x00BA, 0x00AA, 0x00A9, 0x00AE, 0x2122, /* 0x60 */ 0x00A4, 0x2116 /* 0x70 */ /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_26[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x0386, 0x0388, 0x0389, 0x038A, 0x03AA, 0, 0x038C, /* 0x60 */ 0, 0x038E, 0x03AB, 0, 0x038F, 0, 0, 0, /* 0x60 */ 0, 0x03AC, 0x03AD, 0x03AE, 0x03AF, 0x03CA, 0x0390, 0x03CC, /* 0x70 */ 0x03C2, 0x03CD, 0x03CB, 0x03B0, 0x03CE /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_27[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x40 */ 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x040E, 0x040F, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x70 */ 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x045E, 0x045F /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_29[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00C6, 0x0110, 0, 0x0126, 0, 0x0132, 0, /* 0x20 */ 0x0141, 0x013F, 0, 0x014A, 0x00D8, 0x0152, 0, 0x0166, /* 0x20 */ 0x00DE, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0x00E6, 0x0111, 0x00F0, 0x0127, 0x0131, 0x0133, 0x0138, /* 0x40 */ 0x0142, 0x0140, 0x0149, 0x014B, 0x00F8, 0x0153, 0x00DF, 0x0167, /* 0x40 */ 0x00FE /* 0x50 */ /* 0x50 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_2A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00C1, 0x00C0, 0x00C4, 0x00C2, 0x0102, 0x01CD, 0x0100, /* 0x20 */ 0x0104, 0x00C5, 0x00C3, 0x0106, 0x0108, 0x010C, 0x00C7, 0x010A, /* 0x20 */ 0x010E, 0x00C9, 0x00C8, 0x00CB, 0x00CA, 0x011A, 0x0116, 0x0112, /* 0x30 */ 0x0118, 0, 0x011C, 0x011E, 0x0122, 0x0120, 0x0124, 0x00CD, /* 0x30 */ 0x00CC, 0x00CF, 0x00CE, 0x01CF, 0x0130, 0x012A, 0x012E, 0x0128, /* 0x40 */ 0x0134, 0x0136, 0x0139, 0x013D, 0x013B, 0x0143, 0x0147, 0x0145, /* 0x40 */ 0x00D1, 0x00D3, 0x00D2, 0x00D6, 0x00D4, 0x01D1, 0x0150, 0x014C, /* 0x50 */ 0x00D5, 0x0154, 0x0158, 0x0156, 0x015A, 0x015C, 0x0160, 0x015E, /* 0x50 */ 0x0164, 0x0162, 0x00DA, 0x00D9, 0x00DC, 0x00DB, 0x016C, 0x01D3, /* 0x60 */ 0x0170, 0x016A, 0x0172, 0x016E, 0x0168, 0x01D7, 0x01DB, 0x01D9, /* 0x60 */ 0x01D5, 0x0174, 0x00DD, 0x0178, 0x0176, 0x0179, 0x017D, 0x017B, /* 0x70 */ /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_2B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x00E1, 0x00E0, 0x00E4, 0x00E2, 0x0103, 0x01CE, 0x0101, /* 0x20 */ 0x0105, 0x00E5, 0x00E3, 0x0107, 0x0109, 0x010D, 0x00E7, 0x010B, /* 0x20 */ 0x010F, 0x00E9, 0x00E8, 0x00EB, 0x00EA, 0x011B, 0x0117, 0x0113, /* 0x30 */ 0x0119, 0x01F5, 0x011D, 0x011F, 0, 0x0121, 0x0125, 0x00ED, /* 0x30 */ 0x00EC, 0x00EF, 0x00EE, 0x01D0, 0, 0x012B, 0x012F, 0x0129, /* 0x40 */ 0x0135, 0x0137, 0x013A, 0x013E, 0x013C, 0x0144, 0x0148, 0x0146, /* 0x40 */ 0x00F1, 0x00F3, 0x00F2, 0x00F6, 0x00F4, 0x01D2, 0x0151, 0x014D, /* 0x50 */ 0x00F5, 0x0155, 0x0159, 0x0157, 0x015B, 0x015D, 0x0161, 0x015F, /* 0x50 */ 0x0165, 0x0163, 0x00FA, 0x00F9, 0x00FC, 0x00FB, 0x016D, 0x01D4, /* 0x60 */ 0x0171, 0x016B, 0x0173, 0x016F, 0x0169, 0x01D8, 0x01DC, 0x01DA, /* 0x60 */ 0x01D6, 0x0175, 0x00FD, 0x00FF, 0x0177, 0x017A, 0x017E, 0x017C /* 0x70 */ /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_30[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x4E02, 0x4E04, 0x4E05, 0x4E0C, 0x4E12, 0x4E1F, 0x4E23, /* 0x20 */ 0x4E24, 0x4E28, 0x4E2B, 0x4E2E, 0x4E2F, 0x4E30, 0x4E35, 0x4E40, /* 0x20 */ 0x4E41, 0x4E44, 0x4E47, 0x4E51, 0x4E5A, 0x4E5C, 0x4E63, 0x4E68, /* 0x30 */ 0x4E69, 0x4E74, 0x4E75, 0x4E79, 0x4E7F, 0x4E8D, 0x4E96, 0x4E97, /* 0x30 */ 0x4E9D, 0x4EAF, 0x4EB9, 0x4EC3, 0x4ED0, 0x4EDA, 0x4EDB, 0x4EE0, /* 0x40 */ 0x4EE1, 0x4EE2, 0x4EE8, 0x4EEF, 0x4EF1, 0x4EF3, 0x4EF5, 0x4EFD, /* 0x40 */ 0x4EFE, 0x4EFF, 0x4F00, 0x4F02, 0x4F03, 0x4F08, 0x4F0B, 0x4F0C, /* 0x50 */ 0x4F12, 0x4F15, 0x4F16, 0x4F17, 0x4F19, 0x4F2E, 0x4F31, 0x4F60, /* 0x50 */ 0x4F33, 0x4F35, 0x4F37, 0x4F39, 0x4F3B, 0x4F3E, 0x4F40, 0x4F42, /* 0x60 */ 0x4F48, 0x4F49, 0x4F4B, 0x4F4C, 0x4F52, 0x4F54, 0x4F56, 0x4F58, /* 0x60 */ 0x4F5F, 0x4F63, 0x4F6A, 0x4F6C, 0x4F6E, 0x4F71, 0x4F77, 0x4F78, /* 0x70 */ 0x4F79, 0x4F7A, 0x4F7D, 0x4F7E, 0x4F81, 0x4F82, 0x4F84 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_31[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x4F85, 0x4F89, 0x4F8A, 0x4F8C, 0x4F8E, 0x4F90, 0x4F92, /* 0x20 */ 0x4F93, 0x4F94, 0x4F97, 0x4F99, 0x4F9A, 0x4F9E, 0x4F9F, 0x4FB2, /* 0x20 */ 0x4FB7, 0x4FB9, 0x4FBB, 0x4FBC, 0x4FBD, 0x4FBE, 0x4FC0, 0x4FC1, /* 0x30 */ 0x4FC5, 0x4FC6, 0x4FC8, 0x4FC9, 0x4FCB, 0x4FCC, 0x4FCD, 0x4FCF, /* 0x30 */ 0x4FD2, 0x4FDC, 0x4FE0, 0x4FE2, 0x4FF0, 0x4FF2, 0x4FFC, 0x4FFD, /* 0x40 */ 0x4FFF, 0x5000, 0x5001, 0x5004, 0x5007, 0x500A, 0x500C, 0x500E, /* 0x40 */ 0x5010, 0x5013, 0x5017, 0x5018, 0x501B, 0x501C, 0x501D, 0x501E, /* 0x50 */ 0x5022, 0x5027, 0x502E, 0x5030, 0x5032, 0x5033, 0x5035, 0x5040, /* 0x50 */ 0x5041, 0x5042, 0x5045, 0x5046, 0x504A, 0x504C, 0x504E, 0x5051, /* 0x60 */ 0x5052, 0x5053, 0x5057, 0x5059, 0x505F, 0x5060, 0x5062, 0x5063, /* 0x60 */ 0x5066, 0x5067, 0x506A, 0x506D, 0x5070, 0x5071, 0x503B, 0x5081, /* 0x70 */ 0x5083, 0x5084, 0x5086, 0x508A, 0x508E, 0x508F, 0x5090 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_32[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5092, 0x5093, 0x5094, 0x5096, 0x509B, 0x509C, 0x509E, /* 0x20 */ 0x509F, 0x50A0, 0x50A1, 0x50A2, 0x50AA, 0x50AF, 0x50B0, 0x50B9, /* 0x20 */ 0x50BA, 0x50BD, 0x50C0, 0x50C3, 0x50C4, 0x50C7, 0x50CC, 0x50CE, /* 0x30 */ 0x50D0, 0x50D3, 0x50D4, 0x50D8, 0x50DC, 0x50DD, 0x50DF, 0x50E2, /* 0x30 */ 0x50E4, 0x50E6, 0x50E8, 0x50E9, 0x50EF, 0x50F1, 0x50F6, 0x50FA, /* 0x40 */ 0x50FE, 0x5103, 0x5106, 0x5107, 0x5108, 0x510B, 0x510C, 0x510D, /* 0x40 */ 0x510E, 0x50F2, 0x5110, 0x5117, 0x5119, 0x511B, 0x511C, 0x511D, /* 0x50 */ 0x511E, 0x5123, 0x5127, 0x5128, 0x512C, 0x512D, 0x512F, 0x5131, /* 0x50 */ 0x5133, 0x5134, 0x5135, 0x5138, 0x5139, 0x5142, 0x514A, 0x514F, /* 0x60 */ 0x5153, 0x5155, 0x5157, 0x5158, 0x515F, 0x5164, 0x5166, 0x517E, /* 0x60 */ 0x5183, 0x5184, 0x518B, 0x518E, 0x5198, 0x519D, 0x51A1, 0x51A3, /* 0x70 */ 0x51AD, 0x51B8, 0x51BA, 0x51BC, 0x51BE, 0x51BF, 0x51C2 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_33[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x51C8, 0x51CF, 0x51D1, 0x51D2, 0x51D3, 0x51D5, 0x51D8, /* 0x20 */ 0x51DE, 0x51E2, 0x51E5, 0x51EE, 0x51F2, 0x51F3, 0x51F4, 0x51F7, /* 0x20 */ 0x5201, 0x5202, 0x5205, 0x5212, 0x5213, 0x5215, 0x5216, 0x5218, /* 0x30 */ 0x5222, 0x5228, 0x5231, 0x5232, 0x5235, 0x523C, 0x5245, 0x5249, /* 0x30 */ 0x5255, 0x5257, 0x5258, 0x525A, 0x525C, 0x525F, 0x5260, 0x5261, /* 0x40 */ 0x5266, 0x526E, 0x5277, 0x5278, 0x5279, 0x5280, 0x5282, 0x5285, /* 0x40 */ 0x528A, 0x528C, 0x5293, 0x5295, 0x5296, 0x5297, 0x5298, 0x529A, /* 0x50 */ 0x529C, 0x52A4, 0x52A5, 0x52A6, 0x52A7, 0x52AF, 0x52B0, 0x52B6, /* 0x50 */ 0x52B7, 0x52B8, 0x52BA, 0x52BB, 0x52BD, 0x52C0, 0x52C4, 0x52C6, /* 0x60 */ 0x52C8, 0x52CC, 0x52CF, 0x52D1, 0x52D4, 0x52D6, 0x52DB, 0x52DC, /* 0x60 */ 0x52E1, 0x52E5, 0x52E8, 0x52E9, 0x52EA, 0x52EC, 0x52F0, 0x52F1, /* 0x70 */ 0x52F4, 0x52F6, 0x52F7, 0x5300, 0x5303, 0x530A, 0x530B /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_34[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x530C, 0x5311, 0x5313, 0x5318, 0x531B, 0x531C, 0x531E, /* 0x20 */ 0x531F, 0x5325, 0x5327, 0x5328, 0x5329, 0x532B, 0x532C, 0x532D, /* 0x20 */ 0x5330, 0x5332, 0x5335, 0x533C, 0x533D, 0x533E, 0x5342, 0x534C, /* 0x30 */ 0x534B, 0x5359, 0x535B, 0x5361, 0x5363, 0x5365, 0x536C, 0x536D, /* 0x30 */ 0x5372, 0x5379, 0x537E, 0x5383, 0x5387, 0x5388, 0x538E, 0x5393, /* 0x40 */ 0x5394, 0x5399, 0x539D, 0x53A1, 0x53A4, 0x53AA, 0x53AB, 0x53AF, /* 0x40 */ 0x53B2, 0x53B4, 0x53B5, 0x53B7, 0x53B8, 0x53BA, 0x53BD, 0x53C0, /* 0x50 */ 0x53C5, 0x53CF, 0x53D2, 0x53D3, 0x53D5, 0x53DA, 0x53DD, 0x53DE, /* 0x50 */ 0x53E0, 0x53E6, 0x53E7, 0x53F5, 0x5402, 0x5413, 0x541A, 0x5421, /* 0x60 */ 0x5427, 0x5428, 0x542A, 0x542F, 0x5431, 0x5434, 0x5435, 0x5443, /* 0x60 */ 0x5444, 0x5447, 0x544D, 0x544F, 0x545E, 0x5462, 0x5464, 0x5466, /* 0x70 */ 0x5467, 0x5469, 0x546B, 0x546D, 0x546E, 0x5474, 0x547F /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_35[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5481, 0x5483, 0x5485, 0x5488, 0x5489, 0x548D, 0x5491, /* 0x20 */ 0x5495, 0x5496, 0x549C, 0x549F, 0x54A1, 0x54A6, 0x54A7, 0x54A9, /* 0x20 */ 0x54AA, 0x54AD, 0x54AE, 0x54B1, 0x54B7, 0x54B9, 0x54BA, 0x54BB, /* 0x30 */ 0x54BF, 0x54C6, 0x54CA, 0x54CD, 0x54CE, 0x54E0, 0x54EA, 0x54EC, /* 0x30 */ 0x54EF, 0x54F6, 0x54FC, 0x54FE, 0x54FF, 0x5500, 0x5501, 0x5505, /* 0x40 */ 0x5508, 0x5509, 0x550C, 0x550D, 0x550E, 0x5515, 0x552A, 0x552B, /* 0x40 */ 0x5532, 0x5535, 0x5536, 0x553B, 0x553C, 0x553D, 0x5541, 0x5547, /* 0x50 */ 0x5549, 0x554A, 0x554D, 0x5550, 0x5551, 0x5558, 0x555A, 0x555B, /* 0x50 */ 0x555E, 0x5560, 0x5561, 0x5564, 0x5566, 0x557F, 0x5581, 0x5582, /* 0x60 */ 0x5586, 0x5588, 0x558E, 0x558F, 0x5591, 0x5592, 0x5593, 0x5594, /* 0x60 */ 0x5597, 0x55A3, 0x55A4, 0x55AD, 0x55B2, 0x55BF, 0x55C1, 0x55C3, /* 0x70 */ 0x55C6, 0x55C9, 0x55CB, 0x55CC, 0x55CE, 0x55D1, 0x55D2 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_36[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x55D3, 0x55D7, 0x55D8, 0x55DB, 0x55DE, 0x55E2, 0x55E9, /* 0x20 */ 0x55F6, 0x55FF, 0x5605, 0x5608, 0x560A, 0x560D, 0x560E, 0x560F, /* 0x20 */ 0x5610, 0x5611, 0x5612, 0x5619, 0x562C, 0x5630, 0x5633, 0x5635, /* 0x30 */ 0x5637, 0x5639, 0x563B, 0x563C, 0x563D, 0x563F, 0x5640, 0x5641, /* 0x30 */ 0x5643, 0x5644, 0x5646, 0x5649, 0x564B, 0x564D, 0x564F, 0x5654, /* 0x40 */ 0x565E, 0x5660, 0x5661, 0x5662, 0x5663, 0x5666, 0x5669, 0x566D, /* 0x40 */ 0x566F, 0x5671, 0x5672, 0x5675, 0x5684, 0x5685, 0x5688, 0x568B, /* 0x50 */ 0x568C, 0x5695, 0x5699, 0x569A, 0x569D, 0x569E, 0x569F, 0x56A6, /* 0x50 */ 0x56A7, 0x56A8, 0x56A9, 0x56AB, 0x56AC, 0x56AD, 0x56B1, 0x56B3, /* 0x60 */ 0x56B7, 0x56BE, 0x56C5, 0x56C9, 0x56CA, 0x56CB, 0x56CF, 0x56D0, /* 0x60 */ 0x56CC, 0x56CD, 0x56D9, 0x56DC, 0x56DD, 0x56DF, 0x56E1, 0x56E4, /* 0x70 */ 0x56E5, 0x56E6, 0x56E7, 0x56E8, 0x56F1, 0x56EB, 0x56ED /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_37[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x56F6, 0x56F7, 0x5701, 0x5702, 0x5707, 0x570A, 0x570C, /* 0x20 */ 0x5711, 0x5715, 0x571A, 0x571B, 0x571D, 0x5720, 0x5722, 0x5723, /* 0x20 */ 0x5724, 0x5725, 0x5729, 0x572A, 0x572C, 0x572E, 0x572F, 0x5733, /* 0x30 */ 0x5734, 0x573D, 0x573E, 0x573F, 0x5745, 0x5746, 0x574C, 0x574D, /* 0x30 */ 0x5752, 0x5762, 0x5765, 0x5767, 0x5768, 0x576B, 0x576D, 0x576E, /* 0x40 */ 0x576F, 0x5770, 0x5771, 0x5773, 0x5774, 0x5775, 0x5777, 0x5779, /* 0x40 */ 0x577A, 0x577B, 0x577C, 0x577E, 0x5781, 0x5783, 0x578C, 0x5794, /* 0x50 */ 0x5797, 0x5799, 0x579A, 0x579C, 0x579D, 0x579E, 0x579F, 0x57A1, /* 0x50 */ 0x5795, 0x57A7, 0x57A8, 0x57A9, 0x57AC, 0x57B8, 0x57BD, 0x57C7, /* 0x60 */ 0x57C8, 0x57CC, 0x57CF, 0x57D5, 0x57DD, 0x57DE, 0x57E4, 0x57E6, /* 0x60 */ 0x57E7, 0x57E9, 0x57ED, 0x57F0, 0x57F5, 0x57F6, 0x57F8, 0x57FD, /* 0x70 */ 0x57FE, 0x57FF, 0x5803, 0x5804, 0x5808, 0x5809, 0x57E1 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_38[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x580C, 0x580D, 0x581B, 0x581E, 0x581F, 0x5820, 0x5826, /* 0x20 */ 0x5827, 0x582D, 0x5832, 0x5839, 0x583F, 0x5849, 0x584C, 0x584D, /* 0x20 */ 0x584F, 0x5850, 0x5855, 0x585F, 0x5861, 0x5864, 0x5867, 0x5868, /* 0x30 */ 0x5878, 0x587C, 0x587F, 0x5880, 0x5881, 0x5887, 0x5888, 0x5889, /* 0x30 */ 0x588A, 0x588C, 0x588D, 0x588F, 0x5890, 0x5894, 0x5896, 0x589D, /* 0x40 */ 0x58A0, 0x58A1, 0x58A2, 0x58A6, 0x58A9, 0x58B1, 0x58B2, 0x58C4, /* 0x40 */ 0x58BC, 0x58C2, 0x58C8, 0x58CD, 0x58CE, 0x58D0, 0x58D2, 0x58D4, /* 0x50 */ 0x58D6, 0x58DA, 0x58DD, 0x58E1, 0x58E2, 0x58E9, 0x58F3, 0x5905, /* 0x50 */ 0x5906, 0x590B, 0x590C, 0x5912, 0x5913, 0x5914, 0x8641, 0x591D, /* 0x60 */ 0x5921, 0x5923, 0x5924, 0x5928, 0x592F, 0x5930, 0x5933, 0x5935, /* 0x60 */ 0x5936, 0x593F, 0x5943, 0x5946, 0x5952, 0x5953, 0x5959, 0x595B, /* 0x70 */ 0x595D, 0x595E, 0x595F, 0x5961, 0x5963, 0x596B, 0x596D /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_39[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x596F, 0x5972, 0x5975, 0x5976, 0x5979, 0x597B, 0x597C, /* 0x20 */ 0x598B, 0x598C, 0x598E, 0x5992, 0x5995, 0x5997, 0x599F, 0x59A4, /* 0x20 */ 0x59A7, 0x59AD, 0x59AE, 0x59AF, 0x59B0, 0x59B3, 0x59B7, 0x59BA, /* 0x30 */ 0x59BC, 0x59C1, 0x59C3, 0x59C4, 0x59C8, 0x59CA, 0x59CD, 0x59D2, /* 0x30 */ 0x59DD, 0x59DE, 0x59DF, 0x59E3, 0x59E4, 0x59E7, 0x59EE, 0x59EF, /* 0x40 */ 0x59F1, 0x59F2, 0x59F4, 0x59F7, 0x5A00, 0x5A04, 0x5A0C, 0x5A0D, /* 0x40 */ 0x5A0E, 0x5A12, 0x5A13, 0x5A1E, 0x5A23, 0x5A24, 0x5A27, 0x5A28, /* 0x50 */ 0x5A2A, 0x5A2D, 0x5A30, 0x5A44, 0x5A45, 0x5A47, 0x5A48, 0x5A4C, /* 0x50 */ 0x5A50, 0x5A55, 0x5A5E, 0x5A63, 0x5A65, 0x5A67, 0x5A6D, 0x5A77, /* 0x60 */ 0x5A7A, 0x5A7B, 0x5A7E, 0x5A8B, 0x5A90, 0x5A93, 0x5A96, 0x5A99, /* 0x60 */ 0x5A9C, 0x5A9E, 0x5A9F, 0x5AA0, 0x5AA2, 0x5AA7, 0x5AAC, 0x5AB1, /* 0x70 */ 0x5AB2, 0x5AB3, 0x5AB5, 0x5AB8, 0x5ABA, 0x5ABB, 0x5ABF /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_3A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5AC4, 0x5AC6, 0x5AC8, 0x5ACF, 0x5ADA, 0x5ADC, 0x5AE0, /* 0x20 */ 0x5AE5, 0x5AEA, 0x5AEE, 0x5AF5, 0x5AF6, 0x5AFD, 0x5B00, 0x5B01, /* 0x20 */ 0x5B08, 0x5B17, 0x5B34, 0x5B19, 0x5B1B, 0x5B1D, 0x5B21, 0x5B25, /* 0x30 */ 0x5B2D, 0x5B38, 0x5B41, 0x5B4B, 0x5B4C, 0x5B52, 0x5B56, 0x5B5E, /* 0x30 */ 0x5B68, 0x5B6E, 0x5B6F, 0x5B7C, 0x5B7D, 0x5B7E, 0x5B7F, 0x5B81, /* 0x40 */ 0x5B84, 0x5B86, 0x5B8A, 0x5B8E, 0x5B90, 0x5B91, 0x5B93, 0x5B94, /* 0x40 */ 0x5B96, 0x5BA8, 0x5BA9, 0x5BAC, 0x5BAD, 0x5BAF, 0x5BB1, 0x5BB2, /* 0x50 */ 0x5BB7, 0x5BBA, 0x5BBC, 0x5BC0, 0x5BC1, 0x5BCD, 0x5BCF, 0x5BD6, /* 0x50 */ 0x5BD7, 0x5BD8, 0x5BD9, 0x5BDA, 0x5BE0, 0x5BEF, 0x5BF1, 0x5BF4, /* 0x60 */ 0x5BFD, 0x5C0C, 0x5C17, 0x5C1E, 0x5C1F, 0x5C23, 0x5C26, 0x5C29, /* 0x60 */ 0x5C2B, 0x5C2C, 0x5C2E, 0x5C30, 0x5C32, 0x5C35, 0x5C36, 0x5C59, /* 0x70 */ 0x5C5A, 0x5C5C, 0x5C62, 0x5C63, 0x5C67, 0x5C68, 0x5C69 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_3B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5C6D, 0x5C70, 0x5C74, 0x5C75, 0x5C7A, 0x5C7B, 0x5C7C, /* 0x20 */ 0x5C7D, 0x5C87, 0x5C88, 0x5C8A, 0x5C8F, 0x5C92, 0x5C9D, 0x5C9F, /* 0x20 */ 0x5CA0, 0x5CA2, 0x5CA3, 0x5CA6, 0x5CAA, 0x5CB2, 0x5CB4, 0x5CB5, /* 0x30 */ 0x5CBA, 0x5CC9, 0x5CCB, 0x5CD2, 0x5CDD, 0x5CD7, 0x5CEE, 0x5CF1, /* 0x30 */ 0x5CF2, 0x5CF4, 0x5D01, 0x5D06, 0x5D0D, 0x5D12, 0x5D2B, 0x5D23, /* 0x40 */ 0x5D24, 0x5D26, 0x5D27, 0x5D31, 0x5D34, 0x5D39, 0x5D3D, 0x5D3F, /* 0x40 */ 0x5D42, 0x5D43, 0x5D46, 0x5D48, 0x5D55, 0x5D51, 0x5D59, 0x5D4A, /* 0x50 */ 0x5D5F, 0x5D60, 0x5D61, 0x5D62, 0x5D64, 0x5D6A, 0x5D6D, 0x5D70, /* 0x50 */ 0x5D79, 0x5D7A, 0x5D7E, 0x5D7F, 0x5D81, 0x5D83, 0x5D88, 0x5D8A, /* 0x60 */ 0x5D92, 0x5D93, 0x5D94, 0x5D95, 0x5D99, 0x5D9B, 0x5D9F, 0x5DA0, /* 0x60 */ 0x5DA7, 0x5DAB, 0x5DB0, 0x5DB4, 0x5DB8, 0x5DB9, 0x5DC3, 0x5DC7, /* 0x70 */ 0x5DCB, 0x5DD0, 0x5DCE, 0x5DD8, 0x5DD9, 0x5DE0, 0x5DE4 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_3C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5DE9, 0x5DF8, 0x5DF9, 0x5E00, 0x5E07, 0x5E0D, 0x5E12, /* 0x20 */ 0x5E14, 0x5E15, 0x5E18, 0x5E1F, 0x5E20, 0x5E2E, 0x5E28, 0x5E32, /* 0x20 */ 0x5E35, 0x5E3E, 0x5E4B, 0x5E50, 0x5E49, 0x5E51, 0x5E56, 0x5E58, /* 0x30 */ 0x5E5B, 0x5E5C, 0x5E5E, 0x5E68, 0x5E6A, 0x5E6B, 0x5E6C, 0x5E6D, /* 0x30 */ 0x5E6E, 0x5E70, 0x5E80, 0x5E8B, 0x5E8E, 0x5EA2, 0x5EA4, 0x5EA5, /* 0x40 */ 0x5EA8, 0x5EAA, 0x5EAC, 0x5EB1, 0x5EB3, 0x5EBD, 0x5EBE, 0x5EBF, /* 0x40 */ 0x5EC6, 0x5ECC, 0x5ECB, 0x5ECE, 0x5ED1, 0x5ED2, 0x5ED4, 0x5ED5, /* 0x50 */ 0x5EDC, 0x5EDE, 0x5EE5, 0x5EEB, 0x5F02, 0x5F06, 0x5F07, 0x5F08, /* 0x50 */ 0x5F0E, 0x5F19, 0x5F1C, 0x5F1D, 0x5F21, 0x5F22, 0x5F23, 0x5F24, /* 0x60 */ 0x5F28, 0x5F2B, 0x5F2C, 0x5F2E, 0x5F30, 0x5F34, 0x5F36, 0x5F3B, /* 0x60 */ 0x5F3D, 0x5F3F, 0x5F40, 0x5F44, 0x5F45, 0x5F47, 0x5F4D, 0x5F50, /* 0x70 */ 0x5F54, 0x5F58, 0x5F5B, 0x5F60, 0x5F63, 0x5F64, 0x5F67 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_3D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x5F6F, 0x5F72, 0x5F74, 0x5F75, 0x5F78, 0x5F7A, 0x5F7D, /* 0x20 */ 0x5F7E, 0x5F89, 0x5F8D, 0x5F8F, 0x5F96, 0x5F9C, 0x5F9D, 0x5FA2, /* 0x20 */ 0x5FA7, 0x5FAB, 0x5FA4, 0x5FAC, 0x5FAF, 0x5FB0, 0x5FB1, 0x5FB8, /* 0x30 */ 0x5FC4, 0x5FC7, 0x5FC8, 0x5FC9, 0x5FCB, 0x5FD0, 0x5FD1, 0x5FD2, /* 0x30 */ 0x5FD3, 0x5FD4, 0x5FDE, 0x5FE1, 0x5FE2, 0x5FE8, 0x5FE9, 0x5FEA, /* 0x40 */ 0x5FEC, 0x5FED, 0x5FEE, 0x5FEF, 0x5FF2, 0x5FF3, 0x5FF6, 0x5FFA, /* 0x40 */ 0x5FFC, 0x6007, 0x600A, 0x600D, 0x6013, 0x6014, 0x6017, 0x6018, /* 0x50 */ 0x601A, 0x601F, 0x6024, 0x602D, 0x6033, 0x6035, 0x6040, 0x6047, /* 0x50 */ 0x6048, 0x6049, 0x604C, 0x6051, 0x6054, 0x6056, 0x6057, 0x605D, /* 0x60 */ 0x6061, 0x6067, 0x6071, 0x607E, 0x607F, 0x6082, 0x6086, 0x6088, /* 0x60 */ 0x608A, 0x608E, 0x6091, 0x6093, 0x6095, 0x6098, 0x609D, 0x609E, /* 0x70 */ 0x60A2, 0x60A4, 0x60A5, 0x60A8, 0x60B0, 0x60B1, 0x60B7 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_3E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x60BB, 0x60BE, 0x60C2, 0x60C4, 0x60C8, 0x60C9, 0x60CA, /* 0x20 */ 0x60CB, 0x60CE, 0x60CF, 0x60D4, 0x60D5, 0x60D9, 0x60DB, 0x60DD, /* 0x20 */ 0x60DE, 0x60E2, 0x60E5, 0x60F2, 0x60F5, 0x60F8, 0x60FC, 0x60FD, /* 0x30 */ 0x6102, 0x6107, 0x610A, 0x610C, 0x6110, 0x6111, 0x6112, 0x6113, /* 0x30 */ 0x6114, 0x6116, 0x6117, 0x6119, 0x611C, 0x611E, 0x6122, 0x612A, /* 0x40 */ 0x612B, 0x6130, 0x6131, 0x6135, 0x6136, 0x6137, 0x6139, 0x6141, /* 0x40 */ 0x6145, 0x6146, 0x6149, 0x615E, 0x6160, 0x616C, 0x6172, 0x6178, /* 0x50 */ 0x617B, 0x617C, 0x617F, 0x6180, 0x6181, 0x6183, 0x6184, 0x618B, /* 0x50 */ 0x618D, 0x6192, 0x6193, 0x6197, 0x6198, 0x619C, 0x619D, 0x619F, /* 0x60 */ 0x61A0, 0x61A5, 0x61A8, 0x61AA, 0x61AD, 0x61B8, 0x61B9, 0x61BC, /* 0x60 */ 0x61C0, 0x61C1, 0x61C2, 0x61CE, 0x61CF, 0x61D5, 0x61DC, 0x61DD, /* 0x70 */ 0x61DE, 0x61DF, 0x61E1, 0x61E2, 0x61E7, 0x61E9, 0x61E5 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_3F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x61EC, 0x61ED, 0x61EF, 0x6201, 0x6203, 0x6204, 0x6207, /* 0x20 */ 0x6213, 0x6215, 0x621C, 0x6220, 0x6222, 0x6223, 0x6227, 0x6229, /* 0x20 */ 0x622B, 0x6239, 0x623D, 0x6242, 0x6243, 0x6244, 0x6246, 0x624C, /* 0x30 */ 0x6250, 0x6251, 0x6252, 0x6254, 0x6256, 0x625A, 0x625C, 0x6264, /* 0x30 */ 0x626D, 0x626F, 0x6273, 0x627A, 0x627D, 0x628D, 0x628E, 0x628F, /* 0x40 */ 0x6290, 0x62A6, 0x62A8, 0x62B3, 0x62B6, 0x62B7, 0x62BA, 0x62BE, /* 0x40 */ 0x62BF, 0x62C4, 0x62CE, 0x62D5, 0x62D6, 0x62DA, 0x62EA, 0x62F2, /* 0x50 */ 0x62F4, 0x62FC, 0x62FD, 0x6303, 0x6304, 0x630A, 0x630B, 0x630D, /* 0x50 */ 0x6310, 0x6313, 0x6316, 0x6318, 0x6329, 0x632A, 0x632D, 0x6335, /* 0x60 */ 0x6336, 0x6339, 0x633C, 0x6341, 0x6342, 0x6343, 0x6344, 0x6346, /* 0x60 */ 0x634A, 0x634B, 0x634E, 0x6352, 0x6353, 0x6354, 0x6358, 0x635B, /* 0x70 */ 0x6365, 0x6366, 0x636C, 0x636D, 0x6371, 0x6374, 0x6375 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_40[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6378, 0x637C, 0x637D, 0x637F, 0x6382, 0x6384, 0x6387, /* 0x20 */ 0x638A, 0x6390, 0x6394, 0x6395, 0x6399, 0x639A, 0x639E, 0x63A4, /* 0x20 */ 0x63A6, 0x63AD, 0x63AE, 0x63AF, 0x63BD, 0x63C1, 0x63C5, 0x63C8, /* 0x30 */ 0x63CE, 0x63D1, 0x63D3, 0x63D4, 0x63D5, 0x63DC, 0x63E0, 0x63E5, /* 0x30 */ 0x63EA, 0x63EC, 0x63F2, 0x63F3, 0x63F5, 0x63F8, 0x63F9, 0x6409, /* 0x40 */ 0x640A, 0x6410, 0x6412, 0x6414, 0x6418, 0x641E, 0x6420, 0x6422, /* 0x40 */ 0x6424, 0x6425, 0x6429, 0x642A, 0x642F, 0x6430, 0x6435, 0x643D, /* 0x50 */ 0x643F, 0x644B, 0x644F, 0x6451, 0x6452, 0x6453, 0x6454, 0x645A, /* 0x50 */ 0x645B, 0x645C, 0x645D, 0x645F, 0x6460, 0x6461, 0x6463, 0x646D, /* 0x60 */ 0x6473, 0x6474, 0x647B, 0x647D, 0x6485, 0x6487, 0x648F, 0x6490, /* 0x60 */ 0x6491, 0x6498, 0x6499, 0x649B, 0x649D, 0x649F, 0x64A1, 0x64A3, /* 0x70 */ 0x64A6, 0x64A8, 0x64AC, 0x64B3, 0x64BD, 0x64BE, 0x64BF /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_41[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x64C4, 0x64C9, 0x64CA, 0x64CB, 0x64CC, 0x64CE, 0x64D0, /* 0x20 */ 0x64D1, 0x64D5, 0x64D7, 0x64E4, 0x64E5, 0x64E9, 0x64EA, 0x64ED, /* 0x20 */ 0x64F0, 0x64F5, 0x64F7, 0x64FB, 0x64FF, 0x6501, 0x6504, 0x6508, /* 0x30 */ 0x6509, 0x650A, 0x650F, 0x6513, 0x6514, 0x6516, 0x6519, 0x651B, /* 0x30 */ 0x651E, 0x651F, 0x6522, 0x6526, 0x6529, 0x652E, 0x6531, 0x653A, /* 0x40 */ 0x653C, 0x653D, 0x6543, 0x6547, 0x6549, 0x6550, 0x6552, 0x6554, /* 0x40 */ 0x655F, 0x6560, 0x6567, 0x656B, 0x657A, 0x657D, 0x6581, 0x6585, /* 0x50 */ 0x658A, 0x6592, 0x6595, 0x6598, 0x659D, 0x65A0, 0x65A3, 0x65A6, /* 0x50 */ 0x65AE, 0x65B2, 0x65B3, 0x65B4, 0x65BF, 0x65C2, 0x65C8, 0x65C9, /* 0x60 */ 0x65CE, 0x65D0, 0x65D4, 0x65D6, 0x65D8, 0x65DF, 0x65F0, 0x65F2, /* 0x60 */ 0x65F4, 0x65F5, 0x65F9, 0x65FE, 0x65FF, 0x6600, 0x6604, 0x6608, /* 0x70 */ 0x6609, 0x660D, 0x6611, 0x6612, 0x6615, 0x6616, 0x661D /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_42[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x661E, 0x6621, 0x6622, 0x6623, 0x6624, 0x6626, 0x6629, /* 0x20 */ 0x662A, 0x662B, 0x662C, 0x662E, 0x6630, 0x6631, 0x6633, 0x6639, /* 0x20 */ 0x6637, 0x6640, 0x6645, 0x6646, 0x664A, 0x664C, 0x6651, 0x664E, /* 0x30 */ 0x6657, 0x6658, 0x6659, 0x665B, 0x665C, 0x6660, 0x6661, 0x66FB, /* 0x30 */ 0x666A, 0x666B, 0x666C, 0x667E, 0x6673, 0x6675, 0x667F, 0x6677, /* 0x40 */ 0x6678, 0x6679, 0x667B, 0x6680, 0x667C, 0x668B, 0x668C, 0x668D, /* 0x40 */ 0x6690, 0x6692, 0x6699, 0x669A, 0x669B, 0x669C, 0x669F, 0x66A0, /* 0x50 */ 0x66A4, 0x66AD, 0x66B1, 0x66B2, 0x66B5, 0x66BB, 0x66BF, 0x66C0, /* 0x50 */ 0x66C2, 0x66C3, 0x66C8, 0x66CC, 0x66CE, 0x66CF, 0x66D4, 0x66DB, /* 0x60 */ 0x66DF, 0x66E8, 0x66EB, 0x66EC, 0x66EE, 0x66FA, 0x6705, 0x6707, /* 0x60 */ 0x670E, 0x6713, 0x6719, 0x671C, 0x6720, 0x6722, 0x6733, 0x673E, /* 0x70 */ 0x6745, 0x6747, 0x6748, 0x674C, 0x6754, 0x6755, 0x675D /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_43[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6766, 0x676C, 0x676E, 0x6774, 0x6776, 0x677B, 0x6781, /* 0x20 */ 0x6784, 0x678E, 0x678F, 0x6791, 0x6793, 0x6796, 0x6798, 0x6799, /* 0x20 */ 0x679B, 0x67B0, 0x67B1, 0x67B2, 0x67B5, 0x67BB, 0x67BC, 0x67BD, /* 0x30 */ 0x67F9, 0x67C0, 0x67C2, 0x67C3, 0x67C5, 0x67C8, 0x67C9, 0x67D2, /* 0x30 */ 0x67D7, 0x67D9, 0x67DC, 0x67E1, 0x67E6, 0x67F0, 0x67F2, 0x67F6, /* 0x40 */ 0x67F7, 0x6852, 0x6814, 0x6819, 0x681D, 0x681F, 0x6828, 0x6827, /* 0x40 */ 0x682C, 0x682D, 0x682F, 0x6830, 0x6831, 0x6833, 0x683B, 0x683F, /* 0x50 */ 0x6844, 0x6845, 0x684A, 0x684C, 0x6855, 0x6857, 0x6858, 0x685B, /* 0x50 */ 0x686B, 0x686E, 0x686F, 0x6870, 0x6871, 0x6872, 0x6875, 0x6879, /* 0x60 */ 0x687A, 0x687B, 0x687C, 0x6882, 0x6884, 0x6886, 0x6888, 0x6896, /* 0x60 */ 0x6898, 0x689A, 0x689C, 0x68A1, 0x68A3, 0x68A5, 0x68A9, 0x68AA, /* 0x70 */ 0x68AE, 0x68B2, 0x68BB, 0x68C5, 0x68C8, 0x68CC, 0x68CF /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_44[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x68D0, 0x68D1, 0x68D3, 0x68D6, 0x68D9, 0x68DC, 0x68DD, /* 0x20 */ 0x68E5, 0x68E8, 0x68EA, 0x68EB, 0x68EC, 0x68ED, 0x68F0, 0x68F1, /* 0x20 */ 0x68F5, 0x68F6, 0x68FB, 0x68FC, 0x68FD, 0x6906, 0x6909, 0x690A, /* 0x30 */ 0x6910, 0x6911, 0x6913, 0x6916, 0x6917, 0x6931, 0x6933, 0x6935, /* 0x30 */ 0x6938, 0x693B, 0x6942, 0x6945, 0x6949, 0x694E, 0x6957, 0x695B, /* 0x40 */ 0x6963, 0x6964, 0x6965, 0x6966, 0x6968, 0x6969, 0x696C, 0x6970, /* 0x40 */ 0x6971, 0x6972, 0x697A, 0x697B, 0x697F, 0x6980, 0x698D, 0x6992, /* 0x50 */ 0x6996, 0x6998, 0x69A1, 0x69A5, 0x69A6, 0x69A8, 0x69AB, 0x69AD, /* 0x50 */ 0x69AF, 0x69B7, 0x69B8, 0x69BA, 0x69BC, 0x69C5, 0x69C8, 0x69D1, /* 0x60 */ 0x69D6, 0x69D7, 0x69E2, 0x69E5, 0x69EE, 0x69EF, 0x69F1, 0x69F3, /* 0x60 */ 0x69F5, 0x69FE, 0x6A00, 0x6A01, 0x6A03, 0x6A0F, 0x6A11, 0x6A15, /* 0x70 */ 0x6A1A, 0x6A1D, 0x6A20, 0x6A24, 0x6A28, 0x6A30, 0x6A32 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_45[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6A34, 0x6A37, 0x6A3B, 0x6A3E, 0x6A3F, 0x6A45, 0x6A46, /* 0x20 */ 0x6A49, 0x6A4A, 0x6A4E, 0x6A50, 0x6A51, 0x6A52, 0x6A55, 0x6A56, /* 0x20 */ 0x6A5B, 0x6A64, 0x6A67, 0x6A6A, 0x6A71, 0x6A73, 0x6A7E, 0x6A81, /* 0x30 */ 0x6A83, 0x6A86, 0x6A87, 0x6A89, 0x6A8B, 0x6A91, 0x6A9B, 0x6A9D, /* 0x30 */ 0x6A9E, 0x6A9F, 0x6AA5, 0x6AAB, 0x6AAF, 0x6AB0, 0x6AB1, 0x6AB4, /* 0x40 */ 0x6ABD, 0x6ABE, 0x6ABF, 0x6AC6, 0x6AC9, 0x6AC8, 0x6ACC, 0x6AD0, /* 0x40 */ 0x6AD4, 0x6AD5, 0x6AD6, 0x6ADC, 0x6ADD, 0x6AE4, 0x6AE7, 0x6AEC, /* 0x50 */ 0x6AF0, 0x6AF1, 0x6AF2, 0x6AFC, 0x6AFD, 0x6B02, 0x6B03, 0x6B06, /* 0x50 */ 0x6B07, 0x6B09, 0x6B0F, 0x6B10, 0x6B11, 0x6B17, 0x6B1B, 0x6B1E, /* 0x60 */ 0x6B24, 0x6B28, 0x6B2B, 0x6B2C, 0x6B2F, 0x6B35, 0x6B36, 0x6B3B, /* 0x60 */ 0x6B3F, 0x6B46, 0x6B4A, 0x6B4D, 0x6B52, 0x6B56, 0x6B58, 0x6B5D, /* 0x70 */ 0x6B60, 0x6B67, 0x6B6B, 0x6B6E, 0x6B70, 0x6B75, 0x6B7D /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_46[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6B7E, 0x6B82, 0x6B85, 0x6B97, 0x6B9B, 0x6B9F, 0x6BA0, /* 0x20 */ 0x6BA2, 0x6BA3, 0x6BA8, 0x6BA9, 0x6BAC, 0x6BAD, 0x6BAE, 0x6BB0, /* 0x20 */ 0x6BB8, 0x6BB9, 0x6BBD, 0x6BBE, 0x6BC3, 0x6BC4, 0x6BC9, 0x6BCC, /* 0x30 */ 0x6BD6, 0x6BDA, 0x6BE1, 0x6BE3, 0x6BE6, 0x6BE7, 0x6BEE, 0x6BF1, /* 0x30 */ 0x6BF7, 0x6BF9, 0x6BFF, 0x6C02, 0x6C04, 0x6C05, 0x6C09, 0x6C0D, /* 0x40 */ 0x6C0E, 0x6C10, 0x6C12, 0x6C19, 0x6C1F, 0x6C26, 0x6C27, 0x6C28, /* 0x40 */ 0x6C2C, 0x6C2E, 0x6C33, 0x6C35, 0x6C36, 0x6C3A, 0x6C3B, 0x6C3F, /* 0x50 */ 0x6C4A, 0x6C4B, 0x6C4D, 0x6C4F, 0x6C52, 0x6C54, 0x6C59, 0x6C5B, /* 0x50 */ 0x6C5C, 0x6C6B, 0x6C6D, 0x6C6F, 0x6C74, 0x6C76, 0x6C78, 0x6C79, /* 0x60 */ 0x6C7B, 0x6C85, 0x6C86, 0x6C87, 0x6C89, 0x6C94, 0x6C95, 0x6C97, /* 0x60 */ 0x6C98, 0x6C9C, 0x6C9F, 0x6CB0, 0x6CB2, 0x6CB4, 0x6CC2, 0x6CC6, /* 0x70 */ 0x6CCD, 0x6CCF, 0x6CD0, 0x6CD1, 0x6CD2, 0x6CD4, 0x6CD6 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_47[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6CDA, 0x6CDC, 0x6CE0, 0x6CE7, 0x6CE9, 0x6CEB, 0x6CEC, /* 0x20 */ 0x6CEE, 0x6CF2, 0x6CF4, 0x6D04, 0x6D07, 0x6D0A, 0x6D0E, 0x6D0F, /* 0x20 */ 0x6D11, 0x6D13, 0x6D1A, 0x6D26, 0x6D27, 0x6D28, 0x6C67, 0x6D2E, /* 0x30 */ 0x6D2F, 0x6D31, 0x6D39, 0x6D3C, 0x6D3F, 0x6D57, 0x6D5E, 0x6D5F, /* 0x30 */ 0x6D61, 0x6D65, 0x6D67, 0x6D6F, 0x6D70, 0x6D7C, 0x6D82, 0x6D87, /* 0x40 */ 0x6D91, 0x6D92, 0x6D94, 0x6D96, 0x6D97, 0x6D98, 0x6DAA, 0x6DAC, /* 0x40 */ 0x6DB4, 0x6DB7, 0x6DB9, 0x6DBD, 0x6DBF, 0x6DC4, 0x6DC8, 0x6DCA, /* 0x50 */ 0x6DCE, 0x6DCF, 0x6DD6, 0x6DDB, 0x6DDD, 0x6DDF, 0x6DE0, 0x6DE2, /* 0x50 */ 0x6DE5, 0x6DE9, 0x6DEF, 0x6DF0, 0x6DF4, 0x6DF6, 0x6DFC, 0x6E00, /* 0x60 */ 0x6E04, 0x6E1E, 0x6E22, 0x6E27, 0x6E32, 0x6E36, 0x6E39, 0x6E3B, /* 0x60 */ 0x6E3C, 0x6E44, 0x6E45, 0x6E48, 0x6E49, 0x6E4B, 0x6E4F, 0x6E51, /* 0x70 */ 0x6E52, 0x6E53, 0x6E54, 0x6E57, 0x6E5C, 0x6E5D, 0x6E5E /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_48[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6E62, 0x6E63, 0x6E68, 0x6E73, 0x6E7B, 0x6E7D, 0x6E8D, /* 0x20 */ 0x6E93, 0x6E99, 0x6EA0, 0x6EA7, 0x6EAD, 0x6EAE, 0x6EB1, 0x6EB3, /* 0x20 */ 0x6EBB, 0x6EBF, 0x6EC0, 0x6EC1, 0x6EC3, 0x6EC7, 0x6EC8, 0x6ECA, /* 0x30 */ 0x6ECD, 0x6ECE, 0x6ECF, 0x6EEB, 0x6EED, 0x6EEE, 0x6EF9, 0x6EFB, /* 0x30 */ 0x6EFD, 0x6F04, 0x6F08, 0x6F0A, 0x6F0C, 0x6F0D, 0x6F16, 0x6F18, /* 0x40 */ 0x6F1A, 0x6F1B, 0x6F26, 0x6F29, 0x6F2A, 0x6F2F, 0x6F30, 0x6F33, /* 0x40 */ 0x6F36, 0x6F3B, 0x6F3C, 0x6F2D, 0x6F4F, 0x6F51, 0x6F52, 0x6F53, /* 0x50 */ 0x6F57, 0x6F59, 0x6F5A, 0x6F5D, 0x6F5E, 0x6F61, 0x6F62, 0x6F68, /* 0x50 */ 0x6F6C, 0x6F7D, 0x6F7E, 0x6F83, 0x6F87, 0x6F88, 0x6F8B, 0x6F8C, /* 0x60 */ 0x6F8D, 0x6F90, 0x6F92, 0x6F93, 0x6F94, 0x6F96, 0x6F9A, 0x6F9F, /* 0x60 */ 0x6FA0, 0x6FA5, 0x6FA6, 0x6FA7, 0x6FA8, 0x6FAE, 0x6FAF, 0x6FB0, /* 0x70 */ 0x6FB5, 0x6FB6, 0x6FBC, 0x6FC5, 0x6FC7, 0x6FC8, 0x6FCA /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_49[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x6FDA, 0x6FDE, 0x6FE8, 0x6FE9, 0x6FF0, 0x6FF5, 0x6FF9, /* 0x20 */ 0x6FFC, 0x6FFD, 0x7000, 0x7005, 0x7006, 0x7007, 0x700D, 0x7017, /* 0x20 */ 0x7020, 0x7023, 0x702F, 0x7034, 0x7037, 0x7039, 0x703C, 0x7043, /* 0x30 */ 0x7044, 0x7048, 0x7049, 0x704A, 0x704B, 0x7054, 0x7055, 0x705D, /* 0x30 */ 0x705E, 0x704E, 0x7064, 0x7065, 0x706C, 0x706E, 0x7075, 0x7076, /* 0x40 */ 0x707E, 0x7081, 0x7085, 0x7086, 0x7094, 0x7095, 0x7096, 0x7097, /* 0x40 */ 0x7098, 0x709B, 0x70A4, 0x70AB, 0x70B0, 0x70B1, 0x70B4, 0x70B7, /* 0x50 */ 0x70CA, 0x70D1, 0x70D3, 0x70D4, 0x70D5, 0x70D6, 0x70D8, 0x70DC, /* 0x50 */ 0x70E4, 0x70FA, 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x710B, /* 0x60 */ 0x710C, 0x710F, 0x711E, 0x7120, 0x712B, 0x712D, 0x712F, 0x7130, /* 0x60 */ 0x7131, 0x7138, 0x7141, 0x7145, 0x7146, 0x7147, 0x714A, 0x714B, /* 0x70 */ 0x7150, 0x7152, 0x7157, 0x715A, 0x715C, 0x715E, 0x7160 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_4A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7168, 0x7179, 0x7180, 0x7185, 0x7187, 0x718C, 0x7192, /* 0x20 */ 0x719A, 0x719B, 0x71A0, 0x71A2, 0x71AF, 0x71B0, 0x71B2, 0x71B3, /* 0x20 */ 0x71BA, 0x71BF, 0x71C0, 0x71C1, 0x71C4, 0x71CB, 0x71CC, 0x71D3, /* 0x30 */ 0x71D6, 0x71D9, 0x71DA, 0x71DC, 0x71F8, 0x71FE, 0x7200, 0x7207, /* 0x30 */ 0x7208, 0x7209, 0x7213, 0x7217, 0x721A, 0x721D, 0x721F, 0x7224, /* 0x40 */ 0x722B, 0x722F, 0x7234, 0x7238, 0x7239, 0x7241, 0x7242, 0x7243, /* 0x40 */ 0x7245, 0x724E, 0x724F, 0x7250, 0x7253, 0x7255, 0x7256, 0x725A, /* 0x50 */ 0x725C, 0x725E, 0x7260, 0x7263, 0x7268, 0x726B, 0x726E, 0x726F, /* 0x50 */ 0x7271, 0x7277, 0x7278, 0x727B, 0x727C, 0x727F, 0x7284, 0x7289, /* 0x60 */ 0x728D, 0x728E, 0x7293, 0x729B, 0x72A8, 0x72AD, 0x72AE, 0x72B1, /* 0x60 */ 0x72B4, 0x72BE, 0x72C1, 0x72C7, 0x72C9, 0x72CC, 0x72D5, 0x72D6, /* 0x70 */ 0x72D8, 0x72DF, 0x72E5, 0x72F3, 0x72F4, 0x72FA, 0x72FB /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_4B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x72FE, 0x7302, 0x7304, 0x7305, 0x7307, 0x730B, 0x730D, /* 0x20 */ 0x7312, 0x7313, 0x7318, 0x7319, 0x731E, 0x7322, 0x7324, 0x7327, /* 0x20 */ 0x7328, 0x732C, 0x7331, 0x7332, 0x7335, 0x733A, 0x733B, 0x733D, /* 0x30 */ 0x7343, 0x734D, 0x7350, 0x7352, 0x7356, 0x7358, 0x735D, 0x735E, /* 0x30 */ 0x735F, 0x7360, 0x7366, 0x7367, 0x7369, 0x736B, 0x736C, 0x736E, /* 0x40 */ 0x736F, 0x7371, 0x7377, 0x7379, 0x737C, 0x7380, 0x7381, 0x7383, /* 0x40 */ 0x7385, 0x7386, 0x738E, 0x7390, 0x7393, 0x7395, 0x7397, 0x7398, /* 0x50 */ 0x739C, 0x739E, 0x739F, 0x73A0, 0x73A2, 0x73A5, 0x73A6, 0x73AA, /* 0x50 */ 0x73AB, 0x73AD, 0x73B5, 0x73B7, 0x73B9, 0x73BC, 0x73BD, 0x73BF, /* 0x60 */ 0x73C5, 0x73C6, 0x73C9, 0x73CB, 0x73CC, 0x73CF, 0x73D2, 0x73D3, /* 0x60 */ 0x73D6, 0x73D9, 0x73DD, 0x73E1, 0x73E3, 0x73E6, 0x73E7, 0x73E9, /* 0x70 */ 0x73F4, 0x73F5, 0x73F7, 0x73F9, 0x73FA, 0x73FB, 0x73FD /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_4C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x73FF, 0x7400, 0x7401, 0x7404, 0x7407, 0x740A, 0x7411, /* 0x20 */ 0x741A, 0x741B, 0x7424, 0x7426, 0x7428, 0x7429, 0x742A, 0x742B, /* 0x20 */ 0x742C, 0x742D, 0x742E, 0x742F, 0x7430, 0x7431, 0x7439, 0x7440, /* 0x30 */ 0x7443, 0x7444, 0x7446, 0x7447, 0x744B, 0x744D, 0x7451, 0x7452, /* 0x30 */ 0x7457, 0x745D, 0x7462, 0x7466, 0x7467, 0x7468, 0x746B, 0x746D, /* 0x40 */ 0x746E, 0x7471, 0x7472, 0x7480, 0x7481, 0x7485, 0x7486, 0x7487, /* 0x40 */ 0x7489, 0x748F, 0x7490, 0x7491, 0x7492, 0x7498, 0x7499, 0x749A, /* 0x50 */ 0x749C, 0x749F, 0x74A0, 0x74A1, 0x74A3, 0x74A6, 0x74A8, 0x74A9, /* 0x50 */ 0x74AA, 0x74AB, 0x74AE, 0x74AF, 0x74B1, 0x74B2, 0x74B5, 0x74B9, /* 0x60 */ 0x74BB, 0x74BF, 0x74C8, 0x74C9, 0x74CC, 0x74D0, 0x74D3, 0x74D8, /* 0x60 */ 0x74DA, 0x74DB, 0x74DE, 0x74DF, 0x74E4, 0x74E8, 0x74EA, 0x74EB, /* 0x70 */ 0x74EF, 0x74F4, 0x74FA, 0x74FB, 0x74FC, 0x74FF, 0x7506 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_4D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7512, 0x7516, 0x7517, 0x7520, 0x7521, 0x7524, 0x7527, /* 0x20 */ 0x7529, 0x752A, 0x752F, 0x7536, 0x7539, 0x753D, 0x753E, 0x753F, /* 0x20 */ 0x7540, 0x7543, 0x7547, 0x7548, 0x754E, 0x7550, 0x7552, 0x7557, /* 0x30 */ 0x755E, 0x755F, 0x7561, 0x756F, 0x7571, 0x7579, 0x757A, 0x757B, /* 0x30 */ 0x757C, 0x757D, 0x757E, 0x7581, 0x7585, 0x7590, 0x7592, 0x7593, /* 0x40 */ 0x7595, 0x7599, 0x759C, 0x75A2, 0x75A4, 0x75B4, 0x75BA, 0x75BF, /* 0x40 */ 0x75C0, 0x75C1, 0x75C4, 0x75C6, 0x75CC, 0x75CE, 0x75CF, 0x75D7, /* 0x50 */ 0x75DC, 0x75DF, 0x75E0, 0x75E1, 0x75E4, 0x75E7, 0x75EC, 0x75EE, /* 0x50 */ 0x75EF, 0x75F1, 0x75F9, 0x7600, 0x7602, 0x7603, 0x7604, 0x7607, /* 0x60 */ 0x7608, 0x760A, 0x760C, 0x760F, 0x7612, 0x7613, 0x7615, 0x7616, /* 0x60 */ 0x7619, 0x761B, 0x761C, 0x761D, 0x761E, 0x7623, 0x7625, 0x7626, /* 0x70 */ 0x7629, 0x762D, 0x7632, 0x7633, 0x7635, 0x7638, 0x7639 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_4E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x763A, 0x763C, 0x764A, 0x7640, 0x7641, 0x7643, 0x7644, /* 0x20 */ 0x7645, 0x7649, 0x764B, 0x7655, 0x7659, 0x765F, 0x7664, 0x7665, /* 0x20 */ 0x766D, 0x766E, 0x766F, 0x7671, 0x7674, 0x7681, 0x7685, 0x768C, /* 0x30 */ 0x768D, 0x7695, 0x769B, 0x769C, 0x769D, 0x769F, 0x76A0, 0x76A2, /* 0x30 */ 0x76A3, 0x76A4, 0x76A5, 0x76A6, 0x76A7, 0x76A8, 0x76AA, 0x76AD, /* 0x40 */ 0x76BD, 0x76C1, 0x76C5, 0x76C9, 0x76CB, 0x76CC, 0x76CE, 0x76D4, /* 0x40 */ 0x76D9, 0x76E0, 0x76E6, 0x76E8, 0x76EC, 0x76F0, 0x76F1, 0x76F6, /* 0x50 */ 0x76F9, 0x76FC, 0x7700, 0x7706, 0x770A, 0x770E, 0x7712, 0x7714, /* 0x50 */ 0x7715, 0x7717, 0x7719, 0x771A, 0x771C, 0x7722, 0x7728, 0x772D, /* 0x60 */ 0x772E, 0x772F, 0x7734, 0x7735, 0x7736, 0x7739, 0x773D, 0x773E, /* 0x60 */ 0x7742, 0x7745, 0x7746, 0x774A, 0x774D, 0x774E, 0x774F, 0x7752, /* 0x70 */ 0x7756, 0x7757, 0x775C, 0x775E, 0x775F, 0x7760, 0x7762 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_4F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7764, 0x7767, 0x776A, 0x776C, 0x7770, 0x7772, 0x7773, /* 0x20 */ 0x7774, 0x777A, 0x777D, 0x7780, 0x7784, 0x778C, 0x778D, 0x7794, /* 0x20 */ 0x7795, 0x7796, 0x779A, 0x779F, 0x77A2, 0x77A7, 0x77AA, 0x77AE, /* 0x30 */ 0x77AF, 0x77B1, 0x77B5, 0x77BE, 0x77C3, 0x77C9, 0x77D1, 0x77D2, /* 0x30 */ 0x77D5, 0x77D9, 0x77DE, 0x77DF, 0x77E0, 0x77E4, 0x77E6, 0x77EA, /* 0x40 */ 0x77EC, 0x77F0, 0x77F1, 0x77F4, 0x77F8, 0x77FB, 0x7805, 0x7806, /* 0x40 */ 0x7809, 0x780D, 0x780E, 0x7811, 0x781D, 0x7821, 0x7822, 0x7823, /* 0x50 */ 0x782D, 0x782E, 0x7830, 0x7835, 0x7837, 0x7843, 0x7844, 0x7847, /* 0x50 */ 0x7848, 0x784C, 0x784E, 0x7852, 0x785C, 0x785E, 0x7860, 0x7861, /* 0x60 */ 0x7863, 0x7864, 0x7868, 0x786A, 0x786E, 0x787A, 0x787E, 0x788A, /* 0x60 */ 0x788F, 0x7894, 0x7898, 0x78A1, 0x789D, 0x789E, 0x789F, 0x78A4, /* 0x70 */ 0x78A8, 0x78AC, 0x78AD, 0x78B0, 0x78B1, 0x78B2, 0x78B3 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_50[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x78BB, 0x78BD, 0x78BF, 0x78C7, 0x78C8, 0x78C9, 0x78CC, /* 0x20 */ 0x78CE, 0x78D2, 0x78D3, 0x78D5, 0x78D6, 0x78E4, 0x78DB, 0x78DF, /* 0x20 */ 0x78E0, 0x78E1, 0x78E6, 0x78EA, 0x78F2, 0x78F3, 0x7900, 0x78F6, /* 0x30 */ 0x78F7, 0x78FA, 0x78FB, 0x78FF, 0x7906, 0x790C, 0x7910, 0x791A, /* 0x30 */ 0x791C, 0x791E, 0x791F, 0x7920, 0x7925, 0x7927, 0x7929, 0x792D, /* 0x40 */ 0x7931, 0x7934, 0x7935, 0x793B, 0x793D, 0x793F, 0x7944, 0x7945, /* 0x40 */ 0x7946, 0x794A, 0x794B, 0x794F, 0x7951, 0x7954, 0x7958, 0x795B, /* 0x50 */ 0x795C, 0x7967, 0x7969, 0x796B, 0x7972, 0x7979, 0x797B, 0x797C, /* 0x50 */ 0x797E, 0x798B, 0x798C, 0x7991, 0x7993, 0x7994, 0x7995, 0x7996, /* 0x60 */ 0x7998, 0x799B, 0x799C, 0x79A1, 0x79A8, 0x79A9, 0x79AB, 0x79AF, /* 0x60 */ 0x79B1, 0x79B4, 0x79B8, 0x79BB, 0x79C2, 0x79C4, 0x79C7, 0x79C8, /* 0x70 */ 0x79CA, 0x79CF, 0x79D4, 0x79D6, 0x79DA, 0x79DD, 0x79DE /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_51[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x79E0, 0x79E2, 0x79E5, 0x79EA, 0x79EB, 0x79ED, 0x79F1, /* 0x20 */ 0x79F8, 0x79FC, 0x7A02, 0x7A03, 0x7A07, 0x7A09, 0x7A0A, 0x7A0C, /* 0x20 */ 0x7A11, 0x7A15, 0x7A1B, 0x7A1E, 0x7A21, 0x7A27, 0x7A2B, 0x7A2D, /* 0x30 */ 0x7A2F, 0x7A30, 0x7A34, 0x7A35, 0x7A38, 0x7A39, 0x7A3A, 0x7A44, /* 0x30 */ 0x7A45, 0x7A47, 0x7A48, 0x7A4C, 0x7A55, 0x7A56, 0x7A59, 0x7A5C, /* 0x40 */ 0x7A5D, 0x7A5F, 0x7A60, 0x7A65, 0x7A67, 0x7A6A, 0x7A6D, 0x7A75, /* 0x40 */ 0x7A78, 0x7A7E, 0x7A80, 0x7A82, 0x7A85, 0x7A86, 0x7A8A, 0x7A8B, /* 0x50 */ 0x7A90, 0x7A91, 0x7A94, 0x7A9E, 0x7AA0, 0x7AA3, 0x7AAC, 0x7AB3, /* 0x50 */ 0x7AB5, 0x7AB9, 0x7ABB, 0x7ABC, 0x7AC6, 0x7AC9, 0x7ACC, 0x7ACE, /* 0x60 */ 0x7AD1, 0x7ADB, 0x7AE8, 0x7AE9, 0x7AEB, 0x7AEC, 0x7AF1, 0x7AF4, /* 0x60 */ 0x7AFB, 0x7AFD, 0x7AFE, 0x7B07, 0x7B14, 0x7B1F, 0x7B23, 0x7B27, /* 0x70 */ 0x7B29, 0x7B2A, 0x7B2B, 0x7B2D, 0x7B2E, 0x7B2F, 0x7B30 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_52[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7B31, 0x7B34, 0x7B3D, 0x7B3F, 0x7B40, 0x7B41, 0x7B47, /* 0x20 */ 0x7B4E, 0x7B55, 0x7B60, 0x7B64, 0x7B66, 0x7B69, 0x7B6A, 0x7B6D, /* 0x20 */ 0x7B6F, 0x7B72, 0x7B73, 0x7B77, 0x7B84, 0x7B89, 0x7B8E, 0x7B90, /* 0x30 */ 0x7B91, 0x7B96, 0x7B9B, 0x7B9E, 0x7BA0, 0x7BA5, 0x7BAC, 0x7BAF, /* 0x30 */ 0x7BB0, 0x7BB2, 0x7BB5, 0x7BB6, 0x7BBA, 0x7BBB, 0x7BBC, 0x7BBD, /* 0x40 */ 0x7BC2, 0x7BC5, 0x7BC8, 0x7BCA, 0x7BD4, 0x7BD6, 0x7BD7, 0x7BD9, /* 0x40 */ 0x7BDA, 0x7BDB, 0x7BE8, 0x7BEA, 0x7BF2, 0x7BF4, 0x7BF5, 0x7BF8, /* 0x50 */ 0x7BF9, 0x7BFA, 0x7BFC, 0x7BFE, 0x7C01, 0x7C02, 0x7C03, 0x7C04, /* 0x50 */ 0x7C06, 0x7C09, 0x7C0B, 0x7C0C, 0x7C0E, 0x7C0F, 0x7C19, 0x7C1B, /* 0x60 */ 0x7C20, 0x7C25, 0x7C26, 0x7C28, 0x7C2C, 0x7C31, 0x7C33, 0x7C34, /* 0x60 */ 0x7C36, 0x7C39, 0x7C3A, 0x7C46, 0x7C4A, 0x7C55, 0x7C51, 0x7C52, /* 0x70 */ 0x7C53, 0x7C59, 0x7C5A, 0x7C5B, 0x7C5C, 0x7C5D, 0x7C5E /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_53[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7C61, 0x7C63, 0x7C67, 0x7C69, 0x7C6D, 0x7C6E, 0x7C70, /* 0x20 */ 0x7C72, 0x7C79, 0x7C7C, 0x7C7D, 0x7C86, 0x7C87, 0x7C8F, 0x7C94, /* 0x20 */ 0x7C9E, 0x7CA0, 0x7CA6, 0x7CB0, 0x7CB6, 0x7CB7, 0x7CBA, 0x7CBB, /* 0x30 */ 0x7CBC, 0x7CBF, 0x7CC4, 0x7CC7, 0x7CC8, 0x7CC9, 0x7CCD, 0x7CCF, /* 0x30 */ 0x7CD3, 0x7CD4, 0x7CD5, 0x7CD7, 0x7CD9, 0x7CDA, 0x7CDD, 0x7CE6, /* 0x40 */ 0x7CE9, 0x7CEB, 0x7CF5, 0x7D03, 0x7D07, 0x7D08, 0x7D09, 0x7D0F, /* 0x40 */ 0x7D11, 0x7D12, 0x7D13, 0x7D16, 0x7D1D, 0x7D1E, 0x7D23, 0x7D26, /* 0x50 */ 0x7D2A, 0x7D2D, 0x7D31, 0x7D3C, 0x7D3D, 0x7D3E, 0x7D40, 0x7D41, /* 0x50 */ 0x7D47, 0x7D48, 0x7D4D, 0x7D51, 0x7D53, 0x7D57, 0x7D59, 0x7D5A, /* 0x60 */ 0x7D5C, 0x7D5D, 0x7D65, 0x7D67, 0x7D6A, 0x7D70, 0x7D78, 0x7D7A, /* 0x60 */ 0x7D7B, 0x7D7F, 0x7D81, 0x7D82, 0x7D83, 0x7D85, 0x7D86, 0x7D88, /* 0x70 */ 0x7D8B, 0x7D8C, 0x7D8D, 0x7D91, 0x7D96, 0x7D97, 0x7D9D /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_54[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7D9E, 0x7DA6, 0x7DA7, 0x7DAA, 0x7DB3, 0x7DB6, 0x7DB7, /* 0x20 */ 0x7DB9, 0x7DC2, 0x7DC3, 0x7DC4, 0x7DC5, 0x7DC6, 0x7DCC, 0x7DCD, /* 0x20 */ 0x7DCE, 0x7DD7, 0x7DD9, 0x7E00, 0x7DE2, 0x7DE5, 0x7DE6, 0x7DEA, /* 0x30 */ 0x7DEB, 0x7DED, 0x7DF1, 0x7DF5, 0x7DF6, 0x7DF9, 0x7DFA, 0x7E08, /* 0x30 */ 0x7E10, 0x7E11, 0x7E15, 0x7E17, 0x7E1C, 0x7E1D, 0x7E20, 0x7E27, /* 0x40 */ 0x7E28, 0x7E2C, 0x7E2D, 0x7E2F, 0x7E33, 0x7E36, 0x7E3F, 0x7E44, /* 0x40 */ 0x7E45, 0x7E47, 0x7E4E, 0x7E50, 0x7E52, 0x7E58, 0x7E5F, 0x7E61, /* 0x50 */ 0x7E62, 0x7E65, 0x7E6B, 0x7E6E, 0x7E6F, 0x7E73, 0x7E78, 0x7E7E, /* 0x50 */ 0x7E81, 0x7E86, 0x7E87, 0x7E8A, 0x7E8D, 0x7E91, 0x7E95, 0x7E98, /* 0x60 */ 0x7E9A, 0x7E9D, 0x7E9E, 0x7F3C, 0x7F3B, 0x7F3D, 0x7F3E, 0x7F3F, /* 0x60 */ 0x7F43, 0x7F44, 0x7F47, 0x7F4F, 0x7F52, 0x7F53, 0x7F5B, 0x7F5C, /* 0x70 */ 0x7F5D, 0x7F61, 0x7F63, 0x7F64, 0x7F65, 0x7F66, 0x7F6D /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_55[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x7F71, 0x7F7D, 0x7F7E, 0x7F7F, 0x7F80, 0x7F8B, 0x7F8D, /* 0x20 */ 0x7F8F, 0x7F90, 0x7F91, 0x7F96, 0x7F97, 0x7F9C, 0x7FA1, 0x7FA2, /* 0x20 */ 0x7FA6, 0x7FAA, 0x7FAD, 0x7FB4, 0x7FBC, 0x7FBF, 0x7FC0, 0x7FC3, /* 0x30 */ 0x7FC8, 0x7FCE, 0x7FCF, 0x7FDB, 0x7FDF, 0x7FE3, 0x7FE5, 0x7FE8, /* 0x30 */ 0x7FEC, 0x7FEE, 0x7FEF, 0x7FF2, 0x7FFA, 0x7FFD, 0x7FFE, 0x7FFF, /* 0x40 */ 0x8007, 0x8008, 0x800A, 0x800D, 0x800E, 0x800F, 0x8011, 0x8013, /* 0x40 */ 0x8014, 0x8016, 0x801D, 0x801E, 0x801F, 0x8020, 0x8024, 0x8026, /* 0x50 */ 0x802C, 0x802E, 0x8030, 0x8034, 0x8035, 0x8037, 0x8039, 0x803A, /* 0x50 */ 0x803C, 0x803E, 0x8040, 0x8044, 0x8060, 0x8064, 0x8066, 0x806D, /* 0x60 */ 0x8071, 0x8075, 0x8081, 0x8088, 0x808E, 0x809C, 0x809E, 0x80A6, /* 0x60 */ 0x80A7, 0x80AB, 0x80B8, 0x80B9, 0x80C8, 0x80CD, 0x80CF, 0x80D2, /* 0x70 */ 0x80D4, 0x80D5, 0x80D7, 0x80D8, 0x80E0, 0x80ED, 0x80EE /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_56[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x80F0, 0x80F2, 0x80F3, 0x80F6, 0x80F9, 0x80FA, 0x80FE, /* 0x20 */ 0x8103, 0x810B, 0x8116, 0x8117, 0x8118, 0x811C, 0x811E, 0x8120, /* 0x20 */ 0x8124, 0x8127, 0x812C, 0x8130, 0x8135, 0x813A, 0x813C, 0x8145, /* 0x30 */ 0x8147, 0x814A, 0x814C, 0x8152, 0x8157, 0x8160, 0x8161, 0x8167, /* 0x30 */ 0x8168, 0x8169, 0x816D, 0x816F, 0x8177, 0x8181, 0x8190, 0x8184, /* 0x40 */ 0x8185, 0x8186, 0x818B, 0x818E, 0x8196, 0x8198, 0x819B, 0x819E, /* 0x40 */ 0x81A2, 0x81AE, 0x81B2, 0x81B4, 0x81BB, 0x81CB, 0x81C3, 0x81C5, /* 0x50 */ 0x81CA, 0x81CE, 0x81CF, 0x81D5, 0x81D7, 0x81DB, 0x81DD, 0x81DE, /* 0x50 */ 0x81E1, 0x81E4, 0x81EB, 0x81EC, 0x81F0, 0x81F1, 0x81F2, 0x81F5, /* 0x60 */ 0x81F6, 0x81F8, 0x81F9, 0x81FD, 0x81FF, 0x8200, 0x8203, 0x820F, /* 0x60 */ 0x8213, 0x8214, 0x8219, 0x821A, 0x821D, 0x8221, 0x8222, 0x8228, /* 0x70 */ 0x8232, 0x8234, 0x823A, 0x8243, 0x8244, 0x8245, 0x8246 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_57[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x824B, 0x824E, 0x824F, 0x8251, 0x8256, 0x825C, 0x8260, /* 0x20 */ 0x8263, 0x8267, 0x826D, 0x8274, 0x827B, 0x827D, 0x827F, 0x8280, /* 0x20 */ 0x8281, 0x8283, 0x8284, 0x8287, 0x8289, 0x828A, 0x828E, 0x8291, /* 0x30 */ 0x8294, 0x8296, 0x8298, 0x829A, 0x829B, 0x82A0, 0x82A1, 0x82A3, /* 0x30 */ 0x82A4, 0x82A7, 0x82A8, 0x82A9, 0x82AA, 0x82AE, 0x82B0, 0x82B2, /* 0x40 */ 0x82B4, 0x82B7, 0x82BA, 0x82BC, 0x82BE, 0x82BF, 0x82C6, 0x82D0, /* 0x40 */ 0x82D5, 0x82DA, 0x82E0, 0x82E2, 0x82E4, 0x82E8, 0x82EA, 0x82ED, /* 0x50 */ 0x82EF, 0x82F6, 0x82F7, 0x82FD, 0x82FE, 0x8300, 0x8301, 0x8307, /* 0x50 */ 0x8308, 0x830A, 0x830B, 0x8354, 0x831B, 0x831D, 0x831E, 0x831F, /* 0x60 */ 0x8321, 0x8322, 0x832C, 0x832D, 0x832E, 0x8330, 0x8333, 0x8337, /* 0x60 */ 0x833A, 0x833C, 0x833D, 0x8342, 0x8343, 0x8344, 0x8347, 0x834D, /* 0x70 */ 0x834E, 0x8351, 0x8355, 0x8356, 0x8357, 0x8370, 0x8378 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_58[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x837D, 0x837F, 0x8380, 0x8382, 0x8384, 0x8386, 0x838D, /* 0x20 */ 0x8392, 0x8394, 0x8395, 0x8398, 0x8399, 0x839B, 0x839C, 0x839D, /* 0x20 */ 0x83A6, 0x83A7, 0x83A9, 0x83AC, 0x83BE, 0x83BF, 0x83C0, 0x83C7, /* 0x30 */ 0x83C9, 0x83CF, 0x83D0, 0x83D1, 0x83D4, 0x83DD, 0x8353, 0x83E8, /* 0x30 */ 0x83EA, 0x83F6, 0x83F8, 0x83F9, 0x83FC, 0x8401, 0x8406, 0x840A, /* 0x40 */ 0x840F, 0x8411, 0x8415, 0x8419, 0x83AD, 0x842F, 0x8439, 0x8445, /* 0x40 */ 0x8447, 0x8448, 0x844A, 0x844D, 0x844F, 0x8451, 0x8452, 0x8456, /* 0x50 */ 0x8458, 0x8459, 0x845A, 0x845C, 0x8460, 0x8464, 0x8465, 0x8467, /* 0x50 */ 0x846A, 0x8470, 0x8473, 0x8474, 0x8476, 0x8478, 0x847C, 0x847D, /* 0x60 */ 0x8481, 0x8485, 0x8492, 0x8493, 0x8495, 0x849E, 0x84A6, 0x84A8, /* 0x60 */ 0x84A9, 0x84AA, 0x84AF, 0x84B1, 0x84B4, 0x84BA, 0x84BD, 0x84BE, /* 0x70 */ 0x84C0, 0x84C2, 0x84C7, 0x84C8, 0x84CC, 0x84CF, 0x84D3 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_59[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x84DC, 0x84E7, 0x84EA, 0x84EF, 0x84F0, 0x84F1, 0x84F2, /* 0x20 */ 0x84F7, 0x8532, 0x84FA, 0x84FB, 0x84FD, 0x8502, 0x8503, 0x8507, /* 0x20 */ 0x850C, 0x850E, 0x8510, 0x851C, 0x851E, 0x8522, 0x8523, 0x8524, /* 0x30 */ 0x8525, 0x8527, 0x852A, 0x852B, 0x852F, 0x8533, 0x8534, 0x8536, /* 0x30 */ 0x853F, 0x8546, 0x854F, 0x8550, 0x8551, 0x8552, 0x8553, 0x8556, /* 0x40 */ 0x8559, 0x855C, 0x855D, 0x855E, 0x855F, 0x8560, 0x8561, 0x8562, /* 0x40 */ 0x8564, 0x856B, 0x856F, 0x8579, 0x857A, 0x857B, 0x857D, 0x857F, /* 0x50 */ 0x8581, 0x8585, 0x8586, 0x8589, 0x858B, 0x858C, 0x858F, 0x8593, /* 0x50 */ 0x8598, 0x859D, 0x859F, 0x85A0, 0x85A2, 0x85A5, 0x85A7, 0x85B4, /* 0x60 */ 0x85B6, 0x85B7, 0x85B8, 0x85BC, 0x85BD, 0x85BE, 0x85BF, 0x85C2, /* 0x60 */ 0x85C7, 0x85CA, 0x85CB, 0x85CE, 0x85AD, 0x85D8, 0x85DA, 0x85DF, /* 0x70 */ 0x85E0, 0x85E6, 0x85E8, 0x85ED, 0x85F3, 0x85F6, 0x85FC /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_5A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x85FF, 0x8600, 0x8604, 0x8605, 0x860D, 0x860E, 0x8610, /* 0x20 */ 0x8611, 0x8612, 0x8618, 0x8619, 0x861B, 0x861E, 0x8621, 0x8627, /* 0x20 */ 0x8629, 0x8636, 0x8638, 0x863A, 0x863C, 0x863D, 0x8640, 0x8642, /* 0x30 */ 0x8646, 0x8652, 0x8653, 0x8656, 0x8657, 0x8658, 0x8659, 0x865D, /* 0x30 */ 0x8660, 0x8661, 0x8662, 0x8663, 0x8664, 0x8669, 0x866C, 0x866F, /* 0x40 */ 0x8675, 0x8676, 0x8677, 0x867A, 0x868D, 0x8691, 0x8696, 0x8698, /* 0x40 */ 0x869A, 0x869C, 0x86A1, 0x86A6, 0x86A7, 0x86A8, 0x86AD, 0x86B1, /* 0x50 */ 0x86B3, 0x86B4, 0x86B5, 0x86B7, 0x86B8, 0x86B9, 0x86BF, 0x86C0, /* 0x50 */ 0x86C1, 0x86C3, 0x86C5, 0x86D1, 0x86D2, 0x86D5, 0x86D7, 0x86DA, /* 0x60 */ 0x86DC, 0x86E0, 0x86E3, 0x86E5, 0x86E7, 0x8688, 0x86FA, 0x86FC, /* 0x60 */ 0x86FD, 0x8704, 0x8705, 0x8707, 0x870B, 0x870E, 0x870F, 0x8710, /* 0x70 */ 0x8713, 0x8714, 0x8719, 0x871E, 0x871F, 0x8721, 0x8723 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_5B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8728, 0x872E, 0x872F, 0x8731, 0x8732, 0x8739, 0x873A, /* 0x20 */ 0x873C, 0x873D, 0x873E, 0x8740, 0x8743, 0x8745, 0x874D, 0x8758, /* 0x20 */ 0x875D, 0x8761, 0x8764, 0x8765, 0x876F, 0x8771, 0x8772, 0x877B, /* 0x30 */ 0x8783, 0x8784, 0x8785, 0x8786, 0x8787, 0x8788, 0x8789, 0x878B, /* 0x30 */ 0x878C, 0x8790, 0x8793, 0x8795, 0x8797, 0x8798, 0x8799, 0x879E, /* 0x40 */ 0x87A0, 0x87A3, 0x87A7, 0x87AC, 0x87AD, 0x87AE, 0x87B1, 0x87B5, /* 0x40 */ 0x87BE, 0x87BF, 0x87C1, 0x87C8, 0x87C9, 0x87CA, 0x87CE, 0x87D5, /* 0x50 */ 0x87D6, 0x87D9, 0x87DA, 0x87DC, 0x87DF, 0x87E2, 0x87E3, 0x87E4, /* 0x50 */ 0x87EA, 0x87EB, 0x87ED, 0x87F1, 0x87F3, 0x87F8, 0x87FA, 0x87FF, /* 0x60 */ 0x8801, 0x8803, 0x8806, 0x8809, 0x880A, 0x880B, 0x8810, 0x8819, /* 0x60 */ 0x8812, 0x8813, 0x8814, 0x8818, 0x881A, 0x881B, 0x881C, 0x881E, /* 0x70 */ 0x881F, 0x8828, 0x882D, 0x882E, 0x8830, 0x8832, 0x8835 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_5C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x883A, 0x883C, 0x8841, 0x8843, 0x8845, 0x8848, 0x8849, /* 0x20 */ 0x884A, 0x884B, 0x884E, 0x8851, 0x8855, 0x8856, 0x8858, 0x885A, /* 0x20 */ 0x885C, 0x885F, 0x8860, 0x8864, 0x8869, 0x8871, 0x8879, 0x887B, /* 0x30 */ 0x8880, 0x8898, 0x889A, 0x889B, 0x889C, 0x889F, 0x88A0, 0x88A8, /* 0x30 */ 0x88AA, 0x88BA, 0x88BD, 0x88BE, 0x88C0, 0x88CA, 0x88CB, 0x88CC, /* 0x40 */ 0x88CD, 0x88CE, 0x88D1, 0x88D2, 0x88D3, 0x88DB, 0x88DE, 0x88E7, /* 0x40 */ 0x88EF, 0x88F0, 0x88F1, 0x88F5, 0x88F7, 0x8901, 0x8906, 0x890D, /* 0x50 */ 0x890E, 0x890F, 0x8915, 0x8916, 0x8918, 0x8919, 0x891A, 0x891C, /* 0x50 */ 0x8920, 0x8926, 0x8927, 0x8928, 0x8930, 0x8931, 0x8932, 0x8935, /* 0x60 */ 0x8939, 0x893A, 0x893E, 0x8940, 0x8942, 0x8945, 0x8946, 0x8949, /* 0x60 */ 0x894F, 0x8952, 0x8957, 0x895A, 0x895B, 0x895C, 0x8961, 0x8962, /* 0x70 */ 0x8963, 0x896B, 0x896E, 0x8970, 0x8973, 0x8975, 0x897A /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_5D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x897B, 0x897C, 0x897D, 0x8989, 0x898D, 0x8990, 0x8994, /* 0x20 */ 0x8995, 0x899B, 0x899C, 0x899F, 0x89A0, 0x89A5, 0x89B0, 0x89B4, /* 0x20 */ 0x89B5, 0x89B6, 0x89B7, 0x89BC, 0x89D4, 0x89D5, 0x89D6, 0x89D7, /* 0x30 */ 0x89D8, 0x89E5, 0x89E9, 0x89EB, 0x89ED, 0x89F1, 0x89F3, 0x89F6, /* 0x30 */ 0x89F9, 0x89FD, 0x89FF, 0x8A04, 0x8A05, 0x8A07, 0x8A0F, 0x8A11, /* 0x40 */ 0x8A12, 0x8A14, 0x8A15, 0x8A1E, 0x8A20, 0x8A22, 0x8A24, 0x8A26, /* 0x40 */ 0x8A2B, 0x8A2C, 0x8A2F, 0x8A35, 0x8A37, 0x8A3D, 0x8A3E, 0x8A40, /* 0x50 */ 0x8A43, 0x8A45, 0x8A47, 0x8A49, 0x8A4D, 0x8A4E, 0x8A53, 0x8A56, /* 0x50 */ 0x8A57, 0x8A58, 0x8A5C, 0x8A5D, 0x8A61, 0x8A65, 0x8A67, 0x8A75, /* 0x60 */ 0x8A76, 0x8A77, 0x8A79, 0x8A7A, 0x8A7B, 0x8A7E, 0x8A7F, 0x8A80, /* 0x60 */ 0x8A83, 0x8A86, 0x8A8B, 0x8A8F, 0x8A90, 0x8A92, 0x8A96, 0x8A97, /* 0x70 */ 0x8A99, 0x8A9F, 0x8AA7, 0x8AA9, 0x8AAE, 0x8AAF, 0x8AB3 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_5E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8AB6, 0x8AB7, 0x8ABB, 0x8ABE, 0x8AC3, 0x8AC6, 0x8AC8, /* 0x20 */ 0x8AC9, 0x8ACA, 0x8AD1, 0x8AD3, 0x8AD4, 0x8AD5, 0x8AD7, 0x8ADD, /* 0x20 */ 0x8ADF, 0x8AEC, 0x8AF0, 0x8AF4, 0x8AF5, 0x8AF6, 0x8AFC, 0x8AFF, /* 0x30 */ 0x8B05, 0x8B06, 0x8B0B, 0x8B11, 0x8B1C, 0x8B1E, 0x8B1F, 0x8B0A, /* 0x30 */ 0x8B2D, 0x8B30, 0x8B37, 0x8B3C, 0x8B42, 0x8B43, 0x8B44, 0x8B45, /* 0x40 */ 0x8B46, 0x8B48, 0x8B52, 0x8B53, 0x8B54, 0x8B59, 0x8B4D, 0x8B5E, /* 0x40 */ 0x8B63, 0x8B6D, 0x8B76, 0x8B78, 0x8B79, 0x8B7C, 0x8B7E, 0x8B81, /* 0x50 */ 0x8B84, 0x8B85, 0x8B8B, 0x8B8D, 0x8B8F, 0x8B94, 0x8B95, 0x8B9C, /* 0x50 */ 0x8B9E, 0x8B9F, 0x8C38, 0x8C39, 0x8C3D, 0x8C3E, 0x8C45, 0x8C47, /* 0x60 */ 0x8C49, 0x8C4B, 0x8C4F, 0x8C51, 0x8C53, 0x8C54, 0x8C57, 0x8C58, /* 0x60 */ 0x8C5B, 0x8C5D, 0x8C59, 0x8C63, 0x8C64, 0x8C66, 0x8C68, 0x8C69, /* 0x70 */ 0x8C6D, 0x8C73, 0x8C75, 0x8C76, 0x8C7B, 0x8C7E, 0x8C86 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_5F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8C87, 0x8C8B, 0x8C90, 0x8C92, 0x8C93, 0x8C99, 0x8C9B, /* 0x20 */ 0x8C9C, 0x8CA4, 0x8CB9, 0x8CBA, 0x8CC5, 0x8CC6, 0x8CC9, 0x8CCB, /* 0x20 */ 0x8CCF, 0x8CD6, 0x8CD5, 0x8CD9, 0x8CDD, 0x8CE1, 0x8CE8, 0x8CEC, /* 0x30 */ 0x8CEF, 0x8CF0, 0x8CF2, 0x8CF5, 0x8CF7, 0x8CF8, 0x8CFE, 0x8CFF, /* 0x30 */ 0x8D01, 0x8D03, 0x8D09, 0x8D12, 0x8D17, 0x8D1B, 0x8D65, 0x8D69, /* 0x40 */ 0x8D6C, 0x8D6E, 0x8D7F, 0x8D82, 0x8D84, 0x8D88, 0x8D8D, 0x8D90, /* 0x40 */ 0x8D91, 0x8D95, 0x8D9E, 0x8D9F, 0x8DA0, 0x8DA6, 0x8DAB, 0x8DAC, /* 0x50 */ 0x8DAF, 0x8DB2, 0x8DB5, 0x8DB7, 0x8DB9, 0x8DBB, 0x8DC0, 0x8DC5, /* 0x50 */ 0x8DC6, 0x8DC7, 0x8DC8, 0x8DCA, 0x8DCE, 0x8DD1, 0x8DD4, 0x8DD5, /* 0x60 */ 0x8DD7, 0x8DD9, 0x8DE4, 0x8DE5, 0x8DE7, 0x8DEC, 0x8DF0, 0x8DBC, /* 0x60 */ 0x8DF1, 0x8DF2, 0x8DF4, 0x8DFD, 0x8E01, 0x8E04, 0x8E05, 0x8E06, /* 0x70 */ 0x8E0B, 0x8E11, 0x8E14, 0x8E16, 0x8E20, 0x8E21, 0x8E22 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_60[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8E23, 0x8E26, 0x8E27, 0x8E31, 0x8E33, 0x8E36, 0x8E37, /* 0x20 */ 0x8E38, 0x8E39, 0x8E3D, 0x8E40, 0x8E41, 0x8E4B, 0x8E4D, 0x8E4E, /* 0x20 */ 0x8E4F, 0x8E54, 0x8E5B, 0x8E5C, 0x8E5D, 0x8E5E, 0x8E61, 0x8E62, /* 0x30 */ 0x8E69, 0x8E6C, 0x8E6D, 0x8E6F, 0x8E70, 0x8E71, 0x8E79, 0x8E7A, /* 0x30 */ 0x8E7B, 0x8E82, 0x8E83, 0x8E89, 0x8E90, 0x8E92, 0x8E95, 0x8E9A, /* 0x40 */ 0x8E9B, 0x8E9D, 0x8E9E, 0x8EA2, 0x8EA7, 0x8EA9, 0x8EAD, 0x8EAE, /* 0x40 */ 0x8EB3, 0x8EB5, 0x8EBA, 0x8EBB, 0x8EC0, 0x8EC1, 0x8EC3, 0x8EC4, /* 0x50 */ 0x8EC7, 0x8ECF, 0x8ED1, 0x8ED4, 0x8EDC, 0x8EE8, 0x8EEE, 0x8EF0, /* 0x50 */ 0x8EF1, 0x8EF7, 0x8EF9, 0x8EFA, 0x8EED, 0x8F00, 0x8F02, 0x8F07, /* 0x60 */ 0x8F08, 0x8F0F, 0x8F10, 0x8F16, 0x8F17, 0x8F18, 0x8F1E, 0x8F20, /* 0x60 */ 0x8F21, 0x8F23, 0x8F25, 0x8F27, 0x8F28, 0x8F2C, 0x8F2D, 0x8F2E, /* 0x70 */ 0x8F34, 0x8F35, 0x8F36, 0x8F37, 0x8F3A, 0x8F40, 0x8F41 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_61[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x8F43, 0x8F47, 0x8F4F, 0x8F51, 0x8F52, 0x8F53, 0x8F54, /* 0x20 */ 0x8F55, 0x8F58, 0x8F5D, 0x8F5E, 0x8F65, 0x8F9D, 0x8FA0, 0x8FA1, /* 0x20 */ 0x8FA4, 0x8FA5, 0x8FA6, 0x8FB5, 0x8FB6, 0x8FB8, 0x8FBE, 0x8FC0, /* 0x30 */ 0x8FC1, 0x8FC6, 0x8FCA, 0x8FCB, 0x8FCD, 0x8FD0, 0x8FD2, 0x8FD3, /* 0x30 */ 0x8FD5, 0x8FE0, 0x8FE3, 0x8FE4, 0x8FE8, 0x8FEE, 0x8FF1, 0x8FF5, /* 0x40 */ 0x8FF6, 0x8FFB, 0x8FFE, 0x9002, 0x9004, 0x9008, 0x900C, 0x9018, /* 0x40 */ 0x901B, 0x9028, 0x9029, 0x902F, 0x902A, 0x902C, 0x902D, 0x9033, /* 0x50 */ 0x9034, 0x9037, 0x903F, 0x9043, 0x9044, 0x904C, 0x905B, 0x905D, /* 0x50 */ 0x9062, 0x9066, 0x9067, 0x906C, 0x9070, 0x9074, 0x9079, 0x9085, /* 0x60 */ 0x9088, 0x908B, 0x908C, 0x908E, 0x9090, 0x9095, 0x9097, 0x9098, /* 0x60 */ 0x9099, 0x909B, 0x90A0, 0x90A1, 0x90A2, 0x90A5, 0x90B0, 0x90B2, /* 0x70 */ 0x90B3, 0x90B4, 0x90B6, 0x90BD, 0x90CC, 0x90BE, 0x90C3 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_62[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x90C4, 0x90C5, 0x90C7, 0x90C8, 0x90D5, 0x90D7, 0x90D8, /* 0x20 */ 0x90D9, 0x90DC, 0x90DD, 0x90DF, 0x90E5, 0x90D2, 0x90F6, 0x90EB, /* 0x20 */ 0x90EF, 0x90F0, 0x90F4, 0x90FE, 0x90FF, 0x9100, 0x9104, 0x9105, /* 0x30 */ 0x9106, 0x9108, 0x910D, 0x9110, 0x9114, 0x9116, 0x9117, 0x9118, /* 0x30 */ 0x911A, 0x911C, 0x911E, 0x9120, 0x9125, 0x9122, 0x9123, 0x9127, /* 0x40 */ 0x9129, 0x912E, 0x912F, 0x9131, 0x9134, 0x9136, 0x9137, 0x9139, /* 0x40 */ 0x913A, 0x913C, 0x913D, 0x9143, 0x9147, 0x9148, 0x914F, 0x9153, /* 0x50 */ 0x9157, 0x9159, 0x915A, 0x915B, 0x9161, 0x9164, 0x9167, 0x916D, /* 0x50 */ 0x9174, 0x9179, 0x917A, 0x917B, 0x9181, 0x9183, 0x9185, 0x9186, /* 0x60 */ 0x918A, 0x918E, 0x9191, 0x9193, 0x9194, 0x9195, 0x9198, 0x919E, /* 0x60 */ 0x91A1, 0x91A6, 0x91A8, 0x91AC, 0x91AD, 0x91AE, 0x91B0, 0x91B1, /* 0x70 */ 0x91B2, 0x91B3, 0x91B6, 0x91BB, 0x91BC, 0x91BD, 0x91BF /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_63[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x91C2, 0x91C3, 0x91C5, 0x91D3, 0x91D4, 0x91D7, 0x91D9, /* 0x20 */ 0x91DA, 0x91DE, 0x91E4, 0x91E5, 0x91E9, 0x91EA, 0x91EC, 0x91ED, /* 0x20 */ 0x91EE, 0x91EF, 0x91F0, 0x91F1, 0x91F7, 0x91F9, 0x91FB, 0x91FD, /* 0x30 */ 0x9200, 0x9201, 0x9204, 0x9205, 0x9206, 0x9207, 0x9209, 0x920A, /* 0x30 */ 0x920C, 0x9210, 0x9212, 0x9213, 0x9216, 0x9218, 0x921C, 0x921D, /* 0x40 */ 0x9223, 0x9224, 0x9225, 0x9226, 0x9228, 0x922E, 0x922F, 0x9230, /* 0x40 */ 0x9233, 0x9235, 0x9236, 0x9238, 0x9239, 0x923A, 0x923C, 0x923E, /* 0x50 */ 0x9240, 0x9242, 0x9243, 0x9246, 0x9247, 0x924A, 0x924D, 0x924E, /* 0x50 */ 0x924F, 0x9251, 0x9258, 0x9259, 0x925C, 0x925D, 0x9260, 0x9261, /* 0x60 */ 0x9265, 0x9267, 0x9268, 0x9269, 0x926E, 0x926F, 0x9270, 0x9275, /* 0x60 */ 0x9276, 0x9277, 0x9278, 0x9279, 0x927B, 0x927C, 0x927D, 0x927F, /* 0x70 */ 0x9288, 0x9289, 0x928A, 0x928D, 0x928E, 0x9292, 0x9297 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_64[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9299, 0x929F, 0x92A0, 0x92A4, 0x92A5, 0x92A7, 0x92A8, /* 0x20 */ 0x92AB, 0x92AF, 0x92B2, 0x92B6, 0x92B8, 0x92BA, 0x92BB, 0x92BC, /* 0x20 */ 0x92BD, 0x92BF, 0x92C0, 0x92C1, 0x92C2, 0x92C3, 0x92C5, 0x92C6, /* 0x30 */ 0x92C7, 0x92C8, 0x92CB, 0x92CC, 0x92CD, 0x92CE, 0x92D0, 0x92D3, /* 0x30 */ 0x92D5, 0x92D7, 0x92D8, 0x92D9, 0x92DC, 0x92DD, 0x92DF, 0x92E0, /* 0x40 */ 0x92E1, 0x92E3, 0x92E5, 0x92E7, 0x92E8, 0x92EC, 0x92EE, 0x92F0, /* 0x40 */ 0x92F9, 0x92FB, 0x92FF, 0x9300, 0x9302, 0x9308, 0x930D, 0x9311, /* 0x50 */ 0x9314, 0x9315, 0x931C, 0x931D, 0x931E, 0x931F, 0x9321, 0x9324, /* 0x50 */ 0x9325, 0x9327, 0x9329, 0x932A, 0x9333, 0x9334, 0x9336, 0x9337, /* 0x60 */ 0x9347, 0x9348, 0x9349, 0x9350, 0x9351, 0x9352, 0x9355, 0x9357, /* 0x60 */ 0x9358, 0x935A, 0x935E, 0x9364, 0x9365, 0x9367, 0x9369, 0x936A, /* 0x70 */ 0x936D, 0x936F, 0x9370, 0x9371, 0x9373, 0x9374, 0x9376 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_65[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x937A, 0x937D, 0x937F, 0x9380, 0x9381, 0x9382, 0x9388, /* 0x20 */ 0x938A, 0x938B, 0x938D, 0x938F, 0x9392, 0x9395, 0x9398, 0x939B, /* 0x20 */ 0x939E, 0x93A1, 0x93A3, 0x93A4, 0x93A6, 0x93A8, 0x93AB, 0x93B4, /* 0x30 */ 0x93B5, 0x93B6, 0x93BA, 0x93A9, 0x93C1, 0x93C4, 0x93C5, 0x93C6, /* 0x30 */ 0x93C7, 0x93C9, 0x93CA, 0x93CB, 0x93CC, 0x93CD, 0x93D3, 0x93D9, /* 0x40 */ 0x93DC, 0x93DE, 0x93DF, 0x93E2, 0x93E6, 0x93E7, 0x93F9, 0x93F7, /* 0x40 */ 0x93F8, 0x93FA, 0x93FB, 0x93FD, 0x9401, 0x9402, 0x9404, 0x9408, /* 0x50 */ 0x9409, 0x940D, 0x940E, 0x940F, 0x9415, 0x9416, 0x9417, 0x941F, /* 0x50 */ 0x942E, 0x942F, 0x9431, 0x9432, 0x9433, 0x9434, 0x943B, 0x943F, /* 0x60 */ 0x943D, 0x9443, 0x9445, 0x9448, 0x944A, 0x944C, 0x9455, 0x9459, /* 0x60 */ 0x945C, 0x945F, 0x9461, 0x9463, 0x9468, 0x946B, 0x946D, 0x946E, /* 0x70 */ 0x946F, 0x9471, 0x9472, 0x9484, 0x9483, 0x9578, 0x9579 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_66[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x957E, 0x9584, 0x9588, 0x958C, 0x958D, 0x958E, 0x959D, /* 0x20 */ 0x959E, 0x959F, 0x95A1, 0x95A6, 0x95A9, 0x95AB, 0x95AC, 0x95B4, /* 0x20 */ 0x95B6, 0x95BA, 0x95BD, 0x95BF, 0x95C6, 0x95C8, 0x95C9, 0x95CB, /* 0x30 */ 0x95D0, 0x95D1, 0x95D2, 0x95D3, 0x95D9, 0x95DA, 0x95DD, 0x95DE, /* 0x30 */ 0x95DF, 0x95E0, 0x95E4, 0x95E6, 0x961D, 0x961E, 0x9622, 0x9624, /* 0x40 */ 0x9625, 0x9626, 0x962C, 0x9631, 0x9633, 0x9637, 0x9638, 0x9639, /* 0x40 */ 0x963A, 0x963C, 0x963D, 0x9641, 0x9652, 0x9654, 0x9656, 0x9657, /* 0x50 */ 0x9658, 0x9661, 0x966E, 0x9674, 0x967B, 0x967C, 0x967E, 0x967F, /* 0x50 */ 0x9681, 0x9682, 0x9683, 0x9684, 0x9689, 0x9691, 0x9696, 0x969A, /* 0x60 */ 0x969D, 0x969F, 0x96A4, 0x96A5, 0x96A6, 0x96A9, 0x96AE, 0x96AF, /* 0x60 */ 0x96B3, 0x96BA, 0x96CA, 0x96D2, 0x5DB2, 0x96D8, 0x96DA, 0x96DD, /* 0x70 */ 0x96DE, 0x96DF, 0x96E9, 0x96EF, 0x96F1, 0x96FA, 0x9702 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_67[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9703, 0x9705, 0x9709, 0x971A, 0x971B, 0x971D, 0x9721, /* 0x20 */ 0x9722, 0x9723, 0x9728, 0x9731, 0x9733, 0x9741, 0x9743, 0x974A, /* 0x20 */ 0x974E, 0x974F, 0x9755, 0x9757, 0x9758, 0x975A, 0x975B, 0x9763, /* 0x30 */ 0x9767, 0x976A, 0x976E, 0x9773, 0x9776, 0x9777, 0x9778, 0x977B, /* 0x30 */ 0x977D, 0x977F, 0x9780, 0x9789, 0x9795, 0x9796, 0x9797, 0x9799, /* 0x40 */ 0x979A, 0x979E, 0x979F, 0x97A2, 0x97AC, 0x97AE, 0x97B1, 0x97B2, /* 0x40 */ 0x97B5, 0x97B6, 0x97B8, 0x97B9, 0x97BA, 0x97BC, 0x97BE, 0x97BF, /* 0x50 */ 0x97C1, 0x97C4, 0x97C5, 0x97C7, 0x97C9, 0x97CA, 0x97CC, 0x97CD, /* 0x50 */ 0x97CE, 0x97D0, 0x97D1, 0x97D4, 0x97D7, 0x97D8, 0x97D9, 0x97DD, /* 0x60 */ 0x97DE, 0x97E0, 0x97DB, 0x97E1, 0x97E4, 0x97EF, 0x97F1, 0x97F4, /* 0x60 */ 0x97F7, 0x97F8, 0x97FA, 0x9807, 0x980A, 0x9819, 0x980D, 0x980E, /* 0x70 */ 0x9814, 0x9816, 0x981C, 0x981E, 0x9820, 0x9823, 0x9826 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_68[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x982B, 0x982E, 0x982F, 0x9830, 0x9832, 0x9833, 0x9835, /* 0x20 */ 0x9825, 0x983E, 0x9844, 0x9847, 0x984A, 0x9851, 0x9852, 0x9853, /* 0x20 */ 0x9856, 0x9857, 0x9859, 0x985A, 0x9862, 0x9863, 0x9865, 0x9866, /* 0x30 */ 0x986A, 0x986C, 0x98AB, 0x98AD, 0x98AE, 0x98B0, 0x98B4, 0x98B7, /* 0x30 */ 0x98B8, 0x98BA, 0x98BB, 0x98BF, 0x98C2, 0x98C5, 0x98C8, 0x98CC, /* 0x40 */ 0x98E1, 0x98E3, 0x98E5, 0x98E6, 0x98E7, 0x98EA, 0x98F3, 0x98F6, /* 0x40 */ 0x9902, 0x9907, 0x9908, 0x9911, 0x9915, 0x9916, 0x9917, 0x991A, /* 0x50 */ 0x991B, 0x991C, 0x991F, 0x9922, 0x9926, 0x9927, 0x992B, 0x9931, /* 0x50 */ 0x9932, 0x9933, 0x9934, 0x9935, 0x9939, 0x993A, 0x993B, 0x993C, /* 0x60 */ 0x9940, 0x9941, 0x9946, 0x9947, 0x9948, 0x994D, 0x994E, 0x9954, /* 0x60 */ 0x9958, 0x9959, 0x995B, 0x995C, 0x995E, 0x995F, 0x9960, 0x999B, /* 0x70 */ 0x999D, 0x999F, 0x99A6, 0x99B0, 0x99B1, 0x99B2, 0x99B5 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_69[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x99B9, 0x99BA, 0x99BD, 0x99BF, 0x99C3, 0x99C9, 0x99D3, /* 0x20 */ 0x99D4, 0x99D9, 0x99DA, 0x99DC, 0x99DE, 0x99E7, 0x99EA, 0x99EB, /* 0x20 */ 0x99EC, 0x99F0, 0x99F4, 0x99F5, 0x99F9, 0x99FD, 0x99FE, 0x9A02, /* 0x30 */ 0x9A03, 0x9A04, 0x9A0B, 0x9A0C, 0x9A10, 0x9A11, 0x9A16, 0x9A1E, /* 0x30 */ 0x9A20, 0x9A22, 0x9A23, 0x9A24, 0x9A27, 0x9A2D, 0x9A2E, 0x9A33, /* 0x40 */ 0x9A35, 0x9A36, 0x9A38, 0x9A47, 0x9A41, 0x9A44, 0x9A4A, 0x9A4B, /* 0x40 */ 0x9A4C, 0x9A4E, 0x9A51, 0x9A54, 0x9A56, 0x9A5D, 0x9AAA, 0x9AAC, /* 0x50 */ 0x9AAE, 0x9AAF, 0x9AB2, 0x9AB4, 0x9AB5, 0x9AB6, 0x9AB9, 0x9ABB, /* 0x50 */ 0x9ABE, 0x9ABF, 0x9AC1, 0x9AC3, 0x9AC6, 0x9AC8, 0x9ACE, 0x9AD0, /* 0x60 */ 0x9AD2, 0x9AD5, 0x9AD6, 0x9AD7, 0x9ADB, 0x9ADC, 0x9AE0, 0x9AE4, /* 0x60 */ 0x9AE5, 0x9AE7, 0x9AE9, 0x9AEC, 0x9AF2, 0x9AF3, 0x9AF5, 0x9AF9, /* 0x70 */ 0x9AFA, 0x9AFD, 0x9AFF, 0x9B00, 0x9B01, 0x9B02, 0x9B03 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_6A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9B04, 0x9B05, 0x9B08, 0x9B09, 0x9B0B, 0x9B0C, 0x9B0D, /* 0x20 */ 0x9B0E, 0x9B10, 0x9B12, 0x9B16, 0x9B19, 0x9B1B, 0x9B1C, 0x9B20, /* 0x20 */ 0x9B26, 0x9B2B, 0x9B2D, 0x9B33, 0x9B34, 0x9B35, 0x9B37, 0x9B39, /* 0x30 */ 0x9B3A, 0x9B3D, 0x9B48, 0x9B4B, 0x9B4C, 0x9B55, 0x9B56, 0x9B57, /* 0x30 */ 0x9B5B, 0x9B5E, 0x9B61, 0x9B63, 0x9B65, 0x9B66, 0x9B68, 0x9B6A, /* 0x40 */ 0x9B6B, 0x9B6C, 0x9B6D, 0x9B6E, 0x9B73, 0x9B75, 0x9B77, 0x9B78, /* 0x40 */ 0x9B79, 0x9B7F, 0x9B80, 0x9B84, 0x9B85, 0x9B86, 0x9B87, 0x9B89, /* 0x50 */ 0x9B8A, 0x9B8B, 0x9B8D, 0x9B8F, 0x9B90, 0x9B94, 0x9B9A, 0x9B9D, /* 0x50 */ 0x9B9E, 0x9BA6, 0x9BA7, 0x9BA9, 0x9BAC, 0x9BB0, 0x9BB1, 0x9BB2, /* 0x60 */ 0x9BB7, 0x9BB8, 0x9BBB, 0x9BBC, 0x9BBE, 0x9BBF, 0x9BC1, 0x9BC7, /* 0x60 */ 0x9BC8, 0x9BCE, 0x9BD0, 0x9BD7, 0x9BD8, 0x9BDD, 0x9BDF, 0x9BE5, /* 0x70 */ 0x9BE7, 0x9BEA, 0x9BEB, 0x9BEF, 0x9BF3, 0x9BF7, 0x9BF8 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_6B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9BF9, 0x9BFA, 0x9BFD, 0x9BFF, 0x9C00, 0x9C02, 0x9C0B, /* 0x20 */ 0x9C0F, 0x9C11, 0x9C16, 0x9C18, 0x9C19, 0x9C1A, 0x9C1C, 0x9C1E, /* 0x20 */ 0x9C22, 0x9C23, 0x9C26, 0x9C27, 0x9C28, 0x9C29, 0x9C2A, 0x9C31, /* 0x30 */ 0x9C35, 0x9C36, 0x9C37, 0x9C3D, 0x9C41, 0x9C43, 0x9C44, 0x9C45, /* 0x30 */ 0x9C49, 0x9C4A, 0x9C4E, 0x9C4F, 0x9C50, 0x9C53, 0x9C54, 0x9C56, /* 0x40 */ 0x9C58, 0x9C5B, 0x9C5D, 0x9C5E, 0x9C5F, 0x9C63, 0x9C69, 0x9C6A, /* 0x40 */ 0x9C5C, 0x9C6B, 0x9C68, 0x9C6E, 0x9C70, 0x9C72, 0x9C75, 0x9C77, /* 0x50 */ 0x9C7B, 0x9CE6, 0x9CF2, 0x9CF7, 0x9CF9, 0x9D0B, 0x9D02, 0x9D11, /* 0x50 */ 0x9D17, 0x9D18, 0x9D1C, 0x9D1D, 0x9D1E, 0x9D2F, 0x9D30, 0x9D32, /* 0x60 */ 0x9D33, 0x9D34, 0x9D3A, 0x9D3C, 0x9D45, 0x9D3D, 0x9D42, 0x9D43, /* 0x60 */ 0x9D47, 0x9D4A, 0x9D53, 0x9D54, 0x9D5F, 0x9D63, 0x9D62, 0x9D65, /* 0x70 */ 0x9D69, 0x9D6A, 0x9D6B, 0x9D70, 0x9D76, 0x9D77, 0x9D7B /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_6C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9D7C, 0x9D7E, 0x9D83, 0x9D84, 0x9D86, 0x9D8A, 0x9D8D, /* 0x20 */ 0x9D8E, 0x9D92, 0x9D93, 0x9D95, 0x9D96, 0x9D97, 0x9D98, 0x9DA1, /* 0x20 */ 0x9DAA, 0x9DAC, 0x9DAE, 0x9DB1, 0x9DB5, 0x9DB9, 0x9DBC, 0x9DBF, /* 0x30 */ 0x9DC3, 0x9DC7, 0x9DC9, 0x9DCA, 0x9DD4, 0x9DD5, 0x9DD6, 0x9DD7, /* 0x30 */ 0x9DDA, 0x9DDE, 0x9DDF, 0x9DE0, 0x9DE5, 0x9DE7, 0x9DE9, 0x9DEB, /* 0x40 */ 0x9DEE, 0x9DF0, 0x9DF3, 0x9DF4, 0x9DFE, 0x9E0A, 0x9E02, 0x9E07, /* 0x40 */ 0x9E0E, 0x9E10, 0x9E11, 0x9E12, 0x9E15, 0x9E16, 0x9E19, 0x9E1C, /* 0x50 */ 0x9E1D, 0x9E7A, 0x9E7B, 0x9E7C, 0x9E80, 0x9E82, 0x9E83, 0x9E84, /* 0x50 */ 0x9E85, 0x9E87, 0x9E8E, 0x9E8F, 0x9E96, 0x9E98, 0x9E9B, 0x9E9E, /* 0x60 */ 0x9EA4, 0x9EA8, 0x9EAC, 0x9EAE, 0x9EAF, 0x9EB0, 0x9EB3, 0x9EB4, /* 0x60 */ 0x9EB5, 0x9EC6, 0x9EC8, 0x9ECB, 0x9ED5, 0x9EDF, 0x9EE4, 0x9EE7, /* 0x70 */ 0x9EEC, 0x9EED, 0x9EEE, 0x9EF0, 0x9EF1, 0x9EF2, 0x9EF5 /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplDBCSToUniTab_JIS0212_6D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x9EF8, 0x9EFF, 0x9F02, 0x9F03, 0x9F09, 0x9F0F, 0x9F10, /* 0x20 */ 0x9F11, 0x9F12, 0x9F14, 0x9F16, 0x9F17, 0x9F19, 0x9F1A, 0x9F1B, /* 0x20 */ 0x9F1F, 0x9F22, 0x9F26, 0x9F2A, 0x9F2B, 0x9F2F, 0x9F31, 0x9F32, /* 0x30 */ 0x9F34, 0x9F37, 0x9F39, 0x9F3A, 0x9F3C, 0x9F3D, 0x9F3F, 0x9F41, /* 0x30 */ 0x9F43, 0x9F44, 0x9F45, 0x9F46, 0x9F47, 0x9F53, 0x9F55, 0x9F56, /* 0x40 */ 0x9F57, 0x9F58, 0x9F5A, 0x9F5D, 0x9F5E, 0x9F68, 0x9F69, 0x9F6D, /* 0x40 */ 0x9F6E, 0x9F6F, 0x9F70, 0x9F71, 0x9F73, 0x9F75, 0x9F7A, 0x9F7D, /* 0x50 */ 0x9F8F, 0x9F90, 0x9F91, 0x9F92, 0x9F94, 0x9F96, 0x9F97, 0x9F9E, /* 0x50 */ 0x9FA1, 0x9FA2, 0x9FA3, 0x9FA5 /* 0x60 */ /* 0x60 */ };
the_stack
-- Функция транслитерации по правилам библиотеки "Юлия", https://github.com/nalgeon/iuliia create or replace function iuliia_translate(str text, rules jsonb) returns text language plpgsql RETURNS NULL ON NULL INPUT as $$ DECLARE rec record; val text; BEGIN -- https://dangry.ru/iuliia/ -- https://github.com/nalgeon/iuliia -- https://habr.com/ru/post/499574/ FOR rec IN SELECT * FROM jsonb_each_text(rules->'ending_mapping') LOOP str := regexp_replace(str, rec.key || '\M', rec.value); str := regexp_replace(str, initcap(rec.key) || '\M', initcap(rec.value)); END LOOP; FOR rec IN SELECT * FROM jsonb_each_text(rules->'next_mapping') LOOP val := rec.value || rec.key; str := replace(str, rec.key, val); str := replace(str, initcap(rec.key), initcap(val)); END LOOP; FOR rec IN SELECT * FROM jsonb_each_text(rules->'prev_mapping') LOOP if length(rec.key) = 1 then str := regexp_replace(str, '\m' || rec.key, rec.value); str := regexp_replace(str, '\m' || initcap(rec.key), initcap(rec.value)); else val := substr(rec.key, 1, 1) || rec.value; str := replace(str, rec.key, val); str := replace(str, initcap(rec.key), initcap(val)); end if; END LOOP; FOR rec IN SELECT * FROM jsonb_each_text(rules->'mapping') LOOP str := replace(str, rec.key, rec.value); str := replace(str, initcap(rec.key), initcap(rec.value)); END LOOP; RETURN str; END $$; comment on function iuliia_translate(str text, rules jsonb) is 'Транслитерация текста с правилами транслитерации в JSON, см. github.com/nalgeon/iuliia/'; /* Московское метро Схема транслитерации, которую использует Московский метрополитен. Визуально самая приятная из всех, хотя уступает Википедии по фонетической точности. Сочетает удачные решения Википедии и Яндекс.Карт. Придумана в Студии Лебедева, официально нигде не описана. */ create or replace function iuliia_translate_mosmetro(str text) returns text immutable strict language sql PARALLEL SAFE -- Postgres 10 or later as $$ select iuliia_translate( str, -- https://github.com/nalgeon/iuliia/blob/master/mosmetro.json '{ "name": "mosmetro", "description": "Moscow Metro map transliteration schema", "url": "https://dangry.ru/iuliia/mosmetro/", "mapping": { "а": "a", "б": "b", "в": "v", "г": "g", "д": "d", "е": "e", "ё": "e", "ж": "zh", "з": "z", "и": "i", "й": "y", "к": "k", "л": "l", "м": "m", "н": "n", "о": "o", "п": "p", "р": "r", "с": "s", "т": "t", "у": "u", "ф": "f", "х": "kh", "ц": "ts", "ч": "ch", "ш": "sh", "щ": "sch", "ъ": "", "ы": "y", "ь": "", "э": "e", "ю": "yu", "я": "ya" }, "prev_mapping": { "тц": "s", "ьё": "o", "ъё": "o" }, "next_mapping": { "ьа": "y", "ье": "y", "ьё": "y", "ьи": "y", "ьо": "y", "ьу": "y", "ьэ": "y", "ъа": "y", "ъе": "y", "ъё": "y", "ъи": "y", "ъо": "y", "ъу": "y", "ъэ": "y" }, "ending_mapping": { "ий": "y", "ый": "y" }, "samples": [ [ "Юлия, съешь ещё этих мягких французских булок из Йошкар-Олы, да выпей алтайского чаю", "Yuliya, syesh esche etikh myagkikh frantsuzskikh bulok iz Yoshkar-Oly, da vypey altayskogo chayu" ], ["Битцевский парк", "Bitsevsky park"], ["Верхние Лихоборы", "Verkhnie Likhobory"], ["Воробьёвы горы", "Vorobyovy gory"], ["Выхино", "Vykhino"], ["Зябликово", "Zyablikovo"], ["Измайловская", "Izmaylovskaya"], ["Кожуховская", "Kozhukhovskaya"], ["Крылатское", "Krylatskoe"], ["Марьина Роща", "Maryina Roscha"], ["Марьино", "Maryino"], ["Молодёжная", "Molodezhnaya"], ["Октябрьская", "Oktyabrskaya"], ["Ольховая", "Olkhovaya"], ["Парк Победы", "Park Pobedy"], ["Площадь Ильича", "Ploschad Ilyicha"], ["Площадь Революции", "Ploschad Revolyutsii"], ["Пятницкое шоссе", "Pyatnitskoe shosse"], ["Румянцево", "Rumyantsevo"], ["Саларьево", "Salaryevo"], ["Семёновская", "Semenovskaya"], ["Сходненская", "Skhodnenskaya"], ["Текстильщики", "Tekstilschiki"], ["Тёплый стан", "Teply stan"], ["Третьяковская", "Tretyakovskaya"], ["Тропарёво", "Troparevo"], ["Фонвизинская", "Fonvizinskaya"], ["Чистые пруды", "Chistye prudy"], ["Шоссе Энтузиастов", "Shosse Entuziastov"], ["Щёлковская", "Schelkovskaya"], ["Электрозаводская", "Elektrozavodskaya"], ["Юго-Западная", "Yugo-Zapadnaya"] ] }'::jsonb ); $$; comment on function iuliia_translate_mosmetro(str text) is 'Транслитерация текста с правилами транслитерации Мосметро, см. github.com/nalgeon/iuliia/blob/master/mosmetro.json'; /* Википедия Схема транслитерации, которую использует Википедия. Сделана на основе BGN/PCGN со значительными модификациями. Самая продуманная, звучит лучше всех и выглядит приятнее большинства прочих схем. Пожалуй, неудачной вышла только буква Щ. */ create or replace function iuliia_translate_wikipedia(str text) returns text immutable strict language sql PARALLEL SAFE -- Postgres 10 or later as $$ select iuliia_translate( str, -- https://github.com/nalgeon/iuliia/blob/master/wikipedia.json '{ "name": "wikipedia", "description": "Wikipedia transliteration schema", "url": "https://dangry.ru/iuliia/wikipedia/", "mapping": { "а": "a", "б": "b", "в": "v", "г": "g", "д": "d", "е": "e", "ё": "yo", "ж": "zh", "з": "z", "и": "i", "й": "y", "к": "k", "л": "l", "м": "m", "н": "n", "о": "o", "п": "p", "р": "r", "с": "s", "т": "t", "у": "u", "ф": "f", "х": "kh", "ц": "ts", "ч": "ch", "ш": "sh", "щ": "shch", "ъ": "", "ы": "y", "ь": "", "э": "e", "ю": "yu", "я": "ya" }, "prev_mapping": { "е": "ye", "ае": "ye", "ие": "ye", "ое": "ye", "уе": "ye", "эе": "ye", "юе": "ye", "яе": "ye", "ье": "ye", "ъе": "ye" }, "next_mapping": { "ъа": "y", "ъи": "y", "ъо": "y", "ъу": "y", "ъы": "y", "ъэ": "y", "ьа": "y", "ьи": "y", "ьо": "y", "ьу": "y", "ьы": "y", "ьэ": "y" }, "ending_mapping": { "ий": "y", "ый": "y" }, "samples": [ [ "Юлия, съешь ещё этих мягких французских булок из Йошкар-Олы, да выпей алтайского чаю", "Yuliya, syesh yeshchyo etikh myagkikh frantsuzskikh bulok iz Yoshkar-Oly, da vypey altayskogo chayu" ], [ "Россия, город Йошкар-Ола, улица Яна Крастыня", "Rossiya, gorod Yoshkar-Ola, ulitsa Yana Krastynya" ], ["Ельцин", "Yeltsin"], ["Раздольное", "Razdolnoye"], ["Юрьев", "Yuryev"], ["Белкин", "Belkin"], ["Бийск", "Biysk"], ["Подъярский", "Podyarsky"], ["Мусийкъонгийкоте", "Musiykyongiykote"], ["Давыдов", "Davydov"], ["Усолье", "Usolye"], ["Выхухоль", "Vykhukhol"], ["Дальнегорск", "Dalnegorsk"], ["Ильинский", "Ilyinsky"], ["Красный", "Krasny"], ["Великий", "Veliky"], ["Набережные Челны", "Naberezhnye Chelny"] ] }'::jsonb ); $$; -- iuliia_translate_mosmetro() tests DO $$ DECLARE rec record; BEGIN for rec in select value->>0 as src, value->>1 as dst from jsonb_array_elements('{ "name": "mosmetro", "description": "Moscow Metro map transliteration schema", "url": "https://dangry.ru/iuliia/mosmetro/", "mapping": { "а": "a", "б": "b", "в": "v", "г": "g", "д": "d", "е": "e", "ё": "e", "ж": "zh", "з": "z", "и": "i", "й": "y", "к": "k", "л": "l", "м": "m", "н": "n", "о": "o", "п": "p", "р": "r", "с": "s", "т": "t", "у": "u", "ф": "f", "х": "kh", "ц": "ts", "ч": "ch", "ш": "sh", "щ": "sch", "ъ": "", "ы": "y", "ь": "", "э": "e", "ю": "yu", "я": "ya" }, "prev_mapping": { "тц": "s", "ьё": "o", "ъё": "o" }, "next_mapping": { "ьа": "y", "ье": "y", "ьё": "y", "ьи": "y", "ьо": "y", "ьу": "y", "ьэ": "y", "ъа": "y", "ъе": "y", "ъё": "y", "ъи": "y", "ъо": "y", "ъу": "y", "ъэ": "y" }, "ending_mapping": { "ий": "y", "ый": "y" }, "samples": [ [ "Юлия, съешь ещё этих мягких французских булок из Йошкар-Олы, да выпей алтайского чаю", "Yuliya, syesh esche etikh myagkikh frantsuzskikh bulok iz Yoshkar-Oly, da vypey altayskogo chayu" ], ["Битцевский парк", "Bitsevsky park"], ["Верхние Лихоборы", "Verkhnie Likhobory"], ["Воробьёвы горы", "Vorobyovy gory"], ["Выхино", "Vykhino"], ["Зябликово", "Zyablikovo"], ["Измайловская", "Izmaylovskaya"], ["Кожуховская", "Kozhukhovskaya"], ["Крылатское", "Krylatskoe"], ["Марьина Роща", "Maryina Roscha"], ["Марьино", "Maryino"], ["Молодёжная", "Molodezhnaya"], ["Октябрьская", "Oktyabrskaya"], ["Ольховая", "Olkhovaya"], ["Парк Победы", "Park Pobedy"], ["Площадь Ильича", "Ploschad Ilyicha"], ["Площадь Революции", "Ploschad Revolyutsii"], ["Пятницкое шоссе", "Pyatnitskoe shosse"], ["Румянцево", "Rumyantsevo"], ["Саларьево", "Salaryevo"], ["Семёновская", "Semenovskaya"], ["Сходненская", "Skhodnenskaya"], ["Текстильщики", "Tekstilschiki"], ["Тёплый стан", "Teply stan"], ["Третьяковская", "Tretyakovskaya"], ["Тропарёво", "Troparevo"], ["Фонвизинская", "Fonvizinskaya"], ["Чистые пруды", "Chistye prudy"], ["Шоссе Энтузиастов", "Shosse Entuziastov"], ["Щёлковская", "Schelkovskaya"], ["Электрозаводская", "Elektrozavodskaya"], ["Юго-Западная", "Yugo-Zapadnaya"] ] }'::jsonb->'samples') loop raise notice '% => %', rec.src, rec.dst; ASSERT -- результат сравнения должен вернуть boolean iuliia_translate_mosmetro(rec.src) is not distinct from rec.dst, -- если результат сравнения не true, то вернётся сообщение с ошибкой format('%L => %L', rec.src, rec.dst); end loop; END $$; -- iuliia_translate_wikipedia() tests DO $$ DECLARE rec record; BEGIN for rec in select value->>0 as src, value->>1 as dst from jsonb_array_elements('{ "name": "wikipedia", "description": "Wikipedia transliteration schema", "url": "https://dangry.ru/iuliia/wikipedia/", "mapping": { "а": "a", "б": "b", "в": "v", "г": "g", "д": "d", "е": "e", "ё": "yo", "ж": "zh", "з": "z", "и": "i", "й": "y", "к": "k", "л": "l", "м": "m", "н": "n", "о": "o", "п": "p", "р": "r", "с": "s", "т": "t", "у": "u", "ф": "f", "х": "kh", "ц": "ts", "ч": "ch", "ш": "sh", "щ": "shch", "ъ": "", "ы": "y", "ь": "", "э": "e", "ю": "yu", "я": "ya" }, "prev_mapping": { "е": "ye", "ае": "ye", "ие": "ye", "ое": "ye", "уе": "ye", "эе": "ye", "юе": "ye", "яе": "ye", "ье": "ye", "ъе": "ye" }, "next_mapping": { "ъа": "y", "ъи": "y", "ъо": "y", "ъу": "y", "ъы": "y", "ъэ": "y", "ьа": "y", "ьи": "y", "ьо": "y", "ьу": "y", "ьы": "y", "ьэ": "y" }, "ending_mapping": { "ий": "y", "ый": "y" }, "samples": [ [ "Юлия, съешь ещё этих мягких французских булок из Йошкар-Олы, да выпей алтайского чаю", "Yuliya, syesh yeshchyo etikh myagkikh frantsuzskikh bulok iz Yoshkar-Oly, da vypey altayskogo chayu" ], [ "Россия, город Йошкар-Ола, улица Яна Крастыня", "Rossiya, gorod Yoshkar-Ola, ulitsa Yana Krastynya" ], ["Ельцин", "Yeltsin"], ["Раздольное", "Razdolnoye"], ["Юрьев", "Yuryev"], ["Белкин", "Belkin"], ["Бийск", "Biysk"], ["Подъярский", "Podyarsky"], ["Мусийкъонгийкоте", "Musiykyongiykote"], ["Давыдов", "Davydov"], ["Усолье", "Usolye"], ["Выхухоль", "Vykhukhol"], ["Дальнегорск", "Dalnegorsk"], ["Ильинский", "Ilyinsky"], ["Красный", "Krasny"], ["Великий", "Veliky"], ["Набережные Челны", "Naberezhnye Chelny"] ] }'::jsonb->'samples') loop raise notice '% => %', rec.src, rec.dst; ASSERT -- результат сравнения должен вернуть boolean iuliia_translate_wikipedia(rec.src) is not distinct from rec.dst, -- если результат сравнения не true, то вернётся сообщение с ошибкой format('%L => %L', rec.src, rec.dst); end loop; END $$; -- @UNDO drop function if exists iuliia_translate_mosmetro(str text); drop function if exists iuliia_translate_wikipedia(str text); drop function if exists iuliia_translate(str text, rules jsonb);
the_stack
-- -- ────────────────────────────────────────────────────── I ────────── -- :::::: C O L U M N S : : : : : : : : -- ──────────────────────────────────────────────────────────────── -- WITH information_schema_columns AS ( SELECT c.relkind, c.oid, t.typcategory, a.attndims, a.atttypid, a.atttypmod, a.attndims AS "array_dimension", format_type(atttypid, atttypmod) AS "sql_type", regexp_match (format_type(atttypid, atttypmod), '\((\d+),?(\d*)\)') AS "atttypmods", current_database()::information_schema.sql_identifier AS table_catalog, nc.nspname::information_schema.sql_identifier AS table_schema, c.relname::information_schema.sql_identifier AS table_name, a.attname::information_schema.sql_identifier AS column_name, a.attnum::information_schema.cardinal_number AS ordinal_position, pg_get_expr(ad.adbin, ad.adrelid)::information_schema.character_data AS column_default, CASE WHEN a.attnotnull OR t.typtype = 'd'::"char" AND t.typnotnull THEN 'NO'::text ELSE 'YES'::text END::information_schema.yes_or_no AS is_nullable, CASE WHEN t.typtype = 'd'::"char" THEN CASE WHEN bt.typelem <> 0::oid AND bt.typlen = '-1'::integer THEN 'ARRAY'::text WHEN nbt.nspname = 'pg_catalog'::name THEN format_type(t.typbasetype, NULL::integer) ELSE 'USER-DEFINED'::text END ELSE CASE WHEN t.typelem <> 0::oid AND t.typlen = '-1'::integer THEN 'ARRAY'::text WHEN nt.nspname = 'pg_catalog'::name THEN format_type(a.atttypid, NULL::integer) ELSE 'USER-DEFINED'::text END END::information_schema.character_data AS data_type, information_schema._pg_char_max_length (information_schema._pg_truetypid (a.*, t.*), information_schema._pg_truetypmod (a.*, t.*))::information_schema.cardinal_number AS character_maximum_length, information_schema._pg_char_octet_length (information_schema._pg_truetypid (a.*, t.*), information_schema._pg_truetypmod (a.*, t.*))::information_schema.cardinal_number AS character_octet_length, information_schema._pg_numeric_precision (information_schema._pg_truetypid (a.*, t.*), information_schema._pg_truetypmod (a.*, t.*))::information_schema.cardinal_number AS numeric_precision, information_schema._pg_numeric_precision_radix (information_schema._pg_truetypid (a.*, t.*), information_schema._pg_truetypmod (a.*, t.*))::information_schema.cardinal_number AS numeric_precision_radix, information_schema._pg_numeric_scale (information_schema._pg_truetypid (a.*, t.*), information_schema._pg_truetypmod (a.*, t.*))::information_schema.cardinal_number AS numeric_scale, information_schema._pg_datetime_precision (information_schema._pg_truetypid (a.*, t.*), information_schema._pg_truetypmod (a.*, t.*))::information_schema.cardinal_number AS datetime_precision, information_schema._pg_interval_type (information_schema._pg_truetypid (a.*, t.*), information_schema._pg_truetypmod (a.*, t.*))::information_schema.character_data AS interval_type, NULL::integer::information_schema.cardinal_number AS interval_precision, NULL::character varying::information_schema.sql_identifier AS character_set_catalog, NULL::character varying::information_schema.sql_identifier AS character_set_schema, NULL::character varying::information_schema.sql_identifier AS character_set_name, CASE WHEN nco.nspname IS NOT NULL THEN current_database() ELSE NULL::name END::information_schema.sql_identifier AS collation_catalog, nco.nspname::information_schema.sql_identifier AS collation_schema, co.collname::information_schema.sql_identifier AS collation_name, CASE WHEN t.typtype = 'd'::"char" THEN current_database() ELSE NULL::name END::information_schema.sql_identifier AS domain_catalog, CASE WHEN t.typtype = 'd'::"char" THEN nt.nspname ELSE NULL::name END::information_schema.sql_identifier AS domain_schema, CASE WHEN t.typtype = 'd'::"char" THEN t.typname ELSE NULL::name END::information_schema.sql_identifier AS domain_name, current_database()::information_schema.sql_identifier AS udt_catalog, COALESCE(nbt.nspname, nt.nspname)::information_schema.sql_identifier AS udt_schema, COALESCE(bt.typname, t.typname)::information_schema.sql_identifier AS udt_name, NULL::character varying::information_schema.sql_identifier AS scope_catalog, NULL::character varying::information_schema.sql_identifier AS scope_schema, NULL::character varying::information_schema.sql_identifier AS scope_name, NULL::integer::information_schema.cardinal_number AS maximum_cardinality, a.attnum::information_schema.sql_identifier AS dtd_identifier, 'NO'::character varying::information_schema.yes_or_no AS is_self_referencing, CASE WHEN a.attidentity = ANY (ARRAY['a'::"char", 'd'::"char"]) THEN 'YES'::text ELSE 'NO'::text END::information_schema.yes_or_no AS is_identity, CASE a.attidentity WHEN 'a'::"char" THEN 'ALWAYS'::text WHEN 'd'::"char" THEN 'BY DEFAULT'::text ELSE NULL::text END::information_schema.character_data AS identity_generation, seq.seqstart::information_schema.character_data AS identity_start, seq.seqincrement::information_schema.character_data AS identity_increment, seq.seqmax::information_schema.character_data AS identity_maximum, seq.seqmin::information_schema.character_data AS identity_minimum, CASE WHEN seq.seqcycle THEN 'YES'::text ELSE 'NO'::text END::information_schema.yes_or_no AS identity_cycle, 'NEVER'::character varying::information_schema.character_data AS is_generated, NULL::character varying::information_schema.character_data AS generation_expression, CASE WHEN (c.relkind = ANY (ARRAY['r'::"char", 'p'::"char"])) OR (c.relkind = ANY (ARRAY['v'::"char", 'f'::"char"])) AND pg_column_is_updatable (c.oid::regclass, a.attnum, FALSE) THEN 'YES'::text ELSE 'NO'::text END::information_schema.yes_or_no AS is_updatable FROM pg_attribute a LEFT JOIN pg_attrdef ad ON a.attrelid = ad.adrelid AND a.attnum = ad.adnum JOIN (pg_class c JOIN pg_namespace nc ON c.relnamespace = nc.oid) ON a.attrelid = c.oid JOIN (pg_type t JOIN pg_namespace nt ON t.typnamespace = nt.oid) ON a.atttypid = t.oid LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON bt.typnamespace = nbt.oid) ON t.typtype = 'd'::"char" AND t.typbasetype = bt.oid LEFT JOIN (pg_collation co JOIN pg_namespace nco ON co.collnamespace = nco.oid) ON a.attcollation = co.oid AND (nco.nspname <> 'pg_catalog'::name OR co.collname <> 'default'::name) LEFT JOIN (pg_depend dep JOIN pg_sequence seq ON dep.classid = 'pg_class'::regclass::oid AND dep.objid = seq.seqrelid AND dep.deptype = 'i'::"char") ON dep.refclassid = 'pg_class'::regclass::oid AND dep.refobjid = c.oid AND dep.refobjsubid = a.attnum WHERE NOT pg_is_other_temp_schema(nc.oid) AND a.attnum > 0 AND NOT a.attisdropped AND (c.relkind = ANY (ARRAY['r'::"char", 'v'::"char", 'f'::"char", 'p'::"char", 'c'::"char"])) AND (pg_has_role(c.relowner, 'USAGE'::text) OR has_column_privilege(c.oid, a.attnum, 'SELECT, INSERT, UPDATE, REFERENCES'::text)) ), -- -- ──────────────────────────────────────────────────────────── I ────────── -- :::::: M A I N Q U E R Y : : : : : : : : -- ────────────────────────────────────────────────────────────────────── -- main_query AS ( SELECT CASE col.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'c' THEN 'composite' END AS "kind", col.table_catalog AS "database", col.table_schema AS "schema", col.table_name AS "entity", col.column_name AS "name", col.column_default AS "defaultWithTypeCast", NOT CAST(col.is_nullable AS BOOLEAN) AS "notNull", col.sql_type AS "sqlType", col.typcategory AS "typeCategory", -- See http://www.postgresql.org/docs/current/static/catalog-pg-type.html -- MANUAL WAY: CASE WHEN col.data_type = 'ARRAY' THEN LEFT(format_type(col.atttypid, NULL), -2) ELSE NULL END AS "arrayType", col.attndims AS "arrayDimension", col.domain_catalog AS "domainDatabase", col.domain_schema AS "domainSchema", col.domain_name AS "domainName", col.udt_catalog AS "udtDatabase", col.udt_schema AS "udtSchema", regexp_replace(col.udt_name, '^_', '') AS "udtName", -- User Defined Types such AS composite, enumerated etc. ordinal_position AS "position", pg_catalog.col_description(col.oid, col.ordinal_position::INT) AS "comment" FROM information_schema_columns col WHERE col.table_schema = ANY ($1) ORDER BY col.table_schema, col.table_name, col.ordinal_position) -- -- ──────────────────────────────────────────────────────────────────────────── I ────────── -- :::::: E X E C U T E M A I N Q U E R Y : : : : : : : : -- ────────────────────────────────────────────────────────────────────────────────────── -- SELECT * FROM main_query
the_stack
-- 2020-07-14T13:39:06.542Z -- URL zum Konzept UPDATE AD_Reference SET Name='C_BankStatement Source',Updated=TO_TIMESTAMP('2020-07-14 16:39:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541125 ; -- 2020-07-14T13:39:41.235Z -- URL zum Konzept INSERT INTO AD_RelationType (AD_Client_ID,AD_Org_ID,AD_Reference_Source_ID,AD_RelationType_ID,Created,CreatedBy,EntityType,IsActive,IsDirected,IsTableRecordIdTarget,Name,Updated,UpdatedBy) VALUES (0,0,541125,540247,TO_TIMESTAMP('2020-07-14 16:39:40','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.swat','Y','Y','N','C_BankStatement -> ESR_Import',TO_TIMESTAMP('2020-07-14 16:39:40','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-07-14T13:43:02.109Z -- URL zum Konzept INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,541157,TO_TIMESTAMP('2020-07-14 16:43:01','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','ESR_Import target for C_BankStatement',TO_TIMESTAMP('2020-07-14 16:43:01','YYYY-MM-DD HH24:MI:SS'),100,'T') ; -- 2020-07-14T13:43:02.218Z -- URL zum Konzept INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Reference_ID=541157 AND NOT EXISTS (SELECT 1 FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 2020-07-14T13:43:13.046Z -- URL zum Konzept UPDATE AD_Reference SET EntityType='de.metas.payment.esr',Updated=TO_TIMESTAMP('2020-07-14 16:43:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541157 ; -- 2020-07-14T13:47:36.156Z -- URL zum Konzept INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Window_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy,WhereClause) VALUES (0,547550,0,541157,540409,540159,TO_TIMESTAMP('2020-07-14 16:47:35','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.payment.esr','Y','N',TO_TIMESTAMP('2020-07-14 16:47:35','YYYY-MM-DD HH24:MI:SS'),100,' exists ( select 1 from ESR_Import esr join ESR_ImportLine esrl on esr.ESR_Import_ID = esrl.ESR_Import_ID join C_BankStatementLine bsl on esrl.C_BankStatementLine_ID = bsl.C_BankStatementLine_ID join C_BankStatement bs on bsl.C_BankStatement_ID = bs.C_BankStatement_ID where ESR_Import.ESR_Import_ID = esr.ESR_Import_ID and ( esr.ESR_Import_ID = @ESR_Import_ID/-1@ or bs.C_BankStatement_ID = @C_BankStatement_ID/-1@) )') ; -- 2020-07-14T13:48:06.767Z -- URL zum Konzept UPDATE AD_RelationType SET AD_Reference_Target_ID=541157, EntityType='de.metas.payment.esr',Updated=TO_TIMESTAMP('2020-07-14 16:48:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=540247 ; -- 2020-07-14T15:02:15.590Z -- URL zum Konzept INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,541158,TO_TIMESTAMP('2020-07-14 18:02:14','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.payment.esr','Y','N','ESR_Import Source',TO_TIMESTAMP('2020-07-14 18:02:14','YYYY-MM-DD HH24:MI:SS'),100,'T') ; -- 2020-07-14T15:02:16.351Z -- URL zum Konzept INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Reference_ID=541158 AND NOT EXISTS (SELECT 1 FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 2020-07-14T15:02:59.157Z -- URL zum Konzept INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Window_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy) VALUES (0,547550,0,541158,540409,540159,TO_TIMESTAMP('2020-07-14 18:02:58','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.payment.esr','Y','N',TO_TIMESTAMP('2020-07-14 18:02:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-07-14T15:07:25.903Z -- URL zum Konzept UPDATE AD_Reference SET Name='C_Payment Target For ESR_ImportLine',Updated=TO_TIMESTAMP('2020-07-14 18:07:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=540539 ; -- 2020-07-14T15:07:30.456Z -- URL zum Konzept UPDATE AD_Reference SET Name='C_Payment Target For ESR_Import',Updated=TO_TIMESTAMP('2020-07-14 18:07:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=540539 ; -- 2020-07-14T15:11:01.402Z -- URL zum Konzept UPDATE AD_Ref_Table SET WhereClause='EXISTS (Select 1 from C_Payment p join ESR_ImportLine esrl on esrl.C_Payment_ID = p.C_Payment_ID JOIN ESR_Import esr on esrl.ESR_Import_ID = esr.ESR_Import_ID where p.C_Payment_ID = C_Payment.C_Payment_ID and esr.ESR_Import_ID = @ESR_Import_ID/-1@',Updated=TO_TIMESTAMP('2020-07-14 18:11:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=540539 ; -- 2020-07-14T15:11:06.818Z -- URL zum Konzept UPDATE AD_Ref_Table SET AD_Window_ID=195,Updated=TO_TIMESTAMP('2020-07-14 18:11:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=540539 ; -- 2020-07-14T15:11:37.627Z -- URL zum Konzept INSERT INTO AD_RelationType (AD_Client_ID,AD_Org_ID,AD_Reference_Source_ID,AD_Reference_Target_ID,AD_RelationType_ID,Created,CreatedBy,EntityType,IsActive,IsDirected,IsTableRecordIdTarget,Name,Updated,UpdatedBy) VALUES (0,0,541158,540539,540248,TO_TIMESTAMP('2020-07-14 18:11:37','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.payment.esr','Y','N','N','ESR_Import -> C_Payment',TO_TIMESTAMP('2020-07-14 18:11:37','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-07-14T15:12:15.524Z -- URL zum Konzept UPDATE AD_RelationType SET IsDirected='Y',Updated=TO_TIMESTAMP('2020-07-14 18:12:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=540248 ; -- 2020-07-14T15:13:18.175Z -- URL zum Konzept INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,541159,TO_TIMESTAMP('2020-07-14 18:13:17','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.payment','Y','N','C_Payment Source',TO_TIMESTAMP('2020-07-14 18:13:17','YYYY-MM-DD HH24:MI:SS'),100,'T') ; -- 2020-07-14T15:13:18.384Z -- URL zum Konzept INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Reference_ID=541159 AND NOT EXISTS (SELECT 1 FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 2020-07-14T15:14:03.075Z -- URL zum Konzept INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Window_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy) VALUES (0,5043,0,541159,335,195,TO_TIMESTAMP('2020-07-14 18:14:02','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.payment','Y','N',TO_TIMESTAMP('2020-07-14 18:14:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-07-14T15:14:58.422Z -- URL zum Konzept INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,541160,TO_TIMESTAMP('2020-07-14 18:14:58','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.payment.esr','Y','N','ESR_Import Target For C_Payment',TO_TIMESTAMP('2020-07-14 18:14:58','YYYY-MM-DD HH24:MI:SS'),100,'T') ; -- 2020-07-14T15:14:58.491Z -- URL zum Konzept INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Reference_ID=541160 AND NOT EXISTS (SELECT 1 FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 2020-07-14T15:15:31.468Z -- URL zum Konzept INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Window_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy) VALUES (0,547550,0,541160,540409,540159,TO_TIMESTAMP('2020-07-14 18:15:31','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.payment.esr','Y','N',TO_TIMESTAMP('2020-07-14 18:15:31','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-07-14T15:17:10.146Z -- URL zum Konzept UPDATE AD_Ref_Table SET WhereClause='exists (select 1 from ESR_Import esr JOIN ESR_ImportLine esrl on esr.ESR_Import_ID = esrl.ESR_Import_ID JOIN C_Payment p on esrl.C_Payment_ID = p.C_Payment_ID where p.C_Payment_ID = @C_Payment_ID/-1@ AND ESR_Import.ESR_Import_ID = esr.ESR_Import_ID)',Updated=TO_TIMESTAMP('2020-07-14 18:17:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541160 ; -- 2020-07-14T15:17:27.803Z -- URL zum Konzept INSERT INTO AD_RelationType (AD_Client_ID,AD_Org_ID,AD_Reference_Source_ID,AD_Reference_Target_ID,AD_RelationType_ID,Created,CreatedBy,EntityType,IsActive,IsDirected,IsTableRecordIdTarget,Name,Updated,UpdatedBy) VALUES (0,0,541159,541160,540249,TO_TIMESTAMP('2020-07-14 18:17:27','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.payment.esr','Y','N','N','C_Payment -> ESR_Import',TO_TIMESTAMP('2020-07-14 18:17:27','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-07-14T15:18:59.483Z -- URL zum Konzept UPDATE AD_Ref_Table SET WhereClause='EXISTS (Select 1 from C_Payment p join ESR_ImportLine esrl on esrl.C_Payment_ID = p.C_Payment_ID JOIN ESR_Import esr on esrl.ESR_Import_ID = esr.ESR_Import_ID where p.C_Payment_ID = C_Payment.C_Payment_ID and esr.ESR_Import_ID = @ESR_Import_ID/-1@)',Updated=TO_TIMESTAMP('2020-07-14 18:18:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=540539 ; -- 2020-07-14T15:19:13.711Z -- URL zum Konzept UPDATE AD_Reference SET Name='ESR_Import Target for C_BankStatement',Updated=TO_TIMESTAMP('2020-07-14 18:19:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541157 ; -- 2020-07-14T15:19:43.912Z -- URL zum Konzept DELETE FROM AD_RelationType WHERE AD_RelationType_ID=540110 ; -- 2020-07-14T15:19:53.298Z -- URL zum Konzept UPDATE AD_RelationType SET IsDirected='Y',Updated=TO_TIMESTAMP('2020-07-14 18:19:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=540249 ; -- 2020-07-20T14:09:06.291Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Reference SET Name='ESR_Import',Updated=TO_TIMESTAMP('2020-07-20 17:09:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541158 ; -- 2020-07-20T14:09:24.432Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Reference_Value_ID=541158,Updated=TO_TIMESTAMP('2020-07-20 17:09:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541763 ; -- 2020-07-20T14:18:44.090Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,552039,615412,0,540442,TO_TIMESTAMP('2020-07-20 17:18:43','YYYY-MM-DD HH24:MI:SS'),100,1,'de.metas.payment.esr','Y','N','N','N','N','N','N','N','Process Now',TO_TIMESTAMP('2020-07-20 17:18:43','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-07-20T14:18:44.092Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=615412 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2020-07-20T14:18:44.139Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(524) ; -- 2020-07-20T14:18:44.189Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=615412 ; -- 2020-07-20T14:18:44.193Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(615412) ; -- 2020-07-20T14:18:44.284Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,557168,615413,0,540442,TO_TIMESTAMP('2020-07-20 17:18:44','YYYY-MM-DD HH24:MI:SS'),100,10,'de.metas.payment.esr','Y','N','N','N','N','N','N','N','Anhang',TO_TIMESTAMP('2020-07-20 17:18:44','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-07-20T14:18:44.285Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=615413 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2020-07-20T14:18:44.286Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(543390) ; -- 2020-07-20T14:18:44.288Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=615413 ; -- 2020-07-20T14:18:44.288Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(615413) ; -- 2020-07-20T14:18:44.395Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,570817,615414,0,540442,TO_TIMESTAMP('2020-07-20 17:18:44','YYYY-MM-DD HH24:MI:SS'),100,'Zeigt an ob eine Zahlung bereits mit einem Kontoauszug abgeglichen wurde',1,'de.metas.payment.esr','Y','N','N','N','N','N','N','N','Abgeglichen',TO_TIMESTAMP('2020-07-20 17:18:44','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-07-20T14:18:44.397Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=615414 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2020-07-20T14:18:44.398Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(1105) ; -- 2020-07-20T14:18:44.402Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=615414 ; -- 2020-07-20T14:18:44.403Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(615414) ; -- 2020-07-20T14:19:34.967Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Element_ID,AD_UI_ElementGroup_ID,AD_UI_ElementType,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayed_SideList,IsDisplayedGrid,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNo_SideList,SeqNoGrid,Updated,UpdatedBy) VALUES (0,615414,0,540442,570384,540790,'F',TO_TIMESTAMP('2020-07-20 17:19:34','YYYY-MM-DD HH24:MI:SS'),100,'Zeigt an ob eine Zahlung bereits mit einem Kontoauszug abgeglichen wurde','Y','N','N','Y','N','N','N',0,'Abgeglichen',40,0,0,TO_TIMESTAMP('2020-07-20 17:19:34','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-07-20T14:20:59.031Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2020-07-20 17:20:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=615414 ; -- 2020-07-21T14:45:18.907Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_RelationType SET IsActive='N',Updated=TO_TIMESTAMP('2020-07-21 17:45:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=540247 ; -- 2020-07-21T14:45:37.858Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_RelationType SET IsActive='Y',Updated=TO_TIMESTAMP('2020-07-21 17:45:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=540247 ; -- 2020-07-21T14:49:24.018Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_RelationType SET AD_Reference_Source_ID=540592,Updated=TO_TIMESTAMP('2020-07-21 17:49:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=540247 ; -- 2020-07-21T14:49:36.950Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_RelationType SET AD_Reference_Source_ID=541125,Updated=TO_TIMESTAMP('2020-07-21 17:49:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=540247 ; -- 2020-07-21T14:50:09.932Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Ref_Table SET WhereClause=' exists ( select 1 from ESR_Import esr join ESR_ImportLine esrl on esr.ESR_Import_ID = esrl.ESR_Import_ID join C_BankStatementLine bsl on esrl.C_BankStatementLine_ID = bsl.C_BankStatementLine_ID join C_BankStatement bs on bsl.C_BankStatement_ID = bs.C_BankStatement_ID where ESR_Import.ESR_Import_ID = esr.ESR_Import_ID and bs.C_BankStatement_ID = @C_BankStatement_ID/-1@ )',Updated=TO_TIMESTAMP('2020-07-21 17:50:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541157 ; -- 2020-07-21T14:51:42.941Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,541165,TO_TIMESTAMP('2020-07-21 17:51:42','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.payment.esr','Y','N','C_BankStatement Target for ESR_mport',TO_TIMESTAMP('2020-07-21 17:51:42','YYYY-MM-DD HH24:MI:SS'),100,'T') ; -- 2020-07-21T14:51:42.944Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Reference_ID=541165 AND NOT EXISTS (SELECT 1 FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 2020-07-21T14:52:51.164Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Reference SET Name='C_BankStatement Target for ESR_Import',Updated=TO_TIMESTAMP('2020-07-21 17:52:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541165 ; -- 2020-07-21T14:54:19.190Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Window_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,ShowInactiveValues,Updated,UpdatedBy) VALUES (0,4909,0,541165,392,194,TO_TIMESTAMP('2020-07-21 17:54:19','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.payment.esr','Y','N','N',TO_TIMESTAMP('2020-07-21 17:54:19','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-07-21T14:55:56.151Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Ref_Table SET WhereClause=' exists ( select 1 from ESR_Import esr join ESR_ImportLine esrl on esr.ESR_Import_ID = esrl.ESR_Import_ID join C_BankStatementLine bsl on esrl.C_BankStatementLine_ID = bsl.C_BankStatementLine_ID join C_BankStatement bs on bsl.C_BankStatement_ID = bs.C_BankStatement_ID where bs.C_BankStatement_ID = C_BankStatement.C_BankStatement_ID and esr.ESR_Import_ID = @ESR_Import_ID/-1@ )',Updated=TO_TIMESTAMP('2020-07-21 17:55:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541165 ; -- 2020-07-21T14:56:13.596Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_RelationType (AD_Client_ID,AD_Org_ID,AD_Reference_Source_ID,AD_Reference_Target_ID,AD_RelationType_ID,Created,CreatedBy,EntityType,IsActive,IsDirected,IsTableRecordIdTarget,Name,Updated,UpdatedBy) VALUES (0,0,541158,541165,540250,TO_TIMESTAMP('2020-07-21 17:56:13','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.swat','Y','N','N','ESR_Import -> Bank Statement',TO_TIMESTAMP('2020-07-21 17:56:13','YYYY-MM-DD HH24:MI:SS'),100) ;
the_stack
-- 正在导出表 ibase4j.sys_menu 的数据:~36 rows (大约) /*!40000 ALTER TABLE `sys_menu` DISABLE KEYS */; INSERT INTO `sys_menu` (`id_`, `menu_name`, `menu_type`, `parent_id`, `iconcls_`, `request_`, `expand_`, `sort_no`, `is_show`, `permission_`, `remark_`, `enable_`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1, '主控面板', 1, 0, 'icon-home4', '/main/welcome.html', 0, 1, 1, 'main.index', NULL, 1, 1, '2016-06-20 09:16:56', 2, '2017-03-18 17:09:08'), (2, '系统管理', 1, 0, 'glyphicon glyphicon-cog', '#', 0, 1, 1, 'sys', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-29 08:19:19'), (3, '基础管理', 1, 2, NULL, '#', 0, 1, 1, 'sys.base', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-20 09:16:56'), (4, '用户管理', 1, 3, NULL, '/main/admin/user.html', 0, 1, 1, 'sys.base.user', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-03-07 17:45:37'), (5, '部门管理', 1, 3, NULL, '/main/admin/department.html', 0, 2, 1, 'sys.base.dept', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-02-02 21:46:00'), (6, '单位管理', 1, 3, NULL, '/main/admin/unit.html', 0, 2, 1, 'sys.base.unit', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-03-07 17:45:51'), (7, '角色管理', 1, 3, NULL, '/main/admin/role.html', 0, 4, 1, 'sys.base.role', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-02-02 21:46:01'), (8, '菜单管理', 1, 3, NULL, '/main/admin/menu.html', 0, 5, 1, 'sys.base.menu', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-02-02 21:46:02'), (9, '会话管理', 1, 3, NULL, '/main/admin/session.html', 0, 6, 0, 'sys.base.session', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-02-02 21:46:03'), (10, '字典管理', 1, 3, NULL, '/main/admin/dic.html', 0, 7, 1, 'sys.base.dic', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-02-02 21:46:04'), (11, '参数管理', 1, 3, NULL, '/main/admin/param.html', 0, 8, 1, 'sys.base.param', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-02-02 21:46:05'), (12, '操作日志', 1, 3, NULL, '/main/admin/systemLog.html', 0, 9, 1, 'sys.base.event', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-20 09:16:56'), (13, '权限管理', 1, 2, NULL, '#', 0, 2, 1, '', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-20 09:16:56'), (14, '清除缓存', 1, 13, NULL, NULL, 0, 9, 0, 'sys.cache', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-29 09:39:25'), (15, '人员角色', 1, 13, NULL, '/main/admin/personalRole.html', 0, 1, 1, 'sys.permisson.userRole', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-29 09:39:25'), (16, '人员菜单', 1, 13, NULL, '/main/admin/personalMenu.html', 0, 2, 1, 'sys.permisson.userMenu', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-29 09:39:27'), (17, '角色菜单', 1, 13, NULL, '/main/admin/roleMenu.html', 0, 3, 1, 'sys.permisson.roleMenu', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-29 09:39:33'), (18, '人员操作权限', 1, 13, NULL, '/main/admin/personalPermission.html', 0, 4, 1, 'sys.permisson.user', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-29 09:39:29'), (19, '角色操作权限', 1, 13, NULL, '/main/admin/rolePermission.html', 0, 5, 1, 'sys.permisson.role', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-29 09:39:29'), (20, '公共信息管理', 1, 2, NULL, '#', 0, 3, 1, 'sys.cms', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-03-07 17:18:50'), (21, '新闻中心', 1, 20, NULL, '/main/cms/news.html', 0, 2, 1, 'sys.cms.news', NULL, 1, 1, '2017-01-29 12:56:57', 1, '2017-03-07 17:19:50'), (30, '邮件管理', 1, 2, NULL, '#', 0, 4, 1, 'sys.email', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-20 09:16:56'), (31, '邮件管理列表', 1, 30, NULL, '/main/admin/email.html', 0, 1, 1, 'sys.email.list', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-20 09:16:56'), (32, '邮件发送设置', 1, 30, NULL, '/main/admin/emailSend.html', 0, 2, 1, 'sys.email.config', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-02-03 14:55:15'), (33, '邮件模版设置', 1, 30, NULL, '/main/admin/emailTemplate.html', 0, 3, 1, 'sys.email.template', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2016-06-20 09:16:56'), (40, '任务调度', 1, 2, NULL, '#', 0, 6, 1, 'sys.task', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-03-08 11:08:49'), (41, '调度管理', 1, 40, NULL, '/main/admin/timedTask.html', 0, 1, 1, 'sys.task.scheduled', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-02-02 21:46:32'), (42, '调度日志', 1, 40, NULL, '/main/admin/taskLog.html', 0, 2, 1, 'sys.task.log', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-02-02 21:46:33'), (51, '消息管理', 1, 0, 'icon-envelop2', '#', 0, 10, 1, 'cms', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-03-07 17:42:37'), (53, '系统消息', 1, 51, '', '#', 0, 1, 1, 'cms.sys', NULL, 1, 1, '2016-06-20 09:16:56', 1, '2017-05-28 18:56:03'), (54, '通知公告', 1, 53, NULL, '/main/cms/notice.html', 0, 1, 1, 'cms.notice', NULL, 1, 1, '2017-01-29 12:57:58', 2, '2017-03-12 18:55:52'), (55, '文章管理', 2, 20, NULL, '/main/cms/article.html', 0, 1, 1, 'cms.article', NULL, 1, 1, '2017-03-07 17:19:39', 2, '2017-03-12 18:54:29'), (56, '反馈管理', 2, 20, NULL, '/main/cms/feedback.html', 0, 3, 1, 'cms.feedback', NULL, 1, 1, '2017-03-07 17:20:14', 2, '2017-03-12 18:55:02'), (57, '短信管理', 2, 2, NULL, '#', 0, 5, 1, NULL, NULL, 1, 1, '2017-03-07 17:34:18', 1, '2017-03-07 17:34:18'), (58, '短信管理列表', 2, 57, NULL, '/main/msg/msg.html', 0, 1, 1, 'msg.list', NULL, 1, 1, '2017-03-07 17:34:54', 2, '2017-03-14 11:16:29'), (59, '短信发送设置', 2, 57, NULL, '/main/msg/msgConfig.html', 0, 2, 1, 'msg.config', NULL, 1, 1, '2017-03-07 17:36:26', 2, '2017-03-14 11:16:42'); /*!40000 ALTER TABLE `sys_menu` ENABLE KEYS */; -- 正在导出表 ibase4j.sys_role_menu 的数据:~100 rows (大约) /*!40000 ALTER TABLE `sys_role_menu` DISABLE KEYS */; INSERT INTO `sys_role_menu` (`id_`, `role_id`, `menu_id`, `permission_`, `enable_`, `remark_`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1, 1, 1, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (2, 1, 2, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (3, 1, 3, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (4, 1, 4, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (5, 1, 5, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (6, 1, 6, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (7, 1, 7, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (8, 1, 8, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (9, 1, 9, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (10, 1, 10, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (11, 1, 11, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (12, 1, 12, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (13, 1, 13, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (14, 1, 15, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (15, 1, 16, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (16, 1, 17, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (17, 1, 18, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (18, 1, 19, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (19, 1, 14, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (20, 1, 20, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (21, 1, 55, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (22, 1, 21, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (23, 1, 56, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (24, 1, 30, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (25, 1, 31, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (26, 1, 32, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (27, 1, 33, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (28, 1, 57, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (29, 1, 58, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (30, 1, 59, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (31, 1, 40, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (32, 1, 41, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (33, 1, 42, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (34, 1, 51, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (35, 1, 53, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (36, 1, 54, 'read', 1, NULL, 1, '2017-05-28 18:37:56', 1, '2017-05-28 18:37:56'), (37, 1, 4, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (38, 1, 4, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (39, 1, 4, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (40, 1, 5, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (41, 1, 5, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (42, 1, 5, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (43, 1, 6, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (44, 1, 6, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (45, 1, 6, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (46, 1, 7, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (47, 1, 7, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (48, 1, 7, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (49, 1, 8, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (50, 1, 8, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (51, 1, 8, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (52, 1, 9, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (53, 1, 9, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (54, 1, 9, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (55, 1, 10, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (56, 1, 10, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (57, 1, 10, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (58, 1, 11, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (59, 1, 11, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (60, 1, 11, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (61, 1, 15, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (62, 1, 16, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (63, 1, 17, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (64, 1, 18, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (65, 1, 19, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (66, 1, 14, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (67, 1, 55, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (68, 1, 55, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (69, 1, 55, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (70, 1, 21, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (71, 1, 21, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (72, 1, 21, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (73, 1, 56, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (74, 1, 56, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (75, 1, 56, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (76, 1, 31, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (77, 1, 31, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (78, 1, 31, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (79, 1, 32, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (80, 1, 32, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (81, 1, 32, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (82, 1, 33, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (83, 1, 33, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (84, 1, 33, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (85, 1, 58, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (86, 1, 58, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (87, 1, 58, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (88, 1, 59, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (89, 1, 59, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (90, 1, 59, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (91, 1, 41, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (92, 1, 41, 'close', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (93, 1, 41, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (94, 1, 41, 'open', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (95, 1, 41, 'run', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (96, 1, 41, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (97, 1, 42, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (98, 1, 54, 'add', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (99, 1, 54, 'delete', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'), (100, 1, 54, 'update', 1, NULL, 1, '2017-05-28 19:02:25', 1, '2017-05-28 19:02:25'); /*!40000 ALTER TABLE `sys_role_menu` ENABLE KEYS */;
the_stack
--int1 create table source(a int); insert into source values(1); drop table t1; drop table t2; create table t1(a int1, b int1); create table t2(a int1, b int1); insert into t1 select generate_series(1, 127), generate_series(1, 127) from source; insert into t2 select generate_series(1, 127), generate_series(1, 127) from source; analyze t1; analyze t2; explain (costs off) select * from t1, t2 where t1.a = t2.b; select * from t1, t2 where t1.a = t2.b order by 1, 2, 3, 4; drop table t1; drop table t2; --oid create table t1(a oid, b oid); create table t2(a oid, b oid); insert into t1 select generate_series(1, 127), generate_series(1, 127) from source; insert into t2 select generate_series(1, 127), generate_series(1, 127) from source; analyze t1; analyze t2; explain (costs off) select * from t1, t2 where t1.a = t2.b; select * from t1, t2 where t1.a = t2.b order by 1, 2, 3, 4; drop table t1; drop table t2; --bool create table t1(a bool, b bool); create table t2(a bool, b bool); explain (costs off) select * from t1, t2 where t1.a = t2.b; select * from t1, t2 where t1.a = t2.b order by 1, 2, 3, 4; drop table t1; drop table t2; --char create table t1(a "char", b "char"); create table t2(a "char", b "char"); insert into t1 select generate_series(1, 127)::char,generate_series(1, 127)::char from source; insert into t2 select generate_series(1, 127)::char,generate_series(1, 127)::char from source; analyze t1; analyze t2; explain (costs off) select * from t1, t2 where t1.a = t2.b; select * from t1, t2 where t1.a = t2.b order by 1, 2, 3, 4; drop table t1; drop table t2; --name create table t1(a name, b name); create table t2(a name, b name); explain (costs off) select * from t1, t2 where t1.a = t2.b order by 1, 2, 3, 4; select * from t1, t2 where t1.a = t2.b order by 1, 2, 3, 4; drop table t1; drop table t2; --int2vector create table t1(a int2vector, b int2vector); create table t2(a int2vector, b int2vector); insert into t1 select * from t2; drop table t1; drop table t2; --NVARCHAR2 create table t1(a NVARCHAR2, b NVARCHAR2); create table t2(a NVARCHAR2, b NVARCHAR2); insert into t1 select * from t2; drop table t1; drop table t2; --OIDVECTOR create table t1(a OIDVECTOR, b OIDVECTOR); create table t2(a OIDVECTOR, b OIDVECTOR); insert into t1 select * from t2; drop table t1; drop table t2; --FLOAT4 create table t1(a FLOAT4, b FLOAT4); create table t2(a FLOAT4, b FLOAT4); insert into t1 select * from t2; drop table t1; drop table t2; --ABSTIME create table t1(a ABSTIME, b ABSTIME); create table t2(a ABSTIME, b ABSTIME); insert into t1 select * from t2; drop table t1; drop table t2; --RELTIME create table t1(a RELTIME, b RELTIME); create table t2(a RELTIME, b RELTIME); insert into t1 select * from t2; drop table t1; drop table t2; --CASH create table t1(a MONEY, b MONEY); create table t2(a MONEY, b MONEY); insert into t1 select * from t2; drop table t1; drop table t2; --BYTEA create table t1(a BYTEA, b BYTEA); create table t2(a BYTEA, b BYTEA); insert into t1 select * from t2; drop table t1; drop table t2; --DATE create table t1(a DATE, b DATE); create table t2(a DATE, b DATE); insert into t1 select * from t2; drop table t1; drop table t2; --INTERVAL create table t1(a INTERVAL, b INTERVAL); create table t2(a INTERVAL, b INTERVAL); insert into t1 select * from t2; drop table t1; drop table t2; --TIMETZ create table t1(a TIMETZ, b TIMETZ); create table t2(a TIMETZ, b TIMETZ); insert into t1 select * from t2; drop table t1; drop table t2; -- SMALLDATETIME create table t1(a SMALLDATETIME, b SMALLDATETIME); create table t2(a SMALLDATETIME, b SMALLDATETIME); insert into t1 select * from t2; drop table t1; drop table t2; --check passwd create user testtest password 'tsettset'; create user test_llt password 'Ttest@123'; alter user test_llt with password '321@tsetT'; create table t1(a int); create function test(t1) returns void as $$ begin return; end $$ language plpgsql; declare a t1; begin perform test(a); end; / explain (costs off) select * from t1 where not exists (select a from t2); select * from t1 where not exists (select a from t2); explain (costs off) select * from t1 where not a = any (select a from t2); select * from t1 where not a = any (select a from t2); create table test_range_datatype_int2(a int2) partition by range(a) ( partition test_range_datatype_int2_p1 values less than (1), partition test_range_datatype_int2_p2 values less than (2) ); vacuum full test_range_datatype_int2; set enable_kill_query=on; create user test_llt_cancel password 'Ttest@123'; set current_schema = test_llt; create table test(a int); set current_schema = public; drop user test_llt_cancel cascade; --bytealt create table test_bytea(a bytea, b bytea); insert into test_bytea values('abc', 'abcd'); select * from test_bytea where a < b; --rawne create table test_raw(a raw, b raw); insert into test_raw values('abc', 'abc'), ('abc', 'abcde'); select * from test_raw where a != b; --rawtotext select rawtohex(a) from test_raw; --DCH_from_char select to_timestamp('20120930 09:30 pm', 'yyyymmdd hh:MI pm'); select to_timestamp('20120930 09:30 p.m.', 'yyyymmdd hh:MI p.m.'); select to_timestamp('20120930 09:30 111', 'yyyymmdd hh:MI MS'); select to_timestamp('20120930 09:30 111', 'yyyymmdd hh:MI US'); select to_timestamp('20120930 09:30 11111', 'yyyymmdd hh:MI SSSSS'); select to_timestamp('20120930 09:30 11111 TZ', 'yyyymmdd hh:MI SSSSS TZ'); select to_timestamp('20120930 09:30 111 B.C.', 'yyyymmdd hh:MI US B.C.'); select to_timestamp('20120930 09:30 111 BC', 'yyyymmdd hh:MI US BC'); select to_timestamp('20120930 09:30 111 fri', 'yyyymmdd hh:MI US dy'); select to_timestamp('20120930 09:30 111 fri 3', 'yyyymmdd hh:MI US dy Q'); select to_timestamp('2012I30 09:30 111 fri 3', 'yyyyRMdd hh:MI US dy Q'); select to_timestamp('20120930 09:30 5 1234', 'yyyymmdd hh:MI W J'); select to_timestamp('20120930 09:30 pm', 'yyyymmdd hh:MI pm FF'); select to_timestamp('20120930 09:30 5555', 'yyyymmdd hh:MI RRRR'); select to_timestamp('20120930 09:30 55', 'yyyymmdd hh:MI RR'); select to_timestamp('20120930 09:30 55', 'yyyymmdd hh:MI FF'); --create role create role llt_1 password 'Ttest@123' auditadmin; create role llt_2 password 'Ttest@123' auditadmin auditadmin; create role llt_3 password 'Ttest@123' sysadmin sysadmin; create role llt_3 password 'Ttest@123' default tablespace abc; create role llt_4 password 'Ttest@123' default tablespace abc default tablespace abc; create role llt_5 password 'Ttest@123' profile default; --alter role alter role llt_5 auditadmin auditadmin; alter role llt_5 sysadmin sysadmin; --pg_test_err_contain_err select pg_test_err_contain_err(1); select pg_test_err_contain_err(2); select pg_test_err_contain_err(3); select pg_test_err_contain_err(4); select pg_test_err_contain_err(5); --DCH_check select to_timestamp('20130230','yyyyMMDD'); select to_timestamp('0230','MMDD'); select to_timestamp('2014366','yyyyddd'); select to_timestamp('13','HH12'); select to_timestamp('13000','sssss'); select to_timestamp('monday','DAY'); select to_timestamp('monday','Day'); select to_timestamp('monday','day'); select to_timestamp('mon','DY'); select to_timestamp('july','MONTH'); select to_timestamp('july','month'); select to_timestamp('feb','mon'); select to_timestamp('I','rm'); select to_date(19980101100000); create schema alter_llt1; create user alter_llt2 password 'Ttest@123'; create table alter_llt1.t1(f1 serial primary key, f2 int check (f2 > 0)); create view alter_llt1.v1 as select * from alter_llt1.t1; create function alter_llt1.plus1(int) returns int as 'select $1+1' language sql; --create domain alter_llt1.posint integer check (value > 0); create type alter_llt1.ctype as (f1 int, f2 text); create function alter_llt1.same(alter_llt1.ctype, alter_llt1.ctype) returns boolean language sql as 'select $1.f1 is not distinct from $2.f1 and $1.f2 is not distinct from $2.f2'; create operator alter_llt2.> (procedure = alter_llt1.same, leftarg = alter_llt1.ctype, rightarg = alter_llt1.ctype); --do_to_timestamp select to_timestamp('20130101a','YYYYMMdd'); SELECT TO_TIMESTAMP('2014', 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'); SELECT TO_TIMESTAMP('2014-15', 'YYYY-HH-YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'); SELECT TO_TIMESTAMP('12-15', 'SSSSS-SS'); SELECT TO_TIMESTAMP('12-01', 'SSSSS-HH'); SELECT TO_TIMESTAMP('2014-01-02', 'YYYY-DDD-MM'); SELECT TO_TIMESTAMP('2014-01-02', 'YYYY-DDD-DD'); SELECT TO_TIMESTAMP('2014-01-02', 'YYYY12-DDD-DD'); SELECT TO_TIMESTAMP('2014', 'YYYY12YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'); CREATE TABLE LLT_PART_TEST1(A INT , B INT, C INT) PARTITION BY RANGE(A) ( PARTITION P1 VALUES LESS THAN (1000) ); SELECT * FROM LLT_PART_TEST1 WHERE A > 10 AND A IS NULL; INSERT INTO LLT_PART_TEST1 VALUES (GENERATE_SERIES(1, 130), GENERATE_SERIES(1, 130), GENERATE_SERIES(1, 130)); CREATE INDEX IDX_ON_T1 ON LLT_PART_TEST1(A) LOCAL; VACUUM LLT_PART_TEST1 PARTITION (P1); CLUSTER LLT_PART_TEST1 USING IDX_ON_T1; CREATE VIEW VIEW_ON_LLT_PART_TEST1 AS SELECT * FROM LLT_PART_TEST1; INSERT INTO VIEW_ON_LLT_PART_TEST1 SELECT * FROM LLT_PART_TEST1; CREATE OR REPLACE FUNCTION RESULT_COUNT() RETURNS INTEGER AS $$ DECLARE MYINTEGER INTEGER ; BEGIN SELECT COUNT(*) INTO MYINTEGER FROM LLT_PART_TEST1 WHERE A < 1; RETURN MYINTEGER; END; $$LANGUAGE PLPGSQL; CALL RESULT_COUNT(); DROP TABLE LLT_PART_TEST1 CASCADE; DROP FUNCTION RESULT_COUNT(); CREATE TABLE LLT_INT1_AVG_ACCUM(A INT1); INSERT INTO LLT_INT1_AVG_ACCUM VALUES (GENERATE_SERIES(1, 130)); SELECT AVG(A) FROM LLT_INT1_AVG_ACCUM; DROP TABLE LLT_INT1_AVG_ACCUM; select count(*)::bool from pg_stat_get_activity(NULL); select smalldatetime_smaller('19860111','19860405'); select smalldatetime_smaller('19860405','19860111'); select smalldatetime_larger('19570906','19600907'); select smalldatetime_larger('19600907','19570906'); --blacklist in llt SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_t:s0'; CREATE TYPE bigobj (INPUT = lo_filein, OUTPUT = lo_fileout, INTERNALLENGTH = VARIABLE); CREATE TYPE float8_range AS RANGE (subtype = float8, subtype_diff = float8mi); ALTER TYPE colors ADD VALUE 'orange' AFTER 'red'; CREATE COLLATION french (LOCALE = 'fr_FR.utf8'); UNLISTEN virtual; NOTIFY virtual; CREATE LANGUAGE plperl; CREATE OPERATOR FAMILY name USING ALTER OPERATOR FAMILY integer_ops USING btree ADD OPERATOR 1 < (int4, int2) , OPERATOR 2 <= (int4, int2) , FUNCTION 1 btint24cmp(int2, int4) ; ALTER TEXT SEARCH DICTIONARY my_dict ( StopWords = newrussian ); drop table t1 CASCADE; drop table test_raw cascade;
the_stack
set pagesize 100 linesize 200 trims on tab off feedback off echo off verify off set serveroutput on column plan_table_output format a150 column source format a7 column sqlset_name format a40 REM REM $Header: REM REM Copyright (c) 2019, Oracle Corporation. All rights reserved. REM REM AUTHOR REM nigel.bayliss@oracle.com REM REM SCRIPT REM fix_all.sql REM REM DESCRIPTION REM This script generates a SQL plan baselines by taking a REM known plan from the cursor cache, SQL tuning sets or AWR REM and applies it to an existing SQL statement. REM REM Setting the FIX parameter will create a FIXED SQL plan REM baseline. However, it is often beneficial to avoid fixing REM the plan baseline and allow SQL plan management to REM find alternative execution plans. Ultimately, these plans REM can be verified and accepted using SQLplan management REM evolution (because, over time a new plan may be required REM to maintain optimimal performance). REM REM If you would like to accept plans manually (rather than REM automatically), then you can use the following setting: REM REM BEGIN REM DBMS_SPM.SET_EVOLVE_TASK_PARAMETER( REM task_name => 'SYS_AUTO_SPM_EVOLVE_TASK', REM parameter => 'ACCEPT_PLANS', REM value => 'false' ); REM END; REM / REM REM In this way, you chosen plans will remain unchanged unless REM you manually accept new SQL plan baseline plans. REM REM REM PRE-REQUISITES REM 1. Oracle Tuning Pack license. REM REM PARAMETERS REM 1. SQL_ID (required) REM 2. FIX - A FIXED SQL plan basline is created REM The new plan baseline is not FIXED REM 3. NOFORCE - An exception is raised if a SQL plan REM baseline already exists. REM FORCE - Existing SQL plan baselines are disabled (or REM dropped in the case of Standard Edition) REM REM REM EXECUTION REM 1. Connect into SQL*Plus as SYSDBA or user with access to REM data dictionary. REM 2. Execute script fix_awr_spm.sql REM REM EXAMPLE REM # sqlplus system REM SQL> START fix_all.sql [SQL_ID] FIX/NOFIX FORCE/NOFORCE REM SQL> START fix_all.sql 8c2dqym0cbqvj fix force REM PRO PRO Parameter 1: PRO TARGET_SQL_ID (required) PRO DEF target_sql_id = '&1'; PRO PRO Parameter 2: PRO FIX (required) PRO DEF fix = '&2'; PRO PRO Parameter 3: PRO FORCE (required) PRO DEF force = '&3'; WITH p AS ( SELECT plan_hash_value,'CACHE' source FROM v$sql_plan WHERE sql_id = TRIM('&&target_sql_id.') AND other_xml IS NOT NULL UNION SELECT plan_hash_value,'AWR' source FROM dba_hist_sql_plan WHERE sql_id = TRIM('&&target_sql_id.') AND other_xml IS NOT NULL ), m AS ( SELECT plan_hash_value, SUM(elapsed_time)/SUM(executions) avg_et_secs FROM v$sql WHERE sql_id = TRIM('&&target_sql_id.') AND executions > 0 GROUP BY plan_hash_value ), a AS ( SELECT plan_hash_value, SUM(elapsed_time_total)/SUM(executions_total) avg_et_secs FROM dba_hist_sqlstat WHERE sql_id = TRIM('&&target_sql_id.') AND executions_total > 0 GROUP BY plan_hash_value ) SELECT p.plan_hash_value, p.source, ROUND(NVL(m.avg_et_secs, a.avg_et_secs)/1e6, 3) avg_et_secs FROM p, m, a WHERE p.plan_hash_value = m.plan_hash_value(+) AND p.plan_hash_value = a.plan_hash_value(+) ORDER BY avg_et_secs NULLS LAST; select plan_hash_value,'SQLSET' source,avg(ROUND(decode(executions,0,0,elapsed_time/executions)/1e6, 3)) avg_et_secs from dba_sqlset_statements where sql_id = '&&target_sql_id.' group by plan_hash_value, 'SQLSET' order by plan_hash_value; prompt accept source_phv number prompt 'Enter the plan hash value you want to capture: ' declare v_np pls_integer; v_dummy pls_integer; v_sqlsetname varchar2(40); v_sqlsetowner varchar2(100); v_fix_yn varchar2(3) := 'NO'; v_planname varchar2(100); v_newhandle varchar2(100); v_thesource varchar2(10); v_plantime date; v_thesnap number(30); v_signature number(30); v_txt clob; v_target_sqlid varchar2(50) := trim('&&target_sql_id.'); v_source_phv number(20) := '&&source_phv.'; v_fix varchar2(100):= upper('&&fix.'); v_force varchar2(100):= upper('&&force.'); cursor get_source is select * from ( SELECT 'CACHE' source,1,null name,null own FROM v$sql_plan WHERE sql_id = v_target_sqlid AND plan_hash_value = v_source_phv AND other_xml IS NOT NULL UNION SELECT 'AWR' source,2,null name,null own FROM dba_hist_sql_plan WHERE sql_id = v_target_sqlid AND plan_hash_value = v_source_phv AND other_xml IS NOT NULL UNION select 'SQLSET' source,3,sqlset_name name,sqlset_owner from dba_sqlset_statements where sql_id = v_target_sqlid and plan_hash_value = v_source_phv) order by 2; cursor existing_spbs is select sql_handle,plan_name from dba_sql_plan_baselines b, v$sqlarea s where s.exact_matching_signature = b.signature and s.sql_id = v_target_sqlid and enabled = 'YES'; cursor get_handle_and_name is select sql_handle,plan_name from dba_sql_plan_baselines b where b.signature = v_signature and b.accepted = 'YES' and rownum = 1; cursor spb_plans is select t.plan_table_output pout,pb.sql_handle from (select distinct sql_handle from dba_sql_plan_baselines where signature = v_signature) pb, table(dbms_xplan.display_sql_plan_baseline(pb.sql_handle,null,'BASIC')) t where t.plan_table_output like 'Plan name%' or t.plan_table_output like 'Plan hash%' or t.plan_table_output like 'Enabled%'; cursor get_max_time is select max(timestamp) maxts from dba_hist_sql_plan where sql_id = v_target_sqlid and plan_hash_value = v_source_phv; cursor get_snapshot is select snap_id from dba_hist_snapshot where v_plantime between begin_interval_time and end_interval_time; cursor get_signature is select dbms_sqltune.sqltext_to_signature(sql_text) from ( select sql_fulltext sql_text from v$sqlarea where sql_id = v_target_sqlid and rownum = 1 union all select sql_text from dba_hist_sqltext where sql_id = v_target_sqlid and rownum = 1 union all select sql_text from dba_sqlset_statements where sql_id = v_target_sqlid and rownum = 1) where rownum = 1; begin -- -- Parameters -- if (v_fix != 'FIX' and v_fix != 'NOFIX') then raise_application_error (-20003, 'Parameter number 2 must be FIX or NOFIX'); end if; if (v_fix = 'FIX') then v_fix_yn := 'YES'; end if; if (v_force != 'FORCE' and v_force != 'NOFORCE') then raise_application_error (-20004, 'Parameter number 3 must be FORCE or NOFORCE'); end if; -- -- Find the SQL_ID/PHV we want -- open get_source; fetch get_source into v_thesource,v_dummy,v_sqlsetname,v_sqlsetowner; if (get_source%NOTFOUND) then close get_source; raise_application_error (-20001, 'Cannot find SQL_ID/PHV specified'); end if; close get_source; -- -- Disable exising SQL plan baselines if FORCE -- dbms_output.put_line('...'); dbms_output.put_line('...Disable existing SQL Plan Baslines for target SQL statement ID: '||v_target_sqlid); for rec in existing_spbs loop if (v_force != 'FORCE') then raise_application_error (-20005, 'NOFORCE specified and there are existing SQL plan baselines for target SQL statement. Plan baseline name: '||rec.plan_name); end if; dbms_output.put_line('...... Disable SPB '||rec.sql_handle||' '||rec.plan_name); v_np := dbms_spm.alter_sql_plan_baseline(rec.sql_handle,rec.plan_name,'enabled','NO'); end loop; -- -- Load the SPB plan based on source -- if (v_thesource = 'AWR') then -- -- ** -- ** This is not elegant - but I need to get begin and end SnapID -- ** -- open get_max_time; fetch get_max_time into v_plantime; close get_max_time; open get_snapshot; fetch get_snapshot into v_thesnap; close get_snapshot; dbms_output.put_line('... Load from AWR: SnapID '||v_thesnap||' FIXED = '||v_fix_yn); v_np := dbms_spm.load_plans_from_awr(fixed=>v_fix_yn,begin_snap=>v_thesnap-1,end_snap=>v_thesnap, basic_filter=>'plan_hash_value='''||v_source_phv||''' and sql_id='''||v_target_sqlid||''''); end if; if (v_thesource = 'CACHE') then dbms_output.put_line('... Load from cursor cache FIXED = '||v_fix_yn); v_np := dbms_spm.load_plans_from_cursor_cache(fixed=>v_fix_yn,sql_id=>v_target_sqlid,plan_hash_value=>v_source_phv); end if; if (v_thesource = 'SQLSET') then dbms_output.put_line('... Load from SQL Tuning set '''||v_sqlsetname||''' FIXED = '||v_fix_yn); v_np := dbms_spm.load_plans_from_sqlset(fixed=>v_fix_yn,sqlset_name=>v_sqlsetname,sqlset_owner=>v_sqlsetowner, basic_filter=>'plan_hash_value='''||v_source_phv||''' and sql_id='''||v_target_sqlid||''''); end if; dbms_output.put_line('... SQL plan baselines for target SQL statement:'); -- -- Get data on SPBs -- ** -- ** It seems hard to discover relevant signature, plan name and handle ** -- ** This is not elegant -- ** -- open get_signature; fetch get_signature into v_signature; close get_signature; open get_handle_and_name; fetch get_handle_and_name into v_newhandle,v_planname; close get_handle_and_name; -- -- Display information on SPB -- for rec in spb_plans loop dbms_output.put_line('...... '||rec.pout); end loop; dbms_output.put_line('--'); dbms_output.put_line('-- To export SQL plan baselines, first create a staging table...'); dbms_output.put_line('-- '); dbms_output.put_line('exec dbms_spm.create_stgtab_baseline(''spm_staging_table'')'); dbms_output.put_line('-- '); dbms_output.put_line('-- To pack the accepted SQL plan baseline...'); dbms_output.put_line('-- '); dbms_output.put_line('declare n pls_integer; begin n := dbms_spm.pack_stgtab_baseline(table_name=>''spm_staging_table'',plan_name=>'''||v_planname||'''); end;'); dbms_output.put_line('/'); dbms_output.put_line('--'); dbms_output.put_line('--To pack all plan baselines for target SQL statement...'); dbms_output.put_line('-- '); dbms_output.put_line('declare n pls_integer; begin n := dbms_spm.pack_stgtab_baseline(table_name=>''spm_staging_table'',sql_handle=>'''||v_newhandle||'''); end;'); dbms_output.put_line('/'); end; /
the_stack
-- MySQL dump 10.13 Distrib 5.7.29, for osx10.15 (x86_64) -- -- Host: 127.0.0.1 Database: catmall_ums -- ------------------------------------------------------ -- Server version 5.7.29 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Current Database: `catmall_ums` -- CREATE DATABASE /*!32312 IF NOT EXISTS*/ `catmall_ums` /*!40100 DEFAULT CHARACTER SET utf8mb4 */; USE `catmall_ums`; -- -- Table structure for table `ums_growth_change_history` -- DROP TABLE IF EXISTS `ums_growth_change_history`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ums_growth_change_history` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `member_id` bigint(20) DEFAULT NULL COMMENT 'member_id', `create_time` datetime DEFAULT NULL COMMENT 'create_time', `change_count` int(11) DEFAULT NULL COMMENT '改变的值(正负计数)', `note` varchar(0) DEFAULT NULL COMMENT '备注', `source_type` tinyint(4) DEFAULT NULL COMMENT '积分来源[0-购物,1-管理员修改]', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='成长值变化历史记录'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ums_growth_change_history` -- LOCK TABLES `ums_growth_change_history` WRITE; /*!40000 ALTER TABLE `ums_growth_change_history` DISABLE KEYS */; /*!40000 ALTER TABLE `ums_growth_change_history` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ums_integration_change_history` -- DROP TABLE IF EXISTS `ums_integration_change_history`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ums_integration_change_history` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `member_id` bigint(20) DEFAULT NULL COMMENT 'member_id', `create_time` datetime DEFAULT NULL COMMENT 'create_time', `change_count` int(11) DEFAULT NULL COMMENT '变化的值', `note` varchar(255) DEFAULT NULL COMMENT '备注', `source_tyoe` tinyint(4) DEFAULT NULL COMMENT '来源[0->购物;1->管理员修改;2->活动]', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分变化历史记录'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ums_integration_change_history` -- LOCK TABLES `ums_integration_change_history` WRITE; /*!40000 ALTER TABLE `ums_integration_change_history` DISABLE KEYS */; /*!40000 ALTER TABLE `ums_integration_change_history` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ums_member` -- DROP TABLE IF EXISTS `ums_member`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ums_member` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `level_id` bigint(20) DEFAULT NULL COMMENT '会员等级id', `username` char(64) DEFAULT NULL COMMENT '用户名', `password` varchar(64) DEFAULT NULL COMMENT '密码', `nickname` varchar(64) DEFAULT NULL COMMENT '昵称', `mobile` varchar(20) DEFAULT NULL COMMENT '手机号码', `email` varchar(64) DEFAULT NULL COMMENT '邮箱', `header` varchar(500) DEFAULT NULL COMMENT '头像', `gender` tinyint(4) DEFAULT NULL COMMENT '性别', `birth` date DEFAULT NULL COMMENT '生日', `city` varchar(500) DEFAULT NULL COMMENT '所在城市', `job` varchar(255) DEFAULT NULL COMMENT '职业', `sign` varchar(255) DEFAULT NULL COMMENT '个性签名', `source_type` tinyint(4) DEFAULT NULL COMMENT '用户来源', `integration` int(11) DEFAULT NULL COMMENT '积分', `growth` int(11) DEFAULT NULL COMMENT '成长值', `status` tinyint(4) DEFAULT NULL COMMENT '启用状态', `create_time` datetime DEFAULT NULL COMMENT '注册时间', `social_uid` varchar(255) DEFAULT NULL, `access_token` varchar(255) DEFAULT NULL, `expires_in` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='会员'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ums_member` -- LOCK TABLES `ums_member` WRITE; /*!40000 ALTER TABLE `ums_member` DISABLE KEYS */; INSERT INTO `ums_member` VALUES (1,NULL,NULL,NULL,'于你心上眉间',NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'5709671078','2.00ARM6OG0hAVKh96fef4725dtkhvVB','157679999'); /*!40000 ALTER TABLE `ums_member` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ums_member_collect_spu` -- DROP TABLE IF EXISTS `ums_member_collect_spu`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ums_member_collect_spu` ( `id` bigint(20) NOT NULL COMMENT 'id', `member_id` bigint(20) DEFAULT NULL COMMENT '会员id', `spu_id` bigint(20) DEFAULT NULL COMMENT 'spu_id', `spu_name` varchar(500) DEFAULT NULL COMMENT 'spu_name', `spu_img` varchar(500) DEFAULT NULL COMMENT 'spu_img', `create_time` datetime DEFAULT NULL COMMENT 'create_time', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员收藏的商品'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ums_member_collect_spu` -- LOCK TABLES `ums_member_collect_spu` WRITE; /*!40000 ALTER TABLE `ums_member_collect_spu` DISABLE KEYS */; /*!40000 ALTER TABLE `ums_member_collect_spu` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ums_member_collect_subject` -- DROP TABLE IF EXISTS `ums_member_collect_subject`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ums_member_collect_subject` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `subject_id` bigint(20) DEFAULT NULL COMMENT 'subject_id', `subject_name` varchar(255) DEFAULT NULL COMMENT 'subject_name', `subject_img` varchar(500) DEFAULT NULL COMMENT 'subject_img', `subject_urll` varchar(500) DEFAULT NULL COMMENT '活动url', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员收藏的专题活动'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ums_member_collect_subject` -- LOCK TABLES `ums_member_collect_subject` WRITE; /*!40000 ALTER TABLE `ums_member_collect_subject` DISABLE KEYS */; /*!40000 ALTER TABLE `ums_member_collect_subject` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ums_member_level` -- DROP TABLE IF EXISTS `ums_member_level`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ums_member_level` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `name` varchar(100) DEFAULT NULL COMMENT '等级名称', `growth_point` int(11) DEFAULT NULL COMMENT '等级需要的成长值', `default_status` tinyint(4) DEFAULT NULL COMMENT '是否为默认等级[0->不是;1->是]', `free_freight_point` decimal(18,4) DEFAULT NULL COMMENT '免运费标准', `comment_growth_point` int(11) DEFAULT NULL COMMENT '每次评价获取的成长值', `priviledge_free_freight` tinyint(4) DEFAULT NULL COMMENT '是否有免邮特权', `priviledge_member_price` tinyint(4) DEFAULT NULL COMMENT '是否有会员价格特权', `priviledge_birthday` tinyint(4) DEFAULT NULL COMMENT '是否有生日特权', `note` varchar(255) DEFAULT NULL COMMENT '备注', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COMMENT='会员等级'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ums_member_level` -- LOCK TABLES `ums_member_level` WRITE; /*!40000 ALTER TABLE `ums_member_level` DISABLE KEYS */; INSERT INTO `ums_member_level` VALUES (1,'普通会员',3000,1,0.0000,2,0,0,1,'普通会员'),(2,'铜牌会员',7000,0,200.0000,3,0,1,1,'铜牌会员'),(3,'银牌会员',12000,0,180.0000,5,0,1,1,'银牌会员'),(4,'金牌会员',18000,0,150.0000,10,1,1,1,'金牌会员'),(5,'钻石会员',25000,0,120.0000,15,1,1,1,'钻石会员'); /*!40000 ALTER TABLE `ums_member_level` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ums_member_login_log` -- DROP TABLE IF EXISTS `ums_member_login_log`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ums_member_login_log` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `member_id` bigint(20) DEFAULT NULL COMMENT 'member_id', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `ip` varchar(64) DEFAULT NULL COMMENT 'ip', `city` varchar(64) DEFAULT NULL COMMENT 'city', `login_type` tinyint(1) DEFAULT NULL COMMENT '登录类型[1-web,2-app]', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员登录记录'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ums_member_login_log` -- LOCK TABLES `ums_member_login_log` WRITE; /*!40000 ALTER TABLE `ums_member_login_log` DISABLE KEYS */; /*!40000 ALTER TABLE `ums_member_login_log` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ums_member_receive_address` -- DROP TABLE IF EXISTS `ums_member_receive_address`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ums_member_receive_address` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `member_id` bigint(20) DEFAULT NULL COMMENT 'member_id', `name` varchar(255) DEFAULT NULL COMMENT '收货人姓名', `phone` varchar(64) DEFAULT NULL COMMENT '电话', `post_code` varchar(64) DEFAULT NULL COMMENT '邮政编码', `province` varchar(100) DEFAULT NULL COMMENT '省份/直辖市', `city` varchar(100) DEFAULT NULL COMMENT '城市', `region` varchar(100) DEFAULT NULL COMMENT '区', `detail_address` varchar(255) DEFAULT NULL COMMENT '详细地址(街道)', `areacode` varchar(15) DEFAULT NULL COMMENT '省市区代码', `default_status` tinyint(1) DEFAULT NULL COMMENT '是否默认', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='会员收货地址'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ums_member_receive_address` -- LOCK TABLES `ums_member_receive_address` WRITE; /*!40000 ALTER TABLE `ums_member_receive_address` DISABLE KEYS */; INSERT INTO `ums_member_receive_address` VALUES (1,1,'raymond','17888888888','476600','河南省','永城市','东城区','河南省永城市东城区','111111',1),(2,1,'raymond','17888888888','116622','辽宁省','大连市','金州区','大连理工大学','111111',0); /*!40000 ALTER TABLE `ums_member_receive_address` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ums_member_statistics_info` -- DROP TABLE IF EXISTS `ums_member_statistics_info`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ums_member_statistics_info` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `member_id` bigint(20) DEFAULT NULL COMMENT '会员id', `consume_amount` decimal(18,4) DEFAULT NULL COMMENT '累计消费金额', `coupon_amount` decimal(18,4) DEFAULT NULL COMMENT '累计优惠金额', `order_count` int(11) DEFAULT NULL COMMENT '订单数量', `coupon_count` int(11) DEFAULT NULL COMMENT '优惠券数量', `comment_count` int(11) DEFAULT NULL COMMENT '评价数', `return_order_count` int(11) DEFAULT NULL COMMENT '退货数量', `login_count` int(11) DEFAULT NULL COMMENT '登录次数', `attend_count` int(11) DEFAULT NULL COMMENT '关注数量', `fans_count` int(11) DEFAULT NULL COMMENT '粉丝数量', `collect_product_count` int(11) DEFAULT NULL COMMENT '收藏的商品数量', `collect_subject_count` int(11) DEFAULT NULL COMMENT '收藏的专题活动数量', `collect_comment_count` int(11) DEFAULT NULL COMMENT '收藏的评论数量', `invite_friend_count` int(11) DEFAULT NULL COMMENT '邀请的朋友数量', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员统计信息'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ums_member_statistics_info` -- LOCK TABLES `ums_member_statistics_info` WRITE; /*!40000 ALTER TABLE `ums_member_statistics_info` DISABLE KEYS */; /*!40000 ALTER TABLE `ums_member_statistics_info` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `undo_log` -- DROP TABLE IF EXISTS `undo_log`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `undo_log` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `branch_id` bigint(20) NOT NULL, `xid` varchar(100) NOT NULL, `context` varchar(128) NOT NULL, `rollback_info` longblob NOT NULL, `log_status` int(11) NOT NULL, `log_created` datetime NOT NULL, `log_modified` datetime NOT NULL, `ext` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `undo_log` -- LOCK TABLES `undo_log` WRITE; /*!40000 ALTER TABLE `undo_log` DISABLE KEYS */; /*!40000 ALTER TABLE `undo_log` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2020-05-31 9:40:55
the_stack
-- phpMyAdmin SQL Dump -- version 4.1.14 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jul 27, 2015 at 08:18 AM -- Server version: 5.6.17 -- PHP Version: 5.5.12 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `user_0_online` -- -- -------------------------------------------------------- -- -- Table structure for table `aliexpress_childorderlist` -- CREATE TABLE IF NOT EXISTS `aliexpress_childorderlist` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', `memo` varchar(255) DEFAULT NULL COMMENT '速卖通子订单备注', `childid` varchar(20) DEFAULT NULL COMMENT '子订单id', `productid` varchar(20) DEFAULT NULL COMMENT '商品id', `orderid` varchar(30) DEFAULT NULL COMMENT '速卖通订单号主订单号', `lotnum` int(5) DEFAULT NULL COMMENT '单位个数', `productattributes` text COMMENT '商品属性', `productunit` varchar(50) DEFAULT NULL COMMENT '单位', `skucode` varchar(100) DEFAULT NULL COMMENT 'SKU', `productcount` int(5) DEFAULT NULL COMMENT '商品数量', `productprice_amount` float(10,2) DEFAULT NULL COMMENT '单价', `productprice_currencycode` varchar(5) DEFAULT NULL COMMENT '货币单位', `productname` varchar(255) DEFAULT NULL COMMENT '商品名', `productsnapurl` varchar(255) DEFAULT NULL COMMENT '商品链接', `productimgurl` varchar(255) DEFAULT NULL COMMENT '商品图片', `create_time` int(11) DEFAULT NULL COMMENT '创建时间', `update_time` int(11) DEFAULT NULL COMMENT '修改时间', PRIMARY KEY (`id`), KEY `orderid` (`orderid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `aliexpress_freight_template` -- CREATE TABLE IF NOT EXISTS `aliexpress_freight_template` ( `templateid` bigint(18) NOT NULL, `selleruserid` varchar(100) DEFAULT NULL COMMENT '速卖通账号', `uid` int(10) DEFAULT NULL COMMENT '小老板uid', `default` enum('true','false') DEFAULT 'false' COMMENT '是否默认', `template_name` varchar(255) DEFAULT NULL COMMENT '运费模板名', `freight_setting` text COMMENT '运费模板详情', `created` int(11) DEFAULT NULL, `updated` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `aliexpress_order` -- CREATE TABLE IF NOT EXISTS `aliexpress_order` ( `id` varchar(50) NOT NULL COMMENT '速卖通订单号', `selleroperatorloginid` varchar(100) NOT NULL COMMENT '卖家账号', `buyerloginid` varchar(100) NOT NULL COMMENT '买家账号', `gmtcreate` varchar(30) DEFAULT NULL COMMENT '速卖通订单创建时间', `gmtmodified` varchar(30) DEFAULT NULL COMMENT '速卖通订单修改时间', `sellersignerfullname` varchar(100) DEFAULT NULL COMMENT '卖家全名', `ordermsgList` varchar(255) DEFAULT NULL COMMENT '订单留言', `orderstatus` varchar(30) DEFAULT NULL COMMENT '速卖通订单状态', `buyersignerfullname` varchar(100) DEFAULT NULL COMMENT '买家全名', `fundstatus` varchar(30) DEFAULT NULL COMMENT '资金状态', `gmtpaysuccess` varchar(30) DEFAULT NULL COMMENT '付款时间', `issueinfo` varchar(255) DEFAULT NULL COMMENT '纠纷信息', `issuestatus` varchar(20) DEFAULT NULL COMMENT '纠纷状态', `frozenstatus` varchar(20) DEFAULT NULL COMMENT '冻结状态', `logisticsstatus` varchar(50) DEFAULT NULL COMMENT '物流状态', `loaninfo` varchar(255) DEFAULT NULL COMMENT '放款信息', `loanatatus` varchar(20) DEFAULT NULL COMMENT '放款状态', `receiptaddress_zip` varchar(20) DEFAULT NULL COMMENT '收件人邮编', `receiptaddress_address2` varchar(255) DEFAULT NULL COMMENT '收件人地址2', `receiptaddress_detailaddress` varchar(255) DEFAULT NULL COMMENT '收件人详细地址', `receiptaddress_country` varchar(10) DEFAULT NULL COMMENT '收件人国家代码如US', `receiptaddress_city` varchar(100) DEFAULT NULL COMMENT '收件人城市', `receiptaddress_phonenumber` varchar(30) DEFAULT NULL COMMENT '收件人电话', `receiptaddress_province` varchar(100) DEFAULT NULL COMMENT '收件人省、州', `receiptaddress_phonearea` varchar(20) DEFAULT NULL COMMENT '收件人电话区号', `receiptaddress_phonecountry` varchar(20) DEFAULT NULL COMMENT '收件人国家电话区号', `receiptaddress_contactperson` varchar(100) DEFAULT NULL COMMENT '收件人', `receiptaddress_mobileno` varchar(20) DEFAULT NULL COMMENT '收件人手机', `buyerinfo_lastname` varchar(50) DEFAULT NULL COMMENT '买家lastname', `buyerinfo_loginid` varchar(50) DEFAULT NULL COMMENT '买家速卖通账号', `buyerinfo_email` varchar(50) DEFAULT NULL COMMENT '买家邮箱', `buyerinfo_firstname` varchar(50) DEFAULT NULL COMMENT '买家firstname', `buyerinfo_country` varchar(10) DEFAULT NULL COMMENT '买家国家代码', `logisticsamount_amount` float(10,2) DEFAULT NULL COMMENT '运费', `logisticsamount_currencycode` varchar(5) DEFAULT NULL COMMENT '运费货币代码', `orderamount_amount` float(10,2) DEFAULT NULL COMMENT '订单总金额包括运费', `orderamount_currencycode` varchar(5) DEFAULT NULL COMMENT '货币代码', `initOderAmount_amount` float(10,2) DEFAULT NULL COMMENT '订单商品总金额', `initoderamount_currencycode` varchar(5) DEFAULT NULL COMMENT '货币代码', `create_time` int(11) DEFAULT NULL COMMENT '创建时间', `update_time` int(11) DEFAULT NULL COMMENT '修改时间', `memo` varchar(255) DEFAULT NULL COMMENT '订单备注', `logistics_services_name` varchar(200) NOT NULL DEFAULT '' COMMENT '买家选择的运输方式', PRIMARY KEY (`id`), KEY `selleroperatorloginid` (`selleroperatorloginid`), KEY `buyerloginid` (`buyerloginid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `aliexpress_profile` -- CREATE TABLE IF NOT EXISTS `aliexpress_profile` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) DEFAULT NULL, `selleruserid` varchar(100) DEFAULT NULL, `subject` varchar(255) DEFAULT NULL COMMENT '商品标题', `keyword` varchar(255) DEFAULT NULL COMMENT '搜索关键词', `productmorekeywords1` varchar(255) DEFAULT NULL COMMENT '更多关键词一', `productmorekeywords2` varchar(255) DEFAULT NULL COMMENT '更多关键词二', `deliverytime` int(11) DEFAULT NULL COMMENT '备货期', `productprice` varchar(20) DEFAULT NULL COMMENT '商品一口价', `skustock` int(10) DEFAULT NULL COMMENT '数量', `isimagedynamic` enum('true','false') DEFAULT NULL COMMENT '商品主图图片类型', `isimagewatermark` enum('true','false') DEFAULT NULL COMMENT '图片是否加水印的标识', `productunit` int(11) DEFAULT NULL COMMENT '商品单位', `packagetype` enum('true','false') DEFAULT NULL COMMENT '销售方式', `lotnum` int(11) DEFAULT NULL COMMENT '每包件数', `wsvalidnum` int(11) DEFAULT NULL COMMENT '商品有效天数', `src` varchar(50) DEFAULT NULL COMMENT '指此商品发布的来源', `sku` varchar(100) DEFAULT NULL COMMENT '商品编码即SKU', `isbulk` enum('0','1') DEFAULT '0' COMMENT '是否支持批发', `bulkorder` int(11) DEFAULT NULL COMMENT '批发最小数量', `bulkdiscount` int(11) DEFAULT NULL COMMENT '批发折扣', `packagelength` int(11) DEFAULT NULL COMMENT '商品包装长度', `packagewidth` int(11) DEFAULT NULL COMMENT '商品包装宽度', `packageheight` int(11) DEFAULT NULL COMMENT '商品包装高度', `grossweight` varchar(50) DEFAULT NULL COMMENT '商品毛重', `ispacksell` enum('true','false') DEFAULT NULL COMMENT '是否自定义计重true为自定义计重false反之', `baseunit` int(11) DEFAULT NULL COMMENT 'isPackSell为true时 此项必填 购买几件以内不增加运费', `addunit` int(11) DEFAULT NULL COMMENT 'isPackSell为true时 此项必填 每增加件数', `addweight` varchar(100) DEFAULT NULL COMMENT 'isPackSell为true时 此项必填 对应增加的重量', `promisetemplateid` bigint(18) DEFAULT NULL COMMENT '服务模板id', `categoryid` int(11) DEFAULT NULL COMMENT '商品所属类目ID', `freighttemplateid` int(11) DEFAULT NULL COMMENT '运费模版ID', `imageurl` varchar(255) DEFAULT NULL COMMENT '列表显示图片URL', `sizechartid` bigint(18) DEFAULT NULL COMMENT '尺码表模版Id', `groupid` int(11) DEFAULT NULL COMMENT '产品组ID', `created` int(11) DEFAULT NULL, `updated` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `aliexpress_profile_detail` -- CREATE TABLE IF NOT EXISTS `aliexpress_profile_detail` ( `id` int(11) unsigned NOT NULL, `imageurls` text COMMENT '图片', `detail` text COMMENT '描述', `summary` text COMMENT '简要描述', `property` text COMMENT '选中的sku属性', `aeopskuproperty` text COMMENT '可切换图片展示属性', `aeopaeproductskus` text COMMENT 'sku', `aeopaeproductpropertys` text COMMENT '商品细节属性', `created` int(11) DEFAULT NULL, `updated` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `aliexpress_promise_template` -- CREATE TABLE IF NOT EXISTS `aliexpress_promise_template` ( `templateid` bigint(18) NOT NULL COMMENT '服务模板id', `uid` int(10) DEFAULT NULL COMMENT '小老板uid', `selleruserid` varchar(100) DEFAULT NULL COMMENT '速卖通账号', `name` varchar(255) DEFAULT NULL COMMENT '服务模板名', `created` int(11) DEFAULT NULL, `updated` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `aliexpress_shippedorder_log` -- CREATE TABLE IF NOT EXISTS `aliexpress_shippedorder_log` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `uid` int(10) NOT NULL COMMENT '小老板主账号ID', `operator` int(10) NOT NULL COMMENT '标记人ID', `sellerloginid` varchar(100) NOT NULL COMMENT '速卖通登陆账户', `aliexpress_uid` int(10) NOT NULL COMMENT '速卖通账户表ID', `order_id` bigint(20) NOT NULL COMMENT '小老板订单号', `servicename` varchar(100) NOT NULL COMMENT '实际发货物流服务(代码)', `servicename_cn` varchar(100) DEFAULT NULL COMMENT '发货物流服务中文名', `logisticsno` varchar(100) DEFAULT NULL COMMENT '物流追踪号', `description` varchar(100) DEFAULT NULL COMMENT '备注(只能是英文)', `sendtype` varchar(100) NOT NULL COMMENT '状态包括:全部发货(all)、部分发货(part)', `outref` varchar(100) NOT NULL COMMENT '用户需要发货的订单id,速卖通订单号', `trackingwebsite` varchar(100) DEFAULT NULL COMMENT '当serviceName=other的情况时,需要填写对应的追踪网址', `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '标记状态1标记成功,0标记失败', `message` text COMMENT '错误信息', `create_time` int(11) DEFAULT NULL COMMENT '创建时间', `update_time` int(11) DEFAULT NULL COMMENT '修改时间', PRIMARY KEY (`id`), KEY `sellerloginid` (`sellerloginid`), KEY `order_id` (`order_id`), KEY `outref` (`outref`), KEY `status` (`status`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `amazon_item` -- CREATE TABLE IF NOT EXISTS `amazon_item` ( `ASIN` varchar(50) NOT NULL COMMENT '亚马逊编号', `Binding` varchar(255) DEFAULT NULL, `Brand` varchar(255) DEFAULT NULL COMMENT '品牌', `Feature` text COMMENT '特征(最多有5个)', `Label` varchar(255) DEFAULT NULL COMMENT '标签', `Manufacturer` varchar(255) DEFAULT NULL, `Model` varchar(255) DEFAULT NULL COMMENT '模型', `PartNumber` varchar(255) DEFAULT NULL, `ProductGroup` varchar(255) DEFAULT NULL, `ProductTypeName` varchar(255) DEFAULT NULL, `Publisher` varchar(255) DEFAULT NULL, `SmallImage` text COMMENT '小图', `Studio` varchar(255) DEFAULT NULL, `Title` text COMMENT '标题', `Color` varchar(100) DEFAULT NULL COMMENT '颜色', `marketplace_short` varchar(50) NOT NULL COMMENT '网店简写', `merchant_id` varchar(50) NOT NULL COMMENT '账号ID', `origin_ASIN` varchar(50) DEFAULT NULL COMMENT '来源ASIN(可以理解为父asin,来源于报告中asin)', `Product_id` varchar(100) DEFAULT NULL COMMENT '产品ID', `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '编号(唯一标记)', PRIMARY KEY (`ASIN`,`marketplace_short`,`merchant_id`), UNIQUE KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `amazon_open_list_report` -- CREATE TABLE IF NOT EXISTS `amazon_open_list_report` ( `report_id` varchar(50) NOT NULL COMMENT '报告ID', `merchant_id` varchar(50) DEFAULT NULL COMMENT '卖家账号', `item_name` varchar(250) DEFAULT NULL COMMENT '商品名称', `listing_id` varchar(50) DEFAULT NULL COMMENT 'ListID', `seller_sku` varchar(50) DEFAULT NULL COMMENT '卖家SKU', `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '商品价格', `quantity` int(11) NOT NULL DEFAULT '0' COMMENT '商品数量', `open_date` datetime NOT NULL COMMENT '开售时间', `product_id_type` varchar(255) DEFAULT NULL COMMENT '商品ID类型(EAN CPU ASIN等)', `item_note` text COMMENT '商品状态补充说明', `item_condition` varchar(255) DEFAULT NULL COMMENT '商品状态(new like new used等)', `will_ship_internationally` varchar(255) DEFAULT NULL COMMENT '是否支持跨国递送', `expedited_shipping` varchar(255) DEFAULT NULL COMMENT '是否支持快速递送', `product_id` varchar(255) NOT NULL DEFAULT '' COMMENT '商品ID', `pending_quantity` int(11) NOT NULL DEFAULT '0' COMMENT '未付款订单数', `fulfillment_channel` varchar(255) DEFAULT NULL COMMENT '发货渠道', `process_status` char(1) NOT NULL COMMENT '产品处理进度(P=待处理 , C=已处理)', `marketplace_short` varchar(50) NOT NULL COMMENT '网店简写', PRIMARY KEY (`report_id`,`product_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `amazon_ticket` -- CREATE TABLE IF NOT EXISTS `amazon_ticket` ( `ticket_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `ticketID` int(11) unsigned NOT NULL DEFAULT '0', `dept_id` int(10) unsigned NOT NULL DEFAULT '1', `priority_id` int(10) unsigned NOT NULL DEFAULT '2', `topic_id` int(10) unsigned NOT NULL DEFAULT '0', `staff_id` int(10) unsigned NOT NULL DEFAULT '0', `email` varchar(120) NOT NULL DEFAULT '', `related_email_id` int(11) NOT NULL, `name` varchar(32) NOT NULL DEFAULT '', `subject` varchar(150) NOT NULL DEFAULT '[no subject]', `helptopic` varchar(255) DEFAULT NULL, `phone` varchar(16) DEFAULT NULL, `phone_ext` varchar(8) DEFAULT NULL, `ip_address` varchar(16) NOT NULL DEFAULT '', `status` enum('open','closed') NOT NULL DEFAULT 'open', `type` tinyint(4) NOT NULL COMMENT '0--其他1--订单留言2--客户非订单留言3---amazon官方信息4--卖家主动发邮件', `amazon_order_id` varchar(50) NOT NULL COMMENT 'amazon平台订单id', `source` enum('Web','Email','Phone','Other') NOT NULL DEFAULT 'Other', `isoverdue` tinyint(1) unsigned NOT NULL DEFAULT '0', `isanswered` tinyint(1) unsigned NOT NULL DEFAULT '0', `duedate` datetime DEFAULT NULL, `reopened` datetime DEFAULT NULL, `closed` datetime DEFAULT NULL, `lastmessage` datetime DEFAULT NULL, `lastresponse` datetime DEFAULT NULL, `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`ticket_id`), UNIQUE KEY `email_extid` (`ticketID`,`email`), KEY `dept_id` (`dept_id`), KEY `staff_id` (`staff_id`), KEY `status` (`status`), KEY `priority_id` (`priority_id`), KEY `created` (`created`), KEY `closed` (`closed`), KEY `duedate` (`duedate`), KEY `topic_id` (`topic_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `amazon_ticket_attachment` -- CREATE TABLE IF NOT EXISTS `amazon_ticket_attachment` ( `attach_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `ticket_id` int(11) unsigned NOT NULL DEFAULT '0', `ref_id` int(11) unsigned NOT NULL DEFAULT '0', `ref_type` enum('M','R') NOT NULL DEFAULT 'M', `file_size` varchar(32) NOT NULL DEFAULT '', `file_name` varchar(128) NOT NULL DEFAULT '', `file_key` varchar(128) NOT NULL DEFAULT '', `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updated` datetime DEFAULT NULL, PRIMARY KEY (`attach_id`), KEY `ticket_id` (`ticket_id`), KEY `ref_type` (`ref_type`), KEY `ref_id` (`ref_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `amazon_ticket_message` -- CREATE TABLE IF NOT EXISTS `amazon_ticket_message` ( `msg_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `ticket_id` int(11) unsigned NOT NULL DEFAULT '0', `messageId` varchar(255) DEFAULT NULL, `message` text NOT NULL, `headers` text, `source` varchar(16) DEFAULT NULL, `ip_address` varchar(16) DEFAULT NULL, `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updated` datetime DEFAULT NULL, PRIMARY KEY (`msg_id`), KEY `ticket_id` (`ticket_id`), KEY `msgId` (`messageId`), FULLTEXT KEY `message` (`message`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `amazon_ticket_response` -- CREATE TABLE IF NOT EXISTS `amazon_ticket_response` ( `response_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `msg_id` int(11) unsigned NOT NULL DEFAULT '0', `ticket_id` int(11) unsigned NOT NULL DEFAULT '0', `staff_id` int(11) unsigned NOT NULL DEFAULT '0', `staff_name` varchar(32) NOT NULL DEFAULT '', `response` text NOT NULL, `ip_address` varchar(16) NOT NULL DEFAULT '', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`response_id`), KEY `ticket_id` (`ticket_id`), KEY `msg_id` (`msg_id`), KEY `staff_id` (`staff_id`), FULLTEXT KEY `response` (`response`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `amz_order` -- CREATE TABLE IF NOT EXISTS `amz_order` ( `AmazonOrderId` varchar(50) NOT NULL COMMENT 'Amazon Order Id', `merchant_id` varchar(55) NOT NULL DEFAULT '' COMMENT '卖家的amazon 商家编码', `marketplace_short` char(2) NOT NULL DEFAULT '' COMMENT 'amazon店铺国家2位代码,对应marketplace', `LastUpdateDate` timestamp NULL DEFAULT NULL COMMENT '最后修改时间', `PurchaseDate` timestamp NULL DEFAULT NULL, `Status` varchar(30) NOT NULL DEFAULT '' COMMENT '状态', `SalesChannel` varchar(45) NOT NULL DEFAULT '', `OrderChannel` varchar(45) NOT NULL DEFAULT '', `ShipServiceLevel` varchar(45) NOT NULL DEFAULT '', `Name` varchar(255) NOT NULL DEFAULT '', `AddressLine1` varchar(255) NOT NULL DEFAULT '', `AddressLine2` varchar(255) NOT NULL DEFAULT '', `AddressLine3` varchar(255) NOT NULL DEFAULT '', `County` varchar(255) NOT NULL DEFAULT '' COMMENT '镇,县', `City` varchar(255) NOT NULL DEFAULT '', `District` varchar(255) NOT NULL DEFAULT '', `State` varchar(255) NOT NULL DEFAULT '', `PostalCode` varchar(255) NOT NULL DEFAULT '', `CountryCode` char(2) NOT NULL DEFAULT '' COMMENT '国家代码', `Phone` varchar(255) NOT NULL DEFAULT '' COMMENT '电话号码', `Currency` char(3) NOT NULL DEFAULT '' COMMENT '订单货币', `Amount` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '订单金额', `PaymentMethod` varchar(45) NOT NULL DEFAULT '' COMMENT '支付方式', `BuyerEmail` varchar(255) NOT NULL DEFAULT '', `create_time` timestamp NULL DEFAULT NULL COMMENT 'Eagle系统获取并且写入这个Record的时间', `type` varchar(5) NOT NULL DEFAULT 'MFN' COMMENT '这个不是amazon订单header的原始属性值。 订单类型 --"MFN" : Manually Fulfillment "AFN" : Amazon Fulfillment (FBA)', `BuyerName` varchar(100) DEFAULT NULL COMMENT '购买人的名字', `NumberOfItemsShipped` int(10) DEFAULT NULL COMMENT '已经shipped的item个数', `NumberOfItemsUnshipped` int(10) DEFAULT NULL COMMENT '还没有shipped的item个数', `ShipmentServiceLevelCategory` varchar(100) DEFAULT NULL COMMENT 'The shipment service level category of the order------ Expedited FreeEconomy NextDay SameDay SecondDay Scheduled Standard', `EarliestShipDate` int(11) DEFAULT NULL COMMENT 'The start of the time period that you have committed to ship the order', `LatestShipDate` int(11) DEFAULT NULL COMMENT 'The end of the time period that you have committed to ship the order', `EarliestDeliveryDate` int(11) DEFAULT NULL COMMENT 'The start of the time period that you have commited to fulfill the order', `LatestDeliveryDate` int(11) DEFAULT NULL COMMENT 'The end of the time period that you have commited to fulfill the order', PRIMARY KEY (`AmazonOrderId`), KEY `index2` (`BuyerEmail`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Amazon Order 的信息'; -- -------------------------------------------------------- -- -- Table structure for table `amz_order_detail` -- CREATE TABLE IF NOT EXISTS `amz_order_detail` ( `AmazonOrderId` varchar(45) NOT NULL DEFAULT '', `OrderItemId` varchar(50) NOT NULL DEFAULT '' COMMENT 'amazon 的item id', `SellerSKU` varchar(45) NOT NULL DEFAULT '', `ASIN` varchar(255) NOT NULL DEFAULT '', `Title` varchar(501) NOT NULL DEFAULT '', `Amount` decimal(10,2) NOT NULL DEFAULT '0.00', `QuantityOrdered` int(11) NOT NULL DEFAULT '0', `QuantityShipped` decimal(10,2) NOT NULL DEFAULT '0.00', `ItemPrice` decimal(10,2) NOT NULL DEFAULT '0.00', `ShippingPrice` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '该产品分享的运费', `ShippingDiscount` decimal(10,2) DEFAULT '0.00', `ShippingTax` decimal(10,2) NOT NULL DEFAULT '0.00', `GiftWrapPrice` decimal(10,2) NOT NULL DEFAULT '0.00', `GiftWrapTax` decimal(10,2) NOT NULL DEFAULT '0.00', `ItemTax` decimal(10,2) NOT NULL DEFAULT '0.00', `PromotionDiscount` decimal(10,2) NOT NULL DEFAULT '0.00', `GiftMessageText` varchar(255) NOT NULL DEFAULT '', `GiftWrapLevel` varchar(255) NOT NULL DEFAULT '', `PromotionIds` varchar(255) NOT NULL DEFAULT '' COMMENT '多个promotion 的 id 以逗号隔开显示在这里', `CODFee` decimal(10,2) NOT NULL DEFAULT '0.00', `CODFeeDiscount` decimal(10,2) NOT NULL DEFAULT '0.00', `InvoiceRequirement` varchar(255) NOT NULL DEFAULT '' COMMENT 'Invoice 信息', `BuyerSelectedInvoiceCategory` varchar(255) NOT NULL DEFAULT '' COMMENT 'Invoice 信息', `InvoiceTitle` varchar(255) NOT NULL DEFAULT '' COMMENT 'Invoice 信息', `InvoiceInformation` varchar(255) NOT NULL DEFAULT '' COMMENT 'Invoice 信息', PRIMARY KEY (`OrderItemId`), KEY `index2` (`AmazonOrderId`), KEY `index3` (`SellerSKU`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='amazon order details about the SKU and product info'; -- -------------------------------------------------------- -- -- Table structure for table `amz_shop_products` -- CREATE TABLE IF NOT EXISTS `amz_shop_products` ( `id` int(11) NOT NULL AUTO_INCREMENT, `seller_id` varchar(50) NOT NULL COMMENT 'amazon seller id', `marketplace_short` char(2) NOT NULL COMMENT 'Marketplace 缩短', `sku` varchar(250) NOT NULL DEFAULT '' COMMENT '产品sku', `is_active` tinyint(4) NOT NULL COMMENT '0:inactive\n1:active', `qty_available` int(11) NOT NULL DEFAULT '0' COMMENT '刊登在售的数量', `on_sale_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'timestamp\n上架日期', `first_month_sold_qty` int(11) NOT NULL DEFAULT '0' COMMENT '上架首月销量', `last_month_sold_qty` int(11) NOT NULL DEFAULT '0' COMMENT '最近一个月销量', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Amazon 网店里的产品管理' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `auth_role` -- CREATE TABLE IF NOT EXISTS `auth_role` ( `rid` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '角色ID(主键)', `name` varchar(50) NOT NULL DEFAULT '' COMMENT '角色名', `note` varchar(255) NOT NULL DEFAULT '' COMMENT '角色备注信息', `is_active` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否启用0:否 1:是', PRIMARY KEY (`rid`), UNIQUE KEY `unidx_name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色表' AUTO_INCREMENT=2 ; -- -- Dumping data for table `auth_role` -- INSERT INTO `auth_role` (`rid`, `name`, `note`, `is_active`) VALUES (1, 'role1', '权限', 1); -- -------------------------------------------------------- -- -- Table structure for table `auth_role_has_menu` -- CREATE TABLE IF NOT EXISTS `auth_role_has_menu` ( `role_id` int(11) unsigned NOT NULL COMMENT '关联auth_menu中id', `menu_id` int(11) unsigned NOT NULL COMMENT '关联系统表authmenu中id', PRIMARY KEY (`role_id`,`menu_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色与权限关系表'; -- -- Dumping data for table `auth_role_has_menu` -- INSERT INTO `auth_role_has_menu` (`role_id`, `menu_id`) VALUES (1, 1); -- -------------------------------------------------------- -- -- Table structure for table `auth_role_has_user` -- CREATE TABLE IF NOT EXISTS `auth_role_has_user` ( `role_id` int(11) unsigned NOT NULL COMMENT '角色ID', `user_id` int(11) unsigned NOT NULL COMMENT '用户ID', PRIMARY KEY (`role_id`,`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='子用户与角色关联表'; -- -- Dumping data for table `auth_role_has_user` -- INSERT INTO `auth_role_has_user` (`role_id`, `user_id`) VALUES (1, 1); -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_dispute` -- CREATE TABLE IF NOT EXISTS `cm_ebay_dispute` ( `id` int(11) NOT NULL AUTO_INCREMENT, `disputeid` bigint(20) NOT NULL, `selleruserid` varchar(50) NOT NULL DEFAULT '' COMMENT '卖家账号', `buyeruserid` varchar(50) NOT NULL DEFAULT '' COMMENT '买家账号', `user_role` varchar(50) NOT NULL DEFAULT '' COMMENT '发起人:SELLER,BUYER,EBAY', `itemid` bigint(20) NOT NULL DEFAULT '0' COMMENT '刊登号', `transactionid` varchar(14) NOT NULL DEFAULT '' COMMENT '交易号', `disputereason` varchar(64) NOT NULL DEFAULT '' COMMENT '纠纷原因主要, BuyerHasNotPaid, TransactionMutuallyCanceled ', `disputeexplanation` varchar(64) NOT NULL DEFAULT '' COMMENT '纠纷原因的详细说明 ', `disputerecordtype` varchar(64) NOT NULL DEFAULT '' COMMENT '纠纷类型, ItemNotReceived , UnpaidItem', `disputestate` varchar(128) NOT NULL DEFAULT '' COMMENT '纠纷状态', `disputestatus` varchar(128) NOT NULL DEFAULT '' COMMENT '纠纷状态附加', `purchaseprotection` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'inr用户是否符合保护条例', `escalation` tinyint(1) NOT NULL DEFAULT '0' COMMENT '用户不满意并上报到ebay', `has_read` tinyint(1) NOT NULL DEFAULT '0' COMMENT '已读', `disputemessages` longtext NOT NULL COMMENT '聊天记录, 数组 ', `disputecreatedtime` int(11) NOT NULL COMMENT '纠纷发起时间', `create_time` int(11) NOT NULL, `update_time` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `disputeid` (`disputeid`), KEY `selleruserid` (`selleruserid`), KEY `has_read` (`has_read`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='售前纠纷表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_feedback` -- CREATE TABLE IF NOT EXISTS `cm_ebay_feedback` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `feedback_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '评价号', `ebay_uid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所属卖家,也即被评人managedb saas_ebay_user 中ebay_uid', `selleruserid` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源平台卖家用户名', `transaction_id` varchar(14) NOT NULL DEFAULT '' COMMENT '交易号', `od_ebay_transaction_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'od_ebay_transaction表id', `itemid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'od_ebay_item表itemid', `role` varchar(10) NOT NULL DEFAULT '' COMMENT '发起人', `commenting_user` varchar(50) NOT NULL DEFAULT '' COMMENT '评价人', `commenting_user_score` int(11) unsigned NOT NULL COMMENT '评价人信用', `comment_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '评价时间', `comment_text` text NOT NULL COMMENT '留言', `comment_type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Positive,Negative,Neutral,Withdrawn,IndependentlyWithdrawn', `feedback_score` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '总评分数', `feedback_response` varchar(255) NOT NULL DEFAULT '' COMMENT '回复内容', `followup` varchar(255) NOT NULL DEFAULT '' COMMENT '跟踪内容', `response_replaced` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否被eBay删除', `has_read` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '已读', `create_time` int(11) unsigned NOT NULL DEFAULT '0', `update_time` int(11) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idx_feed` (`feedback_id`) USING BTREE, KEY `idx_read` (`has_read`) USING BTREE, KEY `idx_uid` (`ebay_uid`) USING BTREE, KEY `idx_com` (`comment_type`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='ebay评价表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_message_type` -- CREATE TABLE IF NOT EXISTS `cm_ebay_message_type` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `pid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '父级id', `name` varchar(255) NOT NULL DEFAULT '' COMMENT '类型名', `level` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '顺序', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`), KEY `idx_pid` (`pid`), KEY `idx_level` (`level`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='站内信分类表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_msg_template` -- CREATE TABLE IF NOT EXISTS `cm_ebay_msg_template` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `template_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '类型', `template` text NOT NULL COMMENT '模板内容', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`), KEY `idx_tpltype` (`template_type`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='站内信模板表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_msg_template_type` -- CREATE TABLE IF NOT EXISTS `cm_ebay_msg_template_type` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `pid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '父级id', `name` varchar(255) NOT NULL DEFAULT '' COMMENT '类型名', `level` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '顺序', `type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0文件夹 1站内信模板', `template` varchar(255) NOT NULL DEFAULT '' COMMENT '模板内容', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`), KEY `idx_level` (`level`), KEY `idx_pid` (`pid`), KEY `idx_type` (`type`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='站内信分类表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_mymessage` -- CREATE TABLE IF NOT EXISTS `cm_ebay_mymessage` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `uid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户uid', `ebay_uid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'saas_ebay_user表id', `order_id` int(10) DEFAULT NULL COMMENT '订单id', `itemid` bigint(16) DEFAULT NULL COMMENT '商品ID', `messageid` bigint(16) DEFAULT NULL COMMENT '消息ID', `externalmessageid` bigint(16) DEFAULT NULL COMMENT 'ebay外部ID', `is_read` tinyint(1) DEFAULT '0' COMMENT '0未读', `is_flagged` tinyint(1) unsigned DEFAULT NULL COMMENT '是否加星标', `replied` tinyint(2) DEFAULT '0' COMMENT '已回复', `msg_type_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '文件夹id', `expirationdate` varchar(32) DEFAULT NULL COMMENT '到期时间', `listingstatus` varchar(16) DEFAULT NULL COMMENT '帖子状态', `messagetype` varchar(128) DEFAULT NULL COMMENT '消息类型', `questiontype` varchar(32) DEFAULT NULL COMMENT '问题类型', `receivedate_time` int(11) DEFAULT NULL, `receivedate` varchar(32) DEFAULT NULL COMMENT '信息收到日期', `recipientuserid` varchar(32) DEFAULT NULL COMMENT '显示的收件人uid', `sender` varchar(128) DEFAULT NULL COMMENT '寄件人', `responseenabled` varchar(8) DEFAULT NULL COMMENT '可否被回复', `subject` varchar(255) DEFAULT NULL COMMENT '主题', `from_who` varchar(50) DEFAULT NULL COMMENT 'message自动分类类类型eBay,Memgers,HighPriority', `highpriority` varchar(20) DEFAULT NULL COMMENT '是否是high priority站内信,true,false', PRIMARY KEY (`id`), UNIQUE KEY `messageid` (`messageid`), KEY `isread` (`is_read`), KEY `recipientuserid` (`recipientuserid`), KEY `sender` (`sender`), KEY `itemid` (`itemid`), KEY `order_id` (`order_id`), KEY `replied` (`replied`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='message表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_mymessage_detail` -- CREATE TABLE IF NOT EXISTS `cm_ebay_mymessage_detail` ( `messageid` bigint(16) NOT NULL DEFAULT '0' COMMENT 'ebay上的唯一messageid ', `responseurl` text, `text` longtext COMMENT 'message详细', PRIMARY KEY (`messageid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='message详细表'; -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_replymessage` -- CREATE TABLE IF NOT EXISTS `cm_ebay_replymessage` ( `id` int(11) NOT NULL AUTO_INCREMENT, `context` text COMMENT '回复内容', `created` char(13) DEFAULT NULL COMMENT '回复时间', `dealuid` int(11) DEFAULT NULL COMMENT '回复处理人', `msgid` varchar(25) DEFAULT '' COMMENT '对应msg表的ID', `iscomment` tinyint(2) DEFAULT '0' COMMENT '非零为评论', `isdraft` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '非0为草稿', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='ebay 回复 message详细表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_template` -- CREATE TABLE IF NOT EXISTS `cm_ebay_template` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `template_type` int(11) NOT NULL COMMENT '类型', `template` varchar(255) NOT NULL DEFAULT '' COMMENT '模板内容', `create_time` int(11) NOT NULL, `update_time` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `idx_type` (`template_type`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_template_type` -- CREATE TABLE IF NOT EXISTS `cm_ebay_template_type` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `pid` int(11) NOT NULL COMMENT '父级id', `name` varchar(255) NOT NULL DEFAULT '' COMMENT '类型名', `level` int(11) NOT NULL DEFAULT '0' COMMENT '顺序', `create_time` int(11) NOT NULL, `update_time` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `idx_pid` (`pid`,`level`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_usercase` -- CREATE TABLE IF NOT EXISTS `cm_ebay_usercase` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uid` int(11) NOT NULL, `mytype` tinyint(1) NOT NULL DEFAULT '0' COMMENT '基本纠纷类型: 未付款,取消订单,未收到货,货不符', `selleruserid` varchar(50) NOT NULL DEFAULT '' COMMENT '卖家账户', `buyeruserid` varchar(100) NOT NULL DEFAULT '' COMMENT '买家账号', `caseid` varchar(40) NOT NULL DEFAULT '' COMMENT '纠纷号', `type` varchar(100) NOT NULL DEFAULT '' COMMENT '纠纷类型', `status_type` varchar(100) NOT NULL DEFAULT '' COMMENT '纠纷状态类型', `status_value` varchar(100) NOT NULL DEFAULT '' COMMENT '纠纷状态类型对应的值', `itemid` bigint(16) NOT NULL DEFAULT '0' COMMENT '刊登号', `itemtitle` varchar(255) NOT NULL COMMENT 'item的title', `transactionid` varchar(14) NOT NULL DEFAULT '' COMMENT '交易号', `casequantity` int(2) NOT NULL DEFAULT '0' COMMENT '争议数量', `caseamount` varchar(15) NOT NULL COMMENT '争议金额', `created_date` int(10) NOT NULL COMMENT '创建日期', `lastmodified_date` int(10) NOT NULL COMMENT '最后修改日期', `respondbydate` int(10) NOT NULL COMMENT '失效日期', `has_read` tinyint(1) NOT NULL DEFAULT '0' COMMENT '已读', `order_id` int(10) NOT NULL, `create_time` int(11) NOT NULL, `update_time` int(11) NOT NULL, `order_source_srn` int(11) unsigned DEFAULT '0' COMMENT 'od_ebay_order表salesrecordnum', PRIMARY KEY (`id`), UNIQUE KEY `caseid` (`caseid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='用户售后纠纷表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cm_ebay_usercase_ebpdetail` -- CREATE TABLE `cm_ebay_usercase_ebpdetail` ( `id` int(11) NOT NULL AUTO_INCREMENT, `caseid` bigint(15) NOT NULL COMMENT 'caseID', `agreedrefundamount` varchar(20) DEFAULT '' COMMENT '同意退款金额', `appeal` text COMMENT '买家发起的上诉详细', `buyerreturnshipment` text COMMENT '买家退货信息 及退货跟踪号', `casedocumentinfo` text COMMENT '买家上传的case文档信息,仅德国平台', `decision` varchar(100) DEFAULT '' COMMENT '处决人', `decisiondate` varchar(100) DEFAULT NULL COMMENT '处决日期', `decisionreason` varchar(100) DEFAULT NULL COMMENT '处决原因', `decisionreasondetail` text COMMENT '处决原因详细', `detailstatus` varchar(100) DEFAULT '0' COMMENT 'case状态', `detailstatusinfo` text COMMENT 'case状态详细', `fvfcredited` varchar(10) DEFAULT '0' COMMENT '是否将交易费退回卖家', `globalid` varchar(100) DEFAULT '' COMMENT 'eBay平台号', `initialbuyerexpectation` varchar(100) DEFAULT '' COMMENT '买家初步意见', `initialbuyerexpectationdetail` text COMMENT '买家意见详细', `notcountedinbuyerprotectioncases` varchar(10) DEFAULT '0' COMMENT '是否对卖家绩效产生影响,true:不影响,false:影响', `openreason` varchar(100) DEFAULT '' COMMENT '开启原因', `paymentdetail` text COMMENT '支付详细,仅moneyMovement 时会出现', `responsehistory` longtext COMMENT '交流记录', `returnmerchandiseauthorization` varchar(255) DEFAULT '' COMMENT '退款单号,卖家向买家提供', `sellershipment` text COMMENT '买家发货信息,卖家向买家提供', `create_time` int(11) DEFAULT NULL, `update_time` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `caseid` (`caseid`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='用户售后纠纷详细表'; -- -------------------------------------------------------- -- -- Table structure for table `comment_and_chat` -- CREATE TABLE IF NOT EXISTS `comment_and_chat` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', `uid` int(10) unsigned NOT NULL COMMENT '用户ID', `remark` text COMMENT '备注信息', `create_time` int(11) DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户备注信息表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cr_template` -- CREATE TABLE IF NOT EXISTS `cr_template` ( `template_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '模版编号', `template_name` varchar(50) DEFAULT NULL COMMENT '模版名称', `template_content` text COMMENT '内容', `create_time` int(11) unsigned DEFAULT NULL COMMENT '创建时间', `update_time` int(11) unsigned DEFAULT NULL COMMENT '修改时间', `template_width` int(10) unsigned DEFAULT '100' COMMENT '画布宽度', `template_height` int(10) unsigned DEFAULT '100' COMMENT '画布高度', `template_type` enum('地址单','报关单','配货单','发票','商品标签') DEFAULT '地址单' COMMENT '单据类别', `template_content_json` text default '' COMMENT '用于记录Html的具体位置,tcpdf使用', `template_version` int default 0 COMMENT '用于记录是否新版模板,默认为0, 1表示新版', PRIMARY KEY (`template_id`), UNIQUE KEY `uniq_template_name` (`template_name`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cs_message` -- CREATE TABLE IF NOT EXISTS `cs_message` ( `id` int(11) NOT NULL AUTO_INCREMENT, `status` char(1) NOT NULL DEFAULT 'C' COMMENT 'S:发送中 C:已发送,F:错误', `cpur_id` int(11) NOT NULL DEFAULT '0' COMMENT '谁说这句话的,user id,如果是客户来的,id=0', `create_time` datetime NOT NULL COMMENT '说话时间', `subject` text NOT NULL COMMENT 'message标题', `content` text NOT NULL COMMENT 'msg 内容', `platform` enum('ebay','aliexpress','wish','amazon','dhgate') NOT NULL COMMENT '平台', `order_id` varchar(100) NOT NULL COMMENT '订单id 平台', `addi_info` text NOT NULL COMMENT '额外附加信息', PRIMARY KEY (`id`), KEY `order_id` (`order_id`,`platform`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='tracker用到的站内信内容' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cs_msg_template` -- CREATE TABLE IF NOT EXISTS `cs_msg_template` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(200) NOT NULL COMMENT '模板名称', `subject` text NOT NULL, `body` text COMMENT '模板内容', `addi_info` varchar(200) DEFAULT NULL COMMENT 'json格式的附加内容', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='tracking模块发站内信模板' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `cs_recommend_product` -- CREATE TABLE IF NOT EXISTS `cs_recommend_product` ( `id` int(11) NOT NULL AUTO_INCREMENT, `platform` varchar(50) NOT NULL COMMENT 'ebay,wish,aliexpress等', `platform_account_id` varchar(255) NOT NULL COMMENT '渠道的账号标示', `platform_site_id` varchar(10) DEFAULT '' COMMENT '不同站点的标示, US,FR,DE,CN', `listing_id` varchar(100) DEFAULT '' COMMENT '刊登商品的标示,譬如平台sku,或者asin', `product_image_url` varchar(255) NOT NULL DEFAULT '', `product_name` varchar(255) NOT NULL DEFAULT '', `product_url` varchar(255) NOT NULL, `life_view_count` int(11) NOT NULL DEFAULT '0' COMMENT '历史给buyer的展示总次数', `life_click_count` int(11) NOT NULL DEFAULT '0' COMMENT '历史被buyer的点击总次数', `is_on_sale` varchar(1) NOT NULL DEFAULT 'Y' COMMENT '是否在售 Y 或者 N', `create_time` datetime NOT NULL, `update_time` datetime NOT NULL, `is_active` char(1) NOT NULL DEFAULT 'Y' COMMENT 'Y 或 N 该商品如果销售情况不好等 会被设置为不用可用', `product_price` decimal(10,2) NOT NULL DEFAULT '0.00', `product_min_price` decimal(10,2) NOT NULL DEFAULT '0.00', `product_max_price` decimal(10,2) NOT NULL DEFAULT '0.00', `product_price_currency` char(3) NOT NULL DEFAULT '' COMMENT '货币,CNY,USD,HKD,EUR', PRIMARY KEY (`id`), KEY `index1` (`platform`,`platform_account_id`,`platform_site_id`), KEY `sdf` (`listing_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- CREATE TABLE IF NOT EXISTS `cs_auto_roles` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'role编号', `name` varchar(200) NOT NULL COMMENT '规则名称', `platform` varchar(30) NOT NULL COMMENT '来源的平台,例如Amazon,SMT,eBay,Wish', `accounts` varchar(500) NOT NULL COMMENT '匹配平台账号json格式', `nations` text COMMENT '匹配目的地国家json格式', `status` varchar(500) NOT NULL COMMENT '物流状态', `template_id` int(11) NOT NULL COMMENT '留言模板', `priority` int(11) NOT NULL DEFAULT '0' COMMENT '优先顺序', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COMMENT='自动匹配规则表'; CREATE TABLE IF NOT EXISTS `cs_customer` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `platform_source` varchar(50) DEFAULT NULL COMMENT '订单来源 ebay,amazon,aliexpress等等', `last_order_id` varchar(50) DEFAULT NULL COMMENT '最后订单单号', `seller_id` varchar(50) DEFAULT NULL COMMENT '卖家ID', `customer_id` varchar(50) DEFAULT NULL COMMENT '客户标识码,各平台优先哟好难过buyerid,然后email,phone number 来作为该客户的唯一识别方法', `nation_code` char(2) NOT NULL DEFAULT '' COMMENT '国家代码,如CN,US,FR,JP', `email` varchar(50) DEFAULT NULL COMMENT 'email address', `os_flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否outstanding状态,1为是,0为否', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_time` datetime DEFAULT NULL COMMENT '更新时间', `last_message_time` datetime DEFAULT NULL COMMENT '最后回复时间', `msg_sent_error` char(1) NOT NULL DEFAULT 'N' COMMENT '是否有发信失败', `addi_info` text COMMENT '额外附加信息', `last_order_time` datetime DEFAULT NULL COMMENT '最后一个订单日期', `currency` char(3) NOT NULL DEFAULT 'CNY' COMMENT '货币', `life_order_amount` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '总的消费金额', `life_order_count` int(11) NOT NULL DEFAULT '0' COMMENT '总的消费次数', `customer_nickname` varchar(50) DEFAULT NULL COMMENT '买家呢称', PRIMARY KEY (`id`), KEY `customerid` (`customer_id`,`seller_id`), KEY `platform` (`platform_source`,`seller_id`) ) ENGINE=InnoDB AUTO_INCREMENT=4097 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; DROP TABLE IF EXISTS `cs_customer_tags`; CREATE TABLE IF NOT EXISTS `cs_customer_tags` ( `customer_tag_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', `customer_id` varchar(30) NOT NULL DEFAULT '' COMMENT '客户号主键', `tag_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '标签编号', PRIMARY KEY (`customer_tag_id`), UNIQUE KEY `index2` (`customer_id`,`customer_tag_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='产品和标签的对应信息'; CREATE TABLE IF NOT EXISTS `cs_recm_product_perform` ( `id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL DEFAULT '0' COMMENT 'recm product id', `theday` char(10) NOT NULL DEFAULT '' COMMENT 'e.g. 2010-05-19', `view_count` int(11) NOT NULL DEFAULT '0' COMMENT '被展示次数', `click_count` int(11) NOT NULL DEFAULT '0' COMMENT '被点击次数', PRIMARY KEY (`id`), KEY `aa` (`product_id`,`theday`) ) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=utf8 COMMENT='推荐产品的表现'; DROP TABLE IF EXISTS `cs_tag`; CREATE TABLE IF NOT EXISTS `cs_tag` ( `tag_id` int(11) NOT NULL AUTO_INCREMENT, `tag_name` varchar(100) NOT NULL DEFAULT '', `color` varchar(20) DEFAULT NULL COMMENT '标签颜色', PRIMARY KEY (`tag_id`), KEY `index2` (`tag_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='标签定义'; DROP TABLE IF EXISTS `cs_ticket_message`; CREATE TABLE IF NOT EXISTS `cs_ticket_message` ( `msg_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `ticket_id` int(11) DEFAULT NULL COMMENT '客服app的会话id,内部使用', `session_id` varchar(50) DEFAULT NULL COMMENT '对应ticket_session表的session_id,对应平台的session/ticket id', `message_id` varchar(255) DEFAULT NULL COMMENT '每个平台返回的主键ID', `related_id` varchar(50) DEFAULT NULL COMMENT '订单单号/商品sku', `related_type` char(1) DEFAULT NULL COMMENT '相关类别,P:商品,O:订单, S:系统平台', `send_or_receiv` int(1) DEFAULT NULL COMMENT '0--表示接收,1--表示发送', `content` text COMMENT '内容', `headers` text COMMENT '标题', `English_content` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '英文翻译', `Chineses_content` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '中文翻译', `has_read` int(1) DEFAULT NULL COMMENT '0--表示未读,1--表示已读', `msg_contact` longtext COMMENT 'msg原始数据内容', `created` datetime DEFAULT NULL COMMENT '创建时间', `updated` datetime DEFAULT NULL COMMENT '更新时间', `addi_info` text COMMENT '额外附加信息', `app_time` datetime DEFAULT NULL COMMENT 'eagle系统时间', `platform_time` datetime DEFAULT NULL COMMENT '平台实际时间', `haveFile` int(1) DEFAULT '0' COMMENT '是否含图片 0--没有图片,1--有图片', `fileUrl` text COMMENT '图片地址', `status` char(1) DEFAULT 'C' COMMENT 'Pending,Sending,Complete,Fail', PRIMARY KEY (`msg_id`), KEY `ticket_id` (`ticket_id`), KEY `session_id` (`session_id`), KEY `222` (`related_id`,`related_type`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `cs_ticket_session`; CREATE TABLE IF NOT EXISTS `cs_ticket_session` ( `ticket_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `platform_source` varchar(50) DEFAULT NULL COMMENT '订单来源 ebay,amazon,aliexpress等等', `message_type` tinyint(4) NOT NULL COMMENT '0--其他1--订单留言2--站内信', `related_id` varchar(50) DEFAULT '' COMMENT '订单单号/商品sku', `related_type` char(1) DEFAULT NULL COMMENT '相关类别,P:商品,O:订单, S:系统平台', `seller_id` varchar(50) DEFAULT NULL COMMENT '卖家ID', `buyer_id` varchar(50) DEFAULT NULL COMMENT '买家ID,customer key', `session_id` varchar(50) DEFAULT NULL COMMENT '会话ID MsgId,平台的session,ticket id', `has_read` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0--表示未读,1--表示已读', `has_replied` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已回复', `has_handled` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已处理', `created` datetime DEFAULT NULL COMMENT '创建时间', `updated` datetime DEFAULT NULL COMMENT '更新时间', `lastmessage` datetime DEFAULT NULL COMMENT '最后回复时间', `msg_sent_error` char(1) DEFAULT 'N' COMMENT '是否有发信失败', `addi_info` text COMMENT '额外附加信息', `last_omit_msg` text COMMENT '最后消息', `seller_nickname` varchar(50) DEFAULT NULL COMMENT '卖家呢称', `buyer_nickname` varchar(50) DEFAULT NULL COMMENT '买家呢称', `original_msg_type` varchar(50) DEFAULT NULL COMMENT '原始信息类型 --暂时敦煌用到', `list_contact` text COMMENT 'list原始数据内容 敦煌有用', `msgTitle` text COMMENT '标题', `session_type` varchar(50) DEFAULT '' COMMENT 'session类型,暂时只有cdiscount用到', `session_status` varchar(50) DEFAULT '' COMMENT 'session状态,暂时只有cdiscount用到', `item_id` varchar(255) DEFAULT '' COMMENT 'itemId,暂时只有priceminster用到', PRIMARY KEY (`ticket_id`), KEY `customerKey` (`buyer_id`,`platform_source`,`seller_id`), KEY `222` (`related_id`,`related_type`), KEY `seller` (`seller_id`), KEY `222222` (`seller_nickname`), KEY `session_index` (`session_id`,`platform_source`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `dely_delivery` -- CREATE TABLE IF NOT EXISTS `dely_delivery` ( `delivery_id` int(11) unsigned zerofill NOT NULL AUTO_INCREMENT COMMENT '包裹id', `tracking_number` varchar(50) NOT NULL DEFAULT '' COMMENT '发货单号', `tracking_link` varchar(100) NOT NULL DEFAULT '' COMMENT '跟踪号查询网址', `serial_number` varchar(11) NOT NULL DEFAULT '' COMMENT '包裹流水号(日期+当日序号 例:14031500001)', `delivery_status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '包裹状态 (自由仓)0:待分派,1:待交运1,2:待打单,(海外仓)5:待上传,6:待确认,7:待发货,(其他)3:已发货,4:已作废', `is_manual` tinyint(2) unsigned NOT NULL COMMENT '挂起状态,1:已挂起,0:未挂起', `selleruserid` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源平台卖家用户名', `saas_platform_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'saas库平台用户id', `order_source` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源 ebay,amazon,aliexpress,custom', `customer_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'od_customer 表id', `source_buyer_user_id` varchar(255) NOT NULL DEFAULT '' COMMENT '来源平台买家用户名', `consignee` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人', `consignee_country` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人国家', `consignee_country_code` char(2) NOT NULL DEFAULT '' COMMENT '收货人国家代码', `consignee_city` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人城市', `consignee_province` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人省', `consignee_district` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人区', `consignee_county` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人镇', `consignee_address_line1` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址1', `consignee_address_line2` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址2', `consignee_address_line3` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址3', `consignee_postal_code` varchar(255) NOT NULL DEFAULT '' COMMENT '收货地邮编', `consignee_phone` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人电话', `consignee_email` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人email', `consignee_company` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人公司', `warehouse_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '仓库id', `carrier_code` varchar(255) NOT NULL DEFAULT '' COMMENT '物流商code', `shipping_method_code` varchar(255) NOT NULL DEFAULT '' COMMENT '物流方式code', `order_source_shipping_method` varchar(255) NOT NULL DEFAULT '' COMMENT '平台物流方式code', `md5_identify` char(32) NOT NULL DEFAULT '' COMMENT 'md5标识(用于包裹拆分合并)', `delivery_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '发货时间', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `print_url` varchar(255) NOT NULL DEFAULT '' COMMENT '打印的url', `error_info` varchar(255) NOT NULL DEFAULT '' COMMENT '物流/海外仓错误信息', `carrier_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已交运0:否 1:是', `carrier_type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0:普通物流商 1:海外仓', `tpodo_sn` varchar(100) NOT NULL DEFAULT '' COMMENT '第三方(海外仓)出库单号', `tracking_status` varchar(200) NOT NULL DEFAULT '' COMMENT '查询轨迹状态说明', PRIMARY KEY (`delivery_id`), KEY `idx_delstat` (`delivery_status`) USING BTREE, KEY `idx_tracnumsta` (`tracking_number`,`delivery_status`) USING BTREE, KEY `idx_sernumsta` (`serial_number`,`delivery_status`) USING BTREE, KEY `idx_buyertime` (`source_buyer_user_id`,`update_time`), KEY `idx_sellertime` (`selleruserid`,`update_time`), KEY `idx_buyeremail` (`consignee_email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='包裹表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `dely_delivery_item` -- CREATE TABLE IF NOT EXISTS `dely_delivery_item` ( `delivery_item_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '包裹商品表', `product_name` varchar(255) NOT NULL DEFAULT '' COMMENT '商品名称', `sku` varchar(250) NOT NULL DEFAULT '' COMMENT '主图', `order_source_order_item_id` varchar(50) NOT NULL DEFAULT '' COMMENT 'od_ebay_transaction中的id', `source_item_id` varchar(50) NOT NULL DEFAULT '' COMMENT '平台刊登itemid', `quantity` int(11) unsigned NOT NULL DEFAULT '1' COMMENT '数量', `order_id` int(11) unsigned zerofill NOT NULL DEFAULT '00000000000' COMMENT '商品来源订单id', `order_item_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单商品表id', `delivery_id` int(11) unsigned zerofill NOT NULL DEFAULT '00000000000' COMMENT '包裹号', `photo_primary` varchar(255) NOT NULL DEFAULT '' COMMENT '主图', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `platform_sku` varchar(50) NOT NULL DEFAULT '' COMMENT '平台sku', `is_bundle` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否是捆绑商品,1:是0:否', `bdsku` varchar(50) NOT NULL DEFAULT '' COMMENT '捆绑sku', PRIMARY KEY (`delivery_item_id`), KEY `idx_order_id` (`order_id`) USING BTREE, KEY `idx_delivery_id` (`delivery_id`) USING BTREE, KEY `idx_itemid` (`order_source_order_item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='包裹商品表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `dely_shipping_method` -- CREATE TABLE IF NOT EXISTS `dely_shipping_method` ( `carrier_code` varchar(50) NOT NULL DEFAULT '0' COMMENT '物流商code', `shipping_method_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流方式code', `shipping_method_name` varchar(100) NOT NULL DEFAULT '' COMMENT '用户表物流方式名', `platform_amazon` varchar(50) NOT NULL DEFAULT '' COMMENT '向亚马逊发送的物流商号', `platform_ebay` varchar(50) NOT NULL DEFAULT '' COMMENT '向ebay发送的物流商号', `platform_aliexpress` varchar(50) NOT NULL DEFAULT '' COMMENT '向速卖通发送的物流商号', `platform_wish` varchar(20) NOT NULL DEFAULT '' COMMENT '向wish发送的物流商号', `extra_info` varchar(500) NOT NULL DEFAULT '' COMMENT '附加信息', `type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '类型:0系统类型1用户类型', `is_active` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否启用:0不启用1启用', `pre_weight` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '首重', `pre_weight_price` decimal(10,4) unsigned NOT NULL DEFAULT '0.0000' COMMENT '首重价', `add_weight` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '续重', `add_weight_price` decimal(10,4) unsigned NOT NULL DEFAULT '0.0000' COMMENT '续重价', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `logistics_aging` int(10) DEFAULT NULL, PRIMARY KEY (`shipping_method_code`,`carrier_code`), KEY `idx_typeacti` (`type`,`is_active`), KEY `idx_active` (`is_active`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='物流方式表'; -- -------------------------------------------------------- -- -- Table structure for table `dely_tracking_numbers` -- CREATE TABLE IF NOT EXISTS `dely_tracking_numbers` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `carrier_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流商code', `shipping_method_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流方式code', `tracking_number` varchar(50) NOT NULL DEFAULT '' COMMENT '跟踪号', `delivery_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '包裹号', `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0:已取消 1:正常', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`id`), KEY `idx_did` (`delivery_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='仓库物理方式关系表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `dhgate_order` -- CREATE TABLE IF NOT EXISTS `dhgate_order` ( `orderNo` varchar(50) NOT NULL COMMENT '卖家后台登录能看到成交的订单号;示例值:1330312162', `sellerloginid` varchar(55) NOT NULL DEFAULT '' COMMENT '敦煌卖家登陆账号', `orderStatus` varchar(30) NOT NULL DEFAULT '' COMMENT '订单状态', `orderTotalPrice` decimal(10,2) DEFAULT '0.00' COMMENT '订单总金额', `actualPrice` decimal(10,2) DEFAULT '0.00' COMMENT '实收金额', `commissionAmount` decimal(10,2) DEFAULT '0.00' COMMENT '佣金金额', `fillingMoney` decimal(10,2) DEFAULT '0.00' COMMENT '订单补款金额', `gatewayFee` decimal(10,2) DEFAULT '0.00' COMMENT '网关手续费', `itemTotalPrice` decimal(10,2) DEFAULT '0.00' COMMENT '产品总计', `reducePrice` decimal(10,2) DEFAULT '0.00' COMMENT '订单降价金额', `refundMoney` decimal(10,2) DEFAULT '0.00' COMMENT '订单退款金额', `risePrice` decimal(10,2) DEFAULT '0.00' COMMENT '订单涨价金额', `sellerCouponPrice` decimal(10,2) DEFAULT '0.00' COMMENT 'seller优惠券', `shippingCost` decimal(10,2) DEFAULT '0.00' COMMENT '运费', `orderContact` text COMMENT '收货人基本信息,敦煌返回的 OrderContact 数据结构的json', `orderDeliveryList` text COMMENT '发货信息,敦煌返回的 OrderDeliveryInfo 数据结构的json', `buyerId` varchar(55) DEFAULT '' COMMENT '买家ID', `buyerNickName` varchar(255) DEFAULT '' COMMENT '买家别名,买家昵称;示例值:zhangsan', `country` varchar(255) DEFAULT '' COMMENT '收货国家,示例值:United States', `deliveryDate` timestamp NULL DEFAULT NULL COMMENT '发货时间', `shippingType` varchar(55) DEFAULT '' COMMENT '买家选择物流方式,示例值:UPS,D-LINK等', `isWarn` tinyint(1) DEFAULT NULL COMMENT '是否需要特别注意的订单(如高风险订单、售后纠纷订单等)。值为false或null表示订单正常,true表示此订单需要特别注意一下,例如,防止高风险订单直接发货', `warnReason` varchar(255) DEFAULT '' COMMENT '警告原因,示例值:高风险订单、订单发起售后纠纷、信用卡拒付等', `buyerConfirmDate` timestamp NULL DEFAULT NULL COMMENT '买家确认收货时间,日期格式:yyyy-MM-dd HH:mm:ss,精确到秒;示例值:2014-01-12 18:20:21', `cancelDate` timestamp NULL DEFAULT NULL COMMENT '交易取消时间', `deliveryDeadline` timestamp NULL DEFAULT NULL COMMENT '发货截止时间', `inAccountDate` timestamp NULL DEFAULT NULL COMMENT '入账时间', `payDate` timestamp NULL DEFAULT NULL COMMENT '付款时间', `startedDate` timestamp NULL DEFAULT NULL COMMENT '下单日期', `create_time` timestamp NULL DEFAULT NULL COMMENT 'Eagle系统获取并且写入这个Record的时间', `orderRemark` varchar(255) DEFAULT '' COMMENT '订单备注', PRIMARY KEY (`orderNo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='敦煌订单信息表'; -- -------------------------------------------------------- -- -- Table structure for table `dhgate_order_item` -- CREATE TABLE IF NOT EXISTS `dhgate_order_item` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dhgateOrderNo` varchar(50) NOT NULL COMMENT '卖家后台登录能看到成交的订单号;示例值:1330312162', `itemcode` varchar(50) NOT NULL DEFAULT '' COMMENT '产品编号,产品最终页的URL中有产品编码;示例值:184942450', `categoryName` varchar(255) DEFAULT '' COMMENT '产品类目', `grossWeight` decimal(10,2) DEFAULT '0.00' COMMENT '包装重量', `height` decimal(10,2) DEFAULT '0.00' COMMENT '产品包装尺寸:高,单位:cm', `length` decimal(10,2) DEFAULT '0.00' COMMENT '产品包装尺寸:长,单位:cm', `width` decimal(10,2) DEFAULT '0.00' COMMENT '产品包装尺寸:宽,单位:cm', `itemAttr` varchar(255) DEFAULT '' COMMENT '产品属性', `itemCount` int(11) DEFAULT '0' COMMENT '产品数量,示例值:10,如果单位是件,则为10件,如果单位是包,则是10包', `itemImage` varchar(255) DEFAULT '' COMMENT '产品图片URL', `itemName` varchar(255) DEFAULT '' COMMENT '产品名称', `itemPrice` decimal(10,2) DEFAULT '0.00' COMMENT '产品单价', `itemUrl` varchar(255) DEFAULT '' COMMENT '产品地址URL', `measureName` varchar(50) DEFAULT '' COMMENT '商品售卖单位,示例值:包、件、套、千克、千米', `packingQuantity` int(11) DEFAULT '0' COMMENT '产品打包数量,大于1表示按包买,同时也代表每包的数量,<=1表示非按包买,itemCount代表购买数量,示例值:10', `skuCode` varchar(45) DEFAULT '' COMMENT '卖家商品编码', `buyerRemark` varchar(255) DEFAULT '' COMMENT '买家备注', PRIMARY KEY (`id`), KEY `index2` (`dhgateOrderNo`), KEY `index3` (`skuCode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='敦煌订单产品信息表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `ebay_bestoffer` -- CREATE TABLE IF NOT EXISTS `ebay_bestoffer` ( `bestofferid` bigint(20) unsigned NOT NULL, `uid` int(11) DEFAULT NULL, `selleruserid` varchar(255) DEFAULT NULL, `itemid` bigint(20) DEFAULT NULL COMMENT '对应的ebay的itemid', `bestoffer` text COMMENT 'bestoffer', `bestofferstatus` varchar(30) DEFAULT NULL COMMENT 'bestoffer状态', `itembestoffer` text COMMENT '预留itembestoffer', `createtime` int(11) DEFAULT NULL, `status` int(4) DEFAULT '0' COMMENT '是否已经处理', `desc` varchar(80) DEFAULT NULL COMMENT '议价记录', `counterofferprice` float(10,2) DEFAULT NULL COMMENT '议价价格', `operate` varchar(50) DEFAULT NULL COMMENT '处理人', PRIMARY KEY (`bestofferid`), KEY `NewIndex1` (`selleruserid`), KEY `bestofferstatus` (`bestofferstatus`), KEY `createtime` (`createtime`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `ebay_crossselling` -- CREATE TABLE IF NOT EXISTS `ebay_crossselling` ( `crosssellingid` int(11) NOT NULL AUTO_INCREMENT, `selleruserid` varchar(255) DEFAULT NULL COMMENT '绑定的ebay账号', `title` varchar(255) DEFAULT NULL COMMENT '交叉销售范本名', `createtime` int(11) DEFAULT NULL, `updatetime` int(11) DEFAULT NULL, PRIMARY KEY (`crosssellingid`), KEY `selleruserid` (`selleruserid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `ebay_crossselling_item` -- CREATE TABLE IF NOT EXISTS `ebay_crossselling_item` ( `id` int(11) NOT NULL AUTO_INCREMENT, `crosssellingid` int(11) NOT NULL COMMENT '对应的crosssellingID', `sort` int(5) DEFAULT NULL COMMENT '排序', `data` text COMMENT '插入的交叉数据', `html` text COMMENT '整理出来的html', PRIMARY KEY (`id`), KEY `crosssellingid` (`crosssellingid`), KEY `sort` (`sort`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `ebay_item` -- CREATE TABLE IF NOT EXISTS `ebay_item` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uid` int(10) NOT NULL, `itemid` bigint(13) NOT NULL COMMENT 'ItemID', `selleruserid` varchar(32) NOT NULL COMMENT '卖家账号', `itemtitle` varchar(100) NOT NULL COMMENT 'Item标题', `mubanid` int(10) NOT NULL COMMENT '对应模板ID', `quantity` int(5) DEFAULT NULL COMMENT '数量', `quantitysold` int(5) DEFAULT NULL COMMENT '卖出数量', `starttime` int(11) DEFAULT NULL COMMENT 'Item开始时间', `endtime` int(11) DEFAULT NULL COMMENT 'Item结束时间', `dispatchtime` int(5) DEFAULT NULL COMMENT '发货时间', `watchcount` int(5) DEFAULT NULL COMMENT '浏览量', `viewitemurl` varchar(255) DEFAULT NULL COMMENT '查看链接', `currency` varchar(8) DEFAULT NULL COMMENT '币种', `listingtype` varchar(20) DEFAULT NULL COMMENT '刊登方式', `site` char(16) DEFAULT NULL COMMENT '平台', `currentprice` decimal(10,2) DEFAULT NULL COMMENT '当前价格', `listingstatus` enum('Active','Completed','Ended','Error') DEFAULT NULL COMMENT 'Item状态', `listingduration` enum('Days_1','Days_10','Days_3','Days_30','Days_5','Days_7','GTC') DEFAULT NULL COMMENT '刊登时间', `buyitnowprice` decimal(10,2) DEFAULT NULL COMMENT '一口价', `startprice` decimal(10,2) DEFAULT NULL COMMENT '拍卖价', `desc` varchar(64) DEFAULT NULL COMMENT '备注', `sku` varchar(255) DEFAULT NULL COMMENT 'sku', `lastsolddatetime` int(11) DEFAULT NULL COMMENT '最后售出时间', `paypal` varchar(255) DEFAULT NULL COMMENT 'paypal', `outofstockcontrol` tinyint(1) DEFAULT '0' COMMENT '永久在线', `isvariation` tinyint(1) DEFAULT '0' COMMENT '是否多属性', `mainimg` varchar(255) DEFAULT NULL COMMENT '主图', `createtime` int(11) DEFAULT NULL, `updatetime` int(11) DEFAULT NULL, `bukucun` tinyint(2) DEFAULT '0' COMMENT '补库存开关:0关,1卖多少补多少,2自己设置', `less` int(3) DEFAULT NULL COMMENT '自己设置时少于多少件', `bu` int(3) DEFAULT NULL COMMENT '补几件', `storecategoryid` bigint(15) DEFAULT NULL COMMENT '店铺类目1' , `primarycategory` int(10) DEFAULT NULL COMMENT '主类目', PRIMARY KEY (`id`), KEY `itemid` (`itemid`), KEY `uid` (`uid`), KEY `selleruserid` (`selleruserid`), KEY `itemtitle` (`itemtitle`), KEY `mubanid` (`mubanid`), KEY `listingtype` (`listingtype`), KEY `site` (`site`), KEY `sku` (`sku`), KEY `isvariation` (`isvariation`), KEY `outofstockcontrol` (`outofstockcontrol`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `ebay_item_detail` -- CREATE TABLE IF NOT EXISTS `ebay_item_detail` ( `itemid` bigint(13) NOT NULL, `primarycategory` int(10) DEFAULT NULL COMMENT '主类目', `secondarycategory` int(10) DEFAULT NULL COMMENT '子类目', `lotsize` int(5) DEFAULT NULL COMMENT '份数', `conditionid` int(10) DEFAULT NULL COMMENT '新旧', `hitcounter` varchar(32) DEFAULT NULL COMMENT '计数器', `postalcode` varchar(20) DEFAULT NULL COMMENT '邮编', `location` varchar(32) DEFAULT NULL COMMENT '地区', `country` varchar(16) DEFAULT NULL COMMENT '国家', `gallery` varchar(16) DEFAULT NULL COMMENT '图片展示', `storecategoryid` bigint(15) DEFAULT NULL COMMENT '店铺类目1', `storecategory2id` bigint(15) DEFAULT NULL COMMENT '店铺类目2', `additemfee` decimal(10,2) DEFAULT NULL COMMENT '刊登费用', `additemfeecurrency` varchar(8) DEFAULT NULL COMMENT '刊登费用币种', `bestoffer` tinyint(1) DEFAULT '0' COMMENT '是否开启议价', `bestofferprice` decimal(10,2) DEFAULT NULL COMMENT '自动接收的议价', `minibestofferprice` decimal(10,2) DEFAULT NULL COMMENT '最低议价', `epid` varchar(128) DEFAULT NULL COMMENT 'productid', `isbn` varchar(128) DEFAULT NULL COMMENT 'productid', `upc` varchar(128) DEFAULT NULL COMMENT 'productid', `ean` varchar(128) DEFAULT NULL COMMENT 'productid', `subtitle` varchar(255) DEFAULT NULL COMMENT '子标题', `shippingdetails` text COMMENT '物流信息', `sellingstatus` text COMMENT '售卖状态', `itemdescription` text COMMENT 'item主描述', `paymentmethods` text COMMENT '支付信息', `returnpolicy` text COMMENT '退货政策', `listingenhancement` text, `imgurl` text COMMENT '图片', `variation` LONGTEXT COMMENT '多属性', `autopay` tinyint(1) DEFAULT '0', `privatelisting` tinyint(1) DEFAULT '0' COMMENT '私人刊登', `buyerrequirementdetails` text COMMENT '买家要求信息', `itemspecifics` text COMMENT '细节', `vatpercent` decimal(10,2) DEFAULT NULL COMMENT '税', `isreviseinventory` int(4) DEFAULT NULL, `createtime` int(11) DEFAULT NULL, `updatetime` int(11) DEFAULT NULL, `matching_info` text DEFAULT NULL COMMENT '配对待确认信息', PRIMARY KEY (`itemid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `ebay_item_variation_map` -- CREATE TABLE IF NOT EXISTS `ebay_item_variation_map` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemid` bigint(13) DEFAULT NULL, `sku` varchar(155) DEFAULT NULL, `startprice` decimal(10,2) DEFAULT NULL, `quantity` int(5) DEFAULT NULL, `quantitysold` int(5) DEFAULT NULL, `onlinequantity` int(5) DEFAULT NULL, `createtime` int(10) DEFAULT NULL, `updatetime` int(10) DEFAULT NULL, PRIMARY KEY (`id`), KEY `itemid` (`itemid`), KEY `sku` (`sku`), KEY `startprice` (`startprice`), KEY `onlinequantity` (`onlinequantity`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `ebay_log_item` -- CREATE TABLE IF NOT EXISTS `ebay_log_item` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `mubanid` int(11) DEFAULT NULL, `type` int(5) DEFAULT '0' COMMENT '类型', `name` varchar(50) NOT NULL COMMENT '操作人', `reason` varchar(255) DEFAULT NULL COMMENT '修改原因', `itemid` bigint(15) DEFAULT NULL, `content` longtext COMMENT '修改内容', `result` char(15) DEFAULT NULL COMMENT '结果', `message` text COMMENT '失败原因', `createtime` int(11) DEFAULT NULL, `transactionid` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `mubanid` (`mubanid`), KEY `transactionid` (`transactionid`), KEY `reason` (`reason`), KEY `itemid` (`itemid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `ebay_log_muban` -- CREATE TABLE IF NOT EXISTS `ebay_log_muban` ( `logid` int(11) NOT NULL AUTO_INCREMENT, `uid` int(11) DEFAULT NULL, `selleruserid` char(32) DEFAULT NULL, `timerid` int(11) DEFAULT NULL COMMENT '定时刊登器ID', `mubanid` int(11) DEFAULT NULL COMMENT '模板ID', `itemid` bigint(20) DEFAULT NULL COMMENT '刊登成功的话ItemID', `result` tinyint(4) DEFAULT NULL COMMENT '刊登结果', `siteid` int(5) DEFAULT NULL COMMENT '刊登平台', `method` varchar(8) DEFAULT NULL COMMENT '刊登方式,手动自动', `title` varchar(125) DEFAULT NULL COMMENT '刊登标题', `createtime` int(11) DEFAULT NULL, PRIMARY KEY (`logid`), KEY `mubanid` (`mubanid`), KEY `itemid` (`itemid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `ebay_log_muban_detail` -- CREATE TABLE IF NOT EXISTS `ebay_log_muban_detail` ( `logid` int(11) NOT NULL, `message` text, `description` text, `fee` text, `error` text, PRIMARY KEY (`logid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `ebay_muban` -- CREATE TABLE IF NOT EXISTS `ebay_muban` ( `mubanid` int(10) NOT NULL AUTO_INCREMENT, `uid` int(10) DEFAULT NULL, `siteid` int(5) DEFAULT NULL, `itemtitle` varchar(100) DEFAULT NULL, `listingtype` varchar(20) DEFAULT NULL, `location` char(128) DEFAULT NULL, `listingduration` char(10) DEFAULT NULL, `sku` varchar(255) DEFAULT NULL, `paypal` varchar(255) DEFAULT NULL, `selleruserid` varchar(200) DEFAULT NULL, `outofstockcontrol` tinyint(1) DEFAULT NULL, `isvariation` tinyint(1) DEFAULT NULL, `quantity` int(5) DEFAULT NULL, `startprice` decimal(10,2) DEFAULT NULL, `buyitnowprice` decimal(10,2) DEFAULT NULL, `shippingdetails` text, `mainimg` varchar(255) DEFAULT NULL, `desc` varchar(100) DEFAULT NULL, `createtime` int(11) DEFAULT NULL, `updatetime` int(11) DEFAULT NULL, PRIMARY KEY (`mubanid`), KEY `title` (`itemtitle`), KEY `sku` (`sku`), KEY `siteid` (`siteid`), KEY `listingduration` (`listingduration`), KEY `listingtype` (`listingtype`), KEY `quantity` (`quantity`), KEY `selleruserid` (`selleruserid`), KEY `isvariation` (`isvariation`), KEY `paypal` (`paypal`), KEY `outofstockcontrol` (`outofstockcontrol`), KEY `desc` (`desc`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `ebay_muban_detail` -- CREATE TABLE IF NOT EXISTS `ebay_muban_detail` ( `mubanid` int(10) NOT NULL, `epid` varchar(128) DEFAULT NULL COMMENT 'epidID', `isbn` varchar(128) DEFAULT NULL COMMENT 'isbnID', `upc` varchar(128) DEFAULT NULL COMMENT 'upcID', `ean` varchar(128) DEFAULT NULL COMMENT 'eanID', `primarycategory` int(10) DEFAULT NULL COMMENT '主类目', `secondarycategory` int(10) DEFAULT NULL COMMENT '子类目', `storecategoryid` bigint(20) DEFAULT NULL COMMENT '店铺主类目', `storecategory2id` bigint(20) DEFAULT NULL COMMENT '店铺子类目', `lotsize` int(5) DEFAULT NULL COMMENT '每份件数', `itemdescription` longtext COMMENT '描述', `imgurl` text COMMENT '图片信息', `listingenhancement` text COMMENT '格式', `hitcounter` varchar(20) DEFAULT NULL COMMENT '计数器', `paymentmethods` text COMMENT '支付信息', `postalcode` varchar(20) DEFAULT NULL COMMENT '邮编', `country` varchar(10) DEFAULT NULL COMMENT '国家', `region` int(10) DEFAULT NULL COMMENT '区域', `template` varchar(60) DEFAULT NULL COMMENT '模板风格', `basicinfo` int(10) DEFAULT NULL COMMENT '信息模板', `gallery` varchar(200) DEFAULT NULL, `dispatchtime` int(10) DEFAULT NULL COMMENT '包裹处理时间', `return_policy` text COMMENT '退款信息', `conditionid` int(11) DEFAULT NULL COMMENT '特征是否是二手的', `variation` longtext COMMENT '多属性', `specific` text COMMENT '细节值,如color,size', `bestoffer` tinyint(1) DEFAULT '0' COMMENT '是否议价', `bestofferprice` decimal(10,2) DEFAULT NULL COMMENT '自动议价价格', `minibestofferprice` decimal(10,2) DEFAULT NULL COMMENT '自动拒绝议价价格', `buyerrequirementdetails` text COMMENT '买家要求', `autopay` tinyint(1) DEFAULT '0' COMMENT '是否要求立即支付', `secondoffer` decimal(10,0) DEFAULT NULL COMMENT '二次交易', `privatelisting` tinyint(1) DEFAULT '0' COMMENT '是否私人刊登', `itemtitle2` varchar(255) DEFAULT NULL COMMENT '子标题', `vatpercent` decimal(10,2) DEFAULT NULL COMMENT '税', `crossbordertrade` tinyint(1) DEFAULT '0', `crossselling` int(11) DEFAULT NULL COMMENT '交叉销售的范本ID', `createtime` int(11) DEFAULT NULL, `updatetime` int(11) DEFAULT NULL, `itemdescription_listing` longtext, `crossselling_two` int(11) DEFAULT NULL, PRIMARY KEY (`mubanid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `ebay_sales_information` -- CREATE TABLE IF NOT EXISTS `ebay_sales_information` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '逐渐', `uid` int(10) DEFAULT NULL COMMENT 'uid', `name` varchar(255) DEFAULT NULL COMMENT '销售信息范本名', `payment` text COMMENT '支付信息', `delivery_details` text COMMENT '运输信息', `terms_of_sales` text COMMENT '销售相关信息', `about_us` text COMMENT '关于我们', `contact_us` text COMMENT '联系我们', `created` int(11) DEFAULT NULL, `updated` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `ebay_storecategory` -- CREATE TABLE IF NOT EXISTS `ebay_storecategory` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) DEFAULT NULL, `selleruserid` varchar(100) DEFAULT NULL, `categoryid` bigint(19) DEFAULT NULL COMMENT '分类id', `category_name` varchar(100) DEFAULT NULL COMMENT 'ebay店铺分类名', `category_order` int(10) DEFAULT NULL COMMENT 'ebay分类排序', `category_parentid` bigint(19) DEFAULT NULL COMMENT '分类父id', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `excelmodel` -- CREATE TABLE IF NOT EXISTS `excelmodel` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(200) NOT NULL COMMENT '模型名称', `content` text NOT NULL COMMENT '字段集合', `type` int(11) NOT NULL COMMENT '类型:0系统,1自定义', `belong` varchar(100) DEFAULT NULL COMMENT '用户名', `tablename` varchar(100) DEFAULT NULL COMMENT '表名', `keyname` varchar(100) DEFAULT 'id', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; INSERT INTO `excelmodel` (`id`, `name`, `content`, `type`, `belong`, `tablename`, `keyname`) VALUES (0, '默认范本', 'order_source_order_id,order_status,order_source,order_source_site_id,source_buyer_user_id,order_source_create_time,paid_time,grand_total,currency,sku,quantity,photo_primary,consignee,consignee_country_label_cn,user_message,delivery_time,tracknum,logistic_status,desc', 0, 'System', 'od_order_v2', 'id'); -- -------------------------------------------------------- -- -- Table structure for table `fn_transaction` -- CREATE TABLE IF NOT EXISTS `fn_transaction` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '记录编号', `pay_date` timestamp NULL DEFAULT NULL COMMENT '支付日期', `type` char(1) NOT NULL DEFAULT '' COMMENT '类型\nR: 收款记录\nP:付款记录', `currency` char(3) NOT NULL DEFAULT '' COMMENT '币种\nCNY/USD/EUR', `amount` decimal(10,2) DEFAULT NULL COMMENT '金额', `related_purchase_id` varchar(30) NOT NULL DEFAULT '' COMMENT '相关的采购单号', `related_order_id` varchar(30) NOT NULL DEFAULT '' COMMENT '相关的订单号', `pay_to_person` varchar(45) NOT NULL DEFAULT '' COMMENT '收款人', `pay_to_account` varchar(45) NOT NULL DEFAULT '', `pay_from_person` varchar(45) NOT NULL DEFAULT '', `pay_from_account` varchar(45) NOT NULL DEFAULT '', `payment_mode` varchar(50) NOT NULL DEFAULT '' COMMENT '支付方式\n工商银行,支付宝,paypal', `transaction_number` varchar(50) NOT NULL DEFAULT '' COMMENT '支付凭证号\n911126547898', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `addi_info` varchar(255) NOT NULL DEFAULT '' COMMENT '额外的附加信息,使用json格式记录', `capture_user_id` tinyint(3) unsigned DEFAULT NULL COMMENT 'Capture User ID', PRIMARY KEY (`id`), KEY `index2` (`related_purchase_id`), KEY `index3` (`related_order_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='支付/收款记录的基本信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `good_reputation_record` -- CREATE TABLE IF NOT EXISTS `good_reputation_record` ( `id` int(10) NOT NULL AUTO_INCREMENT, `orderid` varchar(50) DEFAULT NULL, `evaluate_time` int(11) DEFAULT NULL, `result` varchar(20) DEFAULT NULL, `fail_reason` varchar(255) DEFAULT NULL COMMENT '失败原因', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `login_info` -- CREATE TABLE IF NOT EXISTS `login_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ip` varchar(100) NOT NULL, `logintime` int(11) NOT NULL, `memo` varchar(200) NOT NULL, `userid` varchar(100) NOT NULL, `username` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `lt_ordertag` -- CREATE TABLE IF NOT EXISTS `lt_ordertag` ( `tag_id` int(11) NOT NULL AUTO_INCREMENT, `order_indicator_code` tinyint(4) NOT NULL DEFAULT '0' COMMENT '订单表里面的自定义标签 编号,例如 6 = order_v2.customized_tag_6', `tag_name` varchar(100) NOT NULL DEFAULT '', `color` varchar(20) DEFAULT NULL COMMENT '标签颜色', PRIMARY KEY (`tag_id`), KEY `index2` (`tag_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='标签定义' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `lt_order_tags` -- CREATE TABLE IF NOT EXISTS `lt_order_tags` ( `tagid` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', `order_id` int(11) NOT NULL DEFAULT 0 COMMENT '订单信息主键', `tag_id` int(11) unsigned DEFAULT NULL COMMENT '标签编号', PRIMARY KEY (`tagid`), UNIQUE KEY `index2` (`order_id`,`tag_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单和标签的对应信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `lt_tag` -- CREATE TABLE IF NOT EXISTS `lt_tag` ( `tag_id` int(11) NOT NULL AUTO_INCREMENT, `tag_name` varchar(100) NOT NULL DEFAULT '', `color` varchar(20) DEFAULT NULL COMMENT '标签颜色', PRIMARY KEY (`tag_id`), KEY `index2` (`tag_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='标签定义' AUTO_INCREMENT=4 ; -- -- Dumping data for table `lt_tag` -- INSERT INTO `lt_tag` (`tag_id`, `tag_name`, `color`) VALUES (1, '待重发包裹', 'red'), (2, '需要退款', 'purple'), (3, '包裹已退回', 'blue'); -- -------------------------------------------------------- -- -- Table structure for table `lt_tracking` -- CREATE TABLE IF NOT EXISTS `lt_tracking` ( `id` int(11) NOT NULL AUTO_INCREMENT, `seller_id` varchar(100) DEFAULT NULL COMMENT '平台seller账号名', `order_id` varchar(100) DEFAULT NULL COMMENT '平台 订单号', `track_no` varchar(100) DEFAULT NULL COMMENT '物流号', `status` varchar(30) DEFAULT NULL COMMENT '物流状态,例如:运输途中,查询不到,已签收,到达待取,递送失败', `state` varchar(30) DEFAULT NULL COMMENT '状态分类,表示该状态属于正常还是退回,超时,无法交运。\n这个状态需要根据不同递送方式的容忍度来判断。部分规则客户可以自定义。例如 中国邮政 5天内查不到才算无法交运,5天不到达是正常。而DHL 5天不到就算递送超时了。\n可能值:正常,失败,超时,无法交运', `source` char(1) DEFAULT NULL COMMENT '记录的录入来源,手工录入是M,excel是E,OMS是O', `platform` varchar(30) DEFAULT NULL COMMENT '来源的平台,例如Amazon,SMT,eBay', `parcel_type` tinyint(4) DEFAULT '0' COMMENT '包裹类型, (0)->未知, (1)->小包, (2)->大包, (3)->EMS', `carrier_type` int(11) DEFAULT '0' COMMENT '物流类型代号, \n0=全球邮政,100002=UPS,100001=DHL,100003=Fedex,100004=TNT,100007=DPD,100010=DPD(UK),100011=One World,100005=GLS,100012=顺丰速运,100008=EShipper,100009=Toll,100006=Aramex,190002=飞特物流,190008=云途物流,190011=百千诚物流,190007=俄速递,190009=快达物流,190003=华翰物流,190012=燕文物流,1 /* comment truncated */ /*90013=淼信国际,190014=俄易达,190015=俄速通,190017=俄通收,190016=俄顺达*/', `is_active` char(1) DEFAULT 'Y' COMMENT '是否活动 如果太旧的物流号,客户可以把它关闭跟踪,我们系统也可以定义n日无变化的跟踪放弃定期检查', `batch_no` varchar(100) DEFAULT NULL COMMENT '提交批次 提交方式+按照时间命名, 后续查看跟踪用户可以用这个来维护某天的查询对象以及某次excel上传来的整批物流 \n可能值:M2015-02-25,Excel2015-02-05 08:30', `create_time` date DEFAULT NULL COMMENT '提交日期', `update_time` datetime DEFAULT NULL COMMENT '更新时间', `from_nation` char(2) DEFAULT NULL COMMENT '来源国家', `to_nation` char(2) DEFAULT NULL COMMENT '目的国家', `mark_handled` char(1) DEFAULT 'N', `notified_seller` char(1) DEFAULT 'N' COMMENT '是否已发送邮件通知商家', `notified_buyer` char(1) DEFAULT 'N' COMMENT '是否已发送邮件通知买家,消费者', `shipping_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否该状态下已发信通知', `pending_fetch_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否该状态下已发信通知', `delivery_failed_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否该状态下已发信通知', `rejected_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否该状态下已发信通知', `received_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否在该状态通知过客户了', `ship_by` varchar(100) DEFAULT NULL COMMENT '递送公司,如 DHL,UPS,燕文,4PX', `delivery_fee` decimal(10,4) DEFAULT NULL COMMENT '递送费用CNY,如 3600.0000, 16.4569, 如果是粘贴快递公司的对账单,会有这个信息', `ship_out_date` date DEFAULT NULL COMMENT '快递单日期,如果是粘贴快递公司的对账单,会有这个信息', `total_days` tinyint(4) DEFAULT NULL, `all_event` text COMMENT '所有事件', `first_event_date` date DEFAULT NULL COMMENT '第一个Event的时间,用来判断,当2个物流商同一个物流号都有结果时候,用谁的结果来作准。', `last_event_date` date DEFAULT NULL COMMENT '最后一个物流时间时间,譬如签收时间', `stay_days` tinyint(4) NOT NULL DEFAULT '0' COMMENT '最后时间到现在逗留时间,如果已完成的订单,逗留时间为0即可', `msg_sent_error` char(1) NOT NULL DEFAULT 'N' COMMENT '是否有发信错误,如果有=Y', `from_lang` varchar(50) DEFAULT NULL COMMENT '发货国家的语言', `to_lang` varchar(50) DEFAULT NULL COMMENT '目标国家的语言', `first_track_result_date` date DEFAULT NULL COMMENT '第一次跟踪到结果的日期', `remark` text COMMENT '用户写入的备注,json格式存储', `addi_info` text COMMENT '其他信息', `ignored_time` datetime DEFAULT NULL COMMENT '忽略查询改物流号的时间', PRIMARY KEY (`id`), UNIQUE KEY `index2` (`track_no`,`order_id`), KEY `index3` (`order_id`), KEY `index4` (`batch_no`), KEY `index5` (`ship_by`), KEY `seller_orderid` (`seller_id`,`order_id`), KEY `status_state` (`status`,`state`), KEY `status_state11` (`state`,`status`), KEY `status_statesss` (`state`,`ship_out_date`,`create_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `lt_tracking_tags` -- CREATE TABLE IF NOT EXISTS `lt_tracking_tags` ( `tracking_tag_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', `tracking_id` varchar(30) NOT NULL DEFAULT '' COMMENT '物流信息主键', `tag_id` int(11) unsigned DEFAULT NULL COMMENT '标签编号', PRIMARY KEY (`tracking_tag_id`), UNIQUE KEY `index2` (`tracking_id`,`tracking_tag_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品和标签的对应信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `matching_rule` -- CREATE TABLE IF NOT EXISTS `matching_rule` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `uid` int(10) unsigned NOT NULL COMMENT '小老板主账号ID', `operator` int(11) unsigned NOT NULL COMMENT '创建或者修改人ID', `rule_name` varchar(100) NOT NULL COMMENT '运输服务匹配规则名', `rules` text COMMENT '规则选择项', `source` text COMMENT '订单来源', `site` text COMMENT '站点', `selleruserid` text COMMENT '卖家账号', `buyer_transportation_service` text COMMENT '买家选择运输服务', `warehouse` text COMMENT '仓库', `receiving_country` text COMMENT '收件国家', `total_amount` text COMMENT '总金额', `freight_amount` text COMMENT '买家支付运费', `total_weight` text COMMENT '总重量', `product_tag` text COMMENT '商品标签', `transportation_service_id` int(10) unsigned DEFAULT NULL COMMENT '运输服务ID', `priority` int(3) unsigned DEFAULT NULL COMMENT '优先级', `is_active` tinyint(1) NOT NULL COMMENT '是否启用', `created` int(11) NOT NULL, `updated` int(11) NOT NULL DEFAULT '1', `volume_weight` text COMMENT '体积重', `volume` text COMMENT '体积', `skus` text COMMENT '指定sku', `total_cost` text COMMENT '总成本', `items_location_country` text COMMENT '物品所在国家', `items_location_provinces` text COMMENT '物品所在州/省份', `items_location_city` text COMMENT '物品所在城市', `receiving_provinces` text COMMENT '收件州/省份', `receiving_city` text COMMENT '收件城市', `proprietary_warehouse_id` int DEFAULT 0 COMMENT '仓库ID,用于新的运输服务匹配时自动匹配仓库ID', `total_amount_new` text default '' COMMENT '订单总金额,按币种区分', `postal_code` text COMMENT '邮编', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `mytemplate` -- CREATE TABLE IF NOT EXISTS `mytemplate` ( `id` int(8) NOT NULL AUTO_INCREMENT, `title` varchar(60) NOT NULL, `pic` varchar(255) DEFAULT NULL, `content` longtext NOT NULL, `type` tinyint(2) NOT NULL DEFAULT '0' COMMENT '风格模板类型 0简单类型 1可视化类型', `account` varchar(60), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_customer` -- CREATE TABLE IF NOT EXISTS `od_customer` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `user_source` varchar(50) NOT NULL DEFAULT '' COMMENT '用户来源', `seller_platform_uid` varchar(50) NOT NULL DEFAULT '' COMMENT '卖家平台账号', `customer_platform_uid` varchar(50) NOT NULL DEFAULT '' COMMENT '买家平台账号', `customer_email` varchar(100) NOT NULL DEFAULT '' COMMENT '卖家email', `accumulated_order_amount` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '累计订单数量', `accumulated_trading_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '累计交易总额', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`), KEY `idx_custom` (`customer_platform_uid`), KEY `idx_seller` (`seller_platform_uid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='客户信息统计表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_delivery` -- CREATE TABLE IF NOT EXISTS `od_delivery` ( `id` int(11) NOT NULL AUTO_INCREMENT, `deliveryid` bigint(13) NOT NULL, `creater` varchar(128) DEFAULT NULL COMMENT '创建人', `ordercount` int(5) DEFAULT NULL COMMENT '订单数量', `skucount` int(5) DEFAULT NULL COMMENT '包含的sku数量', `jianhuo_status` tinyint(1) DEFAULT '0' COMMENT '是否完成拣货', `peihuo_status` tinyint(1) DEFAULT '0' COMMENT '是否完成配货', `warehouseid` int(11) DEFAULT '0' COMMENT '拣货单对应的仓库', `goodscount` int(5) DEFAULT NULL COMMENT '商品数量', `create_picking_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建拣货单时间', `print_picking_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '打印拣货单时间', `picking_status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '拣货单状态', `print_picking_operator` varchar(128) DEFAULT NULL COMMENT '打印人', `picking_operator` varchar(128) DEFAULT NULL COMMENT '拣货人', `account` float NOT NULL DEFAULT '0' COMMENT '金额', PRIMARY KEY (`id`), KEY `delivery_id` (`deliveryid`), KEY `jianhuo_status` (`jianhuo_status`), KEY `peihuo_status` (`peihuo_status`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_delivery_order` -- CREATE TABLE IF NOT EXISTS `od_delivery_order` ( `id` int(11) NOT NULL AUTO_INCREMENT, `delivery_id` bigint(13) NOT NULL COMMENT '映射的拣货单号', `order_id` int(11) NOT NULL COMMENT '映射的订单号', `sku` varchar(128) DEFAULT NULL COMMENT '映射订单的sku', `count` int(5) DEFAULT NULL COMMENT '映射订单的sku数量', `good_property` varchar(128) DEFAULT NULL COMMENT '商品属性', `good_name` varchar(128) DEFAULT NULL COMMENT '商品名称', `warehouse_address_id` int(20) NOT NULL DEFAULT '0' COMMENT '库位号', `image_adress` varchar(128) DEFAULT NULL COMMENT '图片地址', `location_grid` varchar(45) NOT NULL DEFAULT '' COMMENT '仓库货位/格子', PRIMARY KEY (`id`), KEY `delivery_id` (`delivery_id`), KEY `orderid` (`order_id`), KEY `sku` (`sku`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_ebay_externaltransaction` -- CREATE TABLE IF NOT EXISTS `od_ebay_externaltransaction` ( `eid` int(11) unsigned NOT NULL AUTO_INCREMENT, `ebay_orderid` varchar(50) DEFAULT NULL COMMENT 'Ebay OrderId', `selleruserid` varchar(50) DEFAULT NULL, `externaltransactionid` varchar(20) DEFAULT NULL COMMENT 'paypal id', `paymentorrefundamount` decimal(10,3) DEFAULT NULL COMMENT '交易金额', `feeorcreditamount` decimal(10,3) DEFAULT NULL COMMENT 'paypal交易费', `externaltransactiontime` int(10) DEFAULT NULL COMMENT '产生时间 ', `created` int(10) DEFAULT NULL, PRIMARY KEY (`eid`), KEY `ebay_orderid` (`ebay_orderid`), KEY `etid` (`externaltransactionid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_ebay_order` -- CREATE TABLE IF NOT EXISTS `od_ebay_order` ( `eorderid` int(11) unsigned NOT NULL AUTO_INCREMENT, `ebay_orderid` varchar(55) DEFAULT NULL, `ebay_uid` int(10) DEFAULT NULL COMMENT 'ebay账号表的id', `orderstatus` varchar(50) DEFAULT NULL, `ebaypaymentstatus` varchar(50) DEFAULT NULL, `paymentmethod` varchar(50) DEFAULT NULL, `checkoutstatus` varchar(50) DEFAULT NULL, `integratedmerchantcreditcardenabled` varchar(50) DEFAULT NULL, `adjustmentamount` decimal(10,3) DEFAULT NULL, `amountpaid` decimal(10,3) DEFAULT NULL, `amountsaved` decimal(10,3) DEFAULT NULL, `salestaxpercent` decimal(10,3) DEFAULT NULL, `salestaxamount` decimal(10,3) DEFAULT NULL, `shippingservicecost` decimal(10,3) DEFAULT NULL, `subtotal` decimal(10,3) DEFAULT NULL, `total` decimal(10,3) DEFAULT NULL, `feeorcreditamount` decimal(10,3) DEFAULT NULL, `paymentorrefundamount` decimal(10,3) DEFAULT NULL, `insurancecost` decimal(10,3) DEFAULT NULL, `currency` char(3) DEFAULT 'usd', `lastmodifiedtime` int(11) DEFAULT NULL, `createdtime` int(11) DEFAULT NULL, `paidtime` int(11) DEFAULT NULL, `shippedtime` int(11) DEFAULT NULL, `buyeruserid` varchar(64) DEFAULT NULL, `shippingservice` varchar(50) DEFAULT NULL, `shippingincludedintax` int(4) DEFAULT NULL, `ship_name` varchar(100) DEFAULT NULL COMMENT '收件人信息', `ship_company` varchar(100) DEFAULT NULL COMMENT '收件人公司', `ship_cityname` varchar(100) DEFAULT NULL, `ship_stateorprovince` varchar(100) DEFAULT NULL, `ship_country` varchar(100) DEFAULT NULL, `ship_countryname` varchar(100) DEFAULT NULL, `ship_street1` varchar(255) DEFAULT NULL, `ship_street2` varchar(255) DEFAULT NULL, `ship_postalcode` varchar(50) DEFAULT NULL, `ship_phone` varchar(255) DEFAULT NULL, `ship_email` varchar(150) DEFAULT NULL COMMENT '收件人 email', `addressid` varchar(50) DEFAULT NULL, `addressowner` varchar(50) DEFAULT NULL, `externaladdressid` varchar(50) DEFAULT NULL, `externaltransactionid` varchar(50) DEFAULT NULL, `externaltransactiontime` int(11) DEFAULT NULL, `shippingaddress` text, `externaltransaction` text, `buyercheckoutmessage` text, `shippingserviceselected` text, `selleruserid` varchar(55) DEFAULT NULL, `ecid` int(11) DEFAULT NULL, `responsedat` int(10) DEFAULT NULL, `berequest` int(4) DEFAULT NULL, `status_berequest` int(4) DEFAULT NULL, `salesrecordnum` int(11) DEFAULT NULL COMMENT 'SellingMangerRecordNumber', PRIMARY KEY (`eorderid`), KEY `ebay_orderid` (`ebay_orderid`), KEY `selleruserid` (`selleruserid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_ebay_transaction` -- CREATE TABLE IF NOT EXISTS `od_ebay_transaction` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) unsigned DEFAULT NULL, `selleruserid` varchar(100) DEFAULT NULL COMMENT 'Ebay 账号 ', `transactionid` bigint(20) DEFAULT NULL COMMENT 'id', `order_id` int(10) unsigned DEFAULT NULL, `goods_id` int(10) unsigned DEFAULT '0', `itemid` bigint(20) DEFAULT NULL COMMENT 'Item', `eorderid` int(11) DEFAULT NULL, `orderid` varchar(64) DEFAULT NULL COMMENT 'Ebay Order,order transaction', `sku` varchar(250) DEFAULT NULL, `storage_id` int(10) DEFAULT '0' COMMENT '仓库编号', `createddate` int(11) DEFAULT NULL COMMENT '创建时间', `quantitypurchased` int(4) DEFAULT NULL COMMENT ' 数量 ', `platform` varchar(20) DEFAULT NULL COMMENT ' 站点平点 ', `listingtype` enum('Chinese','FixedPriceItem','Other') DEFAULT 'Other', `buyer` text COMMENT 'buyer ', `title` varchar(100) DEFAULT NULL, `status` text COMMENT 'status ', `amountpaid` decimal(10,2) DEFAULT NULL COMMENT '支付总额 ', `adjustmentamount` decimal(10,2) DEFAULT NULL COMMENT '折扣 ', `transactionprice` decimal(10,3) DEFAULT NULL, `shippingservicecost` decimal(10,2) DEFAULT NULL COMMENT '运费', `shippingservice` varchar(255) DEFAULT NULL COMMENT ' 物流 ', `finalvaluefee` decimal(10,2) DEFAULT NULL COMMENT ' 交易费', `finalvaluefee_currency` char(16) DEFAULT NULL COMMENT '交易费货币', `transactionsiteid` char(32) DEFAULT NULL COMMENT '站点', `paypalemailaddress` char(255) DEFAULT NULL COMMENT 'The seller s Paypal email address. ', `shippingserviceselected` text COMMENT ' 使用的物流', `currency` char(32) DEFAULT NULL, `desc` char(255) DEFAULT NULL COMMENT ' ', `paidtime` int(11) unsigned DEFAULT NULL COMMENT '支付时间', `seller_commenttype` char(32) DEFAULT NULL COMMENT '买家好评', `seller_commenttext` char(255) DEFAULT NULL COMMENT '买家好评内容', `shipped` tinyint(1) unsigned DEFAULT '0' COMMENT '是否发货', `rn` char(128) DEFAULT NULL COMMENT '物流单号', `property_id` text COMMENT '属性id', `status_payment` varchar(20) NOT NULL DEFAULT 'wait' COMMENT '付款状态', `status_feedback` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0未评价1已评价', `backmoney` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '退款', `second_chance_offer_sent` tinyint(1) DEFAULT '0' COMMENT '二次购买', `buyer_feedback` char(100) DEFAULT NULL COMMENT '买家好评', `buyer_dispute` char(100) DEFAULT NULL COMMENT '买家纠纷', `additemfee` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '刊登费', `additemfee_currency` char(16) DEFAULT 'USD', `variation` text COMMENT '多属性', `sendinvoice` tinyint(2) DEFAULT '0' COMMENT '发送账单', `salesrecordnum` int(11) DEFAULT NULL COMMENT 'SellingMangerRecordNumber', `buyercheckoutmessage` text, `orderlineitemid` varchar(55) DEFAULT NULL, `lasttimemodified` int(10) NOT NULL DEFAULT '0' COMMENT '修改时间', `goodscategory_id` int(10) DEFAULT NULL COMMENT '商品分类ID', `lotsize` int(4) DEFAULT '0' COMMENT 'lotsize', `is_peihuo` tinyint(2) DEFAULT '0' COMMENT '0未配货,1已配货', `peihuo_user` varchar(32) DEFAULT NULL COMMENT '配货人', `peihuo_time` int(11) DEFAULT '0' COMMENT '配货时间', `created` int(11) unsigned DEFAULT NULL, `updated` int(11) unsigned DEFAULT NULL, `shipmenttrackingdetail` text COMMENT '交易的track信息', PRIMARY KEY (`id`), KEY `NewIndex1` (`uid`), KEY `NewIndex4` (`order_id`), KEY `NewIndex5` (`itemid`,`transactionid`), KEY `selleruserid` (`selleruserid`), KEY `goods_id` (`goods_id`), KEY `listingtype` (`listingtype`), KEY `eorderid` (`eorderid`), KEY `storage_id` (`storage_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=55 ; -- -------------------------------------------------------- -- -- Table structure for table `od_order` -- CREATE TABLE IF NOT EXISTS `od_order` ( `order_id` int(11) unsigned zerofill NOT NULL AUTO_INCREMENT COMMENT '订单id', `order_status` smallint(5) NOT NULL DEFAULT '0' COMMENT '订单流程状态:100:未付款,200:已付款,201:有留言,205:未分仓库,210:SKU不存在,215:报关信息不全,220:paypal/ebay金额不对,225:paypal/ebay地址不对,230:未匹配物流,300:待生成包裹,400:发货处理中,500:已发货,600:已取消', `order_manual_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '挂起状态 0:取消挂起状态', `pay_status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '支付状态', `shipping_status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '发货状态', `order_source` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源 ebay,amazon,aliexpress,custom', `order_type` varchar(50) NOT NULL DEFAULT '' COMMENT '订单类型如amazon FBA订单', `order_source_order_id` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源 的订单id', `order_source_site_id` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源平台下的站点:如eaby下的US站点', `selleruserid` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源平台卖家用户名(下单时候的用户名)', `saas_platform_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'saas库平台用户卖家账号id(ebay或者amazon卖家表中)', `order_source_srn` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'od_ebay_order表salesrecordnum', `customer_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'od_customer 表id', `source_buyer_user_id` varchar(50) NOT NULL DEFAULT '' COMMENT '来源买家用户名', `order_source_shipping_method` varchar(50) NOT NULL DEFAULT '' COMMENT '平台下单时用户选择的物流方式', `order_source_create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单在来源平台的下单时间', `subtotal` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '产品总价格', `shipping_cost` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '运费', `discount_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '折扣', `grand_total` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '合计金额(产品总价格 + 运费 - 折扣 = 合计金额)', `returned_total` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '退款总金额', `price_adjustment` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '价格手动调整(下单后人工调整)', `currency` char(3) NOT NULL DEFAULT '' COMMENT '货币', `consignee` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人', `consignee_postal_code` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人邮编', `consignee_phone` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人电话', `consignee_email` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人Email', `consignee_company` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人公司', `consignee_country` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人国家名', `consignee_country_code` char(2) NOT NULL DEFAULT '' COMMENT '收货人国家代码', `consignee_city` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人城市', `consignee_province` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人省', `consignee_district` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人区', `consignee_county` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人镇', `consignee_address_line1` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址1', `consignee_address_line2` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址2', `consignee_address_line3` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址3', `default_warehouse_id` int(11) NOT NULL DEFAULT '0' COMMENT '默认的仓库id', `default_carrier_code` varchar(255) NOT NULL DEFAULT '' COMMENT '默认物流商代码', `default_shipping_method_code` varchar(255) NOT NULL DEFAULT '' COMMENT '默认物流方式code', `paid_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单付款时间', `delivery_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单发货时间', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间 ', `user_message` text NOT NULL COMMENT '用户留言', `is_manual_order` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否手工订单 1:是 0:否', `carrier_type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0:普通物流商 1:海外仓', `is_feedback` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`order_id`), KEY `idx_statmanu` (`order_status`,`order_manual_id`) USING BTREE, KEY `idx_timeseller` (`order_source_create_time`,`selleruserid`) USING BTREE, KEY `idx_timebuyer` (`order_source_create_time`,`source_buyer_user_id`) USING BTREE, KEY `idx_timegrand` (`order_source_create_time`,`grand_total`), KEY `idx_buyeremail` (`consignee_email`), KEY `idx_manu` (`order_manual_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_order_has_dely_delivery` -- CREATE TABLE IF NOT EXISTS `od_order_has_dely_delivery` ( `order_id` int(11) unsigned zerofill NOT NULL DEFAULT '00000000000' COMMENT '订单id', `delivery_id` int(11) unsigned zerofill NOT NULL DEFAULT '00000000000' COMMENT '包裹id', PRIMARY KEY (`order_id`,`delivery_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='包裹和订单关联表'; -- -------------------------------------------------------- -- -- Table structure for table `od_order_item` -- CREATE TABLE IF NOT EXISTS `od_order_item` ( `order_item_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单商品id', `order_id` int(11) unsigned zerofill NOT NULL DEFAULT '00000000000' COMMENT '订单号', `order_source_srn` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'od_ebay_transaction表salesrecordnum', `order_source_order_item_id` varchar(50) NOT NULL DEFAULT '' COMMENT 'od_ebay_transaction表id或amazon的OrderItemId', `source_item_id` varchar(50) NOT NULL DEFAULT '' COMMENT '平台刊登itemid', `sku` varchar(250) DEFAULT '' COMMENT '商品编码', `product_name` varchar(255) NOT NULL DEFAULT '' COMMENT '下单时标题', `photo_primary` varchar(255) NOT NULL DEFAULT '' COMMENT '商品主图冗余', `shipping_price` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '运费', `shipping_discount` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '运费折扣', `price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '下单时价格', `promotion_discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '促销折扣', `ordered_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '下单时候的数量', `quantity` int(11) unsigned NOT NULL DEFAULT '1' COMMENT '需发货的商品数量', `sent_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '已发货数量', `packed_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '已打包数量', `returned_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '退货数量', `invoice_requirement` varchar(50) NOT NULL DEFAULT '' COMMENT '发票要求', `buyer_selected_invoice_category` varchar(50) NOT NULL DEFAULT '' COMMENT '发票种类', `invoice_title` varchar(50) NOT NULL DEFAULT '' COMMENT '发票抬头', `invoice_information` varchar(50) NOT NULL DEFAULT '' COMMENT '发票内容', `remark` varchar(255) DEFAULT NULL COMMENT '订单备注', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `platform_sku` varchar(50) DEFAULT '' COMMENT '平台sku', `is_bundle` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否是捆绑商品,1:是0:否', `bdsku` varchar(50) NOT NULL DEFAULT '' COMMENT '捆绑sku', PRIMARY KEY (`order_item_id`), KEY `idx_oid` (`order_id`), KEY `idx_itemid` (`order_source_order_item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单商品表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_order_item_v2` -- CREATE TABLE IF NOT EXISTS `od_order_item_v2` ( `order_item_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单商品id', `order_id` int(11) unsigned zerofill NOT NULL DEFAULT '00000000000' COMMENT '订单号', `order_source_srn` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'od_ebay_transaction表salesrecordnum', `order_source_order_item_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'od_ebay_transaction表id或amazon的OrderItemId', `sku` varchar(255) DEFAULT '' COMMENT '商品编码', `product_name` varchar(255) DEFAULT NULL COMMENT '标题', `photo_primary` text DEFAULT NULL COMMENT '主图', `shipping_price` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '运费', `shipping_discount` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '运费折扣', `price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '下单时价格', `promotion_discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '促销折扣', `ordered_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '下单时候的数量', `quantity` int(11) unsigned NOT NULL DEFAULT '1' COMMENT '需发货的商品数量', `sent_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '已发货数量', `packed_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '已打包数量', `returned_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '退货数量', `invoice_requirement` varchar(50) NOT NULL DEFAULT '' COMMENT '发票要求', `buyer_selected_invoice_category` varchar(50) NOT NULL DEFAULT '' COMMENT '发票种类', `invoice_title` varchar(50) NOT NULL DEFAULT '' COMMENT '发票抬头', `invoice_information` varchar(50) NOT NULL DEFAULT '' COMMENT '发票内容', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `desc` text COMMENT '订单商品备注', `platform_sku` varchar(50) DEFAULT '' COMMENT '平台sku', `is_bundle` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否是捆绑商品,1:是;0:否', `bdsku` varchar(50) NOT NULL DEFAULT '' COMMENT '捆绑sku', `source_item_id` varchar(50) DEFAULT NULL, `order_source_order_id` varchar(50) DEFAULT NULL COMMENT '订单来源平台订单号', `order_source_transactionid` varchar(50) DEFAULT NULL COMMENT '订单来源交易号或子订单号', `order_source_itemid` varchar(50) DEFAULT NULL COMMENT '产品ID listing的唯一标示', `product_attributes` varchar(100) DEFAULT NULL COMMENT '商品属性', `product_unit` varchar(50) DEFAULT NULL COMMENT '单位', `lot_num` int(5) DEFAULT '1' COMMENT '单位数量', `goods_prepare_time` int(2) DEFAULT '1' COMMENT '备货时间', `product_url` varchar(455) DEFAULT NULL COMMENT '商品url', `remark` varchar(255) DEFAULT NULL COMMENT '订单备注', `purchase_price` decimal(10,2) NULL DEFAULT NULL COMMENT '订单商品采购价snapshot', `purchase_price_form` DATETIME NULL DEFAULT NULL COMMENT '订单商品采购价snapshot生效的起始时间', `purchase_price_to` DATETIME NULL DEFAULT NULL COMMENT '订单商品采购价snapshot生效的结束时间', `is_sys_create_sku` char(1) NOT NULL DEFAULT '' COMMENT '空sku是否自动创建系统sku并保存到item表中,Y为是,N或空为不是', `addi_info` text COMMENT '额外信息', `oversea_sku` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '订单级别的海外仓sku', `delivery_status` varchar(20) DEFAULT NULL COMMENT '小老板中该item是否能发货', `platform_status` varchar(255) DEFAULT NULL COMMENT '各个平台对应的item status', `item_source` varchar(20) DEFAULT 'platform' COMMENT '商品来源:platform表示平台商品,local表示本地商品', `manual_status` varchar(20) DEFAULT 'enable' COMMENT '手工操作状态:enable表示启用,disable表示禁用', `root_sku` VARCHAR(255) NULL COMMENT '小老板的root sku' , `declaration` TEXT NULL COMMENT '订单item级别的报关信息' , PRIMARY KEY (`order_item_id`), KEY `idx_oid` (`order_id`), KEY `idx_itemid` (`order_source_order_item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单商品表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_order_log` -- CREATE TABLE IF NOT EXISTS `od_order_log` ( `order_log_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '日志编号', `order_id` int(11) unsigned zerofill NOT NULL DEFAULT '00000000000' COMMENT '订单号', `order_parameter` varchar(255) NOT NULL DEFAULT '' COMMENT '订单参数', `content` text NOT NULL COMMENT '日志详细信息', `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作人id', `user_name` varchar(20) NOT NULL DEFAULT '' COMMENT '操作人用户名', `create_time` int(11) unsigned NOT NULL COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL COMMENT '更新时间', PRIMARY KEY (`order_log_id`,`order_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单日志表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_order_manual` -- CREATE TABLE IF NOT EXISTS `od_order_manual` ( `order_manual_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '人工处理id', `order_manual_name` varchar(50) NOT NULL DEFAULT '' COMMENT '人工处理状态', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`order_manual_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='人工处理状态表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_order_remark` -- CREATE TABLE IF NOT EXISTS `od_order_remark` ( `order_remark_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单备注id', `order_id` int(11) unsigned zerofill NOT NULL DEFAULT '00000000000' COMMENT '订单号', `content` text NOT NULL COMMENT '留言内容', `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '留言用户id', `user_name` varchar(20) NOT NULL DEFAULT '' COMMENT '用户名', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`order_remark_id`), KEY `idx_idtime` (`order_id`,`update_time`), KEY `idx_uidtime` (`user_id`,`update_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单备注表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_order_shipped` -- CREATE TABLE IF NOT EXISTS `od_order_shipped` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', `order_id` int(11) NOT NULL COMMENT '订单号', `order_source` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源 ebay,amazon,aliexpress,custom', `selleruserid` varchar(80) DEFAULT NULL COMMENT '卖家账号', `tracking_number` varchar(50) NOT NULL DEFAULT '' COMMENT '发货单号', `tracking_link` varchar(100) NOT NULL DEFAULT '' COMMENT '跟踪号查询网址', `shipping_method_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流方式code', `status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '订单标记发货状态,0:未处理,1:成功,2:失败', `sync_to_tracker` char(1) NOT NULL DEFAULT '' COMMENT '是否同步到Tracker模块了,Y为是,默认空白为否', `result` varchar(20) DEFAULT NULL COMMENT '执行结果', `errors` varchar(255) DEFAULT NULL COMMENT '返回错误', `created` int(11) DEFAULT NULL COMMENT '创建时间', `lasttime` int(11) DEFAULT NULL COMMENT '标记时间', PRIMARY KEY (`id`), KEY `idx_oid` (`order_id`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='订单标发货表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_order_shipped_v2` -- CREATE TABLE IF NOT EXISTS `od_order_shipped_v2` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', `order_id` int(11) NOT NULL COMMENT '订单号', `order_source` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源 ebay,amazon,aliexpress,custom', `selleruserid` varchar(80) DEFAULT NULL COMMENT '卖家账号', `tracking_number` varchar(50) NOT NULL DEFAULT '' COMMENT '发货单号', `tracking_link` TEXT NOT NULL DEFAULT '' COMMENT '跟踪号查询网址', `shipping_method_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流方式code', `shipping_method_name` varchar(100) DEFAULT NULL COMMENT '物流方式名', `status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '订单标记发货状态,0:未处理,1:成功,2:失败', `sync_to_tracker` char(1) NOT NULL DEFAULT '' COMMENT '是否同步到Tracker模块了,Y为是,默认空白为否', `result` varchar(20) DEFAULT NULL COMMENT '执行结果', `errors` text DEFAULT NULL COMMENT '返回错误', `created` int(11) DEFAULT NULL COMMENT '创建时间', `updated` int(11) DEFAULT NULL COMMENT '修改时间', `lasttime` int(11) DEFAULT NULL COMMENT '标记时间', `return_no` varchar(255) DEFAULT '' COMMENT '物流商返回数据', `shipping_service_id` int(11) DEFAULT NULL COMMENT '通过小老板平台发货 存储运输服务id', `order_source_order_id` varchar(50) DEFAULT NULL COMMENT '订单来源平台订单号', `addtype` varchar(100) DEFAULT NULL COMMENT '物流号来源', `signtype` varchar(10) DEFAULT NULL COMMENT '全部发货all 部分发货part', `description` varchar(255) DEFAULT NULL COMMENT '发货备注', `customer_number` varchar(50) DEFAULT NULL COMMENT '物流商返回的客户单号用户查询物流号', `tracker_status` varchar(30) NOT NULL DEFAULT '' COMMENT 'tracker的物流状态', PRIMARY KEY (`id`), KEY `idx_oid` (`order_id`) USING BTREE, KEY `sellerid_orderid` (`selleruserid`,`order_id`), KEY `trackno` (`tracking_number`), KEY `trackeruse` (`sync_to_tracker`,`order_id`,`status`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='订单标发货表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_order_v2` -- CREATE TABLE IF NOT EXISTS `od_order_v2` ( `order_id` int(11) unsigned zerofill NOT NULL AUTO_INCREMENT COMMENT '订单id', `order_status` smallint(5) NOT NULL DEFAULT '0' COMMENT '订单流程状态:100:未付款,200:已付款,201:有留言,205:未分仓库,210:SKU不存在,215:报关信息不全,220:paypal/ebay金额不对,225:paypal/ebay地址不对,230:未匹配物流,300:待生成包裹,400:发货处理中,500:已发货,600:已取消', `pay_status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '支付状态', `order_source_status` varchar(50) DEFAULT NULL COMMENT '订单来源平台订单状态', `order_manual_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '自定义标签', `is_manual_order` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否挂起状态', `shipping_status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '平台发货状态', `exception_status` smallint(5) DEFAULT '0' COMMENT '检测异常状态', `weird_status` char(10) DEFAULT NULL COMMENT '操作异常标签', `order_source` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源 ebay,amazon,aliexpress,custom', `order_type` varchar(50) NOT NULL DEFAULT '' COMMENT '订单类型如amazon FBA订单', `order_source_order_id` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源 的订单id', `order_source_site_id` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源平台下的站点:如eaby下的US站点', `selleruserid` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源平台卖家用户名(下单时候的用户名)', `saas_platform_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'saas库平台用户卖家账号id(ebay或者amazon卖家表中)', `order_source_srn` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'od_ebay_order表salesrecordnum', `customer_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'od_customer 表id', `source_buyer_user_id` varchar(255) NOT NULL DEFAULT '' COMMENT '来源买家用户名', `order_source_shipping_method` varchar(50) NOT NULL DEFAULT '' COMMENT '平台下单时用户选择的物流方式', `order_source_create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单在来源平台的下单时间', `subtotal` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '产品总价格', `shipping_cost` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '运费', `antcipated_shipping_cost` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '预估运费', `actual_shipping_cost` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '实际运费', `discount_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '折扣', `commission_total` decimal(10,2) DEFAULT '0.00' COMMENT '订单平台佣金', `paypal_fee` decimal(10,2) DEFAULT '0.00' COMMENT '暂时ebay使用的paypal 佣金(其他平台待开发其用途)', `grand_total` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '合计金额(产品总价格 + 运费 - 折扣 = 合计金额)', `returned_total` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '退款总金额', `price_adjustment` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '价格手动调整(下单后人工调整)', `currency` char(3) NOT NULL DEFAULT '' COMMENT '货币', `consignee` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人', `consignee_postal_code` varchar(50) NOT NULL DEFAULT '' COMMENT '收货人邮编', `consignee_phone` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人电话', `consignee_mobile` varchar(20) DEFAULT NULL COMMENT '收货人手机', `consignee_fax` varchar(255) DEFAULT NULL COMMENT '收件人传真号', `consignee_email` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人Email', `consignee_company` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人公司', `consignee_country` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人国家名', `consignee_country_code` char(2) NOT NULL DEFAULT '' COMMENT '收货人国家代码', `consignee_city` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人城市', `consignee_province` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人省', `consignee_district` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人区', `consignee_county` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人镇', `consignee_address_line1` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址1', `consignee_address_line2` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址2', `consignee_address_line3` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址3', `default_warehouse_id` int(11) NOT NULL DEFAULT '0' COMMENT '默认的仓库id', `default_carrier_code` varchar(50) NOT NULL DEFAULT '' COMMENT '默认物流商代码', `default_shipping_method_code` varchar(50) NOT NULL DEFAULT '' COMMENT '默认运输服务id', `paid_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单付款时间', `delivery_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '平台订单发货时间', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间 ', `user_message` varchar(255) NOT NULL DEFAULT '' COMMENT '用户留言', `carrier_type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0:普通物流商 1:海外仓', `hassendinvoice` tinyint(1) DEFAULT '0' COMMENT '是否有发送ebay账单', `seller_commenttype` varchar(32) DEFAULT NULL COMMENT '卖家评价类型', `seller_commenttext` varchar(255) DEFAULT NULL COMMENT '卖家评价留言', `status_dispute` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否有发起ebay催款,0没有', `is_feedback` int(1) DEFAULT NULL, `rule_id` int(11) DEFAULT NULL COMMENT '运输服务匹配规则id', `customer_number` varchar(50) DEFAULT NULL COMMENT '物流商返回的客户单号用户查询物流号', `carrier_step` tinyint(1) DEFAULT '0' COMMENT '物流操作步骤', `is_print_picking` tinyint(1) DEFAULT '0' COMMENT '是否打印拣货单', `print_picking_operator` int(10) DEFAULT NULL COMMENT '打印拣货单操作人', `print_picking_time` int(11) DEFAULT NULL COMMENT '打印拣货单时间', `is_print_distribution` tinyint(1) DEFAULT '0' COMMENT '是否打印配货单', `print_distribution_operator` int(10) DEFAULT NULL COMMENT '打印配货单操作人', `print_distribution_time` int(11) DEFAULT NULL COMMENT '配货单打印时间', `is_print_carrier` tinyint(1) DEFAULT '0' COMMENT '是否打印物流单', `print_carrier_operator` int(10) DEFAULT NULL COMMENT '打印物流单操作人', `printtime` int(11) DEFAULT '0' COMMENT '订单物流单打单时间', `delivery_status` tinyint(2) DEFAULT '0' COMMENT '小老板发货流程状态', `delivery_id` bigint(13) DEFAULT NULL COMMENT '拣货单号', `desc` text COMMENT '订单备注', `carrier_error` text, `is_comment_status` tinyint(1) unsigned DEFAULT '0' COMMENT '该订单是否已给好评', `is_comment_ignore` tinyint(1) unsigned DEFAULT '0' COMMENT '该订单是否设置好评忽略', `issuestatus` varchar(20) DEFAULT '' COMMENT '订单纠纷状态', `payment_type` varchar(50) NOT NULL DEFAULT '' COMMENT '支付类型', `logistic_status` varchar(255) DEFAULT NULL COMMENT '物流状态', `logistic_last_event_time` datetime DEFAULT NULL COMMENT '物流最后更新时间', `fulfill_deadline` int(11) NOT NULL DEFAULT '0' COMMENT '销售平台最后发货期限', `profit` decimal(10,2) DEFAULT NULL COMMENT '小老板计算出的利润', `logistics_cost` decimal(10,2) DEFAULT NULL COMMENT '物流成本', `logistics_weight` decimal(10,2) DEFAULT NULL COMMENT '物流商返回的称重重量(g)', `addi_info` text COMMENT '额外信息', `distribution_inventory_status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '分配库存状态2待分配,3缺货,4已分配', `reorder_type` varchar(50) DEFAULT NULL COMMENT '重新发货类型', `purchase_status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '采购(缺货)状态', `pay_order_type` varchar(50) DEFAULT NULL COMMENT '已付款订单类型', `order_evaluation` tinyint(2) NOT NULL DEFAULT '0' COMMENT '订单评价1为好评,2为中评,3差评', `tracker_status` varchar(30) DEFAULT NULL COMMENT 'tracker的物流状态', `origin_shipment_detail` text COMMENT '原始的订单收件人信息', `order_ship_time` datetime DEFAULT NULL COMMENT '小老板发货时间', `shipping_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否发送过启运通知,I为旧数据忽略', `pending_fetch_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否发送过到达待取通知,I为旧数据忽略', `delivery_failed_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '', `rejected_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否发送过异常退回通知,I为旧数据忽略', `received_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否发送过已签收求好评通知,I为旧数据忽略', `seller_weight` decimal(10,2) DEFAULT '0.00' COMMENT '卖家自己的称重重量(g)(取整)', `order_capture` char(1) NOT NULL DEFAULT 'N' COMMENT '是否手工订单N为否,Y为是', `order_relation` varchar(10) NOT NULL DEFAULT 'normal' COMMENT '订单类型 正常为normal,合并原始订单为fm,合并出来的新订单 sm,拆分的原始订单为fs,拆分后的新订单为ss ', `last_modify_time` datetime DEFAULT NULL COMMENT '订单的最后修改时间', `sync_shipped_status` char(1) NOT NULL DEFAULT 'Y' COMMENT '虚拟发货的同步状态P为待提交,S为提交中,F为提交失败,C为提交成功(小老板),Y为提交成功(非小老板)', `system_tag_1` char(1) NOT NULL DEFAULT '' COMMENT '系统标签1,Y为该标签标记了,N或者空白未没有', `system_tag_2` char(1) NOT NULL DEFAULT '' COMMENT '系统标签2,Y为该标签标记了,N或者空白未没有', `system_tag_3` char(1) NOT NULL DEFAULT '' COMMENT '系统标签3,Y为该标签标记了,N或者空白未没有', `system_tag_4` char(1) NOT NULL DEFAULT '' COMMENT '系统标签4,Y为该标签标记了,N或者空白未没有', `system_tag_5` char(1) NOT NULL DEFAULT '' COMMENT '系统标签5,Y为该标签标记了,N或者空白未没有', `customized_tag_1` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签1,Y为该标签标记了,N或者空白未没有', `customized_tag_2` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签2,Y为该标签标记了,N或者空白未没有', `customized_tag_3` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签3,Y为该标签标记了,N或者空白未没有', `customized_tag_4` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签4,Y为该标签标记了,N或者空白未没有', `customized_tag_5` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签5,Y为该标签标记了,N或者空白未没有', `customized_tag_6` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签6,Y为该标签标记了,N或者空白未没有', `customized_tag_7` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签7,Y为该标签标记了,N或者空白未没有', `customized_tag_8` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签8,Y为该标签标记了,N或者空白未没有', `customized_tag_9` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签9,Y为该标签标记了,N或者空白未没有', `customized_tag_10` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签10,Y为该标签标记了,N或者空白未没有', `tracking_no_state` int(3) default 0 COMMENT '物流商获取跟踪号状态 0:表示未获取过,1:表示获取失败,2:表示成功获取', `order_verify` varchar(20) DEFAULT NULL COMMENT '订单是否验证,ebay主要用于验证paypal地址与ebay地址是否一致', `items_md5` varchar(128) DEFAULT NULL COMMENT '所有商品关键值生成的md5,主要用于是否更新商品item表', `complete_ship_time` INT(11) NULL COMMENT '确认发货完成时间' , `declaration_info` text DEFAULT '' COMMENT '用于记录最后一次上传成功的报关信息,以json格式', `isshow` char(1) NOT NULL DEFAULT 'Y' COMMENT '是否显示,Y为显示,N为不显示', `first_sku` varchar(255) DEFAULT NULL COMMENT '商品的第一个sku,可用于排序', `ismultipleProduct` char(1) NOT NULL DEFAULT 'N' COMMENT '是否多品订单,Y为是,N为不是', `tracking_number` varchar(255) DEFAULT NULL COMMENT '物流跟踪号', `billing_info` text COMMENT '账单地址相关信息', `transaction_key` varchar(255) DEFAULT NULL COMMENT '订单交易号(目前用于记录prestashop线下付款的汇款号)', PRIMARY KEY (`order_id`), KEY `idx_statmanu` (`order_status`,`order_manual_id`) USING BTREE, KEY `idx_timeseller` (`order_source_create_time`,`selleruserid`) USING BTREE, KEY `idx_timebuyer` (`order_source_create_time`,`source_buyer_user_id`) USING BTREE, KEY `idx_timegrand` (`order_source_create_time`,`grand_total`), KEY `idx_buyeremail` (`consignee_email`), KEY `idx_manu` (`order_manual_id`), KEY `order_source_order_id` (`order_source_order_id`), KEY `idx_order_customer` (`order_source`,`source_buyer_user_id`), KEY `idx_comment_status` (`is_comment_status`), KEY `idx_comment_ignore` (`is_comment_ignore`), KEY `idx_issuestatus` (`issuestatus`), KEY `logistic_status` (`logistic_status`,`order_source`) COMMENT 'logistic_status', KEY `pay_order_type` (`pay_order_type`), KEY `order_ship_time` (`order_ship_time`), KEY `shipping_notified` (`shipping_notified`,`pending_fetch_notified`,`rejected_notified`,`received_notified`), KEY `platform_shiptime` (`order_source`,`order_ship_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_paypal_transaction` -- CREATE TABLE IF NOT EXISTS `od_paypal_transaction` ( `ptid` int(11) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) DEFAULT NULL, `eorderid` int(10) DEFAULT NULL COMMENT 'ebay_orderdid', `ebay_orderid` varchar(50) DEFAULT NULL COMMENT 'ebay_orderd', `order_id` int(10) DEFAULT NULL COMMENT 'order_id系统订单号', `transactionid` varchar(50) DEFAULT NULL, `transactiontype` varchar(10) DEFAULT NULL, `ordertime` int(10) DEFAULT NULL, `amt` decimal(8,3) DEFAULT NULL, `feeamt` decimal(8,3) DEFAULT NULL, `netamt` decimal(8,3) DEFAULT NULL, `currencycode` char(3) DEFAULT NULL, `buyerid` varchar(50) DEFAULT NULL, `email` varchar(50) DEFAULT NULL COMMENT '付款Email', `receiverbusiness` varchar(50) DEFAULT NULL COMMENT '收款账户', `receiveremail` varchar(50) DEFAULT NULL COMMENT '收款账户', `shiptoname` varchar(50) DEFAULT NULL, `shiptostreet` varchar(50) DEFAULT NULL, `shiptostreet2` varchar(100) DEFAULT NULL, `shiptocity` varchar(50) DEFAULT NULL, `shiptostate` varchar(50) DEFAULT NULL, `shiptocountrycode` varchar(3) DEFAULT NULL, `shiptocountryname` varchar(50) DEFAULT NULL, `shiptozip` varchar(20) DEFAULT NULL, `addressowner` varchar(20) DEFAULT NULL, `paymentstatus` varchar(20) DEFAULT NULL COMMENT '支付状态', `detail` text COMMENT '订单内容', `created` int(10) DEFAULT NULL, `updated` int(10) DEFAULT NULL, PRIMARY KEY (`ptid`), UNIQUE KEY `transactionid` (`transactionid`), KEY `uid` (`uid`), KEY `eorderid` (`eorderid`), KEY `ebay_orderid` (`ebay_orderid`), KEY `idx_oid` (`order_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `od_shippingmethod_automatic_matching` -- CREATE TABLE IF NOT EXISTS `od_shippingmethod_automatic_matching` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `order_source` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源 ebay,amazon,aliexpress,custom', `order_source_site_id` varchar(255) NOT NULL DEFAULT '' COMMENT '订单来源平台下的站点:如eaby下的US站点', `order_selleruserid` varchar(255) NOT NULL DEFAULT '' COMMENT '订单来源平台卖家用户id', `order_subtotal_max` decimal(10,2) NOT NULL COMMENT '订单总金额的最大值', `order_subtotal_min` decimal(10,2) NOT NULL COMMENT '订单总金额的最小值', `order_weight_min` int(11) NOT NULL COMMENT '订单总重量的最小值', `order_has_sku` varchar(255) NOT NULL DEFAULT '' COMMENT '指定sku', `order_weight_max` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单总重量最大值', `order_country` varchar(255) NOT NULL COMMENT '目的地国家', `order_source_shipping_method` varchar(255) NOT NULL DEFAULT '' COMMENT '平台下单时用户选择的物流方式', `warehouse_id` varchar(255) NOT NULL COMMENT '分配的仓库', `carrier_code` varchar(255) NOT NULL DEFAULT '' COMMENT '关联物流商code', `shipping_method_code` varchar(255) NOT NULL DEFAULT '' COMMENT '物流方式编码', `rule_name` varchar(255) DEFAULT NULL COMMENT '规则名称', `weights` varchar(255) DEFAULT NULL COMMENT '权重', `is_active` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否开启0:未开启1:开启', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`), KEY `idx_sousite` (`is_active`,`order_source`,`order_source_site_id`,`order_selleruserid`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='物流方式自动匹配规则' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `operation_log` -- CREATE TABLE IF NOT EXISTS `operation_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `log_key` varchar(45) NOT NULL DEFAULT '' COMMENT '操作对象的实体唯一标识\n采购单号,产品sku等', `log_type` enum('purchase','stock_change','product','finance','warehouse','supplier','stock_take','delivery','order','tracking') NOT NULL COMMENT '采购单,库存变动 等日志的类型', `log_operation` varchar(45) NOT NULL DEFAULT '' COMMENT '具体操作的类型', `capture_user_name` varchar(50) NOT NULL DEFAULT '0' COMMENT '操作者的名称', `update_time` timestamp NULL DEFAULT NULL COMMENT '操作时间', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', PRIMARY KEY (`id`), KEY `index2` (`log_key`,`log_type`), KEY `index3` (`capture_user_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='操作日志,for 仓储,采购,产品,财务4个模块使用' AUTO_INCREMENT=2 ; -- -------------------------------------------------------- -- -- Table structure for table `operation_log_v2` -- CREATE TABLE IF NOT EXISTS `operation_log_v2` ( `id` int(11) NOT NULL AUTO_INCREMENT, `log_key` varchar(45) NOT NULL DEFAULT '' COMMENT '操作对象的实体唯一标识\n采购单号,产品sku等', `log_type` enum('purchase','stock_change','product','finance','warehouse','supplier','stock_take','delivery','order','tracking') NOT NULL COMMENT '采购单,库存变动 等日志的类型', `log_operation` varchar(45) NOT NULL DEFAULT '' COMMENT '具体操作的类型', `capture_user_name` varchar(50) NOT NULL DEFAULT '0' COMMENT '操作者的名称', `update_time` timestamp NULL DEFAULT NULL COMMENT '操作时间', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', PRIMARY KEY (`id`), KEY `index2` (`log_key`,`log_type`), KEY `index3` (`capture_user_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='操作日志,for 仓储,采购,产品,财务4个模块使用' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pc_operation_log` -- CREATE TABLE IF NOT EXISTS `pc_operation_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `log_key` varchar(45) NOT NULL DEFAULT '' COMMENT '操作对象的实体唯一标识\n采购单号,产品sku等', `log_type` enum('purchase','stock_change','product','finance','warehouse','supplier','stock_take') NOT NULL COMMENT '采购单,库存变动 等日志的类型\n', `log_operation` varchar(45) NOT NULL DEFAULT '' COMMENT '具体操作的类型', `capture_user_id` smallint(6) NOT NULL DEFAULT '0' COMMENT '操作者的id', `update_time` timestamp NULL DEFAULT NULL COMMENT '操作时间', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', PRIMARY KEY (`id`), KEY `index2` (`log_key`,`log_type`), KEY `index3` (`capture_user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='操作日志,for 仓储,采购,产品,财务4个模块使用' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pc_purchase` -- CREATE TABLE IF NOT EXISTS `pc_purchase` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '采购单表ID', `purchase_order_id` varchar(255) DEFAULT '' COMMENT '系统生成的内部采购单号', `purchase_source_id` varchar(100) DEFAULT '' COMMENT '采购来源ID,如\n淘宝订单号:TB666986546354\n网易采购单:WY64985343456', `warehouse_id` tinyint(3) unsigned DEFAULT NULL COMMENT '仓库号', `supplier_id` smallint(5) unsigned DEFAULT NULL, `supplier_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'supplier Name snap shot', `status` tinyint(3) unsigned DEFAULT NULL COMMENT '状态\n\n1:等待到货\n2:货品在途\n3:部分到货等待剩余\n4:全部到货\n5:部分到货不等剩余', `delivery_method` tinyint(3) unsigned DEFAULT NULL COMMENT '递送方式编号', `delivery_number` varchar(30) NOT NULL DEFAULT '' COMMENT '递送追踪号', `delivery_fee` decimal(10,2) DEFAULT NULL COMMENT '递送费金额', `amount` decimal(10,2) DEFAULT NULL COMMENT '总金额', `amount_subtotal` decimal(10,2) DEFAULT NULL, `amount_refunded` decimal(10,2) DEFAULT NULL COMMENT '总退款金额', `payment_status` tinyint(3) unsigned DEFAULT NULL COMMENT '付款状态\n1:未付款\n2:已付款', `pay_date` timestamp NULL DEFAULT NULL COMMENT '支付日期', `payment_method` tinyint(3) unsigned DEFAULT NULL COMMENT '支付方式', `payment_record_id` int(11) unsigned DEFAULT NULL COMMENT '支付流水号', `is_refunded` char(1) NOT NULL DEFAULT '' COMMENT '是否退款了\n“Y”:yes\n“N”:No', `is_pending_check` char(1) NOT NULL DEFAULT '' COMMENT '是否等待质检\nY: 是,有到货记录等待质检\nN: 否', `expected_arrival_date` timestamp NULL DEFAULT NULL, `is_arrive_goods` char(1) NOT NULL DEFAULT '' COMMENT '是否到货了\n“Y”:yes\n“N”:No', `comment` text COMMENT '备注', `capture_user_name` varchar(50) NOT NULL DEFAULT '' COMMENT 'Capture User Name', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间 ', `reject_reason` varchar(255) DEFAULT NULL COMMENT '记录审核拒绝原因', `in_stock_comment` text COMMENT '入库备注', `order_id_1688` varchar(50) NULL DEFAULT '' COMMENT '1688订单号', `amount_1688` decimal(10,2) NULL DEFAULT 0 COMMENT '1688订单金额', `status_1688` varchar(50) NULL DEFAULT '' COMMENT '1688订单状态', `pay_url` varchar(255) NULL DEFAULT '' COMMENT '支付链接', `logistics_billNo` varchar(100) NULL DEFAULT '' COMMENT '1688物流运单号', `logistics_company_name` varchar(100) NULL DEFAULT '' COMMENT '1688物流公司名称', `logistics_status` varchar(50) NULL DEFAULT '' COMMENT '1688物流状态', `addi_info` text COMMENT '额外信息', PRIMARY KEY (`id`), KEY `index2` (`payment_method`), KEY `index3` (`status`), KEY `index4` (`purchase_order_id`), KEY `index5` (`purchase_source_id`), KEY `index6` (`supplier_id`), KEY `index7` (`payment_status`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购单的基本信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pc_purchase_arrivals` -- CREATE TABLE IF NOT EXISTS `pc_purchase_arrivals` ( `purchase_arrival_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '标识行', `purchase_arrival_name` varchar(45) DEFAULT NULL COMMENT 'Arrival name, system auto generated.\ne.g.: IN/0001', `purchase_id` int(11) NOT NULL DEFAULT '0' COMMENT '采购单表id', `status` tinyint(3) unsigned DEFAULT NULL COMMENT '状态\n1: 待质检\n2:已质检待入库\n3:已入库', `is_rejected` char(1) NOT NULL DEFAULT '' COMMENT '是否退款/退货了\n“Y”:yes\n“N”:No', `is_pending_check` char(1) NOT NULL DEFAULT '' COMMENT '是否等待质检\n“Y”:yes\n“N”:No', `addi_info` varchar(255) NOT NULL DEFAULT '' COMMENT '额外信息json格式\n额外的附加信息,使用json格式记录', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `capture_user_id` tinyint(3) unsigned DEFAULT NULL COMMENT 'Capture User ID', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间 ', PRIMARY KEY (`purchase_arrival_id`), KEY `index2` (`purchase_id`), KEY `index3` (`purchase_arrival_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购单到货信息,包含了相应的质检信息,入库信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pc_purchase_arrival_detail` -- CREATE TABLE IF NOT EXISTS `pc_purchase_arrival_detail` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `purchase_arrival_id` int(11) unsigned NOT NULL COMMENT '标识行', `sku` varchar(255) NOT NULL DEFAULT '' COMMENT '产品SKU号', `qty` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '数量', `qty_passed` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '良品数量', `qty_defect` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '次品数量', `check_comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `check_user_id` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Capture User ID', `check_time` timestamp NULL DEFAULT NULL COMMENT '质检时间', `stock_in_id` varchar(255) NOT NULL DEFAULT '' COMMENT '入库单号,如果有多个,则保存为 "," 逗号分隔的形式,例如\n"aaaaa11,bbbb22,bbbb33"', `stock_in_qty` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '已入库数量', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购单到货信息,包含了相应的质检信息,入库信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pc_purchase_arrival_reject` -- CREATE TABLE IF NOT EXISTS `pc_purchase_arrival_reject` ( `arrival_reject_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '标识行', `purchase_arrival_id` int(11) DEFAULT NULL COMMENT '到货编号', `total_amount` decimal(10,2) NOT NULL COMMENT '退回的货款', `addi_info` varchar(255) NOT NULL DEFAULT '' COMMENT '额外信息json格式\n额外的附加信息,使用json格式记录', `capture_user_id` tinyint(3) unsigned DEFAULT NULL COMMENT 'Capture User ID', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`arrival_reject_id`), KEY `index2` (`purchase_arrival_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购单退货/退款表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pc_purchase_arrival_reject_detail` -- CREATE TABLE IF NOT EXISTS `pc_purchase_arrival_reject_detail` ( `id` int(11) NOT NULL AUTO_INCREMENT, `arrival_reject_id` varchar(45) NOT NULL DEFAULT '' COMMENT '到货记录退货记录号', `sku` varchar(250) NOT NULL DEFAULT '' COMMENT '产品SKU', `qty` int(11) DEFAULT '0' COMMENT '退货数量', `amount` decimal(10,2) DEFAULT '0.00' COMMENT '退货金额', `reject_type` char(2) NOT NULL DEFAULT '' COMMENT '退货明细类型,如产品SKU或者运费\n或者产品价格补偿等', `comment` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `index2` (`arrival_reject_id`,`sku`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购单退货明细' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pc_purchase_items` -- CREATE TABLE IF NOT EXISTS `pc_purchase_items` ( `purchase_item_id` int(11) NOT NULL AUTO_INCREMENT, `purchase_id` int(11) NOT NULL DEFAULT '0' COMMENT '采购单表id', `sku` varchar(255) NOT NULL DEFAULT '' COMMENT '仓库号', `name` varchar(255) NOT NULL DEFAULT '' COMMENT '产品名称快照', `supplier_id` tinyint(3) unsigned DEFAULT NULL COMMENT '供应商编号', `supplier_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'supplier Name snap shot', `price` decimal(10,2) DEFAULT NULL COMMENT '单价', `qty` int(8) unsigned DEFAULT NULL COMMENT '数量', `amount` decimal(10,2) DEFAULT NULL COMMENT '总金额', `addi_info` varchar(255) NOT NULL DEFAULT '' COMMENT '额外信息json格式\n额外的附加信息,使用json格式记录', `remark` varchar(255) DEFAULT '' COMMENT '备注', `in_stock_qty` int(8) not null default 0 COMMENT '本次入库数量', `product_id` varchar(50) NOT NULL COMMENT '1688商品product_id', `spec_id` varchar(50) NOT NULL COMMENT '1688商品规格Id', `qty_1688` int(11) NULL DEFAULT 0 COMMENT '1688数量', PRIMARY KEY (`purchase_item_id`), KEY `index2` (`purchase_id`), KEY `index3` (`sku`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购单所包含的产品' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pc_purchase_status_history` -- CREATE TABLE IF NOT EXISTS `pc_purchase_status_history` ( `id` int(11) NOT NULL AUTO_INCREMENT, `purchase_id` varchar(45) NOT NULL DEFAULT '' COMMENT '采购单号', `status` smallint(6) NOT NULL DEFAULT '0' COMMENT '采购单状态', `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `capture_user_id` smallint(6) NOT NULL DEFAULT '0' COMMENT '修改者id', PRIMARY KEY (`id`), KEY `purchaseid` (`purchase_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购单状态变化历史' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pc_purchase_suggestion` -- CREATE TABLE IF NOT EXISTS `pc_purchase_suggestion` ( `sku` varchar(255) NOT NULL, `pending_purchase_ship_qty` int(11) NOT NULL DEFAULT '0' COMMENT '待采购发货数量', `pending_stock_qty` int(11) NOT NULL DEFAULT '0' COMMENT '建议备货数量', `create_time` timestamp NULL DEFAULT NULL COMMENT '生成时间', PRIMARY KEY (`sku`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='采购建议'; -- -------------------------------------------------------- -- -- Table structure for table `pc_shipping_mode` -- CREATE TABLE IF NOT EXISTS `pc_shipping_mode` ( `shipping_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '采购运送方式编码', `shipping_name` varchar(100) NOT NULL DEFAULT '' COMMENT '采购运送方式', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `addi_info` varchar(255) NOT NULL DEFAULT '' COMMENT '额外信息json格式', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间', `capture_user` smallint(5) unsigned NOT NULL COMMENT '最后录入操作员', PRIMARY KEY (`shipping_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购递送方式' AUTO_INCREMENT=6 ; -- -- Dumping data for table `pc_shipping_mode` -- INSERT INTO `pc_shipping_mode` (`shipping_id`, `shipping_name`, `comment`, `addi_info`, `create_time`, `capture_user`) VALUES (0, '(未定义)', '', '', '2014-09-23 05:37:58', 0), (1, '自提', '', '', '2014-01-23 05:18:11', 0), (2, '顺丰', '', '', '2014-01-23 05:18:11', 0), (3, '圆通', '', '', '2014-01-23 05:18:53', 1), (4, 'ems', '', '', '2014-01-23 05:19:44', 1), (5, '申通', '', '', '2014-05-15 03:30:54', 0); -- -------------------------------------------------------- -- -- Table structure for table `pd_attributes` -- CREATE TABLE IF NOT EXISTS `pd_attributes` ( `attribute_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '属性id', `name` varchar(45) NOT NULL DEFAULT '' COMMENT '属性名称', `use_count` smallint(5) unsigned NOT NULL, `values` varchar(255) NOT NULL DEFAULT '' COMMENT '可能的值,json格式记录前20个常用值', PRIMARY KEY (`attribute_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='记录自定义产品属性以及该属性的 top 20常用值' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_brand` -- CREATE TABLE IF NOT EXISTS `pd_brand` ( `brand_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL DEFAULT '', `addi_info` varchar(255) NOT NULL DEFAULT '' COMMENT '额外的附加信息,使用json格式记录', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `capture_user_id` tinyint(3) unsigned DEFAULT NULL COMMENT 'Capture User ID', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间 ', PRIMARY KEY (`brand_id`), KEY `index2` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品的品牌信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_category` -- CREATE TABLE IF NOT EXISTS `pd_category` ( `category_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL DEFAULT '' COMMENT '目录名称', `parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '父级目录ID', `level` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '目录级别根目录=1 级,后续的是2级类推', `has_children` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否有下级目录', `addi_info` varchar(255) NOT NULL DEFAULT '' COMMENT '额外信息json格式\n\n额外的附加信息,使用json格式记录', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `capture_user_id` tinyint(3) unsigned DEFAULT NULL COMMENT 'Capture User ID', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间 ', PRIMARY KEY (`category_id`), KEY `index2` (`name`), KEY `index3` (`parent_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分类目录' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_photo` -- CREATE TABLE IF NOT EXISTS `pd_photo` ( `id` int(11) NOT NULL AUTO_INCREMENT, `sku` varchar(255) NOT NULL COMMENT '产品的sku', `priority` smallint(6) NOT NULL DEFAULT '0', `photo_scale` char(2) NOT NULL COMMENT '图片规模:\nTN:Thumbnail\nSM:Small\nLG:Large\nOR:Original', `file_name` varchar(255) NOT NULL DEFAULT '' COMMENT '上传的图片文件名', `photo_url` varchar(455) NOT NULL DEFAULT '' COMMENT '图片存储路径或者文件名', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品图片信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_product` -- CREATE TABLE IF NOT EXISTS `pd_product` ( `sku` varchar(255) NOT NULL COMMENT 'SKU 别名', `is_has_alias` char(1) NOT NULL DEFAULT '' COMMENT 'SKU 别名\n是否有Alias SKU\n“Y”:yes\n“N”:No', `name` varchar(255) NOT NULL DEFAULT '', `type` char(1) NOT NULL DEFAULT '' COMMENT '产品类型\n\n“S”-普通\n“C”-变参\n“B”-捆绑', `status` char(2) NOT NULL DEFAULT '' COMMENT '“OS”:on sale\n“RN”:running out\n“DR”:dropped\n“AC”:archived\n“RS”:re-onsale', `prod_name_ch` varchar(255) NOT NULL DEFAULT '' COMMENT '产品中文名称', `prod_name_en` varchar(255) NOT NULL DEFAULT '' COMMENT '产品英文名称', `declaration_ch` varchar(100) NOT NULL DEFAULT '' COMMENT '中文报关名称', `declaration_en` varchar(100) NOT NULL DEFAULT '' COMMENT '英文报关名称', `declaration_value_currency` varchar(3) DEFAULT 'USD' COMMENT '海关申报价值 货币\n默认USD', `declaration_value` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '海关申报价值 金额', `declaration_code` varchar(50) DEFAULT NULL COMMENT '报关编码', `battery` varchar(1) NOT NULL DEFAULT 'N' COMMENT '产品是否有锂电池:Y/N', `category_id` tinyint(3) unsigned DEFAULT NULL COMMENT '所属目录编号', `brand_id` smallint(5) unsigned NOT NULL COMMENT '品牌id', `is_has_tag` char(1) NOT NULL DEFAULT '' COMMENT '是否有标签\n\n“Y”:yes\n“N”:No', `purchase_by` int(11) unsigned NOT NULL COMMENT '默认采购员id', `purchase_link` text COMMENT '采购链接', `prod_weight` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '重量(克)', `prod_width` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '宽(cm)', `prod_length` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '长(cm)', `prod_height` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '高(cm)', `other_attributes` varchar(255) NOT NULL DEFAULT '' COMMENT '额外属性集\n\nsample data structure:\n“size:L color:red”', `photo_primary` varchar(455) NOT NULL DEFAULT '' COMMENT '主图片缩略图 file name', `supplier_id` int(11) NOT NULL DEFAULT '0' COMMENT '首选供应商编码是冗余,便于查询(已废除)', `purchase_price` decimal(10,2) NULL DEFAULT NULL COMMENT '供应商采购价,便于统计利润', `check_standard` text COMMENT '质检标准', `comment` text COMMENT '备注', `capture_user_id` int(10) unsigned DEFAULT NULL COMMENT 'Capture User ID', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间 ', `total_stockage` int(11) NOT NULL DEFAULT '0' COMMENT '所有仓库存总存量', `pending_ship_qty` int(11) NOT NULL DEFAULT '0' COMMENT '总待发货数量', `create_source` varchar(100) DEFAULT NULL COMMENT '商品来源网站(DSP=分销,ebay,amz=亚马逊)', `product_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '商品唯一码', `additional_cost` decimal(8,2) NULL DEFAULT NULL COMMENT '其他成本', `addi_info` text NULL DEFAULT NULL COMMENT '额外信息', `class_id` int(8) NOT NULL default 0 COMMENT '分类Id', PRIMARY KEY (`sku`), UNIQUE KEY `product_id` (`product_id`), KEY `category` (`category_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品基础信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_product_aliases` -- CREATE TABLE IF NOT EXISTS `pd_product_aliases` ( `product_alias_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '记录编号', `sku` varchar(255) NOT NULL DEFAULT '', `alias_sku` varchar(255) NOT NULL DEFAULT '' COMMENT '别名的SKU', `pack` int(11) DEFAULT '1' COMMENT 'alias 代表每次卖出的数量(x,例如2个装,10个装)', `forsite` varchar(50) DEFAULT NULL COMMENT '该alias 专门属于某个site的使用', `platform` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '平台', `selleruserid` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '店铺id', `comment` text NOT NULL COMMENT '备注', PRIMARY KEY (`product_alias_id`), UNIQUE KEY `alias_platform` (`alias_sku`, `platform`, `selleruserid`), KEY `index3` (`alias_sku`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品和别名的对应信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_product_bundle_relationship` -- CREATE TABLE IF NOT EXISTS `pd_product_bundle_relationship` ( `id` int(50) NOT NULL AUTO_INCREMENT COMMENT '自增ID', `bdsku` varchar(250) NOT NULL COMMENT '捆绑产品sku', `assku` varchar(250) NOT NULL COMMENT '捆绑产品的子产品sku', `qty` int(50) NOT NULL COMMENT '套餐中的数量', `create_date` datetime NOT NULL COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_product_config_relationship` -- CREATE TABLE IF NOT EXISTS `pd_product_config_relationship` ( `id` int(11) NOT NULL AUTO_INCREMENT, `cfsku` varchar(255) NOT NULL COMMENT '变参父产品SKU', `assku` varchar(255) NOT NULL COMMENT '变参子产品SKU', `config_field_ids` text NOT NULL COMMENT '这个变参产品和子产品之间的 变参参数id,用逗号隔开多个', `create_date` datetime DEFAULT NULL COMMENT '这个记录的创建日期', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='变参产品的父产品和子产品的关系' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_product_field` -- CREATE TABLE IF NOT EXISTS `pd_product_field` ( `id` int(11) NOT NULL AUTO_INCREMENT, `field_name` varchar(245) NOT NULL COMMENT '属性中文名称', `field_name_eng` varchar(245) NOT NULL COMMENT '属性英文名称', `field_name_frc` varchar(245) NOT NULL COMMENT '属性法文名称', `field_name_ger` varchar(245) NOT NULL COMMENT '属性德文名称', `use_freq` int(11) DEFAULT '0' COMMENT '使用频率(次数)', PRIMARY KEY (`id`), UNIQUE KEY `index2` (`field_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品属性用到的field自定义' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_product_field_value` -- CREATE TABLE IF NOT EXISTS `pd_product_field_value` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '属性值的ID', `field_id` int(11) NOT NULL DEFAULT '0' COMMENT '属性ID', `value` varchar(245) NOT NULL COMMENT '属性值', `use_freq` int(11) NOT NULL DEFAULT '0' COMMENT '使用频率(次数)', PRIMARY KEY (`id`), KEY `index2` (`field_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品自定义属性的属性可能值' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_product_suppliers` -- CREATE TABLE IF NOT EXISTS `pd_product_suppliers` ( `product_supplier_id` int(11) NOT NULL AUTO_INCREMENT, `sku` varchar(250) NOT NULL DEFAULT '', `supplier_id` int(10) unsigned DEFAULT NULL COMMENT '供应商编码', `priority` tinyint(3) unsigned DEFAULT NULL COMMENT '优先级\n\n0:首选, 1-4 备选', `purchase_price` decimal(10,2) DEFAULT NULL COMMENT '供应商采购价格', `purchase_link` VARCHAR(255) NULL DEFAULT NULL COMMENT '采购链接', PRIMARY KEY (`product_supplier_id`), UNIQUE KEY `index2` (`sku`,`supplier_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='供应商和产品的对应信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_product_tags` -- CREATE TABLE IF NOT EXISTS `pd_product_tags` ( `product_tag_id` int(11) NOT NULL AUTO_INCREMENT, `sku` varchar(250) NOT NULL DEFAULT '', `tag_id` int(11) unsigned DEFAULT NULL COMMENT '标签编号', PRIMARY KEY (`product_tag_id`), UNIQUE KEY `index2` (`sku`,`product_tag_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品和标签的对应信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `pd_supplier` -- CREATE TABLE IF NOT EXISTS `pd_supplier` ( `supplier_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL DEFAULT '', `address_nation` char(2) NOT NULL DEFAULT '' COMMENT 'e.g. CN,UK', `address_state` varchar(100) NOT NULL DEFAULT '' COMMENT 'e.g. 广东省', `address_city` varchar(100) NOT NULL DEFAULT '' COMMENT 'e.g. 中山市', `address_street` varchar(255) NOT NULL DEFAULT '', `url` text, `post_code` varchar(45) NOT NULL DEFAULT '' COMMENT '邮编', `phone_number` varchar(100) NOT NULL DEFAULT '' COMMENT '固话号码', `fax_number` varchar(100) NOT NULL DEFAULT '', `contact_name` varchar(45) NOT NULL DEFAULT '' COMMENT '联系人名字', `mobile_number` varchar(100) NOT NULL DEFAULT '', `qq` varchar(100) NOT NULL DEFAULT '', `ali_wanwan` varchar(100) NOT NULL DEFAULT '', `msn` varchar(100) NOT NULL DEFAULT '', `email` varchar(100) NOT NULL DEFAULT '' COMMENT 'email address', `status` tinyint(1) unsigned DEFAULT NULL COMMENT '1:active\n2:inactive', `account_settle_mode` tinyint(3) unsigned DEFAULT NULL COMMENT '结算方式\n\n1-月结\n2-付款后发货\n3-到货后付款', `payment_mode` varchar(100) NOT NULL DEFAULT '' COMMENT '支付方式\n\n例如:\n工商银行\n支付宝\npaypal', `payment_account` varchar(100) NOT NULL DEFAULT '' COMMENT '支付账号\ne.g. 9011564878564521', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `capture_user_id` tinyint(3) unsigned DEFAULT NULL COMMENT 'Capture User ID', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间 ', `is_disable` tinyint(1) NOT NULL DEFAULT '0', `al1688_user_id` int(11) NULL DEFAULT 0 COMMENT '1688店铺id', `al1688_company_name` varchar(255) NULL DEFAULT '' COMMENT '1688店铺名称', `al1688_url` varchar(255) NULL DEFAULT '' COMMENT '1688店铺链接', PRIMARY KEY (`supplier_id`), KEY `index2` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='供应商基础信息' AUTO_INCREMENT=2 ; -- -- Dumping data for table `pd_supplier` -- INSERT INTO `pd_supplier` (`supplier_id`, `name`, `address_nation`, `address_state`, `address_city`, `address_street`, `post_code`, `phone_number`, `fax_number`, `contact_name`, `mobile_number`, `qq`, `ali_wanwan`, `msn`, `email`, `status`, `account_settle_mode`, `payment_mode`, `payment_account`, `comment`, `capture_user_id`, `create_time`, `update_time`, `is_disable`) VALUES (1, '(无)', '', '', '', '', '', '', '', '', '', '', '', '', '', 1, NULL, '', '', '', NULL, NULL, NULL, 0); -- -------------------------------------------------------- -- -- Table structure for table `pd_tag` -- CREATE TABLE IF NOT EXISTS `pd_tag` ( `tag_id` int(11) NOT NULL AUTO_INCREMENT, `tag_name` varchar(100) NOT NULL DEFAULT '', PRIMARY KEY (`tag_id`), KEY `index2` (`tag_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='标签定义' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `queue_shippedorder_errors` -- CREATE TABLE IF NOT EXISTS `queue_shippedorder_errors` ( `id` int(10) NOT NULL AUTO_INCREMENT, `order_id` int(10) NOT NULL COMMENT '订单号', `osid` int(10) NOT NULL COMMENT 'od_order_shipped主键', `order_source` varchar(50) DEFAULT '' COMMENT '订单来源 ebay,amazon,aliexpress,custom', `order_source_order_id` varchar(50) DEFAULT '' COMMENT '订单来源 的订单id', `selleruserid` varchar(80) NOT NULL COMMENT '卖家账号', `tracking_number` varchar(50) NOT NULL DEFAULT '' COMMENT '发货单号', `tracking_link` varchar(100) NOT NULL DEFAULT '' COMMENT '跟踪号查询网址', `shipping_method_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流方式code', `status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '订单标记发货状态,0:未处理,1:成功,2:失败', `result` varchar(20) DEFAULT NULL COMMENT '执行成功标记', `errors` varchar(255) NOT NULL DEFAULT '' COMMENT '返回错误信息', `created` int(10) DEFAULT NULL, `updated` int(10) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `sys_address` -- CREATE TABLE IF NOT EXISTS `sys_address` ( `id` int(5) unsigned NOT NULL AUTO_INCREMENT, `address_name` varchar(100) NOT NULL, `type` varchar(20) NOT NULL, `country_code` varchar(10) NOT NULL, `country` varchar(100) NOT NULL, `country_en` varchar(100) NOT NULL, `province_code` varchar(10) NOT NULL, `province` varchar(50) NOT NULL, `province_en` varchar(50) NOT NULL, `city` varchar(50) NOT NULL, `city_en` varchar(50) NOT NULL, `district` varchar(50) DEFAULT NULL, `district_en` varchar(50) DEFAULT NULL, `county` varchar(50) DEFAULT NULL, `county_en` varchar(50) DEFAULT NULL, `address` varchar(225) DEFAULT NULL, `address_en` varchar(225) DEFAULT NULL, `zip_code` varchar(20) DEFAULT NULL, `company` varchar(100) DEFAULT NULL, `company_en` varchar(100) DEFAULT NULL, `connect` varchar(100) NOT NULL, `connect_en` varchar(100) NOT NULL, `phone` varchar(50) DEFAULT NULL, `mobile` varchar(50) DEFAULT NULL, `email` varchar(100) DEFAULT NULL, `fax` varchar(50) DEFAULT NULL, `carete_time` int(11) DEFAULT NULL, `update_time` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `sys_carrier_account` -- CREATE TABLE IF NOT EXISTS `sys_carrier_account` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `carrier_code` varchar(50) NOT NULL COMMENT '物流商代码', `carrier_name` varchar(100) NOT NULL COMMENT '物流商名', `carrier_type` tinyint(1) unsigned NOT NULL COMMENT '0:国内物流商 1:海外物流商', `api_params` text COMMENT '物流商认证参数', `create_time` int(11) unsigned DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned DEFAULT '0' COMMENT '更新时间', `user_id` int(11) unsigned NOT NULL COMMENT '用户id', `is_used` tinyint(1) DEFAULT '0' COMMENT '是否启用 0 不启用 1 启用', `address` text COMMENT '发货地址,揽货地址,退货地址 数组', `warehouse` text, `is_default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:不为默认 1:设置为默认', `is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:未删除 1:已删除', `warehouse_id` int(11) DEFAULT '-1' COMMENT '海外仓用于记录属于哪个仓库ID 默认值为-1是因为仓库那边存在为0的仓库', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='物流商帐号表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `sys_carrier_custom` -- CREATE TABLE IF NOT EXISTS `sys_carrier_custom` ( `carrier_code` int(5) NOT NULL AUTO_INCREMENT, `carrier_name` varchar(100) NOT NULL COMMENT '自定义物流商名称', `carrier_type` tinyint(1) DEFAULT '0' COMMENT '自定义物流商类型 0:无数据交互 1:Excel导数据', `address_list` varchar(200) DEFAULT NULL COMMENT '地址列表', `create_time` int(11) DEFAULT NULL, `update_time` int(11) DEFAULT NULL, `is_used` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:未启用 1:已启用', `excel_mode` varchar(50) DEFAULT '' COMMENT 'Excel导出模式', `excel_format` text COMMENT 'Excel导出格式', `warehouse_id` int(11) default -1 COMMENT '用于记录该自定义物流关联的仓库ID', PRIMARY KEY (`carrier_code`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `sys_invoke_jrn` -- CREATE TABLE IF NOT EXISTS `sys_invoke_jrn` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'journal id', `create_time` datetime DEFAULT NULL, `process_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'process id, if the invoke is by a same php thread. they will share a same job id\nSo that we can know the serial func invokings are for a same process / user operation', `module` enum('Amazon','Catalog','Customer','Delivery','Finance','Inventory','Order','Permission','Platform','Purchase','Report','Ticket') NOT NULL COMMENT 'module name,\nsupported values are:\n''Catalog'',''Customer'',''Delivery'',''Finance'',''Inventory'',''Order'',''Permission'',''Platform'',''Purchase'',''Report'',''Ticket''', `class` varchar(145) NOT NULL DEFAULT '' COMMENT 'class being called', `function` varchar(145) NOT NULL DEFAULT '' COMMENT 'the function name called?', `param_1` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_2` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_3` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_4` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_5` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_6` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_7` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_8` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_9` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_10` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `return_code` text NOT NULL, PRIMARY KEY (`id`), KEY `ind1` (`process_id`), KEY `ind2` (`function`), KEY `index4` (`create_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `sys_log` -- CREATE TABLE IF NOT EXISTS `sys_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL COMMENT 'log 创建的时间', `job_no` varchar(145) NOT NULL DEFAULT '' COMMENT 'job 或者 batch id', `job_type` enum('Batch','Online','Background') NOT NULL COMMENT 'log 的产生的job 的类型\nBatch,Background,Online\n', `log_type` enum('Info','Error','Debug','Trace') NOT NULL COMMENT 'log 的级别,\n''Info'',''Error'',''Debug'',''Trace''', `module` enum('Catalog','Customer','Delivery','Finance','Inventory','Order','Permission','Platform','Purchase','Report','Ticket','Amazon') NOT NULL COMMENT 'module name,\nsupported values are:\n''Catalog'',''Customer'',''Delivery'',''Finance'',''Inventory'',''Order'',''Permission'',''Platform'',''Purchase'',''Report'',''Ticket''', `class` varchar(45) NOT NULL DEFAULT '' COMMENT 'class name', `function` varchar(45) NOT NULL DEFAULT '' COMMENT 'function name', `tag` varchar(45) NOT NULL DEFAULT '' COMMENT 'tag name', `remark` varchar(255) NOT NULL DEFAULT '' COMMENT 'remark,message of logged detail', PRIMARY KEY (`id`), KEY `11` (`create_time`), KEY `2` (`job_no`), KEY `3` (`module`,`class`,`function`), KEY `index5` (`tag`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统Online操作,batch job运行,background job 运行的log 写入' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `sys_relationship` -- CREATE TABLE IF NOT EXISTS `sys_relationship` ( `id` int(11) NOT NULL AUTO_INCREMENT, `entity_1_type` enum('Purchase_order','Purchase_arrival','Finance_transaction','Stock_change','Purchase_refund','Order','Order_refund','Order_invoice') NOT NULL COMMENT '关系中的第一个数据实体类型,可选择以下值\n''Purchase_order'',''Purchase_arrival'',''Finance_transaction'',''Stock_change'',''Purchase_refund'',''Order'',''Order_refund'',''Order_invoice''', `entity_1_id` varchar(145) NOT NULL COMMENT '关系中的第一个数据实体 key id', `entity_2_type` enum('Purchase_order','Purchase_arrival','Finance_transaction','Stock_change','Purchase_refund','Order','Order_refund','Order_invoice') NOT NULL COMMENT '关系中的第2个数据实体类型', `entity_2_id` varchar(145) NOT NULL COMMENT '关系中的第2个数据实体 key id', PRIMARY KEY (`id`), KEY `index2` (`entity_1_id`,`entity_1_type`), KEY `index3` (`entity_2_id`,`entity_2_type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `sys_set` -- CREATE TABLE IF NOT EXISTS `sys_set` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `set_key` varchar(50) NOT NULL DEFAULT '' COMMENT '配置名称key', `set_value` varchar(255) NOT NULL DEFAULT '' COMMENT '配置名称', `is_active` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否启用0:否 1:是', PRIMARY KEY (`id`), UNIQUE KEY `set_key` (`set_key`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统设置表' AUTO_INCREMENT=4 ; -- -- Dumping data for table `sys_set` -- INSERT INTO `sys_set` (`id`, `set_key`, `set_value`, `is_active`) VALUES (2, 'autoShipOrder', '自动标记发货', 1), (3, 'autoReviseInventory', '自动补数量(卖多少补多少,无视真实库存)', 0); -- -------------------------------------------------------- -- -- Table structure for table `sys_shipping_service` -- CREATE TABLE IF NOT EXISTS `sys_shipping_service` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `carrier_code` varchar(100) NOT NULL COMMENT '物流商代码', `carrier_params` text COMMENT '参数键值对', `ship_address` varchar(500) DEFAULT '' COMMENT '发货地址', `return_address` varchar(500) DEFAULT '' COMMENT '退货地址', `is_used` tinyint(1) unsigned NOT NULL COMMENT '是否使用 0 不启用 1 启用', `service_name` varchar(255) NOT NULL COMMENT '服务名称', `service_code` text COMMENT '平台服务代码', `auto_ship` tinyint(1) DEFAULT '0' COMMENT '自动发货 0 不启用 1 启用', `web` varchar(255) DEFAULT '' COMMENT '查询网址', `create_time` int(11) unsigned DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned DEFAULT '0' COMMENT '更新时间', `carrier_account_id` int(11) DEFAULT '0' COMMENT '物流商帐号id', `extra_carrier` varchar(20) DEFAULT '' COMMENT '只有ebay亚太平台需要填写 TNT FedEx Bpost(MINIPAK TRAKPAK) CNPOST', `carrier_name` varchar(100) DEFAULT NULL COMMENT '物流商名', `shipping_method_name` varchar(255) DEFAULT NULL COMMENT '物流商运输服务名', `shipping_method_code` varchar(100) DEFAULT NULL COMMENT '物流商运输服务代码', `third_party_code` varchar(100) DEFAULT NULL COMMENT '第三方仓库代码', `warehouse_name` varchar(100) DEFAULT NULL COMMENT '海外仓仓库名', `address` text COMMENT '地址信息', `is_custom` tinyint(1) unsigned DEFAULT '0' COMMENT '是否自定义物流服务 0 不是 1 是', `custom_template_print` varchar(255) DEFAULT NULL, `print_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '打印设置 0:API获取标签 1:小老板高仿标签 2:自定义标签', `print_params` text COMMENT '打印设置 参数', `transport_service_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '运输服务类型 0:经济 1:标准 2:特快', `aging` varchar(10) NOT NULL DEFAULT '' COMMENT '时效', `is_tracking_number` tinyint(1) NOT NULL DEFAULT '0' COMMENT '有无跟踪号 0:没有 1:有', `proprietary_warehouse` text COMMENT '自营仓库设置 数组', `declaration_max_value` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '最大报关价值', `declaration_max_currency` varchar(10) NOT NULL DEFAULT 'USD' COMMENT '最大报关币种', `declaration_max_weight` decimal(10,4) unsigned NOT NULL DEFAULT '0.0000' COMMENT '最高报关重量', `customer_number_config` text COMMENT '客户参考号配置 数组', `is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:未删除 1:已删除', `common_address_id` int(11) NOT NULL DEFAULT '0' COMMENT '常用地址id 当为0时取默认', `is_copy` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:原始生成数据 1:复制生成数据', `tracking_upload_config` text default '' COMMENT '跟踪号上传模式,暂时只支持amazon/ebay这两个平台,其它平台需要调研才行', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='运输服务表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `sys_tracking_number` -- CREATE TABLE IF NOT EXISTS `sys_tracking_number` ( `id` int(11) NOT NULL AUTO_INCREMENT, `shipping_service_id` int(10) NOT NULL COMMENT '运输服务id', `service_name` varchar(255) DEFAULT NULL COMMENT '运输服务名', `tracking_number` varchar(50) NOT NULL COMMENT '物流号', `is_used` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否被分配,使用状态', `order_id` int(11) DEFAULT NULL COMMENT '小老板订单号', `use_time` int(11) DEFAULT NULL COMMENT '分配时间 使用时间', `user_name` varchar(50) DEFAULT NULL COMMENT '创建人', `operator` varchar(50) DEFAULT NULL COMMENT '操作人', `create_time` int(11) DEFAULT NULL COMMENT '创建时间', `update_time` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `shipping_service_id` (`shipping_service_id`), KEY `is_used` (`is_used`), KEY `tracking_number` (`tracking_number`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `usertab` -- CREATE TABLE IF NOT EXISTS `usertab` ( `id` int(10) NOT NULL AUTO_INCREMENT, `uid` int(6) NOT NULL COMMENT '创建或修改者uid', `tabname` varchar(128) NOT NULL COMMENT '标签名', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `user_app_info` -- CREATE TABLE IF NOT EXISTS `user_app_info` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL COMMENT 'app名称', `key` varchar(50) NOT NULL COMMENT 'app的标示名---如 purchase', `is_active` char(1) NOT NULL COMMENT 'Y或者N。该app是否已经启用。Y表示启用', `install_time` datetime NOT NULL COMMENT '该app的安装时间', `update_time` datetime DEFAULT NULL COMMENT '状态更新时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='该用户安装了哪些app' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `user_config` -- CREATE TABLE IF NOT EXISTS `user_config` ( `keyid` varchar(255) NOT NULL COMMENT '用户配置key', `value` text COMMENT '用户配置value', `type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '类型', `create_time` int(11) unsigned NOT NULL DEFAULT '0', `update_time` int(11) unsigned NOT NULL DEFAULT '0', `description` varchar(255) NOT NULL COMMENT '数据描述', PRIMARY KEY (`keyid`), KEY `idx_type` (`type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户表全局性的配置'; -- -- Dumping data for table `user_config` -- INSERT INTO `user_config` (`keyid`, `value`, `type`, `create_time`, `update_time`, `description`) VALUES ('myaccounts_areacode', NULL, 0, 0, 0, '手机区号'), ('myaccounts_company', NULL, 0, 0, 0, '公司名'), ('myaccounts_mobile', NULL, 0, 0, 0, '用户手机号'), ('myaccounts_postcode', NULL, 0, 0, 0, '邮政编码'), ('myaccounts_telephone', NULL, 0, 0, 0, '电话号码'), ('telephone_ext_number', NULL, 0, 0, 0, '分机号'), ('user_city', NULL, 0, 0, 0, '用户所在市'), ('user_country', NULL, 0, 0, 0, '用户所在国家'), ('user_district', NULL, 0, 0, 0, '用户所在区县'), ('user_province', NULL, 0, 0, 0, '用户所在省'), ('user_street', NULL, 0, 0, 0, '街道地址'); -- -------------------------------------------------------- -- -- Table structure for table `ut_config_data` -- CREATE TABLE IF NOT EXISTS `ut_config_data` ( `id` int(11) NOT NULL AUTO_INCREMENT, `path` varchar(255) NOT NULL COMMENT '命名规则 modulename/configname', `value` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; -- -------------------------------------------------------- -- -- Table structure for table `ut_sys_invoke_jrn` -- CREATE TABLE IF NOT EXISTS `ut_sys_invoke_jrn` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'journal id', `create_time` datetime DEFAULT NULL, `process_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'process id, if the invoke is by a same php thread. they will share a same job id\nSo that we can know the serial func invokings are for a same process / user operation', `module` enum('Amazon','Catalog','Customer','Delivery','Finance','Inventory','Order','Permission','Platform','Purchase','Report','Ticket') NOT NULL COMMENT 'module name,\nsupported values are:\n''Catalog'',''Customer'',''Delivery'',''Finance'',''Inventory'',''Order'',''Permission'',''Platform'',''Purchase'',''Report'',''Ticket''', `class` varchar(145) NOT NULL DEFAULT '' COMMENT 'class being called', `function` varchar(145) NOT NULL DEFAULT '' COMMENT 'the function name called?', `param_1` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_2` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_3` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_4` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_5` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_6` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_7` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_8` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_9` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `param_10` text NOT NULL COMMENT 'parameters being called, in Jason format if it is passed as array', `return_code` text NOT NULL, PRIMARY KEY (`id`), KEY `ind1` (`process_id`), KEY `ind2` (`function`), KEY `index4` (`create_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `ut_sys_log` -- CREATE TABLE IF NOT EXISTS `ut_sys_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL COMMENT 'log 创建的时间', `level` enum('info','error','warning','trace') NOT NULL COMMENT 'log 的级别', `module` varchar(45) NOT NULL DEFAULT '' COMMENT 'module name,supported values are:''Catalog'',''Customer'',''Delivery'',''Finance'',''Inventory'',''Order'',''Permission'',''Platform'',''Purchase'',''Report'',''Ticket''', `class` varchar(45) NOT NULL DEFAULT '' COMMENT 'class name', `function` varchar(45) NOT NULL DEFAULT '' COMMENT 'function name', `remark` text NOT NULL COMMENT 'remark,message of logged detail', PRIMARY KEY (`id`), KEY `11` (`create_time`), KEY `3` (`module`,`class`,`function`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统Online操作,batch job运行,background job 运行的log 写入' AUTO_INCREMENT=14 ; -- -------------------------------------------------------- -- -- Table structure for table `ut_user_image` -- CREATE TABLE IF NOT EXISTS `ut_user_image` ( `id` int(11) NOT NULL AUTO_INCREMENT, `origin_url` varchar(90) NOT NULL COMMENT '原图的amazon s3 url', `thumbnail_url` varchar(100) NOT NULL COMMENT '缩略图的 amazon s3 url', `amazon_key` varchar(60) NOT NULL COMMENT '原图在amazon s3上的唯一码。其实就是路径', `origin_size` int(11) NOT NULL COMMENT '原图的大小。以Byte为单位', `thumbnail_size` int(11) NOT NULL COMMENT '缩略图的大小。以Byte为单位', `create_time` datetime NOT NULL COMMENT '图片上传时间', `service` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0是使用amazon s3上传的图片, 1为七牛', `memo` varchar(128) DEFAULT NULL COMMENT '图片使用memo', `original_name` varchar(255) DEFAULT NULL COMMENT '上传时的图片名', `original_width` int(11) NOT NULL DEFAULT '0' COMMENT '原图宽度', `original_height` int(11) NOT NULL DEFAULT '0' COMMENT '原图高度', `classification_id` int(4) not NULL DEFAULT 1 COMMENT '图片类别' , PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- CREATE TABLE IF NOT EXISTS `ut_image_classification` ( `ID` int(4) NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL COMMENT '类别名称', `operation` varchar(100) NOT NULL DEFAULT '{"add":0,"alert":1,"del":1}' COMMENT '是否可以增修删', `parentID` int(11) NOT NULL DEFAULT 0 COMMENT '父节点', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; INSERT INTO `ut_image_classification` (`ID`, `name`, `operation`) VALUES (1, '未分类', '{"add":0,"alert":0,"del":0}'); -- -- Table structure for table `visit_log` -- CREATE TABLE IF NOT EXISTS `visit_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `url_path` varchar(255) NOT NULL COMMENT '是指页面url,网站的域名就不需要提供。 如 :/purchase/purchase/list', `visit_time` datetime NOT NULL COMMENT '访问时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户访问log' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wh_order_reserve_product` -- CREATE TABLE IF NOT EXISTS `wh_order_reserve_product` ( `id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) unsigned zerofill NOT NULL COMMENT '订单号', `package_id` int(11) NOT NULL DEFAULT '0' COMMENT '包裹号', `warehouse_id` smallint(6) DEFAULT '0' COMMENT '仓库编号', `sku` varchar(250) NOT NULL COMMENT '产品sku', `reserved_qty` int(11) NOT NULL DEFAULT '0' COMMENT '预约仓库库存用来发货的数量', `reserved_qty_on_the_way` int(11) NOT NULL DEFAULT '0' COMMENT '预约仓库产品在途的\n用来到货后发货的数量', `reserve_time` timestamp NULL DEFAULT NULL COMMENT '预约的时间', PRIMARY KEY (`id`), KEY `index2` (`order_id`,`package_id`,`sku`), KEY `index3` (`sku`), KEY `index4` (`package_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='记录订单发货预约了sku 的情况' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wh_oversea_warehouse_stock` -- CREATE TABLE IF NOT EXISTS `wh_oversea_warehouse_stock` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `oversea_warehouse_sku` varchar(255) NOT NULL DEFAULT '' COMMENT '海外仓sku', `sku` varchar(255) NOT NULL DEFAULT '' COMMENT '系统sku', `product_name` varchar(50) NOT NULL DEFAULT '' COMMENT '商品名称', `carrier_code` varchar(50) NOT NULL DEFAULT '' COMMENT '海外仓服务商code', `third_party_code` varchar(50) NOT NULL DEFAULT '' COMMENT '海外仓服务商仓库编号', `warehouse_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '系统仓库id', `qty_on_hand` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '在库库存', `qty_ordered` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '在途库存', `qty_reserved` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '冻结库存', `qty_time_out` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '超时库存', `specification` varchar(255) NOT NULL DEFAULT '' COMMENT '规格', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`id`), KEY `idx_ows` (`oversea_warehouse_sku`), KEY `idx_sku` (`sku`), KEY `idx_wi` (`warehouse_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='海外仓库存表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wh_product_stock` -- CREATE TABLE IF NOT EXISTS `wh_product_stock` ( `prod_stock_id` int(11) NOT NULL AUTO_INCREMENT, `warehouse_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '仓库号', `sku` varchar(255) NOT NULL DEFAULT '', `location_grid` varchar(45) NOT NULL DEFAULT '' COMMENT '仓库货位/格子', `qty_in_stock` int(5) NOT NULL DEFAULT '0' COMMENT '在库数量', `qty_purchased_coming` int(8) unsigned NOT NULL DEFAULT '0' COMMENT '采购在途数量', `qty_ordered` int(8) unsigned NOT NULL DEFAULT '0' COMMENT '待发货', `qty_order_reserved` int(8) unsigned NOT NULL DEFAULT '0' COMMENT '已被订单预约', `average_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '历史采购成本', `total_purchased` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '历史采购总量', `safety_stock` SMALLINT(5) default 0 not null COMMENT '安全库存', `addi_info` varchar(255) NOT NULL DEFAULT '', `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间', PRIMARY KEY (`prod_stock_id`), UNIQUE KEY `warehouse_sku` (`warehouse_id`,`sku`), KEY `index3` (`sku`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='仓库的产品数量信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wh_stock_change` -- CREATE TABLE IF NOT EXISTS `wh_stock_change` ( `stock_change_id` varchar(255) NOT NULL COMMENT '出入库单号', `warehouse_id` smallint(5) unsigned DEFAULT '0' COMMENT '仓库号', `change_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '出库或者入库\n1:入库\n2:出库', `reason` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '出入库原因--101:采购入库102:样品入库103:回收邮包104:赠品入库201:订单出库202:样品出库203:重发邮包204:赠品出库205:报废出库300:库存盘点301: 库存盘盈302: 库存盘亏', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `addi_info` varchar(255) NOT NULL DEFAULT '' COMMENT '额外的附加信息,使用json格式记录', `capture_user_id` smallint(5) unsigned DEFAULT '0' COMMENT 'Capture User ID', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间 ', `source_id` int(11) not null default 0 COMMENT '来源表Id', PRIMARY KEY (`stock_change_id`), KEY `index2` (`change_type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='仓库的入库或者入库记录表'; -- -------------------------------------------------------- -- -- Table structure for table `wh_stock_change_detail` -- CREATE TABLE IF NOT EXISTS `wh_stock_change_detail` ( `id` int(11) NOT NULL AUTO_INCREMENT, `stock_change_id` varchar(255) NOT NULL DEFAULT '' COMMENT '出入库单据编号', `sku` varchar(250) NOT NULL DEFAULT '', `qty` int(11) NOT NULL DEFAULT '0' COMMENT '数量', `prod_name` varchar(100) NOT NULL DEFAULT '' COMMENT '产品名称快照', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='仓库出入单的具体产品明细' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wh_stock_take` -- CREATE TABLE IF NOT EXISTS `wh_stock_take` ( `stock_take_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '盘点单号', `warehouse_id` smallint(5) unsigned DEFAULT NULL COMMENT '仓库号', `number_of_sku` smallint(5) unsigned DEFAULT NULL COMMENT '产品品种数量', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `capture_user_id` smallint(5) unsigned DEFAULT NULL COMMENT 'Capture User ID', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间 ', PRIMARY KEY (`stock_take_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='仓库的库存盘点表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wh_stock_take_detail` -- CREATE TABLE IF NOT EXISTS `wh_stock_take_detail` ( `id` int(11) NOT NULL AUTO_INCREMENT, `stock_take_id` int(11) NOT NULL DEFAULT '0' COMMENT '盘点单编号', `sku` varchar(40) NOT NULL DEFAULT '' COMMENT '产品编码SKU', `product_name` varchar(255) NOT NULL DEFAULT '' COMMENT '货品名称(快照)', `location_grid` varchar(45) NOT NULL DEFAULT '' COMMENT '仓库货位/格子', `qty_shall_be` int(11) NOT NULL DEFAULT '0' COMMENT '应有可用库存', `qty_actual` int(11) NOT NULL DEFAULT '0' COMMENT '实际盘点数', `qty_reported` int(11) NOT NULL DEFAULT '0' COMMENT '报损\n报溢\n\n正数是盘点报溢\n负数是盘点报损', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='盘点的具体产品SKU,数量,结果信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wh_warehouse` -- CREATE TABLE IF NOT EXISTS `wh_warehouse` ( `warehouse_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '仓库号', `name` varchar(50) NOT NULL DEFAULT '' COMMENT '仓库名称', `is_active` char(1) NOT NULL DEFAULT '' COMMENT '状态可用\n“Y”:yes\n“N”:No', `address_nation` char(2) NOT NULL DEFAULT '' COMMENT 'e.g. CN,UK', `address_state` varchar(100) NOT NULL DEFAULT '' COMMENT 'e.g. 广东省', `address_city` varchar(100) NOT NULL DEFAULT '' COMMENT 'e.g. 中山市', `address_street` varchar(255) NOT NULL DEFAULT '', `address_postcode` varchar(45) NOT NULL DEFAULT '' COMMENT '邮编', `address_phone` varchar(45) NOT NULL DEFAULT '' COMMENT '电话', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `addi_info` varchar(255) NOT NULL DEFAULT '' COMMENT '额外的附加信息,使用json格式记录', `capture_user_id` int(11) unsigned DEFAULT NULL COMMENT 'Capture User ID', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间', `is_oversea` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0:普通仓库 1:海外仓', `address_params` text COMMENT '地址相关参数', `carrier_code` varchar(50) DEFAULT '' COMMENT '海外仓代码', `third_party_code` varchar(100) DEFAULT '' COMMENT '海外仓仓库代码', `oversea_type` int(11) DEFAULT '0' COMMENT '海外仓模式 0:API接口 1:excel导入', `excel_mode` varchar(50) DEFAULT '' COMMENT 'Excel导出模式', `excel_format` text COMMENT 'Excel导出格式', `is_zero_inventory` int DEFAULT 0 COMMENT '是否支持负库存出库 0:不支持 1:支持', PRIMARY KEY (`warehouse_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='仓库的基本信息' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wh_warehouse_cover_nation` -- CREATE TABLE IF NOT EXISTS `wh_warehouse_cover_nation` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', `nation` char(2) NOT NULL COMMENT '国家代号', `warehouse_id` int(11) NOT NULL COMMENT '仓库代号', `priority` tinyint(4) unsigned NOT NULL DEFAULT '200' COMMENT '数字大表示优先级高,100是中等,200最优先', PRIMARY KEY (`id`), UNIQUE KEY `id1` (`nation`,`warehouse_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='仓库能递送国家的关系表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wh_warehouse_has_shipping_method` -- CREATE TABLE IF NOT EXISTS `wh_warehouse_has_shipping_method` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `warehouse_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '仓库id', `carrier_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流商', `shipping_method_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流方式', `extra_info` text NOT NULL COMMENT '额外信息', `pre_weight` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '首重', `pre_weight_price` decimal(10,4) unsigned NOT NULL DEFAULT '0.0000' COMMENT '首重价', `add_weight` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '续重', `add_weight_price` decimal(10,4) unsigned NOT NULL DEFAULT '0.0000' COMMENT '续重价', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='仓库物理方式关系表' AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wish_fanben` -- CREATE TABLE IF NOT EXISTS `wish_fanben` ( `id` int(10) NOT NULL AUTO_INCREMENT, `brand` varchar(50) DEFAULT NULL COMMENT '品牌', `type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '商品类型 1在线商品 2小老板刊登商品', `status` varchar(20) NOT NULL COMMENT '状态:error,editing, uploading, complete', `lb_status` int(11) NOT NULL DEFAULT '1' COMMENT '小老板刊登商品状态 1待发布 2平台审核中 3发布成功 4发布失败 5标记删除 6在线商品', `site_id` int(5) DEFAULT NULL, `parent_sku` varchar(50) NOT NULL DEFAULT '' COMMENT '如果是变参的,填入老爸SKU', `variance_count` int(11) NOT NULL DEFAULT '1' COMMENT '该范本包含的变参子产品数量', `name` varchar(255) NOT NULL COMMENT '产品名称', `tags` varchar(255) NOT NULL, `upc` varchar(50) DEFAULT NULL COMMENT 'UPC,EAN,barcode', `landing_page_url` text COMMENT '自营网店的URL', `internal_sku` varchar(50) DEFAULT '' COMMENT '小老板内部商品SKU', `msrp` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '原售价,被划掉的', `shipping_time` varchar(250) NOT NULL DEFAULT '' COMMENT 'just the estimated days,e.g. "3-7"', `main_image` text NOT NULL COMMENT '主图片,必填', `extra_image_1` text, `extra_image_2` text, `extra_image_3` text, `extra_image_4` text, `extra_image_5` text, `extra_image_6` text, `extra_image_7` text, `extra_image_8` text, `extra_image_9` text, `extra_image_10` text, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `description` text NOT NULL, `capture_user_id` tinyint(4) NOT NULL COMMENT '操作者ID', `wish_product_id` varchar(50) DEFAULT '' COMMENT 'Wish 平台的product id,用于update一个product', `error_message` text COMMENT 'Wish返回的错误信息', `addinfo` varchar(255) NOT NULL DEFAULT '' COMMENT '备用信息,json格式', `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '商品价格', `inventory` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品库存', `number_saves` int(11) NOT NULL DEFAULT '0' COMMENT '商品WISH平台收藏数', `number_sold` int(11) NOT NULL DEFAULT '0' COMMENT '商品WISH平台销售数', `is_enable` tinyint(4) NOT NULL DEFAULT '1' COMMENT '变种商品是否存在下架商品 1不存在 2存在', `shipping` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '运费美元', `matching_info` text DEFAULT NULL COMMENT '配对待确认信息', PRIMARY KEY (`id`), UNIQUE KEY `siteidandparentsku` (`site_id`,`parent_sku`), KEY `title` (`name`), KEY `sku` (`internal_sku`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `wish_fanben_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `wish_fanben_action` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '操作类型', `wish_fanben_info` text CHARACTER SET utf8 NOT NULL COMMENT '操作内容', `wish_fanben_return_info` text CHARACTER SET utf8 NOT NULL COMMENT '返回内容', `wish_fanben_status` int(11) NOT NULL DEFAULT '1' COMMENT '操作执行状态 1正常 2异常', `create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', `update_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wish_fanben_variance` -- CREATE TABLE IF NOT EXISTS `wish_fanben_variance` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Variance id', `fanben_id` int(11) NOT NULL COMMENT '这个variance属于某个范本', `parent_sku` varchar(50) NOT NULL COMMENT '父产品sku', `sku` varchar(250) NOT NULL COMMENT '变参子产品sku', `sync_status` varchar(30) NOT NULL COMMENT '同步状态', `internal_sku` varchar(50) NOT NULL COMMENT 'Eagle系统的商品sku', `color` varchar(100) NOT NULL COMMENT 'wish平台的颜色', `size` varchar(100) NOT NULL COMMENT 'wish平台的size', `price` decimal(8,2) NOT NULL COMMENT 'wish平台美元售价', `shipping` decimal(8,2) NOT NULL COMMENT '运费美元', `inventory` int(11) NOT NULL COMMENT '库存量', `addinfo` text COMMENT '备用信息,json格式', `enable` char(1) NOT NULL DEFAULT 'Y' COMMENT '商品启用状态(Y=上架,N=下架)', `variance_product_id` varchar(50) NOT NULL COMMENT 'wish平台返回的product id', `image_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'SKU专属图片地址', PRIMARY KEY (`id`), UNIQUE KEY `locateit` (`fanben_id`,`parent_sku`,`sku`), KEY `syncstatus` (`sync_status`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Wish刊登的变参子产品范本信息' AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `queue_product_log` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, `status` char(1) DEFAULT 'P', `total_product` int(11) DEFAULT NULL, `total_variance` int(11) DEFAULT NULL, `platform` varchar(50) NOT NULL, `operator` int(11) unsigned DEFAULT '0' COMMENT '0:系统 其他:uid', `shop` varchar(255) DEFAULT NULL COMMENT '卖家账号', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `wish_order` -- CREATE TABLE IF NOT EXISTS `wish_order` ( `order_id` varchar(255) NOT NULL COMMENT '订单号', `order_time` datetime DEFAULT NULL COMMENT '创建时间', `order_total` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '总金额', `transaction_id` varchar(255) DEFAULT NULL COMMENT '交易号', `variant_id` varchar(255) DEFAULT NULL, `city` varchar(255) DEFAULT NULL COMMENT '城市', `country` varchar(255) DEFAULT NULL COMMENT '国家', `name` varchar(255) DEFAULT NULL COMMENT '姓名', `phone_number` varchar(255) DEFAULT NULL COMMENT '电话号码', `state` varchar(255) DEFAULT NULL COMMENT '州/省', `street_address1` text COMMENT '街道地址 1', `street_address2` text COMMENT '街道地址2', `zipcode` varchar(255) DEFAULT NULL COMMENT '邮编', `last_updated` datetime DEFAULT NULL COMMENT '最近更新时间', `shipping_cost` decimal(10,2) DEFAULT '0.00' COMMENT '运费成本', `shipping` decimal(10,2) DEFAULT '0.00' COMMENT '运费', `status` varchar(255) DEFAULT NULL COMMENT '状态', `buyer_id` varchar(50) DEFAULT NULL COMMENT 'buyerid 每个买家固定的', `shipping_provider` varchar(100) DEFAULT NULL COMMENT '物流商', `tracking_number` varchar(50) DEFAULT NULL COMMENT '物流号', PRIMARY KEY (`order_id`), KEY `buyer_id` (`buyer_id`), KEY `tracking_number` (`tracking_number`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='wish订单'; -- -------------------------------------------------------- -- -- Table structure for table `wish_order_detail` -- CREATE TABLE IF NOT EXISTS `wish_order_detail` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', `product_id` varchar(255) DEFAULT NULL COMMENT '商品编号', `quantity` int(11) DEFAULT NULL COMMENT '数量', `price` decimal(10,2) DEFAULT NULL COMMENT '价格', `cost` decimal(10,2) DEFAULT NULL COMMENT '成本', `shipping` decimal(10,2) DEFAULT NULL COMMENT '运费', `shipping_cost` decimal(10,2) DEFAULT NULL COMMENT '运费成本', `product_name` varchar(255) DEFAULT NULL COMMENT '商品名称', `product_image_url` text COMMENT '商品图片说明', `days_to_fulfill` int(11) DEFAULT NULL COMMENT '备货周期', `sku` varchar(255) DEFAULT NULL COMMENT 'sku', `size` varchar(255) DEFAULT NULL COMMENT '规格', `order_id` varchar(255) NOT NULL COMMENT '订单编号', PRIMARY KEY (`id`), UNIQUE KEY `order_sku` (`order_id`,`sku`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='wish订单明细表' AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `aliexpress_listing` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '商品id', `productid` varchar(20) NOT NULL COMMENT '在线上id', `freight_template_id` varchar(20) DEFAULT NULL COMMENT '运费模板id', `owner_member_seq` varchar(20) DEFAULT NULL COMMENT '速卖通账号id号,还不知道有什么用', `subject` varchar(255) DEFAULT NULL COMMENT '商品标题', `photo_primary` varchar(255) DEFAULT NULL COMMENT '主图', `error_message` text COMMENT '错误信息', `imageurls` text COMMENT '橱窗图片多图', `selleruserid` varchar(20) DEFAULT NULL COMMENT '卖家账号', `ws_offline_date` int(11) DEFAULT NULL COMMENT '预计下架时间', `product_min_price` float(10,2) DEFAULT NULL COMMENT '最小售价', `ws_display` varchar(50) DEFAULT NULL COMMENT '下架原因', `product_max_price` float(10,2) DEFAULT NULL COMMENT '商品最高价', `gmt_modified` int(11) DEFAULT NULL COMMENT '商品最后修改时间', `gmt_create` int(11) DEFAULT NULL COMMENT '商品上架时间', `sku_stock` int(7) DEFAULT NULL COMMENT '商品在售数量', `created` int(11) DEFAULT NULL, `updated` int(11) DEFAULT NULL, `product_status` smallint(1) DEFAULT '0' COMMENT '0-保存未发布 1-onSelling-上架销售中 2-offline-下架 3-auditing-审核中 4-editingRequired-审核不通过', `edit_status` tinyint(1) DEFAULT '0' COMMENT '0-待发布 1-发布中 2-修改中 3-发布失败', PRIMARY KEY (`id`), KEY `productid` (`productid`), KEY `selleruserid` (`selleruserid`), KEY `ws_offline_date` (`ws_offline_date`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; INSERT INTO `cs_msg_template` (`id`, `name`, `subject`, `body`, `addi_info`) VALUES (1, '已签收请求好评(预设1)', 'Your parcel (number [包裹物流号]) has arrived, which is shipped by [包裹递送物流商].', 'Dear [收件人名称],\r\n\r\nYour parcel (number [包裹物流号]) has arrived, which is shipped by [包裹递送物流商].\r\n\r\nShipping address:\r\n[收件人地址,包含城市].\r\n\r\nDo you encounter any problem while operating this product?\r\nPlease consult us if any issue.\r\n\r\nIf you find the product is good, would you please give us a positive evaluation?\r\nThe related order ID is [平台订单号].\r\n\r\nThanks and regards\r\nGood day.\r\n\r\nFor more details about your order and get more excellent products, please visit [买家查看包裹追踪及商品推荐链接]', '{"recom_prod":"Y","layout":"1","recom_prod_count":"4"}'), (2, '启运通知英文 (预设1)', 'Your parcel has been shipped', 'Dear [收件人名称]\r\n\r\nThanks for your order [平台订单号]. \r\nPlease be advised that your parcel has been shipped.\r\nBy carrier [包裹递送物流商] , with delivery number [包裹物流号].\r\n\r\nCheck the status of your shipment NOW:\r\n[买家查看包裹追踪及商品推荐链接]\r\n\r\nIf you have any additional questions, please do not hesitate to contact us.\r\nThanks and regards\r\n', '{"recom_prod":"Y","layout":"1","recom_prod_count":"8"}'); CREATE TABLE IF NOT EXISTS `cdiscount_offer_list` ( `id` int(11) NOT NULL AUTO_INCREMENT, `best_shipping_charges` float DEFAULT NULL COMMENT '最佳运费', `comments` text, `creation_date` datetime DEFAULT NULL, `dea_tax` float DEFAULT NULL, `discount_list` text, `eco_tax` float DEFAULT NULL COMMENT '环境税', `integration_price` float DEFAULT NULL COMMENT '整合价格', `last_update_date` datetime DEFAULT NULL, `minimum_price_for_price_alignment` float DEFAULT NULL COMMENT '调整后的最低价', `offer_bench_mark` text, `offer_pool_list` text COMMENT 'json格式', `offer_state` varchar(100) DEFAULT NULL COMMENT 'Active/', `parent_product_id` varchar(100) DEFAULT NULL, `price` float DEFAULT NULL, `price_must_be_aligned` varchar(100) DEFAULT NULL COMMENT '/DontAlign', `product_condition` varchar(100) DEFAULT NULL COMMENT 'New/', `product_ean` varchar(100) DEFAULT NULL, `product_id` varchar(100) DEFAULT NULL, `product_packaging_unit` varchar(100) DEFAULT NULL, `product_packaging_unit_price` float DEFAULT NULL, `product_packaging_value` decimal(8,2) DEFAULT NULL, `seller_product_id` varchar(100) DEFAULT NULL, `shipping_information_list` text COMMENT 'json格式', `stock` decimal(8,2) NOT NULL DEFAULT '0.00', `striked_price` decimal(8,2) DEFAULT NULL COMMENT '最高价格?', `vat_rate` decimal(8,2) DEFAULT NULL COMMENT '增值税率', `name` text COMMENT '通过页面抓取获得的name信息', `img` text COMMENT '页面抓取到的photos,json格式', `description` text COMMENT '页面抓取到的产品描述', `sku` varchar(100) DEFAULT NULL, `brand` varchar(100) DEFAULT NULL, `is_bestseller` varchar(1) DEFAULT NULL COMMENT '自己是不是最佳卖家,Y/N', `bestseller_name` varchar(100) DEFAULT NULL COMMENT '最佳卖家名称', `bestseller_price` decimal(8,2) DEFAULT NULL COMMENT '最佳卖家此商品的售价', `seller_id` varchar(100) NOT NULL COMMENT '对应店铺登录名', `product_url` text COMMENT '商品在销售平台的链接', `last_15_days_sold` int(11) NOT NULL DEFAULT '0' COMMENT '最近15日售出数量,以当前日期的0:0:0为统计结束时间', `concerned_status` CHAR(1) NOT NULL DEFAULT 'N' COMMENT '关注状态:N:普通;I:忽略;F:关注;H:爆款', `terminator_active` VARCHAR(1) NULL DEFAULT NULL COMMENT '跟卖终结者是否生效', `matching_info` text DEFAULT NULL COMMENT '配对待确认信息', PRIMARY KEY (`id`), UNIQUE KEY `product_id` (`product_id`,`seller_id`), KEY `sku` (`sku`), KEY `product_mark` (`product_id`,`seller_product_id`), KEY `seller_id` (`seller_id`), KEY `concerned_status` (`concerned_status`), KEY `is_bestseller` (`is_bestseller`), KEY `terminator_active` (`terminator_active`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- 表的结构 `cdiscount_order` -- CREATE TABLE IF NOT EXISTS `cdiscount_order` ( `ordernumber` varchar(50) NOT NULL DEFAULT '' COMMENT '订单号', `billing_address1` varchar(255) DEFAULT NULL, `billing_address2` varchar(255) DEFAULT NULL, `billing_building` varchar(255) DEFAULT NULL, `billing_transaction_id` varchar(255) DEFAULT NULL, `billing_city` varchar(255) DEFAULT NULL, `billing_civility` varchar(255) DEFAULT NULL, `billing_companyname` varchar(255) DEFAULT NULL, `billing_country` varchar(255) DEFAULT NULL, `billing_firstname` varchar(255) DEFAULT NULL, `billing_instructions` varchar(255) DEFAULT NULL, `billing_lastname` varchar(100) DEFAULT NULL, `billing_placename` varchar(100) DEFAULT NULL, `billing_street` varchar(255) DEFAULT NULL, `billing_zipcode` varchar(30) DEFAULT NULL, `creationdate` datetime DEFAULT NULL, `customer_customerid` varchar(100) DEFAULT NULL, `customer_mobilephone` varchar(100) DEFAULT NULL, `customer_phone` varchar(100) DEFAULT NULL, `customer_civility` varchar(100) DEFAULT NULL, `customer_firstname` varchar(100) DEFAULT NULL, `customer_lastname` varchar(100) DEFAULT NULL, `hasclaims` varchar(100) DEFAULT NULL, `initialtotalamount` float(10,2) DEFAULT '0.00' COMMENT '初始总金额', `initialtotalshippingchargesamount` float(10,2) DEFAULT '0.00', `lastupdateddate` datetime DEFAULT NULL, `modifieddate` datetime DEFAULT NULL, `offer` varchar(100) DEFAULT NULL, `orderstate` varchar(100) DEFAULT NULL, `shippedtotalamount` float(10,2) DEFAULT '0.00', `shippedTotalShippingCharges` float(10,2) DEFAULT '0.00', `shipping_address1` varchar(255) DEFAULT NULL, `shipping_address2` varchar(255) DEFAULT NULL, `shipping_apartmentnumber` varchar(255) DEFAULT NULL, `shipping_building` varchar(255) DEFAULT NULL, `shipping_city` varchar(255) DEFAULT NULL, `shipping_civility` varchar(255) DEFAULT NULL, `shipping_companyname` varchar(255) DEFAULT NULL, `shipping_country` varchar(255) DEFAULT NULL, `shipping_county` varchar(255) DEFAULT NULL, `shipping_firstname` varchar(100) DEFAULT NULL, `shipping_instructions` varchar(255) DEFAULT NULL, `shipping_lastname` varchar(100) DEFAULT NULL, `shipping_placename` varchar(100) DEFAULT NULL, `shipping_relayid` varchar(100) DEFAULT NULL, `shipping_street` varchar(255) DEFAULT NULL, `shipping_zipcode` varchar(30) DEFAULT NULL, `shippingcode` varchar(30) DEFAULT NULL, `sitecommissionpromisedamount` float(10,2) DEFAULT '0.00', `sitecommissionshippedamount` float(10,2) DEFAULT '0.00', `sitecommissionvalidatedamount` float(10,2) DEFAULT '0.00', `status` varchar(100) DEFAULT NULL, `validatedtotalamount` float(10,2) DEFAULT '0.00', `validatedtotalshippingcharges` float(10,2) DEFAULT '0.00', `validationstatus` varchar(100) DEFAULT NULL, `archiveparcellist` varchar(100) DEFAULT NULL, `seller_id` varchar(255) DEFAULT NULL COMMENT '卖家账号登录名', `addinfo` text COMMENT '其他信息 oms_auto_inserted=0/1 oms_admin_inserted=0/1 errors=', `updated_time` DATETIME NULL DEFAULT NULL COMMENT '小老板更新时间', PRIMARY KEY (`ordernumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='wish订单'; -- -- 表的结构 `cdiscount_order_detail` -- CREATE TABLE IF NOT EXISTS `cdiscount_order_detail` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ordernumber` varchar(50) NOT NULL, `acceptationstate` varchar(100) DEFAULT NULL, `categorycode` varchar(100) DEFAULT NULL, `deliverydatemax` datetime DEFAULT NULL, `deliverydatemin` datetime DEFAULT NULL, `hasclaim` varchar(100) DEFAULT NULL, `initialprice` varchar(100) DEFAULT NULL, `isnegotiated` varchar(100) DEFAULT NULL, `isproducteangenerated` varchar(100) DEFAULT NULL, `name` varchar(100) DEFAULT NULL, `orderlinechildlist` varchar(255) DEFAULT NULL, `productcondition` varchar(100) DEFAULT NULL, `productean` varchar(100) DEFAULT NULL, `productid` varchar(100) NOT NULL COMMENT 'INTERETBCA:客人给的小费', `purchaseprice` float(10,2) NOT NULL DEFAULT '0.00', `quantity` int(10) DEFAULT '0', `rowid` varchar(100) DEFAULT NULL, `sellerproductid` varchar(100) DEFAULT NULL, `shippingdatemax` datetime DEFAULT NULL, `shippingdatemin` datetime DEFAULT NULL, `sku` varchar(100) DEFAULT NULL COMMENT 'INTERETBCA:客人给的小费', `skuparent` varchar(100) DEFAULT NULL, `unitadditionalshippingcharges` float(10,2) DEFAULT '0.00', `unitshippingcharges` float(10,2) DEFAULT '0.00', PRIMARY KEY (`id`), KEY `ordernumber` (`ordernumber`), KEY `productid` (`productid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `lazada_order` ( `id` int(11) NOT NULL AUTO_INCREMENT, `OrderId` varchar(30) NOT NULL, `CustomerFirstName` varchar(50) DEFAULT NULL, `CustomerLastName` varchar(50) DEFAULT NULL, `OrderNumber` varchar(50) NOT NULL, `PaymentMethod` varchar(50) NOT NULL, `DeliveryInfo` varchar(255) DEFAULT NULL, `Remarks` varchar(255) DEFAULT NULL, `Price` decimal(10,2) NOT NULL DEFAULT '0.00', `GiftOption` tinyint(2) NOT NULL, `GiftMessage` text, `VoucherCode` varchar(255) DEFAULT NULL, `CreatedAt` int(11) NOT NULL, `UpdatedAt` int(11) NOT NULL, `AddressBilling` text, `AddressShipping` text, `NationalRegistrationNumber` varchar(100) DEFAULT NULL, `ItemsCount` int(11) NOT NULL, `Statuses` varchar(255) NOT NULL, `create_time` int(11) NOT NULL DEFAULT '0', `update_time` int(11) NOT NULL DEFAULT '0', `lazada_api_email` varchar(255) NOT NULL, PRIMARY KEY (`id`), KEY `OrderId` (`OrderId`), KEY `OrderNumber` (`OrderNumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `lazada_order_items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `OrderItemId` varchar(30) NOT NULL, `ShopId` varchar(30) NOT NULL, `OrderId` varchar(30) NOT NULL, `Name` varchar(255) NOT NULL, `Sku` varchar(100) NOT NULL, `ShopSku` varchar(100) NOT NULL, `ShippingType` varchar(50) NOT NULL, `ItemPrice` decimal(10,2) NOT NULL DEFAULT '0.00', `PaidPrice` decimal(10,2) NOT NULL DEFAULT '0.00', `Currency` varchar(10) NOT NULL, `WalletCredits` decimal(10,2) NOT NULL DEFAULT '0.00', `TaxAmount` decimal(10,2) NOT NULL DEFAULT '0.00', `ShippingAmount` decimal(10,2) NOT NULL DEFAULT '0.00', `VoucherAmount` decimal(10,2) NOT NULL DEFAULT '0.00', `VoucherCode` varchar(255) DEFAULT NULL, `Status` varchar(30) NOT NULL, `ShipmentProvider` varchar(50) DEFAULT NULL, `TrackingCode` varchar(100) DEFAULT NULL, `Reason` varchar(255) DEFAULT NULL, `PurchaseOrderId` varchar(30) DEFAULT NULL, `PurchaseOrderNumber` varchar(30) DEFAULT NULL, `PackageId` varchar(30) DEFAULT NULL, `CreatedAt` int(11) NOT NULL, `UpdatedAt` int(11) NOT NULL, `SmallImageUrl` varchar(455) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `dp_info` ( `duepay_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `order_id` int(11) unsigned zerofill NOT NULL COMMENT '订单编号', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '催款时间', `pay_time` timestamp NULL DEFAULT NULL COMMENT '支付时间', `status` tinyint(1) unsigned NOT NULL DEFAULT '1', `order_time` timestamp NULL DEFAULT NULL COMMENT '下单时间', `shop_id` varchar(50) NOT NULL COMMENT '店铺id', `rule_id` int(11) unsigned DEFAULT '0' COMMENT '规则id', `consignee_country_code` varchar(5) DEFAULT '' COMMENT '所属国家', `due_status` tinyint(1) unsigned DEFAULT '1' COMMENT '1:未付费,2:已付费', `buyer` varchar(50) DEFAULT NULL COMMENT '买家', `cost` decimal(10,2) DEFAULT NULL COMMENT '订单金额', `contacted` tinyint(1) unsigned DEFAULT '0' COMMENT '1:客服已联系过不再自动催款', `content` text COMMENT '催款内容', `source_id` varchar(255) DEFAULT NULL COMMENT '订单号', `update_time` timestamp NULL DEFAULT NULL COMMENT '更新时间', `msg_type` tinyint(1) NULL DEFAULT 1 COMMENT '1:催款,2:>留言 ', PRIMARY KEY (`duepay_id`), KEY `order_id` (`order_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='催款提醒日志表'; CREATE TABLE IF NOT EXISTS `cm_comment_rule` ( `id` int(11) UNSIGNED AUTO_INCREMENT, -- `userid` int(11) UNSIGNED NOT NULL COMMENT '用户id', `selleruseridlist` varchar(255) NOT NULL COMMENT '规则包含的店铺名列表', `content` varchar(1000) NOT NULL COMMENT '好评内容', `is_dispute` tinyint(1) UNSIGNED COMMENT '是否包含纠纷订单', `countrylist` varchar(2000) NOT NULL COMMENT '规则包含的国家列表', `is_use` tinyint(1) NOT NULL DEFAULT 1 COMMENT '规则是否启用 1启用 0不启用', `platform` varchar(30) NOT NULL COMMENT '订单来源aliexpress,ebay,wish,amazon,dh等', `createtime` int(11) UNSIGNED DEFAULT 0 COMMENT '创建时间', `updatetime` int(11) UNSIGNED DEFAULT 0 COMMENT '修改时间', PRIMARY KEY (`id`), KEY `idx_platform` (`platform`) ) ENGINE=innodb DEFAULT CHARSET=utf8 COMMENT '自动好评规则表'; CREATE TABLE IF NOT EXISTS `cm_comment_template` ( `id` int(11) UNSIGNED AUTO_INCREMENT, `content` varchar(1000) NOT NULL COMMENT '留言内容', `createtime` int(11) UNSIGNED COMMENT '创建时间', -- `userid` int(11) UNSIGNED NOT NULL COMMENT '用户主帐号id', `is_use` tinyint(1) UNSIGNED DEFAULT 1 COMMENT '是否启用 1启用 0不启用', `platform` varchar(30) NOT NULL COMMENT '订单来源aliexpress,ebay,wish,amazon,dh等', PRIMARY KEY (`id`), KEY `idx_platform` (`platform`), KEY `idx_isuse` (`is_use`) ) ENGINE=MYISAM DEFAULT CHARSET=utf8 COMMENT '好评留言表'; CREATE TABLE IF NOT EXISTS `cm_comment_log` ( `id` int(11) UNSIGNED AUTO_INCREMENT, `order_id` int(11) UNSIGNED NOT NULL COMMENT '订单id', `order_source_order_id` varchar(50) NOT NULL COMMENT '订单来源平台id', `selleruserid` varchar(50) NOT NULL COMMENT '店铺id', `platform` varchar(30) NOT NULL COMMENT '订单来源aliexpress,ebay,wish,amazon,dh等', `source_buyer_user_id` varchar(50) NOT NULL DEFAULT '' COMMENT '买家用户名', `subtotal` decimal(10,2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '产品总价格', `currency` char(3) NOT NULL DEFAULT '' COMMENT '货币', `paid_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单付款时间', `content` varchar(1000) NOT NULL DEFAULT '' COMMENT '好评留言内容', `is_success` tinyint(1) DEFAULT 0 COMMENT '是否发送成功 1成功 0失败', `error_msg` varchar(255) DEFAULT '' COMMENT '失败原因', `createtime` int(11) UNSIGNED DEFAULT 0 COMMENT '好评时间', `rule_id` int(11) UNSIGNED DEFAULT 0 COMMENT '好评规则id', `order_source_create_time` int(11) unsigned DEFAULT '0' COMMENT '下单时间', PRIMARY KEY (`id`), KEY `idx_platform` (`platform`) ) ENGINE=MYISAM DEFAULT CHARSET=utf8 COMMENT '好评记录表'; CREATE TABLE IF NOT EXISTS `cm_comment_enable` ( `id` int(11) UNSIGNED AUTO_INCREMENT, `uid` int(11) UNSIGNED NOT NULL COMMENT '小老板主帐号id', `selleruserid` varchar(100) NOT NULL COMMENT '卖家帐号', `platform` varchar(30) NOT NULL COMMENT '订单来源aliexpress,ebay,wish,amazon,dh等', `enable_status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否开启自动好评 0:停用,1:开启', `createtime` int(11) UNSIGNED DEFAULT 0 COMMENT '创建时间', PRIMARY KEY (`id`), KEY `idx_platform` (`platform`) ) ENGINE=MYISAM DEFAULT CHARSET=utf8 COMMENT '自动好评设置表'; CREATE TABLE IF NOT EXISTS `od_order_old_v2` ( `order_id` int(11) unsigned zerofill NOT NULL COMMENT '订单id', `order_status` smallint(5) NOT NULL DEFAULT '0' COMMENT '订单流程状态:100:未付款,200:已付款,201:有留言,205:未分仓库,210:SKU不存在,215:报关信息不全,220:paypal/ebay金额不对,225:paypal/ebay地址不对,230:未匹配物流,300:待生成包裹,400:发货处理中,500:已发货,600:已取消', `pay_status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '支付状态', `order_source_status` varchar(50) DEFAULT NULL COMMENT '订单来源平台订单状态', `order_manual_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '自定义标签', `is_manual_order` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否挂起状态', `shipping_status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '平台发货状态', `exception_status` smallint(5) DEFAULT '0' COMMENT '检测异常状态', `weird_status` char(10) DEFAULT NULL COMMENT '操作异常标签', `order_source` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源 ebay,amazon,aliexpress,custom', `order_type` varchar(50) NOT NULL DEFAULT '' COMMENT '订单类型如amazon FBA订单', `order_source_order_id` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源 的订单id', `order_source_site_id` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源平台下的站点:如eaby下的US站点', `selleruserid` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源平台卖家用户名(下单时候的用户名)', `saas_platform_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'saas库平台用户卖家账号id(ebay或者amazon卖家表中)', `order_source_srn` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'od_ebay_order表salesrecordnum', `customer_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'od_customer 表id', `source_buyer_user_id` varchar(255) NOT NULL DEFAULT '' COMMENT '来源买家用户名', `order_source_shipping_method` varchar(50) NOT NULL DEFAULT '' COMMENT '平台下单时用户选择的物流方式', `order_source_create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单在来源平台的下单时间', `subtotal` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '产品总价格', `shipping_cost` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '运费', `antcipated_shipping_cost` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '预估运费', `actual_shipping_cost` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '实际运费', `discount_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '折扣', `commission_total` decimal(10,2) DEFAULT '0.00' COMMENT '订单平台佣金', `paypal_fee` decimal(10,2) DEFAULT '0.00' COMMENT '暂时ebay使用的paypal 佣金(其他平台待开发其用途)', `grand_total` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '合计金额(产品总价格 + 运费 - 折扣 = 合计金额)', `returned_total` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '退款总金额', `price_adjustment` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '价格手动调整(下单后人工调整)', `currency` char(3) NOT NULL DEFAULT '' COMMENT '货币', `consignee` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人', `consignee_postal_code` varchar(50) NOT NULL DEFAULT '' COMMENT '收货人邮编', `consignee_phone` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人电话', `consignee_mobile` varchar(20) DEFAULT NULL COMMENT '收货人手机', `consignee_fax` varchar(255) DEFAULT NULL COMMENT '收件人传真号', `consignee_email` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人Email', `consignee_company` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人公司', `consignee_country` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人国家名', `consignee_country_code` char(2) NOT NULL DEFAULT '' COMMENT '收货人国家代码', `consignee_city` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人城市', `consignee_province` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人省', `consignee_district` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人区', `consignee_county` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人镇', `consignee_address_line1` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址1', `consignee_address_line2` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址2', `consignee_address_line3` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人地址3', `default_warehouse_id` int(11) NOT NULL DEFAULT '0' COMMENT '默认的仓库id', `default_carrier_code` varchar(50) NOT NULL DEFAULT '' COMMENT '默认物流商代码', `default_shipping_method_code` varchar(50) NOT NULL DEFAULT '' COMMENT '默认运输服务id', `paid_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单付款时间', `delivery_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '平台订单发货时间', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间 ', `user_message` varchar(255) NOT NULL DEFAULT '' COMMENT '用户留言', `carrier_type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0:普通物流商 1:海外仓', `hassendinvoice` tinyint(1) DEFAULT '0' COMMENT '是否有发送ebay账单', `seller_commenttype` varchar(32) DEFAULT NULL COMMENT '卖家评价类型', `seller_commenttext` varchar(255) DEFAULT NULL COMMENT '卖家评价留言', `status_dispute` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否有发起ebay催款,0没有', `is_feedback` int(1) DEFAULT NULL, `rule_id` int(11) DEFAULT NULL COMMENT '运输服务匹配规则id', `customer_number` varchar(50) DEFAULT NULL COMMENT '物流商返回的客户单号用户查询物流号', `carrier_step` tinyint(1) DEFAULT '0' COMMENT '物流操作步骤', `is_print_picking` tinyint(1) DEFAULT '0' COMMENT '是否打印拣货单', `print_picking_operator` int(10) DEFAULT NULL COMMENT '打印拣货单操作人', `print_picking_time` int(11) DEFAULT NULL COMMENT '打印拣货单时间', `is_print_distribution` tinyint(1) DEFAULT '0' COMMENT '是否打印配货单', `print_distribution_operator` int(10) DEFAULT NULL COMMENT '打印配货单操作人', `print_distribution_time` int(11) DEFAULT NULL COMMENT '配货单打印时间', `is_print_carrier` tinyint(1) DEFAULT '0' COMMENT '是否打印物流单', `print_carrier_operator` int(10) DEFAULT NULL COMMENT '打印物流单操作人', `printtime` int(11) DEFAULT '0' COMMENT '订单物流单打单时间', `delivery_status` tinyint(2) DEFAULT '0' COMMENT '小老板发货流程状态', `delivery_id` bigint(13) DEFAULT NULL COMMENT '拣货单号', `desc` text COMMENT '订单备注', `carrier_error` text, `is_comment_status` tinyint(1) unsigned DEFAULT '0' COMMENT '该订单是否已给好评', `is_comment_ignore` tinyint(1) unsigned DEFAULT '0' COMMENT '该订单是否设置好评忽略', `issuestatus` varchar(20) DEFAULT '' COMMENT '订单纠纷状态', `payment_type` varchar(50) NOT NULL DEFAULT '' COMMENT '支付类型', `logistic_status` varchar(255) DEFAULT NULL COMMENT '物流状态', `logistic_last_event_time` datetime DEFAULT NULL COMMENT '物流最后更新时间', `fulfill_deadline` int(11) NOT NULL DEFAULT '0' COMMENT '销售平台最后发货期限', `profit` decimal(10,2) DEFAULT NULL COMMENT '小老板计算出的利润', `logistics_cost` decimal(10,2) DEFAULT NULL COMMENT '物流成本', `logistics_weight` decimal(10,2) DEFAULT NULL COMMENT '物流商返回的称重重量(g)', `addi_info` text COMMENT '额外信息', `distribution_inventory_status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '分配库存状态2待分配,3缺货,4已分配', `reorder_type` varchar(50) DEFAULT NULL COMMENT '重新发货类型', `purchase_status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '采购(缺货)状态', `pay_order_type` varchar(50) DEFAULT NULL COMMENT '已付款订单类型', `order_evaluation` tinyint(2) NOT NULL DEFAULT '0' COMMENT '订单评价1为好评,2为中评,3差评', `tracker_status` varchar(30) DEFAULT NULL COMMENT 'tracker的物流状态', `origin_shipment_detail` text COMMENT '原始的订单收件人信息', `order_ship_time` datetime DEFAULT NULL COMMENT '小老板发货时间', `shipping_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否发送过启运通知,I为旧数据忽略', `pending_fetch_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否发送过到达待取通知,I为旧数据忽略', `delivery_failed_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '', `rejected_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否发送过异常退回通知,I为旧数据忽略', `received_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否发送过已签收求好评通知,I为旧数据忽略', `seller_weight` decimal(10,2) DEFAULT '0.00' COMMENT '卖家自己的称重重量(g)(取整)', `order_capture` char(1) NOT NULL DEFAULT 'N' COMMENT '是否手工订单N为否,Y为是', `order_relation` varchar(10) NOT NULL DEFAULT 'normal' COMMENT '订单类型 正常为normal,合并原始订单为fm,合并出来的新订单 sm,拆分的原始订单为fs,拆分后的新订单为ss ', `last_modify_time` datetime DEFAULT NULL COMMENT '订单的最后修改时间', `sync_shipped_status` char(1) NOT NULL DEFAULT 'Y' COMMENT '虚拟发货的同步状态P为待提交,S为提交中,F为提交失败,C为提交成功(小老板),Y为提交成功(非小老板)', `system_tag_1` char(1) NOT NULL DEFAULT '' COMMENT '系统标签1,Y为该标签标记了,N或者空白未没有', `system_tag_2` char(1) NOT NULL DEFAULT '' COMMENT '系统标签2,Y为该标签标记了,N或者空白未没有', `system_tag_3` char(1) NOT NULL DEFAULT '' COMMENT '系统标签3,Y为该标签标记了,N或者空白未没有', `system_tag_4` char(1) NOT NULL DEFAULT '' COMMENT '系统标签4,Y为该标签标记了,N或者空白未没有', `system_tag_5` char(1) NOT NULL DEFAULT '' COMMENT '系统标签5,Y为该标签标记了,N或者空白未没有', `customized_tag_1` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签1,Y为该标签标记了,N或者空白未没有', `customized_tag_2` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签2,Y为该标签标记了,N或者空白未没有', `customized_tag_3` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签3,Y为该标签标记了,N或者空白未没有', `customized_tag_4` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签4,Y为该标签标记了,N或者空白未没有', `customized_tag_5` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签5,Y为该标签标记了,N或者空白未没有', `customized_tag_6` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签6,Y为该标签标记了,N或者空白未没有', `customized_tag_7` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签7,Y为该标签标记了,N或者空白未没有', `customized_tag_8` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签8,Y为该标签标记了,N或者空白未没有', `customized_tag_9` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签9,Y为该标签标记了,N或者空白未没有', `customized_tag_10` char(1) NOT NULL DEFAULT '' COMMENT '自定义标签10,Y为该标签标记了,N或者空白未没有', `tracking_no_state` int(3) default 0 COMMENT '物流商获取跟踪号状态 0:表示未获取过,1:表示获取失败,2:表示成功获取', `order_verify` varchar(20) DEFAULT NULL COMMENT '订单是否验证,ebay主要用于验证paypal地址与ebay地址是否一致', `items_md5` varchar(128) DEFAULT NULL COMMENT '所有商品关键值生成的md5,主要用于是否更新商品item表', `complete_ship_time` INT(11) NULL COMMENT '确认发货完成时间' , `declaration_info` text DEFAULT '' COMMENT '用于记录最后一次上传的报关信息,以json格式', `isshow` char(1) NOT NULL DEFAULT 'Y' COMMENT '是否显示,Y为显示,N为不显示', `first_sku` varchar(255) DEFAULT NULL COMMENT '商品的第一个sku,可用于排序', `ismultipleProduct` char(1) NOT NULL DEFAULT 'N' COMMENT '是否多品订单,Y为是,N为不是', `tracking_number` varchar(255) DEFAULT NULL COMMENT '物流跟踪号', `billing_info` text COMMENT '账单地址相关信息', `transaction_key` varchar(255) DEFAULT NULL COMMENT '订单交易号(目前用于记录prestashop线下付款的汇款号)', PRIMARY KEY (`order_id`), KEY `idx_statmanu` (`order_status`,`order_manual_id`) USING BTREE, KEY `idx_timeseller` (`order_source_create_time`,`selleruserid`) USING BTREE, KEY `idx_timebuyer` (`order_source_create_time`,`source_buyer_user_id`) USING BTREE, KEY `idx_timegrand` (`order_source_create_time`,`grand_total`), KEY `idx_buyeremail` (`consignee_email`), KEY `idx_manu` (`order_manual_id`), KEY `order_source_order_id` (`order_source_order_id`), KEY `idx_order_customer` (`order_source`,`source_buyer_user_id`), KEY `idx_comment_status` (`is_comment_status`), KEY `idx_comment_ignore` (`is_comment_ignore`), KEY `idx_issuestatus` (`issuestatus`), KEY `logistic_status` (`logistic_status`,`order_source`) COMMENT 'logistic_status', KEY `pay_order_type` (`pay_order_type`), KEY `order_ship_time` (`order_ship_time`), KEY `shipping_notified` (`shipping_notified`,`pending_fetch_notified`,`rejected_notified`,`received_notified`), KEY `platform_shiptime` (`order_source`,`order_ship_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='旧订单表' ; CREATE TABLE IF NOT EXISTS `od_order_item_old_v2` ( `order_item_id` int(11) unsigned NOT NULL COMMENT '订单商品id', `order_id` int(11) unsigned zerofill NOT NULL DEFAULT '00000000000' COMMENT '订单号', `order_source_srn` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'od_ebay_transaction表salesrecordnum', `order_source_order_item_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'od_ebay_transaction表id或amazon的OrderItemId', `sku` varchar(255) DEFAULT '' COMMENT '商品编码', `product_name` varchar(255) DEFAULT NULL COMMENT '标题', `photo_primary` text DEFAULT NULL COMMENT '主图', `shipping_price` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '运费', `shipping_discount` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '运费折扣', `price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '下单时价格', `promotion_discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '促销折扣', `ordered_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '下单时候的数量', `quantity` int(11) unsigned NOT NULL DEFAULT '1' COMMENT '需发货的商品数量', `sent_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '已发货数量', `packed_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '已打包数量', `returned_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '退货数量', `invoice_requirement` varchar(50) NOT NULL DEFAULT '' COMMENT '发票要求', `buyer_selected_invoice_category` varchar(50) NOT NULL DEFAULT '' COMMENT '发票种类', `invoice_title` varchar(50) NOT NULL DEFAULT '' COMMENT '发票抬头', `invoice_information` varchar(50) NOT NULL DEFAULT '' COMMENT '发票内容', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `desc` text COMMENT '订单商品备注', `platform_sku` varchar(50) DEFAULT '' COMMENT '平台sku', `is_bundle` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否是捆绑商品,1:是;0:否', `bdsku` varchar(50) NOT NULL DEFAULT '' COMMENT '捆绑sku', `source_item_id` varchar(50) DEFAULT NULL, `order_source_order_id` varchar(50) DEFAULT NULL COMMENT '订单来源平台订单号', `order_source_transactionid` varchar(50) DEFAULT NULL COMMENT '订单来源交易号或子订单号', `order_source_itemid` varchar(50) DEFAULT NULL COMMENT '产品ID listing的唯一标示', `product_attributes` varchar(100) DEFAULT NULL COMMENT '商品属性', `product_unit` varchar(50) DEFAULT NULL COMMENT '单位', `lot_num` int(5) DEFAULT '1' COMMENT '单位数量', `goods_prepare_time` int(2) DEFAULT '1' COMMENT '备货时间', `product_url` varchar(455) DEFAULT NULL COMMENT '商品url', `remark` varchar(255) DEFAULT NULL COMMENT '订单备注', `purchase_price` decimal(10,2) NULL DEFAULT NULL COMMENT '订单商品采购价snapshot', `purchase_price_form` DATETIME NULL DEFAULT NULL COMMENT '订单商品采购价snapshot生效的起始时间', `purchase_price_to` DATETIME NULL DEFAULT NULL COMMENT '订单商品采购价snapshot生效的结束时间', `is_sys_create_sku` char(1) NOT NULL DEFAULT '' COMMENT '空sku是否自动创建系统sku并保存到item表中,Y为是,N或空为不是', `addi_info` text COMMENT '额外信息', `oversea_sku` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '订单级别的海外仓sku', `delivery_status` varchar(20) DEFAULT NULL COMMENT '小老板中该item是否能发货', `platform_status` varchar(255) DEFAULT NULL COMMENT '各个平台对应的item status', `item_source` varchar(20) DEFAULT 'platform' COMMENT '商品来源:platform表示平台商品,local表示本地商品', `manual_status` varchar(20) DEFAULT 'enable' COMMENT '手工操作状态:enable表示启用,disable表示禁用', `root_sku` VARCHAR(255) NULL COMMENT '小老板的root sku' , `declaration` TEXT NULL COMMENT '订单item级别的报关信息' , PRIMARY KEY (`order_item_id`), KEY `idx_oid` (`order_id`), KEY `idx_itemid` (`order_source_order_item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='旧订单商品的数据表' ; CREATE TABLE IF NOT EXISTS `od_order_shipped_old_v2` ( `id` int(11) NOT NULL COMMENT 'ID', `order_id` int(11) NOT NULL COMMENT '订单号', `order_source` varchar(50) NOT NULL DEFAULT '' COMMENT '订单来源 ebay,amazon,aliexpress,custom', `selleruserid` varchar(80) DEFAULT NULL COMMENT '卖家账号', `tracking_number` varchar(50) NOT NULL DEFAULT '' COMMENT '发货单号', `tracking_link` TEXT NOT NULL DEFAULT '' COMMENT '跟踪号查询网址', `shipping_method_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流方式code', `shipping_method_name` varchar(100) DEFAULT NULL COMMENT '物流方式名', `status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '订单标记发货状态,0:未处理,1:成功,2:失败', `sync_to_tracker` char(1) NOT NULL DEFAULT '' COMMENT '是否同步到Tracker模块了,Y为是,默认空白为否', `result` varchar(20) DEFAULT NULL COMMENT '执行结果', `errors` text DEFAULT NULL COMMENT '返回错误', `created` int(11) DEFAULT NULL COMMENT '创建时间', `updated` int(11) DEFAULT NULL COMMENT '修改时间', `lasttime` int(11) DEFAULT NULL COMMENT '标记时间', `return_no` varchar(255) DEFAULT '' COMMENT '物流商返回数据', `shipping_service_id` int(11) DEFAULT NULL COMMENT '通过小老板平台发货 存储运输服务id', `order_source_order_id` varchar(50) DEFAULT NULL COMMENT '订单来源平台订单号', `addtype` varchar(100) DEFAULT NULL COMMENT '物流号来源', `signtype` varchar(10) DEFAULT NULL COMMENT '全部发货all 部分发货part', `description` varchar(255) DEFAULT NULL COMMENT '发货备注', `customer_number` varchar(50) DEFAULT NULL COMMENT '物流商返回的客户单号用户查询物流号', `tracker_status` varchar(30) NOT NULL DEFAULT '' COMMENT 'tracker的物流状态', KEY `idx_oid` (`order_id`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='旧订单标发货的数据表'; DROP TABLE IF EXISTS `dp_enable`; CREATE TABLE `dp_enable` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `selleruserid` varchar(50) NOT NULL DEFAULT '', `platform` varchar(50) DEFAULT 'aliexpress', `enable` int(1) unsigned DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `om_order_message_info`; CREATE TABLE `om_order_message_info` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL COMMENT 'OMS订单号', `order_source_order_id` varchar(50) NOT NULL DEFAULT '' COMMENT '平台 订单号', `order_source` varchar(50) NOT NULL DEFAULT '' COMMENT '平台', `rule_type` varchar(20) DEFAULT NULL COMMENT '匹配类型', `rule_id` int(10) DEFAULT NULL COMMENT '规则ID', `info_id` int(11) unsigned DEFAULT NULL COMMENT '日志ID', `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消息助手日志记录'; DROP TABLE IF EXISTS `om_order_message_template`; CREATE TABLE `om_order_message_template` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `template_name` varchar(50) NOT NULL DEFAULT '' COMMENT '模板名称', `content` text NOT NULL COMMENT '内容', `status` int(1) NOT NULL DEFAULT '1' COMMENT '删除标识', `is_active` int(11) NOT NULL COMMENT '是否启用', `create_time` timestamp NULL DEFAULT '2015-10-01 00:00:00', `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消息助手模板'; DROP TABLE IF EXISTS `check_sync`; CREATE TABLE `check_sync` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `sellerloginid` varchar(100) NOT NULL default '' COMMENT '速卖通登陆账户', `sync_time` int(11) not null DEFAULT '0' COMMENT '最后同步时间', `number` int(5) not null DEFAULT '0' COMMENT '备用字段', PRIMARY KEY (`id`), KEY `sellerloginid` (`sellerloginid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='速卖通手动同步订单最后更新时间表'; CREATE TABLE `ebay_muban_profile`( `id` INT(11) NOT NULL AUTO_INCREMENT, `savename` VARCHAR(32) COMMENT '范本名', `type` VARCHAR(16) COMMENT '模块', `detail` TEXT COMMENT '内容', `created` INT(11) COMMENT '创建时间', `updated` INT(11) COMMENT '修改时间', PRIMARY KEY (`id`), INDEX `savename` (`savename`), INDEX `type` (`type`) ) ENGINE=MYISAM CHARSET=utf8 COLLATE=utf8_general_ci; -- -- Table structure for table `dely_carrier` -- CREATE TABLE IF NOT EXISTS `dely_carrier` ( `carrier_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流商编码', `carrier_name` varchar(100) NOT NULL DEFAULT '' COMMENT '物流商名', `extra_info` text NOT NULL COMMENT '额外信息', `type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '类型:0系统类型1用户类型', `is_active` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '启用:0不启用1启用', `connect_address` varchar(50) NOT NULL DEFAULT '' COMMENT '联系地址', `connect_name` varchar(50) NOT NULL DEFAULT '' COMMENT '联系人姓名', `connect_phone` varchar(50) NOT NULL DEFAULT '' COMMENT '联系人电话', `carrier_remark` varchar(255) NOT NULL DEFAULT '' COMMENT '用户物流商备注信息 ', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `warehouse_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '唯一对应的仓库id', `carrier_type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0:普通物流商 1:海外仓', PRIMARY KEY (`carrier_code`), KEY `idx_typeacti` (`type`,`is_active`), KEY `idx_active` (`is_active`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='物流商表'; CREATE TABLE IF NOT EXISTS `lt_tracking_archive` ( `id` int(11) NOT NULL , `seller_id` varchar(100) DEFAULT NULL COMMENT '平台seller账号名', `order_id` varchar(100) DEFAULT NULL COMMENT '平台 订单号', `track_no` varchar(100) DEFAULT NULL COMMENT '物流号', `status` varchar(30) DEFAULT NULL COMMENT '物流状态,例如:运输途中,查询不到,已签收,到达待取,递送失败', `state` varchar(30) DEFAULT NULL COMMENT '状态分类,表示该状态属于正常还是退回,超时,无法交运。\n这个状态需要根据不同递送方式的容忍度来判断。部分规则客户可以自定义。例如 中国邮政 5天内查不到才算无法交运,5天不到达是正常。而DHL 5天不到就算递送超时了。\n可能值:正常,失败,超时,无法交运', `source` char(1) DEFAULT NULL COMMENT '记录的录入来源,手工录入是M,excel是E,OMS是O', `platform` varchar(30) DEFAULT NULL COMMENT '来源的平台,例如Amazon,SMT,eBay', `parcel_type` tinyint(4) DEFAULT '0' COMMENT '包裹类型, (0)->未知, (1)->小包, (2)->大包, (3)->EMS', `carrier_type` int(11) DEFAULT '0' COMMENT '物流类型代号, \n0=全球邮政,100002=UPS,100001=DHL,100003=Fedex,100004=TNT,100007=DPD,100010=DPD(UK),100011=One World,100005=GLS,100012=顺丰速运,100008=EShipper,100009=Toll,100006=Aramex,190002=飞特物流,190008=云途物流,190011=百千诚物流,190007=俄速递,190009=快达物流,190003=华翰物流,190012=燕文物流,1 /* comment truncated */ /*90013=淼信国际,190014=俄易达,190015=俄速通,190017=俄通收,190016=俄顺达*/', `is_active` char(1) DEFAULT 'Y' COMMENT '是否活动 如果太旧的物流号,客户可以把它关闭跟踪,我们系统也可以定义n日无变化的跟踪放弃定期检查', `batch_no` varchar(100) DEFAULT NULL COMMENT '提交批次 提交方式+按照时间命名, 后续查看跟踪用户可以用这个来维护某天的查询对象以及某次excel上传来的整批物流 \n可能值:M2015-02-25,Excel2015-02-05 08:30', `create_time` date DEFAULT NULL COMMENT '提交日期', `update_time` datetime DEFAULT NULL COMMENT '更新时间', `from_nation` char(2) DEFAULT NULL COMMENT '来源国家', `to_nation` char(2) DEFAULT NULL COMMENT '目的国家', `mark_handled` char(1) DEFAULT 'N', `notified_seller` char(1) DEFAULT 'N' COMMENT '是否已发送邮件通知商家', `notified_buyer` char(1) DEFAULT 'N' COMMENT '是否已发送邮件通知买家,消费者', `shipping_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否该状态下已发信通知', `pending_fetch_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否该状态下已发信通知', `rejected_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否该状态下已发信通知', `received_notified` char(1) NOT NULL DEFAULT 'N' COMMENT '是否在该状态通知过客户了', `ship_by` varchar(100) DEFAULT NULL COMMENT '递送公司,如 DHL,UPS,燕文,4PX', `delivery_fee` decimal(10,4) DEFAULT NULL COMMENT '递送费用CNY,如 3600.0000, 16.4569, 如果是粘贴快递公司的对账单,会有这个信息', `ship_out_date` date DEFAULT NULL COMMENT '快递单日期,如果是粘贴快递公司的对账单,会有这个信息', `total_days` tinyint(4) DEFAULT NULL, `all_event` text COMMENT '所有事件', `first_event_date` date DEFAULT NULL COMMENT '第一个Event的时间,用来判断,当2个物流商同一个物流号都有结果时候,用谁的结果来作准。', `last_event_date` date DEFAULT NULL COMMENT '最后一个物流时间时间,譬如签收时间', `stay_days` tinyint(4) NOT NULL DEFAULT '0' COMMENT '最后时间到现在逗留时间,如果已完成的订单,逗留时间为0即可', `msg_sent_error` char(1) NOT NULL DEFAULT 'N' COMMENT '是否有发信错误,如果有=Y', `from_lang` varchar(50) DEFAULT NULL COMMENT '发货国家的语言', `to_lang` varchar(50) DEFAULT NULL COMMENT '目标国家的语言', `first_track_result_date` date DEFAULT NULL COMMENT '第一次跟踪到结果的日期', `remark` text COMMENT '用户写入的备注,json格式存储', `addi_info` text COMMENT '其他信息', PRIMARY KEY (`id`), UNIQUE KEY `index2` (`track_no`,`order_id`), KEY `index3` (`order_id`), KEY `index4` (`batch_no`), KEY `index5` (`ship_by`), KEY `seller_orderid` (`seller_id`,`order_id`), KEY `status_state` (`status`,`state`), KEY `status_state11` (`state`,`status`), KEY `status_statesss` (`state`,`ship_out_date`,`create_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `lazada_publish_listing`; CREATE TABLE IF NOT EXISTS `lazada_publish_listing` ( `id` int(10) NOT NULL AUTO_INCREMENT, `lazada_uid` int(11) NOT NULL COMMENT 'saas_lazada_user表主键', `platform` VARCHAR( 20 ) NOT NULL DEFAULT 'lazada' COMMENT '所属平台lazada,linio等', `site` varchar(10) NOT NULL COMMENT '卖家站点', `store_info` text NULL COMMENT 'lazada产品目录信息', `base_info` text NULL COMMENT '产品基本信息', `variant_info` text NULL COMMENT '产品变参信息', `image_info` text NULL COMMENT '产品图片信息', `description_info` text NULL COMMENT '产品描述信息', `shipping_info` text NULL COMMENT '产品发货信息', `warranty_info` text NULL COMMENT '产品保证信息', `state` varchar(32) NULL COMMENT '刊登产品的状态。 draft,product_upload,product_uploaded,image_upload,image_uploaded,complete,fail', `status` varchar(64) NULL COMMENT '产品状态的即时描述', `feed_id` varchar(127) NULL COMMENT 'api请求成功的feed id', `feed_info` text NULL COMMENT 'api请求失败原因', `uploaded_product` text NULL COMMENT '在于lazada的产品sku。', `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '该记录创建时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '该记录更新时间', PRIMARY KEY (`id`), KEY `lazada_uid_id` (`lazada_uid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='lazada刊登产品' ; DROP TABLE IF EXISTS `lazada_listing`; CREATE TABLE IF NOT EXISTS `lazada_listing` ( `id` int(11) NOT NULL AUTO_INCREMENT, `lazada_uid_id` int(11) NOT NULL COMMENT 'saas_lazada_user的主键', `platform` varchar(20) NOT NULL, `site` varchar(10) NOT NULL, `SellerSku` varchar(255) NOT NULL, `ParentSku` varchar(255) DEFAULT NULL, `ShopSku` varchar(100) DEFAULT NULL, `Name` varchar(255) DEFAULT NULL, `Quantity` int(11) NOT NULL DEFAULT '0', `Available` int(11) NOT NULL DEFAULT '0', `Price` decimal(10,2) NOT NULL DEFAULT '0.00', `SalePrice` decimal(10,2) NOT NULL DEFAULT '0.00', `SaleStartDate` int(11) NOT NULL DEFAULT '0', `SaleEndDate` int(11) NOT NULL DEFAULT '0', `Status` varchar(10) NOT NULL, `ProductId` varchar(100) DEFAULT NULL COMMENT 'EAN/UPC/ISBN of the product, if it exists', `Url` varchar(255) DEFAULT NULL, `MainImage` varchar(350) DEFAULT NULL, `Variation` varchar(100) DEFAULT NULL, `create_time` int(11) NOT NULL, `update_time` int(11) NOT NULL, `sub_status` varchar(60) DEFAULT NULL COMMENT 'getProduct返回的Status只有active,inactive,deleted。需要增加一个字段来表示rejected,pending等等状态信息', `is_editing` TINYINT( 1 ) NOT NULL DEFAULT '0' COMMENT '是否修改中,等待产品信息回填', `feed_id` varchar(127) DEFAULT NULL COMMENT 'api请求成功的feed id', `error_message` text, `operation_log` text COMMENT '记录客户修改记录,json 数组记录每次操作', `FulfillmentBySellable` int(11) NOT NULL DEFAULT '0' COMMENT 'The available stock in Venture warehouse', `FulfillmentByNonSellable` int(11) NOT NULL DEFAULT '0' COMMENT 'The non-sellable stock in Venture warehouse', `ReservedStock` int(11) NOT NULL DEFAULT '0' COMMENT 'The stock reserved in Seller Center', `RealTimeStock` int(11) NOT NULL DEFAULT '0' COMMENT 'The stock reserved in Shop', `matching_info` text DEFAULT NULL COMMENT '配对待确认信息', PRIMARY KEY (`id`), KEY `lazada_uid_id` (`lazada_uid_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `lazada_listing_v2`; CREATE TABLE IF NOT EXISTS `lazada_listing_v2` ( `id` int(11) NOT NULL AUTO_INCREMENT, `platform` varchar(20) NOT NULL, `site` varchar(10) NOT NULL, `lazada_uid` int(11) NOT NULL COMMENT 'saas_lazada_user的主键', `group_id` varchar(255) NOT NULL COMMENT '取产品其中一个sku', `SellerSku` varchar(255) NOT NULL, `name` varchar(255) NULL COMMENT '为方便搜索,抽出name字段', `PrimaryCategory` int(11) NOT NULL, `Attributes` text NULL, `Skus` text NULL, `sub_status` text NULL COMMENT '产品内各个Sku的getQc状态,或者是filter状态', `lb_status` int(11) NOT NULL DEFAULT '0' COMMENT '小老板定义的各种状态', `error_message` text NULL, `operation_log` text NULL COMMENT '记录客户修改记录,json 数组记录每次操作', `create_time` int(11) NOT NULL, `update_time` int(11) NOT NULL, `matching_info` text DEFAULT NULL COMMENT '配对待确认信息', PRIMARY KEY (`id`), KEY `platform` (`platform`), KEY `site` (`site`), KEY `SellerSku` (`SellerSku`), KEY `lazada_uid` (`lazada_uid`), KEY `group_id_lazada_uid` (`group_id`,`lazada_uid`), KEY `SellerSku_lazada_uid` (`SellerSku`,`lazada_uid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `cs_ticket_message_tags` ( `cs_ticket_tag_id` int(11) NOT NULL AUTO_INCREMENT, `cs_ticket_id` varchar(30) NOT NULL, `tag_id` int(11) NOT NULL, PRIMARY KEY (`cs_ticket_tag_id`), KEY `ticket_tag` (`cs_ticket_id`,`tag_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE `base_fitmentmuban` ( `id` int(10) unsigned NOT NULL auto_increment, `siteid` int(10) NOT NULL default '100', `primarycategory` int(10) default NULL, `name` varchar(100) NOT NULL COMMENT '别名', `itemcompatibilitylist` longtext NOT NULL COMMENT 'fitment', `created` int(11) NOT NULL, `updated` int(11) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `base_fitmenttosku` ( `id` int(10) NOT NULL, `fid` int(10) default NULL, `name` varchar(100) default NULL COMMENT '别名', `sku` varchar(100) NOT NULL COMMENT 'SKU', `addstatus` tinyint(1) default '1' COMMENT '是否允许SKU被自动添加', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `ebay_account_map` ( `id` int(11) NOT NULL AUTO_INCREMENT, `selleruserid` varchar(32) NOT NULL COMMENT 'ebay账号', `paypal` varchar(32) NOT NULL COMMENT 'paypal账号', `desc` varchar(32) DEFAULT NULL COMMENT '备注', `created` int(11) DEFAULT NULL COMMENT '记录创建时间', `updated` int(11) DEFAULT NULL COMMENT '记录修改时间', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `ensogo_variance` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Variance id', `product_id` int(11) NOT NULL COMMENT '这个variance属于某个范本', `parent_sku` varchar(150) NOT NULL COMMENT '父产品sku', `name` varchar(255) DEFAULT NULL, `sku` varchar(250) NOT NULL COMMENT '变参子产品sku', `sync_status` varchar(30) DEFAULT '' COMMENT '同步状态', `internal_sku` varchar(50) DEFAULT '' COMMENT 'Eagle系统的商品sku', `color` varchar(100) DEFAULT '' COMMENT 'wish平台的颜色', `size` varchar(100) DEFAULT '' COMMENT 'wish平台的size', `price` decimal(8,2) NOT NULL COMMENT 'wish平台美元售价', `shipping` decimal(8,2) NOT NULL COMMENT '运费美元', `shipping_time` varchar(50) DEFAULT '' COMMENT '运输时间', `inventory` int(11) NOT NULL COMMENT '库存量', `addinfo` text COMMENT '备用信息,json格式', `enable` char(1) NOT NULL DEFAULT 'Y' COMMENT '商品启用状态(Y=上架,N=下架)', `variance_product_id` varchar(50) DEFAULT '' COMMENT 'wish平台返回的product id', `image_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'SKU专属图片地址', `msrp` decimal(10,2) DEFAULT '0.00' COMMENT '官方建议价', `error_message` text COMMENT 'ensogo平台返回的错误信息', `blocked` tinyint(1) DEFAULT '1' COMMENT '审核是否通过', PRIMARY KEY (`id`), UNIQUE KEY `locateit` (`product_id`,`parent_sku`,`sku`), KEY `syncstatus` (`sync_status`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Enosogo刊登的变参子产品范本信息' AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `ensogo_order` ( `order_id` varchar(255) NOT NULL COMMENT '订单号', `order_time` datetime DEFAULT NULL COMMENT '创建时间', `order_total` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '总金额', `transaction_id` varchar(255) DEFAULT NULL COMMENT '交易号', `city` varchar(255) DEFAULT NULL COMMENT '城市', `country` varchar(255) DEFAULT NULL COMMENT '国家', `name` varchar(255) DEFAULT NULL COMMENT '姓名', `phone_number` varchar(255) DEFAULT NULL COMMENT '电话号码', `state` varchar(255) DEFAULT NULL COMMENT '州/省', `street_address1` text COMMENT '街道地址 1', `street_address2` text COMMENT '街道地址2', `zipcode` varchar(255) DEFAULT NULL COMMENT '邮编', `last_updated` datetime DEFAULT NULL COMMENT '最近更新时间', `shipping_cost` decimal(10,2) DEFAULT '0.00' COMMENT '运费成本', `shipping` decimal(10,2) DEFAULT '0.00' COMMENT '运费', `status` varchar(255) DEFAULT NULL COMMENT '状态', `buyer_id` varchar(50) DEFAULT NULL COMMENT 'buyerid 每个买家固定的', `shipping_provider` varchar(100) DEFAULT NULL COMMENT '物流商', `tracking_number` varchar(50) DEFAULT NULL COMMENT '物流号', `shipped_date` datetime DEFAULT NULL COMMENT '发货时间', `ship_note` text COMMENT '发货备注', `product_id` varchar(255) DEFAULT NULL COMMENT '商品ID', `variant_id` varchar(255) DEFAULT NULL, `variant_name` varchar(255) DEFAULT NULL COMMENT '商品variant name', `quantity` int(11) DEFAULT NULL COMMENT '数量', `price` decimal(10,2) DEFAULT NULL COMMENT '价格', `cost` decimal(10,2) DEFAULT NULL COMMENT '成本', `product_name` varchar(255) DEFAULT NULL COMMENT '商品名称', `product_image_url` text COMMENT '商品图片说明', `days_to_fulfill` int(11) DEFAULT NULL COMMENT '备货周期', `hours_to_fulfill` int(11) DEFAULT NULL COMMENT '备货周期', `sku` varchar(255) DEFAULT NULL COMMENT 'sku', `size` varchar(255) DEFAULT NULL COMMENT '规格', `refunded_by` varchar(255) DEFAULT NULL COMMENT '退款人', `refunded_time` datetime DEFAULT NULL COMMENT '退款时间', `refund_reason` varchar(255) DEFAULT NULL COMMENT '退款原因', `website` char(2) DEFAULT NULL COMMENT '站点', PRIMARY KEY (`order_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ensogo订单'; CREATE TABLE IF NOT EXISTS `ebay_promotion`( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `selleruserid` VARCHAR(100) DEFAULT NULL, `promotionalsaleid` VARCHAR(50) DEFAULT NULL COMMENT '促销规则id', `promotionalsalename` VARCHAR(255) DEFAULT NULL COMMENT '促销名', `action` VARCHAR(50) DEFAULT NULL COMMENT '对规则的操作,增删改查', `discounttype` VARCHAR(50) DEFAULT NULL COMMENT '打折对象', `discountvalue` FLOAT(10,2) DEFAULT NULL COMMENT '折扣', `promotionalsaleendtime` INT(11) DEFAULT NULL COMMENT '结束时间', `promotionalsalestarttime` INT(11) DEFAULT NULL COMMENT '开始时间', `promotionalsaletype` VARCHAR(50) DEFAULT NULL COMMENT '促销类型', `status` VARCHAR(50) DEFAULT NULL COMMENT '状态', `created` INT(11) DEFAULT NULL, `updated` INT(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MYISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `ensogo_product` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `brand` varchar(50) DEFAULT NULL COMMENT '品牌', `type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '商品类型 1在线商品 2小老板刊登商品', `status` varchar(20) DEFAULT 'uploading' COMMENT '状态:error,editing, uploading, complete', `lb_status` int(11) DEFAULT '1' COMMENT '小老板刊登商品状态 1待发布 2平台审核中 3发布成功 4发布失败 5标记删除 6在线商品', `site_id` int(5) DEFAULT NULL, `parent_sku` varchar(255) NOT NULL DEFAULT '' COMMENT '如果是变参的,填入老爸SKU', `variance_count` int(11) NOT NULL DEFAULT '1' COMMENT '该范本包含的变参子产品数量', `name` varchar(255) NOT NULL COMMENT '产品名称', `tags` varchar(255) NOT NULL, `upc` varchar(50) DEFAULT NULL COMMENT 'UPC,EAN,barcode', `landing_page_url` text COMMENT '自营网店的URL', `internal_sku` varchar(255) DEFAULT '' COMMENT '小老板内部商品SKU', `category_id` int(4) DEFAULT NULL COMMENT 'ensogo分类', `msrp` decimal(10,2) DEFAULT '0.00' COMMENT '原售价,被划掉的', `shipping_time` varchar(250) DEFAULT '' COMMENT 'just the estimated days,e.g. "3-7"', `main_image` text COMMENT '主图片,必填', `extra_image_1` text, `extra_image_2` text, `extra_image_3` text, `extra_image_4` text, `extra_image_5` text, `extra_image_6` text, `extra_image_7` text, `extra_image_8` text, `extra_image_9` text, `extra_image_10` text, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `description` text, `capture_user_id` tinyint(4) NOT NULL COMMENT '操作者ID', `ensogo_product_id` varchar(50) DEFAULT '' COMMENT 'Wish 平台的product id,用于update一个product', `error_message` text COMMENT 'Wish返回的错误信息', `addinfo` varchar(255) DEFAULT '' COMMENT '备用信息,json格式', `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '商品价格', `inventory` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品库存', `shipping` decimal(8,2) DEFAULT '0.00' COMMENT '运费美元', `number_saves` int(11) DEFAULT '0' COMMENT '商品WISH平台收藏数', `number_sold` int(11) DEFAULT '0' COMMENT '商品WISH平台销售数', `is_enable` tinyint(4) NOT NULL DEFAULT '1' COMMENT '变种商品是否存在下架商品 1不存在 2存在', `variant_name` varchar(255) DEFAULT NULL COMMENT '第一个变种name', `json_info` text COMMENT '其他信息', `request_id` varchar(255) DEFAULT NULL COMMENT 'ensogo平台返回查询id', `blocked` tinyint(1) DEFAULT '1' COMMENT '是否通过审核', `sale_type` tinyint(1) unsigned NOT NULL DEFAULT '2' COMMENT '售卖形式: 1单品 2多变种', PRIMARY KEY (`id`), KEY `site_id` (`site_id`), KEY `parent_sku` (`parent_sku`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `aliexpress_listing_detail` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', `productid` varchar(20) NOT NULL COMMENT '在线上id', `categoryid` varchar(20) NOT NULL COMMENT '所属目录id', `selleruserid` varchar(20) DEFAULT NULL COMMENT '卖家账号', `product_price` float(10,2) DEFAULT NULL COMMENT '售价', `product_gross_weight` float(10,3) DEFAULT NULL COMMENT '毛重kg', `product_length` int(10) DEFAULT NULL COMMENT '长cm', `product_width` int(10) DEFAULT NULL COMMENT '宽cm', `product_height` int(10) DEFAULT NULL COMMENT '高cm', `currencyCode` varchar(5) DEFAULT NULL COMMENT '货币', `aeopAeProductPropertys` text COMMENT '商品的类目属性', `sku_code` text COMMENT 'sku编号记录', `aeopAeProductSKUs` text COMMENT '商品的SKU信息', `detail` text COMMENT '详细描述(支持html)', `product_groups` varchar(200) DEFAULT NULL COMMENT '产品分组,支持多个,用逗号分隔', `product_unit` varchar(100) DEFAULT NULL COMMENT '商品单位编号', `package_type` tinyint(1) DEFAULT '0' COMMENT '销售方式 0-false 非打包销售 1-true', `reduce_strategy` tinyint(1) DEFAULT NULL COMMENT '库存减扣方式 1-下单减库存 2-支付减库存', `delivery_time` tinyint(2) DEFAULT NULL COMMENT '商品备货期 1-60天', `bulk_order` int(10) DEFAULT NULL COMMENT '批发最小数量 。取值范围2-100000。', `bulk_discount` tinyint(2) DEFAULT NULL COMMENT '批发折扣', `isPackSell` smallint(6) DEFAULT '0' COMMENT '是否自定义称重 0-false 1-true', `baseUnit` smallint(4) DEFAULT NULL COMMENT '购买几件以内不增加运费', `addUnit` smallint(4) DEFAULT NULL COMMENT '每增加件数', `addWeight` varchar(10) DEFAULT NULL COMMENT '对应增加的重量', `promise_templateid` int(10) DEFAULT NULL COMMENT '服务模板id', `wsValidNum` tinyint(2) DEFAULT NULL COMMENT '产品有效期14/30天', `listen_id` int(10) DEFAULT NULL COMMENT '未发布,保存状态下的商品主表ID', `lot_num` int(10) DEFAULT '1' COMMENT '每包件数。 打包销售情况,lotNum>1,非打包销售情况,lotNum=1', `product_mv` varchar(200) DEFAULT NULL COMMENT '介绍视频地址', `is_bulk` tinyint(1) DEFAULT '0' COMMENT '是否支持批发价 1-true 0-flase', `matching_info` text DEFAULT NULL COMMENT '配对待确认信息', PRIMARY KEY (`id`), KEY `productid` (`productid`), KEY `selleruserid` (`selleruserid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `od_order_goods` ( `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '自增主键', `order_source` varchar(20) DEFAULT NULL COMMENT '销售平台来源', `order_id` int(11) NOT NULL COMMENT '小老板单号', `order_source_order_id` varchar(50) DEFAULT NULL COMMENT '销售平台订单号', `order_item_id` int(11) NOT NULL COMMENT 'od_order_item_v2主键', `order_source_itemid` varchar(50) DEFAULT NULL COMMENT '平台商品刊登号或者商品号', `photo_primary` varchar(255) DEFAULT NULL COMMENT '主图地址', `product_attributes` varchar(255) DEFAULT NULL COMMENT '物品属性可用于配货', `product_name` varchar(255) DEFAULT NULL COMMENT '标题或者商品配货名字', `order_item_sku` varchar(255) DEFAULT NULL COMMENT '小老板订单交易中的SKU', `order_item_quantity` int(5) DEFAULT NULL, `sku` varchar(255) DEFAULT NULL COMMENT '实际SKU', `quantity` int(5) DEFAULT NULL COMMENT '实际数量', `price` decimal(8,2) DEFAULT NULL COMMENT '成本参考单价用于计算毛利', `sold_time` datetime DEFAULT NULL, `paid_time` datetime DEFAULT NULL, `selleruserid` varchar(50) DEFAULT NULL COMMENT '卖家账号', `source_buyer_user_id` varchar(100) DEFAULT NULL COMMENT '买家账号', key(`order_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `od_order_systags_mapping` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', `tag_code` varchar(50) NOT NULL COMMENT 'tag的代码', `order_id` int(11) NOT NULL COMMENT 'od_order_v2 中的order_id', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单模块系统标签关联表'; CREATE TABLE IF NOT EXISTS `carrier_use_record`( `id` int(11) NOT NULL AUTO_INCREMENT, `carrier_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流商代码', `is_active` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0:未启用 1:已启用', `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `is_del` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0:未删除 1:已删除', `carrier_type` tinyint(1) default 0 not null COMMENT '0:为货代 1:海外仓', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='user所使用的物流商'; CREATE TABLE IF NOT EXISTS `carrier_user_address`( `id` int(11) NOT NULL AUTO_INCREMENT, `carrier_code` varchar(50) NOT NULL DEFAULT '' COMMENT '物流商代码,当type为1时该值为空', `type` tinyint(1) not null default '0' COMMENT '0:物流所使用的地址 1:常用地址 2:回邮地址', `address_name` varchar(100) not null default '' COMMENT '该地址简称', `is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:未删除 1:已删除', `is_default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:不为默认 1:设置为默认', `address_params` text COMMENT '发货地址/揽货地址 数组', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='user所使用的揽收或发货地址'; CREATE TABLE IF NOT EXISTS `warehouse_matching_rule` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `rule_name` varchar(100) NOT NULL COMMENT '仓库匹配规则名', `rules` text COMMENT '规则选择项', `warehouse_id` int(10) unsigned DEFAULT NULL COMMENT '仓库ID', `priority` int(3) DEFAULT 1 COMMENT '优先级', `is_active` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否启用', `created` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间', `updated` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE `ensogo_variance_countries` ( `id` int(11) NOT NULL AUTO_INCREMENT, `variance_id` int(11) DEFAULT NULL COMMENT 'ENSOGO变种ID', `product_id` int(11) DEFAULT NULL COMMENT 'ENSOGO商品ID', `country_code` varchar(100) NOT NULL DEFAULT '0' COMMENT 'SMT订单号', `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '订单变更时间', `shipping` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '推送消息ID', `msrp` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '推送订单类型', `status` int(11) NOT NULL COMMENT '状态信息 1未发布 2已发布', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_time` datetime DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`id`), KEY `variance_id` (`variance_id`), KEY `product_id` (`product_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `priceminister_product_list` ( `id` int(11) NOT NULL AUTO_INCREMENT, `productid` varchar(30) DEFAULT NULL COMMENT 'PM内部prid id,订单获取不到的', `seller_id` varchar(255) NOT NULL COMMENT 'prod对应的卖家账号', `alias` varchar(255) DEFAULT NULL, `headline` text COMMENT '产品名', `caption` varchar(255) DEFAULT NULL COMMENT 'brand?', `topic` varchar(255) DEFAULT NULL, `offercounts` text COMMENT 'json', `bestprices` text COMMENT 'json', `url` text COMMENT '商品url', `image` text COMMENT '商品img', `barcode` varchar(100) DEFAULT NULL COMMENT 'EAN', `partnumber` varchar(255) DEFAULT NULL COMMENT '卖家sku', `reviews` text, `breadcrumbselements` text COMMENT 'json,搜索信息', PRIMARY KEY (`id`), KEY `seller_id & ean` (`seller_id`,`barcode`), KEY `seller_id & sku` (`seller_id`,`partnumber`), KEY `seller_id & product_id` (`seller_id`,`productid`), KEY `productid` (`productid`), KEY `barcode` (`barcode`), KEY `sku` (`partnumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `cdiscount_offer_terminator` ( `id` int(11) NOT NULL AUTO_INCREMENT, `addi_info` text, `uid` int(10) NOT NULL, `product_id` varchar(30) NOT NULL, `create` datetime DEFAULT NULL COMMENT 'create time', `is_parent_product` char(1) DEFAULT 'N' COMMENT 'if is a variant parent', `bestseller_name` varchar(100) DEFAULT NULL, `bestseller_price` decimal(8,2) DEFAULT NULL, PRIMARY KEY (`id`), KEY `uid+product_id` (`uid`,`product_id`), KEY `uid` (`uid`), KEY `product_id` (`product_id`), KEY `bestseller_name` (`bestseller_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `cdiscount_offer_terminator_daily` ( `id` int(11) NOT NULL AUTO_INCREMENT, `product_id` varchar(50) NOT NULL, `seller_product_id` varchar(100) NOT NULL COMMENT '卖家sku', `seller_id` varchar(100) NOT NULL COMMENT '卖家店铺登录名', `shop_name` varchar(100) DEFAULT NULL COMMENT '卖家店铺名', `name` varchar(1000) DEFAULT NULL COMMENT '商品名称', `img` text COMMENT '商品图片', `product_url` text COMMENT '商品链接', `date` date NOT NULL COMMENT '统计日期', `create_time` datetime DEFAULT NULL, `type` char(2) NOT NULL COMMENT '关注类型:H,F,N,I', `ever_been_surpassed` char(2) DEFAULT NULL COMMENT '是否曾经被挤掉bestseller位置', `change_history` text COMMENT '统计日内bestseller变动记录', PRIMARY KEY (`id`), KEY `product_id` (`product_id`), KEY `seller_id` (`seller_id`), KEY `shop_name` (`shop_name`), KEY `date` (`date`), KEY `type` (`type`), KEY `ever_been_surpassed` (`ever_been_surpassed`), KEY `seller_product_id` (`seller_product_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3182 ; CREATE TABLE `goodscollect_all` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL COMMENT '采集商品的标题', `description` longtext COMMENT '采集商品的内容', `mainimg` varchar(255) DEFAULT NULL COMMENT '采集商品的主图', `img` text COMMENT '采集商品的图片数据', `link` varchar(255) NOT NULL COMMENT '采集商品的原链接', `platform` varchar(55) NOT NULL COMMENT '采集商品的来源平台', `price` float DEFAULT NULL COMMENT '采集商品的价格', `toplatform` text COMMENT '商品认领到的平台', `wish` tinyint(1) NOT NULL DEFAULT '0', `ebay` tinyint(1) NOT NULL DEFAULT '0', `lazada` tinyint(1) NOT NULL DEFAULT '0', `ensogo` tinyint(1) NOT NULL DEFAULT '0', `createtime` int(11) NOT NULL COMMENT '采集商品采集时间', `customcode` text COMMENT '备用字段', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; CREATE TABLE `goodscollect_ebay` ( `mubanid` int(10) NOT NULL AUTO_INCREMENT, `uid` int(10) DEFAULT NULL, `siteid` int(5) DEFAULT NULL, `itemtitle` varchar(100) DEFAULT NULL, `listingtype` varchar(20) DEFAULT NULL, `location` char(128) DEFAULT NULL, `listingduration` char(10) DEFAULT NULL, `sku` varchar(255) DEFAULT NULL, `paypal` varchar(255) DEFAULT NULL, `selleruserid` varchar(200) DEFAULT NULL, `outofstockcontrol` tinyint(1) DEFAULT NULL, `isvariation` tinyint(1) DEFAULT NULL, `quantity` int(5) DEFAULT NULL, `startprice` decimal(10,2) DEFAULT NULL, `buyitnowprice` decimal(10,2) DEFAULT NULL, `shippingdetails` text, `mainimg` varchar(255) DEFAULT NULL, `desc` varchar(100) DEFAULT NULL, `createtime` int(11) DEFAULT NULL, `updatetime` int(11) DEFAULT NULL, PRIMARY KEY (`mubanid`), KEY `title` (`itemtitle`), KEY `sku` (`sku`), KEY `siteid` (`siteid`), KEY `listingduration` (`listingduration`), KEY `listingtype` (`listingtype`), KEY `quantity` (`quantity`), KEY `selleruserid` (`selleruserid`), KEY `isvariation` (`isvariation`), KEY `paypal` (`paypal`), KEY `outofstockcontrol` (`outofstockcontrol`), KEY `desc` (`desc`) ) ENGINE=MyISAM AUTO_INCREMENT=32 DEFAULT CHARSET=utf8; CREATE TABLE `goodscollect_ebay_detail` ( `mubanid` int(10) NOT NULL, `epid` varchar(128) DEFAULT NULL COMMENT 'epidID', `isbn` varchar(128) DEFAULT NULL COMMENT 'isbnID', `upc` varchar(128) DEFAULT NULL COMMENT 'upcID', `ean` varchar(128) DEFAULT NULL COMMENT 'eanID', `primarycategory` int(10) DEFAULT NULL COMMENT '主类目', `secondarycategory` int(10) DEFAULT NULL COMMENT '子类目', `storecategoryid` bigint(20) DEFAULT NULL COMMENT '店铺主类目', `storecategory2id` bigint(20) DEFAULT NULL COMMENT '店铺子类目', `lotsize` int(5) DEFAULT NULL COMMENT '每份件数', `itemdescription` longtext COMMENT '描述', `imgurl` text COMMENT '图片信息', `listingenhancement` text COMMENT '格式', `hitcounter` varchar(20) DEFAULT NULL COMMENT '计数器', `paymentmethods` text COMMENT '支付信息', `postalcode` varchar(20) DEFAULT NULL COMMENT '邮编', `country` varchar(10) DEFAULT NULL COMMENT '国家', `region` int(10) DEFAULT NULL COMMENT '区域', `template` varchar(60) DEFAULT NULL COMMENT '模板风格', `basicinfo` int(10) DEFAULT NULL COMMENT '信息模板', `gallery` varchar(200) DEFAULT NULL, `dispatchtime` int(10) DEFAULT NULL COMMENT '包裹处理时间', `return_policy` text COMMENT '退款信息', `conditionid` int(11) DEFAULT NULL COMMENT '特征是否是二手的', `variation` longtext COMMENT '多属性', `specific` text COMMENT '细节值,如color,size', `bestoffer` tinyint(1) DEFAULT '0' COMMENT '是否议价', `bestofferprice` decimal(10,2) DEFAULT NULL COMMENT '自动议价价格', `minibestofferprice` decimal(10,2) DEFAULT NULL COMMENT '自动拒绝议价价格', `buyerrequirementdetails` text COMMENT '买家要求', `autopay` tinyint(1) DEFAULT '0' COMMENT '是否要求立即支付', `secondoffer` decimal(10,0) DEFAULT NULL COMMENT '二次交易', `privatelisting` tinyint(1) DEFAULT '0' COMMENT '是否私人刊登', `itemtitle2` varchar(255) DEFAULT NULL COMMENT '子标题', `vatpercent` decimal(10,2) DEFAULT NULL COMMENT '税', `crossbordertrade` tinyint(1) DEFAULT '0', `crossselling` int(11) DEFAULT NULL COMMENT '交叉销售的范本ID', `createtime` int(11) DEFAULT NULL, `updatetime` int(11) DEFAULT NULL, `crossselling_two` int(10) DEFAULT NULL, PRIMARY KEY (`mubanid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `aliexpress_detail_module` ( `id` bigint(18) NOT NULL, `display_content` text, `module_contents` text, `status` varchar(50) DEFAULT NULL, `name` varchar(100) DEFAULT NULL, `type` varchar(100) DEFAULT NULL, `ali_member_id` varchar(100) DEFAULT NULL, `sellerloginid` varchar(100) DEFAULT NULL, KEY `sellerloginid` (`sellerloginid`) USING BTREE, KEY `id` (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `aliexpress_group_info` ( `group_id` bigint(15) NOT NULL COMMENT '分组ID', `group_name` varchar(100) NOT NULL COMMENT '分组名', `parent_group_id` bigint(15) NOT NULL DEFAULT '0' COMMENT '父分组ID ', `selleruserid` varchar(100) NOT NULL, KEY `group_id` (`group_id`) USING BTREE, KEY `parent_group_id` (`parent_group_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `common_declared_info` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', `custom_name` varchar(100) COMMENT '自定义名称', `ch_name` varchar(100) COMMENT '中文报关名', `en_name` varchar(100) COMMENT '英文报关名', `declared_value` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '申报金额', `declared_weight` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '申报重量', `detail_hs_code` varchar(50) DEFAULT NULL COMMENT '海关编码', `is_default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否默认 1表示默认,0表示不默认', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='常用报关信息表'; CREATE TABLE IF NOT EXISTS `edm_sent_history` ( `id` int(11) NOT NULL AUTO_INCREMENT, `act_name` varchar(255) NOT NULL COMMENT '调用的模块', `module_key` varchar(255) NOT NULL COMMENT '模块对应的key或id', `send_to` varchar(255) NOT NULL COMMENT '发给谁', `send_from` varchar(255) NOT NULL COMMENT '通过哪个邮箱发送', `subject` text, `status` int(11) NOT NULL DEFAULT '0' COMMENT '0:未处理;1:成功;2:失败', `error_message` text, `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `addi_info` text COMMENT 'json:subject、body、from_nane.....', PRIMARY KEY (`id`), KEY `act_name` (`act_name`), KEY `module_key` (`module_key`), KEY `send_to` (`send_to`), KEY `send_from` (`send_from`), KEY `status` (`status`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `od_order_relation` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '关联id', `father_orderid` int(11) NOT NULL COMMENT '父订单小老板订单号', `son_orderid` int(11) NOT NULL COMMENT '子订单小老板订单号', `type` varchar(10) NOT NULL DEFAULT '' COMMENT '关联类型merge,split', PRIMARY KEY (`id`) ) ENGINE=InnoDB COMMENT='订单关联表' ; CREATE TABLE IF NOT EXISTS `db_sales_daily` ( `id` int(11) NOT NULL AUTO_INCREMENT, `thedate` date NOT NULL, `platform` varchar(255) NOT NULL COMMENT 'CDISCOUNT,EBAY,etc', `seller_id` varchar(255) NOT NULL, `order_type` varchar(50) DEFAULT NULL COMMENT '平台订单类型,如amazon的AFN/MFN,CD的FBC/normal', `sales_count` int(11) NOT NULL, `sales_amount_original_currency` decimal(13,2) NOT NULL, `original_currency` char(3) NOT NULL, `sales_amount_USD` decimal(13,2) NOT NULL, `profit_cny` decimal(13,2) NOT NULL DEFAULT '0.00' COMMENT '利润,人民币计算', `use_module_type` varchar(20) NULL DEFAULT NULL COMMENT '使用者模块', PRIMARY KEY (`id`), UNIQUE KEY `dfsf` (`thedate`,`platform`,`seller_id`,`order_type`, `use_module_type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='每个平台每个店铺每天生产一条记录' AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `wh_3rd_party_stockage` ( `id` int(11) NOT NULL AUTO_INCREMENT, `warehouse_id` int(11) NOT NULL COMMENT '海外仓仓库编号,对应海外仓库表', `platform_code` varchar(255) NOT NULL DEFAULT '' COMMENT '平台sku,也可以是库存编码', `sku` varchar(255) NOT NULL DEFAULT '' COMMENT '本地sku', `seller_sku` varchar(255) NOT NULL COMMENT '平台上面显示用户自编的sku', `current_inventory` int(11) NOT NULL DEFAULT '0' COMMENT '当前库存', `adding_inventory` int(11) NOT NULL DEFAULT '0' COMMENT '在途补货库存', `reserved_inventory` int(11) NOT NULL DEFAULT '0' COMMENT '占用库存', `usable_inventory` int(11) NOT NULL DEFAULT '0' COMMENT '可用库存', `title` varchar(255) NOT NULL DEFAULT '' COMMENT '产品名称', `suggest_inventory` int(11) NOT NULL DEFAULT '0' COMMENT '建议库存', `biweekly_sold_qty` int(11) NOT NULL DEFAULT '0' COMMENT '2周销量', `img_url` int(11) DEFAULT NULL COMMENT '图片链接', `account_id` varchar(255) NOT NULL DEFAULT '' COMMENT '海外仓账号编号,对应物流账号表', `addinfo` varchar(255) NOT NULL DEFAULT '', `marketplace_id` VARCHAR(50) NOT NULL DEFAULT '' COMMENT 'Amazon站点Id', `not_usable_inventory` int(11) NOT NULL DEFAULT '0' COMMENT '不可售库存', PRIMARY KEY (`id`), KEY `sku` (`warehouse_id`,`sku`), KEY `sku_2` (`sku`), KEY `seller_sku` (`seller_sku`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='海外仓的产品库存' AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `order_declared_info` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', `platform` varchar(50) COMMENT '对应平台', `itemID` VARCHAR(255) COMMENT '平台的Item ID', `sku` VARCHAR(255) COMMENT 'SKU', `ch_name` varchar(100) COMMENT '中文报关名', `en_name` varchar(100) COMMENT '英文报关名', `declared_value` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '申报金额', `declared_weight` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '申报重量', `detail_hs_code` varchar(50) DEFAULT NULL COMMENT '海关编码', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单级别报关信息' AUTO_INCREMENT=1; CREATE TABLE IF NOT EXISTS `listing_move_log` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `item_id` VARCHAR(64) NULL DEFAULT NULL COMMENT '商品编号', `sku` varchar(128) DEFAULT NULL COMMENT '主SKU', `item_title` varchar(255) DEFAULT NULL COMMENT '商品标题', `platform_from` varchar(50) NOT NULL COMMENT '搬家源平台', `platform_to` varchar(50) NOT NULL COMMENT '搬家目标平台', `shop_from` varchar(128) NOT NULL COMMENT '搬家源商店(或源卖家)', `shop_to` varchar(128) NOT NULL COMMENT '搬家目标商店(或目标卖家)', `move_count` int(11) NOT NULL DEFAULT '1' COMMENT '添加次数', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; CREATE TABLE IF NOT EXISTS `amazon_feedback_info` ( `feedback_id` int(11) NOT NULL AUTO_INCREMENT, `create_time` int(11) unsigned NOT NULL DEFAULT '0', `rating` int(11) NOT NULL DEFAULT '0' COMMENT '级别,几星', `feedback_comments` text NOT NULL COMMENT 'feedback 内容', `arrived_on_time` int(1) NOT NULL DEFAULT '1' COMMENT '已准时抵达', `item_as_described` int(1) NOT NULL DEFAULT '1' COMMENT '与描述相符的商品', `customer_service` int(1) NOT NULL DEFAULT '1' COMMENT '客户服务', `order_source_order_id` varchar(100) NOT NULL COMMENT '平台订单号', `rater_email` varchar(100) NOT NULL COMMENT '评价人电子邮箱', `rater_role` varchar(10) DEFAULT NULL COMMENT '评价者身份', `respond_url` varchar(250) DEFAULT NULL COMMENT '回复url', `resolve_url` varchar(250) DEFAULT NULL COMMENT '解决url', `message_from_amazon` text COMMENT '亚马逊消息', `rating_status` int(1) NOT NULL DEFAULT '0' COMMENT '是否处理差评', `marketplace_id` varchar(50) NOT NULL COMMENT '站点Id', `merchant_id` varchar(50) NOT NULL COMMENT '账号Id', PRIMARY KEY (`feedback_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=149 ; CREATE TABLE IF NOT EXISTS `amazon_review_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `review_id` varchar(50) DEFAULT NULL, `merchant_id` varchar(50) NOT NULL COMMENT '账号Id', `marketplace_id` varchar(50) NOT NULL COMMENT '站点Id', `asin` varchar(50) NOT NULL, `create_time` int(11) unsigned NOT NULL DEFAULT '0', `rating` decimal(2,1) NOT NULL COMMENT '级别,几星', `title` varchar(255) NOT NULL COMMENT '标题', `author` varchar(50) NOT NULL COMMENT '留言者', `format_strip` varchar(255) NOT NULL DEFAULT '1' COMMENT '属性', `verified_purchase` varchar(20) NOT NULL COMMENT '是否确认购买', `review_comments` text COMMENT 'review内容', `order_source_order_id` varchar(50) COMMENT '订单号', `cust_id` varchar(50) COMMENT '客户id', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1931 ; CREATE TABLE IF NOT EXISTS `cs_mail_quest_list` ( `id` int(11) NOT NULL AUTO_INCREMENT, `quest_template_id` int(11) NOT NULL COMMENT '对应的模板id', `quest_number` varchar(100) NOT NULL COMMENT '生成的任务批次,templateId-time格式', `platform` varchar(100) NOT NULL, `seller_id` varchar(255) NOT NULL, `site_id` varchar(100) NOT NULL, `order_source_order_id` varchar(100) NOT NULL, `status` varchar(20) NOT NULL COMMENT '邮件状态:P(pending)-待发送,S(submit)-提交处理中,C(complete)-发送完成,F(failed)-发送失败,CF-创建失败', `priority` int(1) DEFAULT '5' COMMENT '优先级1最高,5最低', `mail_from` varchar(255) NOT NULL COMMENT '发件人', `mail_to` varchar(255) NOT NULL COMMENT '收件人', `consignee` varchar(255) DEFAULT NULL COMMENT '收件人名称', `subject` varchar(1000) NOT NULL COMMENT '邮件标题', `body` text COMMENT '邮件内容', `pending_send_time_location` datetime DEFAULT NULL COMMENT '预计发送时间-本地', `pending_send_time_consignee` datetime DEFAULT NULL COMMENT '预计发送时间-收件人时区', `sent_time_location` datetime DEFAULT NULL COMMENT '发送成功时间-本地', `sent_time_consignee` datetime DEFAULT NULL COMMENT '发送成功时间-收件人时区', `last_sent_time` datetime DEFAULT NULL COMMENT '最后一次尝试发送的时间', `created_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '重发次数', `addi_info` text, PRIMARY KEY (`id`), KEY `quest_template_id` (`quest_template_id`,`quest_number`,`platform`,`seller_id`,`site_id`,`order_source_order_id`,`status`,`priority`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `cs_quest_template` ( `id` int(11) NOT NULL AUTO_INCREMENT, `platform` varchar(100) NOT NULL, `seller_id` varchar(255) NOT NULL COMMENT 'amazon为merchant_id', `site_id` varchar(255) NOT NULL COMMENT 'amazon为marketplace_id', `name` varchar(255) NOT NULL, `status` varchar(100) NOT NULL DEFAULT 'active', `auto_generate` int(11) NOT NULL DEFAULT '0' COMMENT '是否自动生成任务:0不自动,1自动', `subject` varchar(1000) DEFAULT NULL, `contents` text, `for_order_type` varchar(100) DEFAULT NULL COMMENT '适用于什么类型订单,如FBA,FBM', `send_after_order_created_days` int(11) DEFAULT '1' COMMENT '订单创建后多少天符合规规则', `pending_send_time` varchar(2) DEFAULT '9' COMMENT '发送时间段', `order_in_howmany_days` int(11) NOT NULL COMMENT '订单创建后几天后符合规则', `can_send_when_reviewed` int(11) NOT NULL DEFAULT '0' COMMENT '是否有review也继续发', `can_send_when_feedbacked` int(11) NOT NULL DEFAULT '0' COMMENT '是否有feedback也继续发', `can_shen_when_contacted` int(11) NOT NULL DEFAULT '0' COMMENT '是否有邮件来往过也继续发', `filter_order_item_type` varchar(100) DEFAULT 'non' COMMENT '按什么方式筛选订单商品。in或者out或者non', `order_item_key_type` varchar(100) DEFAULT NULL COMMENT 'item key的类型筛选,key的类型(sku;platform_item_id)', `order_item_keys` varchar(500) DEFAULT NULL COMMENT '要筛选的item keys', `send_one_pre_howmany_days` int(11) NOT NULL DEFAULT '7' COMMENT '同一个买家最多每多少天才发一封', `can_send_to_blacklist_buyer` int(11) DEFAULT '0' COMMENT '是否对黑名单里面的买家也发', `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `last_generated_time` datetime DEFAULT NULL, `last_generated_log` text COMMENT '上一次生成任务的结果log', `addi_info` text, PRIMARY KEY (`id`), UNIQUE KEY `seller_template` (`platform`,`seller_id`,`site_id`,`name`), KEY `can_send_when` (`can_send_when_reviewed`,`can_send_when_feedbacked`,`can_shen_when_contacted`), KEY `auto_generate` (`auto_generate`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `cs_seller_email_address` ( `id` int(11) NOT NULL AUTO_INCREMENT, `email_address` varchar(255) NOT NULL, `platform` varchar(100) DEFAULT NULL, `seller_id` varchar(255) NOT NULL COMMENT 'amazon为merchant_id', `site_id` varchar(255) NOT NULL COMMENT 'amazon为marketplace_id', `create_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL, `status` varchar(100) DEFAULT NULL, `sent_count` int(11) NOT NULL DEFAULT '0' COMMENT '累计发送邮件数', `addi_info` text, PRIMARY KEY (`id`), UNIQUE KEY `seller_store` (`platform`,`seller_id`,`site_id`), KEY `email_address` (`email_address`,`status`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `amazon_order_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` int(11) unsigned DEFAULT NULL, `order_time` int(11) unsigned DEFAULT NULL COMMENT '订单日期', `order_id` varchar(50) DEFAULT NULL COMMENT 'amazon单号', `cust_id` varchar(50) DEFAULT NULL COMMENT '客户id', `marketplace_id` varchar(50) NOT NULL COMMENT '站点Id', `merchant_id` varchar(50) NOT NULL COMMENT '账号Id', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=149 COMMENT='Amazon后台 Order 的个别信息'; CREATE TABLE IF NOT EXISTS `cms_notification_readed` ( `id` int(11) NOT NULL AUTO_INCREMENT, `notification_id` int(11) NOT NULL COMMENT '消息id', `uid` int(11) NOT NULL, `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=164 COMMENT='消息是否已读对应关系表'; CREATE TABLE IF NOT EXISTS `amazon_listing` ( `id` int(10) NOT NULL AUTO_INCREMENT, `merchant_id` varchar(100) NOT NULL, `marketplace_id` varchar(100) NOT NULL, `marketplace_short` varchar(2) NOT NULL, `asin` varchar(255) NOT NULL, `product_id` VARCHAR(255) DEFAULT NULL, `sku` varchar(100) DEFAULT NULL, `ean` varchar(100) DEFAULT NULL, `upc` varchar(100) DEFAULT NULL, `title` text, `description` text COMMENT '商品描述', `price` decimal(15,2) NOT NULL DEFAULT '0.00', `images_src` text COMMENT '原始图片url,json格式', `stock` int(11) DEFAULT '0' COMMENT '线上库存', `condition` int(2) DEFAULT NULL COMMENT '商品成色?', `currency` varchar(3) DEFAULT NULL COMMENT '币种', `images` text COMMENT 'json格式', `detail_page_url` text, `binding` varchar(100) DEFAULT NULL, `brand` varchar(100) DEFAULT NULL, `catalog_number` varchar(100) DEFAULT NULL, `cat_str` text, `color` varchar(100) DEFAULT NULL, `size` varchar(100) DEFAULT NULL, `feature` text, `label` varchar(100) DEFAULT NULL, `publisher` varchar(100) DEFAULT NULL, `studio` varchar(100) DEFAULT NULL, `manufacturer` varchar(100) DEFAULT NULL, `model` varchar(100) DEFAULT NULL, `mpn` varchar(100) DEFAULT NULL, `part_number` varchar(100) DEFAULT NULL, `childrens` text COMMENT '子商品asin,json格式', `parent_asin` varchar(255) DEFAULT NULL COMMENT '父ASIN', `relationships` text COMMENT '关系信息json', `product_group` varchar(200) DEFAULT NULL, `product_type_name` varchar(200) DEFAULT NULL, `status` varchar(100) NOT NULL COMMENT '在售状态等', `get_info_step` int(2) NOT NULL DEFAULT '0' COMMENT '获取信息的进行步骤。0:通过report获取了基本信息;1:通过接口获取了详细信息;2上传并获取了本地图片url', `report_info` text COMMENT '从report 获取的产品信息', `prod_info` text COMMENT '从接口 获取的产品信息', `is_get_prod_info` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否获取产品信息,0等待获取 1正在获取 2获取完成 3上次获取失败', `err_times` int(11) NOT NULL DEFAULT '0', `err_msg` varchar(255) DEFAULT NULL, `batch_num` char(255) NOT NULL COMMENT '批次号,用report id填入', `create_time` datetime NOT NULL, `update_time` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `merchant_id` (`merchant_id`,`marketplace_short`,`asin`,`sku`,`upc`,`ean`), KEY `batch_num` (`batch_num`,`catalog_number`,`brand`), KEY `parent_asin` (`parent_asin`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='amazon线上listing表,用于oms或者零售易搬家' AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `pd_product_classification` ( `ID` int(4) NOT NULL AUTO_INCREMENT, `number` varchar(10) NOT NULL DEFAULT '' COMMENT '类别编码', `name` varchar(50) NOT NULL COMMENT '类别名称', `parent_number` varchar(10) NOT NULL DEFAULT '0' COMMENT '父节类别编码', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品分类表' AUTO_INCREMENT=9 ; CREATE TABLE IF NOT EXISTS `ut_user_pdf` ( `id` int(11) NOT NULL AUTO_INCREMENT, `origin_url` varchar(255) DEFAULT NULL, `origin_size` varchar(50) DEFAULT NULL, `original_name` varchar(255) NOT NULL, `service` int(11) DEFAULT NULL, `file_key` varchar(255) DEFAULT NULL, `language` varchar(50) DEFAULT NULL, `create_time` datetime DEFAULT NULL, `product_ids` varchar(255) DEFAULT NULL, `add_info` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `user_operation_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `log_module` varchar(20) NOT NULL DEFAULT '' COMMENT '操作模块', `uid` int(11) NULL DEFAULT NULL COMMENT '操作者id', `operator_name` varchar(100) NOT NULL DEFAULT '' COMMENT '操作者名称', `create_time` int(11) NULL DEFAULT NULL COMMENT '操作时间', `operator_content` varchar(500) NOT NULL DEFAULT '' COMMENT '操作内容', `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `addi_info` text COMMENT '额外信息', `key_id` int(11) NULL DEFAULT NULL COMMENT '对应表Id, 如order_id, product_id', `login_ip` varchar(100) NULL DEFAULT NULL COMMENT '登录ip', PRIMARY KEY (`id`), KEY `log_module` (`log_module`), KEY `uid` (`uid`), KEY `operator_content` (`operator_content`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户操作日志'; CREATE TABLE IF NOT EXISTS `wh_stock_allocation` ( `id` int(11) NOT NULL AUTO_INCREMENT, `stock_allocatione_id` varchar(30) NOT NULL COMMENT '调拨单号', `in_warehouse_id` smallint(5) unsigned DEFAULT NULL COMMENT '调入仓库id', `out_warehouse_id` smallint(5) unsigned DEFAULT NULL COMMENT '调出仓库id', `number_of_sku` smallint(5) unsigned DEFAULT NULL COMMENT '产品品种数量', `comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注', `capture_user_id` smallint(5) unsigned DEFAULT NULL COMMENT '操作人uid', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间 ', PRIMARY KEY (`id`), UNIQUE KEY `stock_allocatione_id` (`stock_allocatione_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='仓库调拨'; CREATE TABLE IF NOT EXISTS `wh_stock_allocation_detail` ( `id` int(11) NOT NULL AUTO_INCREMENT, `allocatione_id` int(11) NOT NULL COMMENT '调拨单id', `sku` varchar(255) NOT NULL DEFAULT '' COMMENT '产品编码SKU', `location_grid` varchar(45) NOT NULL DEFAULT '' COMMENT '仓库货位/格子', `qty` int(11) NOT NULL DEFAULT '0' COMMENT '调拨数量', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='仓库调拨明细'; CREATE TABLE IF NOT EXISTS `pc_1688_listing` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL COMMENT '1688店铺id', `company_name` varchar(255) NOT NULL DEFAULT '' COMMENT '1688店铺名称', `product_id` varchar(50) NOT NULL COMMENT '1688商品product_id', `sku_1688` varchar(255) NOT NULL COMMENT '1688商品skuCode 或 skuId 或 product_id', `spec_id` varchar(255) NOT NULL COMMENT '1688商品规格Id', `name` varchar(255) NOT NULL COMMENT '1688商品名称', `image_url` varchar(255) NOT NULL DEFAULT '' COMMENT '主图url', `pro_link` varchar(255) NOT NULL DEFAULT '' COMMENT '1688链接', `attributes` varchar(255) NOT NULL DEFAULT '' COMMENT '属性', `sku` varchar(255) NOT NULL COMMENT '本地商品sku', PRIMARY KEY (`id`), UNIQUE KEY `al1688_info` (`product_id`, `sku_1688`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='1688商品信息';
the_stack
-- -- Licensed to the Apache Software Foundation (ASF) under one or more -- contributor license agreements. See the NOTICE file distributed with -- this work for additional information regarding copyright ownership. -- The ASF licenses this file to You under the Apache License, Version 2.0 -- (the "License"); you may not use this file except in compliance with -- the License. You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- -- subquery tests (ANY and ALL subqueries) -- CREATE FUNCTION ConsistencyChecker() RETURNS VARCHAR(128) EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.T_ConsistencyChecker.runConsistencyChecker' LANGUAGE JAVA PARAMETER STYLE JAVA; autocommit off; autocommit off; -- create the all type tables create table s (i int, s smallint, c char(30), vc char(30), b bigint); create table t (i int, s smallint, c char(30), vc char(30), b bigint); create table tt (ii int, ss smallint, cc char(30), vcvc char(30), b bigint); create table ttt (iii int, sss smallint, ccc char(30), vcvcvc char(30)); -- populate the tables insert into s values (null, null, null, null, null); insert into s values (0, 0, '0', '0', 0); insert into s values (1, 1, '1', '1', 1); insert into t values (null, null, null, null, null); insert into t values (0, 0, '0', '0', 0); insert into t values (1, 1, '1', '1', 1); insert into t values (1, 1, '1', '1', 1); insert into t values (2, 2, '2', '2', 1); insert into tt values (null, null, null, null, null); insert into tt values (0, 0, '0', '0', 0); insert into tt values (1, 1, '1', '1', 1); insert into tt values (1, 1, '1', '1', 1); insert into tt values (2, 2, '2', '2', 1); insert into ttt values (null, null, null, null); insert into ttt values (11, 11, '11', '11'); insert into ttt values (11, 11, '11', '11'); insert into ttt values (22, 22, '22', '22'); -- ANY subqueries -- negative tests -- select * subquery select * from s where s = ANY (select * from s); -- incompatable types select * from s where s >= ANY (select b from t); -- invalid operator select * from s where s * ANY (select c from t); -- ? in select list of subquery select * from s where s = ANY (select ? from s); -- positive tests -- constants on left side of subquery select * from s where 1 = ANY (select s from t); select * from s where -1 = ANY (select i from t); select * from s where '1' = ANY (select vc from t); select * from s where 0 = ANY (select b from t); select * from s where 1 <> ANY (select s from t); select * from s where -1 <> ANY (select i from t); select * from s where '1' <> ANY (select vc from t); select * from s where 0 <> ANY (select b from t); select * from s where 1 >= ANY (select s from t); select * from s where -1 >= ANY (select i from t); select * from s where '1' >= ANY (select vc from t); select * from s where 0 >= ANY (select b from t); select * from s where 1 > ANY (select s from t); select * from s where -1 > ANY (select i from t); select * from s where '1' > ANY (select vc from t); select * from s where 0 > ANY (select b from t); select * from s where 1 <= ANY (select s from t); select * from s where -1 <= ANY (select i from t); select * from s where '1' <= ANY (select vc from t); select * from s where 0 <= ANY (select b from t); select * from s where 1 < ANY (select s from t); select * from s where -1 < ANY (select i from t); select * from s where '1' < ANY (select vc from t); select * from s where 0 < ANY (select b from t); -- Try a ? parameter on the LHS of a subquery. prepare subq1 as 'select * from s where ? = ANY (select s from t)'; execute subq1 using 'values (1)'; remove subq1; -- constants in subquery select list select * from s where i = ANY (select 1 from t); select * from s where i = ANY (select -1 from t); select * from s where c = ANY (select '1' from t); select * from s where b = ANY (select 1 from t); select * from s where i <> ANY (select 1 from t); select * from s where i <> ANY (select -1 from t); select * from s where c <> ANY (select '1' from t); select * from s where b <> ANY (select 1 from t); select * from s where i >= ANY (select 1 from t); select * from s where i >= ANY (select -1 from t); select * from s where c >= ANY (select '1' from t); select * from s where b >= ANY (select 1 from t); select * from s where i > ANY (select 1 from t); select * from s where i > ANY (select -1 from t); select * from s where c > ANY (select '1' from t); select * from s where b > ANY (select 1 from t); select * from s where i <= ANY (select 1 from t); select * from s where i <= ANY (select -1 from t); select * from s where c <= ANY (select '1' from t); select * from s where b <= ANY (select 1 from t); select * from s where i < ANY (select 1 from t); select * from s where i < ANY (select -1 from t); select * from s where c < ANY (select '1' from t); select * from s where b < ANY (select 1 from t); -- constants on both sides select * from s where 1 = ANY (select 0 from t); select * from s where 0 = ANY (select 0 from t); select * from s where 1 <> ANY (select 0 from t); select * from s where 0 <> ANY (select 0 from t); select * from s where 1 >= ANY (select 0 from t); select * from s where 0 >= ANY (select 0 from t); select * from s where 1 > ANY (select 0 from t); select * from s where 0 > ANY (select 0 from t); select * from s where 1 <= ANY (select 0 from t); select * from s where 0 <= ANY (select 0 from t); select * from s where 1 < ANY (select 0 from t); select * from s where 0 < ANY (select 0 from t); -- compatable types select * from s where c = ANY (select vc from t); select * from s where vc = ANY (select c from t); select * from s where i = ANY (select s from t); select * from s where s = ANY (select i from t); select * from s where c <> ANY (select vc from t); select * from s where vc <> ANY (select c from t); select * from s where i <> ANY (select s from t); select * from s where s <> ANY (select i from t); select * from s where c >= ANY (select vc from t); select * from s where vc >= ANY (select c from t); select * from s where i >= ANY (select s from t); select * from s where s >= ANY (select i from t); select * from s where c > ANY (select vc from t); select * from s where vc > ANY (select c from t); select * from s where i > ANY (select s from t); select * from s where s > ANY (select i from t); select * from s where c <= ANY (select vc from t); select * from s where vc <= ANY (select c from t); select * from s where i <= ANY (select s from t); select * from s where s <= ANY (select i from t); select * from s where c < ANY (select vc from t); select * from s where vc < ANY (select c from t); select * from s where i < ANY (select s from t); select * from s where s < ANY (select i from t); -- empty subquery result set select * from s where i = ANY (select i from t where 1 = 0); select * from s where i <> ANY (select i from t where 1 = 0); select * from s where i >= ANY (select i from t where 1 = 0); select * from s where i > ANY (select i from t where 1 = 0); select * from s where i <= ANY (select i from t where 1 = 0); select * from s where i < ANY (select i from t where 1 = 0); -- subquery under an or select i from s where i = -1 or i = ANY (select i from t); select i from s where i = 0 or i = ANY (select i from t where i = -1); select i from s where i = -1 or i = ANY (select i from t where i = -1 or i = 1); select i from s where i = -1 or i <> ANY (select i from t); select i from s where i = 0 or i >= ANY (select i from t where i = -1); select i from s where i = -1 or i < ANY (select i from t where i = -1 or i = 1); select i from s where i = -1 or i >= ANY (select i from t); select i from s where i = 0 or i > ANY (select i from t where i = -1); select i from s where i = -1 or i <> ANY (select i from t where i = -1 or i = 1); -- correlated subqueries select * from s where i > ANY (select i from t where s.s > t.s); select * from s where i >= ANY (select i from t where s.s >= t.s); select * from s where i < ANY (select i from t where s.s < t.s); select * from s where i <= ANY (select i from t where s.s <= t.s); select * from s where i = ANY (select i from t where s.s = t.s); select * from s where i <> ANY (select i from t where s.s <> t.s); -- ALL/NOT IN and NOTs -- create tables create table s_3rows (i int); create table t_1 (i int); create table u_null (i int); create table v_empty (i int); create table w_2 (i int); -- populate tables insert into s_3rows values(NULL); insert into s_3rows values(1); insert into s_3rows values(2); insert into u_null values(NULL); insert into t_1 values(1); insert into w_2 values(2); -- test ALLs select * from s_3rows where s_3rows.i not in (select i from t_1); select * from s_3rows where s_3rows.i <> ALL (select i from t_1); select * from s_3rows where s_3rows.i >= ALL (select i from t_1); select * from s_3rows where s_3rows.i > ALL (select i from t_1); select * from s_3rows where s_3rows.i <= ALL (select i from t_1); select * from s_3rows where s_3rows.i < ALL (select i from t_1); select * from s_3rows where s_3rows.i = ALL (select i from t_1); select * from s_3rows where s_3rows.i not in (select i from u_null); select * from s_3rows where s_3rows.i <> ALL (select i from u_null); select * from s_3rows where s_3rows.i >= ALL (select i from u_null); select * from s_3rows where s_3rows.i > ALL (select i from u_null); select * from s_3rows where s_3rows.i <= ALL (select i from u_null); select * from s_3rows where s_3rows.i < ALL (select i from u_null); select * from s_3rows where s_3rows.i = ALL (select i from u_null); select * from s_3rows where s_3rows.i not in (select i from v_empty); select * from s_3rows where s_3rows.i <> ALL (select i from v_empty); select * from s_3rows where s_3rows.i >= ALL (select i from v_empty); select * from s_3rows where s_3rows.i > ALL (select i from v_empty); select * from s_3rows where s_3rows.i <= ALL (select i from v_empty); select * from s_3rows where s_3rows.i < ALL (select i from v_empty); select * from s_3rows where s_3rows.i = ALL (select i from v_empty); select * from s_3rows where s_3rows.i not in (select i from w_2); select * from s_3rows where s_3rows.i <> ALL (select i from w_2); select * from s_3rows where s_3rows.i >= ALL (select i from w_2); select * from s_3rows where s_3rows.i > ALL (select i from w_2); select * from s_3rows where s_3rows.i <= ALL (select i from w_2); select * from s_3rows where s_3rows.i < ALL (select i from w_2); select * from s_3rows where s_3rows.i = ALL (select i from w_2); select * from w_2 where w_2.i = ALL (select i from w_2); -- NOT = ANY <=> <> ALL select * from s_3rows where NOT s_3rows.i = ANY (select i from w_2); select * from s_3rows where s_3rows.i <> ALL (select i from w_2); select * from s_3rows where NOT s_3rows.i = ANY (select i from v_empty); select * from s_3rows where s_3rows.i <> ALL (select i from v_empty); -- NOT <> ANY <=> = ALL select * from s_3rows where NOT s_3rows.i <> ANY (select i from w_2); select * from s_3rows where s_3rows.i = ALL (select i from w_2); select * from s_3rows where NOT s_3rows.i <> ANY (select i from v_empty); select * from s_3rows where s_3rows.i = ALL (select i from v_empty); -- NOT >= ANY <=> < ALL select * from s_3rows where NOT s_3rows.i >= ANY (select i from w_2); select * from s_3rows where s_3rows.i < ALL (select i from w_2); select * from s_3rows where NOT s_3rows.i >= ANY (select i from v_empty); select * from s_3rows where s_3rows.i < ALL (select i from v_empty); -- NOT > ANY <=> <= ALL select * from s_3rows where NOT s_3rows.i > ANY (select i from w_2); select * from s_3rows where s_3rows.i <= ALL (select i from w_2); select * from s_3rows where NOT s_3rows.i > ANY (select i from v_empty); select * from s_3rows where s_3rows.i <= ALL (select i from v_empty); -- NOT <= ANY <=> > ALL select * from s_3rows where NOT s_3rows.i <= ANY (select i from w_2); select * from s_3rows where s_3rows.i > ALL (select i from w_2); select * from s_3rows where NOT s_3rows.i <= ANY (select i from v_empty); select * from s_3rows where s_3rows.i > ALL (select i from v_empty); -- NOT < ANY <=> >= ALL select * from s_3rows where NOT s_3rows.i < ANY (select i from w_2); select * from s_3rows where s_3rows.i >= ALL (select i from w_2); select * from s_3rows where NOT s_3rows.i < ANY (select i from v_empty); select * from s_3rows where s_3rows.i >= ALL (select i from v_empty); -- NOT = ALL <=> <> ANY select * from s_3rows where NOT s_3rows.i = ALL (select i from w_2); select * from s_3rows where s_3rows.i <> ANY (select i from w_2); select * from s_3rows where NOT s_3rows.i = ALL (select i from v_empty); select * from s_3rows where s_3rows.i <> ANY (select i from v_empty); -- NOT <> ALL <=> = ANY select * from s_3rows where NOT s_3rows.i <> ALL (select i from w_2); select * from s_3rows where s_3rows.i = ANY (select i from w_2); select * from s_3rows where NOT s_3rows.i <> ALL (select i from v_empty); select * from s_3rows where s_3rows.i = ANY (select i from v_empty); -- NOT >= ALL <=> < ANY select * from s_3rows where NOT s_3rows.i >= ALL (select i from w_2); select * from s_3rows where s_3rows.i < ANY (select i from w_2); select * from s_3rows where NOT s_3rows.i >= ALL (select i from v_empty); select * from s_3rows where s_3rows.i < ANY (select i from v_empty); -- NOT > ALL <=> <= ANY select * from s_3rows where NOT s_3rows.i > ALL (select i from w_2); select * from s_3rows where s_3rows.i <= ANY (select i from w_2); select * from s_3rows where NOT s_3rows.i > ALL (select i from v_empty); select * from s_3rows where s_3rows.i <= ANY (select i from v_empty); -- NOT <= ALL <=> > ANY select * from s_3rows where NOT s_3rows.i <= ALL (select i from w_2); select * from s_3rows where s_3rows.i > ANY (select i from w_2); select * from s_3rows where NOT s_3rows.i <= ALL (select i from v_empty); select * from s_3rows where s_3rows.i > ANY (select i from v_empty); -- NOT < ALL <=> >= ANY select * from s_3rows where NOT s_3rows.i < ALL (select i from w_2); select * from s_3rows where s_3rows.i >= ANY (select i from w_2); select * from s_3rows where NOT s_3rows.i < ALL (select i from v_empty); select * from s_3rows where s_3rows.i >= ANY (select i from v_empty); -- test skipping of generating is null predicates for non-nullable columns create table t1 (c1 int not null, c2 int); create table t2 (c1 int not null, c2 int); insert into t1 values(1, 2); insert into t2 values(0, 3); select * from t1 where c1 not in (select c2 from t2); select * from t1 where c2 not in (select c1 from t2); select * from t1 where c1 not in (select c1 from t2); drop table t1; drop table t2; -- update create table u (i int, s smallint, c char(30), vc char(30), b bigint); insert into u select * from s; select * from u; update u set b = exists (select * from t) where vc < ANY (select vc from s); select * from u; delete from u; insert into u select * from s; -- delete delete from u where c < ANY (select c from t); select * from u; -- do consistency check on scans, etc. values ConsistencyChecker(); -- reset autocommit autocommit on; -- drop the tables drop table s; drop table t; drop table tt; drop table ttt; drop table u; drop table s_3rows; drop table t_1; drop table u_null; drop table v_empty; drop table w_2; -- DERBY-634: Dynamic subquery materialization can cause stack overflow create table parentT ( i int, j int, k int); create table childT ( i int, j int, k int); -- Load some data insert into parentT values (1,1,1), (2,2,2), (3,3,3), (4,4,4); insert into parentT select i+4, j+4, k+4 from parentT; insert into parentT select i+8, j+8, k+8 from parentT; insert into parentT select i+16, j+16, k+16 from parentT; insert into parentT select i+32, j+32, k+32 from parentT; insert into parentT select i+64, j+64, k+64 from parentT; insert into parentT select i+128, j+128, k+128 from parentT; insert into parentT select i+256, j+256, k+256 from parentT; insert into parentT select i+512, j+512, k+512 from parentT; insert into parentT select i+1024, j+1024, k+1024 from parentT; insert into parentT select i+2048, j+2048, k+2048 from parentT; insert into parentT select i+4096, j+4096, k+4096 from parentT; insert into parentT select i+8192, j+8192, k+8192 from parentT; -- Try with three different sizes of subquery results. update parentT set j = j /10; update parentT set k = k /100; create unique index parentIdx on parentT(i); insert into childT select * from parentT; select count(*) from parentT where i < 10 and i not in (select i from childT); select count(*) from parentT where i< 10 and exists (select i from childT where childT.i=parentT.i); select count(*) from parentT where i< 10 and j not in (select distinct j from childT); select count(*) from parentT where i< 10 and exists (select distinct j from childT where childT.j=parentT.j); select count(*) from parentT where i< 10 and k not in (select distinct k from childT); select count(*) from parentT where i< 10 and exists (select distinct k from childT where childT.k=parentT.k); drop table childT; drop table parentT;
the_stack
-- 2017-11-11T12:42:05.905 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy,WidgetSize) VALUES (0,543472,0,'X1',TO_TIMESTAMP('2017-11-11 12:42:05','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Regal','Regal',TO_TIMESTAMP('2017-11-11 12:42:05','YYYY-MM-DD HH24:MI:SS'),100,'S') ; -- 2017-11-11T12:42:05.919 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543472 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2017-11-11T12:42:31.327 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-11 12:42:31','YYYY-MM-DD HH24:MI:SS'),Name='Rack',PrintName='Rack' WHERE AD_Element_ID=543472 AND AD_Language='en_US' ; -- 2017-11-11T12:42:31.357 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543472,'en_US') ; -- 2017-11-11T12:42:36.053 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-11 12:42:36','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Element_ID=543472 AND AD_Language='en_US' ; -- 2017-11-11T12:42:36.066 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543472,'en_US') ; -- 2017-11-11T13:04:15.242 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsSelectionColumn,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,557832,543472,0,10,207,'N','X1',TO_TIMESTAMP('2017-11-11 13:04:15','YYYY-MM-DD HH24:MI:SS'),100,'N','D',60,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Regal',0,0,TO_TIMESTAMP('2017-11-11 13:04:15','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000) ; -- 2017-11-11T13:04:15.244 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=557832 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2017-11-11T13:04:27.375 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET SeqNo=50,Updated=TO_TIMESTAMP('2017-11-11 13:04:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1401 ; -- 2017-11-11T13:04:30.196 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET SeqNo=40,Updated=TO_TIMESTAMP('2017-11-11 13:04:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1400 ; -- 2017-11-11T13:04:35.550 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsIdentifier='Y', SeqNo=30,Updated=TO_TIMESTAMP('2017-11-11 13:04:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557832 ; -- 2017-11-11T13:06:36.024 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,557832,560486,0,178,67,TO_TIMESTAMP('2017-11-11 13:06:35','YYYY-MM-DD HH24:MI:SS'),100,60,'U',0,'Y','Y','Y','Y','N','N','N','N','N','Regal',95,85,999,1,TO_TIMESTAMP('2017-11-11 13:06:35','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-11T13:06:36.025 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=560486 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2017-11-11T13:07:34.013 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,560486,0,178,541165,549175,'F',TO_TIMESTAMP('2017-11-11 13:07:33','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Regal',55,0,0,TO_TIMESTAMP('2017-11-11 13:07:33','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-11T13:08:01.061 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-11-11 13:08:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549175 ; -- 2017-11-11T13:08:01.066 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-11-11 13:08:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548723 ; -- 2017-11-11T13:08:01.068 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-11-11 13:08:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548725 ; -- 2017-11-11T13:08:01.070 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-11-11 13:08:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548716 ; -- 2017-11-11T13:08:50.486 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET Name='Gang',Updated=TO_TIMESTAMP('2017-11-11 13:08:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1399 ; -- 2017-11-11T13:08:50.487 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Gang', Description='X dimension, e.g., Aisle', Help='The X dimension indicates the Aisle a product is located in.' WHERE AD_Column_ID=1399 AND IsCentrallyMaintained='Y' ; -- 2017-11-11T13:08:53.735 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET Name='Fach',Updated=TO_TIMESTAMP('2017-11-11 13:08:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1400 ; -- 2017-11-11T13:08:53.736 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Fach', Description='Y dimension, e.g., Bin', Help='The Y dimension indicates the Bin a product is located in' WHERE AD_Column_ID=1400 AND IsCentrallyMaintained='Y' ; -- 2017-11-11T13:09:07.264 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET Name='Ebene',Updated=TO_TIMESTAMP('2017-11-11 13:09:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1401 ; -- 2017-11-11T13:09:07.265 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Ebene', Description='Z dimension, e.g., Level', Help='The Z dimension indicates the Level a product is located in.' WHERE AD_Column_ID=1401 AND IsCentrallyMaintained='Y' ; -- 2017-11-11T13:09:17.821 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET Name='Gang',Updated=TO_TIMESTAMP('2017-11-11 13:09:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=633 ; -- 2017-11-11T13:09:17.824 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='X', Name='Gang', Description='X-Dimension, z.B. Gang', Help='Die X-Dimension zeigt den Gang an, in dem sich ein Produkt befindet.' WHERE AD_Element_ID=633 ; -- 2017-11-11T13:09:17.840 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='X', Name='Gang', Description='X-Dimension, z.B. Gang', Help='Die X-Dimension zeigt den Gang an, in dem sich ein Produkt befindet.', AD_Element_ID=633 WHERE UPPER(ColumnName)='X' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2017-11-11T13:09:17.841 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='X', Name='Gang', Description='X-Dimension, z.B. Gang', Help='Die X-Dimension zeigt den Gang an, in dem sich ein Produkt befindet.' WHERE AD_Element_ID=633 AND IsCentrallyMaintained='Y' ; -- 2017-11-11T13:09:17.843 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Gang', Description='X-Dimension, z.B. Gang', Help='Die X-Dimension zeigt den Gang an, in dem sich ein Produkt befindet.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=633) AND IsCentrallyMaintained='Y' ; -- 2017-11-11T13:09:17.871 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='X', Name='Gang' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=633) ; -- 2017-11-11T13:09:32.887 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET PrintName='Gang',Updated=TO_TIMESTAMP('2017-11-11 13:09:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=633 ; -- 2017-11-11T13:09:32.889 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Gang', Name='Gang' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=633) ; -- 2017-11-11T13:09:47.246 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-11 13:09:47','YYYY-MM-DD HH24:MI:SS'),Name='Aisle' WHERE AD_Element_ID=633 AND AD_Language='en_US' ; -- 2017-11-11T13:09:47.259 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(633,'en_US') ; -- 2017-11-11T13:09:53.645 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-11 13:09:53','YYYY-MM-DD HH24:MI:SS'),PrintName='Aisle' WHERE AD_Element_ID=633 AND AD_Language='en_US' ; -- 2017-11-11T13:09:53.648 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(633,'en_US') ; -- 2017-11-11T13:10:30.679 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-11 13:10:30','YYYY-MM-DD HH24:MI:SS'),Name='Rack' WHERE AD_Column_ID=557832 AND AD_Language='en_US' ; -- 2017-11-11T13:10:45.718 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-11 13:10:45','YYYY-MM-DD HH24:MI:SS'),Name='Tray',IsTranslated='Y' WHERE AD_Column_ID=1400 AND AD_Language='en_US' ; -- 2017-11-11T13:10:55.334 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET Name='Fach',Updated=TO_TIMESTAMP('2017-11-11 13:10:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=635 ; -- 2017-11-11T13:10:55.336 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='Y', Name='Fach', Description='Y-Dimension, z.B. Fach', Help='Die Y-Dimension zeigt das Fach an, in dem sich ein Produkt befindet.' WHERE AD_Element_ID=635 ; -- 2017-11-11T13:10:55.347 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Y', Name='Fach', Description='Y-Dimension, z.B. Fach', Help='Die Y-Dimension zeigt das Fach an, in dem sich ein Produkt befindet.', AD_Element_ID=635 WHERE UPPER(ColumnName)='Y' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2017-11-11T13:10:55.348 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Y', Name='Fach', Description='Y-Dimension, z.B. Fach', Help='Die Y-Dimension zeigt das Fach an, in dem sich ein Produkt befindet.' WHERE AD_Element_ID=635 AND IsCentrallyMaintained='Y' ; -- 2017-11-11T13:10:55.349 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Fach', Description='Y-Dimension, z.B. Fach', Help='Die Y-Dimension zeigt das Fach an, in dem sich ein Produkt befindet.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=635) AND IsCentrallyMaintained='Y' ; -- 2017-11-11T13:10:55.378 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Y', Name='Fach' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=635) ; -- 2017-11-11T13:11:12.671 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-11 13:11:12','YYYY-MM-DD HH24:MI:SS'),Name='Tray',PrintName='Tray' WHERE AD_Element_ID=635 AND AD_Language='en_US' ; -- 2017-11-11T13:11:12.676 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(635,'en_US') ; -- 2017-11-11T13:11:38.513 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET Name='Ebene', PrintName='Ebene',Updated=TO_TIMESTAMP('2017-11-11 13:11:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=637 ; -- 2017-11-11T13:11:38.515 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='Z', Name='Ebene', Description='Z-Dimension, z.B. Ebene', Help='Die Z-Dimension zeigt an, auf welcher Ebene sich ein Produkt befindet.' WHERE AD_Element_ID=637 ; -- 2017-11-11T13:11:38.529 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Z', Name='Ebene', Description='Z-Dimension, z.B. Ebene', Help='Die Z-Dimension zeigt an, auf welcher Ebene sich ein Produkt befindet.', AD_Element_ID=637 WHERE UPPER(ColumnName)='Z' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2017-11-11T13:11:38.530 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Z', Name='Ebene', Description='Z-Dimension, z.B. Ebene', Help='Die Z-Dimension zeigt an, auf welcher Ebene sich ein Produkt befindet.' WHERE AD_Element_ID=637 AND IsCentrallyMaintained='Y' ; -- 2017-11-11T13:11:38.531 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Ebene', Description='Z-Dimension, z.B. Ebene', Help='Die Z-Dimension zeigt an, auf welcher Ebene sich ein Produkt befindet.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=637) AND IsCentrallyMaintained='Y' ; -- 2017-11-11T13:11:38.559 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Ebene', Name='Ebene' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=637) ; -- 2017-11-11T13:11:51.954 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-11 13:11:51','YYYY-MM-DD HH24:MI:SS'),Name='Level',PrintName='Level' WHERE AD_Element_ID=637 AND AD_Language='en_US' ; -- 2017-11-11T13:11:51.959 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(637,'en_US') ; -- 2017-11-11T13:12:10.944 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('M_Locator','ALTER TABLE public.M_Locator ADD COLUMN X1 VARCHAR(60)') ; -- 2017-11-11T13:12:32.777 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Fach',Updated=TO_TIMESTAMP('2017-11-11 13:12:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548723 ; -- 2017-11-11T13:12:36.066 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Gang',Updated=TO_TIMESTAMP('2017-11-11 13:12:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548722 ; -- 2017-11-11T13:12:41.714 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Ebene',Updated=TO_TIMESTAMP('2017-11-11 13:12:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548724 ; -- 2017-11-11T13:13:01.364 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,560486,0,178,541165,549176,'F',TO_TIMESTAMP('2017-11-11 13:13:01','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Regal',74,0,0,TO_TIMESTAMP('2017-11-11 13:13:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-11T13:14:32.482 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-11-11 13:14:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548715 ; -- 2017-11-11T13:15:07.996 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=549176 ; -- 2017-11-11T13:15:26.868 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-11-11 13:15:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549175 ; -- 2017-11-11T13:15:33.048 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-11-11 13:15:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548723 ; -- 2017-11-11T13:15:34.975 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-11-11 13:15:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548725 ; -- 2017-11-11T13:15:38.069 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-11-11 13:15:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548716 ; -- 2017-11-11T13:15:42.270 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-11-11 13:15:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548715 ; -- 2017-11-11T13:16:00.968 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2017-11-11 13:16:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548722 ; -- 2017-11-11T13:16:04.357 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2017-11-11 13:16:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549175 ; -- 2017-11-11T13:16:07.648 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2017-11-11 13:16:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548724 ; -- 2017-11-11T13:16:10.613 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2017-11-11 13:16:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548723 ; -- 2017-11-11T13:16:13.949 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2017-11-11 13:16:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548716 ; -- 2017-11-11T13:16:17.598 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2017-11-11 13:16:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548715 ;
the_stack
-- 2018-01-02T13:16:23.541 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,DefaultValue,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,558436,542857,0,20,540888,'N','IsErrorAcknowledged',TO_TIMESTAMP('2018-01-02 13:16:23','YYYY-MM-DD HH24:MI:SS'),100,'N','N','de.metas.event',1,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','Y','N','N','N','N','N','N','N','Y','N','Fehler zur Kentnis genommen',0,0,TO_TIMESTAMP('2018-01-02 13:16:23','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-01-02T13:16:23.542 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=558436 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-01-02T13:16:26.940 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('AD_EventLog','ALTER TABLE public.AD_EventLog ADD COLUMN IsErrorAcknowledged CHAR(1) DEFAULT ''N'' CHECK (IsErrorAcknowledged IN (''Y'',''N'')) NOT NULL') ; -- 2018-01-02T13:16:41.008 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET IsReadOnly='N',Updated=TO_TIMESTAMP('2018-01-02 13:16:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=540979 ; -- 2018-01-02T13:16:58.711 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,558436,561305,0,540979,0,TO_TIMESTAMP('2018-01-02 13:16:58','YYYY-MM-DD HH24:MI:SS'),100,0,'U',0,'Y','Y','Y','N','N','N','N','Y','Fehler zur Kentnis genommen',26,26,0,1,1,TO_TIMESTAMP('2018-01-02 13:16:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T13:16:58.712 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=561305 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2018-01-02T13:17:05.350 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2018-01-02 13:17:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561304 ; -- 2018-01-02T13:17:05.834 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2018-01-02 13:17:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561286 ; -- 2018-01-02T13:17:07.132 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2018-01-02 13:17:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561285 ; -- 2018-01-02T13:17:07.571 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2018-01-02 13:17:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561292 ; -- 2018-01-02T13:17:07.922 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2018-01-02 13:17:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561303 ; -- 2018-01-02T13:17:08.266 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2018-01-02 13:17:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561289 ; -- 2018-01-02T13:17:08.627 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2018-01-02 13:17:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561288 ; -- 2018-01-02T13:17:09.083 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2018-01-02 13:17:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561287 ; -- 2018-01-02T13:17:09.570 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2018-01-02 13:17:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561290 ; -- 2018-01-02T13:17:10.371 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2018-01-02 13:17:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561291 ; -- 2018-01-02T13:17:15.516 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET EntityType='de.metas.event',Updated=TO_TIMESTAMP('2018-01-02 13:17:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561305 ; -- 2018-01-02T13:21:05.591 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,AllowProcessReRun,Classname,CopyFromProcess,Created,CreatedBy,Description,EntityType,IsActive,IsApplySecuritySettings,IsBetaFunctionality,IsDirectPrint,IsOneInstanceOnly,IsReport,IsServerProcess,IsUseBPartnerLanguage,LockWaitTimeout,Name,RefreshAllAfterExecution,ShowHelp,Type,Updated,UpdatedBy,Value) VALUES ('4',0,0,540906,'Y','de.metas.event.log.process.AD_EventLog_DeleteOldRecords','N',TO_TIMESTAMP('2018-01-02 13:21:05','YYYY-MM-DD HH24:MI:SS'),100,'Removes AD_EventLog records that were not updated later than the given number of days in the past.','de.metas.event','Y','N','N','N','N','N','N','Y',0,'Delete old event log records','N','Y','Java',TO_TIMESTAMP('2018-01-02 13:21:05','YYYY-MM-DD HH24:MI:SS'),100,'AD_EventLog_DeleteOldRecords') ; -- 2018-01-02T13:21:05.592 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=540906 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) ; -- 2018-01-02T13:23:13.792 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540906,541257,11,'LastUpdatedDaysBack',TO_TIMESTAMP('2018-01-02 13:23:13','YYYY-MM-DD HH24:MI:SS'),100,'30','U',0,'Y','N','Y','N','N','N','last updated interval in days',10,TO_TIMESTAMP('2018-01-02 13:23:13','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T13:23:13.794 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=541257 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2018-01-02T13:24:30.301 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Menu_ID,AD_Org_ID,AD_Process_ID,Created,CreatedBy,Description,EntityType,InternalName,IsActive,IsCreateNew,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy) VALUES ('P',0,541005,0,540906,TO_TIMESTAMP('2018-01-02 13:24:30','YYYY-MM-DD HH24:MI:SS'),100,'Removes AD_EventLog records that were not updated later than the given number of days in the past.','de.metas.event','AD_EventLog_DeleteOldRecords','Y','N','N','N','N','Delete old event log records',TO_TIMESTAMP('2018-01-02 13:24:30','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T13:24:30.303 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Menu_ID, t.Description,t.Name,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=541005 AND NOT EXISTS (SELECT 1 FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID) ; -- 2018-01-02T13:24:30.304 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 541005, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=541005) ; -- 2018-01-02T13:24:30.883 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540859 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.885 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540727 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.886 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=155 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.888 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=156 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.889 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=175 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.890 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=157 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.891 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=552 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.892 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540537 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.892 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540603 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.893 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540639 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.894 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540640 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.895 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540645 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.896 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=541004 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.896 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540691 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:30.897 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=541005 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.193 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540859 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.195 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540727 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.196 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=155 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.197 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=156 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.198 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=175 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.199 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=157 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.200 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=552 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.201 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540537 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.204 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540603 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.205 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540639 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.206 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540640 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.207 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540645 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.208 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=541004 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.210 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=541005 AND AD_Tree_ID=10 ; -- 2018-01-02T13:24:33.211 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=540691 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:03.513 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu (AD_Client_ID,AD_Menu_ID,AD_Org_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsCreateNew,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy) VALUES (0,541006,0,TO_TIMESTAMP('2018-01-02 13:25:03','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.event','eventlog','Y','N','N','N','Y','Event log',TO_TIMESTAMP('2018-01-02 13:25:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T13:25:03.514 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Menu_ID, t.Description,t.Name,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=541006 AND NOT EXISTS (SELECT 1 FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID) ; -- 2018-01-02T13:25:03.516 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 541006, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=541006) ; -- 2018-01-02T13:25:04.101 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=53035 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:04.102 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=53036 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:04.103 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=53037 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:04.104 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=53038 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:04.104 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540539 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:04.105 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540593 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:04.106 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=53039 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:04.106 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=53040 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:04.107 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=53224 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:04.108 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=53041 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:04.109 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=53042 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:04.109 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=53034, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=541006 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.760 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000007 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.762 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=218 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.763 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=541006 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.764 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540478 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.765 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=153 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.767 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=263 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.769 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=166 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.770 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=203 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.771 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540627 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.772 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540281 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.773 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=53242 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.774 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=236 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.775 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=183 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.778 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=160 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.779 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=278 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.780 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=15, Updated=now(), UpdatedBy=100 WHERE Node_ID=345 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.782 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=16, Updated=now(), UpdatedBy=100 WHERE Node_ID=53014 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.783 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=17, Updated=now(), UpdatedBy=100 WHERE Node_ID=540016 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.785 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=18, Updated=now(), UpdatedBy=100 WHERE Node_ID=540613 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.786 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=19, Updated=now(), UpdatedBy=100 WHERE Node_ID=53083 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.788 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=20, Updated=now(), UpdatedBy=100 WHERE Node_ID=53108 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.789 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=21, Updated=now(), UpdatedBy=100 WHERE Node_ID=518 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.790 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=22, Updated=now(), UpdatedBy=100 WHERE Node_ID=519 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.791 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=23, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000004 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.792 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=24, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000001 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.793 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=25, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000000 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.795 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=26, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000002 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.796 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=27, Updated=now(), UpdatedBy=100 WHERE Node_ID=540029 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.797 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=28, Updated=now(), UpdatedBy=100 WHERE Node_ID=540028 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.798 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=29, Updated=now(), UpdatedBy=100 WHERE Node_ID=540030 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.799 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=30, Updated=now(), UpdatedBy=100 WHERE Node_ID=540031 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.800 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=31, Updated=now(), UpdatedBy=100 WHERE Node_ID=540034 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.801 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=32, Updated=now(), UpdatedBy=100 WHERE Node_ID=540024 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.803 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=33, Updated=now(), UpdatedBy=100 WHERE Node_ID=540004 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.804 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=34, Updated=now(), UpdatedBy=100 WHERE Node_ID=540015 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.805 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=35, Updated=now(), UpdatedBy=100 WHERE Node_ID=540066 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.806 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=36, Updated=now(), UpdatedBy=100 WHERE Node_ID=540043 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.807 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=37, Updated=now(), UpdatedBy=100 WHERE Node_ID=540048 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.809 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=38, Updated=now(), UpdatedBy=100 WHERE Node_ID=540052 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.810 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=39, Updated=now(), UpdatedBy=100 WHERE Node_ID=540058 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.811 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=40, Updated=now(), UpdatedBy=100 WHERE Node_ID=540077 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.813 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=41, Updated=now(), UpdatedBy=100 WHERE Node_ID=540060 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.814 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=42, Updated=now(), UpdatedBy=100 WHERE Node_ID=540076 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.818 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=43, Updated=now(), UpdatedBy=100 WHERE Node_ID=540075 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.823 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=44, Updated=now(), UpdatedBy=100 WHERE Node_ID=540074 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.825 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=45, Updated=now(), UpdatedBy=100 WHERE Node_ID=540073 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.826 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=46, Updated=now(), UpdatedBy=100 WHERE Node_ID=540062 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.828 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=47, Updated=now(), UpdatedBy=100 WHERE Node_ID=540070 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.829 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=48, Updated=now(), UpdatedBy=100 WHERE Node_ID=540068 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.830 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=49, Updated=now(), UpdatedBy=100 WHERE Node_ID=540065 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.831 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=50, Updated=now(), UpdatedBy=100 WHERE Node_ID=540067 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.832 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=51, Updated=now(), UpdatedBy=100 WHERE Node_ID=540083 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.833 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=52, Updated=now(), UpdatedBy=100 WHERE Node_ID=540136 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.834 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=53, Updated=now(), UpdatedBy=100 WHERE Node_ID=540106 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.835 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=54, Updated=now(), UpdatedBy=100 WHERE Node_ID=540090 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.836 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=55, Updated=now(), UpdatedBy=100 WHERE Node_ID=540109 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.837 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=56, Updated=now(), UpdatedBy=100 WHERE Node_ID=540119 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.838 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=57, Updated=now(), UpdatedBy=100 WHERE Node_ID=540120 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.839 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=58, Updated=now(), UpdatedBy=100 WHERE Node_ID=540103 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.840 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=59, Updated=now(), UpdatedBy=100 WHERE Node_ID=540098 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.841 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=60, Updated=now(), UpdatedBy=100 WHERE Node_ID=540105 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.842 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=61, Updated=now(), UpdatedBy=100 WHERE Node_ID=540092 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.842 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=62, Updated=now(), UpdatedBy=100 WHERE Node_ID=540139 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.843 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=63, Updated=now(), UpdatedBy=100 WHERE Node_ID=540187 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.844 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=64, Updated=now(), UpdatedBy=100 WHERE Node_ID=540184 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.845 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=65, Updated=now(), UpdatedBy=100 WHERE Node_ID=540147 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.845 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=66, Updated=now(), UpdatedBy=100 WHERE Node_ID=540185 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.847 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=67, Updated=now(), UpdatedBy=100 WHERE Node_ID=540167 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.848 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=68, Updated=now(), UpdatedBy=100 WHERE Node_ID=540234 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.849 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=69, Updated=now(), UpdatedBy=100 WHERE Node_ID=540148 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.850 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=70, Updated=now(), UpdatedBy=100 WHERE Node_ID=540228 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.851 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=71, Updated=now(), UpdatedBy=100 WHERE Node_ID=540237 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.851 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=72, Updated=now(), UpdatedBy=100 WHERE Node_ID=540225 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.852 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=73, Updated=now(), UpdatedBy=100 WHERE Node_ID=540244 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.853 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=74, Updated=now(), UpdatedBy=100 WHERE Node_ID=540269 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.854 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=75, Updated=now(), UpdatedBy=100 WHERE Node_ID=540260 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.855 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=76, Updated=now(), UpdatedBy=100 WHERE Node_ID=540246 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.856 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=77, Updated=now(), UpdatedBy=100 WHERE Node_ID=540261 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.858 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=78, Updated=now(), UpdatedBy=100 WHERE Node_ID=540243 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.860 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=79, Updated=now(), UpdatedBy=100 WHERE Node_ID=540404 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.861 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=80, Updated=now(), UpdatedBy=100 WHERE Node_ID=540270 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.862 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=81, Updated=now(), UpdatedBy=100 WHERE Node_ID=540252 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.862 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=82, Updated=now(), UpdatedBy=100 WHERE Node_ID=540400 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.864 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=83, Updated=now(), UpdatedBy=100 WHERE Node_ID=540253 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.864 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=84, Updated=now(), UpdatedBy=100 WHERE Node_ID=540264 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.865 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=85, Updated=now(), UpdatedBy=100 WHERE Node_ID=540443 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.866 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=86, Updated=now(), UpdatedBy=100 WHERE Node_ID=540265 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.867 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=87, Updated=now(), UpdatedBy=100 WHERE Node_ID=540238 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.867 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=88, Updated=now(), UpdatedBy=100 WHERE Node_ID=540512 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.868 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=89, Updated=now(), UpdatedBy=100 WHERE Node_ID=540544 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.869 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=90, Updated=now(), UpdatedBy=100 WHERE Node_ID=540529 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.870 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=91, Updated=now(), UpdatedBy=100 WHERE Node_ID=540517 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.871 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=92, Updated=now(), UpdatedBy=100 WHERE Node_ID=540518 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.871 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=93, Updated=now(), UpdatedBy=100 WHERE Node_ID=540440 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.872 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=94, Updated=now(), UpdatedBy=100 WHERE Node_ID=540559 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.873 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=95, Updated=now(), UpdatedBy=100 WHERE Node_ID=540608 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.874 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=96, Updated=now(), UpdatedBy=100 WHERE Node_ID=540587 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.874 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=97, Updated=now(), UpdatedBy=100 WHERE Node_ID=540570 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.875 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=98, Updated=now(), UpdatedBy=100 WHERE Node_ID=540576 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.876 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=99, Updated=now(), UpdatedBy=100 WHERE Node_ID=540631 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.876 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=100, Updated=now(), UpdatedBy=100 WHERE Node_ID=540656 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.877 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=101, Updated=now(), UpdatedBy=100 WHERE Node_ID=540649 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.878 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=102, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000005 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.879 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=103, Updated=now(), UpdatedBy=100 WHERE Node_ID=540886 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.879 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=104, Updated=now(), UpdatedBy=100 WHERE Node_ID=540997 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.880 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=105, Updated=now(), UpdatedBy=100 WHERE Node_ID=540999 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.881 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=106, Updated=now(), UpdatedBy=100 WHERE Node_ID=540967 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.881 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=107, Updated=now(), UpdatedBy=100 WHERE Node_ID=540987 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.882 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=108, Updated=now(), UpdatedBy=100 WHERE Node_ID=540993 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:17.883 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=109, Updated=now(), UpdatedBy=100 WHERE Node_ID=540992 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.521 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540859 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.522 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540727 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.523 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=155 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.524 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=156 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.525 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=175 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.526 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=157 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.527 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=552 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.527 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540537 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.528 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540603 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.529 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540639 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.530 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540640 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.530 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540645 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.531 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=541004 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.532 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=541005 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.533 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=541006 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:20.533 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=218, SeqNo=15, Updated=now(), UpdatedBy=100 WHERE Node_ID=540691 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:23.375 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=541006, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=541005 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:25.327 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=541006, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=541004 AND AD_Tree_ID=10 ; -- 2018-01-02T13:25:25.328 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=541006, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=541005 AND AD_Tree_ID=10 ; -- 2018-01-02T13:26:49.205 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Description='Removes AD_EventLog records that were not updated later than the given number of days in the past. Records with an error are ignored, unless isErrorAcknowledged was set to "yes".',Updated=TO_TIMESTAMP('2018-01-02 13:26:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540906 ; -- 2018-01-02T13:26:49.208 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Description='Removes AD_EventLog records that were not updated later than the given number of days in the past. Records with an error are ignored, unless isErrorAcknowledged was set to "yes".', IsActive='Y', Name='Delete old event log records',Updated=TO_TIMESTAMP('2018-01-02 13:26:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=541005 ; CREATE INDEX IF NOT EXISTS ad_eventlog_updated ON public.ad_eventlog (updated ASC NULLS LAST); COMMENT ON INDEX ad_eventlog_updated IS 'This index is here to support the process that deletes on event log records'; ALTER TABLE public.ad_eventlog_entry DROP CONSTRAINT adeventlog_adeventlogentry; ALTER TABLE public.ad_eventlog_entry ADD CONSTRAINT adeventlog_adeventlogentry FOREIGN KEY (ad_eventlog_id) REFERENCES public.ad_eventlog (ad_eventlog_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; COMMENT ON CONSTRAINT adeventlog_adeventlogentry ON public.ad_eventlog_entry IS 'This constraint has "ON DELETE CASCADE" to support the process that deletes old event log records'; -- 2018-01-02T13:41:57.341 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET DDL_NoForeignKey='Y',Updated=TO_TIMESTAMP('2018-01-02 13:41:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=558429 ; ALTER TABLE public.ad_eventlog_entry DROP CONSTRAINT adissue_adeventlogentry; CREATE INDEX IF NOT EXISTS ad_eventlog_entry_ad_Eventlog_id ON public.ad_eventlog_entry (ad_eventlog_id); -- 2018-01-02T13:45:03.934 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Index_Table (AD_Client_ID,AD_Index_Table_ID,AD_Org_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsUnique,Name,Processing,Updated,UpdatedBy,WhereClause) VALUES (0,540415,0,540888,TO_TIMESTAMP('2018-01-02 13:45:03','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.event','Y','Y','ad_eventlog_uc_uuid','N',TO_TIMESTAMP('2018-01-02 13:45:03','YYYY-MM-DD HH24:MI:SS'),100,'IsActive=''Y''') ; -- 2018-01-02T13:45:03.935 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Index_Table_Trl (AD_Language,AD_Index_Table_ID, ErrorMsg, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Index_Table_ID, t.ErrorMsg, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Index_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Index_Table_ID=540415 AND NOT EXISTS (SELECT 1 FROM AD_Index_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Index_Table_ID=t.AD_Index_Table_ID) ; -- 2018-01-02T13:45:24.173 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Index_Column (AD_Client_ID,AD_Column_ID,AD_Index_Column_ID,AD_Index_Table_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,558412,540831,540415,0,TO_TIMESTAMP('2018-01-02 13:45:24','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.event','Y',10,TO_TIMESTAMP('2018-01-02 13:45:24','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T13:45:29.694 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator CREATE UNIQUE INDEX ad_eventlog_uc_uuid ON AD_EventLog (Event_UUID) WHERE IsActive='Y' ; -- 2018-01-02T13:49:48.994 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Description='The event will be posted with the same UUID, so any event logging will be done to this event log record. The reposted event will carry the additional information which event handlers already processed it successfully in the past. This allows those handlers to avoid processing it again. If the the event was posted to a local topic, it will once again be posted to a local topic, but this time local on the machine this process runs on.',Updated=TO_TIMESTAMP('2018-01-02 13:49:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540905 ;
the_stack
-- 2021-02-18T13:43:27.762Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y',Updated=TO_TIMESTAMP('2021-02-18 15:43:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11194 ; -- 2021-02-18T13:43:52.949Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,11194,0,408,543266,577962,'F',TO_TIMESTAMP('2021-02-18 15:43:52','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 15:43:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T13:45:15.819Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='',Updated=TO_TIMESTAMP('2021-02-18 15:45:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11194 ; -- 2021-02-18T13:46:16.942Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 15:46:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11194 ; -- 2021-02-18T13:47:52.721Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=Y & @#ShowAcct@=Y',Updated=TO_TIMESTAMP('2021-02-18 15:47:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=707 ; -- 2021-02-18T13:51:52.478Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 15:51:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1095 ; -- 2021-02-18T14:03:52.098Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,1095,0,186,543272,577964,'F',TO_TIMESTAMP('2021-02-18 16:03:51','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 16:03:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T14:07:28.600Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2021-02-18 16:07:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=577964 ; -- 2021-02-18T14:07:44.981Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='N',Updated=TO_TIMESTAMP('2021-02-18 16:07:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=577964 ; -- 2021-02-18T14:08:15.101Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2021-02-18 16:08:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3660 ; -- 2021-02-18T14:09:51.603Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='',Updated=TO_TIMESTAMP('2021-02-18 16:09:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3660 ; -- 2021-02-18T14:11:11.367Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2021-02-18 16:11:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=577964 ; -- 2021-02-18T14:11:42.908Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsActive='N',Updated=TO_TIMESTAMP('2021-02-18 16:11:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544788 ; -- 2021-02-18T14:12:05.231Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsActive='Y',Updated=TO_TIMESTAMP('2021-02-18 16:12:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544788 ; -- 2021-02-18T14:12:33.866Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='N',Updated=TO_TIMESTAMP('2021-02-18 16:12:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=577964 ; -- 2021-02-18T14:14:58.191Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2021-02-18 16:14:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1095 ; -- 2021-02-18T14:16:41.252Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='N',Updated=TO_TIMESTAMP('2021-02-18 16:16:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544788 ; -- 2021-02-18T14:16:58.781Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2021-02-18 16:16:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544788 ; -- 2021-02-18T14:17:36.749Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=577964 ; -- 2021-02-18T14:17:47.401Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,1095,0,186,543272,577967,'F',TO_TIMESTAMP('2021-02-18 16:17:47','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 16:17:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T14:18:45.976Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='',Updated=TO_TIMESTAMP('2021-02-18 16:18:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1095 ; -- 2021-02-18T14:19:51.740Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y', Help='The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.', Name='Buchungsdatum', Description='Accounting Date', AD_Name_ID=NULL,Updated=TO_TIMESTAMP('2021-02-18 16:19:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1095 ; -- 2021-02-18T14:19:51.783Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(263) ; -- 2021-02-18T14:19:51.799Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=1095 ; -- 2021-02-18T14:19:51.801Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(1095) ; -- 2021-02-18T14:21:27.770Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=544787 ; -- 2021-02-18T14:21:27.785Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=577967 ; -- 2021-02-18T14:21:27.789Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=1095 ; -- 2021-02-18T14:21:27.790Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=1095 ; -- 2021-02-18T14:21:27.797Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=1095 ; -- 2021-02-18T14:22:36.121Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Tab_ID,IsDisplayed,DisplayLength,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,IsActive,Created,CreatedBy,IsReadOnly,ColumnDisplayLength,IncludedTabHeight,Updated,UpdatedBy,Help,AD_Field_ID,IsDisplayedGrid,SeqNo,SeqNoGrid,SpanX,SpanY,AD_Column_ID,Name,Description,AD_Org_ID,EntityType) VALUES (186,'Y',0,0,'N','N','N','N',0,'Y',TO_TIMESTAMP('2021-02-18 16:22:35','YYYY-MM-DD HH24:MI:SS'),100,'Y',0,0,TO_TIMESTAMP('2021-02-18 16:22:35','YYYY-MM-DD HH24:MI:SS'),100,'The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.',631843,'Y',720,720,1,1,2183,'Buchungsdatum','Accounting Date',0,'D') ; -- 2021-02-18T14:22:36.123Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Field_ID=631843 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2021-02-18T14:22:36.125Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(263) ; -- 2021-02-18T14:22:36.130Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=631843 ; -- 2021-02-18T14:22:36.131Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(631843) ; -- 2021-02-18T14:22:52.947Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,631843,0,186,543272,577970,'F',TO_TIMESTAMP('2021-02-18 16:22:52','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 16:22:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T14:37:54.957Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed/''X''@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 16:37:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2776 ; -- 2021-02-18T14:38:17.453Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2776,0,263,543274,577971,'F',TO_TIMESTAMP('2021-02-18 16:38:17','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 16:38:17','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T14:43:01.018Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 16:43:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2935 ; -- 2021-02-18T14:43:25.351Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2935,0,257,543280,577972,'F',TO_TIMESTAMP('2021-02-18 16:43:25','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 16:43:25','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T14:45:46.949Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 16:45:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3437 ; -- 2021-02-18T14:46:04.302Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,3437,0,294,543268,577973,'F',TO_TIMESTAMP('2021-02-18 16:46:04','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 16:46:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T14:47:05.666Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 16:47:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3333 ; -- 2021-02-18T14:47:26.919Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,3333,0,290,543271,577974,'F',TO_TIMESTAMP('2021-02-18 16:47:26','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 16:47:26','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T14:53:14.325Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=542634 ; -- 2021-02-18T14:54:11.696Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541305 ; -- 2021-02-18T14:54:34.243Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,3493,0,296,543275,577975,'F',TO_TIMESTAMP('2021-02-18 16:54:34','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 16:54:34','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T14:54:46.824Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 16:54:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3493 ; -- 2021-02-18T14:57:52.993Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 16:57:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10393 ; -- 2021-02-18T15:01:25.619Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 17:01:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10432 ; -- 2021-02-18T15:02:13.715Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 17:02:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10452 ; -- 2021-02-18T15:02:47.959Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10452,0,662,543265,577976,'F',TO_TIMESTAMP('2021-02-18 17:02:47','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',30,0,0,TO_TIMESTAMP('2021-02-18 17:02:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T15:10:12.298Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 17:10:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57719 ; -- 2021-02-18T15:10:34.958Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,57719,0,53271,543273,577978,'F',TO_TIMESTAMP('2021-02-18 17:10:34','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 17:10:34','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T15:11:37.965Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='',Updated=TO_TIMESTAMP('2021-02-18 17:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57719 ; -- 2021-02-18T15:12:13.330Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 17:12:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57719 ; -- 2021-02-18T15:12:24.218Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=544853 ; -- 2021-02-18T15:12:57.616Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 17:12:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57853 ; -- 2021-02-18T15:14:14.628Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,57853,0,53276,543269,577979,'F',TO_TIMESTAMP('2021-02-18 17:14:14','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 17:14:14','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T15:15:18.121Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 17:15:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=557587 ; -- 2021-02-18T15:16:23.708Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557587,0,540778,543261,577980,'F',TO_TIMESTAMP('2021-02-18 17:16:23','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 17:16:23','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T15:18:19.589Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541623 ; -- 2021-02-18T15:19:11.503Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557702,0,540782,543260,577981,'F',TO_TIMESTAMP('2021-02-18 17:19:11','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 17:19:11','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T15:19:41.220Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541679 ; -- 2021-02-18T15:20:18.466Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 17:20:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559512 ; -- 2021-02-18T15:20:53.850Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,559512,0,540854,543259,577982,'F',TO_TIMESTAMP('2021-02-18 17:20:53','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 17:20:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T15:23:59.170Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-18 17:23:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=627589 ; -- 2021-02-18T15:24:17.314Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=575918 ; -- 2021-02-18T15:24:37.866Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,627589,0,543272,544713,577983,'F',TO_TIMESTAMP('2021-02-18 17:24:37','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',20,0,0,TO_TIMESTAMP('2021-02-18 17:24:37','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T15:34:40.946Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540560,544957,TO_TIMESTAMP('2021-02-18 17:34:40','YYYY-MM-DD HH24:MI:SS'),100,'Y','posted',18,TO_TIMESTAMP('2021-02-18 17:34:40','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T15:34:58.262Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,879,0,159,544957,577984,'F',TO_TIMESTAMP('2021-02-18 17:34:58','YYYY-MM-DD HH24:MI:SS'),100,'Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.','Y','N','N','Y','N','N','N',0,'Buchungsdatum',10,0,0,TO_TIMESTAMP('2021-02-18 17:34:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-22T14:48:39.103Z -- URL zum Konzept UPDATE AD_Field SET AD_Name_ID=NULL, Description='Accounting Date', Help='The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.', Name='Buchungsdatum',Updated=TO_TIMESTAMP('2021-02-22 16:48:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559512 ; -- 2021-02-22T14:48:39.567Z -- URL zum Konzept /* DDL */ select update_FieldTranslation_From_AD_Name_Element(263) ; -- 2021-02-22T14:48:39.636Z -- URL zum Konzept DELETE FROM AD_Element_Link WHERE AD_Field_ID=559512 ; -- 2021-02-22T14:48:39.685Z -- URL zum Konzept /* DDL */ select AD_Element_Link_Create_Missing_Field(559512) ; -- 2021-02-22T14:51:22.781Z -- URL zum Konzept DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=547475 ; -- 2021-02-22T14:57:38.162Z -- URL zum Konzept UPDATE AD_Field SET DisplayLogic='@Processed@=''Y''',Updated=TO_TIMESTAMP('2021-02-22 16:57:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=557702 ;
the_stack
-- MySQL dump 10.13 Distrib 5.7.23, for Linux (x86_64) -- -- Host: 127.0.0.1 Database: jobspider -- ------------------------------------------------------ -- Server version 5.7.23-0ubuntu0.16.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `job_ai` -- DROP TABLE IF EXISTS `job_ai`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `job_ai` ( `url` varchar(300) NOT NULL, `url_obj_id` varchar(60) NOT NULL, `title` varchar(100) NOT NULL, `salary_min` float DEFAULT NULL, `salary_max` float DEFAULT NULL, `job_city` varchar(100) DEFAULT NULL, `experience_year` varchar(30) DEFAULT NULL, `education_need` varchar(30) DEFAULT NULL, `publish_date` varchar(20) DEFAULT NULL, `job_advantage_tags` varchar(100) DEFAULT NULL, `position_info` longtext, `job_classification` varchar(50) DEFAULT NULL, `crawl_time` datetime NOT NULL, `crawl_update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`url_obj_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='人工智能表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `job_ai` -- LOCK TABLES `job_ai` WRITE; /*!40000 ALTER TABLE `job_ai` DISABLE KEYS */; /*!40000 ALTER TABLE `job_ai` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `job_arithmetic` -- DROP TABLE IF EXISTS `job_arithmetic`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `job_arithmetic` ( `url` varchar(300) NOT NULL, `url_obj_id` varchar(60) NOT NULL, `title` varchar(100) NOT NULL, `salary_min` float DEFAULT NULL, `salary_max` float DEFAULT NULL, `job_city` varchar(100) DEFAULT NULL, `experience_year` varchar(30) DEFAULT NULL, `education_need` varchar(30) DEFAULT NULL, `publish_date` varchar(20) DEFAULT NULL, `job_advantage_tags` varchar(100) DEFAULT NULL, `position_info` longtext, `job_classification` varchar(50) DEFAULT NULL, `crawl_time` datetime NOT NULL, `crawl_update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`url_obj_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='arithmetic算法表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `job_arithmetic` -- LOCK TABLES `job_arithmetic` WRITE; /*!40000 ALTER TABLE `job_arithmetic` DISABLE KEYS */; /*!40000 ALTER TABLE `job_arithmetic` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `job_bigdata` -- DROP TABLE IF EXISTS `job_bigdata`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `job_bigdata` ( `url` varchar(300) NOT NULL, `url_obj_id` varchar(60) NOT NULL, `title` varchar(100) NOT NULL, `salary_min` float DEFAULT NULL, `salary_max` float DEFAULT NULL, `job_city` varchar(100) DEFAULT NULL, `experience_year` varchar(30) DEFAULT NULL, `education_need` varchar(30) DEFAULT NULL, `publish_date` varchar(20) DEFAULT NULL, `job_advantage_tags` varchar(100) DEFAULT NULL, `position_info` longtext, `job_classification` varchar(50) DEFAULT NULL, `crawl_time` datetime NOT NULL, `crawl_update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`url_obj_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='大数据表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `job_bigdata` -- LOCK TABLES `job_bigdata` WRITE; /*!40000 ALTER TABLE `job_bigdata` DISABLE KEYS */; /*!40000 ALTER TABLE `job_bigdata` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `job_cplus` -- DROP TABLE IF EXISTS `job_cplus`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `job_cplus` ( `url` varchar(300) NOT NULL, `url_obj_id` varchar(60) NOT NULL, `title` varchar(100) NOT NULL, `salary_min` float DEFAULT NULL, `salary_max` float DEFAULT NULL, `job_city` varchar(100) DEFAULT NULL, `experience_year` varchar(30) DEFAULT NULL, `education_need` varchar(30) DEFAULT NULL, `publish_date` varchar(20) DEFAULT NULL, `job_advantage_tags` varchar(100) DEFAULT NULL, `position_info` longtext, `job_classification` varchar(50) DEFAULT NULL, `crawl_time` datetime NOT NULL, `crawl_update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`url_obj_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='C++表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `job_cplus` -- LOCK TABLES `job_cplus` WRITE; /*!40000 ALTER TABLE `job_cplus` DISABLE KEYS */; /*!40000 ALTER TABLE `job_cplus` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `job_go` -- DROP TABLE IF EXISTS `job_go`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `job_go` ( `url` varchar(300) NOT NULL, `url_obj_id` varchar(60) NOT NULL, `title` varchar(100) NOT NULL, `salary_min` float DEFAULT NULL, `salary_max` float DEFAULT NULL, `job_city` varchar(100) DEFAULT NULL, `experience_year` varchar(30) DEFAULT NULL, `education_need` varchar(30) DEFAULT NULL, `publish_date` varchar(20) DEFAULT NULL, `job_advantage_tags` varchar(100) DEFAULT NULL, `position_info` longtext, `job_classification` varchar(50) DEFAULT NULL, `crawl_time` datetime NOT NULL, `crawl_update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`url_obj_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Go语言表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `job_go` -- LOCK TABLES `job_go` WRITE; /*!40000 ALTER TABLE `job_go` DISABLE KEYS */; /*!40000 ALTER TABLE `job_go` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `job_java` -- DROP TABLE IF EXISTS `job_java`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `job_java` ( `url` varchar(300) NOT NULL, `url_obj_id` varchar(60) NOT NULL, `title` varchar(100) NOT NULL, `salary_min` float DEFAULT NULL, `salary_max` float DEFAULT NULL, `job_city` varchar(100) DEFAULT NULL, `experience_year` varchar(30) DEFAULT NULL, `education_need` varchar(30) DEFAULT NULL, `publish_date` varchar(20) DEFAULT NULL, `job_advantage_tags` varchar(100) DEFAULT NULL, `position_info` longtext, `job_classification` varchar(50) DEFAULT NULL, `crawl_time` datetime NOT NULL, `crawl_update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`url_obj_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='JAVA表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `job_java` -- LOCK TABLES `job_java` WRITE; /*!40000 ALTER TABLE `job_java` DISABLE KEYS */; /*!40000 ALTER TABLE `job_java` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `job_python` -- DROP TABLE IF EXISTS `job_python`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `job_python` ( `url` varchar(300) NOT NULL, `url_obj_id` varchar(60) NOT NULL, `title` varchar(100) NOT NULL, `salary_min` float DEFAULT NULL, `salary_max` float DEFAULT NULL, `job_city` varchar(100) DEFAULT NULL, `experience_year` varchar(30) DEFAULT NULL, `education_need` varchar(30) DEFAULT NULL, `publish_date` varchar(20) DEFAULT NULL, `job_advantage_tags` varchar(100) DEFAULT NULL, `position_info` longtext, `job_classification` varchar(50) DEFAULT NULL, `crawl_time` datetime NOT NULL, `crawl_update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`url_obj_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='python表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `job_python` -- LOCK TABLES `job_python` WRITE; /*!40000 ALTER TABLE `job_python` DISABLE KEYS */; /*!40000 ALTER TABLE `job_python` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `job_test` -- DROP TABLE IF EXISTS `job_test`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `job_test` ( `url` varchar(300) NOT NULL, `url_obj_id` varchar(60) NOT NULL, `title` varchar(100) NOT NULL, `salary_min` float DEFAULT NULL, `salary_max` float DEFAULT NULL, `job_city` varchar(100) DEFAULT NULL, `experience_year` varchar(30) DEFAULT NULL, `education_need` varchar(30) DEFAULT NULL, `publish_date` varchar(20) DEFAULT NULL, `job_advantage_tags` varchar(100) DEFAULT NULL, `position_info` longtext, `job_classification` varchar(50) DEFAULT NULL, `crawl_time` datetime NOT NULL, `crawl_update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`url_obj_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Go语言表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `job_test` -- LOCK TABLES `job_test` WRITE; /*!40000 ALTER TABLE `job_test` DISABLE KEYS */; /*!40000 ALTER TABLE `job_test` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2018-09-20 9:49:17
the_stack
 DROP VIEW IF EXISTS dlm.indices; CREATE OR REPLACE VIEW dlm.indices AS SELECT c_t.relname table_name, c_i.relname index_name, pg_relation_size(c_i.relname::regclass) AS current_index_size, pg_size_pretty(pg_relation_size(c_i.relname::regclass)) AS current_index_size_pretty, pg_get_indexdef(indexrelid) || ';' AS current_index_create_ddl, 'DROP INDEX IF EXISTS ' || c_i.relname || ';' AS index_drop_ddl, pg_get_indexdef(indexrelid) || CASE /* prepend the "where" and the condition */ WHEN NOT pg_get_indexdef(indexrelid) ILIKE '% WHERE %' THEN ' WHERE COALESCE(dlm_level, 0::smallint) = 0::smallint' /* just prepend the condition, there is already a "where" */ WHEN pg_get_indexdef(indexrelid) ILIKE '% WHERE %' AND NOT pg_get_indexdef(indexrelid) ILIKE ' WHERE%COALESCE(dlm_level, 0::smallint) = 0::smallint%' THEN ' AND COALESCE(dlm_level, 0::smallint) = 0::smallint' /* do nothing */ WHEN pg_get_indexdef(indexrelid) ILIKE ' WHERE %COALESCE(dlm_level, 0::smallint) = 0::smallint%' THEN '' END || ';' AS new_index_create_ddl FROM pg_index i JOIN pg_class c_t ON c_t.oid = i.indrelid JOIN pg_class c_i ON c_i.oid = i.indexrelid WHERE true AND c_t.relname LIKE '%_tbl' AND NOT i.IndIsPrimary AND NOT i.indIsUnique AND NOT c_i.relname ILIKE '%_dlm_level' /* dont't fiddle with "our" DLM indexes, that's already done elsewhere */ ORDER BY index_name; COMMENT ON VIEW dlm.indices IS 'This view *was* used by the functions that DLM and un-DLM tables. Currently it seems as if we won''t need it in future'; DROP VIEW IF EXISTS dlm.triggers; CREATE OR REPLACE VIEW dlm.triggers AS SELECT fk_info.*, ------------------------- DDL to drop the trigger ------------------------- 'DROP TRIGGER IF EXISTS dlm_' || fk_info.constraint_name || '_tg ON '|| fk_info.foreign_table_name ||';' AS drop_dlm_trigger_ddl, ------------------------- DDL to create the trigger ------------------------- 'DROP TRIGGER IF EXISTS dlm_' || fk_info.constraint_name || '_tg ON '|| fk_info.foreign_table_name ||'; CREATE CONSTRAINT TRIGGER dlm_' || fk_info.constraint_name || '_tg AFTER UPDATE OF DLM_Level ON '|| fk_info.foreign_table_name ||' DEFERRABLE INITIALLY DEFERRED FOR EACH ROW WHEN (NEW.DLM_Level > 0) /* only fire when we migrate out of production */ EXECUTE PROCEDURE dlm.' || fk_info.constraint_name || '_tgfn();' AS create_dlm_trigger_ddl, ------------------------- DDL to create the trgger function ------------------------- 'DROP FUNCTION IF EXISTS dlm.' || fk_info.constraint_name || '_tgfn(); CREATE OR REPLACE FUNCTION dlm.' || fk_info.constraint_name || '_tgfn() RETURNS trigger AS $BODY$ DECLARE v_referencing_id numeric(10,0); v_referencing_level smallint; BEGIN /* check if the referencing table has a DLM_Level column after all. In both cases, we will raise an exception, but with a different error code, because it needs to be handled differently */ /* TODO: consider never selecting the DLM_Level of the referencing table, because we might not need the information and that way we would only need to have different error code and message, but could use most of the code for both cases */ IF EXISTS (SELECT column_name FROM information_schema.columns WHERE table_name='''|| fk_info.table_name ||''' and column_name=''dlm_level'') THEN SELECT r.' || fk_info.column_name || ', r.DLM_Level INTO v_referencing_id, v_referencing_level FROM '|| fk_info.table_name ||' r WHERE r.'|| fk_info.column_name || '= NEW.'|| fk_info.foreign_column_name ||' AND COLAESCE(r.DLM_Level,0)=0; IF v_referencing_id IS NOT NULL THEN RAISE EXCEPTION ''ERROR: Migrating the '|| fk_info.foreign_table_name ||' record with '|| fk_info.foreign_column_name ||'=% to DLM_Level=% violates the constraint trigger dlm_' || fk_info.constraint_name || '_tg'', NEW.'|| fk_info.foreign_column_name ||', NEW.DLM_Level USING ERRCODE = ''235D3'', /* ''23503'' is defined as foreign_key_violation.. we use 235D3, with "D" for DLM */ HINT=''The '|| fk_info.table_name ||' record with '|| fk_info.foreign_column_name ||'=''|| v_referencing_id ||'' and DLM_Level=''|| v_referencing_level ||'' still references that record via its '||fk_info.column_name||' column'', DETAIL=''DLM_Referencing_Table_Name='|| fk_info.table_name ||'; DLM_Referencig_Column_Name='||fk_info.column_name||';'' /* shall be parsable by metasfresh*/ ; END IF; ELSE SELECT r.' || fk_info.column_name || ' INTO v_referencing_id FROM '|| fk_info.table_name ||' r WHERE r.'|| fk_info.column_name || '= NEW.'|| fk_info.foreign_column_name ||' ; IF v_referencing_id IS NOT NULL THEN RAISE EXCEPTION ''ERROR: Migrating the '|| fk_info.foreign_table_name ||' record with '|| fk_info.foreign_column_name ||'=% to DLM_Level=% violates the constraint trigger dlm_' || fk_info.constraint_name || '_tg'', NEW.'|| fk_info.foreign_column_name ||', NEW.DLM_Level USING ERRCODE = ''235D3'', /* ''23503'' is defined as foreign_key_violation.. we use 235D3, with "D" for DLM */ HINT=''The '|| fk_info.table_name ||' record with '|| fk_info.foreign_column_name ||'=''|| v_referencing_id ||'' and *no* DLM_Level column still references that record via its '||fk_info.column_name||' column'', DETAIL=''DLM_Referencing_Table_Name='|| fk_info.table_name ||'; DLM_Referencig_Column_Name='||fk_info.column_name||';'' /* shall be parsable by metasfresh*/ ; END IF; END IF; RETURN NULL; END; $BODY$ LANGUAGE plpgsql VOLATILE; COMMENT ON function dlm.' || fk_info.constraint_name || '_tgfn() IS ''See view dlm.triggers for details.'';' AS create_dlm_triggerfunction_ddl ------------------------- FROM ( -- thanks to http://stackoverflow.com/questions/1152260/postgres-sql-to-list-table-foreign-keys SELECT tc.constraint_name, tc.table_name, kcu.column_name, ccu.table_name AS foreign_table_name, ccu.column_name AS foreign_column_name FROM information_schema.table_constraints AS tc JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name WHERE tc.constraint_type = 'FOREIGN KEY' ) fk_info ; COMMENT ON VIEW dlm.triggers IS 'gh #235, #489: selects foreign key constraints and creates the DDL for a trigger and trigger-function that is analog to the respective FK constraint. The trigger checks if the referencing records are within the same DLM_Level (or are DLM''ed at all). If this is not the case, then the trigger-function raises an exception with error-code: * 235D3 if the referencing table has a DLM_Level column, but with a highter value. * 235N3 if the referncing table does not have a DLM_Level column. In both cases, the change of the DLM_Level column of the referenced table is not allowed to happen, because it would mean that for metasfresh as seen from the referencing record, the referened record would vanish. Note that 23503 is defined as "foreign_key_violation"'; CREATE OR REPLACE FUNCTION dlm.add_table_to_dlm(p_table_name text) RETURNS void AS $BODY$ DECLARE -- v_index_view_row dlm.indices; v_trigger_view_row dlm.triggers; BEGIN EXECUTE 'ALTER TABLE ' || p_table_name || ' RENAME TO ' || p_table_name || '_tbl;'; RAISE NOTICE 'Renamed table % to %', p_table_name, p_table_name||'_tbl'; BEGIN EXECUTE 'ALTER TABLE ' || p_table_name || '_tbl ADD COLUMN DLM_Level smallint;'; /* using smallint, see https://www.postgresql.org/docs/9.1/static/datatype-numeric.html */ RAISE NOTICE 'Added column DLM_Level to table %', p_table_name||'_tbl'; EXCEPTION WHEN duplicate_column THEN RAISE NOTICE 'Column DLM_Level already exists in %. Nothing do to', p_table_name||'_tbl'; END; BEGIN EXECUTE 'ALTER TABLE ' || p_table_name || '_tbl ADD COLUMN DLM_Partion_ID numeric(10,0);'; RAISE NOTICE 'Added column DLM_Partion_ID to table %', p_table_name||'_tbl'; EXCEPTION WHEN duplicate_column THEN RAISE NOTICE 'Column DLM_Partion_ID already exists in %. Nothing do to', p_table_name||'_tbl'; END; /* partial index; we *wanted* postgresql to actually pick this one, because it's small and doesn't grow with the table (as long as we manage to limit the number of "production" records). But we can't have current_setting('metasfresh.DLM_Level') in the index predicate (a.k.a. where-clause) because current_setting() is not an immutable function. Also see http://stackoverflow.com/a/26031289/1012103 EXECUTE 'CREATE INDEX ' || p_table_name || '_DLM_Level ON ' || p_table_name || '_tbl (COALESCE(DLM_Level,0::smallint)) WHERE COALESCE(DLM_Level,0::smallint) = 0::smallint;'; RAISE NOTICE 'Created index %_DLM_Level', p_table_name; */ /* non-partial index; it's large and grows with the table, but so does everything else, and the DBMS will only have to keep those blocks in memory that have DLM_Level=0. And this way we have the flexibility to go with current_setting('metasfresh.DLM_Level'). */ EXECUTE 'CREATE INDEX ' || p_table_name || '_DLM_Level ON ' || p_table_name || '_tbl (COALESCE(DLM_Level,0::smallint))'; EXECUTE 'CREATE VIEW dlm.' || p_table_name || ' AS SELECT * FROM ' || p_table_name || '_tbl WHERE COALESCE(DLM_Level,0::smallint) <= current_setting(''metasfresh.DLM_Level'')::smallint;'; RAISE NOTICE 'Created view dlm.%', p_table_name; FOR v_trigger_view_row IN EXECUTE 'SELECT * FROM dlm.triggers v WHERE lower(v.foreign_table_name) = lower('''|| p_table_name ||'_tbl'')' LOOP EXECUTE v_trigger_view_row.create_dlm_triggerfunction_ddl; EXECUTE v_trigger_view_row.create_dlm_trigger_ddl; RAISE NOTICE 'Created dlm trigger and trigger-function analog to FK constraint %', v_trigger_view_row.constraint_name; END LOOP; /* make sure that the DB actually takes note of what we just did */ EXECUTE 'ANALYZE ' || p_table_name || '_tbl;'; RAISE NOTICE 'Called ANALYZE %', p_table_name || '_tbl'; END; $BODY$ LANGUAGE plpgsql VOLATILE; COMMENT ON FUNCTION dlm.add_table_to_dlm(text) IS 'gh #235, #489: DLMs the given table: * Adds a DLM_Level and DLM_Partion_ID column to the table. * Renames the table to "<tablename>_tbl" and creates a view named <tablename> that selects * from the table, but has a where-clause to make it select only records with DLM_Level <= current_setting(''metasfresh.DLM_Level'') * Creates an index for the new DLM_Level column * iterates "incoming" FK constraints for the table and creates a trigger&triggerfunction to avoid "dangling" references in case a record''s DLM_Level is increased. See the view dlm.triggers for more details. * Does an analyze on the table '; CREATE OR REPLACE FUNCTION dlm.remove_table_from_dlm(p_table_name text, p_retain_dlm_column boolean DEFAULT true) RETURNS void AS $BODY$ DECLARE v_trigger_view_row dlm.triggers; BEGIN EXECUTE 'DROP VIEW IF EXISTS dlm.' || p_table_name; EXECUTE 'DROP INDEX IF EXISTS ' || p_table_name || '_DLM_Level;'; IF p_retain_dlm_column = false THEN EXECUTE 'ALTER TABLE ' || p_table_name || '_Tbl DROP COLUMN IF EXISTS DLM_Level;'; EXECUTE 'ALTER TABLE ' || p_table_name || '_Tbl DROP COLUMN IF EXISTS DLM_Partion_ID;'; RAISE NOTICE 'Dropped columns DLM_Level and DLM_Partion_ID from table % (if they existed)', p_table_name; ELSE RAISE NOTICE 'Retained columns DLM_Level and DLM_Partion_ID of table %', p_table_name; END IF; FOR v_trigger_view_row IN EXECUTE 'SELECT * FROM dlm.triggers v WHERE lower(v.foreign_table_name) = lower('''|| p_table_name ||'_tbl'')' LOOP EXECUTE v_trigger_view_row.drop_dlm_trigger_ddl; RAISE NOTICE 'Dropped dlm trigger analog to FK constraint %', v_trigger_view_row.constraint_name; END LOOP; EXECUTE 'ALTER TABLE ' || p_table_name || '_Tbl RENAME TO ' || p_table_name || ';'; RAISE NOTICE 'Renamed table % back to % ', p_table_name||'_Tbl', p_table_name; END; $BODY$ LANGUAGE plpgsql VOLATILE; COMMENT ON FUNCTION dlm.remove_table_from_dlm(text, boolean) IS 'gh #235, #489: Un-DLMs the given table: * drops the view and removes the "_tbl" suffix from the table name * drops partial indices * drops the tiggers and triggerfunctions that were created using the dlm.triggers view. * optionally drops the DLM_Level and DLM_Partion_ID column, if told so explicitly with the p_retain_dlm_column parameter set to false.' ;
the_stack
# ************************************************************ # Sequel Pro SQL dump # Version 4541 # # http://www.sequelpro.com/ # https://github.com/sequelpro/sequelpro # # Host: 10.176.63.206 (MySQL 5.7.19) # Database: udc # Generation Time: 2018-10-02 06:32:14 +0000 # ************************************************************ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; # Dump of table pc_object_schema_map # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_object_schema_map`; CREATE TABLE `pc_object_schema_map` ( `object_id` int(11) NOT NULL AUTO_INCREMENT, `object_name` varchar(500) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', `container_name` varchar(500) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', `storage_system_id` int(11) NOT NULL, `object_schema` json DEFAULT NULL, `is_self_discovered` enum('Y','N') NOT NULL DEFAULT 'N', `is_registered` enum('Y','N','P') NOT NULL, `is_active_y_n` enum('Y','N') NOT NULL DEFAULT 'Y', `query` text, `created_timestamp_on_store` varchar(100) NOT NULL, `created_user_on_store` varchar(100) NOT NULL, `cre_user` varchar(45) DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT NULL, PRIMARY KEY (`object_id`), UNIQUE KEY `uniq_idx` (`object_name`,`container_name`,`storage_system_id`), KEY `system_fk_idx` (`storage_system_id`), CONSTRAINT `system_fk` FOREIGN KEY (`storage_system_id`) REFERENCES `pc_storage_system` (`storage_system_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; LOCK TABLES `pc_object_schema_map` WRITE; /*!40000 ALTER TABLE `pc_object_schema_map` DISABLE KEYS */; INSERT INTO `pc_object_schema_map` (`object_id`, `object_name`, `container_name`, `storage_system_id`, `object_schema`, `is_self_discovered`, `is_registered`, `is_active_y_n`, `query`, `created_timestamp_on_store`, `created_user_on_store`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (39,'flights_log1234','flights',69,'[{"columnName": "payload", "columnType": "dynamic", "columnClass": "", "columnIndex": 0, "partitionStatus": false, "restrictionStatus": false}]','Y','Y','Y','','','gimeldev','gimeladmin','2018-03-26 14:28:29','gimeladmin','2018-08-20 14:33:55'), (43,'flights_data12','flights',69,'[{"columnName": "payload", "columnType": "dynamic", "columnFamily": "NA"}]','Y','N','Y','','2018-08-16 17:03:09','gimeldev','gimeladmin','2018-03-26 15:20:05','gimeladmin','2018-06-23 16:55:49'), (44,'flights_enriched','flights',68,'[{"columnName": "payload", "columnType": "dynamic"}]','Y','N','Y','','2018-08-16 17:03:09','gimeldev','gimeladmin','2018-03-26 15:41:22','gimeladmin','2018-06-27 14:41:50'), (45,'flights_lkp_airport_details','flights_db',68,'[{"columnName": "payload", "columnType": "dynamic"}]','Y','N','Y','','2018-08-16 17:03:09','gimeldev','gimeladmin','2018-03-26 15:56:55','gimeladmin','2018-06-23 15:21:59'), (46,'flights_lkp_airport_details1','flights_db',70,'[{"columnName": "payload", "columnType": "dynamic"}]','Y','N','Y','','2018-08-16 17:03:09','gimeldev','gimeladmin','2018-03-26 16:36:08','gimeladmin','2018-06-22 13:23:04'), (47,'flights_lkp_cancellation_code','flights_db',66,'[{"columnName": "payload", "columnType": "dynamic", "columnFamily": "NA"}]','N','N','Y','','2018-08-16 17:03:09','gimeldev','gimeladmin','2018-03-26 16:49:10','gimeladmin','2018-03-26 16:49:10'), (48,'flights_lkp_cancellation','flights_db',66,'[{"columnName": "code", "columnType": "string", "columnClass": "", "columnIndex": 0, "columnFamily": "NA", "partitionStatus": false, "restrictionStatus": false}, {"columnName": "description", "columnType": "string", "columnClass": "", "columnIndex": 0, "columnFamily": "NA", "partitionStatus": false, "restrictionStatus": false}]','Y','N','Y','','2018-08-16 17:03:09','gimeldev','gimeladmin','2018-03-26 16:50:39','gimeladmin','2018-08-17 11:00:29'), (49,'flights_lkp_airline','flights_db',66,'[{"columnName": "code", "columnType": "string", "columnFamily": "NA"}, {"columnName": "description", "columnType": "string", "columnFamily": "NA"}]','N','N','Y',NULL,'2018-08-16 17:03:09','gimeldev','gimeladmin','2018-03-26 16:51:49','gimeladmin','2018-05-01 09:45:58'), (50,'flights_lkp_carrier','flights_db',66,'[{"columnName": "code", "columnType": "string", "columnFamily": "NA"}, {"columnName": "description", "columnType": "string", "columnFamily": "NA"}]','Y','N','Y','','2018-08-16 17:03:09','gimeldev','gimeladmin','2018-03-26 16:51:57','gimeladmin','2018-06-27 14:38:21'); /*!40000 ALTER TABLE `pc_object_schema_map` ENABLE KEYS */; UNLOCK TABLES; # Dump of table pc_ranger_policy # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_ranger_policy`; CREATE TABLE `pc_ranger_policy` ( `derived_policy_id` int(11) NOT NULL AUTO_INCREMENT, `policy_id` int(11) NOT NULL, `cluster_id` int(11) NOT NULL, `policy_name` varchar(1000) CHARACTER SET utf8 NOT NULL DEFAULT '', `type_name` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '', `policy_locations` longtext CHARACTER SET utf8 NOT NULL, `is_active_y_n` enum('Y','N') CHARACTER SET utf8 NOT NULL, `cre_user` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`derived_policy_id`), UNIQUE KEY `policy_name_id_cluster_UNIQUE` (`policy_id`,`cluster_id`,`policy_name`), KEY `cluster_id_fk` (`cluster_id`), CONSTRAINT `cluster_id_fk` FOREIGN KEY (`cluster_id`) REFERENCES `pc_storage_clusters` (`cluster_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; # Dump of table pc_ranger_policy_user_group # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_ranger_policy_user_group`; CREATE TABLE `pc_ranger_policy_user_group` ( `derived_policy_user_group_id` int(11) NOT NULL AUTO_INCREMENT, `derived_policy_id` int(11) NOT NULL, `access_types` longtext NOT NULL, `users` mediumtext NOT NULL, `groups` mediumtext NOT NULL, `is_active_y_n` enum('Y','N') NOT NULL, `cre_user` varchar(45) DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`derived_policy_user_group_id`), KEY `derived_policy_id_fk` (`derived_policy_id`), CONSTRAINT `derived_policy_id_fk` FOREIGN KEY (`derived_policy_id`) REFERENCES `pc_ranger_policy` (`derived_policy_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # Dump of table pc_storage # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_storage`; CREATE TABLE `pc_storage` ( `storage_id` int(11) NOT NULL AUTO_INCREMENT, `storage_name` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `storage_desc` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `is_active_y_n` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL, `cre_user` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`storage_id`), UNIQUE KEY `storage_name_UNIQUE` (`storage_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; LOCK TABLES `pc_storage` WRITE; /*!40000 ALTER TABLE `pc_storage` DISABLE KEYS */; INSERT INTO `pc_storage` (`storage_id`, `storage_name`, `storage_desc`, `is_active_y_n`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (2,'Nosql','Nosql Databases - 1','Y','gimeladmin','2017-03-27 19:42:51','gimeladmin','2018-10-01 22:36:05'), (3,'Document','Document based Datastores','Y','gimeladmin','2017-03-27 19:42:51','gimeladmin','2018-10-01 22:36:05'), (5,'Streaming','Streaming Platform Storage','Y','gimeladmin','2017-03-27 19:42:51','gimeladmin','2018-10-01 22:36:05'), (6,'RDBMS','Relational Databases','Y','gimeladmin','2017-03-27 19:42:51','gimeladmin','2018-10-01 22:36:05'), (7,'InMemory','Memory Cache Systems','Y','gimeladmin','2018-02-21 14:22:48','gimeladmin','2018-10-01 22:36:05'); /*!40000 ALTER TABLE `pc_storage` ENABLE KEYS */; UNLOCK TABLES; # Dump of table pc_storage_clusters # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_storage_clusters`; CREATE TABLE `pc_storage_clusters` ( `cluster_id` int(11) NOT NULL AUTO_INCREMENT, `cluster_name` varchar(45) NOT NULL, `cluster_description` varchar(1000) DEFAULT NULL, `livy_end_point` varchar(100) NOT NULL DEFAULT '', `livy_port` int(11) NOT NULL, `is_active_y_n` enum('Y','N') NOT NULL, `cre_user` varchar(45) DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`cluster_id`), UNIQUE KEY `cluster_name_UNIQUE` (`cluster_name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; LOCK TABLES `pc_storage_clusters` WRITE; /*!40000 ALTER TABLE `pc_storage_clusters` DISABLE KEYS */; INSERT INTO `pc_storage_clusters` (`cluster_id`, `cluster_name`, `cluster_description`, `livy_end_point`, `livy_port`, `is_active_y_n`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (4,'Cluster10','Cluster10 is a POC Cluster - Make / Break at will','a.b.c.d',8989,'Y','gimeladmin','2017-08-01 11:43:37','gimeladmin','2018-10-01 22:34:39'), (5,'Cluster1','Cluster1 is a production cluster','e.f.g.h',8989,'Y','gimeladmin','2017-08-01 11:43:37','gimeladmin','2018-10-01 22:34:47'), (6,'Cluster2','Cluster2 is a production cluster for XYZ','i.j.k.l',8989,'Y','gimeladmin','2017-08-01 11:43:37','gimeladmin','2018-10-01 22:34:56'); /*!40000 ALTER TABLE `pc_storage_clusters` ENABLE KEYS */; UNLOCK TABLES; # Dump of table pc_storage_dataset # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_storage_dataset`; CREATE TABLE `pc_storage_dataset` ( `storage_dataset_id` int(11) NOT NULL AUTO_INCREMENT, `storage_dataset_name` varchar(200) CHARACTER SET utf8 NOT NULL, `storage_dataset_alias_name` varchar(500) CHARACTER SET utf8 NOT NULL, `storage_database_name` varchar(500) CHARACTER SET utf8 DEFAULT NULL, `storage_dataset_desc` varchar(500) CHARACTER SET utf8 NOT NULL, `storage_system_id` int(11) DEFAULT NULL, `is_active_y_n` enum('Y','N') CHARACTER SET utf8 DEFAULT NULL, `object_schema_map_id` int(11) NOT NULL, `is_auto_registered` enum('Y','N') CHARACTER SET utf8 NOT NULL, `user_id` int(11) NOT NULL, `cre_user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`storage_dataset_id`), UNIQUE KEY `storage_dataset_uniq_cnst` (`storage_dataset_name`,`storage_dataset_alias_name`,`object_schema_map_id`,`is_auto_registered`), KEY `dataset_user_fk_idx` (`user_id`), KEY `dataset_object_fk_idx` (`object_schema_map_id`), CONSTRAINT `dataset_object_fk` FOREIGN KEY (`object_schema_map_id`) REFERENCES `pc_object_schema_map` (`object_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `dataset_user_fk` FOREIGN KEY (`user_id`) REFERENCES `pc_users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; LOCK TABLES `pc_storage_dataset` WRITE; /*!40000 ALTER TABLE `pc_storage_dataset` DISABLE KEYS */; INSERT INTO `pc_storage_dataset` (`storage_dataset_id`, `storage_dataset_name`, `storage_dataset_alias_name`, `storage_database_name`, `storage_dataset_desc`, `storage_system_id`, `is_active_y_n`, `object_schema_map_id`, `is_auto_registered`, `user_id`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (883,'flights_log_test','flights_log_test','udc','flights_log',69,'Y',39,'Y',22,'gimeldev','2018-03-26 14:37:09','gimeldev','2018-10-01 22:42:21'), (885,'flights_cancelled','flights_cancelled','udc','Elastic Search Data with Enriched Details on Cancelled flights',68,'Y',45,'N',22,'gimeldev','2018-03-26 15:58:19','gimeldev','2018-10-01 22:42:21'), (886,'flights_lkp_airport','flights_lkp_airport','udc','Airport Details',70,'Y',46,'N',22,'gimeldev','2018-03-26 16:37:03','gimeldev','2018-10-01 22:42:21'), (887,'flights_lookup_airline_id_TD','flights_lookup_airline_id_TD','udc','Airline Lookup',66,'Y',49,'N',22,'gimeldev','2018-03-26 16:53:41','gimeldev','2018-10-01 22:42:21'), (888,'flights_lookup_cancellation_code_TD4','flights_lookup_cancellation_code_TD4','udc','flights_lookup_cancellation_code_TD4',66,'Y',48,'N',22,'gimeldev','2018-03-26 16:54:30','gimeldev','2018-10-01 22:42:21'), (889,'flights_lookup_carrier_code_td_2','flights_lookup_carrier_code_td','udc','Lookup Carrier',66,'Y',50,'N',22,'gimeldev','2018-03-26 16:55:12','gimeldev','2018-10-01 22:42:21'), (890,'flights_dataset123','flights_dataset','udc','Demo',69,'Y',39,'N',22,'gimeldev','2018-03-27 13:38:22','gimeldev','2018-10-01 22:42:21'), (892,'flights_123','flights_123','udc','Demo',69,'Y',39,'N',22,'gimeldev','2018-03-28 19:07:57','gimeldev','2018-10-01 22:42:21'); /*!40000 ALTER TABLE `pc_storage_dataset` ENABLE KEYS */; UNLOCK TABLES; # Dump of table pc_storage_dataset_change_log_registered # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_storage_dataset_change_log_registered`; CREATE TABLE `pc_storage_dataset_change_log_registered` ( `storage_dataset_change_log_id` int(11) NOT NULL AUTO_INCREMENT, `storage_dataset_id` int(11) NOT NULL, `storage_dataset_name` varchar(200) CHARACTER SET utf8 NOT NULL, `storage_dataset_alias_name` varchar(10000) COLLATE utf8_unicode_ci DEFAULT NULL, `storage_container_name` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL, `storage_database_name` varchar(500) CHARACTER SET utf8 DEFAULT NULL, `storage_dataset_desc` varchar(500) CHARACTER SET utf8 DEFAULT NULL, `storage_system_id` int(11) NOT NULL, `storage_cluster_id` int(11) DEFAULT NULL, `user_id` int(11) NOT NULL, `storage_dataset_query` longtext COLLATE utf8_unicode_ci, `storage_dataset_schema` text CHARACTER SET utf8, `storage_deployment_status` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `storage_dataset_change_type` enum('C','M','D') CHARACTER SET utf8 DEFAULT NULL, `cre_user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`storage_dataset_change_log_id`), KEY `data_set_change_log_fk_idx` (`storage_dataset_id`), KEY `cluster_change_log_fk_idx` (`storage_cluster_id`), KEY `user_change_log_fk_idx` (`user_id`), KEY `system_dataset_change_log_fk_idx` (`storage_system_id`), CONSTRAINT `cluster_change_log_fk` FOREIGN KEY (`storage_cluster_id`) REFERENCES `pc_storage_clusters` (`cluster_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `data_set_change_log_fk` FOREIGN KEY (`storage_dataset_id`) REFERENCES `pc_storage_dataset` (`storage_dataset_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `system_dataset_change_log_fk` FOREIGN KEY (`storage_system_id`) REFERENCES `pc_storage_system` (`storage_system_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `user_change_log_fk` FOREIGN KEY (`user_id`) REFERENCES `pc_users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; # Dump of table pc_storage_dataset_system # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_storage_dataset_system`; CREATE TABLE `pc_storage_dataset_system` ( `storage_system_dataset_id` int(11) NOT NULL AUTO_INCREMENT, `storage_system_id` int(11) NOT NULL, `storage_dataset_id` int(11) NOT NULL, `is_active_y_n` enum('Y','N') DEFAULT NULL, `cre_user` varchar(45) DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`storage_system_dataset_id`), KEY `system_id_ws_fk_idx` (`storage_system_id`), KEY `dataset_id_ds_fk_idx` (`storage_dataset_id`), CONSTRAINT `dataset_id_ds_fk` FOREIGN KEY (`storage_dataset_id`) REFERENCES `pc_storage_dataset` (`storage_dataset_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `system_id_ds_fk` FOREIGN KEY (`storage_system_id`) REFERENCES `pc_storage_system` (`storage_system_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `pc_storage_dataset_system` WRITE; /*!40000 ALTER TABLE `pc_storage_dataset_system` DISABLE KEYS */; INSERT INTO `pc_storage_dataset_system` (`storage_system_dataset_id`, `storage_system_id`, `storage_dataset_id`, `is_active_y_n`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (956,69,883,'Y','gimeladmin','2018-03-26 14:37:09','gimeladmin','2018-10-01 22:55:00'), (958,68,885,'Y','gimeladmin','2018-03-26 15:58:19','gimeladmin','2018-10-01 22:55:00'), (959,70,886,'Y','gimeladmin','2018-03-26 16:37:03','gimeladmin','2018-10-01 22:55:00'), (960,66,887,'Y','gimeladmin','2018-03-26 16:53:41','gimeladmin','2018-10-01 22:55:00'), (961,66,888,'Y','gimeladmin','2018-03-26 16:54:30','gimeladmin','2018-10-01 22:55:00'), (962,66,889,'Y','gimeladmin','2018-03-26 16:55:12','gimeladmin','2018-10-01 22:55:00'), (963,69,890,'Y','gimeladmin','2018-03-27 13:38:22','gimeladmin','2018-10-01 22:55:00'), (965,69,892,'Y','gimeladmin','2018-03-28 19:07:57','gimeladmin','2018-10-01 22:55:00'); /*!40000 ALTER TABLE `pc_storage_dataset_system` ENABLE KEYS */; UNLOCK TABLES; # Dump of table pc_storage_object_attribute_value # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_storage_object_attribute_value`; CREATE TABLE `pc_storage_object_attribute_value` ( `object_attribute_value_id` int(11) NOT NULL AUTO_INCREMENT, `storage_ds_attribute_key_id` int(11) NOT NULL, `object_id` int(11) NOT NULL, `object_attribute_value` longtext NOT NULL, `is_customized` enum('Y','N') NOT NULL DEFAULT 'N', `is_active_y_n` enum('Y','N') DEFAULT NULL, `cre_user` varchar(45) DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`object_attribute_value_id`), UNIQUE KEY `object_type_value_uniq_idx` (`object_attribute_value`(1000),`storage_ds_attribute_key_id`,`object_id`), KEY `type_object_attribute_fk_idx` (`storage_ds_attribute_key_id`), KEY `object_attribute_fk` (`object_id`), CONSTRAINT `object_attribute_fk` FOREIGN KEY (`object_id`) REFERENCES `pc_object_schema_map` (`object_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `type_object_attribute_fk` FOREIGN KEY (`storage_ds_attribute_key_id`) REFERENCES `pc_storage_type_attribute_key` (`storage_ds_attribute_key_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; LOCK TABLES `pc_storage_object_attribute_value` WRITE; /*!40000 ALTER TABLE `pc_storage_object_attribute_value` DISABLE KEYS */; INSERT INTO `pc_storage_object_attribute_value` (`object_attribute_value_id`, `storage_ds_attribute_key_id`, `object_id`, `object_attribute_value`, `is_customized`, `is_active_y_n`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (18,103,39,'updated_6','N','Y','gimeladmin','2018-03-26 14:28:29','gimeladmin','2018-10-01 22:53:57'), (23,78,43,'updated','N','Y','gimeladmin','2018-03-26 15:20:05','gimeladmin','2018-10-01 22:53:57'), (24,79,43,'updated again','N','Y','gimeladmin','2018-03-26 15:20:05','gimeladmin','2018-10-01 22:53:57'), (25,80,43,'flights.flights_log','N','Y','gimeladmin','2018-03-26 15:20:05','gimeladmin','2018-10-01 22:53:57'), (26,82,43,'flights.flights_log','N','Y','gimeladmin','2018-03-26 15:20:05','gimeladmin','2018-10-01 22:53:57'), (27,101,43,'org.apache.kafka.common.serialization.StringDeserializer','N','Y','gimeladmin','2018-03-26 15:20:05','gimeladmin','2018-10-01 22:53:57'), (28,103,43,'org.apache.kafka.common.serialization.StringDeserializer','N','Y','gimeladmin','2018-03-26 15:20:05','gimeladmin','2018-10-01 22:53:57'), (29,63,44,'Delimiter_1','N','Y','gimeladmin','2018-03-26 15:41:22','gimeladmin','2018-10-01 22:53:57'), (30,64,44,'N','N','Y','gimeladmin','2018-03-26 15:41:22','gimeladmin','2018-10-01 22:53:57'), (31,65,44,'flights/data','N','Y','gimeladmin','2018-03-26 15:41:22','gimeladmin','2018-10-01 22:53:57'), (32,63,45,'_','N','Y','gimeladmin','2018-03-26 15:56:55','gimeladmin','2018-10-01 22:53:57'), (33,64,45,'N','Y','Y','gimeladmin','2018-03-26 15:56:55','gimeladmin','2018-10-01 22:53:57'), (34,65,45,'flights/data','Y','Y','gimeladmin','2018-03-26 15:56:55','gimeladmin','2018-10-01 22:53:57'), (35,91,46,'csv','Y','Y','gimeladmin','2018-03-26 16:36:08','gimeladmin','2018-10-01 22:53:57'), (36,92,46,'/user/flights/lkp/flights_lkp_airport_details','Y','Y','gimeladmin','2018-03-26 16:36:08','gimeladmin','2018-10-01 22:53:57'), (37,86,47,'flights_db.flights_lkp_cancellation_code','N','Y','gimeladmin','2018-03-26 16:49:10','gimeladmin','2018-03-26 16:49:10'), (38,86,48,'tables.abcd','Y','Y','gimeladmin','2018-03-26 16:50:39','gimeladmin','2018-10-01 22:53:57'), (39,86,49,'flights_db.flights_lkp_airline11','Y','Y','gimeladmin','2018-03-26 16:51:49','gimeladmin','2018-10-01 22:53:57'), (40,86,50,'updated_2','Y','Y','gimeladmin','2018-03-26 16:51:57','gimeladmin','2018-10-01 22:53:57'), (41,72,43,'/tmp/zookeeper/checkpoint/flights_log','N','Y','gimeladmin','2018-04-23 13:51:54','gimeladmin','2018-10-01 22:53:57'), (43,72,39,'checkpoint','N','Y','gimeladmin','2018-05-02 15:53:38','gimeladmin','2018-10-01 22:53:57'), (44,78,39,'kryo','N','Y','gimeladmin','2018-05-02 15:53:38','gimeladmin','2018-10-01 22:53:57'), (45,79,39,'key','N','Y','gimeladmin','2018-05-02 15:53:38','gimeladmin','2018-10-01 22:53:57'), (46,80,39,'hello','N','Y','gimeladmin','2018-05-02 15:53:38','gimeladmin','2018-10-01 22:53:57'), (47,82,39,'doctor','Y','Y','gimeladmin','2018-05-02 15:53:38','gimeladmin','2018-10-01 22:53:57'), (117,101,39,'heart','N','Y','gimeladmin','2018-07-31 17:49:30','gimeladmin','2018-10-01 22:53:57'), (124,123,39,'Defaults','Y','Y','gimeladmin','2018-09-28 18:28:13','gimeladmin','2018-10-01 22:53:57'), (125,123,43,'Defaults','Y','Y','gimeladmin','2018-09-28 18:28:13','gimeladmin','2018-10-01 22:53:57'); /*!40000 ALTER TABLE `pc_storage_object_attribute_value` ENABLE KEYS */; UNLOCK TABLES; # Dump of table pc_storage_system # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_storage_system`; CREATE TABLE `pc_storage_system` ( `storage_system_id` int(11) NOT NULL AUTO_INCREMENT, `storage_system_name` varchar(1000) CHARACTER SET utf8 NOT NULL DEFAULT '', `storage_system_desc` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL, `storage_type_id` int(11) NOT NULL, `running_cluster_id` int(11) NOT NULL, `zone_id` int(11) NOT NULL, `admin_user` int(11) DEFAULT NULL, `is_active_y_n` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL, `is_gimel_compatible` enum('Y','N') COLLATE utf8_unicode_ci DEFAULT 'Y', `is_read_compatible` enum('Y','N') COLLATE utf8_unicode_ci DEFAULT 'Y', `cre_user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`storage_system_id`), UNIQUE KEY `storage_system_name_UNIQUE` (`storage_system_name`), KEY `pc_storage_system_ibfk_1_idx` (`storage_type_id`), KEY `admin_user_system_fk` (`admin_user`), KEY `running_cluster` (`running_cluster_id`), KEY `zone_id` (`zone_id`), CONSTRAINT `admin_user_system_fk` FOREIGN KEY (`admin_user`) REFERENCES `pc_users` (`user_id`), CONSTRAINT `pc_storage_system_ibfk_1` FOREIGN KEY (`zone_id`) REFERENCES `pc_zones` (`zone_id`), CONSTRAINT `running_cluster` FOREIGN KEY (`running_cluster_id`) REFERENCES `pc_storage_clusters` (`cluster_id`), CONSTRAINT `system_type_fk` FOREIGN KEY (`storage_type_id`) REFERENCES `pc_storage_type` (`storage_type_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; LOCK TABLES `pc_storage_system` WRITE; /*!40000 ALTER TABLE `pc_storage_system` DISABLE KEYS */; INSERT INTO `pc_storage_system` (`storage_system_id`, `storage_system_name`, `storage_system_desc`, `storage_type_id`, `running_cluster_id`, `zone_id`, `admin_user`, `is_active_y_n`, `is_gimel_compatible`, `is_read_compatible`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (64,'Hbase.Cluster10','QA HBase operations',32,5,1,34,'Y','Y','Y','gimeladmin','2018-02-15 16:56:08','gimeladmin','2018-10-01 23:06:30'), (65,'Hbase.Cluster1','HBASE Development',32,4,1,34,'Y','Y','Y','gimeladmin','2018-02-15 16:56:42','gimeladmin','2018-10-01 23:06:30'), (66,'Teradata.Dev','Development teradata cluster-1',35,4,1,34,'Y','Y','Y','gimeladmin','2018-02-15 16:58:16','gimeladmin','2018-10-01 23:06:30'), (67,'Teradata.Prod','Prod teradata cluster',35,4,1,34,'Y','Y','Y','gimeladmin','2018-02-15 17:00:21','gimeladmin','2018-10-01 23:06:30'), (68,'Elastic.Cluster-Ops','Elastic Search operational logs',33,4,2,34,'Y','N','N','gimeladmin','2018-02-15 17:02:47','gimeladmin','2018-10-01 23:06:30'), (69,'Kafka.Transactional','Transactional Cluster High Speed + Hive Volume Low Rentention ',34,4,1,34,'Y','Y','Y','gimeladmin','2018-02-15 17:06:16','gimeladmin','2018-10-01 23:06:30'), (70,'Hive.Prod-1','Production 1 Hive',36,4,1,34,'Y','Y','Y','gimeladmin','2018-02-15 17:07:05','gimeladmin','2018-10-01 23:06:30'), (71,'Hive.Prod-2','Production 2 Hive',36,5,1,34,'Y','Y','Y','gimeladmin','2018-02-15 17:07:27','gimeladmin','2018-10-01 23:06:30'), (72,'Hive.QA-1','Hadoop-Hive-QA-1',36,6,1,34,'Y','Y','Y','gimeladmin','2018-02-15 17:07:49','gimeladmin','2018-10-01 23:06:30'), (73,'Teradata.QA','This is a cluster for Site Integration for Analytics Results',35,4,1,34,'Y','Y','Y','gimeladmin','2018-02-15 17:09:06','gimeladmin','2018-10-01 23:06:30'); /*!40000 ALTER TABLE `pc_storage_system` ENABLE KEYS */; UNLOCK TABLES; # Dump of table pc_storage_system_attribute_value # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_storage_system_attribute_value`; CREATE TABLE `pc_storage_system_attribute_value` ( `storage_system_attribute_value_id` int(11) NOT NULL AUTO_INCREMENT, `storage_system_attribute_value` varchar(1000) NOT NULL, `storage_ds_attribute_key_id` int(11) DEFAULT NULL, `storage_system_id` int(11) DEFAULT NULL, `is_active_y_n` enum('Y','N') NOT NULL, `cre_user` varchar(45) DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`storage_system_attribute_value_id`), UNIQUE KEY `storage_system_attribute_unique_idx` (`storage_system_id`,`storage_ds_attribute_key_id`,`storage_system_attribute_value`), KEY `pc_system_id_fk_idx` (`storage_system_id`), KEY `pc_data_attribute_key_fk_idx` (`storage_ds_attribute_key_id`), CONSTRAINT `pc_data_attribute_key_fk` FOREIGN KEY (`storage_ds_attribute_key_id`) REFERENCES `pc_storage_type_attribute_key` (`storage_ds_attribute_key_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `pc_system_id_fk` FOREIGN KEY (`storage_system_id`) REFERENCES `pc_storage_system` (`storage_system_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `pc_storage_system_attribute_value` WRITE; /*!40000 ALTER TABLE `pc_storage_system_attribute_value` DISABLE KEYS */; INSERT INTO `pc_storage_system_attribute_value` (`storage_system_attribute_value_id`, `storage_system_attribute_value`, `storage_ds_attribute_key_id`, `storage_system_id`, `is_active_y_n`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (32,'HBASE',62,64,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (33,'HBASE',62,65,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (34,'JDBC',83,66,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (35,'jdbc:teradata://prodteradata.com',84,66,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (36,'com.teradata.jdbc.TeraDriver',85,66,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (37,'JDBC',83,67,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (38,'jdbc:teradata://testteradata.com',84,67,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (39,'com.teradata.jdbc.TeraDriver',85,67,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (40,'8080',66,68,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (41,'gcp.host.11,gcp.host.12,gcp.host.13',67,68,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (42,'ELASTIC_SEARCH',68,68,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (43,'KAFKA',69,69,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (44,'earliest',70,69,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (46,'gcp.host.1:2181,gcp.host.2:2181,gcp.host.3:2181,gcp.host.4:2181,gcp.host.5:2181',73,69,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (47,'http://pp-schema-reg:8081',74,69,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (48,'master.schema',75,69,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (49,'NA',76,69,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (50,'10000',77,69,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (51,'broker1:9092,broker2:9092,broker3:9092',81,69,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (52,'JDBC',83,73,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (53,'jdbc:teradata://prod2teradata.com',84,73,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (54,'com.teradata.jdbc.TeraDriver',85,73,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (59,'hdfs://devcluster.com:8020/',88,72,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (60,'devcluster',89,72,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (61,'HDFS',90,72,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (62,'abcd.com',87,72,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (63,'metastore',93,72,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (64,'3116',94,72,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (65,'Defaults',87,70,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (66,'hadoop.cluster.1.nn',88,70,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (67,'Defaults',89,70,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (68,'HIVE',90,70,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (69,'Defaults',93,70,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (70,'Defaults',94,70,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (71,'Defaults',87,71,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (72,'Defaults',88,71,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (73,'Defaults',89,71,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (74,'Defaults',90,71,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (75,'Defaults',93,71,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'), (76,'Defaults',94,71,'Y','gimeladmin',NULL,'gimeladmin','2018-10-01 22:52:34'); /*!40000 ALTER TABLE `pc_storage_system_attribute_value` ENABLE KEYS */; UNLOCK TABLES; # Dump of table pc_storage_system_container # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_storage_system_container`; CREATE TABLE `pc_storage_system_container` ( `storage_system_container_id` int(11) NOT NULL AUTO_INCREMENT, `storage_system_id` int(11) NOT NULL, `container_name` varchar(45) NOT NULL, `cluster_id` int(11) NOT NULL, `is_active_y_n` enum('Y','N') NOT NULL, `cre_user` varchar(45) DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT NULL, PRIMARY KEY (`storage_system_container_id`), KEY `storage_system_fk_idx` (`storage_system_id`), KEY `cluster_system_fk` (`cluster_id`), CONSTRAINT `cluster_system_fk` FOREIGN KEY (`cluster_id`) REFERENCES `pc_storage_clusters` (`cluster_id`), CONSTRAINT `storage_system_fk` FOREIGN KEY (`storage_system_id`) REFERENCES `pc_storage_system` (`storage_system_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; # Dump of table pc_storage_type # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_storage_type`; CREATE TABLE `pc_storage_type` ( `storage_type_id` int(11) NOT NULL AUTO_INCREMENT, `storage_type_name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `storage_type_desc` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL, `storage_id` int(11) NOT NULL, `is_active_y_n` enum('Y','N') CHARACTER SET utf8 NOT NULL, `cre_user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`storage_type_id`), UNIQUE KEY `storage_type_name_UNIQUE` (`storage_type_name`), KEY `storage_id` (`storage_id`), CONSTRAINT `pc_storage_type_ibfk_1` FOREIGN KEY (`storage_id`) REFERENCES `pc_storage` (`storage_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; LOCK TABLES `pc_storage_type` WRITE; /*!40000 ALTER TABLE `pc_storage_type` DISABLE KEYS */; INSERT INTO `pc_storage_type` (`storage_type_id`, `storage_type_name`, `storage_type_desc`, `storage_id`, `is_active_y_n`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (32,'Hbase','Hbase NoSQL DB',2,'Y','gimeladmin','2018-02-15 15:55:38','gimeladmin','2018-10-01 22:49:21'), (33,'Elastic','Elastic Search Type',3,'Y','gimeladmin','2018-02-15 16:38:46','gimeladmin','2018-10-01 22:49:21'), (34,'Kafka','Kafka Storage type used for streaming',5,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:49:21'), (35,'Teradata','Teradata storage type used for OLAP operations',6,'Y','gimeladmin','2018-02-15 16:52:12','gimeladmin','2018-10-01 22:49:21'), (36,'Hive','Hive storage type',6,'N','gimeladmin','2018-02-15 16:53:26','gimeladmin','2018-10-01 22:49:21'); /*!40000 ALTER TABLE `pc_storage_type` ENABLE KEYS */; UNLOCK TABLES; # Dump of table pc_storage_type_attribute_key # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_storage_type_attribute_key`; CREATE TABLE `pc_storage_type_attribute_key` ( `storage_ds_attribute_key_id` int(11) NOT NULL AUTO_INCREMENT, `storage_ds_attribute_key_name` varchar(1000) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `storage_ds_attribute_key_desc` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL, `is_storage_system_level` enum('Y','N') CHARACTER SET utf8 NOT NULL, `storage_type_id` int(11) NOT NULL, `is_active_y_n` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL, `cre_user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`storage_ds_attribute_key_id`), UNIQUE KEY `type_key_idx` (`storage_ds_attribute_key_name`,`storage_type_id`), KEY `pc_storage_ds_attribute_key_ibfk_1_idx` (`storage_type_id`), CONSTRAINT `pc_storage_type_attribute_key_ibfk_1` FOREIGN KEY (`storage_type_id`) REFERENCES `pc_storage_type` (`storage_type_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; LOCK TABLES `pc_storage_type_attribute_key` WRITE; /*!40000 ALTER TABLE `pc_storage_type_attribute_key` DISABLE KEYS */; INSERT INTO `pc_storage_type_attribute_key` (`storage_ds_attribute_key_id`, `storage_ds_attribute_key_name`, `storage_ds_attribute_key_desc`, `is_storage_system_level`, `storage_type_id`, `is_active_y_n`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (59,'gimel.hbase.columns.mapping','columns mapping','N',32,'Y','gimeladmin','2018-02-15 15:55:38','gimeladmin','2018-10-01 22:48:56'), (60,'gimel.hbase.table.name','table name','N',32,'Y','gimeladmin','2018-02-15 15:55:38','gimeladmin','2018-10-01 22:48:56'), (61,'gimel.hbase.namespace.name','hbase namespace name','N',32,'Y','gimeladmin','2018-02-15 15:55:38','gimeladmin','2018-10-01 22:48:56'), (62,'gimel.storage.type','hbase storage type flag','Y',32,'Y','gimeladmin','2018-02-15 15:55:38','gimeladmin','2018-10-01 22:48:56'), (63,'gimel.es.index.partition.delimiter','delimiter','N',33,'Y','gimeladmin','2018-02-15 16:38:46','gimeladmin','2018-10-01 22:48:56'), (64,'gimel.es.index.partition.isEnabled','is it partitioned','N',33,'Y','gimeladmin','2018-02-15 16:38:46','gimeladmin','2018-10-01 22:48:56'), (65,'es.resource','es index name','N',33,'Y','gimeladmin','2018-02-15 16:38:46','gimeladmin','2018-10-01 22:48:56'), (66,'es.port','port number','Y',33,'Y','gimeladmin','2018-02-15 16:38:46','gimeladmin','2018-10-01 22:48:56'), (67,'es.nodes','nodes for ES','Y',33,'Y','gimeladmin','2018-02-15 16:38:46','gimeladmin','2018-10-01 22:48:56'), (68,'gimel.storage.type','ES storage type flag','Y',33,'Y','gimeladmin','2018-02-15 16:41:50','gimeladmin','2018-10-01 22:48:56'), (69,'gimel.storage.type','pcatalog storage type key for kafka','Y',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (70,'auto.offset.reset','earliest offset','Y',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (72,'gimel.kafka.checkpoint.zookeeper.path','zookeeper path','N',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (73,'gimel.kafka.checkpoint.zookeeper.host','zookeeper host','Y',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (74,'gimel.kafka.avro.schema.source.url','schema registry URL','Y',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (75,'gimel.kafka.avro.schema.source.wrapper.key','wrapper key for source schema','Y',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (76,'gimel.kafka.avro.schema.source','source of avro schema','Y',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (77,'zookeeper.connection.timeout.ms','zookeeper time out','Y',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (78,'value.serializer','value serializer for kafka','N',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (79,'key.serializer','key serializer for kafka','N',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (80,'gimel.kafka.avro.schema.source.key','kafka topic name','N',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (81,'bootstrap.servers','broker list for kafka','Y',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (82,'gimel.kafka.whitelist.topics','kafka topic white list','N',34,'Y','gimeladmin','2018-02-15 16:47:40','gimeladmin','2018-10-01 22:48:56'), (83,'gimel.storage.type','pcatalog storage type key for teradata','Y',35,'Y','gimeladmin','2018-02-15 16:52:12','gimeladmin','2018-10-01 22:48:56'), (84,'gimel.jdbc.url','jdbc teradata cluster URL','Y',35,'Y','gimeladmin','2018-02-15 16:52:12','gimeladmin','2018-10-01 22:48:56'), (85,'gimel.jdbc.driver.class','teradata driver class','Y',35,'Y','gimeladmin','2018-02-15 16:52:12','gimeladmin','2018-10-01 22:48:56'), (86,'gimel.jdbc.input.table.name','teradata input table name','N',35,'Y','gimeladmin','2018-02-15 16:52:12','gimeladmin','2018-10-01 22:48:56'), (87,'gimel.hive.mysql.server','gimel hive mysql server','Y',36,'Y','gimeladmin','2018-03-23 12:16:23','gimeladmin','2018-10-01 22:48:56'), (88,'gimel.hdfs.nn','gimel hdfs name node','Y',36,'Y','gimeladmin','2018-03-23 12:17:06','gimeladmin','2018-10-01 22:48:56'), (89,'gimel.hdfs.storage.name','gimel storage name','Y',36,'Y','gimeladmin','2018-03-23 12:17:42','gimeladmin','2018-10-01 22:48:56'), (90,'gimel.storage.type','gimel storage type','Y',36,'Y','gimeladmin','2018-03-23 12:18:13','gimeladmin','2018-10-01 22:48:56'), (91,'gimel.hdfs.data.format','gimel hdfs data format','N',36,'Y','gimeladmin','2018-03-23 12:18:45','gimeladmin','2018-10-01 22:48:56'), (92,'gimel.hdfs.data.location','gimel hdfs data format location','N',36,'Y','gimeladmin','2018-03-23 12:19:20','gimeladmin','2018-10-01 22:48:56'), (93,'gimel.hive.mysql.db','gimel hive mysql DB','Y',36,'Y','gimeladmin','2018-03-23 17:04:09','gimeladmin','2018-10-01 22:48:56'), (94,'gimel.hive.mysql.port','gimel hive mysql port','Y',36,'Y','gimeladmin','2018-03-23 17:52:34','gimeladmin','2018-10-01 22:48:56'), (101,'key.deserializer','key deserializer for kafka','N',34,'Y','gimeladmin','2018-03-26 14:15:26','gimeladmin','2018-03-26 14:15:31'), (103,'value.deserializer','value deserializer for kafka','N',34,'Y','gimeladmin','2018-03-26 14:16:11','gimeladmin','2018-03-26 14:16:11'), (111,'gimel.hbase.rowkey','rowkey description','N',32,'Y','gimeladmin','2018-04-25 14:41:39','gimeladmin','2018-10-01 22:48:56'), (123,'key.deserializer.1','key.deserializer.1','N',34,'Y','gimeladmin','2018-09-28 18:28:13','gimeladmin','2018-10-01 22:48:56'); /*!40000 ALTER TABLE `pc_storage_type_attribute_key` ENABLE KEYS */; UNLOCK TABLES; # Dump of table pc_teradata_policy # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_teradata_policy`; CREATE TABLE `pc_teradata_policy` ( `teradata_policy_id` int(11) NOT NULL AUTO_INCREMENT, `database_name` varchar(200) NOT NULL DEFAULT '', `iam_role_name` varchar(200) NOT NULL DEFAULT '', `storage_system_id` int(11) NOT NULL, `is_active_y_n` enum('Y','N') DEFAULT NULL, `cre_user` varchar(45) DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`teradata_policy_id`), UNIQUE KEY `teradata_policy_uniq_idx` (`database_name`,`iam_role_name`,`storage_system_id`), KEY `storage_system_tera_policy_fk` (`storage_system_id`), CONSTRAINT `storage_system_tera_policy_fk` FOREIGN KEY (`storage_system_id`) REFERENCES `pc_storage_system` (`storage_system_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # Dump of table pc_users # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_users`; CREATE TABLE `pc_users` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `user_name` varchar(45) NOT NULL, `user_full_name` varchar(45) DEFAULT NULL, `is_active_y_n` enum('Y','N') NOT NULL, `cre_user` varchar(45) DEFAULT NULL, `cre_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) DEFAULT NULL, `upd_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`user_id`), UNIQUE KEY `user_name_UNIQUE` (`user_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `pc_users` WRITE; /*!40000 ALTER TABLE `pc_users` DISABLE KEYS */; INSERT INTO `pc_users` (`user_id`, `user_name`, `user_full_name`, `is_active_y_n`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (22,'gimeldev','Gimel Administrator','Y',NULL,'2018-03-26 11:17:18',NULL,'2018-08-06 10:16:19'), (34,'gimeladmin','gimeladmin','Y',NULL,'2018-06-20 23:59:48',NULL,'2018-06-21 16:12:11'); /*!40000 ALTER TABLE `pc_users` ENABLE KEYS */; UNLOCK TABLES; # Dump of table pc_zones # ------------------------------------------------------------ DROP TABLE IF EXISTS `pc_zones`; CREATE TABLE `pc_zones` ( `zone_id` int(11) NOT NULL AUTO_INCREMENT, `zone_name` varchar(100) NOT NULL, `zone_description` varchar(400) NOT NULL, `is_active_y_n` enum('Y','N') NOT NULL, `cre_user` varchar(45) DEFAULT NULL, `cre_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `upd_user` varchar(45) DEFAULT NULL, `upd_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`zone_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; LOCK TABLES `pc_zones` WRITE; /*!40000 ALTER TABLE `pc_zones` DISABLE KEYS */; INSERT INTO `pc_zones` (`zone_id`, `zone_name`, `zone_description`, `is_active_y_n`, `cre_user`, `cre_ts`, `upd_user`, `upd_ts`) VALUES (1,'az','Analytics zone','Y','gimeladmin','2018-08-22 13:35:17','gimeladmin','2018-10-01 22:47:55'), (2,'rz','restricted zone','Y','gimeladmin','2018-08-22 13:35:43','gimeladmin','2018-10-01 22:47:55'), (3,'corp','Corp zone','Y','gimeladmin','2018-08-22 13:36:11','gimeladmin','2018-10-01 22:47:55'); /*!40000 ALTER TABLE `pc_zones` ENABLE KEYS */; UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
the_stack
-- 2019-12-16T09:43:18.587Z -- URL zum Konzept UPDATE AD_Element_Trl SET Description='', Name='EDI-ID des DESADV-Empfängers', PrintName='EDI-ID des DESADV-Empfängers',Updated=TO_TIMESTAMP('2019-12-16 10:43:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542001 AND AD_Language='de_CH' ; -- 2019-12-16T09:43:18.596Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542001,'de_CH') ; -- 2019-12-16T09:43:25.172Z -- URL zum Konzept UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-12-16 10:43:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542001 AND AD_Language='de_CH' ; -- 2019-12-16T09:43:25.175Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542001,'de_CH') ; -- 2019-12-16T09:43:35.204Z -- URL zum Konzept UPDATE AD_Element_Trl SET Description='', Name='EDI-ID des DESADV-Empfängers', PrintName='EDI-ID des DESADV-Empfängers',Updated=TO_TIMESTAMP('2019-12-16 10:43:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542001 AND AD_Language='de_DE' ; -- 2019-12-16T09:43:35.205Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542001,'de_DE') ; -- 2019-12-16T09:43:35.211Z -- URL zum Konzept /* DDL */ select update_ad_element_on_ad_element_trl_update(542001,'de_DE') ; -- 2019-12-16T09:43:35.212Z -- URL zum Konzept UPDATE AD_Column SET ColumnName='EdiRecipientGLN', Name='EDI-ID des DESADV-Empfängers', Description='', Help=NULL WHERE AD_Element_ID=542001 ; -- 2019-12-16T09:43:35.213Z -- URL zum Konzept UPDATE AD_Process_Para SET ColumnName='EdiRecipientGLN', Name='EDI-ID des DESADV-Empfängers', Description='', Help=NULL, AD_Element_ID=542001 WHERE UPPER(ColumnName)='EDIRECIPIENTGLN' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2019-12-16T09:43:35.214Z -- URL zum Konzept UPDATE AD_Process_Para SET ColumnName='EdiRecipientGLN', Name='EDI-ID des DESADV-Empfängers', Description='', Help=NULL WHERE AD_Element_ID=542001 AND IsCentrallyMaintained='Y' ; -- 2019-12-16T09:43:35.214Z -- URL zum Konzept UPDATE AD_Field SET Name='EDI-ID des DESADV-Empfängers', Description='', Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542001) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 542001) ; -- 2019-12-16T09:43:35.227Z -- URL zum Konzept UPDATE AD_PrintFormatItem pi SET PrintName='EDI-ID des DESADV-Empfängers', Name='EDI-ID des DESADV-Empfängers' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542001) ; -- 2019-12-16T09:43:35.228Z -- URL zum Konzept UPDATE AD_Tab SET Name='EDI-ID des DESADV-Empfängers', Description='', Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 542001 ; -- 2019-12-16T09:43:35.229Z -- URL zum Konzept UPDATE AD_WINDOW SET Name='EDI-ID des DESADV-Empfängers', Description='', Help=NULL WHERE AD_Element_ID = 542001 ; -- 2019-12-16T09:43:35.229Z -- URL zum Konzept UPDATE AD_Menu SET Name = 'EDI-ID des DESADV-Empfängers', Description = '', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 542001 ; -- 2019-12-16T09:43:39.868Z -- URL zum Konzept UPDATE AD_Element_Trl SET Description='',Updated=TO_TIMESTAMP('2019-12-16 10:43:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542001 AND AD_Language='en_US' ; -- 2019-12-16T09:43:39.870Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542001,'en_US') ; -- 2019-12-16T09:46:26.337Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsEdiDesadvRecipient/N@=Y',Updated=TO_TIMESTAMP('2019-12-16 10:46:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=553178 ; -- 2019-12-16T09:46:34.590Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsEdiDesadvRecipient/N@=Y',Updated=TO_TIMESTAMP('2019-12-16 10:46:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=556622 ; -- 2019-12-16T10:29:17.445Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnSQL='(SELECT IsEdiInvoicRecipient from C_BPartner where C_BPartner_ID = C_Order.Bill_BPartner_ID)',Updated=TO_TIMESTAMP('2019-12-16 11:29:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=552603 ; -- 2019-12-16T10:35:51.916Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnSQL='(select bp.IsEdiInvoicRecipient from C_BPartner bp where bp.C_BPartner_ID=C_Doc_Outbound_Log.C_BPartner_ID)',Updated=TO_TIMESTAMP('2019-12-16 11:35:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=551507 ; -- 2019-12-16T10:38:06.540Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET AD_Element_ID=577426, ColumnName='IsEdiDesadvRecipient', DefaultValue='N', Description='', EntityType='de.metas.inoutcandidate', Help=NULL, IsCalculated='N', IsMandatory='N', Name='Erhält EDI-DESADV',Updated=TO_TIMESTAMP('2019-12-16 11:38:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=552463 ; -- 2019-12-16T10:38:06.541Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Erhält EDI-DESADV', Description='', Help=NULL WHERE AD_Column_ID=552463 ; -- 2019-12-16T10:38:06.542Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_Column_Translation_From_AD_Element(577426) ; -- 2019-12-16T10:38:22.929Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnSQL='( case when exists ( select 1 from C_BPartner bp where bp.C_BPartner_ID = M_ShipmentSchedule.C_Bpartner_ID AND bp.IsEdiDesadvRecipient = ''Y'') then ''Y'' else ''N'' end )',Updated=TO_TIMESTAMP('2019-12-16 11:38:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=552463 ; -- 2019-12-16T10:39:23.822Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnSQL='(SELECT IsEdiInvoicRecipient from C_BPartner where C_BPartner_ID = C_Invoice.C_BPartner_ID)',Updated=TO_TIMESTAMP('2019-12-16 11:39:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=552604 ; -- 2019-12-16T10:42:15.440Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET MandatoryLogic='@IsEdiDesadvRecipient@=Y', ReadOnlyLogic='@IsEdiDesadvRecipient@=N',Updated=TO_TIMESTAMP('2019-12-16 11:42:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=548483 ; -- 2019-12-16T10:44:58.642Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ReadOnlyLogic='@IsEdiInvoicRecipient/N@=N',Updated=TO_TIMESTAMP('2019-12-16 11:44:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=552599 ; -- 2019-12-16T10:45:48.639Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ReadOnlyLogic='@IsEdiInvoicRecipient/''N''@ = N',Updated=TO_TIMESTAMP('2019-12-16 11:45:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=548484 ; -- 2019-12-16T10:47:41.881Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET DefaultValue='@IsEdiDesadvRecipient/N@ | @IsEdiInvoicRecipient/N@', ReadOnlyLogic='@IsEdiDesadvRecipient/''N''@=''N'' & @IsEdiInvoicRecipient/''N''@=''N''',Updated=TO_TIMESTAMP('2019-12-16 11:47:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=552598 ; -- 2019-12-16T10:53:05.977Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Window SET IsActive='Y',Updated=TO_TIMESTAMP('2019-12-16 11:53:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=540018 ; -- 2019-12-16T10:53:05.986Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Description=NULL, IsActive='Y', Name='Cockpit',Updated=TO_TIMESTAMP('2019-12-16 11:53:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=540029 ; -- 2019-12-16T10:53:32.961Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsEdiDesadvRecipient@=Y',Updated=TO_TIMESTAMP('2019-12-16 11:53:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=551573 ; -- 2019-12-16T10:53:39.391Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2019-12-16 11:53:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=540018 ; -- 2019-12-16T10:53:39.394Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Description=NULL, IsActive='N', Name='Cockpit',Updated=TO_TIMESTAMP('2019-12-16 11:53:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=540029 ; -- 2019-12-16T10:55:12.945Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsEdiDesadvRecipient@=Y',Updated=TO_TIMESTAMP('2019-12-16 11:55:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559004 ; -- 2019-12-16T10:55:21.595Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsEdiDesadvRecipient/''N''@=''Y''',Updated=TO_TIMESTAMP('2019-12-16 11:55:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559004 ; update AD_field SET DisplayLogic='@IsEdiDesadvRecipient/''N''@=''Y''', Updated='2019-12-16 10:56:21.856929+00', UpdatedBy=99 WHERE AD_Field_ID=559003; update AD_field SET DisplayLogic='@IsEdiDesadvRecipient/''N''@=''Y''', Updated='2019-12-16 10:56:21.856929+00', UpdatedBy=99 WHERE AD_Field_ID=560040; update AD_field SET DisplayLogic='@IsEdiDesadvRecipient/''N''@=''Y''', Updated='2019-12-16 10:56:21.856929+00', UpdatedBy=99 WHERE AD_Field_ID=560039; update AD_field SET DisplayLogic='@IsEdiDesadvRecipient/''N''@=''Y''', Updated='2019-12-16 10:56:21.856929+00', UpdatedBy=99 WHERE AD_Field_ID=562075; update AD_field SET DisplayLogic='@IsEdiDesadvRecipient/''N''@=''Y''', Updated='2019-12-16 10:56:21.856929+00', UpdatedBy=99 WHERE AD_Field_ID=562074; update AD_field SET DisplayLogic='@IsEdiDesadvRecipient/''N''@=''Y''', Updated='2019-12-16 10:56:21.856929+00', UpdatedBy=99 WHERE AD_Field_ID=583139; update AD_field SET DisplayLogic='@IsEdiDesadvRecipient/''N''@=''Y''', Updated='2019-12-16 10:56:21.856929+00', UpdatedBy=99 WHERE AD_Field_ID=583138; -- 2019-12-16T12:04:02.862Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET DefaultValue='@IsEdiInvoicRecipient/N@',Updated=TO_TIMESTAMP('2019-12-16 13:04:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=552598 ; -- 2019-12-16T12:10:04.171Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET DefaultValue='@SQL=SELECT COALESCE( (SELECT IsEDIInvoicRecipient FROM C_BPartner where C_BPartner_ID = @Bill_BPartner_ID/-1@), ''N'')',Updated=TO_TIMESTAMP('2019-12-16 13:10:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=552564 ; DROP VIEW IF EXISTS "de_metas_invoicecandidate".c_invoice_candidate_failed_to_update_v; select db_alter_table('C_Invoice_Candidate','ALTER TABLE C_Invoice_Candidate RENAME COLUMN IsEdiRecipient TO IsEdiInvoicRecipient;'); -- View: de_metas_invoicecandidate.c_invoice_candidate_failed_to_update_v -- DROP VIEW de_metas_invoicecandidate.c_invoice_candidate_failed_to_update_v; CREATE OR REPLACE VIEW de_metas_invoicecandidate.c_invoice_candidate_failed_to_update_v AS SELECT now() AS found, NULL::timestamp with time zone AS reenqueued, 'N'::character(1) AS iserroracknowledged, 'C_Invoice_Candidate_Wrong_Qty_iol_v'::text AS problem_found_by, ic.ad_client_id, ic.ad_org_id, ic.c_invoice_candidate_id, ic.c_orderline_id, ic.created, ic.createdby, ic.isactive, ic.qtytoinvoice, ic.updated, ic.updatedby, ic.schedulerresult, ic.priceactual_override, ic.discount_override, ic.bill_bpartner_id, ic.bill_location_id, ic.bill_user_id, ic.invoicerule, ic.qtytoinvoicenetamt, ic.dateinvoiced, ic.istoclear, ic.m_product_id, ic.dateordered, ic.processed, ic.priceactual, ic.c_currency_id, ic.qtyordered, ic.qtydelivered, ic.qtyinvoiced, ic.qtytoinvoice_override, ic.qtytoinvoice_overridefulfilled, ic.c_charge_id, ic.bill_bpartner_override_id, ic.invoicerule_override, ic.m_pricingsystem_id, ic.discount, ic.netamttoinvoice, ic.netamtinvoiced, ic.c_invoice_candidate_agg_id, ic.lineaggregationkey, ic.lineaggregationkey_suffix, ic.c_ilcandhandler_id, ic.ad_table_id, ic.record_id, ic.iserror, ic.ad_note_id, ic.errormsg, ic.datetoinvoice, ic.datetoinvoice_override, ic.c_conversiontype_id, ic.invoicescheduleamtstatus, ic.ismanual, ic.description, ic.ad_user_incharge_id, ic.headeraggregationkey, ic.splitamt, ic.descriptionheader, ic.descriptionbottom, ic.priceentered, ic.priceentered_override, ic.issotrx, ic.qualitydiscountpercent_effective, ic.qualitynote_receiptschedule, ic.qualitydiscountpercent, ic.qualitydiscountpercent_override, ic.isindispute, ic.qtywithissues, ic.qtyorderedoverunder, ic.reasondiscount, ic.c_uom_id, ic.price_uom_id, ic.c_order_id, ic.c_activity_id, ic.c_tax_id, ic.qtytoinvoiceinpriceuom, ic.isprinted, ic.line, ic.c_doctypeinvoice_id, ic.m_material_tracking_id, ic.approvalforinvoicing, ic.c_tax_override_id, ic.poreference, ic.dateacct, ic.deliverydate, ic.m_inout_id, ic.priceactual_net_effective, ic.istaxincluded, ic.qtyenteredtu, ic.qtytoinvoicebeforediscount, ic.istaxincluded_override, ic.c_invoice_candidate_headeraggregation_id, ic.c_invoice_candidate_headeraggregation_override_id, ic.headeraggregationkey_calc, ic.c_invoice_candidate_headeraggregation_effective_id, ic.headeraggregationkeybuilder_id, ic.first_ship_bplocation_id, ic.isinoutapprovedforinvoicing, ic.qtywithissues_effective, ic.processed_override, ic.processed_calc, ic.task_08848_fixed, ic.lineaggregationkeybuilder_id, ic.ispackagingmaterial, ic.IsEdiInvoicRecipient, ic.isedienabled, ic.m_pricelist_version_id, ic.qualityinvoicelinegrouptype FROM c_invoice_candidate ic WHERE (ic.c_invoice_candidate_id IN ( SELECT c_invoice_candidate_wrong_qty_iol_v.c_invoice_candidate_id FROM de_metas_invoicecandidate.c_invoice_candidate_wrong_qty_iol_v)) UNION SELECT now() AS found, NULL::timestamp with time zone AS reenqueued, 'N'::bpchar AS iserroracknowledged, 'C_Invoice_Candidate_Wrong_Qtytoinvoice_V'::text AS problem_found_by, ic.ad_client_id, ic.ad_org_id, ic.c_invoice_candidate_id, ic.c_orderline_id, ic.created, ic.createdby, ic.isactive, ic.qtytoinvoice, ic.updated, ic.updatedby, ic.schedulerresult, ic.priceactual_override, ic.discount_override, ic.bill_bpartner_id, ic.bill_location_id, ic.bill_user_id, ic.invoicerule, ic.qtytoinvoicenetamt, ic.dateinvoiced, ic.istoclear, ic.m_product_id, ic.dateordered, ic.processed, ic.priceactual, ic.c_currency_id, ic.qtyordered, ic.qtydelivered, ic.qtyinvoiced, ic.qtytoinvoice_override, ic.qtytoinvoice_overridefulfilled, ic.c_charge_id, ic.bill_bpartner_override_id, ic.invoicerule_override, ic.m_pricingsystem_id, ic.discount, ic.netamttoinvoice, ic.netamtinvoiced, ic.c_invoice_candidate_agg_id, ic.lineaggregationkey, ic.lineaggregationkey_suffix, ic.c_ilcandhandler_id, ic.ad_table_id, ic.record_id, ic.iserror, ic.ad_note_id, ic.errormsg, ic.datetoinvoice, ic.datetoinvoice_override, ic.c_conversiontype_id, ic.invoicescheduleamtstatus, ic.ismanual, ic.description, ic.ad_user_incharge_id, ic.headeraggregationkey, ic.splitamt, ic.descriptionheader, ic.descriptionbottom, ic.priceentered, ic.priceentered_override, ic.issotrx, ic.qualitydiscountpercent_effective, ic.qualitynote_receiptschedule, ic.qualitydiscountpercent, ic.qualitydiscountpercent_override, ic.isindispute, ic.qtywithissues, ic.qtyorderedoverunder, ic.reasondiscount, ic.c_uom_id, ic.price_uom_id, ic.c_order_id, ic.c_activity_id, ic.c_tax_id, ic.qtytoinvoiceinpriceuom, ic.isprinted, ic.line, ic.c_doctypeinvoice_id, ic.m_material_tracking_id, ic.approvalforinvoicing, ic.c_tax_override_id, ic.poreference, ic.dateacct, ic.deliverydate, ic.m_inout_id, ic.priceactual_net_effective, ic.istaxincluded, ic.qtyenteredtu, ic.qtytoinvoicebeforediscount, ic.istaxincluded_override, ic.c_invoice_candidate_headeraggregation_id, ic.c_invoice_candidate_headeraggregation_override_id, ic.headeraggregationkey_calc, ic.c_invoice_candidate_headeraggregation_effective_id, ic.headeraggregationkeybuilder_id, ic.first_ship_bplocation_id, ic.isinoutapprovedforinvoicing, ic.qtywithissues_effective, ic.processed_override, ic.processed_calc, ic.task_08848_fixed, ic.lineaggregationkeybuilder_id, ic.ispackagingmaterial, ic.IsEdiInvoicRecipient, ic.isedienabled, ic.m_pricelist_version_id, ic.qualityinvoicelinegrouptype FROM c_invoice_candidate ic WHERE (ic.c_invoice_candidate_id IN ( SELECT c_invoice_candidate_wrong_qtytoinvoice_v.c_invoice_candidate_id FROM de_metas_invoicecandidate.c_invoice_candidate_wrong_qtytoinvoice_v)) UNION SELECT now() AS found, NULL::timestamp with time zone AS reenqueued, 'N'::bpchar AS iserroracknowledged, 'C_Invoice_Candidate_Wrong_Qty_ol_v'::text AS problem_found_by, ic.ad_client_id, ic.ad_org_id, ic.c_invoice_candidate_id, ic.c_orderline_id, ic.created, ic.createdby, ic.isactive, ic.qtytoinvoice, ic.updated, ic.updatedby, ic.schedulerresult, ic.priceactual_override, ic.discount_override, ic.bill_bpartner_id, ic.bill_location_id, ic.bill_user_id, ic.invoicerule, ic.qtytoinvoicenetamt, ic.dateinvoiced, ic.istoclear, ic.m_product_id, ic.dateordered, ic.processed, ic.priceactual, ic.c_currency_id, ic.qtyordered, ic.qtydelivered, ic.qtyinvoiced, ic.qtytoinvoice_override, ic.qtytoinvoice_overridefulfilled, ic.c_charge_id, ic.bill_bpartner_override_id, ic.invoicerule_override, ic.m_pricingsystem_id, ic.discount, ic.netamttoinvoice, ic.netamtinvoiced, ic.c_invoice_candidate_agg_id, ic.lineaggregationkey, ic.lineaggregationkey_suffix, ic.c_ilcandhandler_id, ic.ad_table_id, ic.record_id, ic.iserror, ic.ad_note_id, ic.errormsg, ic.datetoinvoice, ic.datetoinvoice_override, ic.c_conversiontype_id, ic.invoicescheduleamtstatus, ic.ismanual, ic.description, ic.ad_user_incharge_id, ic.headeraggregationkey, ic.splitamt, ic.descriptionheader, ic.descriptionbottom, ic.priceentered, ic.priceentered_override, ic.issotrx, ic.qualitydiscountpercent_effective, ic.qualitynote_receiptschedule, ic.qualitydiscountpercent, ic.qualitydiscountpercent_override, ic.isindispute, ic.qtywithissues, ic.qtyorderedoverunder, ic.reasondiscount, ic.c_uom_id, ic.price_uom_id, ic.c_order_id, ic.c_activity_id, ic.c_tax_id, ic.qtytoinvoiceinpriceuom, ic.isprinted, ic.line, ic.c_doctypeinvoice_id, ic.m_material_tracking_id, ic.approvalforinvoicing, ic.c_tax_override_id, ic.poreference, ic.dateacct, ic.deliverydate, ic.m_inout_id, ic.priceactual_net_effective, ic.istaxincluded, ic.qtyenteredtu, ic.qtytoinvoicebeforediscount, ic.istaxincluded_override, ic.c_invoice_candidate_headeraggregation_id, ic.c_invoice_candidate_headeraggregation_override_id, ic.headeraggregationkey_calc, ic.c_invoice_candidate_headeraggregation_effective_id, ic.headeraggregationkeybuilder_id, ic.first_ship_bplocation_id, ic.isinoutapprovedforinvoicing, ic.qtywithissues_effective, ic.processed_override, ic.processed_calc, ic.task_08848_fixed, ic.lineaggregationkeybuilder_id, ic.ispackagingmaterial, ic.IsEdiInvoicRecipient, ic.isedienabled, ic.m_pricelist_version_id, ic.qualityinvoicelinegrouptype FROM c_invoice_candidate ic WHERE (ic.c_invoice_candidate_id IN ( SELECT c_invoice_candidate_wrong_qty_ol_v.c_invoice_candidate_id FROM de_metas_invoicecandidate.c_invoice_candidate_wrong_qty_ol_v)) UNION SELECT now() AS found, NULL::timestamp with time zone AS reenqueued, 'N'::bpchar AS iserroracknowledged, 'C_Invoice_Candidate_Stale_QtyInvoiced_v'::text AS problem_found_by, ic.ad_client_id, ic.ad_org_id, ic.c_invoice_candidate_id, ic.c_orderline_id, ic.created, ic.createdby, ic.isactive, ic.qtytoinvoice, ic.updated, ic.updatedby, ic.schedulerresult, ic.priceactual_override, ic.discount_override, ic.bill_bpartner_id, ic.bill_location_id, ic.bill_user_id, ic.invoicerule, ic.qtytoinvoicenetamt, ic.dateinvoiced, ic.istoclear, ic.m_product_id, ic.dateordered, ic.processed, ic.priceactual, ic.c_currency_id, ic.qtyordered, ic.qtydelivered, ic.qtyinvoiced, ic.qtytoinvoice_override, ic.qtytoinvoice_overridefulfilled, ic.c_charge_id, ic.bill_bpartner_override_id, ic.invoicerule_override, ic.m_pricingsystem_id, ic.discount, ic.netamttoinvoice, ic.netamtinvoiced, ic.c_invoice_candidate_agg_id, ic.lineaggregationkey, ic.lineaggregationkey_suffix, ic.c_ilcandhandler_id, ic.ad_table_id, ic.record_id, ic.iserror, ic.ad_note_id, ic.errormsg, ic.datetoinvoice, ic.datetoinvoice_override, ic.c_conversiontype_id, ic.invoicescheduleamtstatus, ic.ismanual, ic.description, ic.ad_user_incharge_id, ic.headeraggregationkey, ic.splitamt, ic.descriptionheader, ic.descriptionbottom, ic.priceentered, ic.priceentered_override, ic.issotrx, ic.qualitydiscountpercent_effective, ic.qualitynote_receiptschedule, ic.qualitydiscountpercent, ic.qualitydiscountpercent_override, ic.isindispute, ic.qtywithissues, ic.qtyorderedoverunder, ic.reasondiscount, ic.c_uom_id, ic.price_uom_id, ic.c_order_id, ic.c_activity_id, ic.c_tax_id, ic.qtytoinvoiceinpriceuom, ic.isprinted, ic.line, ic.c_doctypeinvoice_id, ic.m_material_tracking_id, ic.approvalforinvoicing, ic.c_tax_override_id, ic.poreference, ic.dateacct, ic.deliverydate, ic.m_inout_id, ic.priceactual_net_effective, ic.istaxincluded, ic.qtyenteredtu, ic.qtytoinvoicebeforediscount, ic.istaxincluded_override, ic.c_invoice_candidate_headeraggregation_id, ic.c_invoice_candidate_headeraggregation_override_id, ic.headeraggregationkey_calc, ic.c_invoice_candidate_headeraggregation_effective_id, ic.headeraggregationkeybuilder_id, ic.first_ship_bplocation_id, ic.isinoutapprovedforinvoicing, ic.qtywithissues_effective, ic.processed_override, ic.processed_calc, ic.task_08848_fixed, ic.lineaggregationkeybuilder_id, ic.ispackagingmaterial, ic.IsEdiInvoicRecipient, ic.isedienabled, ic.m_pricelist_version_id, ic.qualityinvoicelinegrouptype FROM c_invoice_candidate ic WHERE (ic.c_invoice_candidate_id IN ( SELECT c_invoice_candidate_stale_qtyinvoiced_v.c_invoice_candidate_id FROM de_metas_invoicecandidate.c_invoice_candidate_stale_qtyinvoiced_v)) UNION SELECT now() AS found, NULL::timestamp with time zone AS reenqueued, 'N'::bpchar AS iserroracknowledged, 'C_Invoice_Candidate_Missing_HeaderAggregation_Effective_ID_v (was C_Invoice_Candidate_Missing_Aggregation_Group_v)'::text AS problem_found_by, ic.ad_client_id, ic.ad_org_id, ic.c_invoice_candidate_id, ic.c_orderline_id, ic.created, ic.createdby, ic.isactive, ic.qtytoinvoice, ic.updated, ic.updatedby, ic.schedulerresult, ic.priceactual_override, ic.discount_override, ic.bill_bpartner_id, ic.bill_location_id, ic.bill_user_id, ic.invoicerule, ic.qtytoinvoicenetamt, ic.dateinvoiced, ic.istoclear, ic.m_product_id, ic.dateordered, ic.processed, ic.priceactual, ic.c_currency_id, ic.qtyordered, ic.qtydelivered, ic.qtyinvoiced, ic.qtytoinvoice_override, ic.qtytoinvoice_overridefulfilled, ic.c_charge_id, ic.bill_bpartner_override_id, ic.invoicerule_override, ic.m_pricingsystem_id, ic.discount, ic.netamttoinvoice, ic.netamtinvoiced, ic.c_invoice_candidate_agg_id, ic.lineaggregationkey, ic.lineaggregationkey_suffix, ic.c_ilcandhandler_id, ic.ad_table_id, ic.record_id, ic.iserror, ic.ad_note_id, ic.errormsg, ic.datetoinvoice, ic.datetoinvoice_override, ic.c_conversiontype_id, ic.invoicescheduleamtstatus, ic.ismanual, ic.description, ic.ad_user_incharge_id, ic.headeraggregationkey, ic.splitamt, ic.descriptionheader, ic.descriptionbottom, ic.priceentered, ic.priceentered_override, ic.issotrx, ic.qualitydiscountpercent_effective, ic.qualitynote_receiptschedule, ic.qualitydiscountpercent, ic.qualitydiscountpercent_override, ic.isindispute, ic.qtywithissues, ic.qtyorderedoverunder, ic.reasondiscount, ic.c_uom_id, ic.price_uom_id, ic.c_order_id, ic.c_activity_id, ic.c_tax_id, ic.qtytoinvoiceinpriceuom, ic.isprinted, ic.line, ic.c_doctypeinvoice_id, ic.m_material_tracking_id, ic.approvalforinvoicing, ic.c_tax_override_id, ic.poreference, ic.dateacct, ic.deliverydate, ic.m_inout_id, ic.priceactual_net_effective, ic.istaxincluded, ic.qtyenteredtu, ic.qtytoinvoicebeforediscount, ic.istaxincluded_override, ic.c_invoice_candidate_headeraggregation_id, ic.c_invoice_candidate_headeraggregation_override_id, ic.headeraggregationkey_calc, ic.c_invoice_candidate_headeraggregation_effective_id, ic.headeraggregationkeybuilder_id, ic.first_ship_bplocation_id, ic.isinoutapprovedforinvoicing, ic.qtywithissues_effective, ic.processed_override, ic.processed_calc, ic.task_08848_fixed, ic.lineaggregationkeybuilder_id, ic.ispackagingmaterial, ic.IsEdiInvoicRecipient, ic.isedienabled, ic.m_pricelist_version_id, ic.qualityinvoicelinegrouptype FROM c_invoice_candidate ic WHERE (ic.c_invoice_candidate_id IN ( SELECT c_invoice_candidate_missing_headeraggregation_effective_id_v.c_invoice_candidate_id FROM de_metas_invoicecandidate.c_invoice_candidate_missing_headeraggregation_effective_id_v)) UNION SELECT now() AS found, NULL::timestamp with time zone AS reenqueued, 'N'::bpchar AS iserroracknowledged, 'C_Invoice_Candidate_Missing_C_Invoice_Candidate_Agg_ID_v'::text AS problem_found_by, ic.ad_client_id, ic.ad_org_id, ic.c_invoice_candidate_id, ic.c_orderline_id, ic.created, ic.createdby, ic.isactive, ic.qtytoinvoice, ic.updated, ic.updatedby, ic.schedulerresult, ic.priceactual_override, ic.discount_override, ic.bill_bpartner_id, ic.bill_location_id, ic.bill_user_id, ic.invoicerule, ic.qtytoinvoicenetamt, ic.dateinvoiced, ic.istoclear, ic.m_product_id, ic.dateordered, ic.processed, ic.priceactual, ic.c_currency_id, ic.qtyordered, ic.qtydelivered, ic.qtyinvoiced, ic.qtytoinvoice_override, ic.qtytoinvoice_overridefulfilled, ic.c_charge_id, ic.bill_bpartner_override_id, ic.invoicerule_override, ic.m_pricingsystem_id, ic.discount, ic.netamttoinvoice, ic.netamtinvoiced, ic.c_invoice_candidate_agg_id, ic.lineaggregationkey, ic.lineaggregationkey_suffix, ic.c_ilcandhandler_id, ic.ad_table_id, ic.record_id, ic.iserror, ic.ad_note_id, ic.errormsg, ic.datetoinvoice, ic.datetoinvoice_override, ic.c_conversiontype_id, ic.invoicescheduleamtstatus, ic.ismanual, ic.description, ic.ad_user_incharge_id, ic.headeraggregationkey, ic.splitamt, ic.descriptionheader, ic.descriptionbottom, ic.priceentered, ic.priceentered_override, ic.issotrx, ic.qualitydiscountpercent_effective, ic.qualitynote_receiptschedule, ic.qualitydiscountpercent, ic.qualitydiscountpercent_override, ic.isindispute, ic.qtywithissues, ic.qtyorderedoverunder, ic.reasondiscount, ic.c_uom_id, ic.price_uom_id, ic.c_order_id, ic.c_activity_id, ic.c_tax_id, ic.qtytoinvoiceinpriceuom, ic.isprinted, ic.line, ic.c_doctypeinvoice_id, ic.m_material_tracking_id, ic.approvalforinvoicing, ic.c_tax_override_id, ic.poreference, ic.dateacct, ic.deliverydate, ic.m_inout_id, ic.priceactual_net_effective, ic.istaxincluded, ic.qtyenteredtu, ic.qtytoinvoicebeforediscount, ic.istaxincluded_override, ic.c_invoice_candidate_headeraggregation_id, ic.c_invoice_candidate_headeraggregation_override_id, ic.headeraggregationkey_calc, ic.c_invoice_candidate_headeraggregation_effective_id, ic.headeraggregationkeybuilder_id, ic.first_ship_bplocation_id, ic.isinoutapprovedforinvoicing, ic.qtywithissues_effective, ic.processed_override, ic.processed_calc, ic.task_08848_fixed, ic.lineaggregationkeybuilder_id, ic.ispackagingmaterial, ic.IsEdiInvoicRecipient, ic.isedienabled, ic.m_pricelist_version_id, ic.qualityinvoicelinegrouptype FROM c_invoice_candidate ic WHERE (ic.c_invoice_candidate_id IN ( SELECT c_invoice_candidate_missing_c_invoice_candidate_agg_id_v.c_invoice_candidate_id FROM de_metas_invoicecandidate.c_invoice_candidate_missing_c_invoice_candidate_agg_id_v));
the_stack
-- 2020-04-23T12:02:46.433Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577683,0,'OffsetDays',TO_TIMESTAMP('2020-04-23 15:02:46','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.serviceprovider','Y','Offset days','Offset days',TO_TIMESTAMP('2020-04-23 15:02:46','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-04-23T12:02:46.448Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577683 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2020-04-23T12:03:23.368Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,577683,0,584679,541811,11,'OffsetDays',TO_TIMESTAMP('2020-04-23 15:03:23','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.serviceprovider',5,'Y','N','Y','N','N','N','Offset days',30,TO_TIMESTAMP('2020-04-23 15:03:23','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-04-23T12:03:23.373Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541811 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2020-04-23T12:04:00.184Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Process_Para_Trl WHERE AD_Process_Para_ID=541811 ; -- 2020-04-23T12:04:00.192Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Process_Para WHERE AD_Process_Para_ID=541811 ; -- 2020-04-23T12:04:46.970Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,1581,0,584679,541812,15,'DateFrom',TO_TIMESTAMP('2020-04-23 15:04:46','YYYY-MM-DD HH24:MI:SS'),100,'Startdatum eines Abschnittes','de.metas.serviceprovider',7,'Datum von bezeichnet das Startdatum eines Abschnittes','Y','N','Y','N','N','N','Datum von',30,TO_TIMESTAMP('2020-04-23 15:04:46','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-04-23T12:04:46.971Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541812 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2020-04-23T12:05:28.480Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET SeqNo=5,Updated=TO_TIMESTAMP('2020-04-23 15:05:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541812 ; -- 2020-04-23T12:06:03.493Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='External project reference ID', PrintName='External project reference ID',Updated=TO_TIMESTAMP('2020-04-23 15:06:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577601 AND AD_Language='de_CH' ; -- 2020-04-23T12:06:03.534Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577601,'de_CH') ; -- 2020-04-23T12:06:08.428Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='External project reference ID', PrintName='External project reference ID',Updated=TO_TIMESTAMP('2020-04-23 15:06:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577601 AND AD_Language='de_DE' ; -- 2020-04-23T12:06:08.429Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577601,'de_DE') ; -- 2020-04-23T12:06:08.446Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577601,'de_DE') ; -- 2020-04-23T12:06:08.449Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='S_ExternalProjectReference_ID', Name='External project reference ID', Description=NULL, Help=NULL WHERE AD_Element_ID=577601 ; -- 2020-04-23T12:06:08.453Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='S_ExternalProjectReference_ID', Name='External project reference ID', Description=NULL, Help=NULL, AD_Element_ID=577601 WHERE UPPER(ColumnName)='S_EXTERNALPROJECTREFERENCE_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-04-23T12:06:08.454Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='S_ExternalProjectReference_ID', Name='External project reference ID', Description=NULL, Help=NULL WHERE AD_Element_ID=577601 AND IsCentrallyMaintained='Y' ; -- 2020-04-23T12:06:08.455Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='External project reference ID', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577601) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577601) ; -- 2020-04-23T12:06:08.470Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='External project reference ID', Name='External project reference ID' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577601) ; -- 2020-04-23T12:06:08.472Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='External project reference ID', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577601 ; -- 2020-04-23T12:06:08.474Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='External project reference ID', Description=NULL, Help=NULL WHERE AD_Element_ID = 577601 ; -- 2020-04-23T12:06:08.475Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'External project reference ID', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577601 ; -- 2020-04-23T12:06:14.115Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='External project reference ID', PrintName='External project reference ID',Updated=TO_TIMESTAMP('2020-04-23 15:06:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577601 AND AD_Language='en_US' ; -- 2020-04-23T12:06:14.116Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577601,'en_US') ; -- 2020-04-23T12:06:20.683Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='External project reference ID', PrintName='External project reference ID',Updated=TO_TIMESTAMP('2020-04-23 15:06:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577601 AND AD_Language='nl_NL' ; -- 2020-04-23T12:06:20.684Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577601,'nl_NL') ; -- 2020-04-23T12:13:17.881Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,AllowProcessReRun,Classname,CopyFromProcess,Created,CreatedBy,EntityType,IsActive,IsApplySecuritySettings,IsBetaFunctionality,IsDirectPrint,IsNotifyUserAfterExecution,IsOneInstanceOnly,IsReport,IsServerProcess,IsTranslateExcelHeaders,IsUseBPartnerLanguage,LockWaitTimeout,Name,RefreshAllAfterExecution,ShowHelp,Type,Updated,UpdatedBy,Value) VALUES ('4',0,0,584688,'Y','de.metas.serviceprovider.github.ScheduledGithubImport','N',TO_TIMESTAMP('2020-04-23 15:13:17','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.serviceprovider','Y','N','N','N','N','N','N','N','Y','Y',0,'Scheduled Github import','N','N','Java',TO_TIMESTAMP('2020-04-23 15:13:17','YYYY-MM-DD HH24:MI:SS'),100,'Scheduled Github import') ; -- 2020-04-23T12:13:17.892Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_ID=584688 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) ; -- 2020-04-23T12:14:27.681Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,577683,0,584688,541813,11,'OffsetDays',TO_TIMESTAMP('2020-04-23 15:14:27','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.serviceprovider',5,'Y','N','Y','N','N','N','Offset days',10,TO_TIMESTAMP('2020-04-23 15:14:27','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-04-23T12:14:27.683Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541813 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2020-04-23T12:26:26.790Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Scheduler (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Role_ID,AD_Scheduler_ID,Created,CreatedBy,CronPattern,EntityType,Frequency,FrequencyType,IsActive,IsIgnoreProcessingTime,KeepLogDays,ManageScheduler,Name,Processing,SchedulerProcessType,ScheduleType,Status,Supervisor_ID,Updated,UpdatedBy) VALUES (0,0,584688,0,550061,TO_TIMESTAMP('2020-04-23 15:26:26','YYYY-MM-DD HH24:MI:SS'),100,'00 12/12 * * *','de.metas.serviceprovider',0,'D','Y','N',7,'N','Github Import scheduler','N','P','C','NEW',100,TO_TIMESTAMP('2020-04-23 15:26:26','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-04-23T12:26:50.755Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Scheduler_Para (AD_Client_ID,AD_Org_ID,AD_Process_Para_ID,AD_Scheduler_ID,AD_Scheduler_Para_ID,Created,CreatedBy,IsActive,ParameterDefault,Updated,UpdatedBy) VALUES (0,0,541813,550061,540010,TO_TIMESTAMP('2020-04-23 15:26:50','YYYY-MM-DD HH24:MI:SS'),100,'Y','1',TO_TIMESTAMP('2020-04-23 15:26:50','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-04-23T13:44:52.528Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Scheduler SET CronPattern='00 00,12 * * *',Updated=TO_TIMESTAMP('2020-04-23 16:44:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Scheduler_ID=550061 ; -- 2020-04-23T13:47:27.363Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Scheduler SET CronPattern='0 0,12 * * *',Updated=TO_TIMESTAMP('2020-04-23 16:47:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Scheduler_ID=550061 ; -- 2020-04-23T13:52:38.294Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_SchedulerRecipient (AD_Client_ID,AD_Org_ID,AD_Role_ID,AD_Scheduler_ID,AD_SchedulerRecipient_ID,AD_User_ID,Created,CreatedBy,IsActive,Updated,UpdatedBy) VALUES (0,0,0,550061,540003,100,TO_TIMESTAMP('2020-04-23 16:52:38','YYYY-MM-DD HH24:MI:SS'),100,'Y',TO_TIMESTAMP('2020-04-23 16:52:38','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-04-23T13:55:45.624Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,AllowProcessReRun,Classname,CopyFromProcess,Created,CreatedBy,EntityType,IsActive,IsApplySecuritySettings,IsBetaFunctionality,IsDirectPrint,IsNotifyUserAfterExecution,IsOneInstanceOnly,IsReport,IsServerProcess,IsTranslateExcelHeaders,IsUseBPartnerLanguage,LockWaitTimeout,Name,RefreshAllAfterExecution,ShowHelp,Type,Updated,UpdatedBy,Value) VALUES ('4',0,0,584689,'Y','de.metas.serviceprovider.everhour.ScheduledEverhourImport','N',TO_TIMESTAMP('2020-04-23 16:55:45','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.serviceprovider','Y','N','N','N','N','N','N','N','Y','Y',0,'Scheduled Everhour import','N','N','Java',TO_TIMESTAMP('2020-04-23 16:55:45','YYYY-MM-DD HH24:MI:SS'),100,'Scheduled Everhour import') ; -- 2020-04-23T13:55:45.627Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_ID=584689 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) ; -- 2020-04-23T13:56:35.844Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,577683,0,584689,541814,11,'OffsetDays',TO_TIMESTAMP('2020-04-23 16:56:35','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.serviceprovider',5,'Y','N','Y','N','N','N','Offset days',10,TO_TIMESTAMP('2020-04-23 16:56:35','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-04-23T13:56:35.847Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541814 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2020-04-23T13:57:50.426Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Scheduler (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Role_ID,AD_Scheduler_ID,Created,CreatedBy,CronPattern,EntityType,Frequency,FrequencyType,IsActive,IsIgnoreProcessingTime,KeepLogDays,ManageScheduler,Name,Processing,SchedulerProcessType,ScheduleType,Status,Supervisor_ID,Updated,UpdatedBy) VALUES (0,0,584689,0,550062,TO_TIMESTAMP('2020-04-23 16:57:50','YYYY-MM-DD HH24:MI:SS'),100,'0 1,13 * * *','de.metas.swat',0,'D','Y','N',7,'N','Everhour import scheduler','N','P','C','NEW',100,TO_TIMESTAMP('2020-04-23 16:57:50','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-04-23T13:58:35.202Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Scheduler_Para (AD_Client_ID,AD_Org_ID,AD_Process_Para_ID,AD_Scheduler_ID,AD_Scheduler_Para_ID,Created,CreatedBy,IsActive,ParameterDefault,Updated,UpdatedBy) VALUES (0,0,541814,550062,540011,TO_TIMESTAMP('2020-04-23 16:58:35','YYYY-MM-DD HH24:MI:SS'),100,'Y','7',TO_TIMESTAMP('2020-04-23 16:58:35','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-04-23T14:03:57.890Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Scheduler SET CronPattern='0 1,14 * * *',Updated=TO_TIMESTAMP('2020-04-23 17:03:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Scheduler_ID=550062 ; -- 2020-04-23T14:04:33.456Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Scheduler SET CronPattern='0 1,13 * * *',Updated=TO_TIMESTAMP('2020-04-23 17:04:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Scheduler_ID=550062 ; -- 2020-04-23T14:04:42.777Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Scheduler SET CronPattern='00 1,13 * * *',Updated=TO_TIMESTAMP('2020-04-23 17:04:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Scheduler_ID=550062 ; -- 2020-04-23T14:05:07.240Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Scheduler SET CronPattern='00 13 * * *',Updated=TO_TIMESTAMP('2020-04-23 17:05:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Scheduler_ID=550062 ; -- 2020-04-23T14:06:55.839Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Scheduler SET CronPattern='0 1,13 * * *',Updated=TO_TIMESTAMP('2020-04-23 17:06:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Scheduler_ID=550062 ;
the_stack
CREATE TABLE awa_wiki_content ( /* the wiki page content identifier */ `id` BIGINT NOT NULL, /* the wiki content creation date */ `create_date` DATETIME NOT NULL, /* the wiki text content */ `content` TEXT NOT NULL, /* the format type used used by the wiki content */ `format` TINYINT NOT NULL, /* the content comment string */ `save_comment` VARCHAR(255) BINARY NOT NULL, /* */ `version` INTEGER NOT NULL, /* the wiki page version */ `page_version` INTEGER NOT NULL, /* the wiki page that this Wiki_Content belongs to */ `page_id` BIGINT NOT NULL, /* the page version author */ `author_id` BIGINT NOT NULL, PRIMARY KEY (`id`) ); /* The wiki page represents a page with its versions. It refers to the last version which is currently visible. */ CREATE TABLE awa_wiki_page ( /* the wiki page identifier */ `id` BIGINT NOT NULL, /* the wiki page name */ `name` VARCHAR(255) BINARY NOT NULL, /* the last page version number */ `last_version` INTEGER NOT NULL, /* whether the wiki page is public */ `is_public` TINYINT NOT NULL, /* the page title */ `title` VARCHAR(255) BINARY NOT NULL, /* */ `version` INTEGER NOT NULL, /* a read counter which indicates how many times the page was read. */ `read_count` INTEGER NOT NULL, /* the wiki page preview. */ `preview_id` BIGINT , /* the wiki space that this page belongs to */ `wiki_id` BIGINT NOT NULL, /* the current content (or last version) */ `content_id` BIGINT , PRIMARY KEY (`id`) ); /* Permission is granted to display a wiki page if there is an ACL entry between the wiki space and the user. */ CREATE TABLE awa_wiki_space ( /* the wiki space identifier */ `id` BIGINT NOT NULL, /* the wiki name */ `name` VARCHAR(255) BINARY NOT NULL, /* whether the wiki is public */ `is_public` TINYINT NOT NULL, /* */ `version` INTEGER NOT NULL, /* the wiki creation date. */ `create_date` DATETIME NOT NULL, /* the left panel side wiki text for every page. */ `left_side` TEXT NOT NULL, /* the right panel wiki text for every page. */ `right_side` TEXT NOT NULL, /* the default wiki page format. */ `format` TINYINT NOT NULL, /* */ `workspace_id` BIGINT NOT NULL, PRIMARY KEY (`id`) ); INSERT INTO entity_type (name) VALUES ("awa_wiki_content") ,("awa_wiki_page") ,("awa_wiki_space") ; /* File generated automatically by dynamo */ /* */ CREATE TABLE awa_counter ( /* the object associated with the counter. */ `object_id` BIGINT NOT NULL, /* the day associated with the counter. */ `date` DATE NOT NULL, /* the counter value. */ `counter` INTEGER NOT NULL, /* the counter definition identifier. */ `definition_id` BIGINT NOT NULL, PRIMARY KEY (`object_id`, `date`, `definition_id`) ); /* A counter definition defines what the counter represents. It uniquely identifies the counter for the Counter table. A counter may be associated with a database table. In that case, the counter definition has a relation to the corresponding Entity_Type. */ CREATE TABLE awa_counter_definition ( /* the counter name. */ `name` VARCHAR(255) BINARY NOT NULL, /* the counter unique id. */ `id` INTEGER NOT NULL, /* the optional entity type that identifies the database table. */ `entity_type` INTEGER , PRIMARY KEY (`id`) ); /* */ CREATE TABLE awa_visit ( /* the entity identifier. */ `object_id` BIGINT NOT NULL, /* the number of times the entity was visited by the user. */ `counter` INTEGER NOT NULL, /* the date and time when the entity was last visited. */ `date` DATETIME NOT NULL, /* the user who visited the entity. */ `user` BIGINT NOT NULL, /* the counter definition identifier. */ `definition_id` BIGINT NOT NULL, PRIMARY KEY (`object_id`, `user`, `definition_id`) ); INSERT INTO entity_type (name) VALUES ("awa_counter") ,("awa_counter_definition") ,("awa_visit") ; ALTER TABLE awa_post ADD COLUMN `read_count` INTEGER NOT NULL; ALTER TABLE awa_image ADD COLUMN `owner_id` BIGINT NOT NULL; ALTER TABLE awa_image ADD COLUMN `folder_id` BIGINT NOT NULL; ALTER TABLE awa_image ADD COLUMN `public` TINYINT NOT NULL; ALTER TABLE awa_image ADD COLUMN `path` VARCHAR(255) BINARY NOT NULL; ALTER TABLE awa_storage ADD COLUMN `is_public` TINYINT NOT NULL DEFAULT 0; ALTER TABLE awa_user ADD COLUMN `salt` VARCHAR(255) NOT NULL DEFAULT ""; /* */ CREATE TABLE awa_invitation ( /* the invitation identifier. */ `id` BIGINT NOT NULL, /* version optimistic lock. */ `version` INTEGER NOT NULL, /* date when the invitation was created and sent. */ `create_date` DATETIME NOT NULL, /* the email address to which the invitation was sent. */ `email` VARCHAR(255) BINARY NOT NULL, /* the invitation message. */ `message` text NOT NULL, /* the date when the invitation was accepted. */ `acceptance_date` DATETIME , /* the workspace where the user is invited. */ `workspace_id` BIGINT NOT NULL, /* */ `access_key_id` BIGINT , /* the user being invited. */ `invitee_id` BIGINT , /* */ `inviter_id` BIGINT NOT NULL, PRIMARY KEY (`id`) ); INSERT INTO entity_type (name) VALUES ("awa_invitation"); /* The application that is granted access to the database. */ CREATE TABLE awa_application ( /* the application identifier. */ `id` BIGINT NOT NULL, /* the application name. */ `name` VARCHAR(255) BINARY NOT NULL, /* the application secret key. */ `secret_key` VARCHAR(255) BINARY NOT NULL, /* the application public identifier. */ `client_id` VARCHAR(255) BINARY NOT NULL, /* the optimistic lock version. */ `version` INTEGER NOT NULL, /* the application create date. */ `create_date` DATETIME NOT NULL, /* the application update date. */ `update_date` DATETIME NOT NULL, /* the application title displayed in the OAuth login form. */ `title` VARCHAR(255) BINARY NOT NULL, /* the application description. */ `description` VARCHAR(255) BINARY NOT NULL, /* the optional login URL. */ `app_login_url` VARCHAR(255) BINARY NOT NULL, /* the application logo URL. */ `app_logo_url` VARCHAR(255) BINARY NOT NULL, /* */ `user_id` BIGINT NOT NULL, PRIMARY KEY (`id`) ); /* */ CREATE TABLE awa_callback ( /* */ `id` BIGINT NOT NULL, /* */ `url` VARCHAR(255) BINARY NOT NULL, /* the optimistic lock version. */ `version` INTEGER NOT NULL, /* */ `application_id` BIGINT NOT NULL, PRIMARY KEY (`id`) ); /* The session is created when the user has granted an access to an application or when the application has refreshed its access token. */ CREATE TABLE awa_oauth_session ( /* the session identifier. */ `id` BIGINT NOT NULL, /* the session creation date. */ `create_date` DATETIME NOT NULL, /* a random salt string to access/request token generation. */ `salt` VARCHAR(255) BINARY NOT NULL, /* the expiration date. */ `expire_date` DATETIME NOT NULL, /* the application that is granted access. */ `application_id` BIGINT NOT NULL, /* */ `user_id` BIGINT NOT NULL, /* */ `session_id` BIGINT NOT NULL, PRIMARY KEY (`id`) ); INSERT INTO entity_type (name) VALUES ("awa_application") ,("awa_callback") ,("awa_oauth_session"); ALTER TABLE awa_vote DROP PRIMARY KEY, ADD PRIMARY KEY (`entity_id`, `user_id`); ALTER TABLE awa_vote DROP COLUMN `id`; /* The permission table lists all the application permissions that are defined. This is a system table shared by every user and workspace. The list of permission is fixed and never changes. */ CREATE TABLE awa_permission ( /* the permission database identifier. */ `id` BIGINT NOT NULL, /* the permission name */ `name` VARCHAR(255) BINARY NOT NULL, PRIMARY KEY (`id`) ); INSERT INTO entity_type (name) VALUES ("awa_permission"); ALTER TABLE awa_workspace_member ADD COLUMN join_date DATETIME; ALTER TABLE awa_workspace_member ADD COLUMN role VARCHAR(255); INSERT INTO awa_workspace_member (id, member_id, workspace_id, create_date, join_date, role) (SELECT acl.id, acl.user_id, ws.id, ws.create_date, ws.create_date, 'Owner' FROM awa_workspace AS ws INNER JOIN entity_type AS ent INNER JOIN awa_acl AS acl ON acl.entity_id = ws.id AND acl.entity_type = ent.id WHERE ent.name = 'awa_workspace'); ALTER TABLE awa_acl ADD COLUMN permission BIGINT NOT NULL; ALTER TABLE awa_acl ADD COLUMN workspace_id BIGINT NOT NULL; UPDATE awa_acl INNER JOIN entity_type ON awa_acl.entity_type = entity_type.id AND entity_type.name = 'awa_workspace' SET awa_acl.workspace_id = awa_acl.entity_id; UPDATE awa_acl INNER JOIN entity_type ON awa_acl.entity_type = entity_type.id AND entity_type.name = 'awa_wiki_space' INNER JOIN awa_wiki_space ON awa_acl.entity_id = awa_wiki_space.id SET awa_acl.workspace_id = awa_wiki_space.workspace_id; UPDATE awa_acl INNER JOIN entity_type ON awa_acl.entity_type = entity_type.id AND entity_type.name = 'awa_blog' INNER JOIN awa_blog ON awa_acl.entity_id = awa_blog.id SET awa_acl.workspace_id = awa_blog.workspace_id; ALTER TABLE awa_invitation ADD COLUMN member_id BIGINT NOT NULL; ALTER TABLE awa_access_key ADD COLUMN kind TINYINT NOT NULL; INSERT INTO awa_permission (id, name) VALUES (1, 'blog-create'), (2, 'blog-delete'), (3, 'blog-create-post'), (4, 'blog-delete-post'), (5, 'blog-add-comment'), (6, 'blog-publish-comment'), (7, 'blog-delete-comment'), (8, 'blog-update-post'), (9, 'workspace-create'), (10, 'wiki-page-create'), (11, 'wiki-page-delete'), (12, 'wiki-page-update'), (13, 'wiki-page-view'), (14, 'wiki-space-create'), (15, 'wiki-space-delete'), (16, 'wiki-space-update'), (17, 'storage-create'), (18, 'storage-delete'), (19, 'folder-create'); CREATE TEMPORARY TABLE new_acl ( id integer auto_increment primary key, entity_id BIGINT NOT NULL, user_id BIGINT NOT NULL, workspace_id BIGINT NOT NULL, entity_type INTEGER NOT NULL, permission INTEGER NOT NULL ); /* Permissions on the workspace. */ INSERT INTO new_acl (entity_id, user_id, workspace_id, entity_type, permission) SELECT acl.entity_id, acl.user_id, acl.workspace_id, acl.entity_type, perm.id FROM awa_acl AS acl INNER JOIN entity_type AS e ON acl.entity_type = e.id AND acl.permission <= 0 INNER JOIN awa_permission AS perm ON perm.name IN ('blog-create', 'wiki-space-create', 'storage-create', 'folder-create', 'storage-delete') WHERE e.name = 'awa_workspace'; /* Permissions on the blog entries */ INSERT INTO new_acl (entity_id, user_id, workspace_id, entity_type, permission) SELECT acl.entity_id, acl.user_id, acl.workspace_id, acl.entity_type, perm.id FROM awa_acl AS acl INNER JOIN entity_type AS e ON acl.entity_type = e.id AND acl.permission <= 0 INNER JOIN awa_permission AS perm ON perm.name IN ('blog-update-post', 'blog-delete', 'blog-create-post', 'blog-delete-post', 'blog-add-comment', 'blog-publish-comment', 'blog-delete-comment') WHERE e.name = 'awa_blog'; /* Permissions on the wiki entries */ INSERT INTO new_acl (entity_id, user_id, workspace_id, entity_type, permission) SELECT acl.entity_id, acl.user_id, acl.workspace_id, acl.entity_type, perm.id FROM awa_acl AS acl INNER JOIN entity_type AS e ON acl.entity_type = e.id AND acl.permission <= 0 INNER JOIN awa_permission AS perm ON perm.name IN ('wiki-space-update', 'wiki-space-delete', 'wiki-page-create', 'wiki-page-delete', 'wiki-page-update', 'wiki-page-view') WHERE e.name = 'awa_wiki_space'; /* Install the new permissions. */ DELETE FROM awa_acl; INSERT INTO awa_acl (id, entity_id, user_id, workspace_id, entity_type, permission) SELECT id, entity_id, user_id, workspace_id, entity_type, permission FROM new_acl; UPDATE sequence SET value = GREATEST((SELECT COUNT(*) FROM new_acl), sequence.value) WHERE sequence.name = 'awa_acl'; DROP TEMPORARY TABLE new_acl;
the_stack
create or replace function londiste.local_add_table( in i_queue_name text, in i_table_name text, in i_trg_args text[], in i_table_attrs text, in i_dest_table text, out ret_code int4, out ret_note text) as $$ -- ---------------------------------------------------------------------- -- Function: londiste.local_add_table(5) -- -- Register table on Londiste node, with customizable trigger args. -- -- Parameters: -- i_queue_name - queue name -- i_table_name - table name -- i_trg_args - args to trigger, or magic parameters. -- i_table_attrs - args to python handler -- i_dest_table - actual name of destination table (NULL if same) -- -- Trigger args: -- See documentation for pgq triggers. -- -- Magic parameters: -- no_triggers - skip trigger creation -- skip_truncate - set 'skip_truncate' table attribute -- expect_sync - set table state to 'ok' -- tgflags=X - trigger creation flags -- merge_all - merge table from all sources. required for -- multi-source table -- no_merge - do not merge tables from different sources -- skip - create skip trigger. same as S flag -- virtual_table - skips structure check and trigger creation -- -- Trigger creation flags (default: AIUDL): -- I - ON INSERT -- U - ON UPDATE -- D - ON DELETE -- Q - use pgq.sqltriga() as trigger function -- L - use pgq.logutriga() as trigger function -- B - BEFORE -- A - AFTER -- S - SKIP -- -- Example: -- > londiste.local_add_table('q', 'tbl', array['tgflags=BI', 'SKIP', 'pkey=col1,col2']) -- -- Returns: -- 200 - Ok -- 301 - Warning, trigger exists that will fire before londiste one -- 400 - No such set -- 410 - Table already exists but with different table_attrs ------------------------------------------------------------------------ declare col_types text; fq_table_name text; new_state text; pgversion int; logtrg_previous text; trigger_name text; tbl record; i integer; j integer; arg text; _node record; _tbloid oid; _combined_queue text; _combined_table text; _table_attrs text := i_table_attrs; -- check local tables from all sources _queue_name text; _local boolean; -- argument flags _expect_sync boolean := false; _merge_all boolean := false; _no_merge boolean := false; _virtual_table boolean := false; _dest_table text; _table_name2 text; _desc text; begin -------- i_trg_args ARGUMENTS PARSING (TODO: use different input param for passing extra options that have nothing to do with trigger) if array_lower(i_trg_args, 1) is not null then for i in array_lower(i_trg_args, 1) .. array_upper(i_trg_args, 1) loop arg := i_trg_args[i]; if arg = 'expect_sync' then _expect_sync := true; elsif arg = 'skip_truncate' then _table_attrs := coalesce(_table_attrs || '&skip_truncate=1', 'skip_truncate=1'); elsif arg = 'merge_all' then _merge_all = true; elsif arg = 'no_merge' then _no_merge = true; elsif arg = 'virtual_table' then _virtual_table := true; _expect_sync := true; -- do not copy end if; end loop; end if; if _merge_all and _no_merge then select 405, 'Cannot use merge-all and no-merge together' into ret_code, ret_note; return; end if; fq_table_name := londiste.make_fqname(i_table_name); _dest_table := londiste.make_fqname(coalesce(i_dest_table, i_table_name)); if _dest_table = fq_table_name then _desc := fq_table_name; else _desc := fq_table_name || '(' || _dest_table || ')'; end if; -------- TABLE STRUCTURE CHECK if not _virtual_table then _tbloid := londiste.find_table_oid(_dest_table); if _tbloid is null then select 404, 'Table does not exist: ' || _desc into ret_code, ret_note; return; end if; col_types := londiste.find_column_types(_dest_table); if position('k' in col_types) < 1 then -- allow missing primary key in case of combined table where -- pkey was removed by londiste perform 1 from londiste.table_info t, pgq_node.node_info n_this, pgq_node.node_info n_other where n_this.queue_name = i_queue_name and n_other.combined_queue = n_this.combined_queue and n_other.queue_name <> n_this.queue_name and t.queue_name = n_other.queue_name and coalesce(t.dest_table, t.table_name) = _dest_table and t.dropped_ddl is not null; if not found then select 400, 'Primary key missing on table: ' || _desc into ret_code, ret_note; return; end if; end if; end if; -------- TABLE REGISTRATION LOGIC select * from pgq_node.get_node_info(i_queue_name) into _node; if not found or _node.ret_code >= 400 then select 400, 'No such set: ' || i_queue_name into ret_code, ret_note; return; end if; select merge_state, local, table_attrs into tbl from londiste.table_info where queue_name = i_queue_name and table_name = fq_table_name; if not found then -- add to set on root if _node.node_type = 'root' then select f.ret_code, f.ret_note into ret_code, ret_note from londiste.global_add_table(i_queue_name, i_table_name) f; if ret_code <> 200 then return; end if; else select 404, 'Table not available on queue: ' || _desc into ret_code, ret_note; return; end if; -- reload info select merge_state, local, table_attrs into tbl from londiste.table_info where queue_name = i_queue_name and table_name = fq_table_name; end if; if tbl.local then if tbl.table_attrs is distinct from _table_attrs then select 410, 'Table ' || _desc || ' already added, but with different args: ' || coalesce(tbl.table_attrs, '') into ret_code, ret_note; else select 200, 'Table already added: ' || _desc into ret_code, ret_note; end if; return; end if; if _node.node_type = 'root' then new_state := 'ok'; perform londiste.root_notify_change(i_queue_name, 'londiste.add-table', fq_table_name); elsif _node.node_type = 'leaf' and _node.combined_type = 'branch' then new_state := 'ok'; elsif _expect_sync then new_state := 'ok'; else new_state := NULL; end if; update londiste.table_info set local = true, merge_state = new_state, table_attrs = coalesce(_table_attrs, table_attrs), dest_table = nullif(_dest_table, fq_table_name) where queue_name = i_queue_name and table_name = fq_table_name; if not found then raise exception 'lost table: %', fq_table_name; end if; -- merge all table sources on leaf if _node.node_type = 'leaf' and not _no_merge then for _queue_name, _table_name2, _local in select t2.queue_name, t2.table_name, t2.local from londiste.table_info t join pgq_node.node_info n on (n.queue_name = t.queue_name) left join pgq_node.node_info n2 on (n2.combined_queue = n.combined_queue or (n2.combined_queue is null and n.combined_queue is null)) left join londiste.table_info t2 on (t2.queue_name = n2.queue_name and coalesce(t2.dest_table, t2.table_name) = coalesce(t.dest_table, t.table_name)) where t.queue_name = i_queue_name and t.table_name = fq_table_name and t2.queue_name != i_queue_name -- skip self loop -- if table from some other source is already marked as local, -- raise error if _local and coalesce(new_state, 'x') <> 'ok' then select 405, 'Found local table '|| _desc || ' in queue ' || _queue_name || ', use remove-table first to remove all previous ' || 'table subscriptions' into ret_code, ret_note; return; end if; -- when table comes from multiple sources, merge_all switch is -- required if not _merge_all and coalesce(new_state, 'x') <> 'ok' then select 405, 'Found multiple sources for table '|| _desc || ', use merge-all or no-merge to continue' into ret_code, ret_note; return; end if; update londiste.table_info set local = true, merge_state = new_state, table_attrs = coalesce(_table_attrs, table_attrs) where queue_name = _queue_name and table_name = _table_name2; if not found then raise exception 'lost table: % on queue %', _table_name2, _queue_name; end if; end loop; -- if this node has combined_queue, add table there too -- note: we need to keep both table_name/dest_table values select n2.queue_name, t.table_name from pgq_node.node_info n1 join pgq_node.node_info n2 on (n2.queue_name = n1.combined_queue) left join londiste.table_info t on (t.queue_name = n2.queue_name and t.table_name = fq_table_name and t.local) where n1.queue_name = i_queue_name and n2.node_type = 'root' into _combined_queue, _combined_table; if found and _combined_table is null then select f.ret_code, f.ret_note from londiste.local_add_table(_combined_queue, fq_table_name, i_trg_args, _table_attrs, _dest_table) f into ret_code, ret_note; if ret_code >= 300 then return; end if; end if; end if; -- create trigger select f.ret_code, f.ret_note, f.trigger_name from londiste.create_trigger(i_queue_name, fq_table_name, i_trg_args, _dest_table, _node.node_type) f into ret_code, ret_note, trigger_name; if ret_code > 299 then ret_note := 'Trigger creation failed for table ' || _desc || ': ' || ret_note; return; elsif ret_code = 201 then select 200, 'Table added with no triggers: ' || _desc into ret_code, ret_note; return; end if; -- Check that no trigger exists on the target table that will get fired -- before londiste one (this could have londiste replicate data out-of-order) -- -- Don't report all the trigger names, 8.3 does not have array_accum available. show server_version_num into pgversion; if pgversion >= 90000 then select tg.tgname into logtrg_previous from pg_class r join pg_trigger tg on (tg.tgrelid = r.oid) where r.oid = londiste.find_table_oid(_dest_table) and not tg.tgisinternal and tg.tgname < trigger_name::name -- per-row AFTER trigger and (tg.tgtype & 3) = 1 -- bits: 0:ROW, 1:BEFORE -- current londiste and not londiste.is_replica_func(tg.tgfoid) -- old londiste and substring(tg.tgname from 1 for 10) != '_londiste_' and substring(tg.tgname from char_length(tg.tgname) - 6) != '_logger' order by 1 limit 1; else select tg.tgname into logtrg_previous from pg_class r join pg_trigger tg on (tg.tgrelid = r.oid) where r.oid = londiste.find_table_oid(_dest_table) and not tg.tgisconstraint and tg.tgname < trigger_name::name -- per-row AFTER trigger and (tg.tgtype & 3) = 1 -- bits: 0:ROW, 1:BEFORE -- current londiste and not londiste.is_replica_func(tg.tgfoid) -- old londiste and substring(tg.tgname from 1 for 10) != '_londiste_' and substring(tg.tgname from char_length(tg.tgname) - 6) != '_logger' order by 1 limit 1; end if; if logtrg_previous is not null then select 301, 'Table added: ' || _desc || ', but londiste trigger is not first: ' || logtrg_previous into ret_code, ret_note; return; end if; select 200, 'Table added: ' || _desc into ret_code, ret_note; return; end; $$ language plpgsql; create or replace function londiste.local_add_table( in i_queue_name text, in i_table_name text, in i_trg_args text[], in i_table_attrs text, out ret_code int4, out ret_note text) as $$ -- ---------------------------------------------------------------------- -- Function: londiste.local_add_table(4) -- -- Register table on Londiste node. -- ---------------------------------------------------------------------- begin select f.ret_code, f.ret_note into ret_code, ret_note from londiste.local_add_table(i_queue_name, i_table_name, i_trg_args, i_table_attrs, null) f; return; end; $$ language plpgsql; create or replace function londiste.local_add_table( in i_queue_name text, in i_table_name text, in i_trg_args text[], out ret_code int4, out ret_note text) as $$ -- ---------------------------------------------------------------------- -- Function: londiste.local_add_table(3) -- -- Register table on Londiste node. -- ---------------------------------------------------------------------- begin select f.ret_code, f.ret_note into ret_code, ret_note from londiste.local_add_table(i_queue_name, i_table_name, i_trg_args, null) f; return; end; $$ language plpgsql; create or replace function londiste.local_add_table( in i_queue_name text, in i_table_name text, out ret_code int4, out ret_note text) as $$ -- ---------------------------------------------------------------------- -- Function: londiste.local_add_table(2) -- -- Register table on Londiste node. -- ---------------------------------------------------------------------- begin select f.ret_code, f.ret_note into ret_code, ret_note from londiste.local_add_table(i_queue_name, i_table_name, null) f; return; end; $$ language plpgsql strict;
the_stack
-- -- SELECT -- --Testcase 43: CREATE EXTENSION duckdb_fdw; --Testcase 44: CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER duckdb_fdw OPTIONS (database '/tmp/sqlitefdw_test_core.db'); --Testcase 45: CREATE FOREIGN TABLE onek ( unique1 int4, unique2 int4, two int4, four int4, ten int4, twenty int4, hundred int4, thousand int4, twothousand int4, fivethous int4, tenthous int4, odd int4, even int4, stringu1 name, stringu2 name, string4 name ) SERVER sqlite_svr; --Testcase 46: CREATE FOREIGN TABLE onek2 ( unique1 int4, unique2 int4, two int4, four int4, ten int4, twenty int4, hundred int4, thousand int4, twothousand int4, fivethous int4, tenthous int4, odd int4, even int4, stringu1 name, stringu2 name, string4 name ) SERVER sqlite_svr; --Testcase 47: CREATE FOREIGN TABLE INT8_TBL( q1 int8 OPTIONS (key 'true'), q2 int8 OPTIONS (key 'true') ) SERVER sqlite_svr; --Testcase 48: CREATE FOREIGN TABLE person ( name text, age int4, location point ) SERVER sqlite_svr; -- btree index -- awk '{if($1<10){print;}else{next;}}' onek.data | sort +0n -1 -- --Testcase 1: SELECT * FROM onek WHERE onek.unique1 < 10 ORDER BY onek.unique1; -- -- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | sort +0nr -1 -- --Testcase 2: SELECT onek.unique1, onek.stringu1 FROM onek WHERE onek.unique1 < 20 ORDER BY unique1 using >; -- -- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2 -- --Testcase 3: SELECT onek.unique1, onek.stringu1 FROM onek WHERE onek.unique1 > 980 ORDER BY stringu1 using <; -- -- awk '{if($1>980){print $1,$16;}else{next;}}' onek.data | -- sort +1d -2 +0nr -1 -- --Testcase 4: SELECT onek.unique1, onek.string4 FROM onek WHERE onek.unique1 > 980 ORDER BY string4 using <, unique1 using >; -- -- awk '{if($1>980){print $1,$16;}else{next;}}' onek.data | -- sort +1dr -2 +0n -1 -- --Testcase 5: SELECT onek.unique1, onek.string4 FROM onek WHERE onek.unique1 > 980 ORDER BY string4 using >, unique1 using <; -- -- awk '{if($1<20){print $1,$16;}else{next;}}' onek.data | -- sort +0nr -1 +1d -2 -- --Testcase 6: SELECT onek.unique1, onek.string4 FROM onek WHERE onek.unique1 < 20 ORDER BY unique1 using >, string4 using <; -- -- awk '{if($1<20){print $1,$16;}else{next;}}' onek.data | -- sort +0n -1 +1dr -2 -- --Testcase 7: SELECT onek.unique1, onek.string4 FROM onek WHERE onek.unique1 < 20 ORDER BY unique1 using <, string4 using >; -- -- test partial btree indexes -- -- As of 7.2, planner probably won't pick an indexscan without stats, -- so ANALYZE first. Also, we want to prevent it from picking a bitmapscan -- followed by sort, because that could hide index ordering problems. -- --ANALYZE onek2; SET enable_seqscan TO off; SET enable_bitmapscan TO off; SET enable_sort TO off; -- -- awk '{if($1<10){print $0;}else{next;}}' onek.data | sort +0n -1 -- --Testcase 8: SELECT onek2.* FROM onek2 WHERE onek2.unique1 < 10 order by onek2.unique1; -- -- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | sort +0nr -1 -- --Testcase 9: SELECT onek2.unique1, onek2.stringu1 FROM onek2 WHERE onek2.unique1 < 20 ORDER BY unique1 using >; -- -- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2 -- --Testcase 10: SELECT onek2.unique1, onek2.stringu1 FROM onek2 WHERE onek2.unique1 > 980 ORDER BY onek2.unique1; RESET enable_seqscan; RESET enable_bitmapscan; RESET enable_sort; --Testcase 11: SELECT two, stringu1, ten, string4 INTO TABLE tmp FROM onek; -- -- awk '{print $1,$2;}' person.data | -- awk '{if(NF!=2){print $3,$2;}else{print;}}' - emp.data | -- awk '{if(NF!=2){print $3,$2;}else{print;}}' - student.data | -- awk 'BEGIN{FS=" ";}{if(NF!=2){print $4,$5;}else{print;}}' - stud_emp.data -- -- SELECT name, age FROM person*; ??? check if different --Testcase 12: SELECT p.name, p.age FROM person* p; -- -- awk '{print $1,$2;}' person.data | -- awk '{if(NF!=2){print $3,$2;}else{print;}}' - emp.data | -- awk '{if(NF!=2){print $3,$2;}else{print;}}' - student.data | -- awk 'BEGIN{FS=" ";}{if(NF!=1){print $4,$5;}else{print;}}' - stud_emp.data | -- sort +1nr -2 -- --Testcase 13: SELECT p.name, p.age FROM person* p ORDER BY age using >, name; -- -- Test some cases involving whole-row Var referencing a subquery -- --Testcase 49: select foo from (select 1 offset 0) as foo; --Testcase 50: select foo from (select null offset 0) as foo; --Testcase 51: select foo from (select 'xyzzy',1,null offset 0) as foo; -- -- Test VALUES lists -- --Testcase 14: select * from onek, (values(147, 'RFAAAA'), (931, 'VJAAAA')) as v (i, j) WHERE onek.unique1 = v.i and onek.stringu1 = v.j; -- a more complex case -- looks like we're coding lisp :-) --Testcase 15: select * from onek, (values ((select i from (values(10000), (2), (389), (1000), (2000), ((select 10029))) as foo(i) order by i asc limit 1))) bar (i) where onek.unique1 = bar.i; -- try VALUES in a subquery --Testcase 16: select * from onek where (unique1,ten) in (values (1,1), (20,0), (99,9), (17,99)) order by unique1; -- VALUES is also legal as a standalone query or a set-operation member --Testcase 17: VALUES (1,2), (3,4+4), (7,77.7); --Testcase 52: VALUES (1,2), (3,4+4), (7,77.7) UNION ALL SELECT 2+2, 57 UNION ALL TABLE int8_tbl; -- -- Test ORDER BY options -- --Testcase 53: CREATE FOREIGN TABLE foo (f1 int options (key 'true')) SERVER sqlite_svr; --Testcase 18: INSERT INTO foo VALUES (42),(3),(10),(7),(null),(null),(1); --Testcase 19: SELECT * FROM foo ORDER BY f1; --Testcase 20: SELECT * FROM foo ORDER BY f1 ASC; -- same thing --Testcase 21: SELECT * FROM foo ORDER BY f1 NULLS FIRST; --Testcase 22: SELECT * FROM foo ORDER BY f1 DESC; --Testcase 23: SELECT * FROM foo ORDER BY f1 DESC NULLS LAST; -- Skip, cannot create index on foreign table -- check if indexscans do the right things --CREATE INDEX fooi ON foo (f1); --SET enable_sort = false; --SELECT * FROM foo ORDER BY f1; --SELECT * FROM foo ORDER BY f1 NULLS FIRST; --SELECT * FROM foo ORDER BY f1 DESC; --SELECT * FROM foo ORDER BY f1 DESC NULLS LAST; --DROP INDEX fooi; --CREATE INDEX fooi ON foo (f1 DESC); --SELECT * FROM foo ORDER BY f1; --SELECT * FROM foo ORDER BY f1 NULLS FIRST; --SELECT * FROM foo ORDER BY f1 DESC; --SELECT * FROM foo ORDER BY f1 DESC NULLS LAST; --DROP INDEX fooi; --CREATE INDEX fooi ON foo (f1 DESC NULLS LAST); --SELECT * FROM foo ORDER BY f1; --SELECT * FROM foo ORDER BY f1 NULLS FIRST; --SELECT * FROM foo ORDER BY f1 DESC; --SELECT * FROM foo ORDER BY f1 DESC NULLS LAST; -- -- Test planning of some cases with partial indexes -- -- partial index is usable --Testcase 24: explain (costs off) select * from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; --Testcase 25: select * from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; -- actually run the query with an analyze to use the partial index --Testcase 54: explain (costs off, analyze on, timing off, summary off) select * from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; --Testcase 27: explain (costs off) select unique2 from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; --Testcase 28: select unique2 from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; -- partial index predicate implies clause, so no need for retest --Testcase 29: explain (costs off) select * from onek2 where unique2 = 11 and stringu1 < 'B'; --Testcase 30: select * from onek2 where unique2 = 11 and stringu1 < 'B'; --Testcase 31: explain (costs off) select unique2 from onek2 where unique2 = 11 and stringu1 < 'B'; --Testcase 32: select unique2 from onek2 where unique2 = 11 and stringu1 < 'B'; -- but if it's an update target, must retest anyway --Testcase 33: explain (costs off) select unique2 from onek2 where unique2 = 11 and stringu1 < 'B' for update; --Testcase 34: select unique2 from onek2 where unique2 = 11 and stringu1 < 'B' for update; -- partial index is not applicable --Testcase 35: explain (costs off) select unique2 from onek2 where unique2 = 11 and stringu1 < 'C'; --Testcase 36: select unique2 from onek2 where unique2 = 11 and stringu1 < 'C'; -- partial index implies clause, but bitmap scan must recheck predicate anyway SET enable_indexscan TO off; --Testcase 37: explain (costs off) select unique2 from onek2 where unique2 = 11 and stringu1 < 'B'; --Testcase 38: select unique2 from onek2 where unique2 = 11 and stringu1 < 'B'; RESET enable_indexscan; -- check multi-index cases too --Testcase 39: explain (costs off) select unique1, unique2 from onek2 where (unique2 = 11 or unique1 = 0) and stringu1 < 'B'; --Testcase 40: select unique1, unique2 from onek2 where (unique2 = 11 or unique1 = 0) and stringu1 < 'B'; --Testcase 41: explain (costs off) select unique1, unique2 from onek2 where (unique2 = 11 and stringu1 < 'B') or unique1 = 0; --Testcase 42: select unique1, unique2 from onek2 where (unique2 = 11 and stringu1 < 'B') or unique1 = 0; -- -- Test some corner cases that have been known to confuse the planner -- -- ORDER BY on a constant doesn't really need any sorting --Testcase 55: SELECT 1 AS x ORDER BY x; -- But ORDER BY on a set-valued expression does --Testcase 56: create function sillysrf(int) returns setof int as 'values (1),(10),(2),($1)' language sql immutable; --Testcase 57: select sillysrf(42); --Testcase 58: select sillysrf(-1) order by 1; --Testcase 59: drop function sillysrf(int); -- X = X isn't a no-op, it's effectively X IS NOT NULL assuming = is strict -- (see bug #5084) --Testcase 60: select * from (values (2),(null),(1)) v(k) where k = k order by k; --Testcase 61: select * from (values (2),(null),(1)) v(k) where k = k; -- Test partitioned tables with no partitions, which should be handled the -- same as the non-inheritance case when expanding its RTE. --Testcase 62: create table list_parted_tbl (a int,b int) partition by list (a); --Testcase 63: create table list_parted_tbl1 partition of list_parted_tbl for values in (1) partition by list(b); --Testcase 64: explain (costs off) select * from list_parted_tbl; --Testcase 65: drop table list_parted_tbl; --Testcase 66: DROP FOREIGN TABLE onek; --Testcase 67: DROP FOREIGN TABLE onek2; --Testcase 68: DROP FOREIGN TABLE int8_tbl; --Testcase 69: DROP FOREIGN TABLE person; --Testcase 70: DROP FOREIGN TABLE foo; --Testcase 71: DROP SERVER sqlite_svr; --Testcase 72: DROP EXTENSION duckdb_fdw CASCADE;
the_stack
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'GHTDB') DROP DATABASE [GHTDB] GO CREATE DATABASE [GHTDB] ON (NAME = N'GHTDB_dat', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\GHTDB.mdf' , SIZE = 6, FILEGROWTH = 10%) LOG ON (NAME = N'GHTDB_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\GHTDB.ldf' , SIZE = 2, FILEGROWTH = 10%) COLLATE SQL_Latin1_General_CP1_CI_AS GO exec sp_dboption N'GHTDB', N'autoclose', N'false' GO exec sp_dboption N'GHTDB', N'bulkcopy', N'true' GO exec sp_dboption N'GHTDB', N'trunc. log', N'true' GO exec sp_dboption N'GHTDB', N'torn page detection', N'true' GO exec sp_dboption N'GHTDB', N'read only', N'false' GO exec sp_dboption N'GHTDB', N'dbo use', N'false' GO exec sp_dboption N'GHTDB', N'single', N'false' GO exec sp_dboption N'GHTDB', N'autoshrink', N'false' GO exec sp_dboption N'GHTDB', N'ANSI null default', N'false' GO exec sp_dboption N'GHTDB', N'recursive triggers', N'false' GO exec sp_dboption N'GHTDB', N'ANSI nulls', N'false' GO exec sp_dboption N'GHTDB', N'concat null yields null', N'false' GO exec sp_dboption N'GHTDB', N'cursor close on commit', N'false' GO exec sp_dboption N'GHTDB', N'default to local cursor', N'false' GO exec sp_dboption N'GHTDB', N'quoted identifier', N'false' GO exec sp_dboption N'GHTDB', N'ANSI warnings', N'false' GO exec sp_dboption N'GHTDB', N'auto create statistics', N'true' GO exec sp_dboption N'GHTDB', N'auto update statistics', N'true' GO if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) ) exec sp_dboption N'GHTDB', N'db chaining', N'false' GO use [GHTDB] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Products_Categories]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[Products] DROP CONSTRAINT FK_Products_Categories GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_CustomerCustomerDemo]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[CustomerCustomerDemo] DROP CONSTRAINT FK_CustomerCustomerDemo GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_CustomerCustomerDemo_Customers]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[CustomerCustomerDemo] DROP CONSTRAINT FK_CustomerCustomerDemo_Customers GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Orders_Customers]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[Orders] DROP CONSTRAINT FK_Orders_Customers GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Employees_Employees]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[Employees] DROP CONSTRAINT FK_Employees_Employees GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_EmployeeTerritories_Employees]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[EmployeeTerritories] DROP CONSTRAINT FK_EmployeeTerritories_Employees GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Orders_Employees]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[Orders] DROP CONSTRAINT FK_Orders_Employees GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Order_Details_Orders]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[Order Details] DROP CONSTRAINT FK_Order_Details_Orders GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Order_Details_Products]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[Order Details] DROP CONSTRAINT FK_Order_Details_Products GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Territories_Region]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[Territories] DROP CONSTRAINT FK_Territories_Region GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Orders_Shippers]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[Orders] DROP CONSTRAINT FK_Orders_Shippers GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Products_Suppliers]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[Products] DROP CONSTRAINT FK_Products_Suppliers GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_EmployeeTerritories_Territories]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[EmployeeTerritories] DROP CONSTRAINT FK_EmployeeTerritories_Territories GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CustOrderHist]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[CustOrderHist] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CustOrdersDetail]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[CustOrdersDetail] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CustOrdersOrders]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[CustOrdersOrders] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Employee Sales by Country]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[Employee Sales by Country] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GH_CreateTable]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GH_CreateTable] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GH_MultiRecordSets]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GH_MultiRecordSets] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GH_INOUT1]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GH_INOUT1] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GH_REFCURSOR1]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GH_REFCURSOR1] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GH_REFCURSOR2]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GH_REFCURSOR2] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GH_REFCURSOR3]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GH_REFCURSOR3] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Sales by Year]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[Sales by Year] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SalesByCategory]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[SalesByCategory] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Ten Most Expensive Products]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[Ten Most Expensive Products] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Category Sales for 1997]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Category Sales for 1997] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Sales Totals by Amount]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Sales Totals by Amount] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Sales by Category]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Sales by Category] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Summary of Sales by Quarter]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Summary of Sales by Quarter] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Summary of Sales by Year]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Summary of Sales by Year] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Invoices]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Invoices] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Order Details Extended]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Order Details Extended] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Order Subtotals]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Order Subtotals] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Product Sales for 1997]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Product Sales for 1997] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Alphabetical list of products]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Alphabetical list of products] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Current Product List]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Current Product List] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Orders Qry]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Orders Qry] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Products Above Average Price]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Products Above Average Price] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Products by Category]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Products by Category] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Quarterly Orders]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[Quarterly Orders] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Categories]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Categories] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CustomerCustomerDemo]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[CustomerCustomerDemo] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CustomerDemographics]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[CustomerDemographics] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Customers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Customers] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EmployeeTerritories]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[EmployeeTerritories] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Employees]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Employees] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GH_EMPTYTABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[GH_EMPTYTABLE] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Order Details]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Order Details] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Orders]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Orders] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Products]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Products] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Region]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Region] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Shippers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Shippers] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Suppliers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Suppliers] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Territories]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Territories] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Types_Simple]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Types_Simple] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Types_Extended]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Types_Extended] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Types_Specific]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Types_Specific] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GHSP_TYPES_SIMPLE_1]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GHSP_TYPES_SIMPLE_1] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GHSP_TYPES_SIMPLE_2]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GHSP_TYPES_SIMPLE_2] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GHSP_TYPES_SIMPLE_3]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GHSP_TYPES_SIMPLE_3] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GHSP_TYPES_SIMPLE_4]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GHSP_TYPES_SIMPLE_4] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GHSP_TYPES_SIMPLE_5]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GHSP_TYPES_SIMPLE_5] GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO CREATE TABLE [dbo].[TYPES_SIMPLE] ( -- ID [ID] char(10) NULL, [T_BIT] [bit] NULL , -- integer [T_TINYINT] [tinyint] NULL , [T_SMALLINT] [smallint] NULL , [T_INT] [int] NULL , [T_BIGINT] [bigint] NULL , -- float [T_DECIMAL] [decimal](18, 0) NULL , [T_NUMERIC] [numeric](18, 0) NULL , [T_FLOAT] [float] NULL , [T_REAL] [real] NULL , -- text [T_CHAR] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [T_NCHAR] [nchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [T_VARCHAR] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [T_NVARCHAR] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[TYPES_EXTENDED] ( -- ID [ID] char(10) NULL, -- Text [T_TEXT] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [T_NTEXT] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL , -- Binary [T_BINARY] [binary] (50) NULL , [T_VARBINARY] [varbinary] (50) NULL , --Time [T_DATETIME] [datetime] NULL , [T_SMALLDATETIME] [smalldatetime] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] CREATE TABLE [dbo].[TYPES_SPECIFIC] ( -- ID [ID] char(10) NULL, [T_SMALLMONEY] [smallmoney] NULL , [T_MONEY] [money] NULL , [T_IMAGE] [image] NULL , [T_UNIQUEIDENTIFIER] [uniqueidentifier] NULL , [T_SQL_VARIANT] [sql_variant] NULL , [T_TIMESTAMP] [timestamp] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO CREATE TABLE [dbo].[Categories] ( [CategoryID] [int] IDENTITY (1, 1) NOT NULL , [CategoryName] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Picture] [image] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO CREATE TABLE [dbo].[CustomerCustomerDemo] ( [CustomerID] [nchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [CustomerTypeID] [nchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[CustomerDemographics] ( [CustomerTypeID] [nchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [CustomerDesc] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO CREATE TABLE [dbo].[Customers] ( [CustomerID] [nchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [CompanyName] [nvarchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [ContactName] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ContactTitle] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Address] [nvarchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [City] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Region] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [PostalCode] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Country] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Phone] [nvarchar] (24) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Fax] [nvarchar] (24) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[EmployeeTerritories] ( [EmployeeID] [int] NOT NULL , [TerritoryID] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Employees] ( [EmployeeID] [int] NOT NULL , [LastName] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [FirstName] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Title] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [TitleOfCourtesy] [nvarchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [BirthDate] [datetime] NULL , [HireDate] [datetime] NULL , [Address] [nvarchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [City] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Region] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [PostalCode] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Country] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [HomePhone] [nvarchar] (24) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Extension] [nvarchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Photo] [image] NULL , [Notes] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ReportsTo] [int] NULL , [PhotoPath] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO CREATE TABLE [dbo].[GH_EMPTYTABLE] ( [Col1] [int] NULL , [Col2] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Order Details] ( [OrderID] [int] NOT NULL , [ProductID] [int] NOT NULL , [UnitPrice] [money] NOT NULL , [Quantity] [smallint] NOT NULL , [Discount] [real] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Orders] ( [OrderID] [int] IDENTITY (1, 1) NOT NULL , [CustomerID] [nchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [EmployeeID] [int] NULL , [OrderDate] [datetime] NULL , [RequiredDate] [datetime] NULL , [ShippedDate] [datetime] NULL , [ShipVia] [int] NULL , [Freight] [money] NULL , [ShipName] [nvarchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ShipAddress] [nvarchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ShipCity] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ShipRegion] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ShipPostalCode] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ShipCountry] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Products] ( [ProductID] [int] IDENTITY (1, 1) NOT NULL , [ProductName] [nvarchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [SupplierID] [int] NULL , [CategoryID] [int] NULL , [QuantityPerUnit] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [UnitPrice] [money] NULL , [UnitsInStock] [smallint] NULL , [UnitsOnOrder] [smallint] NULL , [ReorderLevel] [smallint] NULL , [Discontinued] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Region] ( [RegionID] [int] NOT NULL , [RegionDescription] [nchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Shippers] ( [ShipperID] [int] IDENTITY (1, 1) NOT NULL , [CompanyName] [nvarchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Phone] [nvarchar] (24) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Suppliers] ( [SupplierID] [int] IDENTITY (1, 1) NOT NULL , [CompanyName] [nvarchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [ContactName] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ContactTitle] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Address] [nvarchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [City] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Region] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [PostalCode] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Country] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Phone] [nvarchar] (24) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Fax] [nvarchar] (24) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [HomePage] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO CREATE TABLE [dbo].[Territories] ( [TerritoryID] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [TerritoryDescription] [nchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [RegionID] [int] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Categories] WITH NOCHECK ADD CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED ( [CategoryID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Customers] WITH NOCHECK ADD CONSTRAINT [PK_Customers] PRIMARY KEY CLUSTERED ( [CustomerID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Employees] WITH NOCHECK ADD CONSTRAINT [PK_Employees] PRIMARY KEY CLUSTERED ( [EmployeeID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Order Details] WITH NOCHECK ADD CONSTRAINT [PK_Order_Details] PRIMARY KEY CLUSTERED ( [OrderID], [ProductID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Orders] WITH NOCHECK ADD CONSTRAINT [PK_Orders] PRIMARY KEY CLUSTERED ( [OrderID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Products] WITH NOCHECK ADD CONSTRAINT [PK_Products] PRIMARY KEY CLUSTERED ( [ProductID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Shippers] WITH NOCHECK ADD CONSTRAINT [PK_Shippers] PRIMARY KEY CLUSTERED ( [ShipperID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Suppliers] WITH NOCHECK ADD CONSTRAINT [PK_Suppliers] PRIMARY KEY CLUSTERED ( [SupplierID] ) ON [PRIMARY] GO CREATE INDEX [CategoryName] ON [dbo].[Categories]([CategoryName]) ON [PRIMARY] GO ALTER TABLE [dbo].[CustomerCustomerDemo] ADD CONSTRAINT [PK_CustomerCustomerDemo] PRIMARY KEY NONCLUSTERED ( [CustomerID], [CustomerTypeID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[CustomerDemographics] ADD CONSTRAINT [PK_CustomerDemographics] PRIMARY KEY NONCLUSTERED ( [CustomerTypeID] ) ON [PRIMARY] GO CREATE INDEX [City] ON [dbo].[Customers]([City]) ON [PRIMARY] GO CREATE INDEX [CompanyName] ON [dbo].[Customers]([CompanyName]) ON [PRIMARY] GO CREATE INDEX [PostalCode] ON [dbo].[Customers]([PostalCode]) ON [PRIMARY] GO CREATE INDEX [Region] ON [dbo].[Customers]([Region]) ON [PRIMARY] GO ALTER TABLE [dbo].[EmployeeTerritories] ADD CONSTRAINT [PK_EmployeeTerritories] PRIMARY KEY NONCLUSTERED ( [EmployeeID], [TerritoryID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Employees] ADD CONSTRAINT [CK_Birthdate] CHECK ([BirthDate] < getdate()) GO CREATE INDEX [LastName] ON [dbo].[Employees]([LastName]) ON [PRIMARY] GO CREATE INDEX [PostalCode] ON [dbo].[Employees]([PostalCode]) ON [PRIMARY] GO ALTER TABLE [dbo].[Order Details] ADD CONSTRAINT [DF_Order_Details_UnitPrice] DEFAULT (0) FOR [UnitPrice], CONSTRAINT [DF_Order_Details_Quantity] DEFAULT (1) FOR [Quantity], CONSTRAINT [DF_Order_Details_Discount] DEFAULT (0) FOR [Discount], CONSTRAINT [CK_Discount] CHECK ([Discount] >= 0 and [Discount] <= 1), CONSTRAINT [CK_Quantity] CHECK ([Quantity] > 0), CONSTRAINT [CK_UnitPrice] CHECK ([UnitPrice] >= 0) GO CREATE INDEX [OrderID] ON [dbo].[Order Details]([OrderID]) ON [PRIMARY] GO CREATE INDEX [OrdersOrder_Details] ON [dbo].[Order Details]([OrderID]) ON [PRIMARY] GO CREATE INDEX [ProductID] ON [dbo].[Order Details]([ProductID]) ON [PRIMARY] GO CREATE INDEX [ProductsOrder_Details] ON [dbo].[Order Details]([ProductID]) ON [PRIMARY] GO ALTER TABLE [dbo].[Orders] ADD CONSTRAINT [DF_Orders_Freight] DEFAULT (0) FOR [Freight] GO CREATE INDEX [CustomerID] ON [dbo].[Orders]([CustomerID]) ON [PRIMARY] GO CREATE INDEX [CustomersOrders] ON [dbo].[Orders]([CustomerID]) ON [PRIMARY] GO CREATE INDEX [EmployeeID] ON [dbo].[Orders]([EmployeeID]) ON [PRIMARY] GO CREATE INDEX [EmployeesOrders] ON [dbo].[Orders]([EmployeeID]) ON [PRIMARY] GO CREATE INDEX [OrderDate] ON [dbo].[Orders]([OrderDate]) ON [PRIMARY] GO CREATE INDEX [ShippedDate] ON [dbo].[Orders]([ShippedDate]) ON [PRIMARY] GO CREATE INDEX [ShippersOrders] ON [dbo].[Orders]([ShipVia]) ON [PRIMARY] GO CREATE INDEX [ShipPostalCode] ON [dbo].[Orders]([ShipPostalCode]) ON [PRIMARY] GO ALTER TABLE [dbo].[Products] ADD CONSTRAINT [DF_Products_UnitPrice] DEFAULT (0) FOR [UnitPrice], CONSTRAINT [DF_Products_UnitsInStock] DEFAULT (0) FOR [UnitsInStock], CONSTRAINT [DF_Products_UnitsOnOrder] DEFAULT (0) FOR [UnitsOnOrder], CONSTRAINT [DF_Products_ReorderLevel] DEFAULT (0) FOR [ReorderLevel], CONSTRAINT [DF_Products_Discontinued] DEFAULT (0) FOR [Discontinued], CONSTRAINT [CK_Products_UnitPrice] CHECK ([UnitPrice] >= 0), CONSTRAINT [CK_ReorderLevel] CHECK ([ReorderLevel] >= 0), CONSTRAINT [CK_UnitsInStock] CHECK ([UnitsInStock] >= 0), CONSTRAINT [CK_UnitsOnOrder] CHECK ([UnitsOnOrder] >= 0) GO CREATE INDEX [CategoriesProducts] ON [dbo].[Products]([CategoryID]) ON [PRIMARY] GO CREATE INDEX [CategoryID] ON [dbo].[Products]([CategoryID]) ON [PRIMARY] GO CREATE INDEX [ProductName] ON [dbo].[Products]([ProductName]) ON [PRIMARY] GO CREATE INDEX [SupplierID] ON [dbo].[Products]([SupplierID]) ON [PRIMARY] GO CREATE INDEX [SuppliersProducts] ON [dbo].[Products]([SupplierID]) ON [PRIMARY] GO ALTER TABLE [dbo].[Region] ADD CONSTRAINT [PK_Region] PRIMARY KEY NONCLUSTERED ( [RegionID] ) ON [PRIMARY] GO CREATE INDEX [CompanyName] ON [dbo].[Suppliers]([CompanyName]) ON [PRIMARY] GO CREATE INDEX [PostalCode] ON [dbo].[Suppliers]([PostalCode]) ON [PRIMARY] GO ALTER TABLE [dbo].[Territories] ADD CONSTRAINT [PK_Territories] PRIMARY KEY NONCLUSTERED ( [TerritoryID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[CustomerCustomerDemo] ADD CONSTRAINT [FK_CustomerCustomerDemo] FOREIGN KEY ( [CustomerTypeID] ) REFERENCES [dbo].[CustomerDemographics] ( [CustomerTypeID] ), CONSTRAINT [FK_CustomerCustomerDemo_Customers] FOREIGN KEY ( [CustomerID] ) REFERENCES [dbo].[Customers] ( [CustomerID] ) GO ALTER TABLE [dbo].[EmployeeTerritories] ADD CONSTRAINT [FK_EmployeeTerritories_Employees] FOREIGN KEY ( [EmployeeID] ) REFERENCES [dbo].[Employees] ( [EmployeeID] ), CONSTRAINT [FK_EmployeeTerritories_Territories] FOREIGN KEY ( [TerritoryID] ) REFERENCES [dbo].[Territories] ( [TerritoryID] ) GO ALTER TABLE [dbo].[Employees] ADD CONSTRAINT [FK_Employees_Employees] FOREIGN KEY ( [ReportsTo] ) REFERENCES [dbo].[Employees] ( [EmployeeID] ) GO ALTER TABLE [dbo].[Order Details] ADD CONSTRAINT [FK_Order_Details_Orders] FOREIGN KEY ( [OrderID] ) REFERENCES [dbo].[Orders] ( [OrderID] ), CONSTRAINT [FK_Order_Details_Products] FOREIGN KEY ( [ProductID] ) REFERENCES [dbo].[Products] ( [ProductID] ) GO ALTER TABLE [dbo].[Orders] ADD CONSTRAINT [FK_Orders_Customers] FOREIGN KEY ( [CustomerID] ) REFERENCES [dbo].[Customers] ( [CustomerID] ), CONSTRAINT [FK_Orders_Employees] FOREIGN KEY ( [EmployeeID] ) REFERENCES [dbo].[Employees] ( [EmployeeID] ), CONSTRAINT [FK_Orders_Shippers] FOREIGN KEY ( [ShipVia] ) REFERENCES [dbo].[Shippers] ( [ShipperID] ) GO ALTER TABLE [dbo].[Products] ADD CONSTRAINT [FK_Products_Categories] FOREIGN KEY ( [CategoryID] ) REFERENCES [dbo].[Categories] ( [CategoryID] ), CONSTRAINT [FK_Products_Suppliers] FOREIGN KEY ( [SupplierID] ) REFERENCES [dbo].[Suppliers] ( [SupplierID] ) GO ALTER TABLE [dbo].[Territories] ADD CONSTRAINT [FK_Territories_Region] FOREIGN KEY ( [RegionID] ) REFERENCES [dbo].[Region] ( [RegionID] ) GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Current Product List" AS SELECT Product_List.ProductID, Product_List.ProductName FROM Products AS Product_List WHERE (((Product_List.Discontinued)=0)) --ORDER BY Product_List.ProductName GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Orders Qry" AS SELECT Orders.OrderID, Orders.CustomerID, Orders.EmployeeID, Orders.OrderDate, Orders.RequiredDate, Orders.ShippedDate, Orders.ShipVia, Orders.Freight, Orders.ShipName, Orders.ShipAddress, Orders.ShipCity, Orders.ShipRegion, Orders.ShipPostalCode, Orders.ShipCountry, Customers.CompanyName, Customers.Address, Customers.City, Customers.Region, Customers.PostalCode, Customers.Country FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Products Above Average Price" AS SELECT Products.ProductName, Products.UnitPrice FROM Products WHERE Products.UnitPrice>(SELECT AVG(UnitPrice) From Products) --ORDER BY Products.UnitPrice DESC GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Products by Category" AS SELECT Categories.CategoryName, Products.ProductName, Products.QuantityPerUnit, Products.UnitsInStock, Products.Discontinued FROM Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID WHERE Products.Discontinued <> 1 --ORDER BY Categories.CategoryName, Products.ProductName GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Quarterly Orders" AS SELECT DISTINCT Customers.CustomerID, Customers.CompanyName, Customers.City, Customers.Country FROM Customers RIGHT JOIN Orders ON Customers.CustomerID = Orders.CustomerID WHERE Orders.OrderDate BETWEEN '19970101' And '19971231' GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view Invoices AS SELECT Orders.ShipName, Orders.ShipAddress, Orders.ShipCity, Orders.ShipRegion, Orders.ShipPostalCode, Orders.ShipCountry, Orders.CustomerID, Customers.CompanyName AS CustomerName, Customers.Address, Customers.City, Customers.Region, Customers.PostalCode, Customers.Country, (FirstName + ' ' + LastName) AS Salesperson, Orders.OrderID, Orders.OrderDate, Orders.RequiredDate, Orders.ShippedDate, Shippers.CompanyName As ShipperName, "Order Details".ProductID, Products.ProductName, "Order Details".UnitPrice, "Order Details".Quantity, "Order Details".Discount, (CONVERT(money,("Order Details".UnitPrice*Quantity*(1-Discount)/100))*100) AS ExtendedPrice, Orders.Freight FROM Shippers INNER JOIN (Products INNER JOIN ( (Employees INNER JOIN (Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID) ON Employees.EmployeeID = Orders.EmployeeID) INNER JOIN "Order Details" ON Orders.OrderID = "Order Details".OrderID) ON Products.ProductID = "Order Details".ProductID) ON Shippers.ShipperID = Orders.ShipVia GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Order Details Extended" AS SELECT "Order Details".OrderID, "Order Details".ProductID, Products.ProductName, "Order Details".UnitPrice, "Order Details".Quantity, "Order Details".Discount, (CONVERT(money,("Order Details".UnitPrice*Quantity*(1-Discount)/100))*100) AS ExtendedPrice FROM Products INNER JOIN "Order Details" ON Products.ProductID = "Order Details".ProductID --ORDER BY "Order Details".OrderID GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Order Subtotals" AS SELECT "Order Details".OrderID, Sum(CONVERT(money,("Order Details".UnitPrice*Quantity*(1-Discount)/100))*100) AS Subtotal FROM "Order Details" GROUP BY "Order Details".OrderID GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Product Sales for 1997" AS SELECT Categories.CategoryName, Products.ProductName, Sum(CONVERT(money,("Order Details".UnitPrice*Quantity*(1-Discount)/100))*100) AS ProductSales FROM (Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID) INNER JOIN (Orders INNER JOIN "Order Details" ON Orders.OrderID = "Order Details".OrderID) ON Products.ProductID = "Order Details".ProductID WHERE (((Orders.ShippedDate) Between '19970101' And '19971231')) GROUP BY Categories.CategoryName, Products.ProductName GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Category Sales for 1997" AS SELECT "Product Sales for 1997".CategoryName, Sum("Product Sales for 1997".ProductSales) AS CategorySales FROM "Product Sales for 1997" GROUP BY "Product Sales for 1997".CategoryName GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Sales Totals by Amount" AS SELECT "Order Subtotals".Subtotal AS SaleAmount, Orders.OrderID, Customers.CompanyName, Orders.ShippedDate FROM Customers INNER JOIN (Orders INNER JOIN "Order Subtotals" ON Orders.OrderID = "Order Subtotals".OrderID) ON Customers.CustomerID = Orders.CustomerID WHERE ("Order Subtotals".Subtotal >2500) AND (Orders.ShippedDate BETWEEN '19970101' And '19971231') GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Sales by Category" AS SELECT Categories.CategoryID, Categories.CategoryName, Products.ProductName, Sum("Order Details Extended".ExtendedPrice) AS ProductSales FROM Categories INNER JOIN (Products INNER JOIN (Orders INNER JOIN "Order Details Extended" ON Orders.OrderID = "Order Details Extended".OrderID) ON Products.ProductID = "Order Details Extended".ProductID) ON Categories.CategoryID = Products.CategoryID WHERE Orders.OrderDate BETWEEN '19970101' And '19971231' GROUP BY Categories.CategoryID, Categories.CategoryName, Products.ProductName --ORDER BY Products.ProductName GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Summary of Sales by Quarter" AS SELECT Orders.ShippedDate, Orders.OrderID, "Order Subtotals".Subtotal FROM Orders INNER JOIN "Order Subtotals" ON Orders.OrderID = "Order Subtotals".OrderID WHERE Orders.ShippedDate IS NOT NULL --ORDER BY Orders.ShippedDate GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create view "Summary of Sales by Year" AS SELECT Orders.ShippedDate, Orders.OrderID, "Order Subtotals".Subtotal FROM Orders INNER JOIN "Order Subtotals" ON Orders.OrderID = "Order Subtotals".OrderID WHERE Orders.ShippedDate IS NOT NULL --ORDER BY Orders.ShippedDate GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE PROCEDURE CustOrderHist @CustomerID nchar(5) AS SELECT ProductName, Total=SUM(Quantity) FROM Products P, [Order Details] OD, Orders O, Customers C WHERE C.CustomerID = @CustomerID AND C.CustomerID = O.CustomerID AND O.OrderID = OD.OrderID AND OD.ProductID = P.ProductID GROUP BY ProductName GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE PROCEDURE CustOrdersDetail @OrderID int AS SELECT ProductName, UnitPrice=ROUND(Od.UnitPrice, 2), Quantity, Discount=CONVERT(int, Discount * 100), ExtendedPrice=ROUND(CONVERT(money, Quantity * (1 - Discount) * Od.UnitPrice), 2) FROM Products P, [Order Details] Od WHERE Od.ProductID = P.ProductID and Od.OrderID = @OrderID GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE PROCEDURE CustOrdersOrders @CustomerID nchar(5) AS SELECT OrderID, OrderDate, RequiredDate, ShippedDate FROM Orders WHERE CustomerID = @CustomerID ORDER BY OrderID GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure "Employee Sales by Country" @Beginning_Date DateTime, @Ending_Date DateTime AS SELECT Employees.Country, Employees.LastName, Employees.FirstName, Orders.ShippedDate, Orders.OrderID, "Order Subtotals".Subtotal AS SaleAmount FROM Employees INNER JOIN (Orders INNER JOIN "Order Subtotals" ON Orders.OrderID = "Order Subtotals".OrderID) ON Employees.EmployeeID = Orders.EmployeeID WHERE Orders.ShippedDate Between @Beginning_Date And @Ending_Date GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE PROCEDURE GH_CREATETABLE AS Begin --craete a temporary table Create Table #temp_tbl ( Col1 int, Col2 int ) --insert values to the table insert into #temp_tbl values (11,12) insert into #temp_tbl values (21,22) insert into #temp_tbl values (31,32) --execute select on the created table select col1 as Value1, col2 as Value2 from #temp_tbl; --Update Return code end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE PROCEDURE GH_MultiRecordSets as BEGIN -- Declare cursor SELECT EmployeeId, LastName FROM Employees where EmployeeId in (1,2) order by EmployeeId asc; SELECT CustomerId, CompanyName,ContactName FROM Customers where CustomerId in ('MORGK','NORTS') order by customerid asc; -- return empty result set SELECT OrderId, ShipAddress,ShipVia, ShipCity FROM Orders where OrderId=-1 ; END GO CREATE procedure GH_INOUT1 @INPARAM varchar(20) , @OUTPARAM int output AS declare @L_INPARAM varchar(30) select L_INPARAM = @INPARAM select @OUTPARAM = 100 GO CREATE procedure GH_REFCURSOR1 AS SELECT EmployeeId, LastName FROM Employees WHERE EmployeeId=1; GO CREATE procedure GH_REFCURSOR2 @IN_EMPLOYEEID int AS SELECT EmployeeId, LastName FROM Employees where EmployeeId = @IN_EMPLOYEEID GO CREATE procedure GH_REFCURSOR3 @IN_LASTNAME varchar(20) AS SELECT EmployeeId, LastName FROM Employees where LastName = @IN_LASTNAME GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure "Sales by Year" @Beginning_Date DateTime, @Ending_Date DateTime AS SELECT Orders.ShippedDate, Orders.OrderID, "Order Subtotals".Subtotal, DATENAME(yy,ShippedDate) AS Year FROM Orders INNER JOIN "Order Subtotals" ON Orders.OrderID = "Order Subtotals".OrderID WHERE Orders.ShippedDate Between @Beginning_Date And @Ending_Date GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE PROCEDURE SalesByCategory @CategoryName nvarchar(15), @OrdYear nvarchar(4) = '1998' AS IF @OrdYear != '1996' AND @OrdYear != '1997' AND @OrdYear != '1998' BEGIN SELECT @OrdYear = '1998' END SELECT ProductName, TotalPurchase=ROUND(SUM(CONVERT(decimal(14,2), OD.Quantity * (1-OD.Discount) * OD.UnitPrice)), 0) FROM [Order Details] OD, Orders O, Products P, Categories C WHERE OD.OrderID = O.OrderID AND OD.ProductID = P.ProductID AND P.CategoryID = C.CategoryID AND C.CategoryName = @CategoryName AND SUBSTRING(CONVERT(nvarchar(22), O.OrderDate, 111), 1, 4) = @OrdYear GROUP BY ProductName ORDER BY ProductName GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure "Ten Most Expensive Products" AS SET ROWCOUNT 10 SELECT Products.ProductName AS TenMostExpensiveProducts, Products.UnitPrice FROM Products ORDER BY Products.UnitPrice DESC GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO CREATE PROCEDURE GHSP_TYPES_SIMPLE_1 @T_BIT bit , @T_TINYINT tinyint, @T_SMALLINT smallint , @T_INT int, @T_BIGINT bigint, @T_DECIMAL decimal(18, 0), @T_NUMERIC numeric(18, 0) , @T_FLOAT float , @T_REAL real , @T_CHAR char (10), @T_NCHAR nchar (10), @T_VARCHAR varchar (50) , @T_NVARCHAR nvarchar (50) AS SELECT @T_BIT as 'T_BIT', @T_TINYINT as 'T_TINYINT', @T_SMALLINT as 'T_SMALLINT' , @T_INT as 'T_INT', @T_BIGINT as 'T_BIGINT', @T_DECIMAL as 'T_DECIMAL', @T_NUMERIC as 'T_NUMERIC' , @T_FLOAT as 'T_FLOAT' , @T_REAL as 'T_REAL' , @T_CHAR as 'T_CHAR', @T_NCHAR as 'T_NCHAR', @T_VARCHAR as 'T_VARCHAR' , @T_NVARCHAR as 'T_NVARCHAR' GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO CREATE PROCEDURE GHSP_TYPES_SIMPLE_2 @T_BIT bit output, @T_TINYINT tinyint output, @T_SMALLINT smallint output, @T_INT int output, @T_BIGINT bigint output, @T_DECIMAL decimal(18, 0) output, @T_NUMERIC numeric(18, 0) output, @T_FLOAT float output, @T_REAL real output, @T_CHAR char (10) output, @T_NCHAR nchar (10) output, @T_VARCHAR varchar (50) output, @T_NVARCHAR nvarchar (50) output AS IF @T_BIT=0 SELECT @T_BIT=1 ELSE IF (@T_BIT=1) SELECT @T_BIT=0 SELECT @T_TINYINT = @T_TINYINT*2 SELECT @T_SMALLINT = @T_SMALLINT*2 SELECT @T_INT = @T_INT*2 SELECT @T_BIGINT = @T_BIGINT*2 SELECT @T_DECIMAL = @T_DECIMAL*2 SELECT @T_NUMERIC = @T_NUMERIC*2 SELECT @T_FLOAT = @T_FLOAT*2 SELECT @T_REAL = @T_REAL*2 SELECT @T_CHAR = UPPER(@T_CHAR) SELECT @T_NCHAR =UPPER(@T_NCHAR) SELECT @T_VARCHAR = UPPER(@T_VARCHAR) SELECT @T_NVARCHAR = UPPER(@T_NVARCHAR) GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO CREATE PROCEDURE GHSP_TYPES_SIMPLE_3 @ID char, @T_BIT bit output, @T_TINYINT tinyint output, @T_SMALLINT smallint output, @T_INT int output, @T_BIGINT bigint output, @T_DECIMAL decimal(18, 0) output, @T_NUMERIC numeric(18, 0) output, @T_FLOAT float output, @T_REAL real output, @T_CHAR char (10) output, @T_NCHAR nchar (10) output, @T_VARCHAR varchar (50) output, @T_NVARCHAR nvarchar (50) output AS SELECT @T_BIT = T_BIT, @T_TINYINT = T_TINYINT, @T_SMALLINT = T_SMALLINT , @T_INT = T_INT, @T_BIGINT = T_BIGINT, @T_DECIMAL = T_DECIMAL , @T_NUMERIC = T_NUMERIC , @T_FLOAT = T_FLOAT , @T_REAL = T_REAL , @T_CHAR = T_CHAR, @T_NCHAR = T_NCHAR, @T_VARCHAR = T_VARCHAR, @T_NVARCHAR = T_NVARCHAR FROM TYPES_SIMPLE WHERE ID = @ID GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO CREATE PROCEDURE GHSP_TYPES_SIMPLE_4 @ID char AS /*Insert*/ insert into TYPES_SIMPLE(ID,T_INT) values (@ID,50) SELECT * FROM TYPES_SIMPLE WHERE ID = @ID /*Update*/ update TYPES_SIMPLE set T_INT=60 where Id = @ID SELECT * FROM TYPES_SIMPLE WHERE ID = @ID /*Delete*/ delete from TYPES_SIMPLE WHERE ID = @ID SELECT * FROM TYPES_SIMPLE WHERE ID = @ID GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO CREATE PROCEDURE GHSP_TYPES_SIMPLE_5 AS DECLARE @T_BIT bit DECLARE @T_TINYINT tinyint DECLARE @T_SMALLINT smallint DECLARE @T_INT int DECLARE @T_BIGINT bigint DECLARE @T_DECIMAL decimal(18,0) DECLARE @T_NUMERIC numeric(18,0) DECLARE @T_FLOAT float DECLARE @T_REAL real DECLARE @T_CHAR char(10) DECLARE @T_NCHAR nchar(10) DECLARE @T_VARCHAR varchar(50) DECLARE @T_NVARCHAR nvarchar(50) SELECT @T_BIT = 1 SELECT @T_TINYINT = 25 SELECT @T_SMALLINT = 77 SELECT @T_INT = 2525 SELECT @T_BIGINT = 25251414 SELECT @T_DECIMAL = 10 SELECT @T_NUMERIC = 123123 SELECT @T_FLOAT = 17.1414257 SELECT @T_REAL = 0.71425 SELECT @T_CHAR = 'abcdefghij' SELECT @T_NCHAR = N'klmnopqrst' SELECT @T_VARCHAR = 'qwertasdfg' SELECT @T_NVARCHAR = N'qwertasdfg' SELECT @T_BIT as 'T_BIT', @T_TINYINT as 'T_TINYINT', @T_SMALLINT as 'T_SMALLINT' , @T_INT as 'T_INT', @T_BIGINT as 'T_BIGINT', @T_DECIMAL as 'T_DECIMAL', @T_NUMERIC as 'T_NUMERIC' , @T_FLOAT as 'T_FLOAT' , @T_REAL as 'T_REAL' , @T_CHAR as 'T_CHAR', @T_NCHAR as 'T_NCHAR', @T_VARCHAR as 'T_VARCHAR' , @T_NVARCHAR as 'T_NVARCHAR' GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO if not exists (select * from master.dbo.syslogins where loginname = N'mainsoft') BEGIN declare @logindb nvarchar(132), @loginlang nvarchar(132) select @logindb = N'GHTDB', @loginlang = N'us_english' if @logindb is null or not exists (select * from master.dbo.sysdatabases where name = @logindb) select @logindb = N'master' if @loginlang is null or (not exists (select * from master.dbo.syslanguages where name = @loginlang) and @loginlang <> N'us_english') select @loginlang = @@language exec sp_addlogin N'mainsoft', null, @logindb, @loginlang END GO exec sp_addsrvrolemember N'mainsoft', sysadmin GO if not exists (select * from dbo.sysusers where name = N'mainsoft' and uid < 16382) EXEC sp_grantdbaccess N'mainsoft', N'mainsoft' GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO if exists (select * from dbo.sysobjects where id = object_id(N'[mainsoft].[CategoriesNew]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [mainsoft].[CategoriesNew] GO CREATE TABLE [mainsoft].[CategoriesNew] ( [CategoryID] [int] IDENTITY (1, 1) NOT NULL , [CategoryName] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Picture] [image] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO CREATE TABLE [mainsoft].[Categories] ( [CategoryID] [nvarchar] (15) NOT NULL , [CategoryName] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Picture] [int] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO CREATE procedure [mainsoft].[GH_DUMMY] @EmployeeIdPrm char (10) AS SELECT * FROM Employees where EmployeeID > @EmployeeIdPrm GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO ------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------ IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'GHTDB_EX') DROP DATABASE [GHTDB_EX] GO CREATE DATABASE [GHTDB_EX] ON (NAME = N'GHTDB_dat_EX', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\GHTDB_EX.mdf' , SIZE = 6, FILEGROWTH = 10%) LOG ON (NAME = N'GHTDB_EX_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\GHTDB_EX.ldf' , SIZE = 2, FILEGROWTH = 10%) COLLATE SQL_Latin1_General_CP1_CI_AS GO exec sp_dboption N'GHTDB_EX', N'autoclose', N'false' GO exec sp_dboption N'GHTDB_EX', N'bulkcopy', N'true' GO exec sp_dboption N'GHTDB_EX', N'trunc. log', N'true' GO exec sp_dboption N'GHTDB_EX', N'torn page detection', N'true' GO exec sp_dboption N'GHTDB_EX', N'read only', N'false' GO exec sp_dboption N'GHTDB_EX', N'dbo use', N'false' GO exec sp_dboption N'GHTDB_EX', N'single', N'false' GO exec sp_dboption N'GHTDB_EX', N'autoshrink', N'false' GO exec sp_dboption N'GHTDB_EX', N'ANSI null default', N'false' GO exec sp_dboption N'GHTDB_EX', N'recursive triggers', N'false' GO exec sp_dboption N'GHTDB_EX', N'ANSI nulls', N'false' GO exec sp_dboption N'GHTDB_EX', N'concat null yields null', N'false' GO exec sp_dboption N'GHTDB_EX', N'cursor close on commit', N'false' GO exec sp_dboption N'GHTDB_EX', N'default to local cursor', N'false' GO exec sp_dboption N'GHTDB_EX', N'quoted identifier', N'false' GO exec sp_dboption N'GHTDB_EX', N'ANSI warnings', N'false' GO exec sp_dboption N'GHTDB_EX', N'auto create statistics', N'true' GO exec sp_dboption N'GHTDB_EX', N'auto update statistics', N'true' GO if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) ) exec sp_dboption N'GHTDB_EX', N'db chaining', N'false' GO use [GHTDB_EX] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GH_DUMMY]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GH_DUMMY] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Customers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Customers] GO CREATE TABLE [dbo].[Customers] ( [CustomerID] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [CompanyName] [nvarchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ContactName] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ContactTitle] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Address] [nvarchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [City] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Region] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [PostalCode] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Country] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Phone] [nvarchar] (24) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Fax] [nvarchar] (24) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO print '------------------------------' print 'create another GH_DUMMY which select from a different table' print 'customers instead of employees' print '------------------------------' go CREATE procedure GH_DUMMY @CustomerIdPrm char (10) AS SELECT * FROM Customers where CustomerID = @CustomerIdPrm GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO
the_stack
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com -- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions. -------------------------------------------------------------------------------- -- File name: exasnap.sql (Exadata Snapper) BETA -- -- Purpose: Display various Exadata IO efficiency metrics of a session -- from V$SESSTAT. -- -- Author: Tanel Poder ( http://blog.tanelpoder.com | tanel@tanelpoder.com ) -- -- Copyright: (c) 2012 All Rights Reserved -- -- Usage: -- 1) TAKE A SNAPSHOT -- -- SELECT exasnap.begin_snap(<sid>) FROM dual; -- or -- SELECT exasnap.begin_snap('<sid>[@<instance#>]') FROM dual; -- -- 2) Run the measured query in the session you snapshotted -- (or just wait for it to run a while) -- -- 3) TAKE A 2ND SNAPSHOT -- -- SELECT exasnap.begin_snap(<sid>) FROM dual; -- or -- SELECT exasnap.begin_snap('<sid>[@<instance#>]') FROM dual; -- -- 4) REPORT SESSION METRICS -- -- @exasnap.sql basic <begin_snap> <end_snap> -- or -- @exasnap.sql % <begin_snap> <end_snap> -- -- The latter script gives you more output. -- -- Other: This is still a pretty raw script in development and will -- probably change a lot once it reaches v1.0. -- -- The PX slaves aggregate their metrics back to the QC session -- once the query completes, so querying the QC session only is -- ok if you wait for the query to finish (or cancel it) before -- taking a snapshot. -- To measure a query still running, -- -------------------------------------------------------------------------------- SET LINES 999 PAGES 5000 TRIMOUT ON TRIMSPOOL ON TAB OFF COL ioeff_percentage FOR A52 BREAK ON inst_id SKIP 1 ON SID ON CATEGORY SKIP 1 DUP -- keep in capital (MB or GB) DEF unit=MB -- adjust for MB or GB DEF divisor=1024*1024 DEF blocksize=8192 DEF asm_mirrors=2 DEFINE nothing ="" PROMPT PROMPT ---------------------------------------------------------------------------------------------------------------------------------------------&nothing PROMPT -- Exadata Snapper v0.5 BETA by Tanel Poder @ Enkitec - The Exadata Experts ( http://www.enkitec.com ) PROMPT ---------------------------------------------------------------------------------------------------------------------------------------------&nothing WITH stats AS ( SELECT stat_name name , SUM(delta) value , AVG(snap_seconds) snap_seconds -- is the same for all records in this snap_id FROM ( SELECT esn1.snap_id , esn1.snap_time begin_snap_time , esn2.snap_time end_snap_time , esn2.snap_time - esn1.snap_time snap_interval , TO_NUMBER(EXTRACT(second from esn2.snap_time - esn1.snap_time)) + TO_NUMBER(EXTRACT(minute from esn2.snap_time - esn1.snap_time)) * 60 + TO_NUMBER(EXTRACT(hour from esn2.snap_time - esn1.snap_time)) * 60 * 60 + TO_NUMBER(EXTRACT(day from esn2.snap_time - esn1.snap_time)) * 60 * 60 * 24 + -- TODO this is not needed TO_NUMBER(TO_CHAR(esn2.snap_time,'xFF')) - TO_NUMBER(TO_CHAR(esn1.snap_time,'xFF')) snap_seconds -- looks like the last part is buggy but it's too late to figure this out! , esn1.snap_name begin_snap_name , esn2.snap_name end_snap_name , ess1.stat_name , ess1.value begin_value , ess2.value end_value , ess2.value - ess1.value delta FROM ex_snapshot esn1 , ex_session es1 , ex_sesstat ess1 , ex_snapshot esn2 , ex_session es2 , ex_sesstat ess2 WHERE -- snap_id esn1.snap_id = es1.snap_id AND ess1.snap_id = esn1.snap_id AND es1.snap_id = ess1.snap_id AND es1.inst_id = ess1.inst_id AND es1.sid = ess1.sid AND es1.serial# = ess1.serial# -- AND esn2.snap_id = es2.snap_id AND es2.snap_id = ess2.snap_id AND ess2.snap_id = esn2.snap_id AND es2.inst_id = ess2.inst_id AND es2.sid = ess2.sid AND es2.serial# = ess2.serial# AND ess1.stat_name = ess2.stat_name AND ess1.inst_id = ess2.inst_id AND ess1.sid = ess2.sid AND ess1.serial# = ess2.serial# -- AND esn1.snap_id = &2 AND esn2.snap_id = &3 -- -- AND ess2.value - ess1.value != 0 -- for testing ) GROUP BY stat_name ), sq AS ( SELECT * FROM ( SELECT 0 inst_id , 0 sid , CASE WHEN TRIM(name) IN ( 'cell physical IO bytes sent directly to DB node to balance CPU' , 'cell physical IO bytes pushed back due to excessive CPU on cell' , 'cell physical IO bytes sent directly to DB node to balanceCPU u' ) THEN 'cell physical IO bytes sent directly to DB node to balance CPU' ELSE name END name , value FROM --gv$sesstat NATURAL JOIN v$statname stats WHERE 1=1 -- AND (name LIKE 'cell%bytes%' OR name LIKE 'physical%bytes%') AND TRIM(name) IN ( 'physical read total bytes' , 'physical write total bytes' , 'physical read total bytes optimized' , 'cell physical IO bytes eligible for predicate offload' , 'cell physical IO interconnect bytes' , 'cell physical IO interconnect bytes returned by smart scan' , 'cell physical IO bytes saved by storage index' , 'cell IO uncompressed bytes' , 'cell blocks processed by cache layer' , 'cell blocks processed by txn layer' , 'cell blocks processed by data layer' , 'cell blocks processed by index layer' , 'db block gets from cache' , 'consistent gets from cache' , 'db block gets direct' , 'consistent gets direct' -- following three stats are the same thing (named differently in different versions) , 'cell physical IO bytes sent directly to DB node to balance CPU' , 'cell physical IO bytes pushed back due to excessive CPU on cell' , 'cell physical IO bytes sent directly to DB node to balanceCPU u' , 'bytes sent via SQL*Net to client' , 'bytes received via SQL*Net from client' , 'table fetch continued row' , 'chained rows skipped by cell' , 'chained rows processed by cell' , 'chained rows rejected by cell' ) ) PIVOT ( SUM(value) FOR name IN ( 'physical read total bytes' AS phyrd_bytes , 'physical write total bytes' AS phywr_bytes , 'physical read total bytes optimized' AS phyrd_optim_bytes , 'cell physical IO bytes eligible for predicate offload' AS pred_offloadable_bytes , 'cell physical IO interconnect bytes' AS interconnect_bytes , 'cell physical IO interconnect bytes returned by smart scan' AS smart_scan_ret_bytes , 'cell physical IO bytes saved by storage index' AS storidx_saved_bytes , 'cell IO uncompressed bytes' AS uncompressed_bytes , 'cell blocks processed by cache layer' AS cell_proc_cache_blk , 'cell blocks processed by txn layer' AS cell_proc_txn_blk , 'cell blocks processed by data layer' AS cell_proc_data_blk , 'cell blocks processed by index layer' AS cell_proc_index_blk , 'db block gets from cache' AS curr_gets_cache_blk , 'consistent gets from cache' AS cons_gets_cache_blk , 'db block gets direct' AS curr_gets_direct_blk , 'consistent gets direct' AS cons_gets_direct_blk , 'cell physical IO bytes sent directly to DB node to balance CPU' AS cell_bal_cpu_bytes , 'bytes sent via SQL*Net to client' AS net_to_client_bytes , 'bytes received via SQL*Net from client' AS net_from_client_bytes , 'table fetch continued row' AS chain_fetch_cont_row , 'chained rows skipped by cell' AS chain_rows_skipped , 'chained rows processed by cell' AS chain_rows_processed , 'chained rows rejected by cell' AS chain_rows_rejected ) ) ), precalc AS ( SELECT inst_id , sid , ROUND((phyrd_bytes)/(&divisor)) db_physrd_&unit , ROUND((phywr_bytes)/(&divisor)) db_physwr_&unit , ROUND((phyrd_bytes+phywr_bytes)/(&divisor)) db_physio_&unit , ROUND(pred_offloadable_bytes/(&divisor)) pred_offloadable_&unit , ROUND(phyrd_optim_bytes/(&divisor)) phyrd_optim_&unit , ROUND((phyrd_optim_bytes-storidx_saved_bytes)/(&divisor)) phyrd_flash_rd_&unit , ROUND(storidx_saved_bytes/(&divisor)) phyrd_storidx_saved_&unit , ROUND((phyrd_bytes-phyrd_optim_bytes)/(&divisor)) spin_disk_rd_&unit , ROUND((phyrd_bytes-phyrd_optim_bytes+(phywr_bytes*&asm_mirrors))/(&divisor)) spin_disk_io_&unit , ROUND(uncompressed_bytes/(&divisor)) scanned_uncomp_&unit , ROUND(interconnect_bytes/(&divisor)) total_ic_&unit , ROUND(smart_scan_ret_bytes/(&divisor)) smart_scan_ret_&unit , ROUND((interconnect_bytes-smart_scan_ret_bytes)/(&divisor)) non_smart_scan_&unit , ROUND(cell_proc_cache_blk * &blocksize / (&divisor)) cell_proc_cache_&unit , ROUND(cell_proc_txn_blk * &blocksize / (&divisor)) cell_proc_txn_&unit , ROUND(cell_proc_data_blk * &blocksize / (&divisor)) cell_proc_data_&unit , ROUND(cell_proc_index_blk * &blocksize / (&divisor)) cell_proc_index_&unit , ROUND(curr_gets_cache_blk * &blocksize / (&divisor)) curr_gets_cache_&unit , ROUND(cons_gets_cache_blk * &blocksize / (&divisor)) cons_gets_cache_&unit , ROUND(curr_gets_direct_blk * &blocksize / (&divisor)) curr_gets_direct_&unit , ROUND(cons_gets_direct_blk * &blocksize / (&divisor)) cons_gets_direct_&unit , ROUND(cell_bal_cpu_bytes / (&divisor)) cell_bal_cpu_&unit , ROUND(net_to_client_bytes / (&divisor)) net_to_client_&unit , ROUND(net_from_client_bytes / (&divisor)) net_from_client_&unit , chain_fetch_cont_row , chain_rows_skipped , chain_rows_processed , chain_rows_rejected FROM sq ), precalc2 AS ( SELECT inst_id , sid , db_physio_&unit , db_physrd_&unit , db_physwr_&unit , pred_offloadable_&unit , phyrd_optim_&unit , phyrd_flash_rd_&unit + spin_disk_rd_&unit phyrd_disk_and_flash_&unit , phyrd_flash_rd_&unit , phyrd_storidx_saved_&unit , spin_disk_io_&unit , spin_disk_rd_&unit , ((spin_disk_io_&unit - spin_disk_rd_&unit)) AS spin_disk_wr_&unit , scanned_uncomp_&unit , ROUND((scanned_uncomp_&unit/NULLIF(spin_disk_rd_&unit + phyrd_flash_rd_&unit, 0))*db_physrd_&unit) est_full_uncomp_&unit , total_ic_&unit , smart_scan_ret_&unit , non_smart_scan_&unit , cell_proc_cache_&unit , cell_proc_txn_&unit , cell_proc_data_&unit , cell_proc_index_&unit , cell_bal_cpu_&unit , curr_gets_cache_&unit , cons_gets_cache_&unit , curr_gets_direct_&unit , cons_gets_direct_&unit , net_to_client_&unit , net_from_client_&unit , chain_fetch_cont_row , chain_rows_skipped , chain_rows_processed , chain_rows_rejected FROM precalc ), --SELECT -- inst_id -- , SUM(db_physio_&unit) -- , SUM(db_physrd_&unit) -- , SUM(db_physwr_&unit) -- , SUM(pred_offloadable_&unit) -- , SUM(phyrd_optim_&unit) -- , SUM(spin_disk_io_&unit) -- , SUM(spin_disk_rd_&unit) -- , SUM(spin_disk_io_&unit - spin_disk_rd_&unit) AS spin_disk_wr_&unit -- , SUM(scanned_uncomp_&unit) -- , ROUND(SUM((scanned_uncomp_&unit/spin_disk_rd_&unit)*db_physrd_&unit)) AS est_full_uncomp_&unit -- , SUM(total_ic_&unit) -- , SUM(smart_scan_ret_&unit) -- , SUM(non_smart_scan_&unit) --FROM -- precalc2 --GROUP BY ROLLUP -- (inst_id) --/ unpivoted AS ( SELECT * FROM precalc2 UNPIVOT ( &unit FOR metric IN ( phyrd_optim_&unit , phyrd_disk_and_flash_&unit , phyrd_flash_rd_&unit , phyrd_storidx_saved_&unit , spin_disk_rd_&unit , spin_disk_wr_&unit , spin_disk_io_&unit , db_physrd_&unit , db_physwr_&unit , db_physio_&unit , scanned_uncomp_&unit , est_full_uncomp_&unit , non_smart_scan_&unit , smart_scan_ret_&unit , total_ic_&unit , pred_offloadable_&unit , cell_proc_cache_&unit , cell_proc_txn_&unit , cell_proc_data_&unit , cell_proc_index_&unit , cell_bal_cpu_&unit , curr_gets_cache_&unit , cons_gets_cache_&unit , curr_gets_direct_&unit , cons_gets_direct_&unit , net_to_client_&unit , net_from_client_&unit , chain_fetch_cont_row , chain_rows_skipped , chain_rows_processed , chain_rows_rejected ) ) ), metric AS ( SELECT 'BASIC' type, 'DB_LAYER_IO' category, 'DB_PHYSIO_&unit' name FROM dual UNION ALL SELECT 'BASIC', 'DB_LAYER_IO', 'DB_PHYSRD_&unit' FROM dual UNION ALL SELECT 'BASIC', 'DB_LAYER_IO', 'DB_PHYSWR_&unit' FROM dual UNION ALL SELECT 'ADVANCED', 'AVOID_DISK_IO', 'PHYRD_OPTIM_&unit' FROM dual UNION ALL SELECT 'ADVANCED', 'AVOID_DISK_IO', 'PHYRD_DISK_AND_FLASH_&unit' FROM dual UNION ALL SELECT 'BASIC', 'AVOID_DISK_IO', 'PHYRD_FLASH_RD_&unit' FROM dual UNION ALL SELECT 'BASIC', 'AVOID_DISK_IO', 'PHYRD_STORIDX_SAVED_&unit' FROM dual UNION ALL SELECT 'BASIC', 'REAL_DISK_IO', 'SPIN_DISK_IO_&unit' FROM dual UNION ALL SELECT 'BASIC', 'REAL_DISK_IO', 'SPIN_DISK_RD_&unit' FROM dual UNION ALL SELECT 'BASIC', 'REAL_DISK_IO', 'SPIN_DISK_WR_&unit' FROM dual UNION ALL SELECT 'ADVANCED', 'COMPRESS', 'SCANNED_UNCOMP_&unit' FROM dual UNION ALL SELECT 'ADVANCED', 'COMPRESS', 'EST_FULL_UNCOMP_&unit' FROM dual UNION ALL SELECT 'BASIC', 'REDUCE_INTERCONNECT', 'PRED_OFFLOADABLE_&unit' FROM dual UNION ALL SELECT 'BASIC', 'REDUCE_INTERCONNECT', 'TOTAL_IC_&unit' FROM dual UNION ALL SELECT 'BASIC', 'REDUCE_INTERCONNECT', 'SMART_SCAN_RET_&unit' FROM dual UNION ALL SELECT 'BASIC', 'REDUCE_INTERCONNECT', 'NON_SMART_SCAN_&unit' FROM dual UNION ALL SELECT 'ADVANCED', 'CELL_PROC_DEPTH', 'CELL_PROC_CACHE_&unit' FROM DUAL UNION ALL SELECT 'ADVANCED', 'CELL_PROC_DEPTH', 'CELL_PROC_TXN_&unit' FROM DUAL UNION ALL SELECT 'BASIC', 'CELL_PROC_DEPTH', 'CELL_PROC_DATA_&unit' FROM DUAL UNION ALL SELECT 'BASIC', 'CELL_PROC_DEPTH', 'CELL_PROC_INDEX_&unit' FROM DUAL UNION ALL SELECT 'ADVANCED', 'CELL_PROC_DEPTH', 'CELL_BAL_CPU_&unit' FROM DUAL UNION ALL SELECT 'ADVANCED', 'IN_DB_PROCESSING', 'CURR_GETS_CACHE_&unit' FROM DUAL UNION ALL SELECT 'ADVANCED', 'IN_DB_PROCESSING', 'CONS_GETS_CACHE_&unit' FROM DUAL UNION ALL SELECT 'ADVANCED', 'IN_DB_PROCESSING', 'CURR_GETS_DIRECT_&unit' FROM DUAL UNION ALL SELECT 'ADVANCED', 'IN_DB_PROCESSING', 'CONS_GETS_DIRECT_&unit' FROM DUAL UNION ALL SELECT 'BASIC', 'CLIENT_COMMUNICATION', 'NET_TO_CLIENT_&unit' FROM DUAL UNION ALL SELECT 'BASIC', 'CLIENT_COMMUNICATION', 'NET_FROM_CLIENT_&unit' FROM DUAL UNION ALL SELECT 'ADVANCED', 'FALLBACK_TO_BLOCK_IO', 'CHAIN_FETCH_CONT_ROW' FROM DUAL UNION ALL SELECT 'ADVANCED', 'FALLBACK_TO_BLOCK_IO', 'CHAIN_ROWS_SKIPPED' FROM DUAL UNION ALL SELECT 'ADVANCED', 'FALLBACK_TO_BLOCK_IO', 'CHAIN_ROWS_PROCESSED' FROM DUAL UNION ALL SELECT 'ADVANCED', 'FALLBACK_TO_BLOCK_IO', 'CHAIN_ROWS_REJECTED' FROM DUAL ) SELECT -- inst_id -- , sid category -- , type , metric , '|'||RPAD(NVL(RPAD('#', ROUND(&unit / NULLIF( (SELECT MAX(&unit) FROM unpivoted u, metric m WHERE u.metric = m.name AND m.type LIKE UPPER('&1')), 0) * 50 ), '#'), ' '), 50, ' ')||'|' ioeff_percentage , &unit , TO_CHAR(ROUND(&unit / (SELECT snap_seconds FROM stats WHERE rownum = 1),1), '9999999.9') AS " &unit/sec" FROM unpivoted u , metric m WHERE u.metric = m.name AND m.type LIKE UPPER('&1') /
the_stack
-- set up users create user acl_test1; create user "acl test2"; create user """acl=""s,/a//acl_test1"; create user acl_temporary_user; -- ACL format checks select ''::ace; select 'a'::ace; select 'q'::ace; select 'a*'::ace; select 'a/'::ace; select 'a/hq'::ace; select 'a/h'::ace; select 'a/h/'::ace; select 'a/h/='::ace; select 'a/h/acl_test1='::ace; select 'a/h/acl_test1=d,'::ace; select 'a/h/acl_test1=dw'::ace; select 'a/ihpc/acl_test1=wdddw'::ace; select 'd/ihpc/acl_test1=wdddw'::ace; select 'a/ihpc/"acl test2"=dw0'::ace; -- invalid role select 'a//blah=d'::ace; -- deleted role create table acl_test (ace ace); insert into acl_test (ace) values ('a//acl_temporary_user=s'); drop user acl_temporary_user; select ace::text ~ '#' from acl_test; -- invalid acl select (ace::text::ace::text) ~ '#' from acl_test; -- current user set role 'acl_test1'; select coalesce(acl_check_access('{}'::ace[], 'sd0', false), 'NULL'); select acl_check_access('{}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), false)::bit(32); select coalesce(acl_check_access(null::ace[], 'sd0', false), 'NULL'); select acl_check_access(null::ace[], (1 << 0) | (1 << 27) | (1 << 29), false)::bit(32); select acl_check_access('{d//=s,a//acl_test1=sdw}'::ace[], 'sd0', false); select acl_check_access('{d//=s,a//acl_test1=sdw}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), false)::bit(32); select acl_check_access('{a//acl_test1=s0,d//=sdw}'::ace[], 'sd0', false); select acl_check_access('{a//acl_test1=s0,d//=sdw}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), false)::bit(32); reset role; set role """acl=""s,/a//acl_test1"; select acl_check_access('{d/hpc/acl_test1=dw0,a//\"\"\"acl=\"\"s\,/a//acl_test1\"=c}'::ace[], 'c', false); select acl_check_access('{d/hpc/acl_test1=dw0,a//\"\"\"acl=\"\"s\,/a//acl_test1\"=c}'::ace[], (1 << 28), false)::bit(32); reset role; -- name select coalesce(acl_check_access('{}'::ace[], 'sd0', 'acl_test1', false), 'NULL'); select acl_check_access('{}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), 'acl_test1', false)::bit(32); select coalesce(acl_check_access(null::ace[], 'sd0', 'acl_test1', false), 'NULL'); select acl_check_access(null::ace[], (1 << 0) | (1 << 27) | (1 << 29), 'acl_test1', false)::bit(32); select coalesce(acl_check_access('{}'::ace[], 'sd0', null, false), 'NULL'); select acl_check_access('{}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), null, false)::bit(32); select acl_check_access('{d//=s,a//acl_test1=sdw}'::ace[], 'sd0', 'acl_test1', false); select acl_check_access('{d//=s,a//acl_test1=sdw}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), 'acl_test1', false)::bit(32); select acl_check_access('{a//acl_test1=s0,d//=sdw}'::ace[], 'sd0', 'acl_test1', false); select acl_check_access('{a//acl_test1=s0,d//=sdw}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), 'acl_test1', false)::bit(32); select acl_check_access('{d/hpc/acl_test1=dw0,a//\"\"\"acl=\"\"s\,/a//acl_test1\"=c}'::ace[], 'c', '"acl="s,/a//acl_test1', false); select acl_check_access('{d/hpc/acl_test1=dw0,a//\"\"\"acl=\"\"s\,/a//acl_test1\"=c}'::ace[], (1 << 28), '"acl="s,/a//acl_test1', false)::bit(32); -- oid select coalesce(acl_check_access('{}'::ace[], 'sd0', (select oid from pg_roles where rolname = 'acl_test1'), false), 'NULL'); select acl_check_access('{}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), (select oid from pg_roles where rolname = 'acl_test1'), false)::bit(32); select coalesce(acl_check_access(null::ace[], 'sd0', (select oid from pg_roles where rolname = 'acl_test1'), false), 'NULL'); select acl_check_access(null::ace[], (1 << 0) | (1 << 27) | (1 << 29), (select oid from pg_roles where rolname = 'acl_test1'), false)::bit(32); select coalesce(acl_check_access('{}'::ace[], 'sd0', null, false), 'NULL'); select acl_check_access('{}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), null, false)::bit(32); select acl_check_access('{d//=s,a//acl_test1=sdw}'::ace[], 'sd0', (select oid from pg_roles where rolname = 'acl_test1'), false); select acl_check_access('{d//=s,a//acl_test1=sdw}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), (select oid from pg_roles where rolname = 'acl_test1'), false)::bit(32); select acl_check_access('{a//acl_test1=s0,d//=sdw}'::ace[], 'sd0', (select oid from pg_roles where rolname = 'acl_test1'), false); select acl_check_access('{a//acl_test1=s0,d//=sdw}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), (select oid from pg_roles where rolname = 'acl_test1'), false)::bit(32); select acl_check_access('{d/hpc/acl_test1=dw0,a//\"\"\"acl=\"\"s\,/a//acl_test1\"=c}'::ace[], 'c', (select oid from pg_roles where rolname = '"acl="s,/a//acl_test1'), false); select acl_check_access('{d/hpc/acl_test1=dw0,a//\"\"\"acl=\"\"s\,/a//acl_test1\"=c}'::ace[], (1 << 28), (select oid from pg_roles where rolname = '"acl="s,/a//acl_test1'), false)::bit(32); -- inherit only select acl_check_access('{d/i/=s,a//acl_test1=sdw}'::ace[], 'sd0', 'acl_test1', false); select acl_check_access('{d/i/=s,a//acl_test1=sdw}'::ace[], (1 << 0) | (1 << 27) | (1 << 29), 'acl_test1', false)::bit(32); -- merge select acl_merge(null::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); select acl_merge(null::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, true); select acl_merge(null::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); select acl_merge(null::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, true); -- inheritance -- container -- no flags -> not inherited select acl_merge('{a//acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- inherit only -> not inherited select acl_merge('{a/i/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- object inherit -> inherit only + object inherit select acl_merge('{a/o/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- inherit only + object inherit -> inherit only + object inherit select acl_merge('{a/io/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- object inherit + no propagate inherit -> no inheritance select acl_merge('{a/op/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- inherit only + object inherit + no propagate inherit -> no inheritance select acl_merge('{a/iop/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- container inherit -> container inherit select acl_merge('{a/c/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- inherit only + container inherit -> container inherit select acl_merge('{a/ic/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- container inherit + no propagate inherit -> no flags select acl_merge('{a/cp/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- inherit only + container inherit + no propagate inherit -> no flags select acl_merge('{a/icp/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- container inherit + object inherit -> container inherit + object inherit select acl_merge('{a/co/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- inherit only + container inherit + object inherit -> container inherit + object inherit select acl_merge('{a/ico/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- container inherit + object inherit + no propagate inherit -> no flags select acl_merge('{a/cop/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- inherit only + container inherit + object inherit + no propagate inherit -> no flags select acl_merge('{a/icop/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- skip inherited select acl_merge('{a/h/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], true, false); -- object -- no flags -> not inherited select acl_merge('{a//acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- inherit only -> not inherited select acl_merge('{a/i/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- object inherit -> no flags select acl_merge('{a/o/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- inherit only + object inherit -> no flags select acl_merge('{a/io/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- object inherit + no propagate inherit -> no flags select acl_merge('{a/op/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- inherit only + object inherit + no propagate inherit -> no flags select acl_merge('{a/iop/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- container inherit -> not inherited select acl_merge('{a/c/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- inherit only + container inherit -> not inherited select acl_merge('{a/ic/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- container inherit + no propagate inherit -> not inherited select acl_merge('{a/cp/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- inherit only + container inherit + no propagate inherit -> not inherited select acl_merge('{a/icp/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- container inherit + object inherit -> no flags select acl_merge('{a/co/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- inherit only + container inherit + object inherit -> no flags select acl_merge('{a/ico/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- container inherit + object inherit + no propagate inherit -> no flags select acl_merge('{a/cop/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- inherit only + container inherit + object inherit + no propagate inherit -> no flags select acl_merge('{a/icop/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- skip inherited select acl_merge('{a/h/acl_test1=d}'::ace[], '{a//=0,d//=1,a//=23,d//=4}'::ace[], false, false); -- clean up drop user acl_test1; drop user "acl test2"; drop user """acl=""s,/a//acl_test1";
the_stack
-- 2017-07-17T17:16:54.036 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='',Updated=TO_TIMESTAMP('2017-07-17 17:16:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545279 ; -- 2017-07-17T17:33:05.056 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-07-17 17:33:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544686 ; -- 2017-07-17T17:33:05.062 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-17 17:33:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544685 ; -- 2017-07-17T17:38:29.501 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=1.000000000000,Updated=TO_TIMESTAMP('2017-07-17 17:38:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12718 ; -- 2017-07-17T17:39:36.388 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-07-17 17:39:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12716 ; -- 2017-07-17T17:46:40.495 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) SELECT 0,3276,0,223,1000032,546573,TO_TIMESTAMP('2017-07-17 17:46:40','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Rabatte drucken',150,0,0,TO_TIMESTAMP('2017-07-17 17:46:40','YYYY-MM-DD HH24:MI:SS'),100 WHERE NOT EXISTS (select 1 from AD_UI_Element where AD_UI_Element_ID=546573) ; -- 2017-07-17T18:09:00.789 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET AD_UI_Column_ID=540035, SeqNo=20,Updated=TO_TIMESTAMP('2017-07-17 18:09:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540046 ; -- 2017-07-17T18:09:17.648 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-17 18:09:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540047 ; -- 2017-07-17T18:09:58.291 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,5190,0,402,540031,546574,TO_TIMESTAMP('2017-07-17 18:09:58','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Notiz',50,0,0,TO_TIMESTAMP('2017-07-17 18:09:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-07-17T18:10:07.449 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540034,540838,TO_TIMESTAMP('2017-07-17 18:10:07','YYYY-MM-DD HH24:MI:SS'),100,'Y','dates',20,TO_TIMESTAMP('2017-07-17 18:10:07','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-07-17T18:10:37.715 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy,WidgetSize) VALUES (0,11463,0,402,540838,546575,TO_TIMESTAMP('2017-07-17 18:10:37','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Start Datum',10,0,0,TO_TIMESTAMP('2017-07-17 18:10:37','YYYY-MM-DD HH24:MI:SS'),100,'S') ; -- 2017-07-17T18:10:47.876 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,11451,0,402,540838,546576,TO_TIMESTAMP('2017-07-17 18:10:47','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','End Datum',20,0,0,TO_TIMESTAMP('2017-07-17 18:10:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-07-17T18:10:52.139 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2017-07-17 18:10:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546576 ; -- 2017-07-17T18:11:12.114 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=540926 ; -- 2017-07-17T18:11:14.923 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=540927 ; -- 2017-07-17T18:11:30.016 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Anfangsdatum',Updated=TO_TIMESTAMP('2017-07-17 18:11:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546575 ; -- 2017-07-17T18:11:34.969 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Enddatum',Updated=TO_TIMESTAMP('2017-07-17 18:11:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546576 ; -- 2017-07-17T18:12:11.545 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-17 18:12:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540910 ; -- 2017-07-17T18:12:11.551 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-07-17 18:12:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540912 ; -- 2017-07-17T18:12:11.556 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-07-17 18:12:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540911 ; -- 2017-07-17T18:12:11.560 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-07-17 18:12:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546575 ; -- 2017-07-17T18:12:11.566 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-07-17 18:12:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546576 ; -- 2017-07-17T18:13:25.741 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Enddatum',Updated=TO_TIMESTAMP('2017-07-17 18:13:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11451 ; -- 2017-07-17T18:13:56.029 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Anfangsdatum',Updated=TO_TIMESTAMP('2017-07-17 18:13:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11463 ; -- 2017-07-17T18:14:44.393 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET Description='', Name='Startdatum', PrintName='Startdatum',Updated=TO_TIMESTAMP('2017-07-17 18:14:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2713 ; -- 2017-07-17T18:14:44.400 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='StartTime', Name='Startdatum', Description='', Help=NULL WHERE AD_Element_ID=2713 ; -- 2017-07-17T18:14:44.411 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='StartTime', Name='Startdatum', Description='', Help=NULL, AD_Element_ID=2713 WHERE UPPER(ColumnName)='STARTTIME' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2017-07-17T18:14:44.413 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='StartTime', Name='Startdatum', Description='', Help=NULL WHERE AD_Element_ID=2713 AND IsCentrallyMaintained='Y' ; -- 2017-07-17T18:14:44.414 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Startdatum', Description='', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=2713) AND IsCentrallyMaintained='Y' ; -- 2017-07-17T18:14:44.428 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Startdatum', Name='Startdatum' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=2713) ; -- 2017-07-17T18:15:35.804 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET Name='Enddatum', PrintName='Enddatum',Updated=TO_TIMESTAMP('2017-07-17 18:15:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2714 ; -- 2017-07-17T18:15:35.814 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='EndTime', Name='Enddatum', Description='End of the time span', Help=NULL WHERE AD_Element_ID=2714 ; -- 2017-07-17T18:15:35.844 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='EndTime', Name='Enddatum', Description='End of the time span', Help=NULL, AD_Element_ID=2714 WHERE UPPER(ColumnName)='ENDTIME' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2017-07-17T18:15:35.846 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='EndTime', Name='Enddatum', Description='End of the time span', Help=NULL WHERE AD_Element_ID=2714 AND IsCentrallyMaintained='Y' ; -- 2017-07-17T18:15:35.847 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Enddatum', Description='End of the time span', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=2714) AND IsCentrallyMaintained='Y' ; -- 2017-07-17T18:15:35.862 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Enddatum', Name='Enddatum' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=2714) ; -- 2017-07-17T18:18:15.765 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=545385 ; -- 2017-07-17T18:20:19.682 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557542,0,402,540040,546577,TO_TIMESTAMP('2017-07-17 18:20:19','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Zulieferant',17,0,0,TO_TIMESTAMP('2017-07-17 18:20:19','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-07-17T18:20:37.096 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557235,0,402,540040,546578,TO_TIMESTAMP('2017-07-17 18:20:37','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Rücklieferung',27,0,0,TO_TIMESTAMP('2017-07-17 18:20:37','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-07-17T18:20:40.557 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-17 18:20:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545379 ; -- 2017-07-17T18:20:47.608 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-17 18:20:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545380 ; -- 2017-07-17T18:20:50.033 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-17 18:20:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546577 ; -- 2017-07-17T18:20:52.833 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-17 18:20:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546578 ; -- 2017-07-17T18:21:39.963 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-17 18:21:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546577 ; -- 2017-07-17T18:21:44.235 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-17 18:21:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546578 ; -- 2017-07-17T18:22:38.008 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557250,0,402,540031,546579,TO_TIMESTAMP('2017-07-17 18:22:37','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Performance Typ',60,0,0,TO_TIMESTAMP('2017-07-17 18:22:37','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-07-17T18:22:48.482 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557245,0,402,540031,546580,TO_TIMESTAMP('2017-07-17 18:22:48','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Beanstandung',70,0,0,TO_TIMESTAMP('2017-07-17 18:22:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-07-17T18:25:04.666 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=4,Updated=TO_TIMESTAMP('2017-07-17 18:25:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540910 ; -- 2017-07-17T18:25:25.631 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-17 18:25:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545387 ; -- 2017-07-17T18:25:28.707 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-17 18:25:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540910 ; -- 2017-07-17T18:25:37.128 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-17 18:25:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545386 ; -- 2017-07-17T18:25:48.548 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-17 18:25:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545388 ; -- 2017-07-17T18:25:52.441 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=32,Updated=TO_TIMESTAMP('2017-07-17 18:25:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540911 ; -- 2017-07-17T18:26:19.574 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-17 18:26:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540912 ; -- 2017-07-17T18:26:22.270 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-17 18:26:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545386 ; -- 2017-07-17T18:26:24.838 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-17 18:26:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540911 ; -- 2017-07-17T18:26:27.920 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-17 18:26:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545388 ;
the_stack
DROP TABLE IF EXISTS non_drugs; DROP TABLE IF EXISTS france_1; DROP TABLE IF EXISTS pre_ingr; DROP TABLE IF EXISTS ingr; DROP TABLE IF EXISTS brand; DROP TABLE IF EXISTS forms; DROP TABLE IF EXISTS unit; DROP TABLE IF EXISTS drug_products; DROP TABLE IF EXISTS list_temp; DROP TABLE IF EXISTS ds_for_prolonged; DROP TABLE IF EXISTS ds_complex; DROP SEQUENCE IF EXISTS conc_stage_seq; DROP SEQUENCE IF EXISTS new_vocab; TRUNCATE TABLE drug_concept_stage; TRUNCATE TABLE internal_relationship_stage; TRUNCATE TABLE ds_stage; TRUNCATE TABLE relationship_to_concept; TRUNCATE TABLE pc_stage; --delete duplicates DELETE FROM france f WHERE EXISTS ( SELECT 1 FROM france f_int WHERE f_int.pfc = f.pfc AND f_int.ctid > f.ctid ); DROP TABLE IF EXISTS non_drugs; CREATE TABLE non_drugs AS SELECT product_desc, form_desc, dosage, dosage_add, volume, packsize, claatc, pfc, molecule, cd_nfc_3, english, lb_nfc_3, descr_pck, strg_unit, strg_meas, NULL::VARCHAR(250) AS concept_type FROM france WHERE molecule ~* 'BANDAGES|DEVICES|CARE PRODUCTS|DRESSING|CATHETERS|EYE OCCLUSION PATCH|INCONTINENCE COLLECTION APPLIANCES|SOAP|CREAM|HAIR|SHAMPOO|LOTION|FACIAL CLEANSER|LIP PROTECTANTS|CLEANSING AGENTS|SKIN|TONICS|TOOTHPASTES|MOUTH|SCALP LOTIONS|UREA 13|BARIUM|CRYSTAL VIOLET' OR molecule ~* 'LENS SOLUTIONS|INFANT |DISINFECTANT|ANTISEPTIC|CONDOMS|COTTON WOOL|GENERAL NUTRIENTS|LUBRICANTS|INSECT REPELLENTS|FOOD|SLIMMING PREPARATIONS|SPECIAL DIET|SWAB|WOUND|GADOBUTROL|GADODIAMIDE|GADOBENIC ACID|GADOTERIC ACID|GLUCOSE 1-PHOSPHATE|BRAN|PADS$|IUD' OR molecule ~* 'AFTER SUN PROTECTANTS|BABY MILKS|INCONTINENCE PADS|INSECT REPELLENTS|WIRE|CORN REMOVER|DDT|DECONGESTANT RUBS|EYE MAKE-UP REMOVERS|FIXATIVES|FOOT POWDERS|FIORAVANTI BALSAM|LOW CALORIE FOOD|NUTRITION|TETRAMETHRIN|OTHERS|NON MEDICATED|NON PHARMACEUTICAL|TRYPAN BLUE' OR ( molecule LIKE '% TEST%' AND molecule NOT LIKE 'TUBERCULIN%' ) OR descr_pck LIKE '%KCAL%' OR english = 'Non Human Usage Products' OR lb_nfc_3 LIKE '%NON US.HUMAIN%'; --list of ingredients DROP TABLE IF EXISTS pre_ingr; CREATE TABLE pre_ingr AS SELECT DISTINCT ingred AS concept_name, pfc, 'Ingredient'::VARCHAR AS concept_class_id FROM ( SELECT UNNEST(regexp_matches(molecule, '[^\+]+', 'g')) AS ingred, pfc FROM france WHERE pfc NOT IN ( SELECT pfc FROM non_drugs ) ) AS s0 WHERE ingred != 'NULL'; -- extract ingredients where it is obvious for molecule like 'NULL' DROP TABLE IF EXISTS france_1; CREATE TABLE france_1 AS SELECT * FROM france WHERE molecule <> 'NULL' UNION SELECT product_desc, form_desc, dosage, dosage_add, volume, packsize, claatc, a.pfc, CASE WHEN concept_name IS NOT NULL THEN concept_name ELSE 'NULL' END, cd_nfc_3, english, lb_nfc_3, descr_pck, strg_unit, strg_meas FROM france a LEFT JOIN pre_ingr b ON trim(replace(product_desc, 'DCI', '')) = upper(concept_name) WHERE molecule = 'NULL'; --list of ingredients DROP TABLE IF EXISTS ingr; CREATE TABLE ingr AS SELECT DISTINCT ingred AS concept_name, pfc, 'Ingredient'::VARCHAR AS concept_class_id FROM ( SELECT UNNEST(regexp_matches(molecule, '[^\+]+', 'g')) AS ingred, pfc FROM france_1 WHERE pfc NOT IN ( SELECT pfc FROM non_drugs ) ) AS s0 WHERE ingred != 'NULL'; --list of Brand Names DROP TABLE IF EXISTS brand; CREATE TABLE brand AS SELECT product_desc AS concept_name, pfc, 'Brand Name'::VARCHAR AS concept_class_id FROM france_1 WHERE pfc NOT IN ( SELECT pfc FROM non_drugs ) AND pfc NOT IN ( SELECT pfc FROM france_1 WHERE molecule = 'NULL' ) AND product_desc NOT LIKE '%DCI%' AND NOT product_desc ~ 'L\.IND|LAB IND|^VAC |VACCIN' AND upper(product_desc) NOT IN ( SELECT upper(concept_name) FROM devv5.concept WHERE concept_class_id LIKE 'Ingredient' AND standard_concept = 'S' ); UPDATE brand SET concept_name = 'UMULINE PROFIL' WHERE concept_name LIKE 'UMULINE PROFIL%'; UPDATE brand SET concept_name = 'CALCIPRAT' WHERE concept_name = 'CALCIPRAT D3'; UPDATE brand SET concept_name = 'DOMPERIDONE ZENTIVA' WHERE concept_name LIKE 'DOMPERIDONE ZENT%'; --list of Dose Forms DROP TABLE IF EXISTS forms; CREATE TABLE forms AS SELECT DISTINCT trim(dose_form_name) AS concept_name, 'Dose Form'::VARCHAR AS concept_class_id FROM france_names_translation a JOIN france_1 b ON a.dose_form = b.LB_NFC_3 WHERE b.molecule != 'NULL' AND pfc NOT IN ( SELECT pfc FROM non_drugs ) AND trim(dose_form_name) NOT IN ( 'Dose Form for Promotional Purposes', 'Miscellaneous External Form', 'Unknown Form' ); -- units, take units used for volume and strength definition DROP TABLE IF EXISTS unit; CREATE TABLE unit AS SELECT strg_meas AS concept_name, 'Unit'::VARCHAR AS concept_class_id, strg_meas AS concept_code FROM ( SELECT strg_meas FROM france_1 WHERE pfc NOT IN ( SELECT pfc FROM non_drugs ) UNION SELECT regexp_replace(volume, '[[:digit:]\.]', '','g') FROM france_1 WHERE strg_meas != 'NULL' AND pfc NOT IN ( SELECT pfc FROM non_drugs ) ) a WHERE a.strg_meas NOT IN ( 'CH', 'NULL' ); INSERT INTO unit VALUES ('UI', 'Unit', 'UI'); INSERT INTO unit VALUES ('MUI', 'Unit', 'MUI'); INSERT INTO unit VALUES ('DOS', 'Unit', 'DOS'); INSERT INTO unit VALUES ('GM', 'Unit', 'GM'); INSERT INTO unit VALUES ('H', 'Unit', 'H'); --no inf. about suppliers DROP TABLE IF EXISTS drug_products; CREATE TABLE drug_products AS SELECT DISTINCT CASE WHEN d.pfc IS NOT NULL THEN trim(regexp_replace(replace(CONCAT ( volume, ' ', substr((replace(molecule, '+', ' / ')), 1, 175) --To avoid names length more than 255 , ' ', c.dose_form_name, ' [' || product_desc || ']', ' Box of ', a.packsize ), 'NULL', ''), '\s+', ' ', 'g')) ELSE trim(regexp_replace(replace(CONCAT ( volume, ' ', substr((replace(molecule, '+', ' / ')), 1, 175) --To avoid names length more than 255 , ' ', c.dose_form_name, ' Box of ', a.packsize ), 'NULL', ''), '\s+', ' ', 'g')) END AS concept_name, 'Drug Product'::VARCHAR AS concept_class_id, a.pfc AS concept_code FROM france_1 a LEFT JOIN brand d ON d.concept_name = a.product_desc LEFT JOIN france_names_translation c ON a.lb_nfc_3 = c.dose_form -- france_names_translation is manually created table containing Form translation to English WHERE a.pfc NOT IN ( SELECT pfc FROM non_drugs ) AND molecule <> 'NULL'; --SEQUENCE FOR OMOP-GENERATED CODES DROP SEQUENCE IF EXISTS conc_stage_seq; CREATE SEQUENCE conc_stage_seq MINVALUE 100 MAXVALUE 1000000 START WITH 100 INCREMENT BY 1 CACHE 20; DROP TABLE IF EXISTS list_temp; CREATE TABLE list_temp AS SELECT concept_name, concept_class_id, 'OMOP' || nextval('conc_stage_seq') AS concept_code FROM ( SELECT concept_name, concept_class_id FROM ingr UNION SELECT concept_name, concept_class_id FROM Brand WHERE concept_name NOT IN ( SELECT concept_name FROM ingr ) UNION SELECT concept_name, concept_class_id FROM forms ) AS s0; --fill drug_concept_stage INSERT INTO drug_concept_stage ( concept_name, vocabulary_id, domain_id, concept_class_id, standard_concept, concept_code, possible_excipient, valid_start_date, valid_end_date, invalid_reason ) SELECT concept_name, 'DA_France', 'Drug', concept_class_id, 'S', concept_code, NULL, CURRENT_DATE AS valid_start_date, --check start date TO_DATE('20991231', 'yyyymmdd') AS valid_end_date, NULL FROM ( SELECT * FROM list_temp UNION SELECT * FROM drug_products UNION SELECT * FROM unit ) AS s0; --DEVICES (rebuild names) INSERT INTO drug_concept_stage ( concept_name, vocabulary_id, domain_id, concept_class_id, standard_concept, concept_code, possible_excipient, valid_start_date, valid_end_date, invalid_reason ) SELECT DISTINCT substr(CONCAT ( volume, ' ', CASE molecule WHEN 'NULL' THEN NULL ELSE CONCAT ( molecule, ' ' ) END, CASE dosage WHEN 'NULL' THEN NULL ELSE CONCAT ( dosage, ' ' ) END, CASE dosage_add WHEN 'NULL' THEN NULL ELSE CONCAT ( dosage_add, ' ' ) END, CASE form_desc WHEN 'NULL' THEN NULL ELSE form_desc END, CASE product_desc WHEN 'NULL' THEN NULL ELSE CONCAT ( ' [', product_desc, ']' ) END, ' Box of ', packsize ), 1, 255) AS concept_name, 'DA_France', 'Device', 'Device', 'S', pfc, NULL, CURRENT_DATE AS valid_start_date, --check start date TO_DATE('20991231', 'yyyymmdd') AS valid_end_date, NULL FROM non_drugs; --fill IRS --Drug to Ingredients INSERT INTO internal_relationship_stage SELECT DISTINCT pfc, concept_code FROM list_temp a JOIN ingr USING ( concept_name, concept_class_id ); --drug to Brand Name INSERT INTO internal_relationship_stage SELECT DISTINCT pfc, concept_code FROM list_temp a JOIN brand using ( concept_name, concept_class_id ); --drug to Dose Form INSERT INTO internal_relationship_stage SELECT DISTINCT pfc, concept_code FROM france_1 a JOIN france_names_translation b ON a.lb_nfc_3 = b.dose_form JOIN drug_concept_stage c ON b.dose_form_name = c.concept_name AND concept_class_id = 'Dose Form' WHERE pfc IN ( SELECT concept_code FROM drug_concept_stage WHERE concept_class_id = 'Drug Product' ); --fill ds_stage --manually found dosages INSERT INTO ds_stage SELECT DISTINCT pfc, concept_code, packsize, amount_value, amount_unit, numerator_value, numerator_unit, denominator_value, denominator_unit FROM ds_stage_manual f JOIN drug_concept_stage dcs ON upper(molecule) = upper(concept_name) AND dcs.concept_class_id = 'Ingredient'; --insulins INSERT INTO ds_stage ( drug_concept_code, ingredient_concept_code, numerator_value, numerator_unit, denominator_value, denominator_unit, box_size ) SELECT pfc, concept_code_2, strg_unit::FLOAT * substring(volume, '([[:digit:]]+(\.[[:digit:]]+)?)')::FLOAT AS numerator_value, strg_meas AS numerator_unit, substring(volume, '([[:digit:]]+(\.[[:digit:]]+)?)')::FLOAT AS denominator_value, regexp_replace(volume, '([[:digit:]]+(\.[[:digit:]]+)?)', '', 'g') AS denominator_unit, packsize::INT FROM france_1 f JOIN internal_relationship_stage irs ON f.pfc = irs.concept_code_1 JOIN drug_concept_stage dcs ON concept_code_2 = dcs.concept_code AND dcs.concept_class_id = 'Ingredient' WHERE volume != 'NULL' AND strg_meas NOT IN ( '%', 'NULL' ) AND molecule NOT LIKE '%+%' AND molecule LIKE '%INSULIN%' AND pfc NOT IN ( SELECT drug_concept_code FROM ds_stage ); -- for delayed (mh/H) drugs DROP TABLE IF EXISTS ds_for_prolonged; CREATE TABLE ds_for_prolonged AS SELECT pfc, concept_code, descr_pck, substring(descr_pck, '(\d+(\.\d+)*)\w*/\d+H') AS numerator_value, 'MG'::VARCHAR AS numerator_unit, substring(descr_pck, '\d+(?:\.\d+)*\w*/(\d+)H') AS denominator_value, 'H'::VARCHAR AS denominator_unit, packsize FROM france_1 f JOIN internal_relationship_stage irs ON f.pfc = irs.concept_code_1 JOIN drug_concept_stage dcs ON concept_code_2 = dcs.concept_code AND dcs.concept_class_id = 'Ingredient' WHERE descr_pck ~ '/\d+\s?H' AND molecule NOT LIKE '%+%' AND pfc NOT IN ( SELECT drug_concept_code FROM ds_stage ); UPDATE ds_for_prolonged SET numerator_value = 0.025 WHERE pfc IN ( '1512103', '2227001', '3420009', '1230210', '3235240', '1128703', '2414501', '2323107', '9737636', '9737629', '9737634', '9737615' ); UPDATE ds_for_prolonged SET numerator_value = 0.037 WHERE pfc IN ( '1128708', '3420001', '1230202', '2427205', '9737621' ); UPDATE ds_for_prolonged SET numerator_value = 0.04 WHERE pfc = '2784501'; UPDATE ds_for_prolonged SET numerator_value = 0.05 WHERE pfc IN ( '3235245', '1128705', '2590301', '2414503', '1512101', '1856301', '3420003', '1230203', '2427201', '1856601', '2323108', '2323108', '2227003', '9737641', '9737606', '9737630', '9737610', '9737609', '9737639', '9737607', '9737605', '9737608' ); UPDATE ds_for_prolonged SET numerator_value = 0.06 WHERE pfc = '2784503'; UPDATE ds_for_prolonged SET numerator_value = 0.075 WHERE pfc IN ( '1128710', '2427207', '2323109', '1230204', '3420005', '2414505', '1856603' ); UPDATE ds_for_prolonged SET numerator_value = 0.075 WHERE pfc IN ( '9737642', '2784505', '9737638', '9737633', '9737616', '9737631' ); UPDATE ds_for_prolonged SET numerator_value = 0.1 WHERE pfc IN ( '1128706', '2427203', '3235250' ); INSERT INTO ds_stage ( drug_concept_code, ingredient_concept_code, numerator_value, numerator_unit, denominator_value, denominator_unit, box_size ) SELECT pfc, concept_code, numerator_value::FLOAT, numerator_unit, denominator_value::FLOAT, denominator_unit, packsize::INT FROM ds_for_prolonged; --doesn't have a volume and drug has only one ingredient INSERT INTO ds_stage ( drug_concept_code, ingredient_concept_code, amount_value, amount_unit, box_size ) SELECT pfc, concept_code_2, strg_unit::FLOAT, strg_meas, packsize::INT FROM france_1 f JOIN internal_relationship_stage irs ON f.pfc = irs.concept_code_1 JOIN drug_concept_stage dcs ON concept_code_2 = dcs.concept_code AND dcs.concept_class_id = 'Ingredient' WHERE volume = 'NULL' AND strg_unit != 'NULL' AND molecule NOT LIKE '%+%' AND strg_meas != '%' AND molecule <> 'NULL' AND pfc NOT IN ( SELECT drug_concept_code FROM ds_stage ); --one ingredient and volume present (descr_pck not like '%/%') INSERT INTO ds_stage ( drug_concept_code, ingredient_concept_code, numerator_value, numerator_unit, denominator_value, denominator_unit, box_size ) SELECT pfc, concept_code_2, strg_unit::FLOAT, strg_meas, substring(volume, '([[:digit:]]+(\.[[:digit:]]+)?)')::FLOAT AS denominator_value, regexp_replace(volume, '[[:digit:]]+(\.[[:digit:]]+)?', '', 'g') AS denominator_unit, packsize::INT FROM france_1 f JOIN internal_relationship_stage irs ON f.pfc = irs.concept_code_1 JOIN drug_concept_stage dcs ON concept_code_2 = dcs.concept_code AND dcs.concept_class_id = 'Ingredient' WHERE volume != 'NULL' AND strg_meas NOT IN ( '%', 'NULL' ) AND molecule NOT LIKE '%+%' AND descr_pck NOT LIKE '%/%' AND molecule <> 'NULL' AND pfc NOT IN ( SELECT drug_concept_code FROM ds_stage ); --one ingredient and volume present (descr_pck like '%/%') volume not like '%G' INSERT INTO ds_stage ( drug_concept_code, ingredient_concept_code, numerator_value, numerator_unit, denominator_value, denominator_unit, box_size ) WITH a AS ( SELECT packsize::INT, pfc, substring(volume, '([[:digit:]]+(\.[[:digit:]]+)?)')::FLOAT AS denominator_value, regexp_replace(volume, '[[:digit:]]+(\.[[:digit:]]+)?', '', 'g') AS denominator_unit, strg_unit::FLOAT, strg_meas, nullif(substring(DESCR_PCK, '/(\d*)'), '')::FLOAT AS num_coef FROM france_1 WHERE volume != 'NULL' AND volume NOT LIKE '%G' AND strg_meas NOT IN ( '%', 'NULL' ) AND molecule NOT LIKE '%+%' AND descr_pck LIKE '%/%' AND molecule <> 'NULL' AND pfc NOT IN ( SELECT drug_concept_code FROM ds_stage ) ) SELECT DISTINCT pfc, concept_code_2, coalesce(((strg_unit * denominator_value) / num_coef), (strg_unit * denominator_value)) AS numerator_value, strg_meas AS numerator_unit, denominator_value, denominator_unit, packsize FROM a JOIN internal_relationship_stage irs ON a.pfc = irs.concept_code_1 JOIN drug_concept_stage dcs ON concept_code_2 = dcs.concept_code AND dcs.concept_class_id = 'Ingredient'; --one ingredient and volume present (descr_pck like '%/%') volume not like '%G' review manually!!!! --(select * from france where volume !='NULL' and volume like '%G' and strg_meas not in ( '%','NULL') AND MOLECULE NOT LIKE '%+%' and descr_pck like '%/%') --one ingredient dosage like %, descr_pck not like '%DOS%' INSERT INTO ds_stage ( drug_concept_code, ingredient_concept_code, numerator_value, numerator_unit, denominator_value, denominator_unit, box_size ) SELECT DISTINCT pfc, concept_code_2, CASE WHEN regexp_replace(volume, '\d*(\.)?(\d)*', '', 'g') IN ( 'L', 'ML' ) THEN strg_unit::FLOAT * (substring(volume, '(\d*(\.)?(\d)*)'))::FLOAT * 10 WHEN regexp_replace(volume, '\d*(\.)?(\d)*', '', 'g') IN ( 'KG', 'G' ) THEN strg_unit::FLOAT * (substring(volume, '(\d*(\.)?(\d)*)'))::FLOAT / 100 ELSE NULL END AS numerator_value, CASE WHEN regexp_replace(volume, '\d*(\.)?(\d)*', '', 'g') = 'ML' THEN 'MG' WHEN regexp_replace(volume, '\d*(\.)?(\d)*', '', 'g') = 'L' THEN 'G' ELSE regexp_replace(volume, '\d*(\.)?(\d)*', '', 'g') END AS numerator_unit, substring(volume, '(\d*(\.)?(\d)*)')::FLOAT AS denominator_value, regexp_replace(volume, '\d*(\.)?(\d)*', '', 'g') AS denominator_unit, packsize::INT FROM france_1 f JOIN internal_relationship_stage irs ON f.pfc = irs.concept_code_1 JOIN drug_concept_stage dcs ON concept_code_2 = dcs.concept_code AND dcs.concept_class_id = 'Ingredient' WHERE volume != 'NULL' AND strg_meas = '%' AND molecule NOT LIKE '%+%' AND lower(descr_pck) NOT LIKE '/%dos%' AND molecule <> 'NULL'; --volume = 'NULL' AND strg_unit !='NULL' AND MOLECULE NOT LIKE '%+%' AND strg_meas = '%' INSERT INTO ds_stage ( drug_concept_code, ingredient_concept_code, numerator_value, numerator_unit, denominator_unit, box_size ) SELECT pfc, concept_code_2, strg_unit::FLOAT * 10 AS numerator_value, 'MG' AS numerator_unit, 'ML' AS denominator_unit, packsize::INT FROM france_1 f JOIN internal_relationship_stage irs ON f.pfc = irs.concept_code_1 JOIN drug_concept_stage dcs ON concept_code_2 = dcs.concept_code AND dcs.concept_class_id = 'Ingredient' WHERE volume = 'NULL' AND strg_unit != 'NULL' AND molecule NOT LIKE '%+%' AND strg_meas = '%' AND molecule <> 'NULL' AND pfc NOT IN ( SELECT drug_concept_code FROM ds_stage ); --volume !='NULL' and strg_unit='NULL' and MOLECULE NOT LIKE '%+%' INSERT INTO ds_stage ( drug_concept_code, ingredient_concept_code, amount_value, amount_unit, box_size ) SELECT pfc, concept_code_2, substring(volume, '(\d*(\.)?(\d)*)')::FLOAT AS amount_value, regexp_replace(volume, '\d*(\.)?(\d)*', '', 'g') AS amount_unit, packsize::INT FROM france_1 f JOIN internal_relationship_stage irs ON f.pfc = irs.concept_code_1 JOIN drug_concept_stage dcs ON concept_code_2 = dcs.concept_code AND dcs.concept_class_id = 'Ingredient' WHERE volume != 'NULL' AND strg_unit = 'NULL' AND molecule NOT LIKE '%+%' AND molecule <> 'NULL' AND pfc NOT IN ( SELECT drug_concept_code FROM ds_stage ) AND regexp_replace(volume, '\d*(\.)?(\d)*', '', 'g') NOT IN ( 'L', 'ML' ); -- need to extract dosages from descr_pck where MOLECULE NOT LIKE '%+%' and volume ='NULL' and strg_unit='NULL' --complex ingredients (excluding 'INSULIN') DROP TABLE IF EXISTS ds_complex; CREATE TABLE ds_complex AS SELECT DISTINCT product_desc, form_desc, dosage, dosage_add, volume, packsize::int4, claatc, pfc, molecule, cd_nfc_3, english, lb_nfc_3, descr_pck, strg_unit, strg_meas, ingred, concentr, CASE WHEN substring(concentr, '\d+\.\d+') IS NOT NULL THEN substring(concentr, '\d+\.\d+') WHEN substring(concentr, '\d+\.\d+') IS NULL THEN substring(concentr, '\d+') END::FLOAT AS strength, substring(concentr, '\d+(?:\.\d+)*([A-Z]+)') AS UNIT FROM ( SELECT product_desc, form_desc, dosage, dosage_add, volume, packsize, claatc, pfc, molecule, cd_nfc_3, english, lb_nfc_3, descr_pck, strg_unit, strg_meas, trim(UNNEST(regexp_matches(molecule, '[^\+]+', 'g'))) AS ingred, trim(UNNEST(regexp_matches(regexp_replace(descr_pck, '^\D*/', '', 'g'), '[^/]+', 'g'))) AS concentr FROM france_1 WHERE molecule LIKE '%+%' AND descr_pck ~ '.*\d+.*/.*\d+.*' AND pfc NOT IN ( SELECT pfc FROM non_drugs ) AND molecule NOT LIKE '%INSULIN%' AND molecule <> 'NULL' ) AS s0; --incorrect dosages for CLAVULANIC ACID+AMOXICILLIN UPDATE ds_complex SET strength = substring(descr_pck, '(\d+(\.\d+)*)\w*/\d+(\.\d+)*')::FLOAT, unit = 'MG' WHERE molecule = 'CLAVULANIC ACID+AMOXICILLIN' AND descr_pck NOT LIKE '%ML' AND ingred = 'AMOXICILLIN'; UPDATE ds_complex SET strength = substring(descr_pck, '\d+(?:\.\d+)*\w*/(\d+(\.\d+)*)')::FLOAT, unit = 'MG' WHERE molecule = 'CLAVULANIC ACID+AMOXICILLIN' AND descr_pck NOT LIKE '%ML' AND ingred = 'CLAVULANIC ACID'; UPDATE ds_complex SET strength = substring(descr_pck, '(\d+(\.\d+)*)\w*/\d+(\.\d+)*')::FLOAT * substring(volume, '(\d+(\.\d+)*)')::FLOAT, unit = 'MG' WHERE molecule = 'CLAVULANIC ACID+AMOXICILLIN' AND descr_pck LIKE '%ML' AND ingred = 'AMOXICILLIN'; UPDATE ds_complex SET strength = substring(descr_pck, '\d+(?:\.\d+)*\w*/(\d+(\.\d+)*)')::FLOAT * substring(volume, '(\d+(\.\d+)*)')::FLOAT, unit = 'MG' WHERE molecule = 'CLAVULANIC ACID+AMOXICILLIN' AND descr_pck LIKE '%ML' AND ingred = 'CLAVULANIC ACID'; UPDATE ds_complex SET volume = '24H', unit = 'MCG' WHERE pfc IN ( '2521201', '3750501' ); UPDATE ds_complex SET volume = '30DOS', unit = 'Y' WHERE pfc = '5351301'; UPDATE DS_COMPLEX SET STRENGTH = '10', UNIT = 'MG' WHERE PFC = '1390401' AND INGRED = 'LIDOCAINE'; UPDATE DS_COMPLEX SET STRENGTH = '20', UNIT = 'MG' WHERE PFC = '1390404' AND INGRED = 'LIDOCAINE'; UPDATE DS_COMPLEX SET STRENGTH = '10', UNIT = 'MG' WHERE PFC = '9667649' AND INGRED = 'LIDOCAINE'; UPDATE DS_COMPLEX SET UNIT = 'MG' WHERE PFC = '9667671' AND INGRED = 'LIDOCAINE'; INSERT INTO ds_stage ( drug_concept_code, ingredient_concept_code, numerator_value, numerator_unit, denominator_value, denominator_unit, box_size ) SELECT DISTINCT pfc, concept_code, strength AS numerator_value, unit AS numerator_unit, substring(volume, '([[:digit:]]+(\.[[:digit:]]+)?)')::FLOAT AS denominator_value, regexp_replace(volume, '([[:digit:]]+(\.[[:digit:]]+)?)', '', 'g') AS denominator_unit, packsize FROM ds_complex f JOIN drug_concept_stage dcs ON ingred = dcs.concept_name AND dcs.concept_class_id = 'Ingredient' WHERE volume != 'NULL' AND molecule <> 'NULL'; INSERT INTO ds_stage ( drug_concept_code, ingredient_concept_code, amount_value, amount_unit, box_size ) SELECT DISTINCT pfc, concept_code, strength AS numerator_value, unit AS numerator_unit, packsize FROM ds_complex f JOIN drug_concept_stage dcs ON ingred = dcs.concept_name AND dcs.concept_class_id = 'Ingredient' WHERE volume = 'NULL' AND molecule <> 'NULL'; UPDATE ds_stage SET amount_unit = NULL WHERE amount_unit = 'NULL'; UPDATE ds_stage SET numerator_unit = NULL WHERE numerator_unit = 'NULL'; UPDATE ds_stage SET denominator_unit = NULL WHERE denominator_unit = 'NULL'; --need to review UPDATE ds_stage SET amount_unit = 'MG' WHERE ( drug_concept_code, ingredient_concept_code ) IN ( SELECT a.drug_concept_code, a.ingredient_concept_code FROM ds_stage a JOIN ds_stage b ON a.drug_concept_code = b.drug_concept_code AND a.ingredient_concept_code != b.ingredient_concept_code AND a.amount_value IS NOT NULL AND a.amount_unit IS NULL AND b.amount_unit = 'MG' ); UPDATE ds_stage SET amount_unit = 'IU' WHERE ( drug_concept_code, ingredient_concept_code ) IN ( SELECT a.drug_concept_code, a.ingredient_concept_code FROM ds_stage a JOIN ds_stage b ON a.drug_concept_code = b.drug_concept_code AND a.ingredient_concept_code != b.ingredient_concept_code AND a.amount_value IS NOT NULL AND a.amount_unit IS NULL AND b.amount_unit = 'IU' ); UPDATE ds_stage SET amount_unit = 'Y' WHERE ( drug_concept_code, ingredient_concept_code ) IN ( SELECT a.drug_concept_code, a.ingredient_concept_code FROM ds_stage a JOIN ds_stage b ON a.drug_concept_code = b.drug_concept_code AND a.ingredient_concept_code != b.ingredient_concept_code AND a.amount_value IS NOT NULL AND a.amount_unit IS NULL AND b.amount_unit = 'Y' ); UPDATE ds_stage SET amount_unit = 'MG' WHERE ( drug_concept_code, ingredient_concept_code ) IN ( SELECT drug_concept_code, ingredient_concept_code FROM ds_stage A JOIN france_1 B ON drug_concept_code = pfc AND english LIKE 'Oral Solid%' AND amount_unit IS NULL AND amount_value IS NOT NULL ); UPDATE ds_stage SET numerator_value = 3000, denominator_value = 60, amount_value = NULL, amount_unit = NULL, numerator_unit = 'MCG', denominator_unit = 'DOS' WHERE drug_concept_code IN ( '2393701', '2393702', '2393703', '2971805', '2971806' ) AND ingredient_concept_code IN ( SELECT concept_code FROM drug_concept_stage WHERE concept_class_id = 'Ingredient' AND concept_name = 'SALMETEROL' ); UPDATE ds_stage SET numerator_value = 1400, denominator_value = 28, amount_value = NULL, amount_unit = NULL, numerator_unit = 'MCG', denominator_unit = 'DOS' WHERE drug_concept_code IN ( '2971801', '2971802', '2971803' ) AND ingredient_concept_code IN ( SELECT concept_code FROM drug_concept_stage WHERE concept_class_id = 'Ingredient' AND concept_name = 'SALMETEROL' ); UPDATE ds_stage SET numerator_value = amount_value * 100, amount_value = NULL, amount_unit = NULL, denominator_value = amount_value, numerator_unit = 'MCG', denominator_unit = 'DOS' WHERE ingredient_concept_code IN ( SELECT concept_code FROM drug_concept_stage WHERE concept_class_id = 'Ingredient' AND concept_name = 'FLUTICASONE' ) AND drug_concept_code IN ( '2393701', '2971802' ); UPDATE ds_stage SET numerator_value = amount_value * 250, amount_value = NULL, amount_unit = NULL, denominator_value = amount_value, numerator_unit = 'MCG', denominator_unit = 'DOS' WHERE ingredient_concept_code IN ( SELECT concept_code FROM drug_concept_stage WHERE concept_class_id = 'Ingredient' AND concept_name = 'FLUTICASONE' ) AND drug_concept_code IN ( '2393702', '2971803', '2971805' ); UPDATE ds_stage SET numerator_value = amount_value * 500, amount_value = NULL, amount_unit = NULL, denominator_value = amount_value, numerator_unit = 'MCG', denominator_unit = 'DOS' WHERE ingredient_concept_code IN ( SELECT concept_code FROM drug_concept_stage WHERE concept_class_id = 'Ingredient' AND concept_name = 'FLUTICASONE' ) AND drug_concept_code IN ( '2393703', '2971801', '2971806' ); UPDATE ds_stage SET numerator_value = 2760, denominator_value = 30, amount_value = NULL, amount_unit = NULL, numerator_unit = 'MCG', denominator_unit = 'DOS' WHERE ingredient_concept_code IN ( SELECT concept_code FROM drug_concept_stage WHERE concept_class_id = 'Ingredient' AND concept_name = 'FLUTICASONE FUROATE' ) AND drug_concept_code = '5475101'; UPDATE ds_stage SET numerator_value = 660, denominator_value = 30, amount_value = NULL, amount_unit = NULL, numerator_unit = 'MCG', denominator_unit = 'DOS' WHERE ingredient_concept_code IN ( SELECT concept_code FROM drug_concept_stage WHERE concept_class_id = 'Ingredient' AND concept_name = 'VILANTEROL' ) AND drug_concept_code = '5475101'; UPDATE ds_stage SET numerator_value = 24000, denominator_value = 60, amount_value = NULL, amount_unit = NULL, numerator_unit = 'MCG', denominator_unit = 'DOS' WHERE ingredient_concept_code IN ( SELECT concept_code FROM drug_concept_stage WHERE concept_class_id = 'Ingredient' AND concept_name = 'BUDESONIDE' ) AND drug_concept_code = '4671001'; UPDATE ds_stage SET numerator_value = 720, denominator_value = 60, amount_value = NULL, amount_unit = NULL, numerator_unit = 'MCG', denominator_unit = 'DOS' WHERE ingredient_concept_code IN ( SELECT concept_code FROM drug_concept_stage WHERE concept_class_id = 'Ingredient' AND concept_name = 'FORMOTEROL' ) AND drug_concept_code = '4671001'; DELETE FROM ds_stage WHERE drug_concept_code = '2935001'; --fill RLC --Ingredients DROP TABLE IF EXISTS relationship_ingrdient; CREATE TABLE relationship_ingrdient AS SELECT DISTINCT a.concept_code AS concept_code_1, f.concept_id AS concept_id_2 FROM drug_concept_stage a JOIN devv5.concept c ON upper(c.concept_name) = upper(a.concept_name) AND c.concept_class_id IN ( 'Ingredient', 'VTM', 'AU Substance' ) JOIN devv5.concept_relationship b ON c.concept_id = concept_id_1 JOIN devv5.concept f ON f.concept_id = concept_id_2 WHERE f.vocabulary_id LIKE 'Rx%' AND f.standard_concept = 'S' AND f.concept_class_id = 'Ingredient' AND a.concept_class_id = 'Ingredient'; INSERT INTO relationship_ingrdient SELECT DISTINCT a.concept_code, c.concept_id FROM drug_concept_stage a JOIN ingredient_all_completed b ON a.concept_name = b.concept_name JOIN devv5.concept c ON c.concept_id = concept_id_2 WHERE a.concept_class_id = 'Ingredient' AND ( b.concept_name, concept_id_2 ) NOT IN ( SELECT concept_name, concept_id_2 FROM drug_concept_stage JOIN relationship_ingrdient ON concept_code = concept_code_1 AND concept_class_id = 'Ingredient' ); INSERT INTO relationship_to_concept SELECT concept_code_1, 'DA_France', concept_id_2, rank() OVER ( PARTITION BY concept_code_1 ORDER BY concept_id_2 ) AS precedence, NULL AS conversion_factor FROM relationship_ingrdient a JOIN devv5.concept ON concept_id_2 = concept_id WHERE standard_concept = 'S'; --Brand Names DROP TABLE IF EXISTS relationship_bn; CREATE TABLE relationship_bn AS SELECT a.concept_code AS concept_code_1, c.concept_id AS concept_id_2 FROM drug_concept_stage a JOIN devv5.concept c ON upper(c.concept_name) = upper(a.concept_name) AND c.concept_class_id = 'Brand Name' AND c.vocabulary_id LIKE 'Rx%' AND c.invalid_reason IS NULL WHERE a.concept_class_id = 'Brand Name'; INSERT INTO relationship_bn SELECT b.concept_code, concept_id_2 FROM brand_names_manual a JOIN drug_concept_stage b ON upper(a.concept_name) = upper(b.concept_name) JOIN devv5.concept c ON concept_id_2 = concept_id AND c.invalid_reason IS NULL AND ( b.concept_code, concept_id_2 ) NOT IN ( SELECT concept_code_1, concept_id_2 FROM relationship_bn ); INSERT INTO relationship_to_concept ( concept_code_1, vocabulary_id_1, concept_id_2, precedence ) SELECT concept_code_1, 'DA_France', concept_id_2, rank() OVER ( PARTITION BY concept_code_1 ORDER BY concept_id_2 ) FROM relationship_bn; --Dose Forms INSERT INTO relationship_to_concept ( concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor ) SELECT b.concept_code, 'DA_France', concept_id_2, precedence, NULL FROM new_form_name_mapping a --manually created table JOIN drug_concept_stage b ON b.concept_name = a.dose_form_name; --Units insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('%', 'DA_France',8554,1,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('G', 'DA_France',8576,1,1000); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('IU', 'DA_France',8510,1,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('IU', 'DA_France',8718,2,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('K', 'DA_France',8510,1,1000); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('K', 'DA_France',8718,2,1000); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('KG', 'DA_France',8576,1,1000); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('L', 'DA_France',8587,1,1000); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('M', 'DA_France',8510,1,1000000); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('MCG', 'DA_France',8576,1,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('MG', 'DA_France',8576,1,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('ML', 'DA_France',8576,2,1000); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('U', 'DA_France',8510,1,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('U', 'DA_France',8718,2,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('Y', 'DA_France',8576,1,0.001); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('UI', 'DA_France',8510,1,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('UI', 'DA_France',8718,2,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('MUI', 'DA_France',8510,1,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('MUI', 'DA_France',8718,2,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('GM', 'DA_France',8576,1,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('DOS', 'DA_France',45744809,1,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('TU', 'DA_France',9413,1,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('TU', 'DA_France',8510,2,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('TU', 'DA_France',8718,3,1); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('MU', 'DA_France',8510,2,0.000001); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('MU', 'DA_France',8718,3,0.000001); insert into relationship_to_concept (concept_code_1, vocabulary_id_1, concept_id_2, precedence, conversion_factor) values ('H', 'DA_France',8505,1,1); --update ds_stage after relationship_to concept found identical ingredients DROP TABLE IF EXISTS ds_sum; CREATE TABLE ds_sum AS WITH a AS ( SELECT DISTINCT ds.drug_concept_code, ds.ingredient_concept_code, ds.box_size, ds.amount_value, ds.amount_unit, ds.numerator_value, ds.numerator_unit, ds.denominator_value, ds.denominator_unit, rc.concept_id_2 FROM ds_stage ds JOIN ds_stage ds2 ON ds.drug_concept_code = ds2.drug_concept_code AND ds.ingredient_concept_code != ds2.ingredient_concept_code JOIN relationship_to_concept rc ON ds.ingredient_concept_code = rc.concept_code_1 JOIN relationship_to_concept rc2 ON ds2.ingredient_concept_code = rc2.concept_code_1 WHERE rc.concept_id_2 = rc2.concept_id_2 ) SELECT drug_concept_code, max(ingredient_concept_code) OVER ( PARTITION BY drug_concept_code, concept_id_2 ) AS ingredient_concept_code, box_size, sum(amount_value) OVER (PARTITION BY drug_concept_code) AS amount_value, amount_unit, sum(numerator_value) OVER ( PARTITION BY drug_concept_code, concept_id_2 ) AS numerator_value, numerator_unit, denominator_value, denominator_unit FROM a UNION SELECT drug_concept_code, ingredient_concept_code, box_size, NULL as amount_value, NULL as amount_unit, NULL as numerator_value, NULL as numerator_unit, NULL as denominator_value, NULL as denominator_unit FROM a WHERE ( drug_concept_code, ingredient_concept_code ) NOT IN ( SELECT drug_concept_code, max(ingredient_concept_code) FROM a GROUP BY drug_concept_code ); DELETE FROM ds_stage WHERE ( drug_concept_code, ingredient_concept_code ) IN ( SELECT drug_concept_code, ingredient_concept_code FROM ds_sum ); INSERT INTO ds_stage SELECT * FROM DS_SUM WHERE coalesce(amount_value, numerator_value) IS NOT NULL; --update irs after relationship_to concept found identical ingredients DELETE FROM internal_relationship_stage WHERE ( concept_code_1, concept_code_2 ) IN ( SELECT concept_code_1, concept_code_2 FROM ( SELECT DISTINCT concept_code_1, concept_code_2, COUNT(concept_code_2) OVER (PARTITION BY concept_code_1) AS irs_cnt FROM internal_relationship_stage JOIN drug_concept_stage ON concept_code = concept_code_2 AND concept_class_id = 'Ingredient' ) irs JOIN ( SELECT DISTINCT drug_concept_code, COUNT(ingredient_concept_code) OVER (PARTITION BY drug_concept_code) AS ds_cnt FROM ds_stage ) ds ON drug_concept_code = concept_code_1 AND irs_cnt != ds_cnt ) AND ( concept_code_1, concept_code_2 ) NOT IN ( SELECT drug_concept_code, ingredient_concept_code FROM ds_stage ); UPDATE ds_stage SET box_size = NULL WHERE drug_concept_code IN ( SELECT drug_concept_code FROM ds_stage ds JOIN internal_relationship_stage i ON concept_code_1 = drug_concept_code LEFT JOIN drug_concept_stage ON concept_code = concept_code_2 AND concept_class_id = 'Dose Form' WHERE box_size IS NOT NULL AND concept_name IS NULL ); INSERT INTO concept_synonym_stage ( synonym_name, synonym_concept_code, synonym_vocabulary_id, language_concept_id ) SELECT dose_form, concept_code, 'DA_France', 4180190 -- French language FROM france_names_translation a JOIN drug_concept_stage ON trim(upper(dose_form_name)) = upper(concept_name); -- Create sequence for new OMOP-created standard concepts DO $$ DECLARE ex INTEGER; BEGIN SELECT MAX(replace(concept_code, 'OMOP','')::int4)+1 into ex FROM devv5.concept WHERE concept_code like 'OMOP%' and concept_code not like '% %'; DROP SEQUENCE IF EXISTS new_vocab; EXECUTE 'CREATE SEQUENCE new_vocab INCREMENT BY 1 START WITH ' || ex || ' NO CYCLE CACHE 20'; END$$; DROP TABLE IF EXISTS code_replace; CREATE TABLE code_replace AS SELECT 'OMOP' || nextval('new_vocab') AS new_code, concept_code AS old_code FROM ( SELECT concept_code FROM drug_concept_stage WHERE concept_code LIKE 'OMOP%' GROUP BY concept_code ORDER BY LPAD(concept_code, 50, '0') ) AS s0; UPDATE drug_concept_stage a SET concept_code = b.new_code FROM code_replace b WHERE a.concept_code = b.old_code; UPDATE relationship_to_concept a SET concept_code_1 = b.new_code FROM code_replace b WHERE a.concept_code_1 = b.old_code; UPDATE ds_stage a SET ingredient_concept_code = b.new_code FROM code_replace b WHERE a.ingredient_concept_code = b.old_code; UPDATE ds_stage a SET drug_concept_code = b.new_code FROM code_replace b WHERE a.drug_concept_code = b.old_code; UPDATE internal_relationship_stage a SET concept_code_1 = b.new_code FROM code_replace b WHERE a.concept_code_1 = b.old_code; UPDATE internal_relationship_stage a SET concept_code_2 = b.new_code FROM code_replace b WHERE a.concept_code_2 = b.old_code; UPDATE pc_stage a SET drug_concept_code = b.new_code FROM code_replace b WHERE a.drug_concept_code = b.old_code; UPDATE drug_concept_stage SET standard_concept = NULL WHERE concept_code IN ( SELECT concept_code FROM drug_concept_stage JOIN internal_relationship_stage ON concept_code_1 = concept_code WHERE concept_class_id = 'Ingredient' AND standard_concept IS NOT NULL );
the_stack
SET foreign_key_checks = 0; DROP TABLE IF EXISTS `dmlgen_types`; DROP TABLE IF EXISTS `store`; DROP TABLE IF EXISTS `store_group`; DROP TABLE IF EXISTS `store_website`; DROP TABLE IF EXISTS `customer_entity`; DROP TABLE IF EXISTS `customer_address_entity`; DROP TABLE IF EXISTS `core_configuration`; DROP VIEW IF EXISTS `view_customer_no_auto_increment`; DROP VIEW IF EXISTS `view_customer_auto_increment`; DROP TABLE IF EXISTS `catalog_product_index_eav_decimal_idx`; DROP TABLE IF EXISTS `sales_order_status_state`; CREATE TABLE `dmlgen_types` ( `id` INT(11) NOT NULL AUTO_INCREMENT, col_bigint_1 BIGINT(20) NULL, col_bigint_2 BIGINT(20) NOT NULL DEFAULT 0, col_bigint_3 BIGINT(20) UNSIGNED NULL, col_bigint_4 BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, col_blob BLOB DEFAULT NULL, col_date_1 DATE DEFAULT NULL, col_date_2 DATE NOT NULL DEFAULT '0000-00-00', col_datetime_1 DATETIME DEFAULT NULL, col_datetime_2 DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', col_decimal_10_1 DECIMAL(10, 1) UNSIGNED DEFAULT NULL, col_decimal_12_4 DECIMAL(12, 4) DEFAULT NULL, price_a_12_4 DECIMAL(12, 4) DEFAULT NULL, price_b_12_4 DECIMAL(12, 4) NOT NULL DEFAULT 0, col_decimal_12_3 DECIMAL(12, 3) NOT NULL DEFAULT 0, col_decimal_20_6 DECIMAL(20, 6) NOT NULL DEFAULT 0.000000, col_decimal_24_12 DECIMAL(24, 12) NOT NULL DEFAULT 0.000000000000, /* col_float FLOAT NOT NULL DEFAULT 1, hard to compare, so skipping */ col_int_1 INT(10) NULL, col_int_2 INT(10) NOT NULL DEFAULT 0, col_int_3 INT(10) UNSIGNED NULL, col_int_4 INT(10) UNSIGNED NOT NULL DEFAULT 0, col_longtext_1 LONGTEXT DEFAULT NULL, col_longtext_2 LONGTEXT NOT NULL DEFAULT '', col_mediumblob MEDIUMBLOB DEFAULT NULL, col_mediumtext_1 MEDIUMTEXT DEFAULT NULL, col_mediumtext_2 MEDIUMTEXT NOT NULL DEFAULT '', col_smallint_1 SMALLINT(5) NULL, col_smallint_2 SMALLINT(5) NOT NULL DEFAULT 0, col_smallint_3 SMALLINT(5) UNSIGNED NULL, col_smallint_4 SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0, has_smallint_5 SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0, is_smallint_5 SMALLINT(5) NULL, col_text TEXT DEFAULT NULL, col_timestamp_1 TIMESTAMP NOT NULL DEFAULT current_timestamp(), col_timestamp_2 TIMESTAMP NULL, col_tinyint_1 TINYINT(1) NOT NULL DEFAULT 0, col_varchar_1 VARCHAR(1) NOT NULL DEFAULT '0', col_varchar_100 VARCHAR(100) DEFAULT NULL, col_varchar_16 VARCHAR(16) NOT NULL DEFAULT 'de_DE', col_char_1 CHAR(21) DEFAULT NULL, col_char_2 CHAR(17) NOT NULL DEFAULT 'xchar', PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; -- Create syntax for TABLE 'store' CREATE TABLE `store` ( `store_id` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Store Id', `code` VARCHAR(32) DEFAULT NULL COMMENT 'Code', `website_id` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Website Id', `group_id` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Group Id', `name` VARCHAR(255) NOT NULL COMMENT 'Store Name', `sort_order` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Store Sort Order', `is_active` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Store Activity', PRIMARY KEY (`store_id`), UNIQUE KEY `STORE_CODE` (`code`), KEY `STORE_WEBSITE_ID` (`website_id`), KEY `STORE_IS_ACTIVE_SORT_ORDER` (`is_active`, `sort_order`), KEY `STORE_GROUP_ID` (`group_id`), CONSTRAINT `STORE_GROUP_ID_STORE_GROUP_GROUP_ID` FOREIGN KEY (`group_id`) REFERENCES `store_group` (`group_id`) ON DELETE CASCADE, CONSTRAINT `STORE_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `store_website` (`website_id`) ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='Stores'; -- Create syntax for TABLE 'store_group' CREATE TABLE `store_group` ( `group_id` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Group Id', `website_id` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Website Id', `name` VARCHAR(255) NOT NULL COMMENT 'Store Group Name', `root_category_id` INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Root Category Id', `default_store_id` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Default Store Id', `code` VARCHAR(32) DEFAULT NULL COMMENT 'Store group unique code', PRIMARY KEY (`group_id`), UNIQUE KEY `STORE_GROUP_CODE` (`code`), KEY `STORE_GROUP_WEBSITE_ID` (`website_id`), KEY `STORE_GROUP_DEFAULT_STORE_ID` (`default_store_id`), CONSTRAINT `STORE_GROUP_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `store_website` (`website_id`) ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='Store Groups'; -- Create syntax for TABLE 'store_website' CREATE TABLE `store_website` ( `website_id` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Website Id', `code` VARCHAR(32) DEFAULT NULL COMMENT 'Code', `name` VARCHAR(64) DEFAULT NULL COMMENT 'Website Name', `sort_order` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Sort Order', `default_group_id` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Default Group Id', `is_default` SMALLINT(5) UNSIGNED DEFAULT 0 COMMENT 'Defines Is Website Default', PRIMARY KEY (`website_id`), UNIQUE KEY `STORE_WEBSITE_CODE` (`code`), KEY `STORE_WEBSITE_SORT_ORDER` (`sort_order`), KEY `STORE_WEBSITE_DEFAULT_GROUP_ID` (`default_group_id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='Websites'; -- Create syntax for TABLE 'customer_entity' CREATE TABLE `customer_entity` ( `entity_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Entity ID', `website_id` SMALLINT(5) UNSIGNED DEFAULT NULL COMMENT 'Website ID', `email` VARCHAR(255) DEFAULT NULL COMMENT 'Email', `group_id` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Group ID', `store_id` SMALLINT(5) UNSIGNED DEFAULT 0 COMMENT 'Store ID', `created_at` TIMESTAMP NOT NULL DEFAULT current_timestamp() COMMENT 'Created At', `updated_at` TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Updated At', `is_active` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Is Active', `created_in` VARCHAR(255) DEFAULT NULL COMMENT 'Created From', `firstname` VARCHAR(255) DEFAULT NULL COMMENT 'First Name', `lastname` VARCHAR(255) DEFAULT NULL COMMENT 'Last Name', `dob` DATE DEFAULT NULL COMMENT 'Date of Birth', `password_hash` VARCHAR(128) DEFAULT NULL COMMENT 'Password_hash', `rp_token` VARCHAR(128) DEFAULT NULL COMMENT 'Reset password token', `rp_token_created_at` DATETIME DEFAULT NULL COMMENT 'Reset password token creation time', `default_billing` INT(10) UNSIGNED DEFAULT NULL COMMENT 'Default Billing Address', `default_shipping` INT(10) UNSIGNED DEFAULT NULL COMMENT 'Default Shipping Address', `gender` SMALLINT(5) UNSIGNED DEFAULT NULL COMMENT 'Gender', PRIMARY KEY (`entity_id`), UNIQUE KEY `CUSTOMER_ENTITY_EMAIL_WEBSITE_ID` (`email`, `website_id`), KEY `CUSTOMER_ENTITY_STORE_ID` (`store_id`), KEY `CUSTOMER_ENTITY_WEBSITE_ID` (`website_id`), KEY `CUSTOMER_ENTITY_FIRSTNAME` (`firstname`), KEY `CUSTOMER_ENTITY_LASTNAME` (`lastname`), CONSTRAINT `CUSTOMER_ENTITY_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE SET NULL, CONSTRAINT `CUSTOMER_ENTITY_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `store_website` (`website_id`) ON DELETE SET NULL ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='Customer Entity'; -- Create syntax for TABLE 'customer_address_entity' CREATE TABLE `customer_address_entity` ( `entity_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Entity ID', `increment_id` VARCHAR(50) DEFAULT NULL COMMENT 'Increment Id', `parent_id` INT(10) UNSIGNED DEFAULT NULL COMMENT 'Parent ID', `created_at` TIMESTAMP NOT NULL DEFAULT current_timestamp() COMMENT 'Created At', `updated_at` TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Updated At', `is_active` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Is Active', `city` VARCHAR(255) NOT NULL COMMENT 'City', `company` VARCHAR(255) DEFAULT NULL COMMENT 'Company', `country_id` VARCHAR(255) NOT NULL COMMENT 'Country', `firstname` VARCHAR(255) NOT NULL COMMENT 'First Name', `lastname` VARCHAR(255) NOT NULL COMMENT 'Last Name', `postcode` VARCHAR(255) DEFAULT NULL COMMENT 'Zip/Postal Code', `region` VARCHAR(255) DEFAULT NULL COMMENT 'State/Province', `street` TEXT NOT NULL COMMENT 'Street Address', PRIMARY KEY (`entity_id`), KEY `CUSTOMER_ADDRESS_ENTITY_PARENT_ID` (`parent_id`), CONSTRAINT `CUSTOMER_ADDRESS_ENTITY_PARENT_ID_CUSTOMER_ENTITY_ENTITY_ID` FOREIGN KEY (`parent_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='Customer Address Entity'; CREATE TABLE `customer_entity_varchar` ( `value_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID', `attribute_id` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Attribute ID', `entity_id` INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Entity ID', `value` VARCHAR(255) DEFAULT NULL COMMENT 'Value', PRIMARY KEY (`value_id`), UNIQUE KEY `CUSTOMER_ENTITY_VARCHAR_ENTITY_ID_ATTRIBUTE_ID` (`entity_id`, `attribute_id`), CONSTRAINT `CUSTOMER_ENTITY_VARCHAR_ENTITY_ID_CUSTOMER_ENTITY_ENTITY_ID` FOREIGN KEY (`entity_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT ='Customer Entity Varchar'; CREATE TABLE `customer_entity_int` ( `value_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID', `attribute_id` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Attribute ID', `entity_id` INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Entity ID', `value` INT(11) NOT NULL DEFAULT 0 COMMENT 'Value', PRIMARY KEY (`value_id`), UNIQUE KEY `CUSTOMER_ENTITY_INT_ENTITY_ID_ATTRIBUTE_ID` (`entity_id`, `attribute_id`), CONSTRAINT `CUSTOMER_ENTITY_INT_ENTITY_ID_CUSTOMER_ENTITY_ENTITY_ID` FOREIGN KEY (`entity_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT ='Customer Entity Int'; CREATE VIEW `view_customer_no_auto_increment` AS -- this join is logically wrong because demo data needed as parent_id column in -- customer_address_entity is empty. SELECT `ce`.`email`, `cae`.`firstname`, `cae`.`lastname`, `cae`.`city` FROM `customer_entity` `ce` JOIN `customer_address_entity` `cae` ON `ce`.`entity_id` = `cae`.`entity_id` ; CREATE VIEW `view_customer_auto_increment` AS -- this join is logically wrong because demo data needed as parent_id column in -- customer_address_entity is empty. SELECT `ce`.`entity_id` AS ce_entity_id, `ce`.`email`, `cae`.`firstname`, `cae`.`lastname`, `cae`.`city` FROM `customer_entity` `ce` JOIN `customer_address_entity` `cae` ON `ce`.`entity_id` = `cae`.`entity_id` ; CREATE TABLE `core_configuration` ( `config_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Id', `scope` VARCHAR(8) NOT NULL DEFAULT 'default' COMMENT 'Scope', `scope_id` INT(11) NOT NULL DEFAULT 0 COMMENT 'Scope Id', `expires` DATETIME NULL COMMENT 'Value expiration time', `path` VARCHAR(255) NOT NULL COMMENT 'Path', `value` TEXT DEFAULT NULL COMMENT 'Value', `version_ts` TIMESTAMP(6) GENERATED ALWAYS AS ROW START COMMENT 'Timestamp Start Versioning', `version_te` TIMESTAMP(6) GENERATED ALWAYS AS ROW END COMMENT 'Timestamp End Versioning', PERIOD FOR SYSTEM_TIME(`version_ts`, `version_te`), PRIMARY KEY (`config_id`), UNIQUE KEY `CORE_CONFIG_DATA_SCOPE_SCOPE_ID_PATH` (`scope`, `scope_id`, `path`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='Config Data' WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME ( PARTITION p_hist HISTORY, PARTITION p_cur CURRENT ); INSERT INTO `store` (`store_id`, `code`, `website_id`, `group_id`, `name`, `sort_order`, `is_active`) VALUES (1, 'admin', 0, 0, 'Admin', 0, 1); INSERT INTO `store_group` (`group_id`, `website_id`, `name`, `root_category_id`, `default_store_id`, `code`) VALUES (1, 0, 'Admin', 0, 0, 'admin'); INSERT INTO `store_website` (`website_id`, `code`, `name`, `sort_order`, `default_group_id`, `is_default`) VALUES (1, 'admin', 'Admin', 0, 0, 1); CREATE TABLE `catalog_product_index_eav_decimal_idx` ( `entity_id` INT(10) UNSIGNED NOT NULL COMMENT 'Entity ID', `attribute_id` SMALLINT(5) UNSIGNED NOT NULL COMMENT 'Attribute ID', `store_id` SMALLINT(5) UNSIGNED NOT NULL COMMENT 'Store ID', `source_id` INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Original entity Id for attribute value', `value` DECIMAL(12, 4) NOT NULL COMMENT 'Value', PRIMARY KEY (`entity_id`, `attribute_id`, `store_id`, `source_id`), KEY `CATALOG_PRODUCT_INDEX_EAV_DECIMAL_IDX_ATTRIBUTE_ID` (`attribute_id`), KEY `CATALOG_PRODUCT_INDEX_EAV_DECIMAL_IDX_STORE_ID` (`store_id`), KEY `CATALOG_PRODUCT_INDEX_EAV_DECIMAL_IDX_VALUE` (`value`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT ='Catalog Product EAV Decimal Indexer Index Table'; INSERT INTO `catalog_product_index_eav_decimal_idx` (`entity_id`, `attribute_id`, `store_id`, `source_id`, `value`) VALUES (1, 1, 1, 1, 1.0000), (2, 1, 1, 2, 2.2150); CREATE TABLE `sales_order_status_state` ( `status` VARCHAR(32) NOT NULL COMMENT 'Status', `state` VARCHAR(32) NOT NULL COMMENT 'Label', `is_default` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Is Default', `visible_on_front` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Visible on front', PRIMARY KEY (`status`, `state`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT ='Sales Order Status Table'; INSERT INTO `sales_order_status_state` (`status`, `state`, `is_default`, `visible_on_front`) VALUES ('canceled', 'canceled', 1, 1), ('closed', 'closed', 1, 1), ('complete', 'complete', 1, 1), ('fraud', 'payment_review', 0, 1), ('fraud', 'processing', 0, 1), ('holded', 'holded', 1, 1), ('payment_review', 'payment_review', 1, 1), ('pending', 'new', 1, 1), ('pending_payment', 'pending_payment', 1, 0), ('processing', 'processing', 1, 1); DROP TABLE IF EXISTS `sequence_catalog_category`; CREATE TABLE `sequence_catalog_category` ( `sequence_value` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY (`sequence_value`) ) ENGINE = InnoDB AUTO_INCREMENT = 42 DEFAULT CHARSET = utf8; -- catalog_category_entity has a 1:1 to table sequence_catalog_category and cannot be reversed DROP TABLE IF EXISTS `catalog_category_entity`; CREATE TABLE `catalog_category_entity` ( `entity_id` INT(10) UNSIGNED NOT NULL COMMENT 'Entity Id', `row_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Version Id', PRIMARY KEY (`row_id`), KEY `CATALOG_CATEGORY_ENTITY_ENTITY_ID` (`entity_id`), CONSTRAINT `CAT_CTGR_ENTT_ENTT_ID_SEQUENCE_CAT_CTGR_SEQUENCE_VAL` FOREIGN KEY (`entity_id`) REFERENCES `sequence_catalog_category` (`sequence_value`) ON DELETE CASCADE ) ENGINE = InnoDB AUTO_INCREMENT = 42 DEFAULT CHARSET = utf8 COMMENT ='Catalog Category Table'; DROP TABLE IF EXISTS `athlete_team_member`; CREATE TABLE `athlete_team_member` ( `id` INT(12) UNSIGNED NOT NULL AUTO_INCREMENT, `team_id` INT(10) UNSIGNED NOT NULL COMMENT 'Athlete Team ID or AID', `athlete_id` INT(10) UNSIGNED NOT NULL COMMENT 'Athlete ID or AGID', PRIMARY KEY (`id`), UNIQUE KEY `UNQ_ATHLETE_TEAM_MEMBER_TEAM_ATHLETE` (`team_id`, `athlete_id`), CONSTRAINT `FK_ATHLETE_TEAM_MEMBER_TEAM_ID` FOREIGN KEY (`team_id`) REFERENCES `athlete_team` (`team_id`) ON DELETE CASCADE, CONSTRAINT `FK_ATHLETE_TEAM_MEMBER_ATHLETE_ID` FOREIGN KEY (`athlete_id`) REFERENCES `athlete` (`athlete_id`) ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET = `utf8mb4` COMMENT ='Athlete Team Members'; DROP TABLE IF EXISTS `athlete_team`; CREATE TABLE `athlete_team` ( `team_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(340) NOT NULL COMMENT 'Team name', PRIMARY KEY (`team_id`) ) ENGINE = InnoDB DEFAULT CHARSET = `utf8mb4` COMMENT ='Athlete Team'; DROP TABLE IF EXISTS `athlete`; CREATE TABLE `athlete` ( `athlete_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Athlete ID', `firstname` VARCHAR(340) COMMENT 'First Name', `lastname` VARCHAR(340) COMMENT 'Last Name', PRIMARY KEY (`athlete_id`) ) ENGINE = InnoDB DEFAULT CHARSET = `utf8mb4` COMMENT ='Athletes'; SET foreign_key_checks = 1;
the_stack
CREATE DATABASE db_gbk TEMPLATE template0 encoding 'GBK' lc_ctype 'zh_CN.GBK' lc_collate 'zh_CN.GBK'; \c db_gbk set client_encoding='UTF8'; show client_encoding; show server_encoding; ------------------------------ basic synax for text search configuration ------------------------------- -- --- Pound -- -- CREATE TEXT SEARCH CONFIGURATION create text search configuration pound_gbk(parser=pound) with (split_flag = '#'); ALTER TEXT SEARCH CONFIGURATION pound_gbk ADD MAPPING FOR zh_words, en_word, numeric, alnum, grapsymbol, multisymbol WITH simple; select cfgname, cfoptions from pg_ts_config where cfgname = 'pound_gbk'; SELECT to_tsvector('pound_gbk', '京东#淘宝#滴滴#爱奇艺#芒果TV'); -- SET THE SPLIT FLAG to '@' alter text search configuration pound_gbk set (split_flag = '@'); select cfgname, cfoptions from pg_ts_config where cfgname = 'pound_gbk'; SELECT to_tsvector('pound_gbk', '京东@淘宝@滴滴@爱奇艺@芒果TV'); -- SET THE SPLIT FLAG to '$' alter text search configuration pound_gbk set (split_flag = '$'); select cfgname, cfoptions from pg_ts_config where cfgname = 'pound_gbk'; SELECT to_tsvector('pound_gbk', '京东$淘宝$滴滴$爱奇艺$芒果TV'); -- SET THE SPLIT FLAG to '%' alter text search configuration pound_gbk set (split_flag = '%'); select cfgname, cfoptions from pg_ts_config where cfgname = 'pound_gbk'; SELECT to_tsvector('pound_gbk', '京东%淘宝%滴滴%爱奇艺%芒果TV'); -- SET THE SPLIT FLAG to '/' alter text search configuration pound_gbk set (split_flag = '/'); select cfgname, cfoptions from pg_ts_config where cfgname = 'pound_gbk'; SELECT to_tsvector('pound_gbk', '京东/淘宝/滴滴/爱奇艺/芒果TV'); -- FOR UNSUPPORTED SPLPT_FLAG, REPORT ERROR alter text search configuration pound_gbk set (split_flag = ','); -- WHEN SPLIT FLAG IS NOT SINGLE CHARACTER, REPORT ERROR alter text search configuration pound_gbk set (split_flag = '#@'); -- WHEN SPLIT FLAG IS NULL CHARACTER, REPORT ERROR alter text search configuration pound_gbk set (split_flag = ''); -- WHEN SINGLE TOKEN EXCEED 256 CHARACTERS, SPLIT DIRECTLY EVEN NO SPLIT FLAG IS FOUND select to_tsvector('pound_gbk','1981年8月26日,美国宇宙飞船“旅行者2号”飞过土星,取得了一系列探测成果,其中包括发现了土星的第17颗卫星——土卫17。所以,今天我们就来说一说“旅行者2号”上的“地球之音”唱片。1977年8月和9月,人类成功发射了“旅行者1号”和“旅行者2号”探测器,再次向外星人作了更详细的自我介绍。这次,它们各自携带了一张称为“地球之音”的唱片,上面录制了丰富的地球信息。这两张唱片都是镀金铜质的,直径为30.5厘米。唱片上录有115幅照片和图表,35种各类声音,近60种语言的问候语和27首世界著名乐曲等。115幅照片中包括我国八达岭长城'); select to_tsvector('pound_gbk','1981年8月26日,美国宇宙飞船“旅行者2号”飞过土星,取得了一系列探测成果,其中包括发现了土星的第17颗卫星——土卫17。所以,今天我们就来说一说“旅行者2号”上的“地球之音”唱片。1977年8月和9月,人类成功发射了“旅行者1号”和“旅行者2号”探测器,再次向外星人作了更详细的自我介绍。这次,它们各自携带了一张称为“地球之音”的唱片,上面录制了丰富的地球信息。这两张唱片都是镀金铜质的,直径为30.5厘米。唱片上录有115幅照片和图表,35种各类声音,近60种语言的问候语和27首世界著名乐曲等。115幅///照片中包括我国八达岭长城'); drop text search configuration pound_gbk; create text search configuration pound_gbk(parser=pound) with (split_flag = '#'); ALTER TEXT SEARCH CONFIGURATION pound_gbk ADD MAPPING FOR zh_words, en_word, numeric, alnum, grapsymbol, multisymbol WITH simple; select cfgname, cfoptions from pg_ts_config where cfgname = 'pound_gbk'; SELECT to_tsvector('pound_gbk', '京东#淘宝#滴滴#爱奇艺#芒果TV'); -- --- N-gram -- -- CREATE TEXT SEARCH CONFIGURATION create text search configuration ngram1(parser=ngram) with (punctuation_ignore = on, gram_size = 2, grapsymbol_ignore = on); alter text search configuration ngram1 ADD MAPPING FOR zh_words, en_word, numeric, alnum, grapsymbol, multisymbol with simple; select cfgname, cfoptions from pg_ts_config where cfgname = 'ngram1'; SELECT to_tsvector('ngram1', '画,龙&点睛'); --punctuation_ignore alter text search configuration ngram1 set (punctuation_ignore = off); SELECT to_tsvector('ngram1', '画,龙&点睛'); --punctuation_ignore alter text search configuration ngram1 set (grapsymbol_ignore = off); SELECT to_tsvector('ngram1', '画,龙&点睛'); --punctuation_ignore alter text search configuration ngram1 set (gram_size = 3); SELECT to_tsvector('ngram1', '画,龙&点睛'); drop text search configuration ngram1; create text search configuration ngram1(parser=ngram); alter text search configuration ngram1 ADD MAPPING FOR zh_words, en_word, numeric, alnum, grapsymbol, multisymbol with simple; select cfgname, cfoptions from pg_ts_config where cfgname = 'ngram1'; SELECT to_tsvector('ngram1', '画,龙&点睛'); --------------------------- basic operation for text search parser ---------------------------------- -- ---- N-gram parser -- set ngram_gram_size = 2; set ngram_grapsymbol_ignore = off; set ngram_punctuation_ignore = off; select ts_parse('ngram', 'Uber提供了电脑版、手机版&平板电脑等版本'); -- configuration parameter: ngram.punctuation_ignore set ngram_punctuation_ignore = on; select ts_parse('ngram', 'Uber提供了电脑版、手机版&平板电脑等版本'); -- configuration parameter: ngram.grapsymbol_ignore set ngram_grapsymbol_ignore = on; select ts_parse('ngram', 'Uber提供了电脑版、手机版&平板电脑等版本'); -- configuration parameter: ngram.grapsymbol_ignore set ngram_gram_size = 4; select ts_parse('ngram', 'Uber提供了电脑版、手机版&平板电脑等版本'); select ts_token_type('ngram'); ------------------------------- basic operation for text search datatype ----------------------- -- --- pound -- select to_tsvector('pound_gbk', 'Uber#滴滴#爱奇艺#芒果TV'); select to_tsquery('pound_gbk','芒果TV'); -- ---- N-gram -- select to_tsvector('ngram1','辽GQQ360'); select to_tsquery('ngram1','360'); ------------------------------- basic operation for text search operator ----------------------- -- --- pound -- select to_tsvector('pound_gbk','Uber#滴滴#爱奇艺#芒果TV') @@ to_tsquery('pound_gbk','芒果TV'); -- true select to_tsvector('pound_gbk','Uber#滴滴#爱奇艺#芒果TV') @@@ to_tsquery('pound_gbk','芒果TV'); -- true select to_tsvector('pound_gbk','芒果TV') @@ to_tsquery('pound_gbk','QQ'); -- false select (to_tsvector('pound_gbk','滴滴') || to_tsvector('pound_gbk','爱奇艺')) @@ to_tsquery('pound_gbk','滴滴'); -- true select to_tsquery('pound_gbk','淘宝') && to_tsquery('pound_gbk','爱奇艺'); select to_tsquery('pound_gbk','淘宝') || to_tsquery('pound_gbk','爱奇艺'); select to_tsvector('pound_gbk','Uber#滴滴#爱奇艺#芒果TV') @@ (to_tsquery('pound_gbk','淘宝')); -- false select to_tsvector('pound_gbk','Uber#滴滴#爱奇艺#芒果TV') @@ (to_tsquery('pound_gbk','爱奇艺')); -- true select to_tsvector('pound_gbk','Uber#滴滴#爱奇艺#芒果TV') @@ (to_tsquery('pound_gbk','淘宝') || to_tsquery('pound_gbk','爱奇艺')); -- true select to_tsvector('pound_gbk','Uber#滴滴#爱奇艺#芒果TV') @@ (to_tsquery('pound_gbk','淘宝') && to_tsquery('pound_gbk','爱奇艺')); --false select !!to_tsquery('pound_gbk','爱奇艺'); select to_tsvector('pound_gbk','Uber#滴滴#爱奇艺#芒果TV') @@ !!to_tsquery('pound_gbk','爱奇艺'); -- false select to_tsvector('pound_gbk','Uber#滴滴#爱奇艺#芒果TV') @@ !!to_tsquery('pound_gbk','淘宝'); --true select to_tsquery('pound_gbk','爱奇艺') @> to_tsquery('pound_gbk','Uber#滴滴#爱奇艺#芒果TV'); -- false select to_tsquery('pound_gbk','Uber#滴滴#爱奇艺#芒果TV') @> to_tsquery('pound_gbk','爱奇艺'); -- true select to_tsquery('pound_gbk','爱奇艺') <@ to_tsquery('pound_gbk','Uber#滴滴#爱奇艺#芒果TV'); -- true select to_tsquery('pound_gbk','Uber#滴滴#爱奇艺#芒果TV') <@ to_tsquery('pound_gbk','爱奇艺'); -- false -- ---- N-gram -- select to_tsvector('ngram1','辽GQQ360') @@ to_tsquery('ngram1','360'); -- true select to_tsvector('ngram1','辽GQQ360') @@@ to_tsquery('ngram1','360'); -- true select to_tsvector('ngram1','360') @@ to_tsquery('ngram1','QQ'); -- false select (to_tsvector('ngram1','辽GQQ') || to_tsvector('ngram1','360')) @@ to_tsquery('ngram1','QQ'); -- true select to_tsquery('ngram1','480') && to_tsquery('ngram1','辽GQQ'); select to_tsquery('ngram1','480') || to_tsquery('ngram1','辽GQQ'); select to_tsvector('ngram1','辽GQQ360') @@ (to_tsquery('ngram1','480')); -- false select to_tsvector('ngram1','辽GQQ360') @@ (to_tsquery('ngram1','辽GQQ')); -- true select to_tsvector('ngram1','辽GQQ360') @@ (to_tsquery('ngram1','480') || to_tsquery('ngram1','辽GQQ')); -- true select to_tsvector('ngram1','辽GQQ360') @@ (to_tsquery('ngram1','480') && to_tsquery('ngram1','辽GQQ')); -- false select !!to_tsquery('ngram1','360') ; select to_tsvector('ngram1','辽GQQ360') @@ !!to_tsquery('ngram1','360'); -- false select to_tsvector('ngram1','辽GQQ360') @@ !!to_tsquery('ngram1','480'); -- true select to_tsquery('ngram1','360') @> to_tsquery('ngram1','辽GQQ360'); -- false select to_tsquery('ngram1','辽GQQ360') @> to_tsquery('ngram1','360'); -- true select to_tsquery('ngram1','360') <@ to_tsquery('ngram1','辽GQQ360'); -- true select to_tsquery('ngram1','辽GQQ360') <@ to_tsquery('ngram1','360'); -- false ------------------------------- basic operation for text search function ----------------------- -- pound select get_current_ts_config(); -- english select length(to_tsvector('pound_gbk','Uber#滴滴#爱奇艺#芒果TV')); -- 4 select length(to_tsvector('pound_gbk','Uber#滴滴#爱奇艺#芒果TV#QQ')); -- 5 select numnode(to_tsquery('pound_gbk','Uber#滴滴#爱奇艺#芒果TV')); select numnode(to_tsquery('pound_gbk','芒果TV') || to_tsquery('pound_gbk','滴滴')); -- select plainto_tsquery('pound_gbk', 'Uber##滴滴# 爱奇艺##芒果TV'); -- select plainto_tsquery('pound_gbk', 'Uber#滴滴#爱奇艺#芒果TV'); select querytree(to_tsquery('pound_gbk','Uber#滴滴#爱奇艺#芒果TV')); select querytree(to_tsquery('pound_gbk','滴滴') && to_tsquery('pound_gbk','爱奇艺')); select querytree(to_tsquery('pound_gbk','滴滴') || to_tsquery('pound_gbk','爱奇艺')); select strip(to_tsvector('pound_gbk','Uber#滴滴#爱奇艺#芒果TV')); select ts_headline('pound_gbk', 'Uber#滴滴#爱奇艺#芒果TV', to_tsquery('pound_gbk','Uber')); select ts_rank(to_tsvector('pound_gbk', 'Uber#滴滴#爱奇艺#芒果TV'), to_tsquery('pound_gbk','Uber#滴滴#爱奇艺#芒果TV')); select ts_rank(to_tsvector('pound_gbk', 'Uber#滴滴#爱奇艺#芒果TV'), to_tsquery('pound_gbk','Uber')); select ts_rank(to_tsvector('pound_gbk', 'Uber#滴滴#爱奇艺#芒果TV'), to_tsquery('pound_gbk','滴滴')); select ts_rank_cd(to_tsvector('pound_gbk', 'Uber#滴滴#爱奇艺#芒果TV'), to_tsquery('pound_gbk','Uber#滴滴#爱奇艺#芒果TV')); select ts_rank_cd(to_tsvector('pound_gbk', 'Uber#滴滴#爱奇艺#芒果TV'), to_tsquery('pound_gbk','Uber')); select ts_rank_cd(to_tsvector('pound_gbk', 'Uber#滴滴#爱奇艺#芒果TV'), to_tsquery('pound_gbk','滴滴')); select ts_rewrite(to_tsquery('pound_gbk','Uber#滴滴#爱奇艺#芒果TV'), to_tsquery('pound_gbk','Uber'), to_tsquery('pound_gbk','爱奇艺')); --N-gram select get_current_ts_config(); -- english select length(to_tsvector('ngram1','辽GQQ360')); -- 6 select length(to_tsvector('ngram1','辽GQQ888')); -- 5 select numnode(to_tsquery('ngram1','辽GQQ360')); -- 11 select numnode(to_tsquery('ngram1','480') || to_tsquery('ngram1','辽GQQ')); -- 9 alter text search configuration ngram1 set (grapsymbol_ignore = off); alter text search configuration ngram1 set (punctuation_ignore = on); alter text search configuration ngram1 set (gram_size = 2); select cfgname, cfoptions from pg_ts_config where cfgname = 'ngram1'; select plainto_tsquery('ngram1', '车,牌,号'); select plainto_tsquery('ngram1', '车,牌,号'); select querytree(to_tsquery('ngram1','中国人民银行')); select querytree(to_tsquery('ngram1','中国人') && to_tsquery('ngram1','民银行')); select querytree(to_tsquery('ngram1','中国人') || to_tsquery('ngram1','民银行')); select strip(to_tsvector('ngram1','中国人民银行')); select ts_headline('ngram1', '中国人民银行', to_tsquery('ngram1','中国人')); select ts_rank(to_tsvector('ngram1', '中国人民银行'), to_tsquery('ngram1','中国人民银行')); select ts_rank(to_tsvector('ngram1', '中国人民银行'), to_tsquery('ngram1','中国人')); select ts_rank(to_tsvector('ngram1', '中国人民银行'), to_tsquery('ngram1','中人')); select ts_rank_cd(to_tsvector('ngram1', '中国人民银行'), to_tsquery('ngram1','中国人民银行')); select ts_rank_cd(to_tsvector('ngram1', '中国人民银行'), to_tsquery('ngram1','中国人')); select ts_rank_cd(to_tsvector('ngram1', '中国人民银行'), to_tsquery('ngram1','中人')); select ts_rewrite(to_tsquery('ngram1','中国人民银行'), to_tsquery('ngram1','银行'), to_tsquery('ngram1','政府')); -------------------------------- add test cases for deprecated zhparser ------------------------- select to_tsvector('zhparser', '城乡建设'); select ts_parse('zhparser', '版权所有 CopyRight 2006-2015 酷狗音乐'); select to_tsquery('zhparser','中国人民银行'); select * from ts_token_type('zhparser'); drop text search configuration ngram1; drop text search configuration pound_gbk; \c postgres DROP DATABASE db_gbk;
the_stack
-- Matrix multiply array[x][m] * array[m][y] select matrix_multiply(ARRAY[[1,2]]::int2[], ARRAY[[1],[2]]::int2[]); select matrix_multiply(ARRAY[[1,2]]::int2[], ARRAY[[1],[2]]::int4[]); select matrix_multiply(ARRAY[[1,2]]::int2[], ARRAY[[1],[2]]::int8[]); select matrix_multiply(ARRAY[[1,2]]::int2[], ARRAY[[1],[2]]::float4[]); select matrix_multiply(ARRAY[[1,2]]::int2[], ARRAY[[1],[2]]::float8[]); select matrix_multiply(ARRAY[[1,2]]::int2[], ARRAY[[1],[2]]::numeric[]); select matrix_multiply(ARRAY[[1,2]]::int4[], ARRAY[[1],[2]]::int2[]); select matrix_multiply(ARRAY[[1,2]]::int4[], ARRAY[[1],[2]]::int4[]); select matrix_multiply(ARRAY[[1,2]]::int4[], ARRAY[[1],[2]]::int8[]); select matrix_multiply(ARRAY[[1,2]]::int4[], ARRAY[[1],[2]]::float4[]); select matrix_multiply(ARRAY[[1,2]]::int4[], ARRAY[[1],[2]]::float8[]); select matrix_multiply(ARRAY[[1,2]]::int4[], ARRAY[[1],[2]]::numeric[]); select matrix_multiply(ARRAY[[1,2]]::int8[], ARRAY[[1],[2]]::int2[]); select matrix_multiply(ARRAY[[1,2]]::int8[], ARRAY[[1],[2]]::int4[]); select matrix_multiply(ARRAY[[1,2]]::int8[], ARRAY[[1],[2]]::int8[]); select matrix_multiply(ARRAY[[1,2]]::int8[], ARRAY[[1],[2]]::float4[]); select matrix_multiply(ARRAY[[1,2]]::int8[], ARRAY[[1],[2]]::float8[]); select matrix_multiply(ARRAY[[1,2]]::int8[], ARRAY[[1],[2]]::numeric[]); select matrix_multiply(ARRAY[[1,2]]::float4[], ARRAY[[1],[2]]::int2[]); select matrix_multiply(ARRAY[[1,2]]::float4[], ARRAY[[1],[2]]::int4[]); select matrix_multiply(ARRAY[[1,2]]::float4[], ARRAY[[1],[2]]::int8[]); select matrix_multiply(ARRAY[[1,2]]::float4[], ARRAY[[1],[2]]::float4[]); select matrix_multiply(ARRAY[[1,2]]::float4[], ARRAY[[1],[2]]::float8[]); select matrix_multiply(ARRAY[[1,2]]::float4[], ARRAY[[1],[2]]::numeric[]); select matrix_multiply(ARRAY[[1,2]]::float8[], ARRAY[[1],[2]]::int2[]); select matrix_multiply(ARRAY[[1,2]]::float8[], ARRAY[[1],[2]]::int4[]); select matrix_multiply(ARRAY[[1,2]]::float8[], ARRAY[[1],[2]]::int8[]); select matrix_multiply(ARRAY[[1,2]]::float8[], ARRAY[[1],[2]]::float4[]); select matrix_multiply(ARRAY[[1,2]]::float8[], ARRAY[[1],[2]]::float8[]); select matrix_multiply(ARRAY[[1,2]]::float8[], ARRAY[[1],[2]]::numeric[]); select matrix_multiply(ARRAY[[1,2]]::numeric[], ARRAY[[1],[2]]::int2[]); select matrix_multiply(ARRAY[[1,2]]::numeric[], ARRAY[[1],[2]]::int4[]); select matrix_multiply(ARRAY[[1,2]]::numeric[], ARRAY[[1],[2]]::int8[]); select matrix_multiply(ARRAY[[1,2]]::numeric[], ARRAY[[1],[2]]::float4[]); select matrix_multiply(ARRAY[[1,2]]::numeric[], ARRAY[[1],[2]]::float8[]); select matrix_multiply(ARRAY[[1,2]]::numeric[], ARRAY[[1],[2]]::numeric[]); -- Matrix multiply array[x][m] * scalar select matrix_multiply(ARRAY[[1,2]]::int2[], 5::int2); select matrix_multiply(ARRAY[[1,2]]::int2[], 5::int4); select matrix_multiply(ARRAY[[1,2]]::int2[], 5::int8); select matrix_multiply(ARRAY[[1,2]]::int2[], 5::float4); select matrix_multiply(ARRAY[[1,2]]::int2[], 5::float8); select matrix_multiply(ARRAY[[1,2]]::int2[], 5::numeric); select matrix_multiply(ARRAY[[1,2]]::int4[], 5::int2); select matrix_multiply(ARRAY[[1,2]]::int4[], 5::int4); select matrix_multiply(ARRAY[[1,2]]::int4[], 5::int8); select matrix_multiply(ARRAY[[1,2]]::int4[], 5::float4); select matrix_multiply(ARRAY[[1,2]]::int4[], 5::float8); select matrix_multiply(ARRAY[[1,2]]::int4[], 5::numeric); select matrix_multiply(ARRAY[[1,2]]::int8[], 5::int2); select matrix_multiply(ARRAY[[1,2]]::int8[], 5::int4); select matrix_multiply(ARRAY[[1,2]]::int8[], 5::int8); select matrix_multiply(ARRAY[[1,2]]::int8[], 5::float4); select matrix_multiply(ARRAY[[1,2]]::int8[], 5::float8); select matrix_multiply(ARRAY[[1,2]]::int8[], 5::numeric); select matrix_multiply(ARRAY[[1,2]]::float4[], 5::int2); select matrix_multiply(ARRAY[[1,2]]::float4[], 5::int4); select matrix_multiply(ARRAY[[1,2]]::float4[], 5::int8); select matrix_multiply(ARRAY[[1,2]]::float4[], 5::float4); select matrix_multiply(ARRAY[[1,2]]::float4[], 5::float8); select matrix_multiply(ARRAY[[1,2]]::float4[], 5::numeric); select matrix_multiply(ARRAY[[1,2]]::float8[], 5::int2); select matrix_multiply(ARRAY[[1,2]]::float8[], 5::int4); select matrix_multiply(ARRAY[[1,2]]::float8[], 5::int8); select matrix_multiply(ARRAY[[1,2]]::float8[], 5::float4); select matrix_multiply(ARRAY[[1,2]]::float8[], 5::float8); select matrix_multiply(ARRAY[[1,2]]::float8[], 5::numeric); select matrix_multiply(ARRAY[[1,2]]::numeric[], 5::int2); select matrix_multiply(ARRAY[[1,2]]::numeric[], 5::int4); select matrix_multiply(ARRAY[[1,2]]::numeric[], 5::int8); select matrix_multiply(ARRAY[[1,2]]::numeric[], 5::float4); select matrix_multiply(ARRAY[[1,2]]::numeric[], 5::float8); select matrix_multiply(ARRAY[[1,2]]::numeric[], 5::numeric); -- matrix add array[] + array[] select matrix_add(ARRAY[[1,2]]::int2[], ARRAY[[1,2]]::int2[]); select matrix_add(ARRAY[[1,2]]::int2[], ARRAY[[1,2]]::int4[]); select matrix_add(ARRAY[[1,2]]::int2[], ARRAY[[1,2]]::int8[]); select matrix_add(ARRAY[[1,2]]::int2[], ARRAY[[1,2]]::float4[]); select matrix_add(ARRAY[[1,2]]::int2[], ARRAY[[1,2]]::float8[]); select matrix_add(ARRAY[[1,2]]::int2[], ARRAY[[1,2]]::numeric[]); select matrix_add(ARRAY[[1,2]]::int4[], ARRAY[[1,2]]::int2[]); select matrix_add(ARRAY[[1,2]]::int4[], ARRAY[[1,2]]::int4[]); select matrix_add(ARRAY[[1,2]]::int4[], ARRAY[[1,2]]::int8[]); select matrix_add(ARRAY[[1,2]]::int4[], ARRAY[[1,2]]::float4[]); select matrix_add(ARRAY[[1,2]]::int4[], ARRAY[[1,2]]::float8[]); select matrix_add(ARRAY[[1,2]]::int4[], ARRAY[[1,2]]::numeric[]); select matrix_add(ARRAY[[1,2]]::int8[], ARRAY[[1,2]]::int2[]); select matrix_add(ARRAY[[1,2]]::int8[], ARRAY[[1,2]]::int4[]); select matrix_add(ARRAY[[1,2]]::int8[], ARRAY[[1,2]]::int8[]); select matrix_add(ARRAY[[1,2]]::int8[], ARRAY[[1,2]]::float4[]); select matrix_add(ARRAY[[1,2]]::int8[], ARRAY[[1,2]]::float8[]); select matrix_add(ARRAY[[1,2]]::int8[], ARRAY[[1,2]]::numeric[]); select matrix_add(ARRAY[[1,2]]::float4[], ARRAY[[1,2]]::int2[]); select matrix_add(ARRAY[[1,2]]::float4[], ARRAY[[1,2]]::int4[]); select matrix_add(ARRAY[[1,2]]::float4[], ARRAY[[1,2]]::int8[]); select matrix_add(ARRAY[[1,2]]::float4[], ARRAY[[1,2]]::float4[]); select matrix_add(ARRAY[[1,2]]::float4[], ARRAY[[1,2]]::float8[]); select matrix_add(ARRAY[[1,2]]::float4[], ARRAY[[1,2]]::numeric[]); select matrix_add(ARRAY[[1,2]]::float8[], ARRAY[[1,2]]::int2[]); select matrix_add(ARRAY[[1,2]]::float8[], ARRAY[[1,2]]::int4[]); select matrix_add(ARRAY[[1,2]]::float8[], ARRAY[[1,2]]::int8[]); select matrix_add(ARRAY[[1,2]]::float8[], ARRAY[[1,2]]::float4[]); select matrix_add(ARRAY[[1,2]]::float8[], ARRAY[[1,2]]::float8[]); select matrix_add(ARRAY[[1,2]]::float8[], ARRAY[[1,2]]::numeric[]); select matrix_add(ARRAY[[1,2]]::numeric[], ARRAY[[1,2]]::int2[]); select matrix_add(ARRAY[[1,2]]::numeric[], ARRAY[[1,2]]::int4[]); select matrix_add(ARRAY[[1,2]]::numeric[], ARRAY[[1,2]]::int8[]); select matrix_add(ARRAY[[1,2]]::numeric[], ARRAY[[1,2]]::float4[]); select matrix_add(ARRAY[[1,2]]::numeric[], ARRAY[[1,2]]::float8[]); select matrix_add(ARRAY[[1,2]]::numeric[], ARRAY[[1,2]]::numeric[]); create table dtype (tint2 int2[], tint4 int4[], tint8 int8[], tfloat4 float4[], tfloat8 float8[], tnumeric numeric[]) Distributed randomly; insert into dtype values( array[1, 2, 3], array[1, 2, 3], array[1, 2, 3], array[1.1, 2.2, 3.3], array[1.1, 2.2, 3.3], array[1.1, 2.2, 3.3] ); insert into dtype values( array[5, 4, 3], array[5, 4, 3], array[5, 4, 3], array[5.1, 4.2, 3.3], array[5.1, 4.2, 3.3], array[5.1, 4.2, 3.3] ); select sum(tint2) from dtype; select sum(tint4) from dtype; select sum(tint8) from dtype; select sum(tfloat4) from dtype; select sum(tfloat8) from dtype; select sum(tnumeric) from dtype; -- should be able to handle null values during sumation insert into dtype values(null, null, null, null, null, null); select sum(tint2) from dtype; select sum(tint4) from dtype; select sum(tint8) from dtype; select sum(tfloat4) from dtype; select sum(tfloat8) from dtype; select sum(tnumeric) from dtype; -- these should fail, but tell us what the return type of sum() was select sum(tint2)::boolean[] from dtype; -- bigint[] select sum(tint4)::boolean[] from dtype; -- bigint[] select sum(tint8)::boolean[] from dtype; -- bigint[] select sum(tfloat4)::boolean[] from dtype; -- float8[] select sum(tfloat8)::boolean[] from dtype; -- float8[] select sum(tnumeric)::boolean[] from dtype; -- float8[] -- What would normal sum do? select sum(tint2[1])::boolean from dtype; -- bigint select sum(tint4[1])::boolean from dtype; -- bigint select sum(tint8[1])::boolean from dtype; -- numeric (bigint above) select sum(tfloat4[1])::boolean from dtype; -- float4 (float8 above) select sum(tfloat8[1])::boolean from dtype; -- float8 select sum(tnumeric[1])::boolean from dtype; -- numeric -- Matrix inversion select pinv(array[[1,-1,3],[2,1,2],[-2,-2,1]])::numeric(10,8)[] as pinv; select pinv(array[[1,-1],[2,1],[-2,-2]])::numeric(10,8)[] as pinv; select pinv(array[[1,-1,3],[2,1,2]])::numeric(10,8)[] as pinv; select pinv(array[[1,-1,3],[2,1,2],[-2,-2,1]])::numeric(10,8)[] as pinv; -- Matrix inversion with oddly shaped matrixes select pinv(array[[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101]])::numeric(10,8)[] as pinv; select pinv(array[[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[ 19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],[32],[33],[34],[ 35],[36],[37],[38],[39],[40],[41],[42],[43],[44],[45],[46],[47],[48],[49],[50],[ 51],[52],[53],[54],[55],[56],[57],[58],[59],[60],[61],[62],[63],[64],[65],[66],[ 67],[68],[69],[70],[71],[72],[73],[74],[75],[76],[77],[78],[79],[80],[81],[82],[ 83],[84],[85],[86],[87],[88],[89],[90],[91],[92],[93],[94],[95],[96],[97],[98],[ 99],[100],[101]])::numeric(10,8)[] as pinv; -- Null matrix select pinv(array[[0,0,0], [0,0,0], [0,0,0]]) as pinv; -- Ensure that AA' = A'A select matrix_multiply(array[[1,-1,3],[2,1,2],[-2,-2,1]], pinv(array[[1,-1,3],[2,1,2],[-2,-2,1]]))::numeric(10,8)[] as "AA'"; select matrix_multiply(pinv(array[[1,-1,3],[2,1,2],[-2,-2,1]]), array[[1,-1,3],[2,1,2],[-2,-2,1]])::numeric(10,8)[] as "A'A"; select matrix_multiply(pinv(array[['1.0e+308'::float8,0,0],[0, 1, 1]]), array[['1.0e+308'::float8,0,0],[0, 1, 1]]) as "A'A"; drop table dtype; -- Check overflow --SMALLINT: [-32768, 32767] select matrix_add(array[32767]::smallint[], array[1]::smallint[]); --overflow select matrix_add(array[32766]::smallint[], array[1]::smallint[]); --no overflow select matrix_add(array[-32768]::smallint[], array[-1]::smallint[]); --overflow select matrix_add(array[-32767]::smallint[], array[-1]::smallint[]); --no overflow -- Check overflow --INT: [-2147483648, 2147483647] select matrix_add(array[2147483647]::int[], array[1]::int[]); --overflow select matrix_add(array[2147483646]::int[], array[1]::int[]); --no overflow select matrix_add(array[-2147483648]::int[], array[-1]::int[]); --overflow select matrix_add(array[-2147483647]::int[], array[-1]::int[]); --no overflow -- Check overflow --BIGINT: [-9223372036854775808, 9223372036854775807] select matrix_add(array[9223372036854775807]::bigint[], array[1]::bigint[]); --overflow select matrix_add(array[9223372036854775806]::bigint[], array[1]::int[]); --no overflow select matrix_add(array[-9223372036854775808]::bigint[], array[-1]::bigint[]); --overflow select matrix_add(array[-9223372036854775807]::bigint[], array[-1]::int[]); --no overflow -- Matrix_multiply will promote result to int64 or float8 automatically select matrix_multiply(array[array[9223372036854775807/3]]::bigint[], array[array[4]]::bigint[]); --overflow select matrix_multiply(array[array[-9223372036854775808]]::bigint[], array[array[-1]]::bigint[]); --overflow select matrix_multiply(array[array[10e200], array[10e200]]::float8[], array[array[10e200]]::float8[]); --overflow
the_stack
-- 2017-09-03T11:46:03.761 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Nr.',Updated=TO_TIMESTAMP('2017-09-03 11:46:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3424 ; -- 2017-09-03T11:46:19.794 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Datum',Updated=TO_TIMESTAMP('2017-09-03 11:46:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3435 ; -- 2017-09-03T11:46:59.514 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Status',Updated=TO_TIMESTAMP('2017-09-03 11:46:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3425 ; -- 2017-09-03T11:47:06.073 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-03 11:47:06','YYYY-MM-DD HH24:MI:SS'),Name='Status' WHERE AD_Field_ID=3425 AND AD_Language='en_US' ; -- 2017-09-03T11:49:49.658 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=50,Updated=TO_TIMESTAMP('2017-09-03 11:49:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547099 ; -- 2017-09-03T11:49:55.999 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=60,Updated=TO_TIMESTAMP('2017-09-03 11:49:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547100 ; -- 2017-09-03T11:50:00.455 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_ElementGroup WHERE AD_UI_ElementGroup_ID=540931 ; -- 2017-09-03T11:50:08.056 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=70,Updated=TO_TIMESTAMP('2017-09-03 11:50:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541231 ; -- 2017-09-03T11:50:13.494 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=80,Updated=TO_TIMESTAMP('2017-09-03 11:50:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547101 ; -- 2017-09-03T11:50:18.238 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=90,Updated=TO_TIMESTAMP('2017-09-03 11:50:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547102 ; -- 2017-09-03T11:50:22.789 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_ElementGroup WHERE AD_UI_ElementGroup_ID=540932 ; -- 2017-09-03T11:50:59.651 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=100,Updated=TO_TIMESTAMP('2017-09-03 11:50:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541239 ; -- 2017-09-03T11:51:04.349 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=110,Updated=TO_TIMESTAMP('2017-09-03 11:51:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541259 ; -- 2017-09-03T11:51:08.706 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=120,Updated=TO_TIMESTAMP('2017-09-03 11:51:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541249 ; -- 2017-09-03T11:51:13.251 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=130,Updated=TO_TIMESTAMP('2017-09-03 11:51:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541248 ; -- 2017-09-03T11:51:18.529 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=140,Updated=TO_TIMESTAMP('2017-09-03 11:51:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541247 ; -- 2017-09-03T11:51:24.184 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=150,Updated=TO_TIMESTAMP('2017-09-03 11:51:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541246 ; -- 2017-09-03T11:51:28.711 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=160,Updated=TO_TIMESTAMP('2017-09-03 11:51:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541238 ; -- 2017-09-03T11:51:33.458 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=170,Updated=TO_TIMESTAMP('2017-09-03 11:51:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541244 ; -- 2017-09-03T11:51:37.775 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=180,Updated=TO_TIMESTAMP('2017-09-03 11:51:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541241 ; -- 2017-09-03T11:51:43.040 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=190,Updated=TO_TIMESTAMP('2017-09-03 11:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541243 ; -- 2017-09-03T11:51:47.815 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=200,Updated=TO_TIMESTAMP('2017-09-03 11:51:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541233 ; -- 2017-09-03T11:51:52.145 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=210,Updated=TO_TIMESTAMP('2017-09-03 11:51:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541235 ; -- 2017-09-03T11:51:56.548 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=220,Updated=TO_TIMESTAMP('2017-09-03 11:51:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541242 ; -- 2017-09-03T11:52:00.758 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=230,Updated=TO_TIMESTAMP('2017-09-03 11:52:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547105 ; -- 2017-09-03T11:52:04.981 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=240,Updated=TO_TIMESTAMP('2017-09-03 11:52:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547106 ; -- 2017-09-03T11:52:09.614 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=250,Updated=TO_TIMESTAMP('2017-09-03 11:52:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547107 ; -- 2017-09-03T11:52:13.829 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=260,Updated=TO_TIMESTAMP('2017-09-03 11:52:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547108 ; -- 2017-09-03T11:52:17.707 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=270,Updated=TO_TIMESTAMP('2017-09-03 11:52:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547109 ; -- 2017-09-03T11:52:22.077 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540961, SeqNo=280,Updated=TO_TIMESTAMP('2017-09-03 11:52:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547111 ; -- 2017-09-03T11:52:28.671 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_ElementGroup WHERE AD_UI_ElementGroup_ID=540933 ; -- 2017-09-03T11:52:38.022 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET Name='advanced edit', SeqNo=10,Updated=TO_TIMESTAMP('2017-09-03 11:52:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540961 ; -- 2017-09-03T11:57:34.563 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='N', IsDisplayed='N',Updated=TO_TIMESTAMP('2017-09-03 11:57:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547101 ; -- 2017-09-03T11:57:47.504 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='N', IsDisplayed='N',Updated=TO_TIMESTAMP('2017-09-03 11:57:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541231 ; -- 2017-09-03T11:58:27.062 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='N', IsDisplayed='N',Updated=TO_TIMESTAMP('2017-09-03 11:58:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541259 ; -- 2017-09-03T11:59:21.706 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='N', IsDisplayed='N',Updated=TO_TIMESTAMP('2017-09-03 11:59:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547102 ; -- 2017-09-03T12:08:59.038 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547082 ; -- 2017-09-03T12:08:59.040 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547084 ; -- 2017-09-03T12:08:59.042 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547085 ; -- 2017-09-03T12:08:59.044 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547091 ; -- 2017-09-03T12:08:59.045 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547090 ; -- 2017-09-03T12:08:59.046 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547086 ; -- 2017-09-03T12:08:59.048 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547087 ; -- 2017-09-03T12:08:59.049 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547092 ; -- 2017-09-03T12:08:59.050 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547088 ; -- 2017-09-03T12:08:59.052 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547089 ; -- 2017-09-03T12:08:59.053 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547095 ; -- 2017-09-03T12:08:59.054 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547093 ; -- 2017-09-03T12:08:59.055 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547097 ; -- 2017-09-03T12:08:59.057 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547096 ; -- 2017-09-03T12:08:59.058 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547094 ; -- 2017-09-03T12:08:59.060 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=160,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547098 ; -- 2017-09-03T12:08:59.061 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=170,Updated=TO_TIMESTAMP('2017-09-03 12:08:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547083 ; -- 2017-09-03T12:09:34.605 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Rabatt %',Updated=TO_TIMESTAMP('2017-09-03 12:09:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547095 ; -- 2017-09-03T12:09:36.948 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Zeilennetto',Updated=TO_TIMESTAMP('2017-09-03 12:09:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547097 ; -- 2017-09-03T12:13:13.666 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-09-03 12:13:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547084 ; -- 2017-09-03T12:13:16.054 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-09-03 12:13:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547085 ; -- 2017-09-03T12:13:17.951 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-09-03 12:13:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547091 ; -- 2017-09-03T12:13:21.440 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-09-03 12:13:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547090 ; -- 2017-09-03T12:13:23.246 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-09-03 12:13:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547086 ; -- 2017-09-03T12:13:24.921 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-09-03 12:13:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547087 ; -- 2017-09-03T12:13:26.685 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-09-03 12:13:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547092 ; -- 2017-09-03T12:13:28.389 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-09-03 12:13:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547088 ; -- 2017-09-03T12:13:30.563 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-09-03 12:13:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547089 ; -- 2017-09-03T12:13:32.711 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-09-03 12:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547095 ; -- 2017-09-03T12:13:36.221 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=130,Updated=TO_TIMESTAMP('2017-09-03 12:13:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547097 ; -- 2017-09-03T12:13:38.639 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=140,Updated=TO_TIMESTAMP('2017-09-03 12:13:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547096 ; -- 2017-09-03T12:13:40.774 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=150,Updated=TO_TIMESTAMP('2017-09-03 12:13:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547094 ; -- 2017-09-03T12:13:42.605 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=160,Updated=TO_TIMESTAMP('2017-09-03 12:13:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547098 ; -- 2017-09-03T12:13:46.621 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=170,Updated=TO_TIMESTAMP('2017-09-03 12:13:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547083 ; -- 2017-09-03T12:13:55.219 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,3409,0,293,540927,548022,TO_TIMESTAMP('2017-09-03 12:13:55','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',180,0,0,TO_TIMESTAMP('2017-09-03 12:13:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-09-03T12:14:04.568 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,3400,0,293,540927,548023,TO_TIMESTAMP('2017-09-03 12:14:04','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',190,0,0,TO_TIMESTAMP('2017-09-03 12:14:04','YYYY-MM-DD HH24:MI:SS'),100) ;
the_stack
-- 注意:写的时候因为要确保自动导入成功,每一行必须以分号结尾,如: -- INSERT INTO `user` (`uid`, `name`) VALUES (NULL, '杭州跃迁科技有限公司')/*密码是123456*/; -- 而不是:INSERT INTO `user` (`uid`, `name`) VALUES (NULL, '杭州跃迁科技有限公司');/*密码是123456*/ ; -- NOTE: -- 正式部署的时候建议删掉下面这句话:(因为意义不明) SET NAMES utf8; -- ; CREATE USER 'databasename'@'localhost' IDENTIFIED BY 'databasepwd'; GRANT USAGE ON *.* TO 'databasename'@'localhost' IDENTIFIED BY 'databasepwd' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; -- CREATE DATABASE IF NOT EXISTS `databasename`; CREATE DATABASE IF NOT EXISTS `databasename` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON `databasename`.* TO 'databasename'@'localhost'; use databasename; /*用户表*/ DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `uid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',/*TODO:是否不够?*/ `sn` char(20) NOT NULL DEFAULT '' COMMENT 'sn', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid',/*是创建者的话该项为创建者本身uid*/ /** * 1.默认为创建者手机号。 * 2.为创建者的时候是公司用户名,不是的时候是公司用户名+用户名 * 3.公司用户名禁止人工注册为11位纯数字 * 4.创建者修改公司用户名的时候记得要把所有下属的shop_name字段改掉 */`shop_name` char(45) not null DEFAULT '' COMMENT '公司用户名', `admin_mobile` char(30) NOT NULL DEFAULT '' COMMENT '创建者手机',/*为创建者的时候是创建者手机(与mobile同步),不是的时候是创建者手机+用户名*/ `username` char(15) NOT NULL DEFAULT '' COMMENT '用户名',/*为创建者时跟admin_mobile、mobile同步,不是创建者时是自己的用户名*/ `mobile` char(15) NOT NULL DEFAULT '' COMMENT '用户手机',/*为创建者时跟admin_mobile、username同步,不是创建者时是自己的手机号*/ `password` char(32) NOT NULL DEFAULT '' COMMENT '密码', `email` char(200) NOT NULL DEFAULT '' COMMENT '用户邮箱', `name` char(32) NOT NULL DEFAULT '未填用户名' COMMENT '姓名', `rpg` tinyint(4) not null DEFAULT 0 COMMENT '用户角色', `qq` char(32) NOT NULL DEFAULT '' COMMENT 'QQ', `invitated_code` char(32) NOT NULL DEFAULT '' COMMENT '被谁邀请', `invitation_code` char(32) NOT NULL DEFAULT '' COMMENT '邀请码', `depart_id` int(20) unsigned NOT NULL DEFAULT 0 COMMENT '所在部门ID', -- 企业信息 `industry` char(100) NOT NULL DEFAULT '' COMMENT '行业', `province` char(32) NOT NULL DEFAULT '请选择' COMMENT '省', `city` char(32) NOT NULL DEFAULT '请选择' COMMENT '市', `TODAY_HISTORY_CONFIG` varchar(500) NOT NULL DEFAULT '' COMMENT '今日经营历史的过滤器配置',/*TODO:够么?*/ `GTClientID` char(32) NOT NULL DEFAULT '' COMMENT '个推的ClientID', `session_id` char(32) NOT NULL DEFAULT '' COMMENT '最后一个登陆的session_id', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '注册时间', `reg_ip` varchar(100) NOT NULL DEFAULT '' COMMENT '注册IP', `last_login_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最后登录时间', `last_login_ip` varchar(100) NOT NULL DEFAULT '' COMMENT '最后登录IP', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `status` tinyint(4) not null DEFAULT 0 COMMENT '用户状态', `login_count` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '用户登录次数计数', `option_array` text NOT NULL DEFAULT '' COMMENT '用户选项数组', `outer_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'faceset标识', PRIMARY KEY (`uid`), UNIQUE KEY `admin_mobile` (`admin_mobile`), UNIQUE KEY `shop_name` (`shop_name`), KEY `admin_uid` (`admin_uid`), KEY `status` (`status`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='用户表'; /*配置表,一行一个企业的配置*/ DROP TABLE IF EXISTS `config`; CREATE TABLE `config` ( `config_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '配置ID', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `MAX_LIMIT_EMPLOYEE` int(10) unsigned not null DEFAULT 2 COMMENT '员工数量', `lock_shop_token` char(150) NOT NULL DEFAULT '' COMMENT '锁店时的token', /*流程模式*/ `order_flow_mode` boolean not null DEFAULT 0 COMMENT '单据流模式,true-开启,false-不开启', `audit_flow_mode` boolean not null DEFAULT 0 COMMENT '审核模式,true-开启,false-不开启', `DELETE_ORDER_ALLOW_STATUS` tinyint(4) not null DEFAULT 2 COMMENT '删除订单所允许的操作状态模式',/*1-状态8/10可以删除订单,2-状态8/10不能删除订单*/ -- 对于下面的跳过选项:true跳过,false不跳 `ck_jump_warehouseConfirm` boolean not null DEFAULT 0 COMMENT '出库类单据是否跳过库管确认收到动作', `ck_jump_warehouOut` boolean not null DEFAULT 0 COMMENT '出库类单据是否跳过出库动作', `ck_jump_deliver` boolean not null DEFAULT 0 COMMENT '出库类单据是否跳过送达动作', `rk_jump_warehouseConfirm` boolean not null DEFAULT 0 COMMENT '入库类单据是否跳过库管确认收到动作', `rk_jump_deliver` boolean not null DEFAULT 0 COMMENT '入库类单据是否跳过入库动作', `is_show_foreground_printer_button` boolean not null DEFAULT 0 COMMENT '是否显示前台打印按钮', `finance_mode` boolean not NULL DEFAULT 1 COMMENT '财务与老板是否为同一人', -- sn `USN` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'user_sn', `SKU` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'sku_sn', `PAD` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '停车位置', `CSN` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '往来单位', `OXC` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '销售单', `OXT` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '销售退货单', `OCR` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '采购单', `OCT` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '采购退货单', `FSK` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '收款单', `FFK` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '付款单', `FQS` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '其他收入', `FFY` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '费用单', `WPD` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '盘点单', /* `WPR` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '平价调拨单', `WPA` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '变价调拨单',*/ `WRN` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '调拨单', `DRA` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '草稿单', `AAR` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '应收款调整', `AAP` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '应付款调整', `STO` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '仓库编号', `AOC` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '账户操作码', `FIS` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '财政收入单', `FES` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '财政支出单', `FCO` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '财政提现单', `FTF` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '财政转账单', `ASN` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'account_sn', `PIO` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '填补单', PRIMARY KEY (`config_id`), UNIQUE KEY `admin_uid` (`admin_uid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='配置表'; -- ================================商品相关Start======================================================= DROP TABLE IF EXISTS `sku`; DROP TABLE IF EXISTS `spu`; DROP TABLE IF EXISTS `cat`; DROP TABLE IF EXISTS `storage`; /*商品分类表*/; CREATE TABLE `cat` ( `cat_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'cat_id', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `cat_name` char(20) NOT NULL DEFAULT '未分类' COMMENT '所属类别名称', `cat_class` int(3) NOT NULL DEFAULT '0' COMMENT '类别的来源(财务类别或是商品类别)', `cat_index` int(5) unsigned NOT NULL DEFAULT 0 COMMENT 'cat显示顺序,一个正整数,数字越小,显示越靠前,1是最前', `status` tinyint(4) not null DEFAULT 1 COMMENT '状态',/*1是开启,0为未启用*/ `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`cat_id`), UNIQUE INDEX `adminUid_catName` (`admin_uid`, `cat_name`) USING HASH, KEY `admin_uid` (`admin_uid`), KEY `status` (`status`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='商品分类表'; /*商品spu表*/; CREATE TABLE `spu` ( `spu_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'spu_id', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `cat_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属类别id',/*0为未分类*/ `spu_name` char(50) NOT NULL DEFAULT '' COMMENT '商品名称(spu)', `spu_index` int(5) unsigned NOT NULL DEFAULT 0 COMMENT '商品spu显示顺序,一个正整数,数字越小,显示越靠前,1是最前', `spu_class` int(3) NOT NULL DEFAULT '0' COMMENT '类别的来源(财务类别或是商品类别)', `qcode` char(50) NOT NULL DEFAULT '' COMMENT '速查编码',/*精确到spu*/ `status` tinyint(4) not null DEFAULT 1 COMMENT '状态,未使用',/*1是开启,0为未启用*/ `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`spu_id`), UNIQUE INDEX `adminUid_spuName` (`admin_uid`, `spu_name`) USING HASH, KEY `admin_uid` (`admin_uid`), KEY `status` (`status`), constraint FK_SPU_cat_id foreign key (cat_id) references cat(cat_id) on delete cascade on update cascade ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='商品spu表'; /*storage 仓库表*/ CREATE TABLE `storage` ( `sto_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `sn`char(20) NOT NULL DEFAULT '' COMMENT '仓库编号', `sto_name` char(80) NOT NULL DEFAULT '' COMMENT '仓库名称', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属店铺uid', `sto_index` tinyint(5) unsigned NOT NULL DEFAULT 2 COMMENT 'storage显示顺序,一个正整数,数字越小,显示越靠前', `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态',/*1是开启,0为未启用*/ `remark` text NOT NULL DEFAULT '' COMMENT '备注', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`sto_id`), UNIQUE INDEX `adminUid_sn` (`admin_uid`, `sn`) USING HASH, KEY `admin_uid` (`admin_uid`), KEY `status` (`status`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='仓库表'; /*商品sku表*/ CREATE TABLE `sku` ( `sku_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'sku_id', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `sn` char(20) NOT NULL DEFAULT '' COMMENT 'sn', -- spu表冗余信息 `spu_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '商品(SPU)名称id', `spu_name` char(50) NOT NULL DEFAULT '' COMMENT '商品名称(spu)', `spu_index` int(5) unsigned NOT NULL DEFAULT 0 COMMENT '商品spu显示顺序,一个正整数,数字越小,显示越靠前,1是最前', `qcode` char(50) NOT NULL DEFAULT '' COMMENT '速查编码',/*精确到spu*/ `spu_status` tinyint(4) not null DEFAULT '1' COMMENT '状态',/*1是开启,0为未启用*/ -- cat表冗余信息 `cat_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属类别id',/*0为未分类*/ `cat_name` char(20) NOT NULL DEFAULT '未分类' COMMENT '所属类别名称', `cat_index` int(5) unsigned NOT NULL DEFAULT 0 COMMENT 'cat显示顺序', `cat_status` tinyint(4) not null DEFAULT '1' COMMENT '状态',/*1是开启,0为未启用*/ -- sku自带信息 `spec_name` char(50) NOT NULL DEFAULT '默认' COMMENT '规格名称', `total_stock` double NOT NULL DEFAULT 0 COMMENT '总库存数量', -- `unit_price` double NOT NULL DEFAULT 0 COMMENT '库存产品的成本(单价)', `last_selling_price` double NOT NULL DEFAULT 0 COMMENT '该sku的最后卖出价', `sku_index` int(5) unsigned NOT NULL DEFAULT 0 COMMENT '商品sku显示顺序,一个正整数,数字越小,显示越靠前,1是最前', `sku_class` int(3) NOT NULL DEFAULT '0' COMMENT '类别的来源(商品类别或是财务类别)', `status` tinyint(4) not null DEFAULT 1 COMMENT '状态',/*1是开启,0为未启用*/ `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最后更新时间', PRIMARY KEY (`sku_id`), UNIQUE INDEX `adminUid_sn` (`admin_uid`, `sn`) USING HASH, UNIQUE INDEX `adminUid_spuId_specName` (`admin_uid`, `spu_id`,`spec_name`) USING HASH, KEY `admin_uid` (`admin_uid`), KEY `status` (`status`), constraint FK_SKU_spu_id foreign key (spu_id) references spu(spu_id) on delete cascade on update cascade, constraint FK_SKU_cat_id foreign key (cat_id) references cat(cat_id) on delete cascade on update cascade ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='商品sku表'; -- ================================商品相关Over======================================================= -- ================================往来单位相关Start======================================================= /*往来单位表*/ DROP TABLE IF EXISTS `carlicense`; DROP TABLE IF EXISTS `phonenum`; DROP TABLE IF EXISTS `contact`; DROP TABLE IF EXISTS `company`; CREATE TABLE `company` ( `cid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `sn` char(20) NOT NULL DEFAULT '' COMMENT 'sn', `name` char(45) not null DEFAULT '' COMMENT '单位名称', `qcode` char(50) NOT NULL DEFAULT '' COMMENT '速查编码', `address` char(60) NOT NULL DEFAULT '' COMMENT '地址', `remark` text NOT NULL DEFAULT '' COMMENT '备注',/*TODO:够么?*/ `balance` double NOT NULL DEFAULT 0 COMMENT '结余(应付-应收),负数是别人欠店主,正数是店主欠别人', `status` tinyint(4) not null DEFAULT 1 COMMENT '状态,是否启用', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `lock_version` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '乐观锁',/*TODO:对么!?*/ `image_url` varchar(600) NOT NULL DEFAULT ' ' COMMENT '照片URL', `visit_times` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '进店次数', `purchase_times` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '购买次数', PRIMARY KEY (`cid`), UNIQUE INDEX `adminUid_companyName` (`admin_uid`, `name`) USING HASH, UNIQUE INDEX `adminUid_sn` (`admin_uid`, `sn`) USING HASH, KEY `admin_uid` (`admin_uid`), KEY `status` (`status`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='往来单位表'; /*联系人表*/ CREATE TABLE `contact` ( `contact_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '联系人ID', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `cid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的cid', `contact_name` char(45) not null DEFAULT '' COMMENT '联系人名称', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`contact_id`), constraint FK_CONTACT_cid foreign key (cid) references company(cid) on delete cascade on update cascade, KEY `admin_uid` (`admin_uid`), KEY `cid` (`cid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='联系人表'; /*电话表*/ CREATE TABLE `phonenum` ( `phonenum_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '联系人ID', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `cid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的cid', `contact_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的contact_id', `mobile` char(25) NOT NULL DEFAULT '' COMMENT '电话', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`phonenum_id`), constraint FK_PHONENUM_cid foreign key (cid) references company(cid) on delete cascade on update cascade, constraint FK_PHONENUM_contact_id foreign key (contact_id) references contact(contact_id) on delete cascade on update cascade, KEY `admin_uid` (`admin_uid`), KEY `cid` (`cid`), KEY `contact_id` (`contact_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='电话表'; /*车牌表*/ CREATE TABLE `carlicense` ( `carlicense_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '车牌号ID', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `cid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的cid', `contact_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的contact_id', `car_license` char(30) NOT NULL DEFAULT '' COMMENT '车牌号', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`carlicense_id`), constraint FK_CARLICENSE_cid foreign key (cid) references company(cid) on delete cascade on update cascade, constraint FK_CARLICENSE_contact_id foreign key (contact_id) references contact(contact_id) on delete cascade on update cascade, KEY `admin_uid` (`admin_uid`), KEY `cid` (`cid`), KEY `contact_id` (`contact_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='车牌表'; -- ================================往来单位相关End======================================================= /*停车位置表*/ DROP TABLE IF EXISTS `parkaddress`; CREATE TABLE `parkaddress` ( `parkaddress_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '停车位置ID', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `sn` char(20) NOT NULL DEFAULT '' COMMENT 'sn', `park_address` varchar(500) NOT NULL DEFAULT '' COMMENT '停车位置', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`parkaddress_id`), UNIQUE INDEX `adminUid_sn` (`admin_uid`, `sn`) USING HASH, KEY `admin_uid` (`admin_uid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='停车位置表'; /*订单表*/ DROP TABLE IF EXISTS `order`; CREATE TABLE `order` ( -- common `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `class` tinyint(3) not null DEFAULT 1 COMMENT '单据类别', `value` double NOT NULL DEFAULT 0 COMMENT '货物价值(订单实际价值)', `remark` text NOT NULL DEFAULT '' COMMENT '备注',/*TODO:够么?*/ `operator_uid` int(10) unsigned NOT NULL COMMENT '开单人uid', `operator_name` char(16) NOT NULL DEFAULT '未填写' COMMENT '开单人姓名,是冗余的,只存第一遍,之后不更改', `history` mediumtext NOT NULL DEFAULT '' COMMENT '操作记录',/*TODO:10000条操作记录,够么?*/ `status` tinyint(3) not null DEFAULT 1 COMMENT '状态', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最后更新时间', `cart` text NOT NULL COMMENT '购物车',/*50个sku:80*300,TODO:够么?*/ `isdeliver` tinyint(4) not null DEFAULT 1 COMMENT '是否送货 1-送货 0-不送货', `freight` double NOT NULL DEFAULT 0 COMMENT '运费', `freight_received` double NOT NULL DEFAULT 0 COMMENT '代付已收运费', `is_calculated` int NOT NULL DEFAULT 0 COMMENT '1为计入成本,0为不计入成本', `freight_cal_method` int NOT NULL DEFAULT 0 COMMENT '运费计算方式 1- 按数量 2-按金额 不计入成本时默认为0', -- order和finance共同字段 `cid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '往来单位主键', `cid_name` char(45) not null DEFAULT '' COMMENT '单位名称冗余', `off` double NOT NULL DEFAULT 0 COMMENT '优惠', `cash` double NOT NULL DEFAULT 0 COMMENT '现金', `bank` double NOT NULL DEFAULT 0 COMMENT '银行', `online_pay` double NOT NULL DEFAULT 0 COMMENT '在线支付', `income` double NOT NULL DEFAULT 0 COMMENT '实收(现金+银行+在线支付)', `name` char(60) not null DEFAULT '' COMMENT '收入来源名称或费用用途名称', -- order `oid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'oid', `contact_name` char(45) not null DEFAULT '' COMMENT '联系人名称', `mobile` char(25) NOT NULL DEFAULT '' COMMENT '电话', `park_address` varchar(500) NOT NULL DEFAULT '' COMMENT '停车位置', `car_license` char(30) NOT NULL DEFAULT '' COMMENT '车牌号', `warehouse_remark` text NOT NULL DEFAULT '' COMMENT '送货信息备注', `sto_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '仓库id', `receivable` double NOT NULL DEFAULT 0 COMMENT '应收(货物价值-优惠)', `balance` double NOT NULL DEFAULT 0 COMMENT '发生交易的那一刻的本单结余快照(实收-应收)', `remain` double NOT NULL DEFAULT 0 COMMENT '等待客户付款的金额即待收金额,正数为客户欠店铺,负数为店铺欠客户', -- Company里的balance:结余(应付-应收),负数是别人欠店主,正数是店主欠别人 `history_balance` double NOT NULL DEFAULT 0 COMMENT '此前结余', `total_balance` double NOT NULL DEFAULT 0 COMMENT '总结余(此前结余+本单结余)', `leave_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '出库时间', `exceptionNo` tinyint(3) not null DEFAULT 0 COMMENT '异常状态码', `exception` varchar(500) NOT NULL DEFAULT '' COMMENT '异常原因', `GeTuiGet` tinyint(3) not null DEFAULT 0 COMMENT '是否手机端已读', -- warehouse `wid` int(10) unsigned NOT NULL COMMENT 'wid', `num` double NOT NULL DEFAULT 0 COMMENT '变更数量', `check_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '盘点人uid', `check_name` char(16) NOT NULL DEFAULT '未填写' COMMENT '盘点人姓名,是冗余的,只存第一遍,之后不更改', `new_sto_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '新仓库id', -- finance `fid` int(10) unsigned NOT NULL COMMENT 'fid', -- sn `sn` char(20) NOT NULL DEFAULT '' COMMENT 'sn', PRIMARY KEY (`oid`), UNIQUE INDEX `adminUid_sn` (`admin_uid`, `sn`) USING HASH, KEY `admin_uid` (`admin_uid`), KEY `status` (`status`), KEY `remain` (`remain`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='订单表'; /*仓库进出表*/ DROP TABLE IF EXISTS `warehouse`; CREATE TABLE `warehouse` ( -- common `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `class` tinyint(3) not null DEFAULT 1 COMMENT '单据类别', `value` double NOT NULL DEFAULT 0 COMMENT '货物价值(订单实际价值)', `remark` text NOT NULL DEFAULT '' COMMENT '备注',/*TODO:够么?*/ `operator_uid` int(10) unsigned NOT NULL COMMENT '开单人uid', `operator_name` char(16) NOT NULL DEFAULT '未填写' COMMENT '开单人姓名,是冗余的,只存第一遍,之后不更改', `history` mediumtext NOT NULL DEFAULT '' COMMENT '操作记录',/*TODO:10000条操作记录,够么?*/ `status` tinyint(3) not null DEFAULT 1 COMMENT '状态', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最后更新时间', `cart` text NOT NULL COMMENT '购物车',/*50个sku:80*300,TODO:够么?*/ `isdeliver` tinyint(4) not null DEFAULT 1 COMMENT '是否送货 1-送货 0-不送货', `freight` double NOT NULL DEFAULT 0 COMMENT '运费', `freight_received` double NOT NULL DEFAULT 0 COMMENT '代付已收运费', `is_calculated` int NOT NULL DEFAULT 0 COMMENT '1为计入成本,0为不计入成本', `freight_cal_method` int NOT NULL DEFAULT 0 COMMENT '运费计算方式 1- 按数量 2-按金额 不计入成本时默认为0', -- order和finance共同字段 `cid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '往来单位主键', `cid_name` char(45) not null DEFAULT '' COMMENT '单位名称冗余', `off` double NOT NULL DEFAULT 0 COMMENT '优惠', `cash` double NOT NULL DEFAULT 0 COMMENT '现金', `bank` double NOT NULL DEFAULT 0 COMMENT '银行', `online_pay` double NOT NULL DEFAULT 0 COMMENT '在线支付', `income` double NOT NULL DEFAULT 0 COMMENT '实收(现金+银行+在线支付)', `name` char(60) not null DEFAULT '' COMMENT '收入来源名称或费用用途名称', -- order `oid` int(10) unsigned NOT NULL COMMENT 'oid', `contact_name` char(45) not null DEFAULT '' COMMENT '联系人名称', `mobile` char(25) NOT NULL DEFAULT '' COMMENT '电话', `park_address` varchar(500) NOT NULL DEFAULT '' COMMENT '停车位置', `car_license` char(30) NOT NULL DEFAULT '' COMMENT '车牌号', `warehouse_remark` text NOT NULL DEFAULT '' COMMENT '送货信息备注', `sto_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '仓库id', `receivable` double NOT NULL DEFAULT 0 COMMENT '应收(货物价值-优惠)', `balance` double NOT NULL DEFAULT 0 COMMENT '发生交易的那一刻的本单结余快照(实收-应收)', `remain` double NOT NULL DEFAULT 0 COMMENT '等待客户付款的金额即待收金额,正数为客户欠店铺,负数为店铺欠客户', -- Company里的balance:结余(应付-应收),负数是别人欠店主,正数是店主欠别人 `history_balance` double NOT NULL DEFAULT 0 COMMENT '此前结余', `total_balance` double NOT NULL DEFAULT 0 COMMENT '总结余(此前结余+本单结余)', `leave_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '出库时间', `exceptionNo` tinyint(3) not null DEFAULT 0 COMMENT '异常状态码', `exception` varchar(500) NOT NULL DEFAULT '' COMMENT '异常原因', `GeTuiGet` tinyint(3) not null DEFAULT 0 COMMENT '是否手机端已读', -- warehouse `wid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'wid', `num` double NOT NULL DEFAULT 0 COMMENT '变更数量', `check_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '盘点人uid', `check_name` char(16) NOT NULL DEFAULT '未填写' COMMENT '盘点人姓名,是冗余的,只存第一遍,之后不更改', `new_sto_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '新仓库id', -- finance `fid` int(10) unsigned NOT NULL COMMENT 'fid', -- sn `sn` char(20) NOT NULL DEFAULT '' COMMENT 'sn', PRIMARY KEY (`wid`), UNIQUE INDEX `adminUid_sn` (`admin_uid`, `sn`) USING HASH, KEY `admin_uid` (`admin_uid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='仓库进出表'; /*财务表*/ DROP TABLE IF EXISTS `finance`; CREATE TABLE `finance` ( -- common `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `class` tinyint(3) not null DEFAULT 1 COMMENT '单据类别', `value` double NOT NULL DEFAULT 0 COMMENT '货物价值(订单实际价值)', `remark` text NOT NULL DEFAULT '' COMMENT '备注',/*TODO:够么?*/ `operator_uid` int(10) unsigned NOT NULL COMMENT '开单人uid', `operator_name` char(16) NOT NULL DEFAULT '未填写' COMMENT '开单人姓名,是冗余的,只存第一遍,之后不更改', `history` mediumtext NOT NULL DEFAULT '' COMMENT '操作记录',/*TODO:10000条操作记录,够么?*/ `status` tinyint(3) not null DEFAULT 1 COMMENT '状态', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最后更新时间', `cart` text NOT NULL COMMENT '购物车',/*50个sku:80*300,TODO:够么?*/ `isdeliver` tinyint(4) not null DEFAULT 1 COMMENT '是否送货 1-送货 0-不送货', `freight` double NOT NULL DEFAULT 0 COMMENT '运费', `freight_received` double NOT NULL DEFAULT 0 COMMENT '代付已收运费', `is_calculated` int NOT NULL DEFAULT 0 COMMENT '1为计入成本,0为不计入成本', `freight_cal_method` int NOT NULL DEFAULT 0 COMMENT '运费计算方式 1- 按数量 2-按金额 不计入成本时默认为0', -- order和finance共同字段 `cid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '往来单位主键', `cid_name` char(45) not null DEFAULT '' COMMENT '单位名称冗余', `off` double NOT NULL DEFAULT 0 COMMENT '优惠', `cash` double NOT NULL DEFAULT 0 COMMENT '现金', `bank` double NOT NULL DEFAULT 0 COMMENT '银行', `online_pay` double NOT NULL DEFAULT 0 COMMENT '在线支付', `income` double NOT NULL DEFAULT 0 COMMENT '实收(现金+银行+在线支付)', `name` char(60) not null DEFAULT '' COMMENT '收入来源名称或费用用途名称', -- order `oid` int(10) unsigned NOT NULL COMMENT 'oid', `contact_name` char(45) not null DEFAULT '' COMMENT '联系人名称', `mobile` char(25) NOT NULL DEFAULT '' COMMENT '电话', `park_address` varchar(500) NOT NULL DEFAULT '' COMMENT '停车位置', `car_license` char(30) NOT NULL DEFAULT '' COMMENT '车牌号', `warehouse_remark` text NOT NULL DEFAULT '' COMMENT '送货信息备注', `sto_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '仓库id', `receivable` double NOT NULL DEFAULT 0 COMMENT '应收(货物价值-优惠)', `balance` double NOT NULL DEFAULT 0 COMMENT '发生交易的那一刻的本单结余快照(实收-应收)', `remain` double NOT NULL DEFAULT 0 COMMENT '等待客户付款的金额即待收金额,正数为客户欠店铺,负数为店铺欠客户', -- Company里的balance:结余(应付-应收),负数是别人欠店主,正数是店主欠别人,这个意义是错的,应该是remain的意义才是对的,待修正 `history_balance` double NOT NULL DEFAULT 0 COMMENT '此前结余', `total_balance` double NOT NULL DEFAULT 0 COMMENT '总结余(此前结余+本单结余)', `leave_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '出库时间', `exceptionNo` tinyint(3) not null DEFAULT 0 COMMENT '异常状态码', `exception` varchar(500) NOT NULL DEFAULT '' COMMENT '异常原因', `GeTuiGet` tinyint(3) not null DEFAULT 0 COMMENT '是否手机端已读', -- warehouse `wid` int(10) unsigned NOT NULL COMMENT 'wid', `num` double NOT NULL DEFAULT 0 COMMENT '变更数量', `check_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '盘点人uid', `check_name` char(16) NOT NULL DEFAULT '未填写' COMMENT '盘点人姓名,是冗余的,只存第一遍,之后不更改', `new_sto_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '新仓库id', -- finance `fid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'fid', -- sn `sn` char(20) NOT NULL DEFAULT '' COMMENT 'sn', PRIMARY KEY (`fid`), UNIQUE INDEX `adminUid_sn` (`admin_uid`, `sn`) USING HASH, KEY `admin_uid` (`admin_uid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='财务表'; /*反馈表*/ DROP TABLE IF EXISTS `feedback`; CREATE TABLE `feedback` ( `feedback_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'feedback_id', `uid` int(10) unsigned NOT NULL COMMENT '用户ID', `content` mediumtext NOT NULL DEFAULT '' COMMENT '反馈内容', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`feedback_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='反馈表'; /*query用的假表*/ DROP TABLE IF EXISTS `query`; CREATE TABLE `query` ( `sku_id` int(10) unsigned NOT NULL COMMENT 'sku_id', `page` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '请求第几页的数据', `pline` int(10) unsigned NOT NULL DEFAULT 10 COMMENT '一页多少行', -- `filter` mediumtext not null DEFAULT '' COMMENT '过滤器条件', `remainType` tinyint(3) NOT NULL DEFAULT 1 COMMENT '应收应付情况。1-店铺还需收款的单据;2-店铺还需付款的单据', `reg_st_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间的开始时间', `reg_end_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间的结束时间', -- `search` mediumtext NOT NULL DEFAULT '' COMMENT '搜索内容' `oid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'oid', `wid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'wid', `fid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'fid', `operator_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'operator_uid', `cid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '往来单位主键', `type` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'search时的type', `search` mediumtext NOT NULL DEFAULT '' COMMENT '搜索内容' ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='query用的假表'; /*updateDatabaseFormat 假表*/ DROP TABLE IF EXISTS `update_database_format`; CREATE TABLE `update_database_format` ( `reg_st_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间的开始时间' ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='update_database_format用的假表'; /*Util用的假表*/ DROP TABLE IF EXISTS `util`; CREATE TABLE `util` ( `type` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'type', `mobile` char(15) NOT NULL DEFAULT '' COMMENT '用户手机', `verify_code` char(4) NOT NULL DEFAULT '' COMMENT '验证码' ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='Util用的假表'; /*每日汇总表*/ DROP TABLE IF EXISTS `everyday_summary_sheet`; CREATE TABLE `everyday_summary_sheet` ( `everyday_summary_sheet_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'everyday_summary_sheet_id', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最后更新时间', `sale` double NOT NULL DEFAULT 0 COMMENT '销售额,算优惠掉的钱数', `sale_off` double NOT NULL DEFAULT 0 COMMENT '销售优惠额', `receivable` double NOT NULL DEFAULT 0 COMMENT '应收款', `payable` double NOT NULL DEFAULT 0 COMMENT '应付款', `actually_income` double NOT NULL DEFAULT 0 COMMENT '总实收款', `actually_paid` double NOT NULL DEFAULT 0 COMMENT '总实付款', `income_cash_total` double NOT NULL DEFAULT 0 COMMENT '现金收入总计', `income_bank_total` double NOT NULL DEFAULT 0 COMMENT '银行收入总计', `income_online_pay_total` double NOT NULL DEFAULT 0 COMMENT '网络收入总计', `balance_cash_total` double NOT NULL DEFAULT 0 COMMENT '现金结余总计', `balance_bank_total` double NOT NULL DEFAULT 0 COMMENT '银行结余总计', `balance_online_pay_total` double NOT NULL DEFAULT 0 COMMENT '网络结余总计', `other_income` double NOT NULL DEFAULT 0 COMMENT '其他收入总计', `expense` double NOT NULL DEFAULT 0 COMMENT '费用总计', `gross_profit` double NOT NULL DEFAULT 0 COMMENT '毛利润', `statistics` text NOT NULL COMMENT '完整的统计信息',/*TODO:够么?*/ PRIMARY KEY (`everyday_summary_sheet_id`), KEY `admin_uid` (`admin_uid`), KEY `reg_time` (`reg_time`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='每日汇总表'; -- ================================权限相关Start======================================================= /*规则表*/ DROP TABLE IF EXISTS `auth_rule`; CREATE TABLE `auth_rule` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `name` char(200) NOT NULL DEFAULT '' COMMENT '规则唯一标识', `title` char(200) NOT NULL DEFAULT '' COMMENT '规则中文名称', `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '', `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:为1正常,为0禁用', `condition` char(200) NOT NULL DEFAULT '' COMMENT '规则表达式,为空表示存在就验证,不为空表示按照条件验证,即规则附件条件,满足附加条件的规则,才认为是有效的规则', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='规则表'; /*用户组表*/ DROP TABLE IF EXISTS `auth_group`; CREATE TABLE `auth_group` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `title` char(200) NOT NULL DEFAULT '' COMMENT '用户组中文名称', `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '为1正常,为0禁用', `rules` text(65535) NOT NULL DEFAULT '' COMMENT '用户组拥有的规则id,多个规则","隔开', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='用户组表'; /*用户组明细表*/ DROP TABLE IF EXISTS `auth_group_access`; CREATE TABLE `auth_group_access` ( `uid` int(10) unsigned NOT NULL COMMENT 'uid', `group_id` int(10) unsigned NOT NULL COMMENT '用户组id', UNIQUE KEY `uid_group_id` (`uid`,`group_id`), KEY `uid` (`uid`), KEY `group_id` (`group_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='用户组明细表'; -- ================================权限相关End======================================================= /*报名表*/ DROP TABLE IF EXISTS `apply`; CREATE TABLE `apply` ( `apply_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'apply_id', `name` varchar(32) NOT NULL DEFAULT '未填写' COMMENT '姓名', `shop_name` varchar(100) not null DEFAULT '' COMMENT '公司名', `industry_name` varchar(500) not null DEFAULT '' COMMENT '行业名', `wechat` varchar(500) not null DEFAULT '' COMMENT '微信号', `mobile` varchar(50) NOT NULL DEFAULT '' COMMENT '手机', `email` varchar(100) NOT NULL DEFAULT '' COMMENT '邮箱', `where_know` varchar(200) NOT NULL DEFAULT '' COMMENT '从何处得知我们', `isDone` tinyint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否跟进', `reg_time_format` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '注册时间-格式化', `country` varchar(100) not null DEFAULT '' COMMENT '国家', `area` varchar(100) not null DEFAULT '' COMMENT '区域', `region` varchar(100) not null DEFAULT '' COMMENT '省份', `city` varchar(100) not null DEFAULT '' COMMENT '市', `county` varchar(100) not null DEFAULT '' COMMENT '县', `isp` varchar(100) not null DEFAULT '' COMMENT 'ISP服务商', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '注册时间', `reg_ip` varchar(100) NOT NULL DEFAULT '0' COMMENT '注册IP', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`apply_id`) ) ENGINE =InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='报名表'; /*服务器统计信息表*/ DROP TABLE IF EXISTS `server_statistics`; CREATE TABLE `server_statistics` ( `ss_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ss_id', `uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '用户ID', `where_know` varchar(200) NOT NULL DEFAULT '' COMMENT '从何处得知我们', `reg_time_format` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '注册时间-格式化', `reg_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '注册时间', `reg_ip` varchar(100) NOT NULL DEFAULT '0' COMMENT '注册IP', PRIMARY KEY (`ss_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='服务器统计信息表'; /*sku_单据 关联表*/ DROP TABLE IF EXISTS `sku_bill`; CREATE TABLE `sku_bill` ( `sku_bill_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'sku_bill_id', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `sku_id` int(10) unsigned NOT NULL COMMENT 'sku_id', `spu_id` int(10) unsigned NOT NULL COMMENT 'spu_id', `oid` int(10) unsigned NOT NULL COMMENT 'oid', `wid` int(10) unsigned NOT NULL COMMENT 'wid', `bill_class` tinyint(3) not null DEFAULT 1 COMMENT '单据类别', `bill_status` tinyint(3) not null DEFAULT 1 COMMENT '单据状态', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`sku_bill_id`), KEY `admin_uid` (`admin_uid`), KEY `sku_id` (`sku_id`), KEY `spu_id` (`spu_id`), KEY `bill_class` (`bill_class`), KEY `reg_time` (`reg_time`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='sku_单据 关联表'; /*sku_cid_price 关联表*/ DROP TABLE IF EXISTS `sku_cid_price`; CREATE TABLE `sku_cid_price` ( `sku_cid_price_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'sku_cid_price_id', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `sku_id` int(10) unsigned NOT NULL COMMENT 'sku_id', `spu_id` int(10) unsigned NOT NULL COMMENT 'spu_id', `cid` int(10) unsigned NOT NULL COMMENT 'cid', `price1` double NOT NULL DEFAULT 0 COMMENT '最近售价1', `quantity1` double NOT NULL DEFAULT 0 COMMENT '最近卖出数量1(与price1对应)', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`sku_cid_price_id`), KEY `admin_uid` (`admin_uid`), KEY `sku_id` (`sku_id`), KEY `spu_id` (`spu_id`), KEY `cid` (`cid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='sku_cid_price 关联表'; /*支付单据表(向星云进销存支付的单据)*/ DROP TABLE IF EXISTS `paybill`; CREATE TABLE `paybill` ( `paybill_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'paybill_id', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的老板uid', `uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建人uid', `sn` char(33) NOT NULL DEFAULT '' COMMENT 'sn', `bill_title` char(100) not null DEFAULT '' COMMENT '账单名称', `bill_money` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单金额,单位:分', `bill_class` tinyint(3) not null DEFAULT 1 COMMENT '单据类别', `bill_status` tinyint(3) not null DEFAULT 0 COMMENT '单据状态,0-未处理,1-已完成,2-已处理,但该单据无效', `member_count` int(5) unsigned NOT NULL DEFAULT '0' COMMENT '一共买了几个月', `sign` char(33) NOT NULL DEFAULT '' COMMENT '自己加密的签名', `channel_type` char(33) NOT NULL DEFAULT '' COMMENT '渠道类型,WX/ALI/UN/KUAIQIAN/JD/BD/YEE/PAYPAL 分别代表微信/支付宝/银联/快钱/京东/百度/易宝/PAYPAL', `sub_channel_type` char(33) NOT NULL DEFAULT '' COMMENT '代表以上各个渠道的子渠道,参看字段说明', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`paybill_id`), KEY `admin_uid` (`admin_uid`), KEY `uid` (`uid`), UNIQUE KEY `sn` (`sn`) USING HASH -- UNIQUE INDEX `sn` (`sn`) USING HASH todo:???? ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='支付单据表(向星云进销存支付的单据)'; /*星云进销存的用户账户系统*/ DROP TABLE IF EXISTS `user_account`; CREATE TABLE `user_account` ( `user_account_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'user_account_id', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的老板uid', `member_class` tinyint(3) not null DEFAULT 0 COMMENT '会员类型', `member_buy_count` tinyint(3) not null DEFAULT 0 COMMENT '这次购买的是什么时常的套餐:0、1、3、6、12', `member_st_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员开始时间', `member_count` int(5) unsigned NOT NULL DEFAULT '0' COMMENT '从开始时间起一共买了几个月', `member_end_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员结束时间', `save_off_record` tinyint(3) not null DEFAULT 0 COMMENT '所享受的优惠记录.1-购买过6个月的优惠;2-购买过12个月的优惠(含2个6个月或1个12个月)', `balance` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '账户余额,单位:分', `balance_sms_gift` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '账户短信费赠送余额,单位:分', `sign` char(33) NOT NULL DEFAULT '' COMMENT '自己加密的签名', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`user_account_id`), UNIQUE KEY `admin_uid` (`admin_uid`), KEY `member_end_time` (`member_end_time`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='星云进销存的用户账户系统'; /*星云进销存用户的短信发送记录明细表*/ DROP TABLE IF EXISTS `sms_details`; CREATE TABLE `sms_details` ( `sms_details_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'sms_details_id', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的老板uid', `class` tinyint(3) not null DEFAULT 0 COMMENT '类型,1-对账单.2-祝福短信', `operator_uid` int(10) unsigned NOT NULL COMMENT '操作人的uid', `phone` text NOT NULL DEFAULT '' COMMENT '收件人字符串', `num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '一个人的短信条数', `sms_text` text NOT NULL DEFAULT '' COMMENT '发送的短信内容',/*TODO:够么?*/ `money` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '本次短信的费用,单位:分', `sign` char(33) NOT NULL DEFAULT '' COMMENT '自己加密的签名', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`sms_details_id`), KEY `admin_uid` (`admin_uid`), KEY `reg_time` (`reg_time`), KEY `class` (`class`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='星云进销存用户的短信发送记录明细表'; /*星云进销存用户的余额支出明细表(内扣系统)*/ DROP TABLE IF EXISTS `payment_details`; CREATE TABLE `payment_details` ( `payment_details_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'payment_details_id', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的老板uid', `class` tinyint(3) not null DEFAULT 0 COMMENT '类型,1-短信', `id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '对应详情信息的主键值', `operator_uid` int(10) unsigned NOT NULL COMMENT '操作人的uid', `money` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '本次交易金额,单位:分', `sign` char(33) NOT NULL DEFAULT '' COMMENT '自己加密的签名', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`payment_details_id`), KEY `admin_uid` (`admin_uid`), KEY `reg_time` (`reg_time`), KEY `class` (`class`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='星云进销存用户的余额支出明细表(内扣系统)'; /*Node异步任务列表*/ DROP TABLE IF EXISTS `asyn_tasks`; CREATE TABLE `asyn_tasks` ( `task_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'task_id', `name` char(20) NOT NULL DEFAULT '' COMMENT '任务名', `class` tinyint(3) NOT NULL DEFAULT 0 COMMENT '任务类型,1-通知库管', `publisher` char(30) NOT NULL DEFAULT '' COMMENT '发布异步任务的session号', `data` text NOT NULL DEFAULT '' COMMENT '异步任务的Json入参', `sign` char(33) NOT NULL DEFAULT '' COMMENT '自己加密的签名', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`task_id`), KEY `reg_time`(`reg_time`), KEY `class` (`class`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='需要Node处理的异步任务列表'; /*存储打印模板的表*/ DROP TABLE IF EXISTS `print_template`; CREATE TABLE `print_template` ( `print_template_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'print_template_id', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `class` tinyint(3) NOT NULL DEFAULT 0 COMMENT '该模板的种类,1-销售出库单', `font_size` tinyint(3) NOT NULL DEFAULT 0 COMMENT '单据货物行里的字号', `content` text NOT NULL DEFAULT '' COMMENT '模板', `optionArray` text NOT NULL DEFAULT '' COMMENT '选项数组', PRIMARY KEY (`print_template_id`), KEY `admin_uid` (`admin_uid`), KEY `class` (`class`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='存储打印模板的表'; /*other用的假表*/ DROP TABLE IF EXISTS `other`; CREATE TABLE `other` ( `reg_st_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间的开始时间' ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='other用的假表'; /*statement_account对账单表*/ DROP TABLE IF EXISTS `statement_account`; CREATE TABLE `statement_account` ( `sid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `s_guid` char(80) NOT NULL DEFAULT '0' COMMENT '随机验证码', `s_pwd`char(6) NOT NULL DEFAULT '0' COMMENT '获取账单密码', `statementofaccount`text NOT NULL DEFAULT '' COMMENT '账单内容', PRIMARY KEY (`sid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='存储客户需要的对账单信息表'; /*sku_storage sku仓库关联表*/ DROP TABLE IF EXISTS `sku_storage`; CREATE TABLE `sku_storage` ( `sku_storage_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `sku_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'sku_id', `sto_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '仓库名称', `admin_uid`int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属店铺uid', `unit_price` double NOT NULL DEFAULT 0 COMMENT '库存产品的成本(单价)', `stock` double NOT NULL DEFAULT 0 COMMENT '库存数量', `reg_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT'创建时间', `update_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT'修改时间', `sku_sto_index` int(5) unsigned NOT NULL DEFAULT 0 COMMENT 'sku在所在仓库的显示顺序,一个正整数,数字越小,显示越靠前,1是最前', `sku_sto_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态',/*1是开启,0为未启用,-1为已删除*/ PRIMARY KEY (`sku_storage_id`), UNIQUE INDEX `adminUid_sku_sto` (`admin_uid`, `sto_id`,`sku_id`) USING HASH, KEY `sku_id` (`sku_id`), KEY `sto_id` (`sto_id`), KEY `admin_uid` (`admin_uid`), KEY `sku_sto_status` (`sku_sto_status`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='sku仓库关联表'; /*账户表*/ DROP TABLE IF EXISTS `account`; CREATE TABLE `account` ( `account_id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `account_creator` char(80) NOT NULL DEFAULT '' COMMENT '开户人', `account_number` char(20) NOT NULL DEFAULT '' COMMENT '账号', `account_name` char(80) NOT NULL DEFAULT '' COMMENT '账户名称', `account_source_name` char(20) NOT NULL DEFAULT '' COMMENT '来源名称', `account_source_type` int(2) NOT NULL DEFAULT 0 COMMENT '账户来源类型', `account_balance` double NOT NULL DEFAULT 0 COMMENT '账户余额', `province` char(10) NOT NULL DEFAULT '' COMMENT '省', `city` char(10) NOT NULL DEFAULT '' COMMENT '市', `bank_name` char(20) NOT NULL DEFAULT '' COMMENT '开户行', `qcode` char(50) NOT NULL DEFAULT '' COMMENT '速查编码', `account_remark` text NOT NULL DEFAULT '' COMMENT '账户信息备注', `status` tinyint(4) not null DEFAULT 0 COMMENT '账户状态(1.有效,0,无效)', `sn` char(20) NOT NULL DEFAULT '' COMMENT 'sn', `reg_time` timestamp NOT NULL DEFAULT 0 COMMENT '创建时间', `update_time` timestamp NOT NULL DEFAULT 0 COMMENT '最后操作时间', PRIMARY KEY (`account_id`), KEY `admin_uid` (`admin_uid`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='账户表'; /*开户来源表*/ DROP TABLE IF EXISTS `account_source`; CREATE TABLE `account_source` ( `account_source_id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `account_prefix` char(10) NOT NULL DEFAULT '' COMMENT '账户来源前6位', `account_source_name` char(20) NOT NULL DEFAULT 'unknownbank' COMMENT '来源名称', `account_source_type` int(2) NOT NULL DEFAULT 0 COMMENT '账户来源类型', PRIMARY KEY (`account_source_id`), KEY `account_prefix` (`account_prefix`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='账户来源表'; /*账户操作记录表*/ DROP TABLE IF EXISTS `account_operation_record`; CREATE TABLE `account_operation_record` ( `account_operation_record_id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `account_id` int(20) unsigned NOT NULL COMMENT '账户ID', `account_number` char(20) NOT NULL DEFAULT '' COMMENT '账号', `account_operation_class` int(3) NOT NULL DEFAULT 0 COMMENT '账户操作类型(操作来源)', `cost` int(20) NOT NULL DEFAULT 0 COMMENT '交易金额', `account_operation_code` char(20) NOT NULL DEFAULT '' COMMENT '操作单号', `reg_time` timestamp NOT NULL DEFAULT 0 COMMENT '创建时间', `update_time` timestamp NOT NULL DEFAULT 0 COMMENT '更新时间', `account_operation_remark` text NOT NULL DEFAULT '' COMMENT '账户操作备注', PRIMARY KEY (`account_operation_record_id`), KEY `admin_uid` (`admin_uid`), KEY `account_id` (`account_id`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='账户操作记录表'; /**代理表*/ DROP TABLE IF EXISTS `proxy_company`; CREATE TABLE `proxy_company` ( `proxy_id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `name` char(10) NOT NULL DEFAULT '' COMMENT '姓名', `area` char(20) NOT NULL DEFAULT '' COMMENT '所在地区', `mobile` char(20) NOT NULL DEFAULT '' COMMENT '手机号', PRIMARY KEY (`proxy_id`), KEY `name` (`name`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='代理商表'; DROP TABLE IF EXISTS `department`; CREATE TABLE `department` ( `depart_id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `depart_name` char(10) NOT NULL DEFAULT '' COMMENT '部门名字', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所属的创建者uid', `depart_manager_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '预留字段,部门主管的UID', `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '部门状态(1.有效,0,无效', `remark` text NOT NULL DEFAULT '' COMMENT '部门信息备注', `reg_time` timestamp NOT NULL DEFAULT 0 COMMENT '创建时间', `update_time` timestamp NOT NULL DEFAULT 0 COMMENT '最后操作时间', PRIMARY KEY (`depart_id`), KEY `admin_uid` (`admin_uid`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='部门表'; DROP TABLE IF EXISTS `face_rec`; CREATE TABLE `face_rec` ( `face_id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `cid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'cid', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'admin_uid', `name` char(45) not null DEFAULT '' COMMENT '单位名称', `photo` text(600) not null DEFAULT '' COMMENT '图片地址', `remark` text NOT NULL DEFAULT '' COMMENT '备注', `reg_time` int(10) unsigned DEFAULT 0 COMMENT '创建时间', `update_time` int(10) unsigned DEFAULT 0 COMMENT '最后操作时间', PRIMARY KEY (`face_id`), KEY `admin_uid` (`admin_uid`) -- constraint FK_CONTACT_cid foreign key (cid) references company(cid) on delete cascade on update cascade, )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='人脸识别表'; DROP TABLE IF EXISTS `cus_list`; CREATE TABLE `cus_list` ( `cus_list_id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `cid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'cid', `admin_uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'admin_uid', `company_name` char(45) not null DEFAULT '' COMMENT '单位名称', `photo` text(600) not null DEFAULT '' COMMENT '图片地址', `update_time` int(10) unsigned DEFAULT 0 COMMENT '最后操作时间', PRIMARY KEY (`cus_list_id`), KEY `admin_uid` (`admin_uid`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='访客列表'; /**七牛上传相关表*/ DROP TABLE IF EXISTS `qn_upload`; CREATE TABLE `qn_upload` ( `upload_id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `uid` int(20) NOT NULL DEFAULT 0 COMMENT 'uid', `fname` varchar(512) NOT NULL, `fkey` varchar(512) NOT NULL, `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `description` varchar(1024), `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '状态(1.有效,0,无效)', `remark` text NOT NULL DEFAULT '' COMMENT '信息备注', `reg_time` timestamp NOT NULL DEFAULT 0 COMMENT '创建时间', `update_time` timestamp NOT NULL DEFAULT 0 COMMENT '最后操作时间', PRIMARY KEY (`upload_id`), KEY `uid` (`uid`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='七牛上传相关表';
the_stack
-- 2021-04-09T10:57:57.714Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID, AD_Element_ID, AD_Org_ID, ColumnName, Created, CreatedBy, EntityType, IsActive, Name, PrintName, Updated, UpdatedBy) VALUES (0, 579010, 0, 'Specification', TO_TIMESTAMP('2021-04-09 13:57:57', 'YYYY-MM-DD HH24:MI:SS'), 100, 'D', 'Y', 'Spezifikation', 'Spezifikation', TO_TIMESTAMP('2021-04-09 13:57:57', 'YYYY-MM-DD HH24:MI:SS'), 100) ; -- 2021-04-09T10:57:57.723Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language, AD_Element_ID, CommitWarning, Description, Help, Name, PO_Description, PO_Help, PO_Name, PO_PrintName, PrintName, WEBUI_NameBrowse, WEBUI_NameNew, WEBUI_NameNewBreadcrumb, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning, t.Description, t.Help, t.Name, t.PO_Description, t.PO_Help, t.PO_Name, t.PO_PrintName, t.PrintName, t.WEBUI_NameBrowse, t.WEBUI_NameNew, t.WEBUI_NameNewBreadcrumb, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y' OR l.IsBaseLanguage = 'Y') AND t.AD_Element_ID = 579010 AND NOT EXISTS(SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Element_ID = t.AD_Element_ID) ; -- 2021-04-09T10:58:14.279Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Specification', PrintName='Specification', Updated=TO_TIMESTAMP('2021-04-09 13:58:14', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Element_ID = 579010 AND AD_Language = 'en_US' ; -- 2021-04-09T10:58:14.306Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT update_TRL_Tables_On_AD_Element_TRL_Update(579010, 'en_US') ; -- 2021-04-09T11:16:32.637Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID, AD_Column_ID, AD_Element_ID, AD_Org_ID, AD_Reference_ID, AD_Table_ID, ColumnName, Created, CreatedBy, DDL_NoForeignKey, EntityType, FacetFilterSeqNo, FieldLength, IsActive, IsAdvancedText, IsAllowLogging, IsAlwaysUpdateable, IsAutoApplyValidationRule, IsAutocomplete, IsCalculated, IsDimension, IsDLMPartitionBoundary, IsEncrypted, IsFacetFilter, IsForceIncludeInGeneratedModel, IsGenericZoomKeyColumn, IsGenericZoomOrigin, IsIdentifier, IsKey, IsLazyLoading, IsMandatory, IsParent, IsSelectionColumn, IsShowFilterIncrementButtons, IsShowFilterInline, IsStaleable, IsSyncDatabase, IsTranslated, IsUpdateable, IsUseDocSequence, MaxFacetsToFetch, Name, SelectionColumnSeqNo, SeqNo, Updated, UpdatedBy, Version) VALUES (0, 573347, 579010, 0, 36, 53016, 'Specification', TO_TIMESTAMP('2021-04-09 14:16:32', 'YYYY-MM-DD HH24:MI:SS'), 100, 'N', 'EE01', 0, 1024, 'Y', 'N', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', 'N', 0, 'Spezifikation', 0, 0, TO_TIMESTAMP('2021-04-09 14:16:32', 'YYYY-MM-DD HH24:MI:SS'), 100, 0) ; -- 2021-04-09T11:16:32.638Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language, AD_Column_ID, Name, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y') AND t.AD_Column_ID = 573347 AND NOT EXISTS(SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Column_ID = t.AD_Column_ID) ; -- 2021-04-09T11:16:32.642Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT update_Column_Translation_From_AD_Element(579010) ; -- 2021-04-09T11:16:39.323Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('PP_WF_Node_Product', 'ALTER TABLE public.PP_WF_Node_Product ADD COLUMN Specification TEXT') ; -- 2021-04-09T11:17:53.556Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID, AD_Column_ID, AD_Element_ID, AD_Org_ID, AD_Reference_ID, AD_Table_ID, ColumnName, Created, CreatedBy, DDL_NoForeignKey, EntityType, FacetFilterSeqNo, FieldLength, IsActive, IsAdvancedText, IsAllowLogging, IsAlwaysUpdateable, IsAutoApplyValidationRule, IsAutocomplete, IsCalculated, IsDimension, IsDLMPartitionBoundary, IsEncrypted, IsFacetFilter, IsForceIncludeInGeneratedModel, IsGenericZoomKeyColumn, IsGenericZoomOrigin, IsIdentifier, IsKey, IsLazyLoading, IsMandatory, IsParent, IsSelectionColumn, IsShowFilterIncrementButtons, IsShowFilterInline, IsStaleable, IsSyncDatabase, IsTranslated, IsUpdateable, IsUseDocSequence, MaxFacetsToFetch, Name, SelectionColumnSeqNo, SeqNo, Updated, UpdatedBy, Version) VALUES (0, 573348, 579010, 0, 36, 53030, 'Specification', TO_TIMESTAMP('2021-04-09 14:17:53', 'YYYY-MM-DD HH24:MI:SS'), 100, 'N', 'EE01', 0, 1024, 'Y', 'N', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', 'N', 0, 'Spezifikation', 0, 0, TO_TIMESTAMP('2021-04-09 14:17:53', 'YYYY-MM-DD HH24:MI:SS'), 100, 0) ; -- 2021-04-09T11:17:53.558Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language, AD_Column_ID, Name, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y') AND t.AD_Column_ID = 573348 AND NOT EXISTS(SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Column_ID = t.AD_Column_ID) ; -- 2021-04-09T11:17:53.560Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT update_Column_Translation_From_AD_Element(579010) ; -- 2021-04-09T11:18:04.467Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('PP_Order_Node_Product', 'ALTER TABLE public.PP_Order_Node_Product ADD COLUMN Specification TEXT') ; -- 2021-04-11T11:00:51.206Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET AD_Reference_ID=10, FieldLength=255, Updated=TO_TIMESTAMP('2021-04-11 14:00:51', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Column_ID = 573347 ; -- 2021-04-11T11:00:54.148Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO t_alter_column VALUES ('pp_wf_node_product', 'Specification', 'VARCHAR(255)', NULL, NULL) ; -- 2021-04-11T11:01:31.963Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET AD_Reference_ID=10, FieldLength=255, Updated=TO_TIMESTAMP('2021-04-11 14:01:31', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Column_ID = 573348 ; -- 2021-04-11T11:15:46.910Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID, AD_Column_ID, AD_Field_ID, AD_Org_ID, AD_Tab_ID, ColumnDisplayLength, Created, CreatedBy, DisplayLength, EntityType, IncludedTabHeight, IsActive, IsDisplayed, IsDisplayedGrid, IsEncrypted, IsFieldOnly, IsHeading, IsReadOnly, IsSameLine, Name, SeqNo, SeqNoGrid, SortNo, SpanX, SpanY, Updated, UpdatedBy) VALUES (0, 573347, 643539, 0, 543533, 0, TO_TIMESTAMP('2021-04-11 14:15:46', 'YYYY-MM-DD HH24:MI:SS'), 100, 0, 'D', 0, 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', 'Spezifikation', 10, 90, 0, 1, 1, TO_TIMESTAMP('2021-04-11 14:15:46', 'YYYY-MM-DD HH24:MI:SS'), 100) ; -- 2021-04-11T11:15:46.913Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language, AD_Field_ID, Description, Help, Name, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description, t.Help, t.Name, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y') AND t.AD_Field_ID = 643539 AND NOT EXISTS(SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Field_ID = t.AD_Field_ID) ; -- 2021-04-11T11:15:46.937Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT update_FieldTranslation_From_AD_Name_Element(579010) ; -- 2021-04-11T11:15:46.946Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID = 643539 ; -- 2021-04-11T11:15:46.948Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT AD_Element_Link_Create_Missing_Field(643539) ; -- 2021-04-11T11:16:37.004Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID, AD_Field_ID, AD_Org_ID, AD_Tab_ID, AD_UI_ElementGroup_ID, AD_UI_Element_ID, AD_UI_ElementType, Created, CreatedBy, IsActive, IsAdvancedField, IsAllowFiltering, IsDisplayed, IsDisplayedGrid, IsDisplayed_SideList, IsMultiLine, MultiLine_LinesCount, Name, SeqNo, SeqNoGrid, SeqNo_SideList, Updated, UpdatedBy) VALUES (0, 643539, 0, 543533, 545100, 583483, 'F', TO_TIMESTAMP('2021-04-11 14:16:36', 'YYYY-MM-DD HH24:MI:SS'), 100, 'Y', 'N', 'N', 'Y', 'N', 'N', 'N', 0, 'Spezifikation', 80, 0, 0, TO_TIMESTAMP('2021-04-11 14:16:36', 'YYYY-MM-DD HH24:MI:SS'), 100) ; -- 2021-04-11T11:17:40.214Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60, Updated=TO_TIMESTAMP('2021-04-11 14:17:40', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_UI_Element_ID = 583483 ; -- 2021-04-11T11:17:40.217Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70, Updated=TO_TIMESTAMP('2021-04-11 14:17:40', 'YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_UI_Element_ID = 579292 ; -- 2021-04-11T11:20:03.042Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID, AD_Column_ID, AD_Field_ID, AD_Org_ID, AD_Tab_ID, ColumnDisplayLength, Created, CreatedBy, DisplayLength, EntityType, IncludedTabHeight, IsActive, IsDisplayed, IsDisplayedGrid, IsEncrypted, IsFieldOnly, IsHeading, IsReadOnly, IsSameLine, Name, SeqNo, SeqNoGrid, SortNo, SpanX, SpanY, Updated, UpdatedBy) VALUES (0, 573348, 643540, 0, 53042, 0, TO_TIMESTAMP('2021-04-11 14:20:02', 'YYYY-MM-DD HH24:MI:SS'), 100, 0, 'D', 0, 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', 'Spezifikation', 120, 120, 0, 1, 1, TO_TIMESTAMP('2021-04-11 14:20:02', 'YYYY-MM-DD HH24:MI:SS'), 100) ; -- 2021-04-11T11:20:03.043Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language, AD_Field_ID, Description, Help, Name, IsTranslated, AD_Client_ID, AD_Org_ID, Created, Createdby, Updated, UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description, t.Help, t.Name, 'N', t.AD_Client_ID, t.AD_Org_ID, t.Created, t.Createdby, t.Updated, t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive = 'Y' AND (l.IsSystemLanguage = 'Y') AND t.AD_Field_ID = 643540 AND NOT EXISTS(SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language = l.AD_Language AND tt.AD_Field_ID = t.AD_Field_ID) ; -- 2021-04-11T11:20:03.044Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT update_FieldTranslation_From_AD_Name_Element(579010) ; -- 2021-04-11T11:20:03.046Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID = 643540 ; -- 2021-04-11T11:20:03.047Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT AD_Element_Link_Create_Missing_Field(643540) ;
the_stack
---- -- Copyright (c) 2012-2018 Apple Inc. All rights reserved. -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ---- --------------------------------------------------- -- Upgrade database schema from VERSION 65 to 66 -- --------------------------------------------------- ALTER TABLE JOB ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE CALENDAR_HOME ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_HOME_METADATA ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_HOME_METADATA ALTER COLUMN TRASH TYPE bigint; ALTER TABLE CALENDAR_HOME_METADATA ALTER COLUMN DEFAULT_EVENTS TYPE bigint; ALTER TABLE CALENDAR_HOME_METADATA ALTER COLUMN DEFAULT_TASKS TYPE bigint; ALTER TABLE CALENDAR_HOME_METADATA ALTER COLUMN DEFAULT_POLLS TYPE bigint; ALTER TABLE CALENDAR_METADATA ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_MIGRATION ALTER COLUMN CALENDAR_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_MIGRATION ALTER COLUMN REMOTE_RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_MIGRATION ALTER COLUMN LOCAL_RESOURCE_ID TYPE bigint; ALTER TABLE NOTIFICATION_HOME ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE NOTIFICATION ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE NOTIFICATION ALTER COLUMN NOTIFICATION_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_BIND ALTER COLUMN CALENDAR_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_BIND ALTER COLUMN CALENDAR_RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_BIND ALTER COLUMN BIND_REVISION TYPE bigint; ALTER TABLE CALENDAR_OBJECT ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT ALTER COLUMN CALENDAR_RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT ALTER COLUMN ORIGINAL_COLLECTION TYPE bigint; ALTER TABLE TIME_RANGE ALTER COLUMN INSTANCE_ID TYPE bigint; ALTER TABLE TIME_RANGE ALTER COLUMN CALENDAR_RESOURCE_ID TYPE bigint; ALTER TABLE TIME_RANGE ALTER COLUMN CALENDAR_OBJECT_RESOURCE_ID TYPE bigint; ALTER TABLE PERUSER ALTER COLUMN TIME_RANGE_INSTANCE_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT_MIGRATION ALTER COLUMN CALENDAR_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT_MIGRATION ALTER COLUMN REMOTE_RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT_MIGRATION ALTER COLUMN LOCAL_RESOURCE_ID TYPE bigint; ALTER TABLE ATTACHMENT ALTER COLUMN ATTACHMENT_ID TYPE bigint; ALTER TABLE ATTACHMENT ALTER COLUMN CALENDAR_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE ATTACHMENT_CALENDAR_OBJECT ALTER COLUMN ATTACHMENT_ID TYPE bigint; ALTER TABLE ATTACHMENT_CALENDAR_OBJECT ALTER COLUMN CALENDAR_OBJECT_RESOURCE_ID TYPE bigint; ALTER TABLE ATTACHMENT_MIGRATION ALTER COLUMN CALENDAR_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE ATTACHMENT_MIGRATION ALTER COLUMN REMOTE_RESOURCE_ID TYPE bigint; ALTER TABLE ATTACHMENT_MIGRATION ALTER COLUMN LOCAL_RESOURCE_ID TYPE bigint; ALTER TABLE RESOURCE_PROPERTY ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE ADDRESSBOOK_HOME ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE ADDRESSBOOK_HOME ALTER COLUMN ADDRESSBOOK_PROPERTY_STORE_ID TYPE bigint; ALTER TABLE ADDRESSBOOK_HOME_METADATA ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE SHARED_ADDRESSBOOK_BIND ALTER COLUMN ADDRESSBOOK_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE SHARED_ADDRESSBOOK_BIND ALTER COLUMN OWNER_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE SHARED_ADDRESSBOOK_BIND ALTER COLUMN BIND_REVISION TYPE bigint; ALTER TABLE ADDRESSBOOK_OBJECT ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE ADDRESSBOOK_OBJECT ALTER COLUMN ADDRESSBOOK_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE ABO_MEMBERS ALTER COLUMN GROUP_ID TYPE bigint; ALTER TABLE ABO_MEMBERS ALTER COLUMN ADDRESSBOOK_ID TYPE bigint; ALTER TABLE ABO_MEMBERS ALTER COLUMN MEMBER_ID TYPE bigint; ALTER TABLE ABO_MEMBERS ALTER COLUMN REVISION TYPE bigint; ALTER TABLE ABO_FOREIGN_MEMBERS ALTER COLUMN GROUP_ID TYPE bigint; ALTER TABLE ABO_FOREIGN_MEMBERS ALTER COLUMN ADDRESSBOOK_ID TYPE bigint; ALTER TABLE SHARED_GROUP_BIND ALTER COLUMN ADDRESSBOOK_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE SHARED_GROUP_BIND ALTER COLUMN GROUP_RESOURCE_ID TYPE bigint; ALTER TABLE SHARED_GROUP_BIND ALTER COLUMN BIND_REVISION TYPE bigint; ALTER TABLE CALENDAR_OBJECT_REVISIONS ALTER COLUMN CALENDAR_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT_REVISIONS ALTER COLUMN CALENDAR_RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT_REVISIONS ALTER COLUMN REVISION TYPE bigint; ALTER TABLE ADDRESSBOOK_OBJECT_REVISIONS ALTER COLUMN ADDRESSBOOK_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE ADDRESSBOOK_OBJECT_REVISIONS ALTER COLUMN OWNER_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE ADDRESSBOOK_OBJECT_REVISIONS ALTER COLUMN OBJECT_RESOURCE_ID TYPE bigint; ALTER TABLE ADDRESSBOOK_OBJECT_REVISIONS ALTER COLUMN REVISION TYPE bigint; ALTER TABLE NOTIFICATION_OBJECT_REVISIONS ALTER COLUMN NOTIFICATION_HOME_RESOURCE_ID TYPE bigint; ALTER TABLE NOTIFICATION_OBJECT_REVISIONS ALTER COLUMN REVISION TYPE bigint; ALTER TABLE TEST_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE TEST_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE APN_PURGING_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE APN_PURGING_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE IMIP_INVITATION_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE IMIP_INVITATION_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE IMIP_POLLING_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE IMIP_POLLING_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE IMIP_REPLY_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE IMIP_REPLY_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE PUSH_NOTIFICATION_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE PUSH_NOTIFICATION_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE GROUP_CACHER_POLLING_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE GROUP_CACHER_POLLING_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE GROUP_REFRESH_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE GROUP_REFRESH_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE GROUP_DELEGATE_CHANGES_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE GROUP_DELEGATE_CHANGES_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE GROUPS ALTER COLUMN GROUP_ID TYPE bigint; ALTER TABLE GROUP_MEMBERSHIP ALTER COLUMN GROUP_ID TYPE bigint; ALTER TABLE GROUP_ATTENDEE_RECONCILE_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE GROUP_ATTENDEE_RECONCILE_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE GROUP_ATTENDEE_RECONCILE_WORK ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE GROUP_ATTENDEE_RECONCILE_WORK ALTER COLUMN GROUP_ID TYPE bigint; ALTER TABLE GROUP_ATTENDEE ALTER COLUMN GROUP_ID TYPE bigint; ALTER TABLE GROUP_ATTENDEE ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE GROUP_SHAREE_RECONCILE_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE GROUP_SHAREE_RECONCILE_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE GROUP_SHAREE_RECONCILE_WORK ALTER COLUMN CALENDAR_ID TYPE bigint; ALTER TABLE GROUP_SHAREE_RECONCILE_WORK ALTER COLUMN GROUP_ID TYPE bigint; ALTER TABLE GROUP_SHAREE ALTER COLUMN GROUP_ID TYPE bigint; ALTER TABLE GROUP_SHAREE ALTER COLUMN CALENDAR_ID TYPE bigint; ALTER TABLE DELEGATE_GROUPS ALTER COLUMN GROUP_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT_SPLITTER_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT_SPLITTER_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT_SPLITTER_WORK ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT_UPGRADE_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT_UPGRADE_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE CALENDAR_OBJECT_UPGRADE_WORK ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE FIND_MIN_VALID_REVISION_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE FIND_MIN_VALID_REVISION_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE REVISION_CLEANUP_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE REVISION_CLEANUP_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE INBOX_CLEANUP_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE INBOX_CLEANUP_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE CLEANUP_ONE_INBOX_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE CLEANUP_ONE_INBOX_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE CLEANUP_ONE_INBOX_WORK ALTER COLUMN HOME_ID TYPE bigint; ALTER TABLE INBOX_REMOVE_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE INBOX_REMOVE_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE INBOX_REMOVE_WORK ALTER COLUMN HOME_ID TYPE bigint; ALTER TABLE SCHEDULE_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE SCHEDULE_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE SCHEDULE_REFRESH_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE SCHEDULE_REFRESH_WORK ALTER COLUMN HOME_RESOURCE_ID TYPE bigint; ALTER TABLE SCHEDULE_REFRESH_WORK ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE SCHEDULE_REFRESH_ATTENDEES ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE SCHEDULE_AUTO_REPLY_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE SCHEDULE_AUTO_REPLY_WORK ALTER COLUMN HOME_RESOURCE_ID TYPE bigint; ALTER TABLE SCHEDULE_AUTO_REPLY_WORK ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE SCHEDULE_ORGANIZER_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE SCHEDULE_ORGANIZER_WORK ALTER COLUMN HOME_RESOURCE_ID TYPE bigint; ALTER TABLE SCHEDULE_ORGANIZER_WORK ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE SCHEDULE_ORGANIZER_SEND_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE SCHEDULE_ORGANIZER_SEND_WORK ALTER COLUMN HOME_RESOURCE_ID TYPE bigint; ALTER TABLE SCHEDULE_ORGANIZER_SEND_WORK ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE SCHEDULE_REPLY_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE SCHEDULE_REPLY_WORK ALTER COLUMN HOME_RESOURCE_ID TYPE bigint; ALTER TABLE SCHEDULE_REPLY_WORK ALTER COLUMN RESOURCE_ID TYPE bigint; ALTER TABLE PRINCIPAL_PURGE_POLLING_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE PRINCIPAL_PURGE_POLLING_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE PRINCIPAL_PURGE_CHECK_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE PRINCIPAL_PURGE_CHECK_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE PRINCIPAL_PURGE_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE PRINCIPAL_PURGE_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE PRINCIPAL_PURGE_HOME_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE PRINCIPAL_PURGE_HOME_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE PRINCIPAL_PURGE_HOME_WORK ALTER COLUMN HOME_RESOURCE_ID TYPE bigint; ALTER TABLE MIGRATION_CLEANUP_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE MIGRATION_CLEANUP_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE MIGRATION_CLEANUP_WORK ALTER COLUMN HOME_RESOURCE_ID TYPE bigint; ALTER TABLE HOME_CLEANUP_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE HOME_CLEANUP_WORK ALTER COLUMN JOB_ID TYPE bigint; ALTER TABLE MIGRATED_HOME_CLEANUP_WORK ALTER COLUMN WORK_ID TYPE bigint; ALTER TABLE MIGRATED_HOME_CLEANUP_WORK ALTER COLUMN JOB_ID TYPE bigint; -- update the version update CALENDARSERVER set VALUE = '66' where NAME = 'VERSION';
the_stack
-- TEST: Validate parsing and strict enforcement for NULL CHECK ON NOT NULL. We -- leave this on for the remainder of the tests as this will soon be the -- default. -- + @ENFORCE_STRICT NULL CHECK ON NOT NULL -- + {enforce_strict_stmt}: ok -- + {int 12} @enforce_strict null check on not null; -- TEST: we'll be using printf in lots of places in the tests as an external proc -- + {declare_proc_no_check_stmt}: ok -- - Error DECLARE PROCEDURE printf NO CHECK; -- TEST: try to declare printf as a normal proc too -- + {declare_proc_stmt}: err -- + Error % procedure cannot be both a normal procedure and an unchecked procedure 'printf' -- +1 Error declare proc printf(); -- TEST: basic test table with an auto inc field (implies not null) -- + create_table_stmt% foo: % id: integer notnull primary_key autoinc -- - Error create table foo( id integer PRIMARY KEY AUTOINCREMENT ); -- TEST: exact duplicate table is ok -- + create_table_stmt% foo: % id: integer notnull primary_key autoinc -- - Error create table foo( id integer PRIMARY KEY AUTOINCREMENT ); -- TEST: create a table using type discrimation: kinds -- + {create_table_stmt}: with_kind: { id: integer<some_key>, cost: real<dollars>, value: real<dollars> } -- + {col_def}: id: integer<some_key> -- + {col_def}: cost: real<dollars> -- + {col_def}: value: real<dollars> -- - Error create table with_kind( id integer<some_key>, cost real<dollars>, value real<dollars> ); -- useful in later tests declare price_d real<dollars>; declare price_e real<euros>; -- TEST: second test table with combination of fields -- + {create_table_stmt}: bar: { id: integer notnull, name: text, rate: longint } -- - Error create table bar( id integer not null, name text @create(2), rate LONG INT @create(2) ); -- TEST: duplicate table name, creates error, will be ignored -- types will not be resolved due to early out -- + Error % duplicate table/view -- + {create_table_stmt}: err create table foo( id integer ); -- TEST: duplicate column names, creates error will be ignored -- + Error % duplicate column name 'id' -- + {create_table_stmt}: err create table baz( id integer, id integer ); -- TEST: ok to get ID from foo, unique -- + select: { id: integer notnull } -- - Error select ID from foo; -- TEST: make sure the type includes the kinds -- + {select_stmt}: select: { id: integer<some_key>, cost: real<dollars>, value: real<dollars> } -- - Error select * from with_kind; -- TEST: classic join -- + select: { id: integer notnull, name: text } -- + JOIN { T1: foo, T2: bar } -- - Error select T1.id, name from foo AS T1 inner join bar AS T2 ON T1.id = T2.id where rate > 0; -- TEST: left join still creates new nullable columns with no join condition -- this is necessary because "T2" might be empty -- + {select_stmt}: select: { id: integer notnull, id: integer } -- - Error select * from foo T1 left join foo T2; -- TEST: cross join does not create new nullable columns with join condition -- cross is the same as inner in SQLite, only reordering optimization is suppressed -- + {select_stmt}: select: { id: integer notnull, id: integer notnull } -- - Error select * from foo T1 cross join foo T2 on T1.id = T2.id; -- TEST: alternate join syntax -- + select: { name: text } -- + {select_from_etc}: JOIN { foo: foo, bar: bar } -- - Error select name from foo, bar; -- TEST: duplicate table alias in the join, error -- + Error % duplicate table name in join 'T1' -- + {select_stmt}: err select name from foo T1, bar T1, bar T1; -- TEST: ambiguous id in foo and bar -- + Error % identifier is ambiguous 'id' select id from foo, bar; -- TEST: column not present -- + Error % name not found 'not_found' select not_found from foo, bar; -- TEST: simple string select, string literals -- + select: { _anon: text notnull } -- - Error select 'foo'; -- TEST: string add not valid, further adding 3 does not create new errors -- + Error % left operand cannot be a string in '+' -- + {select_stmt}: err select 'foo' + 'bar' + 3; -- TEST: correct like expression -- + {like}: bool notnull -- + select_stmt}: select: { _anon: bool notnull } -- - Error select 'foo' like 'baz'; -- TEST: correct not like expression -- + {not_like}: bool notnull -- + {select_stmt}: select: { _anon: bool notnull } -- - Error select 'foo' not like 'baz'; -- TEST: 1 is not a string -- + Error % left operand must be a string in 'LIKE' -- + {select_stmt}: err select 1 like 'baz'; -- TEST: 1 is not a string in a "NOT LIKE" expr -- + Error % left operand must be a string in 'NOT LIKE' -- + {select_stmt}: err select 1 not like 'baz'; -- TEST: 2 is not a string -- + Error % right operand must be a string in 'LIKE' -- + {select_stmt}: err select 'foo' like 2; -- TEST: correct concat strings -- + {concat}: text notnull -- + select_stmt}: select: { _anon: text notnull } -- - Error select 'foo' || 'baz'; -- TEST: correct concat string or number case one -- + {concat}: text notnull -- + select_stmt}: select: { _anon: text notnull } -- - Error select 'foo' || 1; -- TEST: correct concat string or number case two -- + {concat}: text notnull -- + select_stmt}: select: { _anon: text notnull } -- - Error select 1.0 || 'baz'; -- TEST: converts to REAL -- + {select_stmt}: select: { _anon: real notnull } -- + {add}: real notnull -- + {int 1}: integer notnull -- + {dbl 2.0%}: real notnull -- - Error select 1 + 2.0; -- TEST: stays integer -- + {select_stmt}: select: { _anon: integer notnull } -- + {add}: integer notnull -- + {int 3}: integer notnull -- + {int 4}: integer notnull -- - Error select 3 + 4; -- TEST: invalid addition of string to id -- + Error % right operand cannot be a string in '+' -- + {select_stmt}: err select T1.id + 'foo' from foo T1; -- TEST: invalid addition of id to string -- + Error % left operand cannot be a string in '+' -- {select_stmt}: err select 'foo' + T1.id from foo T1; -- TEST: boolean is flexible with numerics -- + {and}: bool notnull -- + {int 1}: integer notnull -- + {int 2}: integer notnull -- - Error select 1 AND 2; -- TEST: logical operators can include null, creates nullable bool -- + {or}: bool -- + {null}: null -- + {int 1}: integer notnull -- - Error select null or 1; -- TEST: logical operators can include null, creates nullable bool -- + {and}: bool -- + {null}: null -- + {int 1}: integer notnull -- - Error select null and 1; -- TEST: ok to add to a boolean -- + {add}: integer notnull -- + {eq}: bool notnull -- - Error select (1 == 2) + 1; -- TEST: can't do a logical AND with a string -- + Error % left operand cannot be a string in 'AND' -- + {select_stmt}: err select 'foo' and 1; -- TEST: error prop handled correctly after invalid boolean -- + Error % right operand cannot be a string in 'AND' -- exactly one error -- OR does NOT get an error, just AND -- +1 Error -- + {or}: err -- + {and}: err -- + {int 1}: integer notnull -- + {strlit 'foo'} select 1 and 'foo' or 1; -- TEST: can't compare string and number -- + Error % incompatible types in expression '<' -- + {lt}: err select 'foo' < 1; -- TEST: can't compare string and number -- + Error % incompatible types in expression '>' -- + {gt}: err select 1 > 'foo'; -- TEST: string comparison is ok -- + {ne}: bool notnull -- + {strlit 'baz'}: text notnull -- + {strlit 'foo'}: text notnull -- - Error select 'baz' != 'foo'; -- TEST: can't compare string and number, error prop ok. -- + Error % incompatible types in expression '>' -- +1 Error -- + {gt}: err -- + {select_stmt}: err select 1 > 'foo' > 2; -- TEST: foo unknown gives error, error doesn't prop through like -- + Error % name not found 'foo' -- - Error % LIKE select foo like 'bar'; -- TEST: selecting negative ordinal (this has to be unary minus and 1) -- + {uminus}: integer notnull -- + {int 1}: integer notnull -- not negative one -- - {int -1} -- - Error select -1; -- TEST: can't do unary minus on string -- + Error % string operand not allowed in '-' -- + {uminus}: err select - 'x'; -- TEST: can't do NOT on strings -- + {not}: err -- + Error % string operand not allowed in 'NOT' select NOT 'x'; -- TEST: real is ok as a boolean, it's truthy -- + {not}: bool notnull -- + {dbl 1.2%}: real notnull -- - Error select NOT 1.2; -- TEST: non-null bool result even with null input -- + {is}: bool notnull -- + {null}: null -- - Error select null is null; -- TEST: incompatible types: is -- + {is}: err -- + Error % incompatible types in expression 'IS' -- +1 Error select 'x' is 1.2; -- TEST: non-null bool result even with null input -- + {is_not}: bool notnull -- + {null}: null -- - Error select null is not null; -- TEST: unary math does not double report errors -- + {uminus}: err -- + Error % string operand not allowed in 'NOT' -- exactly one error -- +1 Error select - NOT 'x'; -- TEST: unary logical does not double report errors -- + {not}: err -- + Error % string operand not allowed in '-' -- exactly one error -- +1 Error select NOT - 'x'; -- TEST: unary is null or is not null does not double report errors -- + {is}: err -- + Error % string operand not allowed in '-' -- exactly one error -- +1 Error select (- 'x') is null; -- TEST: negative boolean is ok -- + {uminus}: integer notnull -- + {not}: bool notnull -- + {int 1}: integer notnull -- - Error select - NOT 1; -- TEST: negative float is ok -- + {uminus}: real notnull -- + {dbl 1.2%}: real notnull -- - Error select - 1.2; -- TEST: int*int -> int -- + {mul}: integer notnull -- - Error select 1 * 2; -- TEST: int-int -> int -- + {sub}: integer notnull -- - Error select 3 - 4; -- TEST: int / int -> int -- + {div}: integer notnull -- - Error select 6 / 3; -- TEST: int % int -> int -- + {mod}: integer notnull -- - Error select 6 % 3; -- TEST: int >= int -> bool -- + {ge}: bool notnull -- - Error select 2 >= 1; -- TEST: int <= int -> bool -- + {le}: bool notnull -- - Error select 1 <= 2; -- TEST: int == int -> bool -- + {eq}: bool notnull -- - Error select 2 = 2; -- TEST: select * produces correct tables joining foo and bar -- - Error -- + {select_stmt}: select: { id: integer notnull, id: integer notnull, name: text, rate: longint } -- + {select_from_etc}: JOIN { foo: foo, bar: bar } select * from foo, bar; -- TEST: select expression alias to one, two works -- - Error -- + {select_stmt}: select: { one: integer notnull, two: integer notnull } select 1 as one, 2 as two; -- TEST: select * with no from is an error -- + Error % select * cannot be used with no FROM clause -- +1 Error -- + {select_stmt}: err -- + {star}: err select *; -- TEST: anonymous columns produce an error -- + {insert_stmt}: err -- + Error % all columns in the select must have a name -- +1 Error insert into foo(id) select * from ( select 1 ); -- TEST: anonymous columns produce an error (with T.* syntax too) -- + {insert_stmt}: err -- + Error % all columns in the select must have a name -- +1 Error insert into foo(id) select T.* from ( select 1 ) as T; -- TEST: select where statement -- + {select_stmt}: select: { T: integer notnull } -- + {select_core}: select: { T: integer notnull } -- + {select_expr_list_con}: select: { T: integer notnull } -- + {select_expr_list}: select: { T: integer notnull } -- + {select_from_etc}: ok -- + {select_where} -- - Error select 10 as T where T = 1; -- TEST: select where with a column specified -- + {select_stmt}: err -- + {name c}: err -- + {select_from_etc}: ok -- + Error % name not found 'c' -- + Error select c where 1; -- TEST: select * from bogus table doesn't give more errors -- + Error % table/view not defined 'goo' -- +1 Error -- + {select_stmt}: err -- + {table_or_subquery}: err select * from goo; -- TEST: add a table with some big stuff -- - Error -- + {col_def}: l: longint -- + {col_def}: r: real create table big ( l LONG integer, r REAL ); -- TEST: create a long int -- - Error -- + {select_stmt}: select: { l: longint } select l from big; -- TEST: long * int -> long -- - Error -- + {select_stmt}: select: { _anon: longint } -- + {select_from_etc}: TABLE { big: big } select l * 1 from big; -- TEST: long * bool -> long (nullables) -- - Error -- + {select_stmt}: select: { _anon: longint } -- + {select_from_etc}: TABLE { big: big } select l * (1==1) from big; -- TEST: long * real -> real (nullables) -- - Error -- + {select_stmt}: select: { _anon: real } -- + {select_from_etc}: TABLE { big: big } select l * 2.0 from big; -- TEST: not x is an error, no cascade error reported just one error -- + Error % incompatible types in expression '=' -- +1 Error -- + {select_stmt}: err -- + {eq}: err -- + {not}: err select not 'x' == 1; -- TEST: `when` expression must be valid -- + Error % right operand must be a string in 'LIKE' -- +1 Error select case when 'x' like 42 then 'foo' end; -- TEST: ok to have two different strings -- - Error -- note there was no else case, so nullable result -- + {select_stmt}: select: { _anon: text } -- + {case_list}: text -- +2 {when}: text notnull select case when 1 = 2 then 'foo' when 3 = 4 then 'bar' end; -- TEST: can't combine a string and a number -- + Error % incompatible types in expression 'then' -- +1 Error -- + {select_stmt}: err -- + {case_expr}: err -- + {case_list}: err select case when 1 = 2 then 'foo' when 3 = 4 then 2 end; -- TEST: when expression should be a boolean -- + Error % incompatible types in expression 'when' -- +1 Error -- + {select_stmt}: err -- + {case_expr}: err -- + {strlit 'x'}: err select case when 'x' then 'foo' end; -- TEST: ok to compare strings to each other -- - Error -- note the result type is nullable, there was no else case! -- + {select_stmt}: select: { _anon: integer } -- + {case_expr}: integer select case 'x' when 'y' then 1 when 'z' then 2 end; -- TEST: ok to compare a real to an int -- - Error -- note the result type is nullable, there was no else case! -- + {select_stmt}: select: { _anon: integer } -- + {case_expr}: integer select case 2 when 1.0 then 1 when 3 then 2 end; -- TEST: can't compare a string and a number -- + Error % incompatible types in expression 'when' -- +1 Error -- + {select_stmt}: err -- + case_expr}: err -- + {strlit 'x'}: err select case 3 when 'x' then 1 end; -- TEST: int combines with real to give real -- - Error -- {select_stmt}: select: { _anon: real notnull } -- {case_expr}: real notnull select case 4 when 1 then 1 else 2.0 end; -- TEST: null combines with int to give nullable int -- - Error -- + {select_stmt}: select: { _anon: integer } -- + {case_expr}: integer -- - {case_expr}: integer notnull select case 5 when 0 then null when 1 then 1 end; -- TEST: real combines with real to give real -- - Error -- + {select_stmt}: select: { _anon: real notnull } -- + {case_expr}: real notnull select case 6 when 0 then 1.0 else 2.0 end; -- TEST: bool combines with null to give nullable bool -- - Error -- + {select_stmt}: select: { _anon: bool } -- + {case_expr}: bool -- - {case_expr}: bool notnull select case 7 when 0 then (1==2) else null end; -- TEST: else statement not compatible type with when -- + Error % incompatible types in expression 'else' -- +1 Error -- + {select_stmt}: err -- + {case_expr}: err -- + {strlit 'bar'}: err select case 8 when 0 then 1 else 'bar' end; -- TEST: case statement has expression type error -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {select_stmt}: err -- + {case_expr}: err -- + {not}: err select case NOT 'x' when 1 then 0 end; -- TEST: ranges ok as integer -- - Error -- + {select_stmt}: select: { _anon: bool notnull } -- + {between}: bool notnull select 1 between 0 and 2; -- TEST: ranges ok as string -- - Error -- + {select_stmt}: select: { _anon: bool notnull } -- + {between}: bool notnull select 'x' between 'a' and 'z'; -- TEST: string cannot be compared to integers -- + Error % incompatible types in expression 'BETWEEN' -- +1 Error -- + {select_stmt}: err -- + {between}: err select 'x' between 2 and 3; -- TEST: string cannot be compared to integers -- second item -- + Error % incompatible types in expression 'BETWEEN' -- +1 Error -- + {select_stmt}: err -- + {between}: err select 'x' between null and 3; -- TEST: null can be compared to anything -- - Error -- note nullable result -- + {select_stmt}: select: { _anon: bool } -- + {between}: bool select null between 1 and 2; -- TEST: range items must be comparable to each other -- + Error % incompatible types in expression 'BETWEEN/AND' -- +1 Error -- + {select_stmt}: err -- + {between}: err select null between 1 and 'x'; -- TEST: don't re-report errors if there is already a failure in the expression -- Note: here we also verify that NOT is weaker than between hence requires the parens stay -- + SELECT (NOT 'x') BETWEEN 1122 AND 3344; -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {select_stmt}: err -- + {between}: err select (NOT 'x') between 1122 and 3344; -- TEST: ranges ok as integer (NOT BETWEEN) -- - Error -- + {select_stmt}: select: { _anon: bool notnull } -- + {not_between}: bool notnull select 1 not between 0 and 2; -- TEST: ranges ok as string -- - Error -- + {select_stmt}: select: { _anon: bool notnull } -- + {not_between}: bool notnull select 'x' not between 'a' and 'z'; -- TEST: string cannot be compared to integers -- + Error % incompatible types in expression 'NOT BETWEEN' -- +1 Error -- + {select_stmt}: err -- + {not_between}: err select 'x' not between 2 and 3; -- TEST: string cannot be compared to integers -- second item -- + Error % incompatible types in expression 'NOT BETWEEN' -- +1 Error -- + {select_stmt}: err -- + {not_between}: err select 'x' not between null and 3; -- TEST: null can be compared to anything -- - Error -- note nullable result -- + {select_stmt}: select: { _anon: bool } -- + {not_between}: bool select null not between 1 and 2; -- TEST: range items must be comparable to each other -- + Error % incompatible types in expression 'NOT BETWEEN/AND' -- +1 Error -- + {select_stmt}: err -- + {not_between}: err select null not between 1 and 'x'; -- TEST: don't re-report errors if there is already a failure in the expression -- Note: here we also verify that NOT is weaker than not between hence requires the parens stay -- + SELECT (NOT 'x') NOT BETWEEN 1122 AND 3344; -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {select_stmt}: err -- + {not_between}: err select (NOT 'x') not between 1122 and 3344; -- TEST: nested select statement in the from clause -- - Error -- +2 {select_stmt}: select: { id: integer notnull, name: text notnull } -- + {select_from_etc}: TABLE { Item: select } -- + {select_stmt}: select: { id: integer notnull, name: text notnull } select * from ( select 1 as id, 'x' as name ) as Item; -- TEST: nested select statement with join -- - Error -- + {select_stmt}: select: { id1: integer notnull, name: text notnull, id2: integer notnull, brand: text notnull } -- + {select_stmt}: select: { id1: integer notnull, name: text notnull } -- + {select_stmt}: select: { id2: integer notnull, brand: text notnull } -- + {join_cond}: JOIN { Item: select, ItemBrand: select } select * from ( select 1 as id1, 'x' as name ) as Item inner join (select 1 as id2, 'b' as brand) as ItemBrand on ItemBrand.id2 = Item.id1; -- TEST: nested select expression -- - Error -- + {select_stmt}: select: { result: integer notnull } -- + {select_expr}: result: integer notnull -- + {select_stmt}: unused: integer notnull select (select 1 as unused) as result; -- TEST: nested select expression with wrong # of items -- + Error % nested select expression must return exactly one column -- +1 Error -- + {select_stmt}: err -- + {select_expr}: err -- + {select_expr_list_con}: select: { _anon: integer notnull, _anon: integer notnull } select (select 1, 2); -- TEST: nested select used for simple math -- - Error -- + {select_stmt}: select: { _anon: integer notnull } -- + {select_expr}: integer notnull select 1 * (select 1); -- TEST: nested select used for string concat -- - Error -- + {select_stmt}: select: { _anon: text notnull } -- + {select_expr}: integer notnull select (select 1) || (select 2); -- TEST: multiple table refs -- - Error -- + {select_stmt}: select: { id: integer notnull, id: integer notnull, name: text, rate: longint } -- + {select_from_etc}: JOIN { foo: foo, bar: bar } select * from (foo, bar); -- TEST: duplicate table refs -- + Error % duplicate table name in join 'foo' -- +1 Error -- + {select_stmt}: err -- + {select_from_etc}: err -- +2 {table_or_subquery}: TABLE { foo: foo } select * from (foo, foo); -- TEST: full join with all expression options (except offset which was added later) -- - Error -- + {select_stmt}: select: { id: integer notnull, id: integer notnull, name: text, rate: longint } -- + {opt_where}: bool notnull -- + {opt_groupby}: ok -- + {opt_having}: bool -- + {opt_orderby}: ok -- + {opt_limit}: integer notnull select * from foo as T1 inner join bar as T2 on T1.id = T2.id where T2.id > 5 group by T2.name having T2.name = 'x' order by T2.rate limit 5; -- TEST: join with bogus ON expression type -- + Error % expected numeric expression 'ON' -- +1 Error -- + {select_stmt}: err -- + {on}: err select * from foo inner join bar as T2 on 'v' where 'w' having 'x' limit 'y'; -- TEST: join with bogus other expression types -- one of few cases where error processing continues -- + Error % expected numeric expression 'WHERE' -- + Error % expected numeric expression 'HAVING' -- + Error % HAVING clause requires GROUP BY clause -- +3 Error -- + {select_stmt}: err select * from foo where 'w' having 'x' limit 'y'; -- TEST: select with bogus order by x limit x -- + Error % name not found 'bogus' -- + Error % expected numeric expression 'LIMIT' -- +2 Error -- + {select_stmt}: err select * from foo order by bogus limit 'y'; -- TEST: force the case where a nested select has an error -- the top level select should be marked with an error -- + Error % string operand not allowed in 'NOT' -- +1 Error -- +2 {select_stmt}: err -- + {not}: err select (select not 'x'); -- TEST: basic IN statement -- null is ok anywhere -- - Error -- + {select_stmt}: select: { _anon: bool notnull } -- + {in_pred}: bool notnull -- +2 {int 1}: integer notnull -- +1 {int 2}: integer notnull -- + {null}: null select 1 in (1, 2, null); -- TEST: can't match strings against a number -- + Error % incompatible types in expression 'IN' -- +1 Error -- + {select_stmt}: err -- + {in_pred}: err select 1 in ('x', 2); -- TEST: simple string works -- - Error -- + {select_stmt}: select: { _anon: bool notnull } -- note null in the list changes nothing -- + {in_pred}: bool notnull -- +2 {strlit 'x'}: text notnull -- +1 {strlit 'y'}: text notnull -- +1 {null}: null select 'x' in ('x', 'y', null); -- TEST: string can't be matched against number -- + Error % incompatible types in expression 'IN' -- +1 Error -- + {select_stmt}: err -- + {in_pred}: err select 'x' in ('x', 1); -- TEST: null can match against numbers -- - Error -- nullable result! CG will make the answer null -- + {select_stmt}: select: { _anon: bool } -- + {expr_list}: integer notnull select null in (1, 2); -- TEST: null can match against strings -- - Error -- nullable result! CG will make the answer null -- + {select_stmt}: select: { _anon: bool } -- + {expr_list}: text notnull select null in ('x', 'y', null); -- TEST: numbers are ok and so are strings, but you can't mix and match -- + Error % incompatible types in expression 'IN' -- +1 Error -- + {select_stmt}: err -- + {in_pred}: err select null in (1, 'x'); -- TEST: no casade errors if the left arg of in has an error -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {select_stmt}: err -- + {in_pred}: err -- + {not}: err select (not 'x') in (1, 'x'); -- TEST: no casade errors if the predicate has an error -- "select distinct" used here just to force that option to run -- semantic analysis does not care about it (so verify successfully ignored?) -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {select_stmt}: err -- + {in_pred}: err -- + {not}: err select distinct 1 in (1, not 'x', 'y'); -- TEST: basic NOT IN statement -- null is ok anywhere -- - Error -- + {select_stmt}: select: { _anon: bool notnull } -- + {not_in}: bool notnull -- +2 {int 1}: integer notnull -- +1 {int 2}: integer notnull -- + {null}: null select 1 not in (1, 2, null); -- TEST: can't match strings against a number -- + Error % incompatible types in expression 'NOT IN' -- +1 Error -- + {select_stmt}: err -- + {not_in}: err select 1 not in ('x', 2); -- TEST: simple string works -- - Error -- + {select_stmt}: select: { _anon: bool notnull } -- note null in the list changes nothing -- + {not_in}: bool notnull -- +2 {strlit 'x'}: text notnull -- +1 {strlit 'y'}: text notnull -- +1 {null}: null select 'x' not in ('x', 'y', null); -- TEST: string can't be matched against number -- + Error % incompatible types in expression 'NOT IN' -- +1 Error -- + {select_stmt}: err -- + {not_in}: err select 'x' not in ('x', 1); -- TEST: null can match against numbers -- - Error -- nullable result! CG will make the answer null -- + {select_stmt}: select: { _anon: bool } -- + {expr_list}: integer notnull select null not in (1, 2); -- TEST: null can match against strings -- - Error -- nullable result! CG will make the answer null -- + {select_stmt}: select: { _anon: bool } -- + {expr_list}: text notnull select null not in ('x', 'y', null); -- TEST: numbers are ok and so are strings, but you can't mix and match -- + Error % incompatible types in expression 'NOT IN' -- +1 Error -- + {select_stmt}: err -- + {not_in}: err select null not in (1, 'x'); -- TEST: create a view -- - Error -- + {create_view_stmt}: MyView: { f1: integer notnull, f2: integer notnull, f3: integer notnull } -- + {name MyView} -- + {select_stmt}: MyView: { f1: integer notnull, f2: integer notnull, f3: integer notnull } create view MyView as select 1 as f1, 2 as f2, 3 as f3; -- TEST: create a view -- exact duplicate is allowed -- - Error -- + {create_view_stmt}: MyView: { f1: integer notnull, f2: integer notnull, f3: integer notnull } -- + {name MyView} -- + {select_stmt}: MyView: { f1: integer notnull, f2: integer notnull, f3: integer notnull } create view MyView as select 1 as f1, 2 as f2, 3 as f3; -- TEST: try to use the view -- - Error -- + {select_stmt}: select: { f1: integer notnull, f2: integer notnull, f3: integer notnull } -- + select_from_etc}: TABLE { ViewAlias: MyView } select f1, f2, ViewAlias.f3 from MyView as ViewAlias; -- TEST: try to make a duplicate view (re-use a view) -- + Error % duplicate table/view name 'MyView' -- + {create_view_stmt}: err -- + {name MyView}: err create view MyView as select 1 y; -- TEST: try to make a duplicate view (re-use a table) -- + Error % duplicate table/view name 'foo' -- + {create_view_stmt}: err create view foo as select 2 x; -- TEST: no error cascade (one error, just the internal error) -- + Error % string operand not allowed in 'NOT' -- +1 Error -- - Error % duplicate -- + {create_view_stmt}: err create view MyView as select NOT 'x'; -- TEST: this view create will fail with one error -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {create_view_stmt}: err -- + {not}: err create view V as select NOT 'x'; -- TEST: can't select from V, it failed. -- + Error % table/view not defined 'V' -- + {select_stmt}: err -- + {select_from_etc}: err -- + {table_or_subquery}: err select * from V; -- TEST: create an index -- - Error -- + {create_index_stmt}: ok -- + {name id}: id: integer notnull create index index_1 on foo(id); -- TEST: exact duplicate index is ok -- - Error -- + {create_index_stmt}: ok -- + {name id}: id: integer notnull create index index_1 on foo(id); -- TEST: exact duplicate index is ok -- + {create_index_stmt}: err -- + Error % migration proc not allowed on object 'index_4' -- +1 Error create index index_4 on foo(id) @delete(1, AMigrateProc); -- TEST: try to create a duplicate index -- + Error % duplicate index name 'index_1' -- -- + {create_index_stmt}: err create index index_1 on bar(id); -- TEST: try to create an index on a table that doesn't exist -- + Error % create index table name not found 'doesNotExist' -- +1 Error -- + {create_index_stmt}: err create index index_2 on doesNotExist(id); -- TEST: try to create an index on columns that do not exist -- + Error % name not found 'doesNotExist' -- +1 Error -- + {create_index_stmt}: err -- + {name doesNotExist}: err create index index_3 on foo(doesNotExist); -- TEST: index on a basic expression -- + CREATE INDEX index_4 ON foo (id + id); -- + {create_index_stmt}: ok -- - Error create index index_4 on foo(id+id); -- TEST: index on a bogus expression -- + {create_index_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create index index_5 on foo(not 'x'); -- TEST: duplicate expressions still give an error -- + CREATE INDEX index_6 ON foo (id + id, id + id); -- + {create_index_stmt}: err -- + Error % name list has duplicate name 'id + id' -- +1 Error create index index_6 on foo(id+id, id+id); -- TEST: partial index with valid expression -- + CREATE INDEX index_7 ON foo (id + id) -- + WHERE id < 100; -- + {create_index_stmt}: ok -- + {opt_where}: bool notnull -- - Error create index index_7 on foo(id+id) where id < 100; -- TEST: partial index with invalid expression (semantic error) -- + {create_index_stmt}: err -- + {opt_where}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create index index_8 on foo(id) where not 'x'; -- TEST: partial index with invalid expression (x not in scope) -- + {create_index_stmt}: err -- + {opt_where}: err -- + Error % name not found 'x' -- +1 Error create index index_9 on foo(id) where x = 5; -- TEST: partial index with invalid expression (not numeric) -- + {create_index_stmt}: err -- + {opt_where}: err -- + Error % expected numeric expression 'WHERE' -- +1 Error create index index_10 on foo(id) where 'hi'; -- TEST: validate primary key columns, ok -- - Error -- + {create_table_stmt}: simple_pk_table: { id: integer notnull } create table simple_pk_table( id integer not null, PRIMARY KEY (id) ); -- TEST: validate primary key columns, bogus name -- + Error % name not found 'pk_col_not_exist' -- +1 Error -- + {create_table_stmt}: err -- + {name pk_col_not_exist}: err create table baz( id integer not null, PRIMARY KEY (pk_col_not_exist) ); -- TEST: validate PK not duplicated -- + Error % more than one primary key in table 'baz' -- +1 Error -- + {create_table_stmt}: err create table baz( id integer not null, PRIMARY KEY (id), PRIMARY KEY (id) ); -- TEST: validate simple unique key -- - Error -- + {create_table_stmt}: simple_ak_table: { id: integer notnull } -- + {name ak1} create table simple_ak_table ( id integer not null, CONSTRAINT ak1 UNIQUE (id) ); -- TEST: validate simple in group of unique key overlapping each others -- + {create_table_stmt}: simple_ak_table_2: { a: integer notnull, b: text, c: real, d: longint } -- - Error create table simple_ak_table_2 ( a integer not null, b text, c real, d long int, UNIQUE (a, b), UNIQUE (a, c), UNIQUE (d) ); -- TEST: validate simple in group of unique key containing one column in common -- + {create_table_stmt}: simple_ak_table_3: { a: integer notnull, b: text, c: real, d: longint } -- - Error create table simple_ak_table_3 ( a integer not null, b text, c real, d long int, UNIQUE (a, b), UNIQUE (b, d) ); -- TEST: invalidate unique key that is the subset (in order) of another, (a, b, c) is invalid because (a, b) is already unique key -- + {create_table_stmt}: err -- + Error % at least part of this unique key is redundant with previous unique keys -- + Error create table simple_ak_table_4 ( a integer not null, b text, c real, UNIQUE (a, b), UNIQUE (a, b, c) ); -- TEST: invalidate same column in two unique key, (b, a) is invalid because (a, b) is already unique key -- + {create_table_stmt}: err -- + Error % at least part of this unique key is redundant with previous unique keys -- + Error create table simple_ak_table_5 ( a integer not null, b text, c real, d long int, UNIQUE (a, b), UNIQUE (b, a) ); -- TEST: invalidate unique key that is the subset (at end) of another, (c, d, b, a) is invalid because subset (a, b) is already unique key -- + {create_table_stmt}: err -- + Error % at least part of this unique key is redundant with previous unique keys -- + Error create table simple_ak_table_6 ( a integer not null, b text, c real, d long int, UNIQUE (a, b), UNIQUE (c, d, b, a) ); -- TEST: invalidate unique key that is the subset (at start) of another, (a, b) is invalid because (a) is unique key -- + {create_table_stmt}: err -- + Error % at least part of this unique key is redundant with previous unique keys -- + Error create table simple_ak_table_7 ( a integer not null, b text, c real, d long int, UNIQUE (a, b), UNIQUE (a) ); -- TEST: validate unique key expression -- + CONSTRAINT ak1 UNIQUE (id / 2) -- + {create_table_stmt}: baz_expr_uk: { id: integer notnull primary_key autoinc } -- - Error create table baz_expr_uk ( id integer PRIMARY KEY AUTOINCREMENT not null, CONSTRAINT ak1 UNIQUE (id/2) ); -- TEST: unique key expression is bogus -- + CONSTRAINT ak1 UNIQUE (random()) -- + {create_table_stmt}: err -- + Error % function may not appear in this context 'random' -- +1 Error create table baz_expr_uk_bogus ( id integer PRIMARY KEY AUTOINCREMENT not null, CONSTRAINT ak1 UNIQUE (random()) ); -- TEST: validate primary key expression -- + CONSTRAINT pk1 PRIMARY KEY (id / 2) -- note id was not converted to 'not null' because constraint id+1 does not match column id -- + {create_table_stmt}: baz_expr_pk: { id: integer } -- - Error create table baz_expr_pk ( id integer, CONSTRAINT pk1 PRIMARY KEY (id/2) ); -- TEST: primary key expression is bogus -- + CONSTRAINT pk1 PRIMARY KEY (random()) -- + {create_table_stmt}: err -- + Error % function may not appear in this context 'random' -- +1 Error create table baz_expr_uk_bogus ( id integer, CONSTRAINT pk1 PRIMARY KEY (random()) ); -- TEST: validate duplicate unique key -- + Error % duplicate constraint name in table 'ak1' -- +1 Error -- + {create_table_stmt}: err create table baz_dup_uk ( id integer PRIMARY KEY AUTOINCREMENT not null, CONSTRAINT ak1 UNIQUE (id), CONSTRAINT ak1 UNIQUE (id) ); -- TEST: validate duplicate primary unique key -- + Error % duplicate constraint name in table 'pk1' -- +1 Error -- + {create_table_stmt}: err create table baz_dup_pk ( id integer not null, CONSTRAINT pk1 PRIMARY KEY (id), CONSTRAINT pk1 PRIMARY KEY (id) ); -- TEST: validate duplicate in group of unique key -- + Error % at least part of this unique key is redundant with previous unique keys -- +1 Error -- + {create_table_stmt}: err create table baz_2 ( id integer PRIMARY KEY AUTOINCREMENT not null, name text, UNIQUE (id, name), UNIQUE (name, id) ); -- TEST: validate unique key columns -- + Error % name not found 'ak_col_not_exist' -- +1 Error -- + {create_table_stmt}: err -- + {name ak_col_not_exist}: err create table baz ( id integer PRIMARY KEY AUTOINCREMENT not null, CONSTRAINT ak1 UNIQUE (ak_col_not_exist) ); -- TEST: validate group of unique key columns -- + Error % name not found 'ak_col_not_exist' -- +1 Error -- + {create_table_stmt}: err -- + {name ak_col_not_exist}: err create table baz_3 ( id integer PRIMARY KEY AUTOINCREMENT not null, UNIQUE (ak_col_not_exist) ); -- TEST: make a valid FK -- - Error -- + {create_table_stmt}: fk_table: { id: integer foreign_key } -- +2 {name_list} -- +2 {name id}: id: integer create table fk_table ( id integer, FOREIGN KEY (id) REFERENCES foo(id) ); -- TEST: make a valid FK -- + Error % duplicate constraint name in table 'x' create table fk_table_dup ( id integer, constraint x foreign key (id) references foo(id), constraint x foreign key (id) references foo(id) ); -- TEST: make an FK that refers to a bogus column in the current table -- + Error % name not found 'bogus' -- +1 Error -- + {create_table_stmt}: err create table baz ( id integer, FOREIGN KEY (bogus) REFERENCES foo(id) ); -- TEST: make an FK that refers to a bogus column in the reference table -- + Error % name not found 'bogus' -- +1 Error -- + {create_table_stmt}: err create table baz ( id integer, FOREIGN KEY (id) REFERENCES foo(bogus) ); -- TEST: make an FK that refers to a bogus table -- + Error % foreign key refers to non-existent table 'bogus' -- +1 Error -- create_table_stmt}: err create table baz ( id integer, FOREIGN KEY (id) REFERENCES bogus(id) ); -- TEST: well formed if statement -- - Error -- +1 {if_stmt}: integer notnull -- +1 {cond_action}: integer notnull -- +1 {if_alt}: ok -- +1 {else}: ok -- +2 {stmt_list}: ok if 1 then select 1; else select 2; end if; -- TEST: if with bad predicate -- + Error % expected numeric expression in IF predicate -- +1 Error -- +1 {if_stmt}: err -- +1 {cond_action}: err -- - {stmt_list}: err if 'x' then select 1; end if; -- TEST: if with error predicate, no double error reporting -- + Error % string operand not allowed in 'NOT' -- +1 Error -- +1 {if_stmt}: err -- +1 {cond_action}: err -- - {stmt_list}: err if not 'x' then select 1; end if; -- TEST: if with bogus statement list, no double error reporting -- + Error % string operand not allowed in 'NOT' -- +1 Error -- +1 {if_stmt}: err -- +1 {cond_action}: err -- +1 {stmt_list}: err if 1 then select not 'x'; end if; -- TEST: if with bogus statement list in else blocki, no double error reporting -- + Error % string operand not allowed in 'NOT' -- +1 Error -- +1 {if_stmt}: err -- +1 {cond_action}: integer notnull -- +1 {if_alt}: err -- +1 {else}: err if 1 then select 1; else select not 'x'; end if; -- TEST: if with else if clause -- - Error -- +1 {if_stmt}: integer notnull -- +2 {cond_action}: integer notnull -- +1 {if_alt}: ok -- +1 {elseif}: integer notnull -- +1 {else}: ok if 1 then select 1; else if 2 then select 2; else select 3; end if; -- TEST: if with else if clause bogus expression type -- + Error % expected numeric expression in IF predicate -- +1 Error -- +1 {if_stmt}: err -- +1 {if_alt}: err -- +1 {cond_action}: integer notnull -- +1 {cond_action}: err if 1 then select 1; else if '2' then select 2; else select 3; end if; -- TEST: create an error down the else if list and make sure it props to the front of the list -- that causes the whole statement to be correctly reported as having an error -- + Error % expected numeric expression in IF predicate -- +1 Error -- +1 {if_stmt}: err -- +1 {if_alt}: err -- +3 {cond_action}: integer notnull -- +1 {cond_action}: err if 1 then select 1; else if 2 then select 2; else if 3 then select 3; else if '4' then select 4; end if; -- TEST: force an error in the group by clause, this error must spoil the whole statement -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {select_stmt}: err -- + {opt_groupby}: err select id from foo group by id, not 'x'; -- TEST: force an error in the order by clause, this error must spoil the whole statement -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {select_stmt}: err -- + {opt_orderby}: err select id from foo order by id, not 'x'; -- TEST: smallish table to cover some missing cases, bool field and an int with default -- - Error -- + {create_table_stmt}: booly: { id: integer has_default, flag: bool } create table booly ( id integer DEFAULT 8675309, flag BOOL ); declare enum ints integer ( negative_one = -1, postive_one = 1 ); -- TEST: use const expr where normally literals go in default value -- + {col_attrs_default}: err -- + {const}: err -- + x INTEGER DEFAULT -1, -- + y INTEGER DEFAULT CONST(1 / 0) -- + Error % evaluation of constant failed create table bad_constants_table( x integer default const(ints.negative_one), y integer default const(1/0) ); -- TEST: this should be of type bool not type int -- rewritten as "TRUE" -- this proves that we can correctly produce the semantic type bool from the bool literal -- + LET bool_x := TRUE; -- + {let_stmt}: bool_x: bool notnull variable -- - Error let bool_x := const(1==1); @enforce_strict is true; -- TEST: strict mode for is true disables is true -- + {assign}: err -- + Error % Operator may not be used because it is not supported on old versions of SQLite 'IS TRUE' -- +1 Error set bool_x := 1 is true; -- TEST: strict mode for is true disables is false -- + {assign}: err -- + Error % Operator may not be used because it is not supported on old versions of SQLite 'IS FALSE' -- +1 Error set bool_x := 1 is false; -- TEST: strict mode for is true disables is not true -- + {assign}: err -- + Error % Operator may not be used because it is not supported on old versions of SQLite 'IS NOT TRUE' -- +1 Error set bool_x := 1 is not true; -- TEST: strict mode for is true disables is not false -- + {assign}: err -- + Error % Operator may not be used because it is not supported on old versions of SQLite 'IS NOT FALSE' -- +1 Error set bool_x := 1 is not false; @enforce_normal is true; -- TEST: 2 is true -- rewritten as "TRUE" -- + SET bool_x := TRUE; -- - Error set bool_x := const(2 is true); -- TEST: 2 is true -- rewritten as "FALSE" -- + SET bool_x := FALSE; -- - Error set bool_x := const(2 is not true); -- TEST: eval error bubbles up -- + {assign}: err -- + SET bool_x := CONST(1 / 0 IS TRUE); -- + Error % evaluation of constant failed set bool_x := const(1/0 is true); -- TEST: true is not 2 --> this is true is an operator -- rewritten as "FALSE" -- + SET bool_x := FALSE; -- - Error set bool_x := const(true is 2); -- TEST: null is not true -- rewritten as "FALSE" -- + SET bool_x := FALSE; -- - Error set bool_x := const(null is true); -- TEST: null is not true -- rewritten as "TRUE" -- + SET bool_x := TRUE; -- - Error set bool_x := const(null is not true); -- TEST: 0 is false -- rewritten as "TRUE" -- + SET bool_x := TRUE; -- - Error set bool_x := const(0 is false); -- TEST: 0 is not false -- rewritten as "FALSE" -- + SET bool_x := FALSE; -- - Error set bool_x := const(0 is not false); -- TEST: null is not false -- rewritten as "TRUE" -- + SET bool_x := TRUE; -- - Error set bool_x := const(null is not false); -- TEST: 1/0 is not false -> error -- not rewritten due to error -- + {assign}: err -- + SET bool_x := CONST(1 / 0 IS NOT FALSE); -- + Error % evaluation of constant failed set bool_x := const(1/0 is not false); -- TEST: 1/0 is not false -> error -- not rewritten due to error -- + {assign}: err -- + SET bool_x := CONST(1 / 0 IS NOT TRUE); -- + Error % evaluation of constant failed set bool_x := const(1/0 is not true); -- TEST: null is not false -- rewritten as "0" -- + SET bool_x := FALSE; -- - Error set bool_x := const(null is false); -- TEST: eval error bubbles up -- + {assign}: err -- + SET bool_x := CONST(1 / 0 IS FALSE); -- + Error % evaluation of constant failed set bool_x := const(1/0 is false); -- TEST: internal const expression -- the internal const(1==1) is evaluated to a literal which then is used by the outer const -- the result must still be bool, this proves that we can correctly eval the type of -- an internal bool literal -- + LET bool_x2 := TRUE; -- + {let_stmt}: bool_x2: bool notnull variable -- - Error let bool_x2 := const(const(1==1)); -- TEST: use const expr where literals go in attribute -- + {const}: err -- + @ATTRIBUTE(whatever=-1) -- + @ATTRIBUTE(whatever=CONST(1 / 0)) -- + Error % evaluation of constant failed @attribute(whatever=const(ints.negative_one)) @attribute(whatever=const(1/0)) declare proc bad_constants_proc(); -- TEST: use bad constant expr in nested context -- + {const}: err -- + @ATTRIBUTE(whatever=(1, CONST(1 / 0), 1)) -- + Error % evaluation of constant failed @attribute(whatever=(1, const(1/0), 1)) declare proc bad_constants_nested_proc(); -- TEST: try to use a NULL default value on a non nullable column -- + {create_table_stmt}: err -- + {col_def}: err -- + Error % cannot assign/copy possibly null expression to not null target 'default value' -- +1 Error create table bad_conversions( data integer not null default const(NULL) ); -- TEST: try to use a lossy conversion in a const expr default value -- + {create_table_stmt}: err -- + {col_def}: err -- + Error % lossy conversion from type 'REAL' in 2.200000e+00 -- +1 Error create table bad_conversions( data integer not null default const(1 + 1.2) ); -- TEST: allowable conversion, the constant becomes real -- + data REAL NOT NULL DEFAULT 1 -- - Error create table good_conversions( data real not null default const(1) ); -- TRUE constant -- + {let_stmt}: tru: bool notnull variable -- - Error LET tru := true; -- FALSE constant -- + {let_stmt}: fal: bool notnull variable -- - Error LET fal := false; -- Use TRUE and FALSE in a const expr -- + {assign}: fal: bool notnull variable -- - Error SET fal := const(FALSE AND TRUE); -- TEST: verify the correct types are extracted, also cover the final select option -- - Error -- + {select_stmt}: select: { id: integer, flag: bool } -- + {select_opts} -- + {distinctrow} select distinctrow id, flag from booly; -- TEST: make variables (X/Y are nullable) -- - Error -- + {declare_vars_type}: integer -- + {name X}: X: integer variable -- + {name Y}: Y: integer variable declare X, Y integer; -- TEST: make variables (X/Y are not null) -- - Error declare X_not_null integer not null; -- TEST: try to declare X again -- + Error % duplicate variable name in the same scope 'X' -- +1 Error -- + {declare_vars_type}: err -- + {name X}: err declare X integer; -- TEST: use the result code helper -- + SET X := @RC; -- + {assign}: X: integer variable -- + {name @RC}: @rc: integer notnull variable -- - Error set X := @RC; -- TEST: try to declare a variable that hides a table -- + Error % global variable hides table/view name 'foo' -- +1 Error -- + {declare_vars_type}: err -- + {name foo}: err declare foo integer; -- TEST: try to access a variable -- - Error -- + {select_stmt}: select: { Y: integer variable } -- + {name Y}: Y: integer variable select Y; -- TEST: create a cursor with select statement -- - Error -- + {declare_cursor}: my_cursor: select: { one: integer notnull, two: integer notnull } variable declare my_cursor cursor for select 1 as one, 2 as two; -- TEST: create a cursor with primitive kinds -- + {declare_cursor}: kind_cursor: select: { id: integer<some_key>, cost: real<dollars>, value: real<dollars> } variable -- - Error declare kind_cursor cursor for select * from with_kind; -- TEST: make a value cursor of the same shape -- + {declare_cursor_like_name}: kind_value_cursor: select: { id: integer<some_key>, cost: real<dollars>, value: real<dollars> } variable shape_storage value_cursor -- - Error declare kind_value_cursor cursor like kind_cursor; -- TEST: try to create a duplicate cursor -- + Error % duplicate variable name in the same scope 'my_cursor' -- +1 Error -- + {declare_cursor}: err -- + {name my_cursor}: err declare my_cursor cursor for select 1; -- TEST: the select statement is bogus, error cascade halted so the duplicate name is not reported -- + Error % string operand not allowed in 'NOT' -- +1 Error -- - duplicate -- + {declare_cursor}: err -- + {select_stmt}: err -- + {not}: err declare my_cursor cursor for select not 'x'; -- TEST: standard loop with leave -- - Error -- + {loop_stmt}: ok -- + {leave_stmt}: ok loop fetch my_cursor into X, Y begin leave; end; -- TEST: loop with leave, leave not the last statement -- + Error % in leave_stmt % statement should be the last thing in a statement list -- +1 Error while 1 begin leave; leave; end; -- TEST: loop with continue, continue not the last statement -- + Error % in continue_stmt % statement should be the last thing in a statement list -- +1 Error while 1 begin continue; leave; end; -- TEST: standard loop with continue -- - Error -- + {loop_stmt}: ok -- + {continue_stmt}: ok loop fetch my_cursor into X, Y begin continue; end; -- TEST: try to loop over a scalar -- + Error % variable is not a cursor 'X' -- +1 Error -- + {loop_stmt}: err -- + {fetch_stmt}: err -- + {name X}: err loop fetch X into y begin leave; end; -- TEST: try to loop over something that isn't present -- + Error % cursor not found 'not_a_variable' -- +1 Error -- + {loop_stmt}: err -- + {fetch_stmt}: err -- + {name not_a_variable}: err loop fetch not_a_variable into x begin leave; end; -- TEST: try to leave outside of a loop -- + Error % leave must be inside of a 'loop', 'while', or 'switch' statement -- +1 Error -- + {leave_stmt}: err leave; -- TEST: try to continue outside of a loop -- + Error % continue must be inside of a 'loop' or 'while' statement -- +1 Error -- + {continue_stmt}: err continue; -- TEST: legal return out of a procedure -- we have to check the next statement and that is tricky if there was -- attribute; this tests that case. -- + {return_stmt}: ok -- - Error create proc return_with_attr() begin if 1 then @attribute(goo) return; end if; end; -- TEST: proc uses @rc and becomes a dml proc -- note this is now a dml_proc (!) -- + {create_proc_stmt}: ok dml_proc -- + {assign}: result_code: integer notnull variable out -- + {name @RC}: @rc: integer notnull variable -- - Error create proc using_rc(out result_code integer not null) begin set result_code := @rc; end; -- TEST: legal return, no attribute on the return this time -- + {return_stmt}: ok -- - Error create proc return_no_attr() begin if 1 then return; end if; end; -- TEST: return must be the last statement (attr form) -- + Error % in return_stmt % statement should be the last thing in a statement list -- +1 Error create proc return_not_last_with_attr() begin if 1 then @attribute(goo) return; return; end if; end; -- TEST: return must be the last statement (no attr form) -- + Error % in return_stmt % statement should be the last thing in a statement list -- +1 Error create proc return_not_last_no_attr() begin if 1 then return; return; end if; end; -- TEST: return outside of any proc -- + Error % return statement should be in a procedure and not at the top level -- +1 Error return; -- TEST: return at top level, that's just goofy -- + Error % return statement should be in a procedure and not at the top level -- +1 Error create proc return_at_top_level() begin return; end; -- TEST: loop must prop errors inside it up so the overall loop is a semantic failure -- + Error % string operand not allowed in 'NOT' -- +1 Error -- {loop_stmt}: err loop fetch my_cursor into X, Y begin select not 'X'; end; -- TEST: open a valid cursor -- - Error -- + {open_stmt}: my_cursor: select: { one: integer notnull, two: integer notnull } variable open my_cursor; -- TEST: close a valid cursor -- - Error -- + {close_stmt}: my_cursor: select: { one: integer notnull, two: integer notnull } variable close my_cursor; -- TEST: open invalid cursor -- + Error % variable is not a cursor 'X' -- +1 Error -- + {open_stmt}: err -- + {name X}: err open X; -- TEST: close invalid cursor -- + Error % variable is not a cursor 'X' -- +1 Error -- + {close_stmt}: err -- + {name X}: err close X; -- TEST: close boxed cursor -- + {close_stmt}: err -- + Error % CLOSE cannot be used on a boxed cursor 'C' -- +1 Error create proc close_boxed_cursor(in box object<foo cursor>) begin declare C cursor for box; close C; end; -- TEST: a working delete -- - Error -- + {delete_stmt}: ok -- + {name foo}: foo: { id: integer notnull primary_key autoinc } -- + {opt_where}: bool notnull delete from foo where id = 33; -- TEST: delete from bogus table -- + Error % table in delete statement does not exist 'bogus_table' -- +1 Error -- + {delete_stmt}: err delete from bogus_table; -- TEST: delete from a view -- + Error % cannot delete from a view 'MyView' -- +1 Error -- + {delete_stmt}: err delete from MyView; -- TEST: delete with bogus expression -- + Error % name not found 'missing_column' -- +1 Error -- + {delete_stmt}: err -- + {name foo}: foo: { id: integer notnull primary_key autoinc } -- + {name missing_column}: err delete from foo where missing_column = 1; -- TEST: regular insert -- - Error -- + {insert_stmt}: ok -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {int 1}: integer notnull -- + {strlit 'bazzle'}: text notnull -- + {int 3}: integer notnull insert into bar values (1, 'bazzle', 3); -- TEST: replace statement -- - Error -- + {insert_stmt}: ok -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {int 1}: integer notnull -- + {strlit 'bazzle'}: text notnull -- + {int 3}: integer notnull replace into bar values (1, 'bazzle', 3); -- TEST: insert or fail -- - Error -- + {insert_stmt}: ok -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {int 1}: integer notnull -- + {strlit 'bazzle'}: text notnull -- + {int 3}: integer notnull insert or fail into bar values (1, 'bazzle', 3); -- TEST: insert or rollback -- - Error -- + {insert_stmt}: ok -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {int 1}: integer notnull -- + {strlit 'bazzle'}: text notnull -- + {int 3}: integer notnull insert or rollback into bar values (1, 'bazzle', 3); -- TEST: insert or abort -- - Error -- + {insert_stmt}: ok -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {int 1}: integer notnull -- + {strlit 'bazzle'}: text notnull -- + {int 3}: integer notnull insert or abort into bar values (1, 'bazzle', 3); -- TEST: insert default values -- - Error -- + {insert_stmt}: ok -- + {name_columns_values} -- + {name foo}: foo: { id: integer notnull primary_key autoinc } -- + {default_columns_values} insert into foo default values; -- TEST: insert default values -- + {insert_stmt}: err -- + Error % mandatory column with no default value in INSERT INTO name DEFAULT VALUES statement 'id' -- +1 Error insert into bar default values; -- TEST: insert into a table that isn't there -- + Error % table in insert statement does not exist 'bogus_table' -- +1 Error -- + {insert_stmt}: err -- + {name bogus_table} insert into bogus_table values (1); -- TEST: insert into a view -- + Error % cannot insert into a view 'MyView' -- +1 Error -- + {name MyView}: MyView: { f1: integer notnull, f2: integer notnull, f3: integer notnull } -- + {insert_stmt}: err insert into MyView values (1); -- TEST: insert with errors -- note that id is a field name of bar but it must not be found -- + Error % name not found 'id' -- +1 Error -- + {insert_stmt}: err -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {name id}: err insert into bar values (id, 'bazzle', 3); -- TEST: insert into foo, one column, it is autoinc, so use NULL -- - Error -- + {insert_stmt}: ok -- + {name foo}: foo: { id: integer notnull primary_key autoinc } insert into foo values (NULL); -- TEST: insert into bar, type mismatch -- + Error % incompatible types in expression 'id' -- +1 Error -- + {insert_stmt}: err -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {strlit 'string is wrong'}: err insert into bar values ('string is wrong', 'string', 1); -- TEST: insert into bar, type mismatch, 2 is wrong -- + Error % incompatible types in expression 'name' -- +1 Error -- + {insert_stmt}: err -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {int 2}: err insert into bar values (1, 2, 3); -- TEST: insert too many columns -- + Error -- +1 Error -- + Error % count of columns differs from count of values -- + {insert_stmt}: err -- + {name foo}: foo: { id: integer notnull primary_key autoinc } insert into foo values(NULL, 2); -- TEST: insert too few columns -- + Error -- +1 Error -- + Error % select statement with VALUES clause requires a non empty list of values -- + {insert_stmt}: err -- + {select_stmt}: err -- + {select_core}: err -- + {name foo}: foo: { id: integer notnull primary_key autoinc } insert into foo values(); -- TEST: insert into bar, null not allowed in non-null field -- + Error % cannot assign/copy possibly null expression to not null target 'id' -- +1 Error -- + {insert_stmt}: err insert into bar values (null, 'string', 1); -- TEST: table cannot have more than one autoinc -- + Error % table can only have one autoinc column 'id2' -- +1 Error -- + {create_table_stmt}: err create table two_autoincs_is_bad( id1 integer PRIMARY KEY AUTOINCREMENT not null, id2 integer PRIMARY KEY AUTOINCREMENT not null ); -- TEST: valid assignment -- - Error -- + {assign}: X: integer variable set X := 1; -- TEST: bogus variable name -- + Error % variable not found 'XX' -- +1 Error -- + {assign}: err -- + {name XX} set XX := 1; -- TEST: try to assign a cursor -- + Error % cannot set a cursor 'my_cursor' -- +1 Error -- + {assign}: err -- + {name my_cursor}: my_cursor: select: { one: integer notnull, two: integer notnull } variable set my_cursor := 1; -- TEST: variable type mismatch -- + Error % incompatible types in expression 'X' -- +1 Error -- + {assign}: err -- + {name X}: err set X := 'x'; -- TEST: null ok with everything -- - Error -- + {assign}: X: integer variable -- + {null}: null set X := null; -- TEST: error propagates up, no other reported error -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {assign}: err -- + {not}: err set X := not 'x'; -- TEST: simple cursor and fetch test -- - Error -- + {declare_cursor}: fetch_cursor: select: { _anon: integer notnull, _anon: text notnull, _anon: null } variable declare fetch_cursor cursor for select 1, 'foo', null; -- setup variables for the upcoming tests declare an_int integer; declare an_int2 integer; declare a_string text; declare a_string2 text; declare a_nullable text; declare an_long long integer; -- TEST: ok to fetch_stmt -- - Error -- + {fetch_stmt}: fetch_cursor: select: { _anon: integer notnull, _anon: text notnull, _anon: null } variable -- + {name an_int}: an_int: integer variable -- + {name a_string}: a_string: text variable -- + {name a_nullable}: a_nullable: text variable fetch fetch_cursor into an_int, a_string, a_nullable; -- TEST: fetch too few columns -- + Error % number of variables did not match count of columns in cursor 'fetch_cursor' -- +1 Error -- + {fetch_stmt}: err fetch fetch_cursor into an_int, a_string; -- TEST: fetch too many columns -- + Error % number of variables did not match count of columns in cursor 'fetch_cursor' -- +1 Error -- + {fetch_stmt}: err fetch fetch_cursor into an_int, a_string, a_nullable, a_string2; -- TEST: fetch an int into a string -- + Error % incompatible types in expression 'a_string2' -- +1 Error -- + {fetch_stmt}: err -- + {name a_string2}: err fetch fetch_cursor into a_string2, a_string, a_nullable; -- TEST: fetch a string into an int -- + Error % incompatible types in expression 'an_int2' -- +1 Error -- + {fetch_stmt}: err -- + {name an_int2}: err fetch fetch_cursor into an_int, an_int2, a_nullable; -- TEST: fetch using a bogus cursor -- + Error % cursor not found 'not_a_cursor' -- +1 Error -- + {fetch_stmt}: err -- + {name not_a_cursor}: err fetch not_a_cursor into i; -- TEST: fetch into a variable that doesn't exist -- + Error % FETCH variable not found 'non_existent_variable' -- +1 Error -- + {fetch_stmt}: err fetch fetch_cursor into non_existent_variable; -- TEST: fetch into variables, duplicate in the list -- + Error % duplicate name in list 'var_id' -- +1 Error -- + {fetch_stmt}: err -- +2 {name var_id} fetch fetch_cursor into var_id, var_id; -- TEST: create an index, duplicate name in index list -- + Error % name list has duplicate name 'id' -- +1 Error -- + {create_index_stmt}: err -- +2 {name id} create index index_7 on foo(id, id); -- TEST: validate no duplictes allowed in unique key -- + Error % name list has duplicate name 'key_id' -- +1 Error -- + {create_table_stmt}: err -- key_id shows up in its definition once, then 2 more times due to duplication -- +3 {name key_id} create table bad_table ( key_id integer PRIMARY KEY AUTOINCREMENT not null, CONSTRAINT ak1 UNIQUE (key_id, key_id) ); -- TEST: validate no duplictes allowed in group of unique key -- + Error % name list has duplicate name 'key_id' -- +1 Error -- + {create_table_stmt}: err -- key_id shows up in its definition once, then 2 more times due to duplication -- +3 {name key_id} create table bad_table_2 ( key_id integer PRIMARY KEY AUTOINCREMENT not null, UNIQUE (key_id, key_id) ); -- TEST: make an FK with duplicate id in the columns -- + Error % name list has duplicate name 'col_id' -- +1 Error -- + {create_table_stmt}: err -- col_id shows up in its definition once, then 2 more times due to duplication -- +3 {name col_id} create table bad_table ( col_id integer, FOREIGN KEY (col_id, col_id) REFERENCES foo(id) ); create table ref_target ( ref_id1 integer, ref_id2 integer ); -- TEST: make an FK with duplicate id in the reference columns -- + Error % name list has duplicate name 'ref_id1' -- +1 Error -- + {create_table_stmt}: err -- +2 {name ref_id1} create table bad_table ( id1 integer, id2 integer, FOREIGN KEY (id1, id2) REFERENCES ref_target(ref_id1, ref_id1) ); -- TEST: try to use a cursor as a value -- you get the "cursor has row" boolean -- - Error -- + {assign}: X: integer variable -- + {name X}: X: integer variable -- + {name my_cursor}: _my_cursor_has_row_: bool notnull variable set X := my_cursor; -- TEST: valid update -- - Error -- + {update_stmt}: foo: { id: integer notnull primary_key autoinc } -- + {opt_where}: bool notnull -- + {eq}: bool notnull -- + {name id}: id: integer notnull -- + {int 2}: integer notnull update foo set id = 1 where id = 2; -- TEST: update with kind matching, ok to update -- + {update_stmt}: with_kind: { id: integer<some_key>, cost: real<dollars>, value: real<dollars> } -- + {update_list}: ok -- - Error update with_kind set cost = price_d; -- TEST: update kind does not match, error -- + {update_stmt}: err -- + Error % expressions of different kinds can't be mixed: 'dollars' vs. 'euros' -- +1 Error update with_kind set cost = price_e; -- TEST: update with view -- + Error % cannot update a view 'myView' -- +1 Error -- + {update_stmt}: err update myView set id = 1; -- TEST: update with bogus where -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {update_stmt}: err -- + {opt_where}: err -- + {not}: err update foo set id = 1 where not 'x'; -- TEST: update with bogus limit -- + Error % expected numeric expression 'LIMIT' -- +1 Error -- + {update_stmt}: err -- + {opt_limit}: err -- + {strlit 'x'}: err update foo set id = 1 limit 'x'; -- TEST: update with bogus order by -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {update_stmt}: err -- + {opt_orderby}: err -- + {update_stmt}: err update foo set id = 1 order by not 'x' limit 2; -- TEST: update with bogus column specified -- + Error % name not found 'non_existent_column' -- +1 Error -- + {update_stmt}: err -- + {name non_existent_column}: err update foo set non_existent_column = 1; -- TEST: update with type mismatch (number <- string) -- + Error % incompatible types in expression 'id' -- +1 Error -- + {update_stmt}: err -- + {update_list}: err -- + {update_entry}: err -- + {name id}: id: integer notnull -- + {strlit 'x'}: text notnull update foo set id = 'x'; -- TEST: update with string type mismatch (string <- number) -- + Error % incompatible types in expression 'name' -- +1 Error -- + {update_stmt}: err -- + {update_list}: err -- + {update_entry}: err -- + {name name}: name: text -- + {int 2}: integer notnull update bar set name = 2; -- TEST: update not null column to constant null -- + Error % cannot assign/copy possibly null expression to not null target 'id' -- +1 Error -- + {update_stmt}: err -- + {update_list}: err -- + {name id}: id: integer notnull -- + {null}: null update bar set id = null; -- TEST: try to use a variable in an update -- + Error % name not found 'X' -- +1 Error -- + {update_stmt}: err -- + {update_entry}: err -- + {name X}: err update bar set X = 1; -- TEST: update nullable column to constant null -- - Error -- + {update_stmt}: bar: { id: integer notnull, name: text, rate: longint } -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {update_list}: ok -- + {update_entry}: rate: longint -- + {null}: null update bar set rate = null; -- TEST: update column to error, no extra errors reported -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {update_stmt}: err -- + {not}: err update bar set id = not 'x'; -- TEST: simple procedure -- - Error -- + {create_proc_stmt}: ok dml_proc -- + {delete_stmt}: ok create procedure proc1() begin delete from foo; end; -- TEST: duplicate proc name -- + Error % duplicate stored proc name 'proc1' -- + {create_proc_stmt}: err -- + {name proc1} create procedure proc1() begin delete from foo; end; -- TEST: procedure with arguments -- - Error -- + {create_proc_stmt}: ok dml_proc -- + {delete_stmt}: ok -- + {eq}: bool -- + {name arg1}: arg1: integer variable in -- + {in_pred}: bool notnull -- + {name arg2}: arg2: text variable in -- Here we're going to check that the parens came out right in the walk -- This is a case where precedence is equal and left to right -- The parents force it to be right to left, we have to honor that even though -- all priorities in sight are equal -- + DELETE FROM foo WHERE arg1 = ('x' IN (arg2)); create procedure proc2(arg1 INT, arg2 text) begin delete from foo where arg1 == ('x' in (arg2)); end; -- TEST: try to use locals that are gone -- + Error % name not found 'arg1' select arg1; -- + Error % name not found 'arg2' select arg2; -- TEST: procedure with duplicate arguments -- + Error % duplicate parameter name 'arg1' -- +1 Error -- + {create_proc_stmt}: err -- + {params}: err create procedure proc3(arg1 INT, arg1 text) begin call anything(arg1, arg2); end; -- TEST: proc name no longer available even though there were errors -- + Error % duplicate stored proc name 'proc3' -- +1 Error -- + {create_proc_stmt}: err create procedure proc3() begin throw; -- whatever, anything end; -- TEST: throw not at the end of a block -- + Error % statement should be the last thing in a statement list -- +1 Error -- + {create_proc_stmt}: err create procedure proc_throw_not_at_end() begin throw; declare x integer; end; -- TEST: the out statement will force the proc type to be recomputed, it must not lose the -- throw state when that happens. -- + {create_proc_stmt}: C: select: { x: integer notnull } variable dml_proc shape_storage uses_out -- - Error create proc throw_before_out() begin begin try declare C cursor for select 1 x; fetch C; end try; begin catch throw; end catch; out C; end; declare proc anything no check; -- TEST: procedure call with arguments mixing in/out legally -- - Error -- + {create_proc_stmt}: ok -- + {params}: ok -- + {call_stmt}: ok -- + {name anything}: ok -- + {name arg1}: arg1: integer variable in -- + {name arg3}: arg3: real variable in out create procedure proc4(in arg1 integer, out arg2 text, inout arg3 real) begin call anything(arg1, arg3); end; -- TEST: local name conflicts with arg -- + Error % duplicate variable name in the same scope 'arg1' -- +1 Error -- + {params}: ok -- + {declare_vars_type}: err -- + {name arg1}: err create procedure proc5(in arg1 integer, out arg2 text, inout arg3 real) begin declare arg1 int; end; -- TEST: try to select out a whole table by table name -- The name is not in scope -- + Error % name not found 'bar' select bar from bar as T; -- TEST: try to select a whole table by aliased table name -- The name is not in scope -- + Error % name not found 'T' select T from bar as T; -- TEST: goofy nested select to verify name reachability -- - Error -- the nested table matches the outer table -- +2 {select_stmt}: select: { id: integer notnull, rate: longint } -- + {select_from_etc}: TABLE { bar: bar } select id, rate from (select id, rate from bar); -- TEST: slighly less goofy nested select to verify name reachability -- - Error -- + {select_stmt}: select: { id: integer notnull, rate: longint } -- the nested select had more columns -- + {select_stmt}: select: { id: integer notnull, name: text, rate: longint } -- + {select_from_etc}: TABLE { bar: bar } select id, rate from (select * from bar); -- TEST: use the table name as its scope -- + {select_stmt}: select: { id: integer notnull } -- + select_from_etc}: TABLE { foo: foo } -- + {dot}: id: integer notnull -- - Error select foo.id from foo; -- TEST: error: try to use the table name as its scope after aliasing -- + Error % in dot % name not found 'id' -- + {select_from_etc}: TABLE { T1: foo } -- + {dot}: err -- + {select_stmt}: err -- + {name id} select foo.id from foo as T1; -- make a not null variable for the next test declare int_nn int not null; -- TEST: bogus assignment -- + Error % cannot assign/copy possibly null expression to not null target 'int_nn' -- +1 Error -- + {assign}: err set int_nn := NULL; -- TEST: call external method with args -- - Error -- + {call_stmt}: ok -- + {name printf}: ok -- + {strlit 'Hello, world'}: text notnull call printf('Hello, world'); -- TEST: call known method with correct args (zero) -- - Error -- + {call_stmt}: ok dml_proc -- + {name proc1}: ok dml_proc call proc1(); -- TEST: call known method with correct args (two) -- - Error -- + {name proc2}: ok dml_proc -- + {call_stmt}: ok dml_proc -- + {int 1}: integer notnull -- + {strlit 'foo'}: text notnull call proc2(1, 'foo'); -- TEST: call known method with correct bogus int (arg1 should be an int) -- + Error % incompatible types in expression 'arg1' -- +1 Error -- + {name proc2}: ok dml_proc -- + {call_stmt}: err -- + {strlit 'bar'}: err -- + {name proc2}: ok dml_proc call proc2('bar', 'foo'); -- TEST: call known method with bogus string (arg2 should be a string) -- + Error % incompatible types in expression 'arg2' -- +1 Error -- + {name proc2}: ok dml_proc -- + {call_stmt}: err -- + {int 2}: err -- + {name proc2}: ok dml_proc call proc2(1, 2); -- TEST: call known method with too many args -- + Error % too many arguments provided to procedure 'proc2' -- +1 Error -- + {name proc2}: ok dml_proc -- + {call_stmt}: err -- + {name proc2}: ok dml_proc call proc2(1, 'foo', 1); -- TEST: call known method with too few args -- + Error % too few arguments provided to procedure 'proc2' -- +1 Error -- + {name proc2}: ok dml_proc -- + {call_stmt}: err -- + {name proc2}: ok dml_proc call proc2(1); -- TEST: call on a method that had errors -- + Error % procedure had errors, can't call 'proc3' -- +1 Error -- + {call_stmt}: err -- + {name proc3} -- - {name proc3}: ok call proc3(1, 'foo'); -- test method with some out arguments, used in tests below create procedure proc_with_output(in arg1 integer, inout arg2 integer, out arg3 integer) begin end; -- TEST: can't use an integer for inout arg -- + Error % expected a variable name for out argument 'arg2' -- + {call_stmt}: err -- +1 Error call proc_with_output(1, 2, X); -- TEST: can't use an integer for out arg -- + Error % expected a variable name for out argument 'arg3' -- + {call_stmt}: err -- +1 Error call proc_with_output(1, X, 3); -- TEST: out values satisfied -- - Error -- + {call_stmt}: ok -- + {int 1}: integer notnull -- + {name X}: X: integer variable -- + {name Y}: Y: integer variable call proc_with_output(1, X, Y); -- TEST: try to use an in/out arg in an out slot -> ok -- - Error -- + {create_proc_stmt}: ok -- + {name proc_with_output}: ok -- + {param_detail}: arg1: integer variable in out -- + {name arg1}: arg1: integer variable in out create procedure test_proc2(inout arg1 integer) begin call proc_with_output(1, X, arg1); end; -- TEST: try to use an out arg in an out slot -> ok -- - Error -- + {create_proc_stmt}: ok -- + {name proc_with_output}: ok -- + {param_detail}: arg1: integer variable out -- + {name arg1}: arg1: integer variable out create procedure test_proc3(out arg1 integer) begin call proc_with_output(1, X, arg1); end; -- TEST: Cursors cannot be passed as OUT arguments. -- + Error % expected a variable name for out argument 'arg1' -- +1 Error create procedure cursors_cannot_be_used_as_out_args() begin declare c cursor for select 0 as x; call test_proc3(c); end; -- TEST: Enum cases cannot be passed as OUT arguments. -- + Error % expected a variable name for out argument 'arg1' -- +1 Error create procedure enum_cases_cannot_be_used_as_out_args() begin call test_proc3(ints.negative_one); end; -- TEST: Unbound variables cannot be passed as OUT arguments. -- + Error % name not found 'unbound' -- +1 Error create procedure unbound_variables_cannot_be_used_as_out_args() begin call test_proc3(unbound); end; -- TEST: try count function -- - Error -- + {select_stmt}: select: { _anon: integer notnull } -- + {name count}: integer notnull -- + {star}: integer select count(*) from foo; -- TEST: verify that analysis of the special function `count` can deal with -- bogus arguments -- + {call}: err -- + {name this_does_not_exist}: err -- + Error % name not found 'this_does_not_exist' -- +1 Error select count(this_does_not_exist) from foo; -- TEST: try count distinct function -- - Error -- + {select_stmt}: select: { c: integer notnull } -- + {name count}: integer notnull -- + {distinct} -- + {arg_list}: ok -- + {name id}: id: integer notnull select count(distinct id) c from foo; -- TEST: try count distinct function with filter clause -- - Error -- + {select_stmt}: select: { c: integer notnull } -- + {name count}: integer notnull -- + {distinct} -- + {arg_list}: ok -- + {name id}: id: integer notnull select count(distinct id) filter (where id = 0) as c from foo; -- TEST: try count distinct function with star -- + {select_stmt}: err -- + {call}: err -- + {name count} -- + Error % DISTINCT may only be used with one explicit argument in an aggregate function 'count' -- +1 Error select count(distinct *) from foo; -- TEST: try sum functions -- - Error -- + {select_stmt}: select: { s: integer } -- + {name sum}: integer select sum(id) s from foo; -- TEST: try total functions -- - Error -- + {select_stmt}: select: { t: real notnull } -- + {name total}: real notnull select total(id) t from foo; -- TEST: try sum functions with too many param -- + Error % function got incorrect number of arguments 'total' -- +1 Error -- + {select_stmt}: err -- + {name total}: err select total(id, rate) from bar; -- TEST: try sum functions with star -- bogus -- + Error % argument can only be used in count(*) '*' -- +1 Error -- + {star}: err -- + {select_stmt}: err -- + {name sum} select sum(*) from foo; -- TEST: try average, this should give a real -- + {select_stmt}: select: { a: real } -- + {name avg}: real -- - Error select avg(id) a from foo; -- TEST: try min, this should give an integer -- + {select_stmt}: select: { m: integer } -- + {name min}: integer -- - Error select min(id) m from foo; -- TEST: bogus number of arguments in count -- + Error % function got incorrect number of arguments 'count' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select count(1,2) from foo); -- TEST: bogus number of arguments in max -- + Error % function got incorrect number of arguments 'max' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select max() from foo); -- TEST: bogus number of arguments in sign -- + Error % function got incorrect number of arguments 'sign' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select sign()); -- TEST: bogus number of arguments in sign -- + Error % function got incorrect number of arguments 'sign' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select sign(1,2)); -- TEST: argument in sign is not numeric -- + Error % argument must be numeric 'sign' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select sign('x')); -- TEST: sign may accept a real arg -- + {let_stmt}: rs: integer notnull variable -- - Error let rs := (select sign(1.0)); -- TEST: sign Nullability is preserved -- + {let_stmt}: nl: integer variable -- - Error let nl := (select sign(nullable(-1.0))); -- TEST: sign Sensitivity is preserved -- + {let_stmt}: ssnl: integer variable sensitive -- - Error let ssnl := (select sign(sensitive(nullable(1)))); -- TEST: bogus number of arguments in round -- + Error % function got incorrect number of arguments 'round' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select round()); -- TEST: round outside of normal context -- + Error % function may not appear in this context 'round' -- +1 Error -- + {call}: err -- + {assign}: err set X := round(); -- TEST: bogus number of arguments in round -- + Error % function got incorrect number of arguments 'round' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select round(1,2,3)); -- TEST: round second arg not numeric -- + Error % second argument must be numeric 'round' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select round(1.5,'x')); -- TEST: round must get a real arg in position 1 -- + Error % first argument must be of type real 'round' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select round(1,2)); -- TEST: round must get a real arg in position 1 -- + {let_stmt}: rr: real notnull variable -- - Error let rr := (select round(1.0,2)); -- TEST: correct round double not null convered to long not null -- + {let_stmt}: ll: longint notnull variable -- - Error let ll := (select round(1.0)); -- TEST: round Nullability is preserved -- + {let_stmt}: NLL: longint variable -- - Error let NLL := (select round(nullable(1.0))); -- TEST: round Nullability is preserved -- + {let_stmt}: NRR: real variable -- - Error let NRR := (select round(1.0, nullable(1))); -- TEST: round Sensitivity is preserved -- + {let_stmt}: SNL: longint variable sensitive -- - Error let SNL := (select round(sensitive(nullable(1.0)))); -- TEST: round Sensitivity is preserved -- + {let_stmt}: SNR: real variable sensitive -- - Error let SNR := (select round(nullable(1.0), sensitive(1))); -- TEST: The precision must be a numeric type but not real -- + {assign}: err -- + Error % operands must be an integer type, not real 'ROUND argument 2' -- +1 Error set ll := (select round(1.0, 2.0)); -- TEST: bogus number of arguments in average -- + Error % function got incorrect number of arguments 'avg' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select avg(1,2) from foo); -- TEST: bogus string type in average -- + Error % argument must be numeric 'avg' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select avg('foo') from foo); -- TEST: bogus null literal in average -- + Error % argument must be numeric 'avg' -- +1 Error -- + {call}: err -- + {assign}: err set X := (select avg(null) from foo); -- TEST: assign select where statement to nullable variable -- + {assign}: X: integer variable -- - Error set X := (select X*10 as v where v = 1); -- TEST: assign select where statement to not null variable -- + {assign}: X_not_null: integer notnull variable -- + {name X_not_null}: X_not_null: integer notnull variable -- + {select_stmt}: _anon: integer notnull -- - Error set X_not_null := (select 1 where 0); -- TEST: bogus function -- + Error % function not yet implemented 'some_unknown_function' -- +1 Error -- {select_stmt}: err set X := (select some_unknown_function(null)); -- TEST: simple while statement -- - Error -- + {while_stmt}: ok -- + {name X}: X: integer variable while X begin select 1; end; -- TEST: not numeric while -- + Error % expected numeric expression 'WHILE' -- + {strlit 'X'}: err -- +1 Error while 'X' begin select 1; end; -- TEST: error in while block should be propagated up -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {while_stmt}: err while X begin select NOT 'x'; end; -- TEST: try to make a nested proc -- + Error % stored procedures cannot be nested 'bar' -- +1 Error -- The containing proc is also in error -- +2 {create_proc_stmt}: err create proc foo() begin create proc bar() begin select 1; end; end; -- TEST: verify that a procedure that calls a DML proc is a DML proc -- - Error -- + {create_proc_stmt}: ok dml_proc -- + {name proc1}: ok dml_proc create proc calls_dml() begin call proc1(); -- it does a select end; -- TEST: not much to go wrong with try/catch -- - Error -- + {trycatch_stmt}: ok -- + {throw_stmt}: ok begin try select 1; end try; begin catch throw; end catch; -- TEST: error in try block should be propagated to top of tree -- + Error % string operand not allowed in 'NOT' -- + {trycatch_stmt}: err -- + {stmt_list}: err -- +1 Error begin try select not 'x'; end try; begin catch throw; end catch; -- TEST: error in catch block should be propagated to top of tree -- + Error % string operand not allowed in 'NOT' -- + {trycatch_stmt}: err -- + {stmt_list}: ok -- + {stmt_list}: err -- +1 Error begin try throw; end try; begin catch select not 'x'; end catch; -- TEST: this procedure will have a structured semantic type -- + {create_proc_stmt}: select: { id: integer notnull, name: text, rate: longint } dml_proc -- - Error -- +1 {select_expr_list}: select: { id: integer notnull, name: text, rate: longint } create procedure with_result_set() begin select * from bar; end; -- TEST: this procedure will have a structured semantic type -- + {create_proc_stmt}: select: { A: integer notnull, B: real notnull } dml_proc -- - Error -- +2 {select_stmt}: select: { A: integer notnull, B: real notnull } create procedure with_matching_result(i integer) begin if i then select 1 as A, 2.5 as B; else select 3 as A, 4.7 as B; end if; end; -- TEST: this procedure will have have not matching arg types -- + Error % in multiple select/out statements, all columns must be an exact type match (expected real notnull; found integer notnull) 'B' -- + {select_expr_list}: select: { A: integer notnull, B: real notnull } -- + {select_expr_list}: select: { A: integer notnull, B: integer notnull } create procedure with_wrong_types(i integer) begin if i then select 1 as A, 2.5 as B; else select 3 as A, 4 as B; end if; end; -- TEST: this procedure will have have not matching arg counts -- + Error % in multiple select/out statements, all must have the same column count -- + {select_expr_list}: select: { A: integer notnull, B: real notnull } -- + {select_expr_list}: select: { A: integer notnull } create procedure with_wrong_count(i integer) begin if i then select 1 as A, 2.5 as B; else select 3 as A; end if; end; -- TEST: this procedure will have nullability mismatch -- + Error % in multiple select/out statements, all columns must be an exact type match (including nullability) (expected integer notnull; found integer) 'A' -- + {create_proc_stmt}: err -- + {select_stmt}: select: { A: integer notnull variable in } -- + {select_expr_list_con}: select: { A: integer variable } create procedure with_wrong_flags(i integer not null) begin if i then select i as A; else select X as A; end if; end; -- TEST: this procedure will match variables -- + {create_proc_stmt}: select: { A: integer notnull variable in } -- use the important fragment for the match, one is a variable so the tree is slightly different -- +2 {select_expr_list}: select: { A: integer notnull -- - Error create procedure with_ok_flags(i integer not null) begin if i then select i as A; else select 2 as A; end if; end; -- TEST: this procedure will not match column names -- + Error % in multiple select/out statements, all column names must be identical so they have unambiguous names 'B' -- + {create_proc_stmt}: err -- + {select_stmt}: select: { A: integer notnull } -- + {select_expr_list_con}: select: { B: integer notnull } create procedure with_bad_names(i integer not null) begin if i then select 1 as A; else select 2 as B; end if; end; -- TEST: this procedure doesn't specify a name for the result -- + Error % all columns in the select must have a name -- + {create_proc_stmt}: err -- + {stmt_list}: err -- + {select_expr_list_con}: select: { _anon: integer notnull } create procedure with_no_names(i integer not null) begin select 1; end; -- TEST: good cursor -- + {declare_cursor}: curs: select: { id: integer notnull, name: text, rate: longint } variable -- + {name with_result_set}: select: { id: integer notnull, name: text, rate: longint } dml_proc -- - Error declare curs cursor for call with_result_set(); -- TEST: bad args to the function -> error path -- + {declare_cursor}: err -- + Error % too many arguments provided to procedure 'with_result_set' -- +1 Error declare curs2 cursor for call with_result_set(1); -- TEST: bad invocation, needs cursor -- + Error % procedures with results can only be called using a cursor in global context 'with_result_set' -- {call_stmt}: err call with_result_set(); -- TEST: bad invocation, this method doesn't return a result set -- + Error % cursor requires a procedure that returns a result set via select 'curs' -- + {declare_cursor}: err -- + {name proc1}: ok dml_proc declare curs cursor for call proc1(); -- TEST: full join with all expression options, including offset -- + {select_stmt}: select: { id: integer notnull, id: integer notnull, name: text, rate: longint } -- + {opt_where}: bool notnull -- + {groupby_list}: ok -- + {opt_having}: bool -- + {opt_orderby}: ok -- + {opt_limit}: integer notnull -- + {opt_offset}: integer notnull select * from foo as T1 inner join bar as T2 on T1.id = T2.id where T2.id > 5 group by T2.name asc, T2.id desc having T2.name = 'x' order by T2.rate limit 5 offset 7; -- TEST: full join with all expression options and bogus offset -- + Error % expected numeric expression 'OFFSET' -- +1 Error -- + {select_stmt}: err -- + {opt_offset}: err select * from foo as T1 inner join bar as T2 on T1.id = T2.id where T2.id > 5 group by T2.name having T2.name = 'x' order by T2.rate limit 5 offset 'x'; -- TEST: You can't aggregate if there is no FROM clause, try that out for count -- + Error % aggregates only make sense if there is a FROM clause 'count' select count(1); -- TEST: checking use of aggregates in the wrong context (not allowed in where) -- + Error % function may not appear in this context 'count' -- +1 Error -- + {select_stmt}: err select * from foo where count(*) == 1; -- TEST: You can't aggregate if there is no FROM clause, try that out for max -- + Error % aggregates only make sense if there is a FROM clause 'max' select max(1); -- TEST: You can't aggregate if there is no FROM clause, try that out for avg -- + Error % aggregates only make sense if there is a FROM clause 'avg' select avg(1); -- TEST: assign a not null to a nullable output, that's ok. -- + {create_proc_stmt}: ok -- - Error -- + {param_detail}: result: integer variable out -- + {assign}: result: integer variable out -- + {int 5}: integer notnull create proc out_proc(out result integer) begin set result := 5; end; -- TEST: Set up a not null int for the tested -- + {name my_int}: my_int: integer notnull variable declare my_int int not null; -- TEST: my_int is not nullable, must be exact match in out parameter, ordinarily this would be compatible -- + Error % cannot assign/copy possibly null expression to not null target 'my_int' call out_proc(my_int); -- TEST: my_real is real, must be exact match in out parameter, ordinarily this would be compatible -- + {name my_real}: my_real: real variable declare my_real real; -- TEST: Try to make the call with a bogus out arg now -- + Error % proc out parameter: arg must be an exact type match (expected integer; found real) 'my_real' call out_proc(my_real); -- TEST: try an exists clause -- + {select_stmt}: select: { id: integer notnull } -- + {exists_expr}: bool notnull -- - Error select * from foo where exists (select * from foo); -- TEST: try a not exists clause -- + {select_stmt}: select: { id: integer notnull } -- + {not}: bool notnull -- + {exists_expr}: bool notnull -- - Error select * from foo where not exists (select * from foo); -- TEST: try an exists clause with an error -- + Error % string operand not allowed in 'NOT' -- only one error reported -- +1 Error -- + {exists_expr}: err select * from foo where exists (select not 'x' from foo); -- TEST: try a not exists clause with an error -- + Error % string operand not allowed in 'NOT' -- only one error reported -- +1 Error -- + {exists_expr}: err select * from foo where not exists (select not 'x' from foo); -- TEST: try to use exists in a bogus place -- + Error % exists_expr % function may not appear in this context 'exists' -- + {exists_expr}: err -- + {assign}: err set X := exists(select * from foo); -- TEST: try to use not exists in a bogus place -- + Error % function may not appear in this context 'exists' -- + {not}: err -- + {exists_expr}: err -- + {assign}: err set X := not exists(select * from foo); -- TEST: release a savepoint out of the blue -- + Error % savepoint has not been mentioned yet, probably wrong 'garbonzo' -- + {release_savepoint_stmt}: err release savepoint garbonzo; -- TEST: rollback to a savepoint out of the blue -- + Error % savepoint has not been mentioned yet, probably wrong 'another_garbonzo' -- + {rollback_trans_stmt}: err rollback transaction to savepoint another_garbonzo; -- TEST: Test the shorthand syntax for cursors. The shape_storage flag for the -- cursor itself comes from the following fetch statement. -- + {declare_cursor}: shape_storage: select: { one: integer notnull, two: integer notnull } variable dml_proc -- + {name shape_storage}: shape_storage: select: { one: integer notnull, two: integer notnull } variable dml_proc shape_storage -- - Error declare shape_storage cursor for select 1 as one, 2 as two; -- TEST: Fetch the auto cursor -- + {fetch_stmt}: shape_storage: select: { one: integer notnull, two: integer notnull } variable dml_proc -- + {name shape_storage}: shape_storage: select: { one: integer notnull, two: integer notnull } variable dml_proc shape_storage -- - Error fetch shape_storage; -- TEST: Now access the cursor -- + {select_stmt}: select: { shape_storage.one: integer notnull variable } -- + {dot}: shape_storage.one: integer notnull variable -- + {name shape_storage} -- + {name one} -- -Error select shape_storage.one; -- TEST: a field that is not present -- + Error % field not found in cursor 'three' -- + {dot}: err -- + {name shape_storage} -- + {name three} select shape_storage.three; -- TEST: a cursor that did not use the auto-cursor feature -- + Error % cursor was not used with 'fetch [cursor]' 'my_cursor' -- + {dot}: err -- + {name my_cursor} -- + {name one} select my_cursor.one; -- TEST: test the join using syntax -- + {select_stmt}: select: { id: integer notnull, id: integer notnull } -- + {select_from_etc}: JOIN { T1: foo, T2: foo } -- + {using} -- + {name id} select * from foo as T1 inner join foo as T2 using(id); -- TEST: duplicate column names -- + Error % duplicate name in list 'id' -- +1 Error -- + {select_stmt}: err select * from foo as T1 inner join foo as T2 using(id, id); -- TEST: invalid column names (missing on the left) -- + Error % join using column not found on the left side of the join 'idx' -- +1 Error select * from foo as T1 inner join foo as T2 using(id, idx); -- TEST: invalid column names (missing on the right) -- + Error % join using column not found on the right side of the join 'name' -- +1 Error select * from bar as T1 inner join foo as T2 using(id, name); -- TEST: helper tables for different join types -- {create_table_stmt}: payload1: { id: integer notnull, data1: integer notnull } -- -Error create table payload1 (id integer not null, data1 integer not null); -- {create_table_stmt}: payload2: { id: integer notnull, data2: integer notnull } -- -Error create table payload2 (id integer not null, data2 integer not null); -- TEST: all not null -- {select_stmt}: select: { id: integer notnull, data1: integer notnull, id: integer notnull, data2: integer notnull } -- - Error select * from payload1 inner join payload2 using (id); -- TEST: right part nullable -- + {select_stmt}: select: { id: integer notnull, data1: integer notnull, id: integer, data2: integer } -- - Error select * from payload1 left outer join payload2 using (id); -- TEST: left part nullable -- + {select_stmt}: select: { id: integer, data1: integer, id: integer notnull, data2: integer notnull } -- - Error select * from payload1 right outer join payload2 using (id); -- TEST: both parts nullable due to cross join -- + select: { id: integer notnull, data1: integer notnull, id: integer notnull, data2: integer notnull } -- - Error select * from payload1 cross join payload2 using (id); -- TEST: compound select -- + {select_stmt}: select: { id: integer notnull, id: integer notnull, id: integer notnull, id: integer notnull } -- + {select_from_etc}: JOIN { A: foo, B: foo, C: foo, D: foo } -- - Error select * from (foo A, foo B) inner join (foo C, foo D); -- TEST: select with embedded error in an interior join -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {select_stmt}: err -- +2 {join_clause}: err select id from (foo inner join bar on not 'x') inner join foo on 1; -- TEST: simple ifnull : note X is nullable -- + {select_stmt}: select: { _anon: integer notnull } -- + {name X}: X: integer variable -- - Error select ifnull(X, 0); -- TEST: simple coalesce with not null result, note X,Y are nullable -- + {select_stmt}: select: { _anon: real notnull } -- + {call}: real notnull -- + {name coalesce} -- + {name X}: X: integer variable -- + {name Y}: Y: integer variable -- + {dbl 1.5%}: real notnull select coalesce(X, Y, 1.5); -- TEST: null in a coalesce is obviously wrong -- + Error % Null literal is useless in function 'coalesce' -- + {call}: err -- + {null}: err -- + {select_stmt}: err select coalesce(X, null, 1.5); -- TEST: not null before the end is obviously wrong -- + Error % encountered arg known to be not null before the end of the list -- +1 Error -- + {call}: err -- + {name coalesce} select coalesce(X, 5, 1.5); -- TEST: wrong number of args (too many) -- + Error % Incorrect number of arguments 'ifnull' -- + {call}: err -- + {name ifnull} -- +1 Error select ifnull(X, 5, 1.5); -- TEST: wrong number of args (too few) -- + Error % Too few arguments provided 'ifnull' -- + {call}: err -- + {name ifnull} -- +1 Error select ifnull(5); -- TEST: not compatible args in ifnull -- + Error % incompatible types in expression 'ifnull' -- + {call}: err -- + {name ifnull} -- +1 Error select ifnull(X, 'hello'); -- TEST: error in expression in ifnull -- + Error % string operand not allowed in 'NOT' -- + {call}: err -- + {name ifnull} -- + {arg_list}: err -- +1 Error select ifnull(not 'x', not 'hello'); -- TEST: make make an FK with the column count wrong -- + Error % The number of columns on both sides of a foreign key must match -- + {create_table_stmt}: err -- + fk_def}: err create table fk_table_2 ( id1 integer, id2 integer, FOREIGN KEY (id1, id2) REFERENCES foo(id) ); -- TEST: make make an FK with the column types not matching -- + Error % the exact type of both sides of a foreign key must match (expected real; found integer notnull) 'id' -- + {create_table_stmt}: err -- + fk_def}: err create table fk_table_2 ( id REAL, FOREIGN KEY (id) REFERENCES foo(id) ); -- TEST: helper table for join/using test -- + {create_table_stmt}: join_clause_1: { id: real } create table join_clause_1 ( id REAL ); -- TEST: helper table for join/using test -- {create_table_stmt}: join_clause_1: { id: integer } create table join_clause_2 ( id integer ); -- TEST: join using syntax with column type mismatch test -- + Error % left/right column types in join USING(...) do not match exactly 'id' -- + {table_or_subquery}: TABLE { join_clause_1: join_clause_1 } -- + {table_or_subquery}: TABLE { join_clause_2: join_clause_2 } -- + {join_clause}: err -- + {select_stmt}: err select * from join_clause_1 inner join join_clause_2 using(id); -- TEST: use last insert rowid, validate it's ok -- + {select_stmt}: select: { _anon: longint notnull } -- + {name last_insert_rowid}: longint notnull -- - Error select last_insert_rowid(); -- TEST: last_insert_row doesn't take args -- + Error % function got incorrect number of arguments 'last_insert_rowid' -- + {name last_insert_rowid}: err -- + {select_stmt}: err select last_insert_rowid(1); -- TEST: last_insert_rowid is not ok in a limit -- + Error % function may not appear in this context 'last_insert_rowid' -- + {call}: err -- + {select_stmt}: err select * from foo limit last_insert_rowid(); -- declare result for last_insert_rowid declare rowid_result long int not null; -- TEST: set last_insert_rowid outside of select statement -- + {assign}: rowid_result: longint notnull variable -- + {name rowid_result}: rowid_result: longint notnull variable -- + {call}: longint notnull -- + {name last_insert_rowid}: longint notnull -- - Error set rowid_result := last_insert_rowid(); -- TEST: use changes, validate it's ok -- + {select_stmt}: select: { _anon: integer notnull } -- + {name changes}: integer notnull -- - Error select changes(); -- TEST: changes doesn't take args -- + Error % function got incorrect number of arguments 'changes' -- + {name changes}: err -- + {select_stmt}: err select changes(1); -- TEST: changes is not ok in a limit -- + Error % function may not appear in this context 'changes' -- + {call}: err -- + {select_stmt}: err select * from foo limit changes(); -- declare result for changes function declare changes_result int not null; -- TEST: set changes outside of select statement -- + {assign}: changes_result: integer notnull variable -- + {name changes_result}: changes_result: integer notnull variable -- + {call}: integer notnull -- + {name changes}: integer notnull -- - Error set changes_result := changes(); -- TEST: printf is ok in a select -- + {select_stmt}: select: { _anon: text notnull } -- + {select_expr}: text notnull -- + {name printf}: text notnull -- - Error select printf('%s %d', 'x', 5); -- TEST: printf is ok in a loose expression -- + {assign}: a_string: text variable -- + {name printf}: text notnull -- - Error set a_string := printf('Hello'); -- TEST: printf is not ok in a limit -- + Error % function may not appear in this context 'printf' -- + {opt_limit}: err -- + {select_stmt}: err select 1 from (select 1) limit printf('%s %d', 'x', 5) == 'x'; -- TEST: update with duplicate columns -- + Error % duplicate target column name in update statement 'id' -- + {update_stmt}: err -- + {name id}: err update foo set id = 1, id = 3 where id = 2; -- TEST: bogus number of arguments in sum -- + Error % function got incorrect number of arguments 'sum' -- + {assign}: err -- + {call}: err set X := (select sum(1,2) from foo); -- TEST: sum used in a limit, bogus -- + Error % function may not appear in this context 'sum' -- + {assign}: err -- + {call}: err set X := (select id from foo limit sum(1)); -- TEST: sum used with text -- + Error % argument must be numeric 'sum' -- + {assign}: err -- + {call}: err set X := (select sum('x') from foo); -- tables for the following test create table A1(foo int); create table B1(foo int); create table C1(foo int); -- TEST: duplicate table name logic needs different left and right table counts -- this test case with 3 tables will have one join with 2 on the left 1 -- on the right -- - Error -- + {select_from_etc}: JOIN { T1: A1, T2: B1, T3: C1 } select * from A1 as T1 left outer join B1 as T2 on T1.foo = t2.foo left outer join C1 as T3 on T2.foo = t3.foo; -- TEST: group_concat basic correct case -- - Error -- + {select_stmt}: select: { id: integer notnull, grp: text } -- + {name group_concat}: text select id, group_concat(name) grp from bar group by id; -- TEST: group_concat with second arg -- - Error -- + {select_stmt}: select: { id: integer notnull, grp: text } -- + {name group_concat}: text select id, group_concat(name, 'x') grp from bar group by id; -- TEST: group_concat with bogus second arg -- + Error % second argument must be a string in function 'group_concat' -- +1 Error -- + {select_stmt}: err select id, group_concat(name, 0) from bar group by id; -- TEST: group_concat with zero args -- + Error % function got incorrect number of arguments 'group_concat' -- +1 Error -- + {select_stmt}: err select id, group_concat() from bar group by id; -- TEST: group_concat with three args -- + Error % function got incorrect number of arguments 'group_concat' -- +1 Error -- + {select_stmt}: err select id, group_concat('x', 'y', 'z') from bar group by id; -- TEST: group_concat outside of aggregate context -- + Error % function may not appear in this context 'group_concat' -- +1 Error -- + {select_stmt}: err select id from bar where group_concat(name) = 'foo'; -- TEST: strftime basic correct case -- - Error -- + {select_stmt}: select: { _anon: text notnull } -- + {name strftime}: text notnull select strftime('%s', 'now'); -- TEST: strftime with a modifier -- - Error -- + {select_stmt}: select: { _anon: text } -- + {name strftime}: text select strftime('%YYYY-%mm-%DDT%HH:%MM:%SS.SSS', 'now', '+1 month'); -- TEST: strftime with multiple modifiers -- - Error -- + {select_stmt}: select: { _anon: text } -- + {name strftime}: text select strftime('%W', 'now', '+1 month', 'start of month', '-3 minutes', 'weekday 4'); -- TEST: strftime with non-string modifier -- + Error -- +1 Error -- + {select_stmt}: err select strftime('%s', 'now', 3); -- TEST: strftime with bogus format -- + Error % all arguments must be strings 'strftime' -- +1 Error -- + {select_stmt}: err select strftime(42, 'now'); -- TEST: strftime with bogus timestring -- + Error % all arguments must be strings 'strftime' -- +1 Error -- + {select_stmt}: err select strftime('%s', 42); -- TEST: strftime is not ok in a loose expression -- + Error % function may not appear in this context 'strftime' -- +1 Error -- + {assign}: err -- + {name strftime} set a_string := strftime('%s', 'now'); -- TEST: strftime without enough arguments -- + Error % function got incorrect number of arguments 'strftime' -- +1 Error -- + {select_stmt}: err select strftime('now'); -- TEST: date basic correct case -- - Error -- + {select_stmt}: select: { _anon: text notnull } -- + {name date}: text notnull select date('now'); -- TEST: date with a modifier -- - Error -- + {select_stmt}: select: { _anon: text } -- + {name date}: text select date('now', '+1 month'); -- TEST: date with multiple modifiers -- - Error -- + {select_stmt}: select: { _anon: text } -- + {name date}: text select date('now', '+1 month', 'start of month', '-3 minutes', 'weekday 4'); -- TEST: date with non-string modifier -- + Error -- +1 Error -- + {select_stmt}: err select date('now', 3); -- TEST: date with bogus timestring -- + Error % all arguments must be strings 'date' -- +1 Error -- + {select_stmt}: err select date(42); -- TEST: date is not ok in a loose expression -- + Error % function may not appear in this context 'date' -- +1 Error -- + {assign}: err -- + {name date} set a_string := date('now'); -- TEST: date without enough arguments -- + Error % function got incorrect number of arguments 'date' -- +1 Error -- + {select_stmt}: err select date(); -- TEST: time basic correct case -- - Error -- + {select_stmt}: select: { _anon: text notnull } -- + {name time}: text notnull select time('now'); -- TEST: time with a modifier -- - Error -- + {select_stmt}: select: { _anon: text } -- + {name time}: text select time('now', '+1 month'); -- TEST: time with multiple modifiers -- - Error -- + {select_stmt}: select: { _anon: text } -- + {name time}: text select time('now', '+1 month', 'start of month', '-3 minutes', 'weekday 4'); -- TEST: time with non-string modifier -- + Error -- +1 Error -- + {select_stmt}: err select time('now', 3); -- TEST: time with bogus timestring -- + Error % all arguments must be strings 'time' -- +1 Error -- + {select_stmt}: err select time(42); -- TEST: time is not ok in a loose expression -- + Error % function may not appear in this context 'time' -- +1 Error -- + {assign}: err -- + {name time} set a_string := time('now'); -- TEST: time without enough arguments -- + Error % function got incorrect number of arguments 'time' -- +1 Error -- + {select_stmt}: err select time(); -- TEST: datetime basic correct case -- - Error -- + {select_stmt}: select: { _anon: text notnull } -- + {name datetime}: text notnull select datetime('now'); -- TEST: datetime with a modifier -- - Error -- + {select_stmt}: select: { _anon: text } -- + {name datetime}: text select datetime('now', '+1 month'); -- TEST: datetime with multiple modifiers -- - Error -- + {select_stmt}: select: { _anon: text } -- + {name datetime}: text select datetime('now', '+1 month', 'start of month', '-3 minutes', 'weekday 4'); -- TEST: datetime with non-string modifier -- + Error -- +1 Error -- + {select_stmt}: err select datetime('now', 3); -- TEST: datetime with bogus timestring -- + Error % all arguments must be strings 'datetime' -- +1 Error -- + {select_stmt}: err select datetime(42); -- TEST: datetime is not ok in a loose expression -- + Error % function may not appear in this context 'datetime' -- +1 Error -- + {assign}: err -- + {name datetime} set a_string := datetime('now'); -- TEST: datetime without enough arguments -- + Error % function got incorrect number of arguments 'datetime' -- +1 Error -- + {select_stmt}: err select datetime(); -- TEST: julianday basic correct case -- - Error -- + {select_stmt}: select: { _anon: real notnull } -- + {name julianday}: real notnull select julianday('now'); -- TEST: julianday with a modifier -- - Error -- + {select_stmt}: select: { _anon: real } -- + {name julianday}: real select julianday('now', '+1 month'); -- TEST: julianday with multiple modifiers -- - Error -- + {select_stmt}: select: { _anon: real } -- + {name julianday}: real select julianday('now', '+1 month', 'start of month', '-3 minutes', 'weekday 4'); -- TEST: julianday with non-string modifier -- + Error -- +1 Error -- + {select_stmt}: err select julianday('now', 3); -- TEST: julianday with bogus timestring -- + Error % all arguments must be strings 'julianday' -- +1 Error -- + {select_stmt}: err select julianday(42); -- TEST: julianday is not ok in a loose expression -- + Error % function may not appear in this context 'julianday' -- +1 Error -- + {assign}: err -- + {name julianday} set a_string := julianday('now'); -- TEST: julianday without enough arguments -- + Error % function got incorrect number of arguments 'julianday' -- +1 Error -- + {select_stmt}: err select julianday(); -- TEST: simple cast expression -- - Error -- + {select_stmt}: select: { _anon: text notnull } -- + {cast_expr}: text notnull select cast(1 as text); -- TEST: cast expression in bogus context -- + Error % CAST may only appear in the context of SQL statement -- +1 Error -- + {cast_expr}: err set X := cast(5.0 as text); -- enforce strict cast and verify @enforce_strict cast; -- TEST 1 is already an int -- + {let_stmt}: err -- + {cast_expr}: err -- + Error % cast is redundant, remove to reduce code size 'CAST(1 AS INTEGER)' -- +1 Error let idx := cast(1 as integer); -- TEST 1.5 is not an integer, the type doesn't match, ok cast -- + {let_stmt}: idr: integer notnull variable -- - Error let idr := cast(1.5 as integer); -- TEST integer conversion but adding a kind, this is ok -- + {let_stmt}: idx: integer<x> notnull variable -- - Error let idx := cast(1 as integer<x>); -- TEST: changing kind, this is ok -- + {let_stmt}: idy: integer<y> notnull variable -- - Error let idy := cast(idx as integer<y>); -- TEST: type and kind match, this is a no-op therefore an error -- + {assign}: err -- + {cast_expr}: err -- + Error % cast is redundant, remove to reduce code size 'CAST(idy AS INTEGER<y> -- +1 Error set idy := cast(idy as integer<y>); -- restore to normalcy @enforce_normal cast; -- TEST: cast expression with expression error -- + Error % string operand not allowed in 'NOT' -- +1 Error -- + {cast_expr}: err select cast(not 'x' as int); -- TEST: create table with PK to force not null -- - Error -- + {create_table_stmt}: pk_test: { id: integer notnull primary_key } -- + {col_def}: id: integer notnull create table pk_test(id integer primary key); -- TEST: create table with PK out of line to force not null -- - Error -- semantic type and coldef must both be notnull -- + {create_table_stmt}: pk_test_2: { id: integer notnull } -- + {col_def}: id: integer notnull create table pk_test_2( id integer, PRIMARY KEY (id) ); -- TEST: ensure that table factors are visible in order create table AA1(id1 int not null); create table BB2(id2 int not null); create table CC3(id3 int not null); -- - Error -- + {select_stmt}: select: { id1: integer notnull, id2: integer notnull, id3: integer } SELECT * FROM (AA1 A, BB2 B) LEFT OUTER JOIN CC3 C ON C.id3 == A.id1; -- TEST: declare procedure basic -- - Error -- + {declare_proc_stmt}: ok -- + {name decl1}: ok -- - decl1%dml -- + {params}: ok -- + {param}: id: integer variable in declare proc decl1(id integer); -- TEST: try to declare this as an unchecked proc also -- + Error % procedure cannot be both a normal procedure and an unchecked procedure 'decl1' -- +1 Error declare proc decl1 no check; -- TEST: declare procedure with DB params -- - Error -- + {declare_proc_stmt}: ok dml_proc -- + {name decl2}: ok dml_proc -- + {param}: id: integer variable in declare proc decl2(id integer) using transaction; -- TEST: declare procedure with select result set -- - Error -- + declare_proc_stmt}: decl3: { A: integer notnull, B: bool } dml_proc declare proc decl3(id integer) ( A integer not null, B bool ); -- TEST: try an arg bundle inside of a declared proc -- make sure the rewrite was accurate -- + DECLARE PROC decl4 (x_A INTEGER NOT NULL, x_B BOOL); -- - Error declare proc decl4(x like decl3); -- TEST: declare inside of a proc -- + Error -- +1 Error -- + Error % declared procedures must be top level 'yy' -- + {create_proc_stmt}: err create proc bogus_nested_declare() begin declare proc yy(); end; -- TEST: duplicate declaration, all matches -- + DECLARE PROC decl1 (id INTEGER); -- + param}: id: integer variable in -- + {declare_proc_stmt}: ok -- - Error declare proc decl1(id integer); -- TEST: duplicate declaration, mismatch -- + Error % in declare_proc_stmt % procedure declarations/definitions do not match 'decl1' -- + {declare_proc_stmt}: err declare proc decl1(id integer not null); -- TEST: bogus parameters -- + Error % duplicate parameter name 'id' -- +1 Error -- + {declare_proc_stmt}: err -- + {params}: err declare proc bogus_duplicate_params(id integer, id integer); -- TEST: declare procedure with select error -- + Error % duplicate column name 'id' -- +1 Error -- + {declare_proc_stmt}: err -- + {params}: ok -- + {typed_names}: err declare proc bogus_select_list(id integer) (id integer, id integer); -- TEST: subquery within in clause -- - Error -- + {in_pred}: bool notnull -- + {select_from_etc}: TABLE { bar: bar } select id from foo where id in (select id from bar); -- TEST: subquery within in clause with multiple columns -- +1 Error -- + nested select expression must return exactly one column -- + {select_stmt}: err select id from foo where id in (select id, id from bar); -- TEST: subquery within in clause with wrong type -- +1 Error -- + incompatible types in expression 'IN' -- + {select_stmt}: err select id from foo where id in (select name from bar); -- TEST: subquery within not in clause -- - Error -- + {not_in}: bool notnull -- + {select_from_etc}: TABLE { bar: bar } select id from foo where id not in (select id from bar); -- TEST: subquery within not in clause with wrong type -- +1 Error -- + incompatible types in expression 'NOT IN' -- + {select_stmt}: err select id from foo where id not in (select name from bar); -- TEST: basic union pattern -- - Error -- + {select_core_list}: union: { A: integer notnull, B: integer notnull } select 1 as A, 2 as B union select 3 as A, 4 as B; -- TEST: basic union all pattern -- - Error -- + {select_core_list}: union_all: { A: integer notnull, B: integer notnull } select 1 as A, 2 as B union all select 3 as A, 4 as B; -- TEST: union all with not matching columns -- + Error % if multiple selects, all column names must be identical so they have unambiguous names 'B' -- +1 Error select 1 as A, 2 as C union all select 3 as A, 4 as B; -- TEST: union all with not matching types (but compat) -- + {select_core_list}: union_all: { A: integer notnull, B: real notnull } -- - Error select 1 as A, 2 as B union all select 3 as A, 4.3 as B; -- TEST: union all with error on the left -- + Error % string operand not allowed in 'NOT' -- +1 Error select not 'x' as A union all select 1 as A; -- TEST: union all with error on the right -- + Error % string operand not allowed in 'NOT' -- +1 Error select 'x' as A union all select not 'x' as A; -- TEST: compound operator intersect -- - Error -- + {select_core_list}: intersect: { A: integer notnull, B: integer notnull } select 1 as A, 2 as B intersect select 3 as A, 4 as B; -- TEST: compound operator except -- - Error -- + {select_core_list}: except: { A: integer notnull, B: integer notnull } select 1 as A, 2 as B except select 3 as A, 4 as B; -- TEST: use nullable in a select -- + {select_stmt}: select: { x: integer } -- - Error select nullable(1) x; -- TEST: use nullable in an expr -- + {let_stmt}: nullable_one: integer variable -- - Error let nullable_one := nullable(1); -- TEST: use sensitive in a select -- + {select_stmt}: select: { x: integer notnull sensitive } -- - Error select sensitive(1) x; -- TEST: use sensitive in an expr -- + {let_stmt}: sens_one: integer notnull variable sensitive -- - Error let sens_one := sensitive(1); -- helper variable declare sens_notnull text not null @sensitive; -- TEST: ensure nullable() doesn't strip the sensitive bit -- notnull is gone, sensitive stays -- + {select_stmt}: select: { sens_notnull: text variable sensitive } -- + {name sens_notnull}: sens_notnull: text notnull variable sensitive -- - Error select nullable(sens_notnull); -- TEST: ensure kind is preserved in nullable -- + {select_stmt}: select: { price_e: real<euros> variable } -- + {name nullable}: price_e: real<euros> variable -- - Error select nullable(price_e); -- TEST: affirmative error generated after nullable with kind -- + {assign}: err -- + Error % expressions of different kinds can't be mixed: 'dollars' vs. 'euros' -- +1 Error set price_d := (select nullable(price_e)); -- TEST: use nullable in a select with wrong args -- + Error % function got incorrect number of arguments 'nullable' -- +1 Error select nullable(1, 2); -- TEST: use nullable in a select with wrong args -- + Error % function got incorrect number of arguments 'sensitive' -- +1 Error select sensitive(1, 2); -- try some const cases especially those with errors -- TEST: variables not allowed in constant expressions (duh) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x); -- TEST: divide by zero yields error in all forms (integer) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1/0); -- TEST: divide by zero yields error in all forms (real) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1/0.0); -- TEST: divide by zero yields error in all forms (long) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1/0L); -- TEST: divide by zero yields error in all forms (bool) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 / not 1); -- TEST: divide by zero yields error in all forms (integer) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 % 0); -- TEST: divide by zero yields error in all forms (long) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 % 0L); -- TEST: divide by zero yields error in all forms (bool) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 % not 1); -- TEST: not handles error prop -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(not x); -- TEST: variables not allowed in constant expressions (duh) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(case x when 1 then 2 end); -- TEST: variables not allowed in constant expressions (duh) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(case 1 when x then 2 end); -- TEST: variables not allowed in constant expressions (duh) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(case 1 when 1 then x end); -- TEST: variables not allowed in constant expressions (duh) -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(case when x then 2 end); -- TEST: non integer arguments not allowed -- + {const}: err -- + Error % operands must be an integer type, not real '~' -- +1 Error select const(~1.3); -- TEST: error should flow through -- + {const}: err -- + SELECT CONST(~(1 / 0)); -- + Error % evaluation of constant failed -- +1 Error select const(~(1/0)); -- TEST: error should flow through -- + {const}: err -- + SELECT CONST(-(1 / 0)); -- + Error % evaluation of constant failed -- +1 Error select const(-(1/0)); -- TEST: ~NULL -- ~NULL is null -- + SELECT NULL; -- - Error select const(~null); -- TEST: -NULL -- -NULL is null -- + SELECT NULL; -- - Error select const(-null); -- TEST: forcing errors in binary operators to make them prop: comparison type -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x == x); -- TEST: forcing errors in binary operators to make them prop: is/is_not comparison type -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x is x); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x + 0); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(0 + x); -- TEST: null handling for + -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(null + 0); -- TEST: null handling for + -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 + null); -- TEST: bool handling for + -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT TRUE; -- - Error select const(true + false); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x - 0); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(0 - x); -- TEST: null handling for - -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(null - 0); -- TEST: null handling for - -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 - null); -- TEST: bool handling for - -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT TRUE; -- - Error select const(true - false); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x * 0); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(0 * x); -- TEST: null handling for * -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(null * 0); -- TEST: null handling for * -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 * null); -- TEST: bool handling for * -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT FALSE; -- - Error select const(true * false); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x / 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 / x); -- TEST: null handling for / -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(null / 1); -- TEST: null handling for / -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(1 / null); -- TEST: bool handling for / -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT FALSE; -- - Error select const(false / true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x % 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 % x); -- TEST: null handling for % -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(null % 1); -- TEST: null handling for % -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(1 % null); -- TEST: bool handling for % -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT FALSE; -- - Error select const(false % true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x == 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 == x); -- TEST: null handling for == (don't use a literal null) -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const((not null) == 0); -- TEST: null handling for == (don't use a literal null) -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 == not null); -- TEST: null handling for + -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 + null); -- TEST: bool handling for == -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT FALSE; -- - Error select const(false == true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x != 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 != x); -- TEST: null handling for == (don't use a literal null) -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const((not null) != 0); -- TEST: null handling for != (don't use a literal null) -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 != not null); -- TEST: bool handling for != -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT TRUE; -- - Error select const(false != true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x <= 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 <= x); -- TEST: null handling for <= (don't use a literal null) -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const((not null) <= 0); -- TEST: null handling for <= (don't use a literal null) -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 <= not null); -- TEST: bool handling for <= -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT TRUE; -- - Error select const(false <= true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x >= 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 >= x); -- TEST: null handling for >= (don't use a literal null) -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const((not null) >= 0); -- TEST: null handling for >= (don't use a literal null) -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 >= not null); -- TEST: bool handling for >= -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT FALSE; -- - Error select const(false >= true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x > 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 > x); -- TEST: null handling for > -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(null > 1); -- TEST: null handling for > -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(1 > null); -- TEST: bool handling for > -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT FALSE; -- - Error select const(false > true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x < 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 < x); -- TEST: null handling for < -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(null < 1); -- TEST: null handling for < -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(1 < null); -- TEST: bool handling for < -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT TRUE; -- - Error select const(false < true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x << 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 << x); -- TEST: null handling for << -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(null << 0); -- TEST: null handling for << -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 << null); -- TEST: bool handling for << -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT FALSE; -- - Error select const(false << true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x >> 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 >> x); -- TEST: null handling for >> -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(null >> 0); -- TEST: null handling for >> -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 >> null); -- TEST: bool handling for >> -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT FALSE; -- - Error select const(false >> true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x | 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 | x); -- TEST: null handling for | -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(null | 0); -- TEST: null handling for | -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 | null); -- TEST: bool handling for | -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT TRUE; -- - Error select const(false | true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x & 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 & x); -- TEST: null handling for & -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(null & 0); -- TEST: null handling for & -- + {select_stmt}: select: { _anon: null } -- + SELECT NULL; -- - Error select const(0 & null); -- TEST: bool handling for & -- + {select_stmt}: select: { _anon: bool notnull } -- + SELECT FALSE; -- - Error select const(false & true); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x is 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 is x); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x is not 1); -- TEST: forcing errors in binary operators to make them prop: normal binary -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 is not x); -- TEST: forcing errors in binary operators to make them prop: and error in first arg -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x and 0); -- TEST: forcing errors in binary operators to make them prop: and error in second arg -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 and x); -- TEST: forcing errors in binary operators to make them prop: or: error in first arg -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(x or 0); -- TEST: forcing errors in binary operators to make them prop: or: force error in second arg -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(0 or x); -- TEST: forcing errors in binary operators to make them prop: and: force error in 2nd arg -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(1 and x); -- TEST: forcing errors in cast -- + {const}: err -- + Error % evaluation of constant failed -- +1 Error select const(cast(x as real)); -- TEST: with expression, duplicate columnms -- + Error % duplicate name in list 'a' -- +1 Error with foo(a, a) as (select 1,2) select 1; -- TEST: with expression, duplicate cte name -- + Error % duplicate common table name 'foo' -- +1 Error with foo(a, b) as (select 1,2), foo(a, b) as (select 1,2) select 1; -- TEST: with expression, too few columns -- + Error % too few column names specified in common table expression 'foo' -- +1 Error with foo(a) as (select 1,2) select 1; -- TEST: with expression, too few columns -- + Error % too many column names specified in common table expression 'foo' -- +1 Error with foo(a, b, c) as (select 1,2) select 1; -- TEST: with expression, broken inner select -- + Error % string operand not allowed in 'NOT' -- +1 Error with foo(a) as (select not 'x') select 1; -- TEST: with expression, broken inner select -- + Error % string operand not allowed in 'NOT' -- +1 Error with foo(a) as (select 1) select not 'x'; -- TEST: basic with expression -- - Error with some_cte(a, b) as (select 1,2) select a, b from some_cte; -- TEST: make sure that the overall result of the CTE is nullable -- even if the first branch of the CTE (which is its provisional definition) -- is not nullable -- WARNING easily broken do not change this test especially not nullability -- WARNING easily broken do not change this test especially not nullability -- WARNING easily broken do not change this test especially not nullability -- WARNING easily broken do not change this test especially not nullability -- WARNING easily broken do not change this test especially not nullability -- + {with_select_stmt}: select: { a: integer } -- + {cte_tables}: ok -- + {cte_table}: foo: { a: integer } -- + {cte_decl}: foo: { a: integer } -- + {select_stmt}: union_all: { x: integer } -- + {select_core}: select: { x: integer notnull } -- + {select_core}: select: { x: null } -- - Error -- WARNING easily broken do not change this test especially not nullability -- WARNING easily broken do not change this test especially not nullability -- WARNING easily broken do not change this test especially not nullability -- WARNING easily broken do not change this test especially not nullability -- WARNING easily broken do not change this test especially not nullability -- WARNING easily broken do not change this test especially not nullability with foo(a) as (select 1 x union all select null x) select * from foo; -- TEST: nested CTE -- note scoping -- - Error -- +2 {cte_table}: y: { a: integer notnull, b: integer notnull } with x(a,b) as (select 1,2) select * from x as X inner join ( with y(a,b) as (select 1,3) select * from y ) as Y on X.a = Y.a inner join ( with y(a,b) as (select 1,3) select * from y ) as Z on X.a = Z.a; -- TEST: with recursive -- - Error -- + {with_select_stmt}: select: { current: integer notnull } -- + {with_recursive} -- + {cte_decl}: cnt: { current: integer notnull } with recursive cnt(current) AS ( select 1 union all select current+1 from cnt limit 10 ) select current from cnt; -- TEST: with recursive with error in the definition -- + Error % duplicate name in list 'current' -- +1 Error with recursive cnt(current, current) AS ( select 1 union all select current+1 from cnt limit 10 ) select current from cnt; -- TEST: with recursive error in the base case -- + Error % string operand not allowed in 'NOT' -- +1 Error with recursive cnt(current) AS ( select not 'x' union all select current+1 from cnt limit 10 ) select current from cnt; -- TEST: with recursive error in the main case -- + Error % string operand not allowed in 'NOT' -- +1 Error with recursive cnt(current) AS ( select 1 union all select not 'x' ) select current from cnt; -- TEST: with recursive error in the output select -- + Error % string operand not allowed in 'NOT' -- +1 Error with recursive cnt(current) AS ( select 1 union all select current+1 from cnt limit 10 ) select not 'x'; -- TEST: verify the shape of tree with many unions -- here we're checking to make sure Y is loose at the end of the chain -- and the two X variables came before in the tree -- +2 | | {name X}: X: integer variable -- + | {name Y}: Y: integer variable select X as A union all select X as A union all select Y as A; -- TEST: verify that we can create a view that is based on a CTE -- -Error -- + {with_select_stmt}: view_with_cte: { x: integer notnull } -- + {cte_table}: goo: { x: integer notnull } create view view_with_cte as with goo(x) as (select 1) select * from goo; -- TEST: verify that we can use non-simple selects inside of an IN -- - Error -- + {in_pred}: bool notnull -- + {select_stmt}: _anon: integer select 1 in (select 1 union all select 2 union all select 3) as A; -- TEST: use table.* syntax to get one table -- - Error -- + {select_stmt}: select: { _first: integer notnull, A: integer notnull, B: integer notnull, _last: integer notnull } -- + {table_star}: T: select: { A: integer notnull, B: integer notnull } select 0 as _first, T.*, 3 as _last from (select 1 as A, 2 as B) as T; -- TEST: use table.* syntax to get two tables -- - Error -- + {table_star}: T: select: { A: integer notnull, B: integer notnull } -- + {select_stmt}: select: { _first: integer notnull, A: integer notnull, B: integer notnull, C: integer notnull, _last: integer notnull } select 0 as _first, T.*, S.*, 3 as _last from (select 1 as A, 2 as B) as T, (select 1 as C) as S; -- TEST: try to use T.* with no from clause -- + Error % select [table].* cannot be used with no FROM clause -- + {table_star}: err select T.*; -- TEST: try to use T.* where T does not exist -- + Error % table not found 'T' -- + {table_star}: err select T.* from (select 1) as U; -- TEST: simple test for declare function -- + name simple_func}: real notnull -- + {param}: arg1: integer notnull variable in -- + {params}: ok -- + DECLARE FUNC simple_func (arg1 integer not null) REAL not null; -- - Error declare function simple_func(arg1 integer not null) real not null; -- TEST: error duplicate function -- + Error % duplicate function name 'simple_func' -- +1 Error declare function simple_func(arg1 integer) real not null; -- TEST: error declare proc conflicts with func -- + Error % proc name conflicts with func name 'simple_func' -- +1 Error declare proc simple_func(arg1 integer not null); -- TEST: error declare proc conflicts with func -- + Error % proc name conflicts with func name 'simple_func' -- +1 Error create proc simple_func(arg1 integer not null) begin select 1; end; -- TEST: error declare function that conflicts with a proc -- + Error % func name conflicts with proc name 'proc1' -- +1 Error declare function proc1(i integer) integer; -- TEST: try to declare a function inside a proc -- + Error % declared functions must be top level 'foo' -- +1 Error create proc nested_func_wrapper() begin declare function foo() integer; end; -- TEST: duplicate function formal -- + Error % duplicate parameter name 'a' -- +1 Error declare function dup_formal(a integer, a integer) integer; -- result for the next test declare real_result real; -- TEST: simple function call simple return -- + {assign}: real_result: real variable -- + {name real_result}: real_result: real variable -- + {call}: real notnull -- + {name simple_func} -- + {arg_list}: ok -- + {int 1}: integer notnull -- - Error set real_result := simple_func(1); -- TEST: function call with bogus arg type -- + {call}: err -- + {assign}: err -- + Error % incompatible types in expression 'arg1' -- +1 Error set real_result := simple_func('xx'); -- TEST: function call with invalid args -- + {call}: err -- + {assign}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error set real_result := simple_func(not 'xx'); -- TEST: try to use user func in a sql statement -- + {select_stmt}: err -- + {call}: err -- + Error % User function may not appear in the context of a SQL statement 'simple_func' -- +1 Error select simple_func(1); -- TEST: declare an object variable -- + {name obj_var}: obj_var: object variable -- - Error declare obj_var object; -- TEST: error on ordered comparisons (left) -- + Error % left operand cannot be an object in '<' -- +1 Error set X := obj_var < 1; -- TEST: error on ordered comparisons (right) -- + Error % right operand cannot be an object in '<' -- +1 Error set X := 1 < obj_var; -- TEST: ok to compare objects to each other with equality -- + {eq}: bool -- - Error set X := obj_var == obj_var; -- TEST: ok to compare objects to each other with inequality -- + {ne}: bool -- - Error set X := obj_var <> obj_var; -- TEST: error on math with object (left) -- + Error % left operand cannot be an object in '+' -- +1 Error set X := obj_var + 1; -- TEST: error on ordered comparisons (right) -- + Error % right operand cannot be an object in '+' -- +1 Error set X := 1 + obj_var; -- TEST: error on unary not -- + Error % object operand not allowed in 'NOT' -- + {not}: err -- +1 Error set X := not obj_var; -- TEST: error on unary negation -- + {uminus}: err -- + Error % object operand not allowed in '-' -- +1 Error set X := - obj_var; -- TEST: assign object to string -- + {name a_string}: err -- + Error % incompatible types in expression 'a_string' -- +1 Error set a_string := obj_var; -- TEST: assign string to an object -- + {name obj_var}: err -- + Error % incompatible types in expression 'obj_var' -- +1 Error set obj_var := a_string; -- TEST: create proc with object arg -- + {param}: an_obj: object variable out -- - Error create proc obj_proc(out an_obj object) begin set an_obj := null; end; -- TEST: try to create a table with an object column -- + {col_def}: err -- + Error % tables cannot have object columns 'obj' -- +1 Error create table object_table_test( obj object ); -- TEST: try to use an object variable in a select statement -- + {name obj_var}: err -- + Error % object variables may not appear in the context of a SQL statement (except table-valued functions) 'obj_var' -- +1 Error select obj_var; -- TEST: try to use an object variable in an IN statement, that's ok -- + {in_pred}: bool -- + {expr_list}: obj_var: object variable -- - Error set X := obj_var in (obj_var, null); -- TEST: bogus in statement with object variable, combining with numeric -- + {in_pred}: err -- + Error % incompatible types in expression 'IN' -- +1 Error set X := obj_var in (obj_var, 1); -- TEST: bogus in statement with object variable, combining with text -- + {in_pred}: err -- + Error % incompatible types in expression 'IN' -- +1 Error set X := obj_var in ('foo', obj_var); -- TEST: bogus in statement with object variable, searching for text with object in list -- + {in_pred}: err -- + {expr_list}: text notnull -- + Error % incompatible types in expression 'IN' -- +1 Error set X := 'foo' in ('foo', obj_var); -- TEST: case statement using objects as test condition -- + {assign}: X: integer variable -- + {case_expr}: integer notnull -- + {name obj_var}: obj_var: object variable -- - Error set X := case obj_var when obj_var then 2 else 3 end; -- TEST: case statement using objects as result -- + {assign}: obj_var: object variable -- + {name obj_var}: obj_var: object variable -- + {case_expr}: object -- + {case_list}: object variable -- + {when}: obj_var: object variable -- + {null}: null -- - Error set obj_var := case 1 when 1 then obj_var else null end; -- TEST: between with objects is just not happening, first case -- + Error % first operand cannot be an object in 'BETWEEN' -- +1 Error set X := obj_var between 1 and 3; -- TEST: between with objects is just not happening, second case; -- + Error % incompatible types in expression 'BETWEEN' -- +1 Error set X := 2 between obj_var and 3; -- TEST: between with objects is just not happening, third case; -- + Error % incompatible types in expression 'BETWEEN' -- +1 Error set X := 2 between 1 and obj_var; -- TEST: not between with objects similarly not supported, first case -- + Error % first operand cannot be an object in 'NOT BETWEEN' -- +1 Error set X := obj_var not between 1 and 3; -- TEST: not between with objects similarly not supported, second case; -- + Error % incompatible types in expression 'NOT BETWEEN' -- +1 Error set X := 2 not between obj_var and 3; -- TEST: not between with objects similarly not supported, third case; -- + Error % incompatible types in expression 'NOT BETWEEN' -- +1 Error set X := 2 not between 1 and obj_var; -- TEST: make a function that creates an not null object -- + {name creater_func}: object notnull create_func -- - Error declare function creater_func() create object not null; -- TEST: make a function that creates an nullable -- + declare_func_stmt}: object create_func -- - Error declare function maybe_create_func() create object; -- Storage for these next few tests -- - Error declare not_null_object object not null; -- TEST: convert object to not null -- + {assign}: not_null_object: object notnull variable -- + {name not_null_object}: not_null_object: object notnull variable -- - Error set not_null_object := ifnull_crash(obj_var); -- TEST: convert object to not null -- ifnull_crash form -- + {assign}: not_null_object: object notnull variable -- + {name not_null_object}: not_null_object: object notnull variable -- - Error set not_null_object := ifnull_crash(obj_var); -- TEST: convert object to not null (throw semantic) -- same code path as above -- + {assign}: not_null_object: object notnull variable -- + {name not_null_object}: not_null_object: object notnull variable -- - Error set not_null_object := ifnull_throw(obj_var); -- TEST: attest with matching kind, ok to go -- + {assign}: price_d: real<dollars> variable -- + {name price_d}: price_d: real<dollars> variable -- + {call}: price_d: real<dollars> notnull variable set price_d := ifnull_crash(price_d); -- TEST: attest should copy the semantic info including kind, hence can produce errors -- + {assign}: err -- + Error % expressions of different kinds can't be mixed: 'dollars' vs. 'euros' -- +1 Error set price_d := ifnull_crash(price_e); -- TEST: convert to not null -- fails already not null -- + {call}: err -- + Error % argument must be a nullable type (but not constant NULL) in 'ifnull_crash' -- +1 Error set not_null_object := ifnull_crash(not_null_object); -- TEST: convert to not null -- fails can't do this to 'null' -- + {call}: err -- + Error % argument must be a nullable type (but not constant NULL) in 'ifnull_crash' -- +1 Error set not_null_object := ifnull_crash(null); -- TEST: convert to not null -- fails wrong arg count -- + {call}: err -- + Error % function got incorrect number of arguments 'ifnull_crash' -- +1 Error set not_null_object := ifnull_crash(1, 7); -- TEST: convert to not null -- fails in SQL context -- + {call}: err -- + Error % function may not appear in this context 'ifnull_crash' -- +1 Error set not_null_object := (select ifnull_crash(1)); -- TEST: echo statement is ok in any top level context -- + {echo_stmt}: ok -- + {name c} -- + {strlit 'foo\n'} -- - Error @echo c, 'foo\n'; -- TEST: simple typed object declaration -- + declare_vars_type}: object<Foo> -- + {name_list}: foo_obj: object<Foo> variable -- + {name foo_obj}: foo_obj: object<Foo> variable -- + {type_object}: object<Foo> -- + {name Foo} -- - Error declare foo_obj object<Foo>; -- TEST: simple typed object assignment -- + {assign}: foo_obj: object<Foo> variable -- + {name foo_obj}: foo_obj: object<Foo> variable -- + {name foo_obj}: foo_obj: object<Foo> variable -- - Error set foo_obj := foo_obj; -- TEST: function with typed object return type -- + {declare_func_stmt}: object<Foo> -- - Error declare function foo_func() object<Foo>; -- TEST: function with typed object return type -- + {assign}: foo_obj: object<Foo> variable -- + {name foo_obj}: foo_obj: object<Foo> variable -- + {call}: object<Foo> -- - Error set foo_obj := foo_func(); -- TEST: some different object type -- + {declare_vars_type}: object<Bar> -- + {name_list}: bar_obj: object<Bar> variable -- - Error declare bar_obj object<Bar>; -- TEST: assign Bar to a Foo -- + Error % expressions of different kinds can't be mixed: 'Bar' vs. 'Foo' -- +1 Error set bar_obj := foo_obj; -- TEST: case statement must have uniform return type -- + Error % expressions of different kinds can't be mixed: 'Bar' vs. 'Foo' -- +1 Error set bar_obj := case 1 when 1 then bar_obj when 2 then foo_obj end; -- TEST: case statement errors in then expr -- + Error % name not found 'bar_object' -- +1 Error set bar_obj := case 1 when 1 then bar_object when 2 then foo_obj end; -- TEST: case statement must have uniform return type -- + Error % expressions of different kinds can't be mixed: 'Bar' vs. 'Foo' -- +1 Error set bar_obj := case 1 when 1 then bar_obj else foo_obj end; -- TEST: case statement errors in else -- + Error % name not found 'foo_object' -- +1 Error set bar_obj := case 1 when 1 then bar_obj else foo_object end; -- TEST: case statement typed object no errors -- + {assign}: bar_obj: object<Bar> variable -- + {name bar_obj}: bar_obj: object<Bar> variable -- + {case_expr}: object<Bar> -- - Error set bar_obj := case 1 when 1 then bar_obj when 2 then bar_obj else bar_obj end; -- TEST: non-user func with bogus arg -- + {call_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error call printf('%d', simple_func(not 'x')); -- TEST: insert with column names, types match -- + {insert_stmt}: ok -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- - Error insert into bar(id, name, rate) values (1, '2', 3); -- TEST: insert with auto increment column null ok -- + {insert_stmt}: ok -- + {name_columns_values} -- + {name foo}: foo: { id: integer notnull primary_key autoinc } -- - Error insert into foo(id) values(NULL); -- TEST: insert missing column -- + {insert_stmt}: err -- + Error % required column missing in INSERT statement 'id' -- +1 Error insert into bar(name) values('x'); -- TEST: insert column name doesn't exist -- + {insert_stmt}: err -- + Error % name not found 'garbonzo' -- +1 Error insert into bar(garbonzo) values('x'); -- TEST: insert duplicate column name -- + {insert_stmt}: err -- + Error % name list has duplicate name 'id' -- +1 Error insert into bar(id, id) values('x'); -- TEST: insert column with default value -- + {insert_stmt}: ok -- + {name booly}: booly: { id: integer has_default, flag: bool } -- - Error insert into booly(id) values(1); -- TEST: insert into a view (with columns) -- + Error % cannot insert into a view 'MyView' -- +1 Error -- + {name MyView}: MyView: { f1: integer notnull, f2: integer notnull, f3: integer notnull } -- + {insert_stmt}: err insert into MyView(id) values (1); -- TEST: insert into non existent table -- + {insert_stmt}: err -- + Error % table in insert statement does not exist 'garbonzo' -- +1 Error insert into garbonzo(id) values('x'); -- TEST: declare a function with object arg type -- + {param_detail}: goo: object<Goo> variable in -- - Error declare function goo_func(goo object<Goo>) text; -- TEST: function with mismatched arg type -- + {assign}: err -- + Error % expressions of different kinds can't be mixed: 'Goo' vs. 'Bar' -- +1 Error set a_string := goo_func(bar_obj); -- TEST: user function with bogus arg -- + {assign}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error set a_string := goo_func(not 'x'); -- TEST: insert columns with mismatched count -- + {insert_stmt}: err -- + Error % count of columns differs from count of values -- +1 Error insert into foo(id) values(NULL, NULL); -- TEST: insert columns with error in expression -- + {insert_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error insert into foo(id) values(not 'x'); -- TEST: insert auto inc column with not null value -- + {insert_stmt}: ok -- + {name_columns_values} -- + {name foo}: foo: { id: integer notnull primary_key autoinc } -- - Error insert into foo(id) values(1); -- TEST: insert with not matching column types -- + {insert_stmt}: err -- + Error % incompatible types in expression 'id' -- +1 Error insert into bar(id) values('x'); -- TEST: create a temporary view -- + {create_view_stmt}: temp_view: { A: integer notnull, B: integer notnull } -- this is the temp flag -- + {int 1} -- + {name_and_select} -- + {name temp_view} -- + {select_stmt}: temp_view: { A: integer notnull, B: integer notnull } -- - Error create temp view temp_view as select 1 A, 2 B; -- TEST: alter a table, adding a nullable column -- {alter_table_add_column_stmt}: ok -- {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- {col_def}: name: text -- - Error alter table bar add column name text; -- TEST: alter a table, adding a nullable column -- {alter_table_add_column_stmt}: err -- + Error % adding a not nullable column with no default value is not allowed 'name' alter table bar add column name text not null; -- TEST: alter a table, adding a column whose declared type does not match -- {alter_table_add_column_stmt}: err -- + Error % added column must be an exact match for the column type declared in the table 'name' alter table bar add column name integer; -- TEST: alter a table, adding a column that was not declared -- {alter_table_add_column_stmt}: err -- + Error % added column must already be reflected in declared schema, with @create, exact name match required 'goo' alter table bar add column goo integer; -- TEST: alter a table, adding a column that was not declared -- {alter_table_add_column_stmt}: err -- + Error % added column must already be reflected in declared schema, with @create, exact name match required 'NAME' alter table bar add column NAME text; -- TEST: alter a table, adding a nullable column -- {alter_table_add_column_stmt}: err -- + Error % tables cannot have object columns 'foo' alter table bar add column foo object; -- TEST: alter a table, adding an autoinc column -- {alter_table_add_column_stmt}: err -- + Error % adding an auto increment column is not allowed 'id' alter table bar add column id integer primary key autoincrement; -- TEST: alter a table, table doesn't exist -- {alter_table_add_column_stmt}: err -- + Error % table in alter statement does not exist 'garbonzo' alter table garbonzo add column id integer primary key autoincrement; -- TEST: alter a table, table is a view -- {alter_table_add_column_stmt}: err -- + Error % cannot alter a view 'MyView' alter table MyView add column id integer primary key autoincrement; -- TEST: try to declare a schema version inside of a proc -- + Error % schema upgrade version declaration must be outside of any proc -- +1 Error create proc bogus_version() begin @schema_upgrade_version(11); end; -- TEST: try to declare a schema version after tables already defined -- + Error % schema upgrade version declaration must come before any tables are declared -- +1 Error @schema_upgrade_version(11); -- TEST: try to declare a bogus version number -- + Error % schema upgrade version must be a positive integer -- +1 Error @schema_upgrade_version(0); -- TEST: try to alter a column with create version specs -- + Error % version annotations not valid in alter statement 'name' -- +1 Error alter table bar add column name text @create(1, foo); -- TEST: try to alter a column with delete version specs -- + Error % version annotations not valid in alter statement 'name' -- +1 Error alter table bar add column name text @delete(1); -- TEST: try to alter a column with multiple version specs -- + Error % duplicate version annotation -- +1 Error alter table bar add column name text @delete(1) @delete(1); -- TEST: try to alter a column with multiple version specs -- + Error % duplicate version annotation -- +1 Error alter table bar add column name text @create(1) @create(1); -- TEST: try to alter a column with bogus version number -- + Error % version number in annotation must be positive -- +1 Error alter table bar add column name text @create(0); -- TEST: declare a table with a deleted column (should be deleted) -- + {create_table_stmt}: hides_id_not_name: { name: text } -- + {col_def}: id: integer deleted -- + {col_def}: name: text create table hides_id_not_name( id int @delete(2), name text @create(3) ); -- TEST: try to use id from the above -- + {name id}: err -- + Error % name not found 'id' -- +1 Error select id from hides_id_not_name; -- TEST: try to use name from the above -- + {select_stmt}: select: { name: text } -- - Error select name from hides_id_not_name; -- TEST: duplicate procedure annotation -- + {create_table_stmt}: err -- + {col_def}: err -- + {create_attr}: err -- + Error % a procedure can appear in only one annotation 'creator' -- +1 Error create table migrate_test( id integer not null, id2 integer @create(4, creator), id3 integer @create(4, creator) ); -- TEST: try to declare 'creator' in the wrong version (it should be in 4) -- + {create_proc_stmt}: err -- + Error % @schema_upgrade_version not declared or doesn't match upgrade version 4 for proc 'creator' -- +1 Error create proc creator() begin select 1; end; -- TEST: create a table with @create annotations in a bogus order -- + Error % created columns must be at the end and must be in version order 'col3' -- +1 Error create table migrate_annotions_broken( col1 integer, col2 integer @create(3), col3 integer ); -- TEST: create a table with @create annotations on a not null column -- + Error % create/delete version numbers can only be applied to columns that are nullable or have a default value 'col2' -- +1 Error create table migrate_annotions_broken_not_null_create( col1 integer, col2 integer not null @create(3) ); -- TEST: create a table with @delete annotations on a not null column -- + Error % create/delete version numbers can only be applied to columns that are nullable or have a default value 'col2' -- +1 Error create table migrate_annotions_broken_not_null_delete( col1 integer, col2 integer not null @delete(3) ); -- TEST: create a table with @delete on earlier version than create -- + Error % column delete version can't be <= column create version 'col2' -- +1 Error create table migrate_annotions_delete_out_of_order( col1 integer, col2 integer @delete(3) @create(4) ); -- TEST: create a table with versioning -- + {create_attr} -- + {int 1} -- + {name table_create_proc} -- + {delete_attr} -- + {int 2} -- + {name table_delete_proc} -- + deleted -- - Error create table versioned_table( id integer @create(2) ) @create(1, table_create_proc) @delete(3, table_delete_proc); -- TEST: try to use a migration procedure name that ends in _crc -- + Error % the name of a migration procedure may not end in '_crc' 'x_crc' -- +1 Error create table bogus_migration_proc( id integer ) @create(1, x_crc); -- TEST: create a table with double creates -- +1 Error % duplicate version annotation -- +1 Error create table versioned_table_double_create( id integer ) @create(1) @create(1); -- TEST: create a table with double delete -- +1 Error % duplicate version annotation -- +1 Error create table versioned_table_double_delete( id integer ) @delete(1) @delete(1); -- TEST: try to create an index on deprecated table -- + {create_index_stmt}: err -- + Error % create index table name not found (hidden by @delete) 'versioned_table' -- +1 Error create index index_broken on versioned_table(id); -- TEST: make an FK that refers to a versioned table -- + Error % foreign key refers to non-existent table (hidden by @delete) 'versioned_table' -- +1 Error -- create_table_stmt}: err create table baz ( id integer, foreign key (id) references versioned_table(id) ); -- TEST: try to select from a deprecated table -- + Error % table/view not defined (hidden by @delete) 'versioned_table' -- +1 Error select * from versioned_table; -- TEST: try to alter a deleted table -- DDL is exempt from the existence rules -- - Error alter table versioned_table add column id integer; -- TEST: try to delete from a deprecated table -- + Error % table in delete statement does not exist (hidden by @delete) 'versioned_table' -- +1 Error delete from versioned_table; -- TEST: try to insert into a deprecated table -- + Error % table in insert statement does not exist (hidden by @delete) 'versioned_table' -- +1 Error insert into versioned_table values(1); -- TEST: try to insert into a deprecated table (column syntax) -- + Error % table in insert statement does not exist (hidden by @delete) 'versioned_table' -- +1 Error insert into versioned_table(id) values(1); -- TEST: try to create a view with the same name as the versioned table -- note: the name is found even though the table is deleted -- + {create_view_stmt}: err -- + Error % duplicate table/view name 'versioned_table' create view versioned_table as select 1 x; -- TEST: try to create a global variable with the same name as the versioned table -- note: the name is found even though the table is deleted -- + {declare_vars_type}: err -- + Error % global variable hides table/view name 'versioned_table' -- +1 Error declare versioned_table integer; -- TEST: try to create a table with the same name as the versioned table -- note: the name is found even though the table is deleted -- + {create_table_stmt}: err -- + Error % duplicate table/view name 'versioned_table' create table versioned_table(id2 integer); -- TEST: drop the table (note that DDL works on any version) -- + {drop_table_stmt}: ok -- + {name versioned_table}: versioned_table: { id: integer } deleted -- - Error drop table if exists versioned_table; -- TEST: drop table that doesn't exist -- + Error % table in drop statement does not exist 'garbonzo' -- +1 Error drop table garbonzo; -- TEST: try to drop table on a view -- + Error % cannot drop a view with drop table 'MyView' -- +1 Error drop table MyView; -- TEST: use a proc to get the result set -- + {create_proc_stmt}: select: { id: integer notnull, name: text, rate: longint } dml_proc -- + {call_stmt}: select: { id: integer notnull, name: text, rate: longint } dml_proc -- - Error create procedure uses_proc_for_result() begin call with_result_set(); end; -- TEST: table with a column deleted too soon -- + Error % column delete version can't be <= the table create version 'id' -- +1 Error create table t_col_early_delete ( id integer @delete(2) ) @create(3); -- TEST: table with a column created too soon -- + Error % column create version can't be <= the table create version 'id' -- +1 Error create table t_col_early_delete ( id integer @create(2) ) @create(3); -- TEST: table with a column deleted too late -- + Error % column delete version can't be >= the table delete version 'id' -- +1 Error create table t_col_early_delete ( id integer @delete(2) ) @delete(1); -- TEST: table with a column created too late -- + Error % column create version can't be >= the table delete version 'id' -- +1 Error create table t_col_early_delete ( id integer @create(2) ) @delete(1); -- TEST: table deleted not null column with default -- + {col_def}: id: integer notnull has_default deleted @delete(2) -- - Error create table t_col_delete_notnull ( id integer not null DEFAULT 8675309 @delete(2) ); -- TEST: negative default value -- + {create_table_stmt}: neg_default: { id: integer notnull has_default } -- + {col_def}: id: integer notnull has_default -- + {col_attrs_default} -- + {uminus} -- + {int 1} -- - Error create table neg_default ( id integer not null default -1 @create(2) ); -- TEST: alter a table, adding a nullable column -- {alter_table_add_column_stmt}: ok -- {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- {col_def}: name: text -- - Error alter table neg_default add column id integer not null default -1; -- TEST: try to validate previous schema in a proc -- + {create_proc_stmt}: err -- + {previous_schema_stmt}: err -- + Error % switching to previous schema validation mode must be outside of any proc -- +1 Error create proc bogus_validate() begin @previous_schema; end; -- TEST: make a select * with a duplicate result column name and try to fetch the fields -- + {fetch_stmt}: err -- + {name C}: err -- + Error % duplicate column name in result not allowed 'id' -- +1 Error create proc bogus_fetch() begin declare C cursor for select * from foo T1 join foo T2 on T1.id = T2.id; fetch C; end; -- TEST: make a select * with a duplicate result column name and use that as a proc result set -- + {create_proc_stmt}: err -- + Error % duplicate column name in result not allowed 'id' -- +1 Error create proc bogus_result_duplicate_names() begin select * from foo T1 join foo T2 on T1.id = T2.id; end; -- TEST: make table with text as a column name -- + {create_table_stmt}: table_with_text_as_name: { text: text, text2: text } -- - Error create table table_with_text_as_name( text text, text2 text ); -- TEST: use text as a column -- + {select_stmt}: select: { text: text, text2: text } -- - Error select text, text2 from table_with_text_as_name; -- TEST: extract a column named text -- brutal renames -- + {select_stmt}: select: { text: text, other_text: text } -- + {select_from_etc}: TABLE { table_with_text_as_name: table_with_text_as_name } -- + {name text2}: text2: text -- + {name text}: text: text -- - Error select text2 as text, text as other_text from table_with_text_as_name; -- TEST: try to start a schema upgrade after there are tables -- {schema_upgrade_script_stmt}: err -- + Error % schema upgrade declaration must come before any tables are declared -- +1 Error @schema_upgrade_script; -- TEST: try to start a schema upgrade inside a proc -- {schema_upgrade_script_stmt}: err -- + Error % schema upgrade declaration must be outside of any proc -- +1 Error create proc schema_upgrade_you_wish() begin @schema_upgrade_script; end; -- TEST: try to use the non-column insert syntax on a table with deleted columns -- we should get a fully formed insert on the non deleted column -- + INSERT INTO hides_id_not_name(name) VALUES('x'); -- + {name hides_id_not_name}: hides_id_not_name: { name: text } insert into hides_id_not_name values('x'); -- TEST: create a table with more mixed column stuff for use testing alter statements later -- + {create_table_stmt}: trickier_alter_target: { id: integer notnull, added: text } -- - Error create table trickier_alter_target( id integer, something_deleted text @create(1) @delete(2), added text @create(2), primary key(id) ); -- TEST: try to add id --> doesn't work -- + {alter_table_add_column_stmt}: err -- + {name trickier_alter_target}: trickier_alter_target: { id: integer notnull, added: text } -- + Error % added column must already be reflected in declared schema, with @create, exact name match required 'id' -- +1 Error alter table trickier_alter_target add column id integer; -- TEST: try to add something_deleted --> doesn't work -- + {alter_table_add_column_stmt}: err -- + {name trickier_alter_target}: trickier_alter_target: { id: integer notnull, added: text } -- + Error % added column must already be reflected in declared schema, with @create, exact name match required 'something_deleted' -- +1 Error alter table trickier_alter_target add column something_deleted text; -- TEST: try to add 'added' -> works! -- + {name trickier_alter_target}: trickier_alter_target: { id: integer notnull, added: text } -- + alter_table_add_column_stmt}: ok -- + {col_def}: added: text -- - Error alter table trickier_alter_target add column added text; -- TEST: select as table with error -- + {select_stmt}: err -- + {table_or_subquery}: err -- + string operand not allowed in 'NOT' -- +1 Error select * from (select not 'x' X); -- TEST: create a view with versions -- + FROM bar @DELETE(2); -- + {delete_attr} -- - Error create view view_with_version as select * from bar @delete(2); -- TEST: use a long literal -- + {longint 3147483647}: longint notnull -- - Error set ll := 3147483647L; -- TEST: try to drop a view that doesn't exist -- + {drop_view_stmt}: err -- + Error % view in drop statement does not exist 'view_not_present' -- +1 Error drop view view_not_present; -- TEST: try to drop a view that is a table -- + {drop_view_stmt}: err -- + Error % cannot drop a table with drop view 'foo' -- +1 Error drop view foo; -- TEST: drop a view that is really a view -- + {drop_view_stmt}: ok -- + {name MyView}: MyView: { f1: integer notnull, f2: integer notnull, f3: integer notnull } -- - Error drop view if exists MyView; -- TEST: drop an index that exists -- + DROP INDEX index_1; -- {drop_index_stmt}: ok -- - Error drop index index_1; -- TEST: drop an index that exists -- {drop_index_stmt}: err -- + Error % index in drop statement was not declared 'I_dont_see_no_steekin_index' -- +1 Error drop index if exists I_dont_see_no_steekin_index; -- TEST: specify a column attribute twice (put something in between) -- + {create_table_stmt}: err -- + Error % a column attribute was specified twice on the same column -- +1 Error create table two_not_null( id integer not null unique not null ); -- TEST: specify incompatible constraints -- + {create_table_stmt}: err -- + Error % column can't be primary key and also unique key 'id' -- +1 Error create table mixed_pk_uk( id integer primary key unique ); -- TEST: verify unique column flag recorded -- + {create_table_stmt}: table_with_uk: { id: integer unique_key } -- - Error create table table_with_uk( id integer unique ); -- TEST: validate PK not duplicated (mixed metho) -- + {create_table_stmt}: err -- + Error % more than one primary key in table 'baz' -- +1 Error create table baz( id integer primary key AUTOINCREMENT not null, PRIMARY KEY (id) ); -- TEST: seed value is a string -- error -- + {insert_stmt}: err -- + Error % seed expression must be a non-nullable integer -- +1 Error insert into bar (id, name, rate) values (1, 'bazzle', 3) @dummy_seed('x'); -- TEST: seed value is a string -- expression error -- + {insert_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error insert into bar (id, name, rate) values (1, 'bazzle', 3) @dummy_seed(not 'x'); -- TEST: ok to go insert with dummy values -- note that the insert statement has been mutated!! -- + INSERT INTO bar(id, name, rate) VALUES(_seed_, printf('name_%d', _seed_), _seed_) @DUMMY_SEED(1 + 2) @DUMMY_DEFAULTS @DUMMY_NULLABLES; -- + {insert_dummy_spec}: integer notnull -- + {call}: text notnull -- + {name printf}: text notnull -- + {strlit 'name_%d'}: text notnull -- - Error insert into bar () values () @dummy_seed(1+2) @dummy_nullables @dummy_defaults; -- TEST: use default value of a table -- + {name booly}: booly: { id: integer has_default, flag: bool } -- - Error insert into booly(flag) values(1); -- TEST: try to declare a blob variable -- + {declare_vars_type}: blob -- + {name_list}: blob_var: blob variable -- - Error declare blob_var blob; -- TEST: error on ordered comparisons (left) -- + Error % left operand cannot be a blob in '<' -- +1 Error set X := blob_var < 1; -- TEST: error on ordered comparisons (right) -- + Error % right operand cannot be a blob in '<' -- +1 Error set X := 1 < blob_var; -- TEST: ok to compare blobs to each other with equality -- + {eq}: bool -- - Error set X := blob_var == blob_var; -- TEST: ok to compare blobs to each other with inequality -- + {ne}: bool -- - Error set X := blob_var <> blob_var; -- TEST: error on math with blob (left) -- + Error % left operand cannot be a blob in '+' -- +1 Error set X := blob_var + 1; -- TEST: error on ordered comparisons (right) -- + Error % right operand cannot be a blob in '+' -- +1 Error set X := 1 + blob_var; -- TEST: error on unary not -- + Error % blob operand not allowed in 'NOT' -- + {not}: err -- +1 Error set X := not blob_var; -- TEST: error on unary negation -- + {uminus}: err -- + Error % blob operand not allowed in '-' -- +1 Error set X := - blob_var; -- TEST: assign blob to string -- + {name a_string}: err -- + Error % incompatible types in expression 'a_string' -- +1 Error set a_string := blob_var; -- TEST: assign string to a blob -- + {name blob_var}: err -- + Error % incompatible types in expression 'blob_var' -- +1 Error set blob_var := a_string; -- TEST: report error to use concat outside SQL statement -- + Error % CONCAT may only appear in the context of a SQL statement -- +1 Error set a_string := blob_var || 2.0; -- TEST: report error to concat blob and number -- + Error % blob operand must be converted to string first in '||' -- +1 Error select blob_var || 2.0; -- TEST: report error to concat number and blob -- + Error % blob operand must be converted to string first in '||' -- +1 Error select 1 || blob_var; -- TEST: create proc with blob arg -- + CREATE PROC blob_proc (OUT a_blob BLOB) -- + {create_proc_stmt}: ok -- + {param}: a_blob: blob variable out -- - Error create proc blob_proc(out a_blob blob) begin set a_blob := null; end; -- TEST: try to create a table with a blob column -- + {create_table_stmt}: blob_table_test: { b: blob } -- - Error create table blob_table_test( b blob ); -- TEST: try to use a blob variable in a select statement -- + {select_stmt}: select: { blob_var: blob variable } -- - Error select blob_var; -- TEST: try to use a blob variable in an IN statement, that's ok -- + {in_pred}: bool -- + {expr_list}: blob_var: blob variable -- - Error set X := blob_var in (blob_var, null); -- TEST: bogus in statement with blob variable, combining with numeric -- + {in_pred}: err -- + Error % incompatible types in expression 'IN' -- +1 Error set X := blob_var in (blob_var, 1); -- TEST: bogus in statement with blob variable, combining with text -- + {in_pred}: err -- + Error % incompatible types in expression 'IN' -- +1 Error set X := blob_var in ('foo', blob_var); -- TEST: bogus in statement with blob variable, searching for text with blob in list -- + {in_pred}: err -- + {expr_list}: text notnull -- + Error % incompatible types in expression 'IN' -- +1 Error set X := 'foo' in ('foo', blob_var); -- TEST: case statement using blobs as test condition -- + {assign}: X: integer variable -- + {case_expr}: integer notnull -- + {name blob_var}: blob_var: blob variable -- - Error set X := case blob_var when blob_var then 2 else 3 end; -- TEST: case statement using blobs as result -- + {assign}: blob_var: blob variable -- + {name blob_var}: blob_var: blob variable -- + {case_expr}: blob -- + {case_list}: blob variable -- + {when}: blob_var: blob variable -- + {null}: null -- - Error set blob_var := case 1 when 1 then blob_var else null end; -- TEST: between with blobs is just not happening, first case -- + Error % first operand cannot be a blob in 'BETWEEN' -- +1 Error set X := blob_var between 1 and 3; -- TEST: between with blobs is just not happening, second case; -- + Error % incompatible types in expression 'BETWEEN' -- +1 Error set X := 2 between blob_var and 3; -- TEST: between with blobs is just not happening, third case; -- + Error % incompatible types in expression 'BETWEEN' -- +1 Error set X := 2 between 1 and blob_var; -- TEST: not between with blobs similarly not supported, first case -- + Error % first operand cannot be a blob in 'NOT BETWEEN' -- +1 Error set X := blob_var not between 1 and 3; -- TEST: not between with blobs similarly not supported, second case; -- + Error % incompatible types in expression 'NOT BETWEEN' -- +1 Error set X := 2 not between blob_var and 3; -- TEST: not between with blobs similarly not supported, third case; -- + Error % incompatible types in expression 'NOT BETWEEN' -- +1 Error set X := 2 not between 1 and blob_var; -- TEST: try to fetch into object variables -- + {fetch_stmt}: err -- + Error % incompatible types in expression 'o1' -- +1 Error create proc bogus_object_read() begin declare o1, o2, o3 object; declare C cursor for select * from bar; fetch C into o1, o2, o3; end; -- TEST: try to use in (select...) in a bogus context -- + Error % [not] in (select ...) is only allowed inside of select lists, where, on, and having clauses -- +1 Error create proc fool(x integer) begin set x := x in (select 1); end; -- TEST: try to use not in (select...) in a bogus context -- + Error % [not] in (select ...) is only allowed inside of select lists, where, on, and having clauses -- +1 Error create proc notfool(x integer) begin set x := x not in (select 1); end; -- TEST: try to make a dummy blob -- not supported -- + {insert_stmt}: ok -- + {cast_expr}: blob notnull -- + {call}: text notnull -- + {name printf}: text notnull -- + {strlit 'b_%d'}: text notnull -- + {name _seed_}: _seed_: integer notnull variable -- + INSERT INTO blob_table_test(b) VALUES(CAST(printf('b_%d', _seed_) AS BLOB)) @DUMMY_SEED(1) @DUMMY_NULLABLES; -- - Error insert into blob_table_test() values() @dummy_seed(1) @dummy_nullables; -- TEST: simple out statement case create proc out_cursor_proc() begin declare C cursor for select 1 A, 2 B; fetch C; out C; end; -- needed for the next test declare QQ cursor like out_cursor_proc; -- TEST: force an error on the out cursor path, bad args -- {declare_cursor}: err -- + Error % too many arguments provided to procedure 'out_cursor_proc' -- +1 Error fetch QQ from call out_cursor_proc(1); -- we need this for the next test, it has the right shape but it's not an out proc create proc not_out_cursor_proc() begin select 1 A, 2 B; end; -- TEST: force an error on the out cursor path, the proc isn't actually an out cursor proc -- {fetch_call_stmt}: err -- + Error % cursor requires a procedure that returns a cursor with OUT 'QQ' -- +1 Error fetch QQ from call not_out_cursor_proc(); -- TEST: use non-fetched cursor for out statement -- + {create_proc_stmt}: err -- + {out_stmt}: err -- + Error % the cursor was not fetched with the auto-fetch syntax 'fetch [cursor]' 'C' -- +1 Error create proc out_cursor_proc_not_shape_storage() begin declare a, b integer not null; declare C cursor for select 1 A, 2 B; fetch C into a, b; out C; end; -- TEST: use non-fetched cursor for out statement -- + {create_proc_stmt}: err -- + {out_stmt}: err -- + Error % in multiple select/out statements, all column names must be identical so they have unambiguous names 'C' -- +1 Error create proc out_cursor_proc_incompat_results() begin declare a, b integer not null; declare C cursor for select 1 A, 2 B; declare D cursor for select 1 A, 2 C; fetch C; fetch D; out C; out D; end; -- TEST: use mixed select and out -- + {create_proc_stmt}: err -- + {select_stmt}: err -- + Error % can't mix and match out, out union, or select/call for return values 'out_cursor_proc_mixed_cursor_select' -- +1 Error create proc out_cursor_proc_mixed_cursor_select() begin declare a, b integer not null; declare C cursor for select 1 A, 2 B; fetch C; out C; select 1 A, 2 B; end; -- TEST: use mixed select and out (other order) -- + {create_proc_stmt}: err -- + {out_stmt}: err -- + Error % can't mix and match out, out union, or select/call for return values 'out_cursor_proc_mixed_cursor_select_select_first' -- +1 Error create proc out_cursor_proc_mixed_cursor_select_select_first() begin declare a, b integer not null; declare C cursor for select 1 A, 2 B; fetch C; select 1 A, 2 B; out C; end; -- TEST: use mixed select and out union -- + {create_proc_stmt}: err -- + {out_union_stmt}: err -- + Error % can't mix and match out, out union, or select/call for return values 'out_cursor_proc_mixed_cursor_select_then_union' -- +1 Error create proc out_cursor_proc_mixed_cursor_select_then_union() begin declare a, b integer not null; declare C cursor for select 1 A, 2 B; fetch C; select 1 A, 2 B; out union C; end; -- TEST simple out union proc with dml -- + {create_proc_stmt}: C: select: { A: integer notnull, B: integer notnull } variable dml_proc shape_storage uses_out_union -- - Error create proc out_union_dml() begin declare C cursor for select 1 A, 2 B; fetch C; out union C; end; -- TEST simple out union proc no DML -- + {create_proc_stmt}: C: select: { A: integer notnull, B: integer notnull } variable shape_storage uses_out_union -- - Error create proc out_union() begin declare C cursor like select 1 A, 2 B; fetch C using 1 A, 2 B; out union C; end; -- TEST: pass through out union is and out union proc and marked "calls" (dml version) -- + {create_proc_stmt}: C: select: { A: integer notnull, B: integer notnull } variable dml_proc shape_storage uses_out_union calls_out_union -- - Error create proc call_out_union_dml() begin call out_union_dml(); end; -- TEST: pass through out union is and out union proc and marked "calls" (not dml version) -- + {create_proc_stmt}: C: select: { A: integer notnull, B: integer notnull } variable shape_storage uses_out_union calls_out_union -- - Error create proc call_out_union() begin call out_union(); end; -- TEST: calling out union for pass through not compatible with regular out union -- + {create_proc_stmt}: err -- + {out_union_stmt}: C: select: { A: integer notnull, B: integer notnull } variable dml_proc shape_storage -- + Error % can't mix and match out, out union, or select/call for return values 'out_union_call_and_out_union' -- +1 Error create proc out_union_call_and_out_union() begin declare C cursor for select 1 A, 2 B; fetch C; out union C; call out_union_dml(); end; -- TEST: calling out union for pass through not compatible with regular out union -- + {create_proc_stmt}: err -- + {out_union_stmt}: err -- + Error % can't mix and match out, out union, or select/call for return values 'out_union_call_and_out_union_other_order' -- +1 Error create proc out_union_call_and_out_union_other_order() begin declare C cursor for select 1 A, 2 B; fetch C; call out_union_dml(); out union C; end; -- TEST: use out statement with non cursor -- + {create_proc_stmt}: err -- + {out_stmt}: err -- + Error % variable is not a cursor 'C' -- +1 Error create proc out_not_cursor() begin declare C integer; out C; end; -- TEST: out cursor outside of a proc -- + {out_stmt}: err -- + Error % the out cursor statement only makes sense inside of a procedure -- +1 Error out curs; -- TEST: read the result of a proc with an out cursor -- + {create_proc_stmt}: ok dml_proc -- + {declare_value_cursor}: C: select: { A: integer notnull, B: integer notnull } variable dml_proc shape_storage value_cursor -- + {call_stmt}: C: select: { A: integer notnull, B: integer notnull } variable dml_proc shape_storage uses_out -- - Error create proc result_reader() begin declare C cursor fetch from call out_cursor_proc(); end; -- TEST: read the result of a proc with an out cursor -- + {fetch_stmt}: err -- + Error % value cursors are not used with FETCH C, or FETCH C INTO 'C' -- +1 Error create proc fails_result_reader() begin declare C cursor fetch from call out_cursor_proc(); fetch C; end; -- TEST: declare a fetch proc with a result set -- + {declare_proc_stmt}: declared_proc: { t: text } uses_out -- - Error declare proc declared_proc(id integer) out (t text); -- TEST: fetch call a procedure with bogus args -- + {create_proc_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create proc invalid_proc_fetch_bogus_call() begin declare C cursor fetch from call declared_proc(not 'x'); end; -- a bogus proc for use in a later test create proc xyzzy() begin end; -- TEST: call a procedure that is just all wrong -- + {create_proc_stmt}: err -- + Error % cursor requires a procedure that returns a cursor with OUT 'C' -- +1 Error create proc invalid_proc_fetch() begin declare C cursor fetch from call xyzzy(); end; -- TEST: read the result of a proc with an out cursor, use same var twice -- +1 {declare_value_cursor}: C: select: { A: integer notnull, B: integer notnull } variable dml_proc shape_storage value_cursor -- +1 {declare_value_cursor}: err -- + Error % duplicate variable name in the same scope 'C' -- +1 Error create proc fails_result_reader_double_decl() begin declare C cursor fetch from call out_cursor_proc(); declare C cursor fetch from call out_cursor_proc(); end; -- TEST: use proc_with_output like it was a function -- + SET an_int := proc_with_output(1, an_int); -- + {assign}: an_int: integer variable -- + {call}: integer -- + {name proc_with_output} -- + {arg_list}: ok -- - Error set an_int := proc_with_output(1, an_int); -- TEST: helper proc to test distinc in proc used as a function create procedure proc_func(in arg1 integer, out arg2 integer) begin drop table foo; end; -- TEST: Use distinct in a procedure used as a function -- + {assign}: err -- + {call}: err -- + {distinct} -- + {arg_list}: ok -- + Error % DISTINCT may only be used in function that are aggregated or user defined 'proc_func' -- +1 Error SET an_int := proc_func(distinct 1); -- TEST: use proc_with_output like it was a function, too many args -- + {call}: err -- + Error % too many arguments provided to procedure 'proc_with_output' -- +1 Error set an_int := proc_with_output(1, an_int, an_int); -- TEST: try to use a proc that deals with struct results -- + {call}: err -- + Error % Stored procs that deal with result sets or cursors cannot be invoked as functions 'out_cursor_proc' -- +1 Error set an_int := out_cursor_proc(); -- TEST: this proc has no out arg that can be used as a result -- + {call}: err -- + Error % last formal arg of procedure is not an out arg, cannot use proc as a function 'proc2' -- +1 Error set an_int := proc2(1); -- TEST: user proc calls can't happen inside of SQL -- + {call}: err -- + Error % Stored proc calls may not appear in the context of a SQL statement 'proc_with_output' -- +1 Error set an_int := (select proc_with_output(1, an_int, an_int)); -- a helper proc that is for sure using dml create proc dml_func(out a integer not null) begin set a := (select 1); end; -- TEST: create a proc that calls a dml proc as a function, must become a dml proc itself -- - Error -- + {assign}: a: integer notnull variable out -- + {create_proc_stmt}: ok dml_proc create proc should_be_dml(out a integer not null) begin set a := dml_func(); end; -- TEST: fetch cursor from values -- + {name C}: C: select: { A: integer notnull, B: integer notnull } variable dml_proc shape_storage value_cursor -- + {fetch_values_stmt}: ok create proc fetch_values() begin declare C cursor fetch from call out_cursor_proc(); fetch C from values(1,2); end; -- TEST: fetch cursor from values with dummy values -- + FETCH C(A, B) FROM VALUES(_seed_, _seed_) @DUMMY_SEED(123) @DUMMY_NULLABLES; -- + {name C}: C: select: { A: integer notnull, B: integer notnull } variable dml_proc shape_storage value_cursor -- + {fetch_values_stmt}: ok -- +2 {name _seed_}: _seed_: integer notnull variable create proc fetch_values_dummy() begin declare C cursor fetch from call out_cursor_proc(); fetch C() from values() @dummy_seed(123) @dummy_nullables; end; -- TEST: fetch cursor from call -- + FETCH C FROM CALL out_cursor_proc(); -- + {fetch_call_stmt}: ok -- + {name C}: C: select: { A: integer notnull, B: integer notnull } variable shape_storage value_cursor -- + {call_stmt}: C: select: { A: integer notnull, B: integer notnull } variable dml_proc shape_storage uses_out -- + {name out_cursor_proc}: C: select: { A: integer notnull, B: integer notnull } variable dml_proc shape_storage uses_out -- - Error create proc fetch_from_call() begin declare C cursor like out_cursor_proc; fetch C from call out_cursor_proc(); out C; end; -- TEST: fetch cursor from call to proc with invalid arguments -- + {create_proc_stmt}: err -- + {name fetch_from_call_to_proc_with_invalid_arguments}: err -- + {stmt_list}: err -- + {fetch_call_stmt}: err -- + {call_stmt}: err -- + Error % too many arguments provided to procedure 'out_cursor_proc' -- +1 Error create proc fetch_from_call_to_proc_with_invalid_arguments() begin declare C cursor like out_cursor_proc; fetch C from call out_cursor_proc(42); out C; end; -- TEST: fetch cursor from call with invalid cursor -- + {create_proc_stmt}: err -- + {stmt_list}: err -- + {fetch_call_stmt}: err -- +2 {name C}: err -- +2 Error % variable is not a cursor 'C' create proc fetch_from_call_to_proc_with_invalid_cursor() begin declare C text; fetch C from call out_cursor_proc(); out C; end; -- TEST: fetch cursor from call to proc with different column names -- + {create_proc_stmt}: err -- + {name fetch_from_call_to_proc_with_different_column_names}: err -- + {stmt_list}: err -- + {fetch_call_stmt}: err -- + {call_stmt}: err -- expected type is not marked as an error -- - {name C}: err -- + Error % receiving cursor from call, all column names must be identical so they have unambiguous names 'B' -- +1 Error create proc fetch_from_call_to_proc_with_different_column_names() begin declare C cursor like select 1 A, 2 C; fetch C from call out_cursor_proc(); out C; end; -- TEST: fetch non cursor -- + {fetch_values_stmt}: err -- + Error % cursor not found 'not_a_cursor' -- +1 Error fetch not_a_cursor from values(1,2,3); -- TEST: try to use fetch values on a statement cursor -- + {fetch_values_stmt}: err -- + Error % fetch values is only for value cursors, not for sqlite cursors 'my_cursor' -- +1 Error fetch my_cursor from values(1,2,3); -- TEST: attempt bogus seed -- + {fetch_values_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create proc fetch_values_bogus_seed_value() begin declare C cursor fetch from call out_cursor_proc(); fetch C() from values() @dummy_seed(not 'x'); end; -- TEST: missing columns in fetch values -- + {fetch_values_stmt}: err -- + Error % count of columns differs from count of values -- +1 Error create proc fetch_values_missing_value() begin declare C cursor fetch from call out_cursor_proc(); fetch C from values(); end; -- TEST: helper proc that returns a blob -- + {create_proc_stmt}: C: select: { B: blob } variable dml_proc shape_storage uses_out create proc blob_out() begin -- cheesy nullable blob declare C cursor for select case when 1 then cast('x' as blob) else null end B; fetch C; out C; end; -- TEST: fetch cursor from values with dummy values but one is a blob -- + {fetch_values_stmt}: err -- + Error % there's no good way to generate dummy blobs; not supported for now -- +1 Error create proc fetch_values_blob_dummy() begin declare C cursor fetch from call blob_out(); fetch C() from values() @dummy_seed(123) @dummy_nullables; end; -- TEST: fetch cursor from values but not all columns mentioned -- + {fetch_values_stmt}: err -- + Error % required column missing in FETCH statement 'B' -- +1 Error create proc fetch_values_missing_columns() begin declare C cursor fetch from call out_cursor_proc(); fetch C(A) from values(1); end; -- TEST: fetch cursor from values bogus value expression -- + {fetch_values_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create proc fetch_values_bogus_value() begin declare C cursor fetch from call out_cursor_proc(); fetch C(A,B) from values(1, not 'x'); end; -- TEST: fetch cursor from values bogus value type -- + {fetch_values_stmt}: err -- + Error % incompatible types in expression 'B' -- +1 Error create proc fetch_values_bogus_type() begin declare C cursor fetch from call out_cursor_proc(); fetch C(A,B) from values(1, 'x'); end; -- TEST: fetch cursor from values provide null for blob (works) -- + fetch_values_stmt}: ok -- + FETCH C(B) FROM VALUES(NULL) @DUMMY_SEED(123); -- - Error create proc fetch_values_blob_dummy_with_null() begin declare C cursor fetch from call blob_out(); fetch C() from values() @dummy_seed(123); end; -- TEST: fetch to a cursor from another cursor -- + FETCH C0(A, B) FROM VALUES(1, 2); -- + FETCH C1(A, B) FROM VALUES(C0.A, C0.B); -- + {create_proc_stmt}: C1: select: { A: integer notnull, B: integer notnull } variable shape_storage uses_out -- + {fetch_values_stmt}: ok -- - Error create proc fetch_to_cursor_from_cursor() begin declare C0 cursor like select 1 A, 2 B; declare C1 cursor like C0; fetch C0 from values(1, 2); fetch C1 from C0; out C1; end; -- TEST: fetch to a cursor from an invalid cursor -- + {create_proc_stmt}: err -- + {name fetch_to_cursor_from_invalid_cursor}: err -- + {stmt_list}: err -- + {fetch_values_stmt}: err -- + {name C0}: err -- + Error % variable is not a cursor 'C0' -- +1 Error create proc fetch_to_cursor_from_invalid_cursor() begin declare C0 int; declare C1 cursor like select 1 A, 2 B; fetch C1 from C0; out C1; end; -- TEST: fetch to an invalid cursor from a cursor -- + {create_proc_stmt}: err -- + {name fetch_to_invalid_cursor_from_cursor}: err -- + {stmt_list}: err -- + {fetch_values_stmt}: err -- + {name C1}: err -- + Error % variable is not a cursor 'C1' -- +1 Error create proc fetch_to_invalid_cursor_from_cursor() begin declare C0 cursor like select 1 A, 2 B; declare C1 int; fetch C0 from values(1, 2); fetch C1 from C0; end; -- TEST: fetch to a statement cursor from another cursor -- + {create_proc_stmt}: err -- + {name fetch_to_statement_cursor_from_cursor}: err -- + {stmt_list}: err -- + {fetch_values_stmt}: err -- + Error % fetch values is only for value cursors, not for sqlite cursors 'C1' -- +1 Error create proc fetch_to_statement_cursor_from_cursor() begin declare C0 cursor like select 1 A, 2 B; declare C1 cursor for select 1 A, 2 B; fetch C0 from values(1, 2); fetch C1 from C0; end; -- TEST: fetch to a cursor from a cursor with different columns -- + {create_proc_stmt}: err -- + {name fetch_to_cursor_from_cursor_with_different_columns}: err -- + {stmt_list}: err -- + {fetch_values_stmt}: err -- + Error % [shape] has too few fields 'C0' -- +1 Error create proc fetch_to_cursor_from_cursor_with_different_columns() begin declare C0 cursor like select 1 A, 2 B; declare C1 cursor like select 1 A, 2 B, 3 C; fetch C0 from values(1, 2); fetch C1 from C0; end; -- TEST: fetch to a cursor from a cursor without fields -- + {create_proc_stmt}: err -- + {name fetch_to_cursor_from_cursor_without_fields}: err -- + {stmt_list}: err -- + {fetch_values_stmt}: err -- + {name C0}: err -- + Error % cannot read from a cursor without fields 'C0' -- +1 Error create proc fetch_to_cursor_from_cursor_without_fields() begin declare X int; declare Y real; declare C0 cursor for select 1 A, 2.5; declare C1 cursor like C0; fetch C0 into X, Y; fetch C1 from C0; end; -- TEST: declare a cursor like an existing cursor -- + {create_proc_stmt}: ok dml_proc -- + {name declare_cursor_like_cursor}: ok dml_proc -- + {declare_cursor_like_name}: C1: select: { A: integer notnull, B: integer notnull } variable shape_storage value_cursor -- + {name C1}: C1: select: { A: integer notnull, B: integer notnull } variable shape_storage value_cursor -- - Error create proc declare_cursor_like_cursor() begin declare C0 cursor fetch from call out_cursor_proc(); declare C1 cursor like C0; end; -- TEST: declare a cursor like a variable that's not a cursor -- + {create_proc_stmt}: err -- + {name declare_cursor_like_non_cursor_variable}: err -- + {stmt_list}: err -- + {declare_cursor_like_name}: err -- + {name C0}: err -- + Error % variable is not a cursor 'C0' -- +1 Error create proc declare_cursor_like_non_cursor_variable() begin declare C0 integer; declare C1 cursor like C0; end; -- TEST: declare a cursor with the same name as an existing variable -- + {create_proc_stmt}: err -- + {name declare_cursor_like_cursor_with_same_name}: err -- + {stmt_list}: err -- + {declare_cursor_like_name}: err -- + {name C0}: err -- + Error % duplicate variable name in the same scope 'C0' -- +1 Error create proc declare_cursor_like_cursor_with_same_name() begin declare C0 cursor fetch from call out_cursor_proc(); declare C0 cursor like C0; end; -- TEST: declare a cursor like something that's not defined -- + {create_proc_stmt}: err -- + {name declare_cursor_like_undefined_variable}: err -- + {stmt_list}: err -- + {declare_cursor_like_name}: err -- + {name C0}: err -- + Error % must be a cursor, proc, table, or view 'C0' -- +1 Error create proc declare_cursor_like_undefined_variable() begin declare C1 cursor like C0; end; -- TEST: declare a cursor like a proc -- + {create_proc_stmt}: ok -- + {name declare_cursor_like_proc}: ok -- + {declare_cursor_like_name}: C: decl3: { A: integer notnull, B: bool } variable shape_storage value_cursor -- + {name C}: C: decl3: { A: integer notnull, B: bool } variable shape_storage value_cursor -- - ok dml_proc -- - Error create proc declare_cursor_like_proc() begin declare C cursor like decl3; end; -- TEST: declare a cursor like a proc with no result -- + {create_proc_stmt}: err -- + {name declare_cursor_like_proc_with_no_result}: err -- + {stmt_list}: err -- + {declare_cursor_like_name}: err -- + {name decl1}: err -- + Error % proc has no result 'decl1' -- +1 Error create proc declare_cursor_like_proc_with_no_result() begin declare C cursor like decl1; end; -- TEST: declare a cursor like a table -- + {create_proc_stmt}: ok -- + {name declare_cursor_like_table}: ok -- + {declare_cursor_like_name}: C: bar: { id: integer notnull, name: text, rate: longint } variable shape_storage value_cursor -- + {name C}: C: bar: { id: integer notnull, name: text, rate: longint } variable shape_storage value_cursor -- - dml_proc -- - Error create proc declare_cursor_like_table() begin declare C cursor like bar; end; -- TEST: declare a cursor like a view -- + {create_proc_stmt}: ok -- + {name declare_cursor_like_view}: ok -- + {declare_cursor_like_name}: C: MyView: { f1: integer notnull, f2: integer notnull, f3: integer notnull } variable shape_storage value_cursor -- + {name C}: C: MyView: { f1: integer notnull, f2: integer notnull, f3: integer notnull } variable shape_storage value_cursor -- - dml_proc -- - Error create proc declare_cursor_like_view() begin declare C cursor like MyView; end; -- TEST: use like syntax to declare a cursor of the type of a select statement -- + CREATE PROC declare_cursor_like_select () -- + DECLARE C CURSOR LIKE SELECT 1 AS A, 2.5 AS B, 'x' AS C; -- + FETCH C(A, B, C) FROM VALUES(_seed_, _seed_, printf('C_%d', _seed_)) @DUMMY_SEED(123); -- + {declare_cursor_like_select}: C: select: { A: integer notnull, B: real notnull, C: text notnull } variable shape_storage value_cursor -- + {fetch_values_stmt}: ok -- - dml_proc -- - Error create proc declare_cursor_like_select() begin declare C cursor like select 1 A, 2.5 B, 'x' C; fetch C() from values() @dummy_seed(123); out C; end; -- TEST: a bogus cursor due to bogus expression in select -- + {declare_cursor_like_select}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error declare some_cursor cursor like select 1 A, 2.5 B, not 'x' C; -- TEST: duplicate cursor name -- + {declare_cursor_like_select}: err -- + Error % duplicate variable name in the same scope 'X' -- +1 Error declare X cursor like select 1 A, 2.5 B, 'x' C; -- TEST: pull the rowid out of a table -- + {select_stmt}: select: { rowid: longint notnull } -- - Error select rowid from foo; -- TEST: pull a rowid from a particular table -- + {select_stmt}: select: { rowid: longint notnull } -- + SELECT T1.rowid -- - Error select T1.rowid from foo T1, bar T2; -- TEST: name not unique, not found -- + {select_stmt}: err -- + Error % name not found 'rowid' -- +1 Error select T1.rowid from foo T2, foo T3; -- TEST: rowid name ambiguous -- + {select_stmt}: err -- + Error % identifier is ambiguous 'rowid' select rowid from foo T1, foo T2; -- TEST: read the result of a non-dml proc; we must not become a dml proc for doing so -- - dml_proc -- + {create_proc_stmt}: ok -- + declare_value_cursor}: C: select: { A: integer notnull, B: real notnull, C: text notnull } variable shape_storage value_cursor -- + call_stmt}: C: select: { A: integer notnull, B: real notnull, C: text notnull } variable shape_storage uses_out -- - Error create proc value_result_reader() begin declare C cursor fetch from call declare_cursor_like_select(); end; -- TEST: create table with misc attributes -- + {stmt_and_attr} -- + {create_table_stmt}: misc_attr_table: { id: integer notnull } -- +4 {misc_attrs} -- +4 {misc_attr} -- +1 {name foo} -- +1 {name goo} -- +1 {name bar} -- +1 {name baz} -- +1 {name num} -- +1 {uminus} -- +1 {int 9} -- + @ATTRIBUTE(foo) -- + @ATTRIBUTE(goo) -- + @ATTRIBUTE(num=-9) -- + @ATTRIBUTE(bar=baz) @attribute(foo) @attribute(goo) @attribute(num=-9) create table misc_attr_table ( @attribute(bar = baz) id integer not null ); -- TEST: complex index (with expression) -- + CREATE UNIQUE INDEX IF NOT EXISTS my_unique_index ON bar (id / 2 ASC, name DESC, rate); -- + {create_index_stmt}: ok -- - Error create unique index if not exists my_unique_index on bar(id/2 asc, name desc, rate); -- TEST: there is no index that covers id so this is an error, the index covers id/2 -- + {create_table_stmt}: err -- + Error % the set of columns referenced in the foreign key statement should match exactly a unique key in the parent table 'bar' -- +1 Error create table ref_bar( id integer not null references bar(id) -- index is on id/2 ); -- TEST: try to update a table that does not exist -- + {update_stmt}: err -- + Error % table in update statement does not exist 'This_Table_Does_Not_Exist' -- +1 Error update This_Table_Does_Not_Exist set x = 1; -- TEST: create a table with a valid FK on a column -- + {create_table_stmt}: fk_on_col: { fk_src: integer foreign_key } -- + {col_attrs_fk}: ok -- + {name foo} -- + {name id}: id: integer notnull -- - Error create table fk_on_col( fk_src integer references foo ( id ) on update cascade on delete set null ); -- TEST: create a table with a bogus FK : too many cols -- + {create_table_stmt}: err -- + Error % the FK reference must be exactly one column with the correct type 'fk_src' -- +1 Error create table bogus_fk_on_col_1( fk_src integer references bar ( id, name ) on update cascade on delete set null ); -- TEST: create a table with a bogus FK : wrong type -- + {create_table_stmt}: err -- + Error % the FK reference must be exactly one column with the correct type 'fk_src' -- +1 Error create table bogus_fk_on_col_1( fk_src integer references bar ( name ) ); -- TEST: create a table with a bogus FK : no such table -- + {create_table_stmt}: err -- + Error % foreign key refers to non-existent table 'no_such_table' -- +1 Error create table bogus_fk_on_col_1( fk_src integer references no_such_table ( name ) ); -- TEST: create a table with a bogus FK : no such column -- + {create_table_stmt}: err -- + Error % name not found 'no_such_column' -- +1 Error create table bogus_fk_on_col_1( fk_src integer references bar ( no_such_column ) ); -- TEST: create a table with a non-integer autoinc -- + {create_table_stmt}: err -- + Error % autoincrement column must be [LONG_]INTEGER PRIMARY KEY 'id' -- +1 Error create table bogus_autoinc_type(id bool primary key autoincrement); -- TEST: create a table an autoinc and without rowid -- + {create_table_stmt}: err -- + Error % table has an AUTOINCREMENT column; it cannot also be WITHOUT ROWID 'bogus_without_rowid' -- +1 Error create table bogus_without_rowid(id integer primary key autoincrement) without rowid; -- TEST: create a table that is going to be on the recreate plan -- + {create_table_stmt}: recreatable: { id: integer notnull primary_key, name: text } @recreate -- + @RECREATE; -- + {recreate_attr} -- - Error create table recreatable( id integer primary key, name text ) @recreate; -- TEST: create a table that is going to be on the recreate plan, try to version a column in it -- + {create_table_stmt}: err -- + @RECREATE; -- + {recreate_attr} -- + Error % columns in a table marked @recreate cannot have @create or @delete 'id' create table column_marked_delete_on_recreate_table( id integer primary key @create(2), name text ) @recreate; -- TEST: create a proc that uses the same CTE name twice, these should not conflict -- + {create_proc_stmt}: select: { a: integer notnull, b: integer notnull } dml_proc -- +2 {cte_tables}: ok -- +2 {cte_table}: should_not_conflict: { a: integer notnull, b: integer notnull } -- - Error create proc cte_test() begin with should_not_conflict(a,b) as (select 111,222) select * from should_not_conflict; with should_not_conflict(a,b) as (select 111,222) select * from should_not_conflict; end; -- TEST: use a CTE on a insert statement, all ok -- - Error -- + {with_insert_stmt}: ok -- + {cte_table}: x: { a: integer notnull, b: text notnull, c: longint notnull } -- + {insert_stmt}: ok -- + {select_stmt}: a: integer -- + {select_stmt}: b: text -- + {select_stmt}: c: longint -- + {insert_normal} -- + {name_columns_values} -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } create proc with_insert_form() begin with x(a,b,c) as (select 12, 'foo', 35L) insert into bar values ( ifnull((select a from x), 0), ifnull((select b from x), 'foo'), ifnull((select 1L as c where 0), 0) ); end; -- TEST: use a CTE on a insert statement using columns, all ok -- - Error -- + {with_insert_stmt}: ok -- + {cte_table}: x: { a: integer notnull, b: text notnull, c: longint notnull } -- + {insert_stmt}: ok -- + {insert_normal} -- + {name_columns_values} -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } create proc with_column_spec_form() begin with x(a,b,c) as (select 12, 'foo', 35L) insert into bar(id,name,rate) values ( ifnull((select a from x), 0), ifnull((select b from x), 'foo'), ifnull((select 1L as c where 0), 0) ); end; -- TEST: with-insert form, CTE is bogus -- + {with_insert_stmt}: err -- + {cte_tables}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create proc with_insert_bogus_cte() begin with x(a) as (select not 'x') insert into bar(id,name,rate) values (1, 'x', 2); end; -- TEST: with-insert form, insert clause is bogus -- + {with_insert_stmt}: err -- + {cte_tables}: ok -- + {insert_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create proc with_insert_bogus_insert() begin with x(a) as (select 1) insert into bar(id,name,rate) values (1, not 'x', 1); end; -- TEST: insert from select (this couldn't possibly run but it makes sense semantically) -- + {insert_stmt}: ok -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {select_stmt}: select: { id: integer notnull, name: text, rate: longint } insert into bar select * from bar where id > 5; -- TEST: insert from select, wrong number of columns -- + {insert_stmt}: err -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {select_stmt}: select: { id: integer notnull } -- + Error % count of columns differs from count of values -- +1 Error insert into bar select id from bar; -- TEST: insert from select, type mismatch in args -- + {insert_stmt}: err -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {select_stmt}: select: { name: text, id: integer notnull, rate: longint } -- + Error % incompatible types in expression 'id' -- +1 Error insert into bar select name, id, rate from bar; -- TEST: insert from select, bogus select -- + {insert_stmt}: err -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {select_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error insert into bar select not 'x'; -- TEST: declare a function for use in select statements, this is a sqlite udf -- + {declare_select_func_stmt}: real notnull select_func -- + {param_detail}: id: integer variable in -- - Error declare select func SqlUserFunc(id integer) real not null; -- TEST: now try to use the user function in a select statement -- + SELECT SqlUserFunc(1); -- + {select_stmt}: select: { _anon: real notnull } -- + {call}: real notnull -- + {name SqlUserFunc} -- - Error select SqlUserFunc(1); -- TEST: now try to use the user function with distinct keyword -- + SELECT SqlUserFunc(DISTINCT id) -- + {select_stmt}: select: { _anon: real notnull } -- + {call}: real notnull -- + {name SqlUserFunc} -- + {distinct} -- + {arg_list}: ok -- - Error select SqlUserFunc(distinct id) from foo; -- TEST: now try to use the user function with filter clause -- + SELECT SqlUserFunc(DISTINCT id) -- + {select_stmt}: select: { _anon: real notnull } -- + {call}: real notnull -- + {name SqlUserFunc} -- + {call_filter_clause} -- + {distinct} -- + {arg_list}: ok -- - Error select SqlUserFunc(distinct id) filter (where 1) from foo; -- TEST: now try to use the select user function loose -- + {assign}: err -- + {name my_real}: my_real: real variable -- + {call}: err -- + Error % User function may only appear in the context of a SQL statement 'SqlUserFunc' -- +1 Error set my_real := SqlUserFunc(1); -- TEST: now try to use the select user function loose with distinct -- + {assign}: err -- + {name my_real}: my_real: real variable -- + {call}: err -- + Error % User function may only appear in the context of a SQL statement 'SqlUserFunc' -- +1 Error set my_real := SqlUserFunc(distinct 1); -- TEST: now try to use the select user function loose with filter clause -- + {assign}: err -- + {name my_real}: my_real: real variable -- + {call}: err -- + Error % User function may only appear in the context of a SQL statement 'SqlUserFunc' -- +1 Error set my_real := SqlUserFunc(1) filter (where 0); -- TEST: declare select func with an error in declartion -- + Error % func name conflicts with proc name 'foo' declare select func foo(x integer, x integer) integer; -- TEST: create a cursor and fetch from arguments -- AST rewritten -- + CREATE PROC arg_fetcher (arg1 TEXT NOT NULL, arg2 INTEGER NOT NULL, arg3 REAL NOT NULL) -- + FETCH curs(A, B, C) FROM VALUES(arg1, arg2, arg3); -- + | {fetch_values_stmt}: ok -- + | {name_columns_values} -- + | {name curs}: curs: select: { A: text notnull, B: integer notnull, C: real notnull } variable shape_storage value_cursor -- + | {columns_values}: ok -- + | {column_spec} -- + | | {name_list} -- + | | {name A}: A: text notnull -- + | | {name_list} -- + | | {name B}: B: integer notnull -- + | | {name_list} -- + | | {name C}: C: real notnull -- + | {insert_list} -- + | {name arg1}: arg1: text notnull variable in -- + | {insert_list} -- + | {name arg2}: arg2: integer notnull variable in -- + | {insert_list} -- + | {name arg3}: arg3: real notnull variable in create proc arg_fetcher(arg1 text not null, arg2 integer not null, arg3 real not null) begin declare curs cursor like select 'x' A, 1 B, 3.5 C; fetch curs from arguments; end; -- TEST: use the arguments like "bar" even though there are other arguments -- AST rewritten, note "extra" does not appear -- + CREATE PROC fetch_bar (extra INTEGER, id_ INTEGER NOT NULL, name_ TEXT, rate_ LONG_INT) -- + FETCH curs(id, name, rate) FROM VALUES(id_, name_, rate_); -- + {create_proc_stmt}: ok -- - Error create proc fetch_bar(extra integer, like bar) begin declare curs cursor like bar; fetch curs from arguments(like bar); end; -- TEST: scoped like arguments -- + CREATE PROC qualified_like (x_id INTEGER NOT NULL, x_name TEXT, x_rate LONG_INT, y_id INTEGER NOT NULL, y_name TEXT, y_rate LONG_INT) create proc qualified_like(x like bar, y like bar) begin end; -- TEST: use the arguments like "bar" even though there are other arguments -- AST rewritten, note "extra" does not appear -- + CREATE PROC insert_bar (extra INTEGER, id_ INTEGER NOT NULL, name_ TEXT, rate_ LONG_INT) -- + INSERT INTO bar(id, name, rate) VALUES(id_, name_, rate_); -- + {create_proc_stmt}: ok -- - Error create proc insert_bar(extra integer, like bar) begin insert into bar from arguments(like bar); end; -- TEST: use the arguments like "bar" some have trailing _ and some do not -- AST rewritten, note some have _ and some do not -- + INSERT INTO bar(id, name, rate) VALUES(id, name_, rate); -- + {create_proc_stmt}: ok -- - Error create proc insert_bar_explicit(extra integer, id integer not null, name_ text, rate long integer) begin insert into bar from arguments(like bar); end; -- TEST: use the arguments like "bar" but some args are missing -- AST rewritten, note some have _ and some do not -- + {create_proc_stmt}: err -- + Error % expanding FROM ARGUMENTS, there is no argument matching 'name' -- +1 Error create proc insert_bar_missing(extra integer, id integer not null) begin insert into bar from arguments(like bar); end; -- TEST: bogus name in the like part of from arguments -- + {create_proc_stmt}: err -- + {insert_stmt}: err -- + Error % must be a cursor, proc, table, or view 'bogus_name_here' -- +1 Error create proc insert_bar_from_bogus(extra integer, like bar) begin insert into bar from arguments(like bogus_name_here); end; declare val_cursor cursor like my_cursor; -- TEST: try to fetch a cursor from arguments but not in a procedure -- + {fetch_values_stmt}: err -- + Error % FROM ARGUMENTS construct is only valid inside a procedure -- +1 Error fetch val_cursor from arguments; -- TEST: try to fetch a cursor but not enough arguments -- + {fetch_values_stmt}: err -- + Error % [shape] has too few fields 'ARGUMENTS' -- +1 Error create proc arg_fetcher_not_enough_args(arg1 text not null) begin declare curs cursor like select 'x' A, 1 B, 3.5 C; fetch curs from arguments; end; -- TEST: rewrite insert statement using arguments -- + {insert_stmt}: ok -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + INSERT INTO bar(id, name, rate) VALUES(id, name, rate); -- These appear as a parameter AND in the insert list -- +1 {name id}: id: integer notnull variable in -- +1 {name name}: name: text variable in -- +1 {name rate}: rate: longint variable in -- - Error create proc bar_auto_inserter(id integer not null, name text, rate LONG INT) begin insert into bar from arguments; end; -- TEST: rewrite insert statement but minimal columns -- + {insert_stmt}: ok -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + INSERT INTO bar(id) VALUES(id); -- These appear as a parameters -- +1 {name id}: id: integer notnull variable in -- +1 {name name}: name: text variable in -- +1 {name rate}: rate: longint variable in -- - Error create proc bar_auto_inserter_mininal(id integer not null, name text, rate LONG INT) begin insert into bar(id) from arguments; end; -- TEST: rewrite insert statement but no columns, bogus -- + {insert_stmt}: err -- + INSERT INTO bar() FROM ARGUMENTS -- + Error % FROM [shape] is redundant if column list is empty create proc bar_auto_inserter_no_columns(id integer not null, name text, rate LONG INT) begin insert into bar() from arguments @dummy_seed(1); end; -- TEST: rewrite insert statement but not enough columns -- + {insert_stmt}: err -- + INSERT INTO bar(id, name, rate) FROM ARGUMENTS(id); -- + Error % [shape] has too few fields 'ARGUMENTS' create proc bar_auto_inserter_missing_columns(id integer) begin insert into bar from arguments; end; -- TEST: rewrite proc arguments using the LIKE table form -- - Error -- + CREATE PROC rewritten_like_args (id_ INTEGER NOT NULL, name_ TEXT, rate_ LONG_INT) -- + INSERT INTO bar(id, name, rate) VALUES(id_, name_, rate_); -- + {create_proc_stmt}: ok dml_proc -- + {param}: id_: integer notnull variable in -- + {param}: name_: text variable in -- + {param}: rate_: longint variable in -- + {name bar}: bar: { id: integer notnull, name: text, rate: longint } -- + {insert_stmt}: ok -- these appear as a parameter and also in the insert list -- +1 {name id_}: id_: integer notnull variable in -- +1 {name name_}: name_: text variable in -- +1 {name rate_}: rate_: longint variable in -- the clean name appears in the insert list and as a column -- +2 {name id} -- +2 {name name} -- +2 {name rate} -- the ARGUMENTS dot name resolves to the correct arg name -- +1 {dot}: id_: integer notnull variable in -- +1 {dot}: name_: text variable in -- +1 {dot}: rate_: longint variable in create proc rewritten_like_args(like bar) begin insert into bar from arguments; end; -- TEST: try to rewrite args on a bogus table -- + {create_proc_stmt}: err -- + Error % must be a cursor, proc, table, or view 'garbonzo' -- +1 Error create proc rewrite_args_fails(like garbonzo) begin declare x integer; end; -- a fake table for some args create table args1( id integer primary key, name text, data blob ); -- a fake table for some more args create table args2( id integer references args1(id), name2 text, rate real ); -- TEST: this procedure uses two tables for its args, the trick here is that both tables -- have the id_ column; we should only emit it once -- note that id_ was skipped the second time -- + CREATE PROC two_arg_sources (id_ INTEGER NOT NULL, name_ TEXT, data_ BLOB, name2_ TEXT, rate_ REAL) -- {create_proc_stmt): ok -- - Error create proc two_arg_sources(like args1, like args2) begin end; -- TEST: test the case where 2nd and subsequent like forms do nothing -- + CREATE PROC two_arg_sources_fully_redundant (id_ INTEGER NOT NULL, name_ TEXT, data_ BLOB) -- {create_proc_stmt): ok -- - Error create proc two_arg_sources_fully_redundant(like args1, like args1, like args1) begin end; create view ViewShape as select TRUE a, 2.5 b, 'xyz' c; -- + CREATE PROC like_a_view (a_ BOOL NOT NULL, b_ REAL NOT NULL, c_ TEXT NOT NULL) -- + SELECT * -- + FROM ViewShape AS v -- + WHERE v.a = a_ AND v.b = b_ AND v.c > c_; -- + {create_proc_stmt}: select: { a: bool notnull, b: real notnull, c: text notnull } dml_proc create proc like_a_view(like ViewShape) begin select * from ViewShape v where v.a = a_ and v.b = b_ and v.c > c_; end; -- TEST: try to create a cursor that is like a select statement with not all names present -- + Error % all columns in the select must have a name -- +1 Error create proc bogus_cursor_shape() begin declare C cursor like select 1, 2; end; -- TEST: views must have a name for every column -- + all columns in the select must have a name -- + Error create view MyBogusView as select 1, 2; -- TEST: make this proc accept args to fake the result of another proc -- + {create_proc_stmt}: C: select: { A: integer notnull, B: integer notnull } variable shape_storage uses_out -- + {declare_cursor_like_name}: C: select: { A: integer notnull, B: integer notnull } variable shape_storage value_cursor -- + {out_stmt}: C: select: { A: integer notnull, B: integer notnull } variable shape_storage value_cursor -- - Error create proc like_other_proc(like out_cursor_proc) begin declare C cursor like out_cursor_proc; fetch C from arguments; out C; end; -- TEST: create a proc using another proc that doesn't have a result type -- + {create_proc_stmt}: err -- + Error % proc has no result 'proc1' -- +1 Error create procedure bogus_like_proc(like proc1) begin declare x int; end; -- TEST: create a non-temporary table using another table -- + create_table_stmt% nontemp_table_like_table: % id: integer -- - Error create temp table nontemp_table_like_table( like foo ); -- TEST: create a temporary table using another table -- + create_table_stmt% table_like_table: % id: integer -- - Error create temp table table_like_table( like foo ); -- TEST: create a temporary table using a view -- + {create_table_stmt}: table_like_view: { f1: integer notnull, f2: integer notnull, f3: integer notnull } -- - Error create temp table table_like_view( like MyView ); -- TEST: create a temporary table using a proc -- + {create_table_stmt}: table_like_proc: { id: integer notnull, name: text, rate: longint } -- - Error create temp table table_like_proc( like with_result_set ); -- TEST: try to create a table with a proc with no result -- + {create_table_stmt}: err -- + {col_key_list}: err -- + Error % proc has no result 'proc1' -- +1 Error create temp table table_like_proc_with_no_result( like proc1 ); -- TEST: try to create a table with non existent view/proc/view -- + {create_table_stmt}: err -- + {col_key_list}: err -- + Error % must be a cursor, proc, table, or view 'this_thing_doesnt_exist' -- +1 Error create temp table table_like_nonexistent_view( like this_thing_doesnt_exist ); -- TEST: create a temp table using two like arguments -- + {create_table_stmt}: table_multiple_like: { f1: integer notnull, f2: integer notnull, f3: integer notnull, id: integer notnull, name: text, rate: longint } -- - Error create temp table table_multiple_like( like MyView, like with_result_set ); -- TEST: create a temp table using mix of like and normal columns -- + {create_table_stmt}: table_like_mixed: { garbage: text, f1: integer notnull, f2: integer notnull, f3: integer notnull, happy: integer } -- - Error create temp table table_like_mixed( garbage text, like MyView, happy integer ); -- TEST: try to create a temp table but there is a duplicate column after expanding like -- + {create_table_stmt}: err -- + Error % duplicate column name 'f1' -- +1 Error create temp table table_with_dup_col( f1 text, like MyView ); -- TEST: try to create a temp view with versioning -- not allowed -- + {create_view_stmt}: err -- + Error % temp objects may not have versioning annotations 'bogus_temp_view_with_versioning' -- +1 Error create temp view bogus_temp_view_with_versioning as select 1 x @delete(1); -- TEST: try to create a temp trigger with versioning -- not allowed -- + {create_trigger_stmt}: err -- + Error % temp objects may not have versioning annotations 'bogus_temp_trigger' -- +1 Error create temp trigger if not exists bogus_temp_trigger before delete on bar begin delete from bar where rate > id; end @delete(2); -- TEST: try to create a temp table with versioning -- not allowed -- + {create_table_stmt}: err -- + Error % temp objects may not have versioning annotations 'bogus_temp_with_create_versioning' -- +1 Error create temp table bogus_temp_with_create_versioning( id integer ) @create(1); -- TEST: try to create a temp table with versioning -- not allowed -- + {create_table_stmt}: err -- + Error % temp objects may not have versioning annotations 'bogus_temp_with_delete_versioning' -- +1 Error create temp table bogus_temp_with_delete_versioning( id integer ) @delete(1); -- TEST: try to create a temp table with recreate versioning -- not allowed -- + {create_table_stmt}: err -- + Error % temp objects may not have versioning annotations 'bogus_temp_with_recreate_versioning' -- +1 Error create temp table bogus_temp_with_recreate_versioning( id integer ) @recreate; -- TEST: try to create a temp table with versioning in a column -- not allowed -- + {create_table_stmt}: err -- + Error % columns in a temp table may not have versioning attributes 'id' -- +1 Error create temp table bogus_temp_with_versioning_in_column( id integer @create(2) ); -- TEST: try to use match in a select statement -- - Error -- + {select_expr}: bool notnull -- + {match}: bool notnull -- + {strlit 'x'}: text notnull -- + {strlit 'y'}: text notnull select 'x' match 'y'; -- TEST: try to use match not in a select statement -- + {match}: err -- + {assign}: err -- + Error % operator may only appear in the context of a SQL statement 'MATCH' -- +1 Error set X := 'x' match 'y'; -- TEST: try to use glob in a select statement -- - Error -- + {select_expr}: bool notnull -- + {glob}: bool notnull -- + {strlit 'x'}: text notnull -- + {strlit 'y'}: text notnull select 'x' glob 'y'; -- TEST: try to use glob not in a select statement -- + {glob}: err -- + {assign}: err -- + Error % operator may only appear in the context of a SQL statement 'GLOB' -- +1 Error set X := 'x' GLOB 'y'; -- TEST: try to use match not in a select statement -- + {match}: err -- + {assign}: err -- + Error % operator may only appear in the context of a SQL statement 'MATCH' -- +1 Error set X := 'x' MATCH 'y'; -- TEST: try to use regexp not in a select statement -- + {regexp}: err -- + {assign}: err -- + Error % operator may only appear in the context of a SQL statement 'REGEXP' -- +1 Error set X := 'x' REGEXP 'y'; -- TEST: REGEXP inside of SQL is ok -- + {regexp}: bool notnull -- - Error set X := (select 'x' REGEXP 'y'); -- TEST: shift and bitwise operators -- + {assign}: X: integer variable -- + {name X}: X: integer variable -- + {rshift}: integer notnull -- + {bin_and}: integer notnull -- + {lshift}: integer notnull -- + {bin_or}: integer notnull -- + {lshift}: integer notnull -- - Error -- + SET X := 1 << 2 | 1 << 4 & 1 >> 8; set X := 1 << 2 | 1 << 4 & 1 >> 8; -- TEST: try a integer operator with a real -- + {assign}: err -- + {bin_and}: err -- + Error % operands must be an integer type, not real '&' -- +1 Error set X := 3.0 & 2; -- TEST: try a integer unary operator with a real -- + {assign}: err -- + {tilde}: err -- + Error % operands must be an integer type, not real '~' -- +1 Error set X := ~3.0; -- TEST: try to access a column by its select alias in the later portions of the select -- + {select_stmt}: select: { a: integer notnull, b: integer notnull } -- + {name b}: b: integer notnull -- - Error select 1 a, 2 b from (select 1) as T where b = 2; -- TEST: use column aliases in ORDER BY statement -- + {create_proc_stmt}: select: { bar_id: integer notnull } dml_proc -- + {name bar_id}: bar_id: integer notnull -- - Error create proc simple_alias_order_by() begin select id as bar_id from bar order by bar_id; end; -- TEST: use column aliases for fabricated columns in ORDER BY statement -- + {create_proc_stmt}: union_all: { sort_order_value: integer notnull, id: integer notnull } dml_proc -- + {name sort_order_value}: sort_order_value: integer notnull -- - Error create proc complex_alias_order_by() begin select 1 as sort_order_value, id from bar union all select 2 as sort_order_value, id from bar order by sort_order_value, id; end; -- TEST: fake stories table for test case stolen from the real schema create table stories(media_id long); -- TEST: ensure that the column alias is used as the second choice compared to a column name -- This won't compile correctly if the binding is wrong, the int will be compared to a string -- + {select_stmt}: select: { media_id: text notnull } -- + {name media_id}: media_id: longint -- - {name media_id}: media_id: text notnull -- - Error SELECT 'xyzzy' AS media_id FROM stories WHERE media_id = 123; -- TEST: basic delete trigger -- + CREATE TEMP TRIGGER IF NOT EXISTS trigger1 -- + BEFORE DELETE ON bar -- + FOR EACH ROW -- + WHEN old.id = 3 -- + {create_trigger_stmt}: ok -- + {eq}: bool notnull -- + {dot}: id: integer notnull -- +2 {delete_stmt}: ok -- - Error create temp trigger if not exists trigger1 before delete on bar for each row when old.id = 3 begin delete from bar where rate > id; delete from bar where rate = old.id; end; -- TEST: basic delete trigger, try to use "new" -- + CREATE TRIGGER trigger1a -- + BEFORE DELETE ON bar -- + WHEN new.id = 3 -- + {create_trigger_stmt}: err -- + Error % name not found 'id' -- +1 Error create trigger trigger1a before delete on bar when new.id = 3 begin delete from bar where rate > id; end; -- TEST: basic insert trigger -- + CREATE TRIGGER trigger2 -- + AFTER INSERT ON bar -- + BEGIN -- + DELETE FROM bar WHERE rate > new.id; -- + END; -- + {create_trigger_stmt}: ok -- +1 {delete_stmt}: ok -- - Error create trigger trigger2 after insert on bar begin delete from bar where rate > new.id; end; -- TEST: basic insert trigger, try to use "old" -- + CREATE TRIGGER trigger2a -- + AFTER INSERT ON bar -- + WHEN old.id = 3 -- + {create_trigger_stmt}: err -- + Error % name not found 'id' -- +1 Error create trigger trigger2a after insert on bar when old.id = 3 begin delete from bar where rate > id; end; -- TEST: use update instead of on a view -- + {create_trigger_stmt}: ok -- +4 {dot}: b: real notnull -- + {name ViewShape} -- + {update_stmt}: bar: { id: integer notnull, name: text, rate: longint } -- + {insert_stmt}: ok -- - Error create trigger trigger3 instead of update on ViewShape when old.b > 1 and new.b < 3 begin update bar set id = 7 where rate > old.b and rate < new.b; insert into bar values (7, 'goo', 17L); end; -- TEST: exact duplicate trigger is ok -- + {create_trigger_stmt}: ok -- +4 {dot}: b: real notnull -- + {name ViewShape} -- + {update_stmt}: bar: { id: integer notnull, name: text, rate: longint } -- + {insert_stmt}: ok -- - Error create trigger trigger3 instead of update on ViewShape when old.b > 1 and new.b < 3 begin update bar set id = 7 where rate > old.b and rate < new.b; insert into bar values (7, 'goo', 17L); end; -- TEST: duplicate trigger -- + {create_trigger_stmt}: err -- + {name ViewShape} -- + Error % trigger already exists 'trigger3' create trigger trigger3 instead of update on ViewShape begin select 1; end; -- TEST: specify update columns -- + {create_trigger_stmt}: ok -- + {name a}: a: bool notnull -- + {name b}: b: real notnull -- + {name c}: c: text notnull -- - Error create trigger trigger4 instead of update of a, b, c on ViewShape begin select 1; end; -- TEST: specify update columns -- + {create_trigger_stmt}: err -- + Error % name list has duplicate name 'a' -- + Error create trigger trigger4a instead of update of a, a, c on ViewShape begin select 1; end; -- TEST: specify a view where one is not allowed -- + {create_trigger_stmt}: err -- + Error % a trigger on a view must be the INSTEAD OF form 'ViewShape' -- + Error create trigger trigger4b before update on ViewShape begin select 1; end; -- TEST: specify a bogus table name -- + {create_trigger_stmt}: err -- + Error % table/view not found 'no_such_table_dude' -- + Error create trigger trigger4c before update on no_such_table_dude begin select 1; end; -- TEST: specify a bogus executed statement -- + {create_trigger_stmt}: err -- + {stmt_list}: err -- + {select_stmt}: err -- + Error % name not found 'id' -- + Error create trigger trigger4d before insert on bar begin select old.id; end; -- TEST: this proc is not a result proc even though it looks like it has a loose select... -- the select is inside a trigger, it is NOT a return for this proc -- - {create_proc_stmt}: select: { id: integer notnull } dml_proc -- + {create_proc_stmt}: ok dml_proc -- - Error create proc make_trigger() begin create trigger selecting_trigger before delete on bar for each row when old.id > 7 begin select old.id; end; end; -- TEST: try to drop a trigger (bogus) -- + {drop_trigger_stmt}: err -- + Error % trigger in drop statement was not declared 'this_trigger_does_not_exist' -- +1 Error drop trigger this_trigger_does_not_exist; -- TEST: try to drop a trigger (bogus) -- + {drop_trigger_stmt}: ok -- + {int 1} -- - Error drop trigger if exists trigger1; -- TEST: try to delete a table before it was created -- + {create_table_stmt}: err -- + Error % delete version can't be <= create version 'retro_deleted_table' -- +1 Error create table retro_deleted_table( id integer) @create(3) @delete(1); -- TEST: basic delete trigger with RAISE expression -- + {create_trigger_stmt}: ok -- + {raise}: null -- - Error create temp trigger if not exists trigger5 before delete on bar begin select RAISE(rollback, "omg roll it back!"); end; -- TEST: try to use raise in a non trigger context -- + {select_stmt}: err -- + {raise}: err -- + Error % RAISE may only be used in a trigger statement -- +1 Error select RAISE(ignore); -- TEST: try to use raise with a bogus string -- + {create_trigger_stmt}: err -- + {raise}: err -- + Error % RAISE 2nd argument must be a string -- +1 Error create temp trigger if not exists trigger6 before delete on bar begin select RAISE(rollback, 0); end; -- TEST: try to use raise with a bogus expression -- + {create_trigger_stmt}: err -- + {raise}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create temp trigger if not exists trigger7 before delete on bar begin select RAISE(rollback, not 'x'); end; -- TEST: try to create a trigger with a migrate proc -- + {create_trigger_stmt}: err -- + Error % migration proc not allowed on object 'trigger8' -- +1 Error create trigger if not exists trigger8 before delete on bar begin select 1 x; end @delete(1, MigrateProcFoo); -- TEST: try to select union with different number of columns -- + {select_core_list}: err -- + {select_core_compound} -- +2 {int 2} -- + Error % if multiple selects, all must have the same column count -- +1 Error select 1 as A, 2 as B, 3 as C union all select 3 as A, 4 as B; -- TEST: try to select union with different incompatible types -- + {select_core_list}: err -- + {select_core_compound} -- +2 {int 2} -- + Error % incompatible types in expression 'A' -- +1 Error select 1 as A, 2 as B union all select 'x' as A, 4 as B; -- TEST: try to select union with different compatible types (null checks) -- + {select_core_list}: union_all: { A: integer, B: integer } -- + {select_core_compound} -- + {int 2} -- + {select_core}: select: { A: integer notnull, B: integer } -- + {select_core}: select: { A: null, B: integer notnull } -- - Error select 1 as A, nullable(2) as B union all select NULL as A, 4 as B; -- TEST: try to select union multiple times -- + {select_stmt}: union_all: { A: integer notnull, B: integer notnull } -- + {select_core_compound} -- +7 {int 2} -- +3 {select_core_list}: union_all: { A: integer notnull, B: integer notnull } -- +4 {select_core}: select: { A: integer notnull, B: integer notnull } -- - Error select 1 as A, 2 as B union all select 1 as A, 2 as B union all select 1 as A, 2 as B union all select 1 as A, 2 as B; -- TEST: try to return untyped NULL -- + {create_proc_stmt}: err -- + Error % NULL expression has no type to imply the type of the select result 'n' -- +1 Error create proc returns_bogus_null() begin select null AS n; end; -- TEST: try to declare cursor for untyped NULL -- + {create_proc_stmt}: err -- + Error % NULL expression has no type to imply the type of the select result 'n' -- +1 Error create proc fetch_null_column() begin declare C cursor for select null AS n; fetch C; end; -- TEST: declare a column as -- + {create_table_stmt}: with_sensitive: { id: integer, name: text sensitive, info: integer sensitive } -- - Error create table with_sensitive( id integer, name text @sensitive, info integer @sensitive ); -- TEST: declare a table to test with with_sensitive table with non-sensitive column as -- + {create_table_stmt}: without_sensitive: { name: text } -- - Error create table without_sensitive( name text ); -- TEST: select out some -- + {create_proc_stmt}: select: { -- + safe: integer notnull, -- + sensitive_1: integer sensitive, -- + sensitive_2: text sensitive, -- + not_sensitive_1: text notnull, -- + sensitive_3: integer sensitive, -- + sensitive_4: bool sensitive -- + } dml_proc create proc get_sensitive() begin select 1 as safe, info+1 sensitive_1, name as sensitive_2, 'x' as not_sensitive_1, -info as sensitive_3, info between 1 and 3 as sensitive_4 from with_sensitive; end; -- TEST: making a sensitive variable -- + {declare_vars_type}: integer sensitive -- - Error declare _sens integer @sensitive; -- TEST: using sensitive in the LIMIT clause -- + {select_stmt}: select: { safe: integer notnull sensitive } -- - Error select 1 as safe limit _sens; -- TEST: using sensitive in the LIMIT clause (control case) -- + {select_stmt}: select: { safe: integer notnull } -- - Error select 1 as safe limit 1; -- TEST: using sensitive in the OFFSET clause (control case) -- + {select_stmt}: select: { safe: integer notnull sensitive } -- - Error select 1 as safe limit 1 offset _sens; -- TEST: using sensitive in the OFFSET clause (control case) -- + {select_stmt}: select: { safe: integer notnull } -- - Error select 1 as safe limit 1 offset 1; -- TEST: local arithmetic -- + {add}: integer sensitive -- + {name _sens}: _sens: integer variable sensitive -- - Error set _sens := _sens + 1; -- TEST: in an IN expression (needle) -- + {in_pred}: bool sensitive -- + {name _sens}: _sens: integer variable sensitive -- + {int 1}: integer notnull -- + {int 2}: integer notnull -- - Error set _sens := _sens in (1, 2); -- TEST: in an IN expression (haystack) -- + {in_pred}: bool notnull sensitive -- + {int 1}: integer notnull -- + {expr_list}: _sens: integer variable sensitive -- + {name _sens}: _sens: integer variable sensitive -- - Error set _sens := 1 in (1, _sens); -- TEST: in an IN expression (select form) -- + {in_pred}: bool notnull sensitive -- + {select_stmt}: _anon: bool notnull sensitive -- - Error set _sens := (select 1 in (select info from with_sensitive)); -- TEST: in a CASE statement (control case) -- + {case_expr}: integer notnull -- + {int 0}: integer notnull -- + {int 1}: integer notnull -- + {int 2}: integer notnull -- + {int 3}: integer notnull -- - Error set _sens := nullable(case 0 when 1 then 2 else 3 end); -- TEST: in a CASE statement (sensitive in the main expression) -- + {case_expr}: integer notnull sensitive -- + {name _sens}: _sens: integer variable sensitive -- + {case_list}: integer notnull -- + {int 1}: integer notnull -- + {int 2}: integer notnull -- + {int 3}: integer notnull -- - Error set _sens := nullable(case _sens when 1 then 2 else 3 end); -- TEST: in a CASE statement (sensitive in the when part) -- + {case_expr}: integer notnull sensitive -- + {name _sens}: _sens: integer variable sensitive -- + {case_list}: integer notnull -- + {int 0}: integer notnull -- + {int 2}: integer notnull -- + {int 3}: integer notnull -- - Error set _sens := nullable(case 0 when _sens then 2 else 3 end); -- TEST: in a CASE statement (sensitive in the then part) -- + {case_expr}: integer sensitive -- + {name _sens}: _sens: integer variable sensitive -- + {case_list}: integer variable sensitive -- + {int 0}: integer notnull -- + {int 1}: integer notnull -- + {int 3}: integer notnull -- - Error set _sens := nullable(case 0 when 1 then _sens else 3 end); -- TEST: in a CASE statement (sensitive in the else part) -- + {case_expr}: integer sensitive -- + {name _sens}: _sens: integer variable sensitive -- + {case_list}: integer notnull -- + {int 0}: integer notnull -- + {int 1}: integer notnull -- + {int 2}: integer notnull -- - Error set _sens := nullable(case 0 when 1 then 2 else _sens end); -- TEST: make sure that cast preserves -- + {select_stmt}: _anon: integer sensitive -- - Error set _sens := (select cast(_sens as INT)); -- TEST: make sure AVG preserves -- + {name AVG}: real sensitive -- - Error select AVG(T1.info) from with_sensitive T1; -- TEST: make sure MIN preserves -- + {name MIN}: integer sensitive -- - Error select MIN(T1.info) from with_sensitive T1; -- TEST: make sure MAX preserves -- + {name MAX}: integer sensitive -- - Error select MAX(T1.info) from with_sensitive T1; -- TEST: make sure SUM preserves -- + {name SUM}: integer sensitive -- - Error select SUM(T1.info) from with_sensitive T1; -- TEST: make sure COUNT preserves -- + {name COUNT}: integer notnull sensitive -- - Error select COUNT(T1.info) from with_sensitive T1; -- TEST: control AVG -- - {name AVG}: id: % sensitive -- + {name AVG}: real -- - Error select AVG(T1.id) from with_sensitive T1; -- TEST: control MAX -- - {name MAX}: id: % sensitive -- + {name MAX}: integer -- - Error select MAX(T1.id) from with_sensitive T1; -- TEST: control SUM -- - {name SUM}: id: % sensitive -- + {name SUM}: integer -- - Error select SUM(T1.id) as s from with_sensitive T1; -- TEST: control COUNT -- - {name COUNT}: id: % sensitive -- + {name COUNT}: integer notnull -- - Error select COUNT(T1.id) c from with_sensitive T1; -- TEST: coalesce -- + {call}: integer notnull sensitive -- - Error set _sens := coalesce(_sens, 0); -- TEST: coalesce control case ok -- - {call}: % sensitive -- - Error set _sens := coalesce(nullable(1), 0); -- TEST: coalesce control not null -- - {call}: % sensitive -- + Error % encountered arg known to be not null before the end of the list, rendering the rest useless. '7' -- +1 Error set _sens := coalesce(7, 0); -- TEST: sensitive with IS right -- + {is}: bool notnull sensitive -- - Error set _sens := 0 is _sens; -- TEST: sensitive with IS left -- + {is}: bool notnull sensitive -- - Error set _sens := _sens is 0; -- TEST: sensitive with IS control -- - {is}: % sensitive -- + {is}: bool notnull -- - Error set _sens := 0 is 0; -- TEST: sensitive with IS NOT right -- + {is_not}: bool notnull sensitive -- - Error set _sens := 0 is not _sens; -- TEST: sensitive with IS NOT left -- + {is_not}: bool notnull sensitive -- - Error set _sens := _sens is not 0; -- TEST: sensitive with IS NOT control -- - {is_not}: % sensitive -- + {is_not}: bool notnull -- - Error set _sens := 0 is not 0; -- TEST: sensitive with EXISTS(select *) -- + {exists_expr}: bool notnull sensitive -- - Error set _sens := (select exists(select * from with_sensitive)); -- TEST: sensitive with EXISTS(select sensitive) -- + {exists_expr}: bool notnull sensitive -- - Error set _sens := (select exists(select info from with_sensitive)); -- TEST: sensitive with EXISTS(select not sensitive) -- - {exists_expr}: bool notnull sensitive -- + {exists_expr}: bool notnull -- - Error set _sens := (select exists(select id from with_sensitive)); -- TEST: sensitive implicit due to where clause -- + {select_stmt}: id: integer sensitive -- + {opt_where}: bool sensitive -- - Error set _sens := (select id from with_sensitive where info = 1); -- TEST: select implicit control case (where not sensitive) -- - {select_stmt}: id: integer sensitive -- + {select_stmt}: id: integer -- - {opt_where}: % sensitive -- + {opt_where}: bool -- - Error set _sens := (select id from with_sensitive where id = 1); -- TEST: sensitive implicit due to having clause -- + {select_stmt}: id: integer sensitive -- + {opt_having}: bool sensitive -- - Error set _sens := (select id from with_sensitive group by info having info = 1); -- TEST: assign sensitive column value to a non-sensitive colunm -- + {insert_stmt}: err -- + Error % cannot assign/copy sensitive expression to non-sensitive target 'name' insert into without_sensitive select name from with_sensitive; create table a ( key_ int not null primary key, sort_key int not null ); create table b ( key_ int not null primary key, a_key_ int not null, sort_key int not null ); -- TEST: compound select ordered by name -- + {select_stmt}: UNION: { key_: integer notnull, sort_key: integer notnull } -- - Error select key_, sort_key from a union select key_, sort_key from b order by sort_key, key_; -- TEST: compound select ordered by index -- + {select_stmt}: UNION: { key_: integer notnull, sort_key: integer notnull } -- - Error select key_, sort_key from a union select key_, sort_key from b order by 2, key_; -- TEST: compound select ordered by an arbitrary expression -- + {select_stmt}: err -- + {select_orderby}: err -- +1 Error select key_, sort_key from a union select key_, sort_key from b order by 1 + 1, key_; -- TEST: compound select name lookup from select list (other places ambiguous, still ok) -- + {select_stmt}: union_all: { key_: integer notnull, sort_key: integer notnull } -- + {select_core_list}: union_all: { key_: integer notnull, sort_key: integer notnull } -- + {select_core_compound} -- + ORDER BY sort_key, key_; -- + {opt_orderby}: ok -- - Error select a.key_, a.sort_key from a union all select b.key_, b.sort_key from a inner join b ON b.a_key_ = a.key_ order by sort_key, key_; -- TEST: compound select name lookup using something other than the select list -- + {opt_orderby}: err -- + ORDER BY a_key_ -- + Error % name not found 'a_key_' -- + {int 2}: integer notnull -- + {int 3}: integer notnull -- +1 Error select a.key_, a.sort_key from a union all select b.key_, b.sort_key from a inner join b on b.a_key_ = a.key_ order by a_key_ limit 2 offset 3; -- TEST: compound select name lookup using something other than the select list (explicit) -- + {opt_orderby}: err -- + ORDER BY b.a_key_; -- + Error % name not found 'a_key_' -- +1 Error select a.key_, a.sort_key from a union ALL select b.key_, b.sort_key from a inner join b ON b.a_key_ = a.key_ order by b.a_key_; -- TEST: join columns become because ON condition is SENSITIVE -- + {select_stmt}: select: { id: integer notnull sensitive } -- - Error select T1.id from bar T1 inner join with_sensitive T2 on T1.id = T2.id and T2.info = 1; -- TEST: join columns flag ON condition (control case) -- + {select_stmt}: select: { id: integer notnull } -- - {select_stmt}: select: { id: % sensitive } -- - Error select T1.id from bar T1 inner join with_sensitive T2 on T1.id = T2.id; -- TEST: join columns become because USING condition has SENSITIVE columns -- + {select_stmt}: select: { id: integer sensitive } -- + {name_list}: info: integer sensitive -- - Error select T1.id from with_sensitive T1 inner join with_sensitive T2 using(info); -- TEST: join columns do not become because USING condition has no SENSITIVE columns -- + {select_stmt}: select: { id: integer } -- - {select_stmt}: select: { id: % sensitive } -- + {name_list}: id: integer -- - Error select T1.id from with_sensitive T1 inner join with_sensitive T2 using(id); -- TEST: try to assign sensitive data to a non-sensitive variable -- + {assign}: err -- + {name _sens}: _sens: integer variable sensitive -- + Error % cannot assign/copy sensitive expression to non-sensitive target 'X' -- +1 Error set X := _sens; -- TEST: try to call a normal proc with a sensitive parameter -- + {call_stmt}: err -- + Error % cannot assign/copy sensitive expression to non-sensitive target 'id' -- +1 Error call decl1(_sens); declare proc sens_proc(out foo integer @sensitive); declare proc non_sens_proc(out foo integer); declare proc non_sens_proc_nonnull(out foo integer not null); -- TEST: try to call a proc with a sensitive out parameter -- + Error % cannot assign/copy sensitive expression to non-sensitive target 'X' -- +1 Error call sens_proc(X); -- TEST: control case: ok to call a proc with a non-sensitive out parameter -- + {name _sens}: _sens: integer variable sensitive -- - Error call non_sens_proc(_sens); -- TEST: make sure we can't call a proc that takes a nullable int out with a not-null integer -- Error % cannot assign/copy possibly null expression to not null target 'int_nn' -- +1 Error call non_sens_proc(int_nn); -- TEST: make sure we can't call a proc that takes a non-nullable int out with a nullable integer -- Error % proc out parameter: arg must be an exact type match (even nullability) (expected integer notnull; found integer) -- +1 Error call non_sens_proc_nonnull(X); -- TEST: try to insert sensitive data to a non-sensitive column -- + Error % cannot assign/copy sensitive expression to non-sensitive target 'id' -- +1 Error insert into foo(id) values(coalesce(_sens,0)); -- TEST: try to update to sensitive -- + Error % cannot assign/copy sensitive expression to non-sensitive target 'id' -- +1 Error update bar set id = coalesce(_sens,0) where name = 'x'; -- Do various validations on this func in the following tests declare function sens_func(id integer @sensitive, t text) text @sensitive; declare sens_text text @sensitive; declare non_sens_text text; -- TEST: ok to assign to sensitive text, ok to pass non-sensitive integer as a sensitive integer -- + {assign}: sens_text: text variable sensitive -- + {name sens_text}: sens_text: text variable sensitive -- + {call}: text sensitive -- - Error set sens_text := sens_func(1, 'x'); -- TEST: not ok to assign to non-sensitive text -- + Error % cannot assign/copy sensitive expression to non-sensitive target 'non_sens_text' -- + {assign}: err -- + {name non_sens_text}: err -- + {call}: text sensitive -- +1 Error set non_sens_text := sens_func(1, 'x'); -- TEST: not ok to pass sensitive text as non-sensitive arg -- + Error % cannot assign/copy sensitive expression to non-sensitive target 't' -- + {call}: err -- +1 Error set sens_text := sens_func(1, sens_text); -- TEST: make sure that the expression in the update is evaluated in the select context -- this allows you to use things like CAST or date operations -- + {update_stmt}: foo: { id: integer notnull primary_key autoinc } -- + {cast_expr}: integer notnull -- - Error update foo set id = cast('1' as integer); -- TEST: basic delete stmt with CTE form -- + {with_delete_stmt}: ok -- + {select_from_etc}: TABLE { x: x } -- - Error create proc with_delete_form() begin with x(id) as (select 1 union all select 2) delete from bar where id in (select * from x); end; -- TEST: basic delete stmt with CTE form (CTE bogus) -- + {create_proc_stmt}: err -- + {with_delete_stmt}: err -- + {cte_tables}: err -- + {select_expr_list_con}: select: { _anon: integer notnull } -- + {select_expr_list_con}: select: { _anon: text notnull } -- + Error % incompatible types in expression '_anon' -- +1 Error create proc with_delete_form_bogus_cte() begin with x(id) as (select 1 union all select 'x') delete from bar where id in (select * from x); end; -- TEST: basic delete stmt with CTE form (delete bogus) -- + {create_proc_stmt}: err -- + {with_delete_stmt}: err -- + Error % table in delete statement does not exist 'not_valid_table' -- +1 Error create proc with_delete_form_bogus_delete() begin with x(id) as (select 1 union all select 2) delete from not_valid_table where id in (select * from x); end; -- TEST: basic update stmt with CTE form -- + {with_update_stmt}: bar: { id: integer notnull, name: text, rate: longint } -- + {select_from_etc}: TABLE { x: x } -- - Error create proc with_update_form() begin with x(id) as (select 1 union all select 2) update bar set name = 'xyzzy' where id in (select * from x); end; -- TEST: basic update stmt with CTE form (CTE bogus) -- + {create_proc_stmt}: err -- + {with_update_stmt}: err -- + {cte_tables}: err -- + {select_expr_list_con}: select: { _anon: integer notnull } -- + {select_expr_list_con}: select: { _anon: text notnull } -- + Error % incompatible types in expression '_anon' -- +1 Error create proc with_update_form_bogus_cte() begin with x(id) as (select 1 union all select 'x') update bar set name = 'xyzzy' where id in (select * from x); end; -- TEST: basic update stmt with CTE form (update bogus) -- + {create_proc_stmt}: err -- + {with_update_stmt}: err -- + Error % table in update statement does not exist 'not_valid_table' -- +1 Error create proc with_update_form_bogus_delete() begin with x(id) as (select 1 union all select 2) update not_valid_table set name = 'xyzzy' where id in (select * from x); end; -- TEST: match a proc that was previously created -- + DECLARE PROC out_cursor_proc () OUT (A INTEGER NOT NULL, B INTEGER NOT NULL) USING TRANSACTION; -- + {declare_proc_stmt}: out_cursor_proc: { A: integer notnull, B: integer notnull } dml_proc uses_out -- - Error declare proc out_cursor_proc() OUT (A int not null, B int not null) using transaction; -- TEST: declare the proc first then create it -- + CREATE PROC decl1 (id INTEGER) -- + {create_proc_stmt}: ok -- - Error create proc decl1(id integer) begin declare i integer; end; -- TEST: try to create it again, even though it matches, no dice -- + {create_proc_stmt}: err -- + Error % duplicate stored proc name 'decl1' -- +1 Error create proc decl1(id integer) begin declare i integer; end; -- TEST: try to create a proc that doesn't match the signature -- the only difference here is that the declaration specified -- that this was to be a proc that uses the database... we will not do so -- + CREATE PROC decl2 (id INTEGER) -- + Error % procedure declarations/definitions do not match 'decl2' -- + {create_proc_stmt}: err create proc decl2(id integer) begin declare i integer; end; -- TEST: autotest attribute with all attributes -- + {stmt_and_attr} -- + {misc_attrs}: ok -- + {dot} -- + {name cql} -- + {name autotest} -- + {misc_attr_value_list} -- + {name dummy_table}: ok -- + {name dummy_insert}: ok -- + {name dummy_select}: ok -- + {name dummy_result_set}: ok -- + {name dummy_test}: ok -- + {create_proc_stmt}: select: { id: integer notnull, name: text, rate: longint } dml_proc @attribute(cql:autotest=(dummy_test, dummy_table, dummy_insert, dummy_select, dummy_result_set)) create proc autotest_all_attribute() begin select * from bar; end; -- TEST: autotest attribute with dummy_test info on multiple columns -- + {stmt_and_attr} -- + {misc_attrs}: ok -- + {dot} -- + {name cql} -- + {name autotest} -- + {misc_attr_value_list} -- + {name dummy_table}: ok -- + {name dummy_test}: ok -- + {name bar}: ok -- + {name id}: ok -- + {int 1}: ok -- + {uminus} -- + | {int 2}: ok -- + {name name}: ok -- + {strlit 'Nelly'}: ok -- + {strlit 'Babeth'}: ok -- + {name foo}: ok -- + {name id}: ok -- + {int 777}: ok -- + {create_proc_stmt}: select: { id: integer notnull, name: text, rate: longint } dml_proc @attribute(cql:autotest=(dummy_table, (dummy_test, (bar, (id, name), (1, 'Nelly'), (-2, 'Babeth')), (foo, (id), (777))))) create proc autotest_dummy_test_with_others_attributes() begin select * from bar; end; -- TEST: autotest attribute with dymmy_test info on a single table and column -- + {stmt_and_attr} -- + {misc_attrs}: ok -- + {dot} -- + {name cql} -- + {name autotest} -- + {misc_attr_value_list} -- + {name dummy_test}: ok -- + {name bar}: ok -- + {name id}: ok -- + {int 1}: ok -- + {int 2}: ok -- + {create_proc_stmt}: select: { id: integer notnull, name: text, rate: longint } dml_proc @attribute(cql:autotest=((dummy_test, (bar, (id), (1), (2))))) create proc autotest_dummy_test_without_other_attributes() begin select * from bar; end; -- TEST: dummy_test info with invalid column value type (value type str is incorrect) -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {name one}: err -- + autotest attribute 'dummy_test' has invalid value type in 'id' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (bar, (id), (one))))) create proc autotest_dummy_test_invalid_col_str_value() begin select * from bar; end; -- TEST: dummy_test info with invalid column value type (value type dbl is incorrect) -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {dbl 0.1}: err -- + autotest attribute 'dummy_test' has invalid value type in 'id' -- +1 Error @attribute(cql:autotest=((dummy_test, (bar, (id), (0.1))))) create proc autotest_dummy_test_invalid_col_dbl_value() begin select * from bar; end; -- TEST: dummy_test info with int value for a long column -- + {create_proc_stmt}: select: { id: integer notnull, name: text, rate: longint } dml_proc -- + {misc_attrs}: ok -- - Error @attribute(cql:autotest=((dummy_test, (bar, (rate), (1))))) create proc autotest_dummy_test_long_col_with_int_value() begin select * from bar; end; -- TEST: dummy_test info with int value for a negative long column -- + {create_proc_stmt}: select: { id: integer notnull, name: text, rate: longint } dml_proc -- + {misc_attrs}: ok -- + {uminus} -- + | {int 1} -- - Error @attribute(cql:autotest=((dummy_test, (bar, (rate), (-1))))) create proc autotest_dummy_test_neg_long_col_with_int_value() begin select * from bar; end; -- TEST: dummy_test info with invalid column value type (value type strlit is incorrect) -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {strlit 'bogus'}: err -- + autotest attribute 'dummy_test' has invalid value type in 'id' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (bar, (id) , ('bogus'))))) create proc autotest_dummy_test_invalid_col_strlit_value() begin select * from bar; end; -- TEST: dummy_test info with invalid column value type (value type lng is incorrect) -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {longint 1}: err -- + autotest attribute 'dummy_test' has invalid value type in 'id' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (bar, (id), (1L))))) create proc autotest_dummy_test_invalid_col_lng_value() begin select * from bar; end; -- TEST: dummy_test info with column name not nested -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {name bar}: err -- + autotest attribute has incorrect format (column name should be nested) in 'dummy_test' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (bar, id, (1), (2))))) create proc autotest_dummy_test_invalid_col_format() begin select * from bar; end; -- TEST: dummy_test info with two column value for one column name -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {name bar}: err -- + autotest attribute has incorrect format (too many column values) in 'dummy_test' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (bar, (id), (1, 2))))) create proc autotest_dummy_test_too_many_value_format() begin select * from bar; end; -- TEST: dummy_test info with one column value for 2 column name -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {name bar}: err -- + autotest attribute has incorrect format (mismatch number of column and values) in 'dummy_test' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (bar, (id, name), (1))))) create proc autotest_dummy_test_missing_value_format() begin select * from bar; end; -- TEST: dummy_test info missing column value for each column name -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {name bar}: err -- + autotest attribute has incorrect format (column value should be nested) in 'dummy_test' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (bar, (id, name))))) create proc autotest_dummy_test_no_value_format() begin select * from bar; end; -- TEST: dummy_test info with column value as column name -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {misc_attr_value_list}: err -- + autotest attribute has incorrect format (table name should be nested) in 'dummy_test' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (1, (id), (1))))) create proc autotest_bogus_table_name_format() begin select * from bar; end; -- TEST: dummy_test info missing column name but has column value -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {name bar}: err -- + autotest attribute has incorrect format (column name should be nested) in 'dummy_test' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (bar, (1), (1))))) create proc autotest_bogus_colum_name_format() begin select * from bar; end; -- TEST: dummy_test info with column value not nested -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {name bar}: err -- + autotest attribute has incorrect format (column value should be nested) in 'dummy_test' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (bar, (id), 1)))) create proc autotest_colum_value_incorrect_format() begin select * from bar; end; -- TEST: dummy_test info with bogus column name -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {name bar}: ok -- + {name bogus_col}: err -- + autotest attribute 'dummy_test' has non existent column 'bogus_col' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (bar, (bogus_col), (1), (2))))) create proc autotest_dummy_test_bogus_col_name() begin select * from bar; end; -- TEST: dummy_test info with bogus table name -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_test}: err -- + {name bogus_table}: err -- + autotest attribute 'dummy_test' has non existent table 'bogus_table' -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_test, (bogus_table, (id), (1), (2))))) create proc autotest_dummy_test_bogus_table_name() begin select * from bar; end; -- TEST: autotest attribute with bogus attribute name -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_bogus}: err -- + autotest attribute name is not valid 'dummy_bogus' -- +1 Error @attribute(cql:autotest=(dummy_bogus)) create proc autotest_dummy_bogus() begin select * from bar; end; -- TEST: autotest attribute with bogus attribute name nested -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_bogus}: err -- + {name dummy_table}: ok -- + autotest has incorrect format -- +1 Error @attribute(cql:autotest=(dummy_table, (dummy_bogus))) create proc autotest_bogus_nested_attribute() begin select * from bar; end; -- TEST: dummy_test info not nested -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name bar}: err -- + autotest has incorrect format -- +1 Error @attribute(cql:autotest=(dummy_test, (bar, (id), (1)))) create proc autotest_dummy_test_not_nested() begin select * from bar; end; -- TEST: autotest attribute not nested. -- + {stmt_and_attr}: err -- + {create_proc_stmt}: err -- + Error % autotest attribute name is not valid 'bar' -- + Error % autotest has incorrect format 'found nested attributes that don't start with dummy_test' -- +2 Error @attribute(cql:autotest=(dummy_test, bar, ((id, name),(1, 'x')))) create proc autotest_dummy_test_not_nested_2() begin select * from bar; end; -- TEST: autotest attribute with column names double nested -- + {stmt_and_attr}: err -- + {create_proc_stmt}: err -- + Error % autotest attribute has incorrect format (table name should be nested) in 'dummy_test' -- +1 Error @attribute(cql:autotest=((dummy_test, ((bar, (id), (1), (2)))))) create proc autotest_dummy_test_with_col_double_nested() begin select * from bar; end; -- TEST: autotest attribute with dummy_table -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + {name dummy_table}: err -- + autotest has incorrect format -- +1 Error @attribute(cql:autotest=dummy_table) create proc autotest_incorrect_formatting() begin select * from bar; end; -- some declrations for autodrop tests create temp table table1( id integer); create temp table table2( id integer); create table not_a_temp_table( id integer); -- TEST: autodrop attribute (correct usage) -- + {stmt_and_attr} -- + {misc_attrs}: ok -- + {dot} -- + {name cql} -- + {name autodrop} -- + {name table1}: ok -- + {name table2}: ok -- + {create_proc_stmt}: select: { id: integer } dml_proc -- + {name autodropper}: select: { id: integer } dml_proc @attribute(cql:autodrop=(table1, table2)) create proc autodropper() begin select * from table1; end; -- TEST: autodrop attribute: name is not an object -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + autodrop temp table does not exist 'not_an_object' -- +1 Error @attribute(cql:autodrop=(not_an_object)) create proc autodropper_not_an_objecte() begin select * from table1; end; -- TEST: autodrop attribute: name is a view -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + Error % autodrop target is not a table 'ViewShape' -- +1 Error @attribute(cql:autodrop=(ViewShape)) create proc autodropper_dropping_view() begin select * from table1; end; -- TEST: autodrop attribute: name is not a temp table -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + Error % autodrop target must be a temporary table 'not_a_temp_table' -- +1 Error @attribute(cql:autodrop=(not_a_temp_table)) create proc autodropper_not_temp_table() begin select * from table1; end; -- TEST: autodrop attribute: proc doesn't select anything -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + Error % autodrop annotation can only go on a procedure that returns a result set 'autodrop_not_really_a_result_set_proc' -- +1 Error @attribute(cql:autodrop=(table1, table2)) create proc autodrop_not_really_a_result_set_proc() begin declare i integer; end; -- TEST: autodrop attribute: proc doesn't use the database -- + {create_proc_stmt}: err -- + {misc_attrs}: err -- + Error % autodrop annotation can only go on a procedure that uses the database 'autodrop_no_db' -- +1 Error @attribute(cql:autodrop=(table1, table2)) create procedure autodrop_no_db() begin declare C cursor like select 1 id; fetch c (id) from values(1); out c; end; -- TEST: table to test referenceable (primary key, unique key) column -- {create_table_stmt}: referenceable: { a: integer notnull primary_key, b: real unique_key, c: text unique_index_key, d: text } -- - Error create table referenceable ( a int primary key, b real unique, c text, d text, e long int ); -- TEST: table to test referenceable group of columns -- {create_table_stmt}: referenceable: { a: integer notnull, b: real } -- - Error create table referenceable_2 ( a int, b real, primary key (a, b) ); -- TEST: index to test referenceable (unique index key) column -- - Error create unique index referenceable_index on referenceable(c, d); -- TEST: test foreign key on a primary key -- +1 {create_table_stmt}: reference_pk: { id: integer foreign_key } -- +1 {fk_def}: ok -- - Error create table reference_pk( id int, foreign key (id) references referenceable(a) ); -- TEST: test foreign key on a group of primary key -- +1 {create_table_stmt}: reference_2_pk: { id: integer foreign_key, size: real foreign_key } -- +1 {fk_def}: ok -- - Error create table reference_2_pk( id int, size real, foreign key (id, size) references referenceable_2(a, b) ); -- TEST: test foreign key on a group of primary key in the wrong order -- +1 {create_table_stmt}: reference_2_wrong_order_pk: { id: integer foreign_key, size: real foreign_key } -- +1 {fk_def}: ok -- - Error create table reference_2_wrong_order_pk( id int, size real, foreign key (size, id) references referenceable_2(b, a) ); -- TEST: test foreign key on a unique key -- +1 {create_table_stmt}: reference_uk: { id: real foreign_key } -- +1 {fk_def}: ok -- - Error create table reference_uk( id real, foreign key (id) references referenceable(b) ); -- TEST: test foreign key on a mixed of primary and unique key -- +1 {create_table_stmt}: err -- +1 {fk_def}: err -- +1 Error % the set of columns referenced in the foreign key statement should match exactly a unique key in the parent table 'referenceable' -- +1 Error create table reference_pk_and_uk( id1 int, id2 real, foreign key (id1, id2) references referenceable(a, b) ); -- TEST: test foreign key on a unique key -- +1 {create_table_stmt}: referenceable_unique_index: { id: text foreign_key, label: text foreign_key } -- +1 {fk_def}: ok -- - Error create table referenceable_unique_index( id text, label text, foreign key (id, label) references referenceable(c, d) ); -- TEST: test foreign key on a mixed of a primary and unique index -- +1 {create_table_stmt}: err -- +1 {fk_def}: err -- +1 Error % the set of columns referenced in the foreign key statement should match exactly a unique key in the parent table 'referenceable' -- +1 Error create table reference_pk_and_unique_index( id1 int, id2 text, foreign key (id1, id2) references referenceable(a, c) ); -- TEST: test foreign key on a mixed of a unique key and unique index -- +1 {create_table_stmt}: err -- +1 {fk_def}: err -- +1 Error % the set of columns referenced in the foreign key statement should match exactly a unique key in the parent table 'referenceable' -- +1 Error create table reference_uk_and_unique_index( id1 real, id2 text, id3 text, foreign key (id1, id2, id3) references referenceable(b, c, d) ); -- TEST: test foreign key on a single non referenceable column -- +1 {create_table_stmt}: err -- +1 {fk_def}: err -- + Error % the set of columns referenced in the foreign key statement should match exactly a unique key in the parent table 'referenceable' -- +1 Error create table reference_not_referenceable_column( id long int primary key, foreign key (id) references referenceable(e) ); -- TEST: test foreign key on multiple non referenceable columns -- +1 {create_table_stmt}: err -- +1 {fk_def}: err -- + Error % the set of columns referenced in the foreign key statement should match exactly a unique key in the parent table -- +1 Error create table reference_not_referenceable_columns( id1 text primary key, id2 text, id3 text, foreign key (id1, id2, id3) references referenceable(c, d, e) ); -- TEST: test foreign key on a subset of unique index -- +1 {create_table_stmt}: err -- +1 {fk_def}: err -- + Error % the set of columns referenced in the foreign key statement should match exactly a unique key in the parent table -- +1 Error create table reference_not_referenceable_column( id text, foreign key (id) references referenceable(c) ); -- TEST: validate enforcement parse and analysis (fk on update) -- + @ENFORCE_STRICT FOREIGN KEY ON UPDATE -- + {enforce_strict_stmt}: ok -- + {int 1} @enforce_strict foreign key on update; -- TEST: validate enforcement parse and analysis (fk on delete) -- + @ENFORCE_STRICT FOREIGN KEY ON DELETE; -- + {enforce_strict_stmt}: ok -- + {int 2} @enforce_strict foreign key on delete; -- TEST: validate enforcement parse and analysis (fk on update) -- + @ENFORCE_NORMAL FOREIGN KEY ON UPDATE -- + {enforce_normal_stmt}: ok -- + {int 1} @enforce_normal foreign key on update; -- TEST: validate enforcement parse and analysis (fk on delete) -- + @ENFORCE_NORMAL FOREIGN KEY ON DELETE; -- + {enforce_normal_stmt}: ok -- + {int 2} @enforce_normal foreign key on delete; -- switch back to strict mode for the validation tests @enforce_strict foreign key on update; @enforce_strict foreign key on delete; -- TEST: strict validation ok -- + id INTEGER REFERENCES foo (id) ON UPDATE CASCADE ON DELETE CASCADE -- + {create_table_stmt}: fk_strict_ok: { id: integer foreign_key } -- + {col_attrs_fk}: ok -- - Error create table fk_strict_ok ( id integer REFERENCES foo(id) ON DELETE CASCADE ON UPDATE CASCADE ); -- TEST: strict failure ON UPDATE missing -- + {create_table_stmt}: err -- + {col_def}: err -- + {col_attrs_fk}: err -- + Error % strict FK validation requires that some ON UPDATE option be selected for every foreign key -- +1 Error create table fk_strict_failure_update( id integer REFERENCES foo(id) ); -- TEST: strict failure ON DELETE missing -- + {create_table_stmt}: err -- + {col_def}: err -- + {col_attrs_fk}: err -- + id INTEGER REFERENCES foo (id) ON UPDATE NO ACTION -- + Error % strict FK validation requires that some ON DELETE option be selected for every foreign key -- +1 Error CREATE TABLE fk_strict_failure_delete( id INTEGER REFERENCES foo (id) ON UPDATE NO ACTION ); -- TEST: strict failure ON DELETE missing (loose FK) -- + {create_table_stmt}: err -- + {fk_def}: err -- + Error % strict FK validation requires that some ON DELETE option be selected for every foreign key -- +1 Error CREATE TABLE fk_strict_failure_delete_loose( id INTEGER, FOREIGN KEY (id) REFERENCES foo(id) ON UPDATE NO ACTION ); -- TEST: strict failure ON UPDATE missing (loose FK) -- + {create_table_stmt}: err -- + {fk_def}: err -- + Error % strict FK validation requires that some ON UPDATE option be selected for every foreign key -- +1 Error CREATE TABLE fk_strict_failure_update_loose( id INTEGER, FOREIGN KEY (id) REFERENCES foo(id) ); -- TEST: strict success with loose fk -- + {create_table_stmt}: fk_strict_success_loose: { id: integer foreign_key } -- + {fk_def}: ok -- - Error CREATE TABLE fk_strict_success_loose( id INTEGER, FOREIGN KEY (id) REFERENCES foo(id) ON DELETE NO ACTION ON UPDATE CASCADE ); -- TEST: create proc with an invalid column name in the identity attribute -- + Error % procedure identity column does not exist in result set 'col3' -- +1 Error @attribute(cql:identity=(col1, col3)) create proc invalid_identity() begin select 1 as col1, 2 as col2, 3 as data; end; -- TEST: create proc with an identity attribute but it has no result -- + Error % identity annotation can only go on a procedure that returns a result set 'no_result_set_identity' -- +1 Error @attribute(cql:identity=(col1, col3)) create proc no_result_set_identity() begin declare x integer; /* no op */ end; -- TEST: base_fragment attribute (correct usage) @attribute(cql:base_fragment=core) create proc test_base_fragment(id_ integer not null) begin with core(x,y,z) as (select id,name,rate from bar where id = id_) select * from core; end; -- TEST: extension_fragment attribute (correct usage) -- + {create_proc_stmt}: select: { x: integer notnull, y: text, z: longint } dml_proc -- + {select_stmt}: select: { x: integer notnull, y: text, z: longint } -- + {select_core_list}: union_all: { x: integer notnull, y: text, z: longint } -- + {select_core_compound} -- - Error @attribute(cql:extension_fragment=core) create proc test_extension_fragment_union(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), -- this is stub for the core plugin_two(*) as ( select * from core union all select 3 x, "y" y, 5L z ) select * from plugin_two; end; -- TEST: a second extension_fragment attribute (correct usage) (verify you can add several out union in a row) -- + {create_proc_stmt}: select: { x: integer notnull, y: text, z: longint } dml_proc -- + {select_stmt}: select: { x: integer notnull, y: text, z: longint } -- + {select_core_list}: union_all: { x: integer notnull, y: text, z: longint } -- + {select_core_compound} -- - Error @attribute(cql:extension_fragment=core) create proc test_extension_fragment_union_two(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), -- this is stub for the core plugin_two_a(*) as ( select * from core union all select 3 x, "y" y, 5L z ) select * from plugin_two_a; end; -- TEST: base_fragment attribute (correct usage) @attribute(cql:base_fragment=another_core) create proc test_base_fragment_two(id_ integer not null) begin with another_core(x,y) as (select T1.id, name from foo AS T1 inner join bar AS T2 ON T1.id = T2.id where T1.id = id_) select * from another_core; end; -- TEST: base_fragment attribute (duplicate creation) -- + Error % fragment name conflicts with existing base fragment 'core' -- +1 Error @attribute(cql:base_fragment=core) create proc test_duplicate_base_fragment(id_ integer not null) begin with core(x,y,z) as (select id,name,rate from bar where id = id_) select * from core; end; -- TEST: base_fragment attribute (erroneous usage) -- + Error % fragment must end with exactly 'SELECT * FROM core_one' -- +1 Error @attribute(cql:base_fragment=core_one) create proc bad_base_fragment_one(id_ integer not null) begin with core_one(id,name,rate) as (select id,name,rate from bar where id = id_) select id from core_one; end; -- TEST: base_fragment attribute (erroneous usage) -- + Error % fragment must end with exactly 'SELECT * FROM core_two' -- +1 Error @attribute(cql:base_fragment=core_two) create proc bad_base_fragment_two(id_ integer not null) begin with core_two(x,y,z) as (select id,name,rate from bar where id = id_) select * from bar; end; -- TEST: base_fragment attribute (erroneous usage) -- + Error % base fragment must have only a single CTE named the same as the fragment 'bar' -- +1 Error @attribute(cql:base_fragment=bar) create proc bad_base_fragment_three(id_ integer not null) begin with core_three(x,y,z) as (select id,name,rate from bar where id = id_) select * from bar; end; -- TEST: make sure that using two CTEs in a base fragment causes an error -- You can run into this error if you mark your extension fragment as a base fragment on accident. -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {create_proc_stmt}: err -- + Error % base fragment must have only a single CTE named the same as the fragment 'err_assembly_name' -- +1 Error @attribute(cql:base_fragment=err_assembly_name) create proc ext1() begin with err_assembly_name(id) as (select * from foo), ext1(*) as ( select * from err_assembly_name union all select 1 id ) select * from ext1; end; -- TEST: base_fragment attribute (erroneous usage) -- + Error % fragments can only have one statement in the statement list and it must be a WITH..SELECT -- +1 Error @attribute(cql:base_fragment=core_four) create proc bad_base_fragment_four(id_ integer not null) begin select id,name,rate from bar where id = id_; end; -- TEST: create a plugin table that is going to add a column to the base fragment -- + {create_table_stmt}: plugin_table: { id: integer notnull primary_key, name: text, flag: bool } -- - Error create table plugin_table( id integer primary key, name text, flag BOOL ); -- TEST: extension_fragment attribute (incorrect usage, not UNION ALL everywhere) -- + {create_proc_stmt}: err -- + {with_select_stmt}: err -- + Error % all the compound operators in this CTE must be UNION ALL 'not_union_all' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_extension_fragment_not_union_all(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), -- this is stub for the core not_union_all(*) as ( select * from core union all select 3 x, "y" y, 5L z except select 3 x, "y" y, 5L z ) select * from not_union_all; end; -- TEST: extension_fragment attribute (correct usage) -- - Error @attribute(cql:extension_fragment=core) create proc test_extension_fragment(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_one(x,y,z,a) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.name = core.y AND plugin_table.id = id_) select * from plugin_one; end; -- TEST: extension_fragment attribute (incorrect usage, out of order) -- + {create_proc_stmt}: err -- + {with_select_stmt}: err -- + Error % all extension fragments that use UNION ALL must come before those that use LEFT OUTER JOIN 'out_of_order' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_extension_fragment_union_out_of_order(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), -- this is stub for the core out_of_order(*) as ( select * from core union all select 3 x, "y" y, 5L z ) select * from out_of_order; end; -- TEST: extension_fragment attribute (correct usage) -- + Error % fragment parameters must be exactly '(id_ INTEGER NOT NULL)' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_extension_fragment_bad_args(id_ integer) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_one(x,y,z,a) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.name = core.y AND plugin_table.id = id_) select * from plugin_one; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % fragment name is not a previously declared base fragmen -- +1 Error @attribute(cql:extension_fragment=wrong_core) create proc test_bad_extension_fragment_one(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_wrong_one(x,y,z,a) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.name = core.y AND plugin_table.id = id_) select * from plugin_wrong_one; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % extension/assembly fragment must have the CTE named same as the base fragment -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_two(id_ integer not null) begin with core_not_exist(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_wrong_two(x,y,z,a) as ( select core_not_exist.*, plugin_table.flag from core_not_exist left outer join plugin_table on plugin_table.name = core_not_exist.y AND plugin_table.id = id_) select * from plugin_wrong_two; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % extension fragment must add exactly one CTE; found extra named 'plugin_wrong_three' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_three(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_wrong_extra(x,y,z,a) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.name = core.y AND plugin_table.id = id_), plugin_wrong_three(x,y,z,a) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.name = core.y AND plugin_table.id = id_) select * from plugin_wrong_three; end; -- TEST: extension_fragment attribute (erroneous usage) -- Here we check for the case where you try to do something other than a join in the CTE -- + Error % extension fragment CTE must be a simple left outer join from 'core' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bogus_extension_shape(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), bogus_shape(x,y,z,a) as (select core.*, 1 a from core) select * from bogus_shape; end; -- TEST: extension_fragment attribute (erroneous usage) -- Here we're checking that we detect the case when you try to join from something other than a table -- + Error % extension fragment CTE must be a simple left outer join from 'core' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bogus_extension_data_source(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), bogus_not_a_table(x,y,z,a) as (select core.*, junk.a from (select * from core) core inner join (select 1 a) junk) select * from bogus_not_a_table; end; -- make a bogus thing with the same shape as core but a different name -- - Error create view core2 as select 1 x, nullable("a") y, nullable(3L) z; -- TEST: extension_fragment attribute (erroneous usage) -- Here we're checking that we detect the case when you try to join from something other than a table -- + Error % extension fragment CTE must be a simple left outer join from 'core' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bogus_extension_table_name(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), bogus_wrong_table(x,y,z,a) as (select core.*, junk.a from core2 core left outer join (select 1 a) junk) select * from bogus_wrong_table; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % extension/assembly fragment must use base CTE column list same as from the base fragment 'core' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_four(id_ integer not null) begin with core(x,y,z,a) as (select 1,nullable("a"),nullable(3L),4), plugin_wrong_four(x,y,z,a,flag) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.name = core.y AND plugin_table.id = id_) select * from plugin_wrong_four; end; -- TEST: extension_fragment attribute (erroneous usage) -- Here we're checking that there are no top level restrictions (like 'where') -- + Error % extension fragment CTE must have a FROM clause and no other top level clauses 'bogus_extra_clauses' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_where_in_cte(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), bogus_extra_clauses(x,y,z,a) as ( select core.*, junk.a from core left outer join (select 1 a) junk where core.x = 1) select * from bogus_extra_clauses; end; -- TEST: extension_fragment attribute (erroneous usage) -- Here we're checking that there are no top level restrictions (like 'limit' in the union all case) -- + Error % extension fragment CTE must have not have ORDER BY or LIMIT clauses 'bogus_extra_clauses2' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_limit_in_union_all(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), bogus_extra_clauses2(*) as ( select * from core union all select * from core limit 1) select * from bogus_extra_clauses2; end; -- TEST: extension_fragment attribute (erroneous usage) -- Here we're checking that there are no post restrictions (like 'limit') -- + Error % extension fragment CTE must have a FROM clause and no other top level clauses 'bogus_extra_clauses' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_limit_in_cte(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), bogus_extra_clauses(x,y,z,a) as ( select core.*, junk.a from core left outer join (select 1 a) junk limit 3) select * from bogus_extra_clauses; end; -- TEST: extension_fragment attribute (erroneous usage) -- Here we're checking that no FROM clause is illegal -- + Error % extension fragment CTE must select T.* from base CTE 'core' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_missing_from_in_cte(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), bogus_missing_from(x,y,z,a) as (select 1, nullable("a"),nullable(3L), 1a) select * from bogus_missing_from; end; -- TEST: extension_fragment attribute (erroneous usage) -- here the join is "inner" rather than left outer -- + Error % extension fragment CTE must be a simple left outer join from 'core' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_five(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_wrong_five(x,y,z,a) as ( select core.*, plugin_table.flag from core inner join plugin_table on plugin_table.name = core.y AND plugin_table.id = id_) select * from plugin_wrong_five; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % fragment must end with exactly 'SELECT * FROM plugin_wrong_six' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_six(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_wrong_six(x,y,z,a) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.name = core.y AND plugin_table.id = id_) select plugin_wrong_six.x from plugin_wrong_six; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % fragment must end with exactly 'SELECT * FROM plugin_wrong_seven' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_seven(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_wrong_seven(x,y,z,a) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.name = core.y AND plugin_table.id = id_) select * from core; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % extension fragment CTE must select T.* from base CTE 'core' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_eight(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_wrong_eight(x,y,z,a) as ( select bar.*, plugin_table.flag from bar left outer join plugin_table on plugin_table.id = id_) select * from plugin_wrong_eight; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % extension fragment CTE must select T.* from base CTE 'core' -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_nine(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_wrong_nine(x,y) as ( select core.y, plugin_table.flag from core left outer join plugin_table on plugin_table.id = id_) select * from plugin_wrong_nine; end; -- TEST: create plugin_wrong_nine extension, using up the name plugin_wrong_nine -- + {create_proc_stmt}: select: { x: integer notnull, y: text, z: longint, a: bool } dml_proc -- - Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_nine_ok(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_wrong_nine(x,y,z,a) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.id = id_) select * from plugin_wrong_nine; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % extension fragment name conflicts with existing fragment 'plugin_wrong_nine' -- + {name test_bad_extension_fragment_ten}: err -- + {cte_tables}: err -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_ten(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), plugin_wrong_nine(x,y,z,a) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.id = id_) select * from plugin_wrong_nine; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % fragments can only have one statement in the statement list and it must be a WITH..SELECT -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_eleven(id_ integer not null) begin select * from plugin_table; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % extension/assembly fragment must add stub for base CTE with same types from base fragment (expected longint; found integer) 'rate' -- + {name test_bad_extension_fragment_with_wrong_base_sem_type}: err -- + {select_expr_list_con}: err -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_with_wrong_base_sem_type(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3)), plugin_wrong_eleven(x,y,z,a) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.id = id_) select * from plugin_wrong_eleven; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % extension/assembly fragment stub for base CTE column must be exact type match (including nullability) (expected longint; found longint notnull) 'rate' -- + {name test_bad_extension_fragment_with_wrong_base_nullability}: err -- + {select_expr_list_con}: err -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_with_wrong_base_nullability(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),3L), plugin_wrong_twelve(x,y,z,a) as ( select core.*, plugin_table.flag from core left outer join plugin_table on plugin_table.id = id_) select * from plugin_wrong_twelve; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % if multiple selects, all column names must be identical so they have unambiguous names 'name' -- + {create_proc_stmt}: err -- + {with_select_stmt}: err -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_union_one(id_ integer) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), -- this is stub for the core test_bad_extension_fragment_union_one(x,y,z,name) as ( select core.*, CAST(NULL as TEXT) as name2 from core union all select core.*, plugin_table.name from core inner join plugin_table on plugin_table.name = "test") select * from test_bad_extension_fragment_union_one; end; -- TEST: extension_fragment attribute (erroneous usage) -- + Error % if multiple selects, all must have the same column count -- + {create_proc_stmt}: err -- + {with_select_stmt}: err -- + {cte_tables}: err -- +1 Error @attribute(cql:extension_fragment=core) create proc test_bad_extension_fragment_union_two(id_ integer) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), -- this is stub for the core test_bad_extension_fragment_union_two(x,y,z,name) as ( select core.*, CAST(NULL as TEXT) as name from core union all select core.* from core inner join plugin_table on plugin_table.name = "test") select * from test_bad_extension_fragment_union_two; end; -- TEST: extension_fragment attribute (incorrect usage) -- + Error % fragment must start with exactly 'SELECT * FROM core' -- + {create_proc_stmt}: err -- + {with_select_stmt}: err -- +1 Error @attribute(cql:extension_fragment=core) create proc test_extension_fragment_union_three(id_ integer not null) begin with core(x,y,z) as (select 1,nullable("a"),nullable(3L)), -- this is stub for the core test_bad_extension_fragment_union_three(*) as ( select * from bar union all select * from bar) select * from test_bad_extension_fragment_union_three; end; -- Setting up a fragment for the assembly test (only trivial validation here) -- - Error @attribute(cql:base_fragment=assembly_core) create proc test_assembly_base_fragment(id_ integer not null) begin with assembly_core(x,y,z) as (select id,name,rate from bar where id = id_) select * from assembly_core; end; -- Setting up a fragment for the assembly test (only trivial validation here) -- - Error @attribute(cql:extension_fragment=assembly_core) create proc test_assembly_extension_fragment_one(id_ integer not null) begin with assembly_core(x,y,z) as (select 1,nullable("a"),nullable(3L)), -- this is stub for the core assembly_one(x,y,z) as ( select * from assembly_core union all select 3 x, "y" y, 5L z) select * from assembly_one; end; -- Setting up a fragment for the assembly test (only trivial validation here) -- - Error @attribute(cql:extension_fragment=assembly_core) create proc test_assembly_extension_fragment_two(id_ integer not null) begin with assembly_core(x,y,z) as (select 1,nullable("a"),nullable(3L)), assembly_two(x,y,z,a,b,c) as ( select assembly_core.*, plugin_table.flag, min(plugin_table.id, 10L), min(plugin_table.id, 10.05) from assembly_core left outer join plugin_table on plugin_table.name = assembly_core.y AND plugin_table.id = id_) select * from assembly_two; end; -- Setting up a fragment for the assembly test (only trivial validation here) -- - Error @attribute(cql:extension_fragment=assembly_core) create proc test_assembly_extension_fragment_three(id_ integer not null) begin with assembly_core(x,y,z) as (select 1,nullable("a"),nullable(3L)), assembly_three(*) as ( select assembly_core.*, plugin_table.id d from assembly_core left outer join plugin_table on plugin_table.id = id_) select * from assembly_three; end; -- TEST: assembly_fragment attribute (correct usage) -- - Error -- + {misc_attrs}: ok -- + {name assembly_fragment} -- + {create_proc_stmt}: select: { x: integer notnull, y: text, z: longint, a: bool, b: longint, c: real, d: integer } dml_proc -- + {select_stmt}: select: { x: integer notnull, y: text, z: longint, a: bool, b: longint, c: real, d: integer } -- + {cte_table}: assembly_core: { x: integer notnull, y: text, z: longint } -- + {cte_table}: assembly_one: { x: integer notnull, y: text, z: longint } -- + {cte_table}: assembly_two: { x: integer notnull, y: text, z: longint, a: bool, b: longint, c: real } -- + {cte_table}: assembly_three: { x: integer notnull, y: text, z: longint, a: bool, b: longint, c: real, d: integer } @attribute(cql:assembly_fragment=assembly_core) create proc assembly_core(id_ integer not null) begin with assembly_core(x,y,z) as (select 1,nullable("a"),nullable(3L)) -- this is stub for the core select * from assembly_core; end; -- TEST: base fragment with atypical body -- + create_proc_stmt}: err -- + Error % fragments can only have one statement in the statement list and it must be a WITH..SELECT @attribute(cql:base_fragment=for_bad2) create proc test_assembly_base_for_bad2(id_ integer not null) begin declare foo integer; with for_bad(x) as (select 1) select * from for_bad; end; -- setup for the assembly fragment -- - Error @attribute(cql:base_fragment=for_bad) create proc test_assembly_base_for_bad(id_ integer not null) begin with for_bad(x) as (select 1) select * from for_bad; end; -- TEST: extension fragment with bogus content -- + create_proc_stmt}: err -- + Error % fragments can only have one statement in the statement list and it must be a WITH..SELECT @attribute(cql:extension_fragment=for_bad) create proc test_bad_ext(id_ integer not null) begin declare foo integer; with for_bad(x) as (select 1), plugin_one(x,a) as (select 1, 2) select * from plugin_one; end; -- TEST: assembly fragment with atypical body -- + {create_proc_stmt}: err -- + Error % fragments can only have one statement in the statement list and it must be a WITH..SELECT @attribute(cql:assembly_fragment=for_bad) create proc test_assembly_fragment2(id_ integer not null) begin declare foo integer; with for_bad(x) as (select 1) select * from for_bad; end; -- TEST: assembly_fragment attribute (erroneous usage) -- + Error % duplicate assembly fragments of base fragment 'assembly_core' -- + {misc_attrs}: err -- + {name duplicate_assembly_fragment}: err -- +1 Error @attribute(cql:assembly_fragment=assembly_core) create proc duplicate_assembly_fragment(id_ integer not null) begin with assembly_core(x,y,z) as (select 1,2,nullable(3L)) -- this is stub for the core select * from assembly_core; end; -- TEST: assembly_fragment attribute (erroneous usage) -- + Error % assembly fragment can only have one CTE 'another_core' -- + {stmt_list}: err -- + {cte_tables}: err -- +1 Error @attribute(cql:assembly_fragment=another_core) create proc bad_assembly_fragment_one(id_ integer not null) begin with another_core(x,y) as (select 1,nullable("a")), -- this is stub for the core another_cte(x,y) as ( select another_core.* from another_core ) select * from another_cte; end; -- TEST: assembly_fragment attribute (erroneous usage) -- + Error % fragment name is not a previously declared base fragment 'wrong_core' -- + {misc_attrs}: err -- + {name bad_assembly_fragment_two}: err -- +1 Error @attribute(cql:assembly_fragment=wrong_core) create proc bad_assembly_fragment_two(id_ integer not null) begin with wrong_core(x,y,z) as (select 1,nullable("a"),nullable(3L)) -- this is stub for the core select * from wrong_core; end; -- - Error @attribute(cql:base_fragment=test_bad_assembly_base_fragment) create proc test_bad_assembly_base_fragment(id_ integer not null) begin with test_bad_assembly_base_fragment(x,y,z) as (select id,name,rate from bar where id = id_) select * from test_bad_assembly_base_fragment; end; -- TEST: assembly_fragment attribute (erroneous usage) -- + Error % fragments can only have one statement in the statement list and it must be a WITH..SELECT -- +1 Error @attribute(cql:assembly_fragment=test_bad_assembly_base_fragment) create proc bad_assembly_fragment_three(id_ integer not null) begin select id,name,rate from bar where id = id_; end; -- - Error @attribute(cql:base_fragment=assembly_core_bad_one) create proc test_bad_assembly_base_fragment_one(id_ integer not null) begin with assembly_core_bad_one(x,y,z) as (select id,name,rate from bar where id = id_) select * from assembly_core_bad_one; end; -- TEST: a simple ext fragment with the same name as the next, this is ok in isolation -- - Error @attribute(cql:extension_fragment=assembly_core_bad_one) create proc test_bad_assembly_extension_fragment_one(id_ integer not null) begin with assembly_core_bad_one(x,y,z) as (select 1,nullable("a"),nullable(3L)), assembly_bad_one(x,y,z,a) as ( select assembly_core_bad_one.*, plugin_table.flag from assembly_core_bad_one left outer join plugin_table on plugin_table.name = assembly_core_bad_one.y AND plugin_table.id = id_) select * from assembly_bad_one; end; -- TEST: a simple ext fragment with the same name as the previous, this is ok in isolation -- - Error @attribute(cql:extension_fragment=assembly_core_bad_one) create proc test_bad_assembly_extension_fragment_two(id_ integer not null) begin with assembly_core_bad_one(x,y,z) as (select 1,nullable("a"),nullable(3L)), -- this is stub for the core assembly_bad_two(x,y,z,a) as ( select assembly_core_bad_one.*, plugin_table.flag from assembly_core_bad_one left outer join plugin_table on plugin_table.name = assembly_core_bad_one.y AND plugin_table.id = id_) select * from assembly_bad_two; end; -- TEST: assembly_fragment attribute (erroneous usage) -- + Error % extension fragments of same base fragment share the same cte column 'a' -- + {name assembly_core_bad_one}: err -- +1 Error @attribute(cql:assembly_fragment=assembly_core_bad_one) create proc assembly_core_bad_one(id_ integer not null) begin with assembly_core_bad_one(x,y,z) as (select 1,nullable("a"),nullable(3L)) -- this is stub for the core select * from assembly_core_bad_one; end; -- Set up base fragment for bad_assembly_fragment_with_wrong_base_sem_type -- - Error @attribute(cql:base_fragment=assembly_core_bad_two) create proc create_bad_assembly_base_fragment_two(id_ integer not null) begin with assembly_core_bad_two(x,y,z) as (select id,name,rate from bar where id = id_) select * from assembly_core_bad_two; end; -- TEST: assembly_fragment attribute (erroneous usage) -- + Error % extension/assembly fragment stub for base CTE column must be exact type match (including nullability) (expected longint; found longint notnull) 'rate' -- + {name test_bad_assembly_fragment_with_wrong_base_sem_type}: err -- + {select_expr_list_con}: err -- +1 Error @attribute(cql:assembly_fragment=assembly_core_bad_two) create proc test_bad_assembly_fragment_with_wrong_base_sem_type(id_ integer not null) begin with assembly_core_bad_two(x,y,z) as (select 1,nullable("a"),3L) select * from assembly_core_bad_two; end; -- TEST: Set up base fragment for bad_assembly_fragment_with_wrong_base_nullability -- - Error @attribute(cql:base_fragment=assembly_core_bad_three) create proc create_bad_assembly_base_fragment_three(id_ integer not null) begin with assembly_core_bad_three(x,y,z) as (select id,name,rate from bar where id = id_) select * from assembly_core_bad_three; end; -- TEST: assembly_fragment attribute (erroneous usage) -- + Error % extension/assembly fragment must add stub for base CTE with same types from base fragment (expected text; found integer) 'name' -- + {name test_bad_assembly_fragment_with_wrong_base_nullability}: err -- + {select_expr_list_con}: err -- +1 Error @attribute(cql:assembly_fragment=assembly_core_bad_three) create proc test_bad_assembly_fragment_with_wrong_base_nullability(id_ integer not null) begin with assembly_core_bad_three(x,y,z) as (select 1,nullable(2),nullable(3L)) select * from assembly_core_bad_three; end; -- setup a new base fragment -- - Error @attribute(cql:base_fragment=assembly_core_simple) create proc base_with_args(idx_ integer not null) begin with assembly_core_simple(x) as (select 1 x) select * from assembly_core_simple; end; -- Set up an assembly fragment with the wrong parameters -- + Error % fragment parameters must be exactly '(idx_ INTEGER NOT NULL)' -- +1 Error @attribute(cql:assembly_fragment=assembly_core_simple) create proc assembly_core_simple(id_ integer not null) begin with assembly_core_simple(x) as (select 1 x) select * from assembly_core_simple; end; -- TEST: declare a valid root region -- + {declare_schema_region_stmt}: root_region: region -- + {name root_region} -- - Error @declare_schema_region root_region; -- TEST: declare a valid region with dependencies -- + {declare_schema_region_stmt}: dep_region: region -- + {name dep_region} -- + {name root_region} -- - Error @declare_schema_region dep_region using root_region; -- TEST: try to redefine a region -- + {declare_schema_region_stmt}: err -- + Error % schema region already defined 'root_region' -- +1 Error @declare_schema_region root_region; -- TEST: try to use a region that doesn't exist -- + {declare_schema_region_stmt}: err -- + Error % unknown schema region 'unknown_region' -- +1 Error @declare_schema_region root_region using unknown_region; -- TEST: try to use the same region twice -- + {declare_schema_region_stmt}: err -- + Error % duplicate name in list 'root_region' -- +1 Error @declare_schema_region root_region using root_region, root_region; -- TEST: enter a schema region -- + {begin_schema_region_stmt}: ok -- + | {name root_region} -- - Error @begin_schema_region root_region; -- TEST: enter a schema region while there is already one active -- + {begin_schema_region_stmt}: err -- + Error % schema regions do not nest; end the current region before starting a new one -- +1 Error @begin_schema_region root_region; -- TEST: exit a schema region -- + {end_schema_region_stmt}: ok -- - Error @end_schema_region; -- add some more regions to create a diamond shape (two ways to get to root) @declare_schema_region dep2_region USING root_region; @declare_schema_region diamond_region USING dep_region, dep2_region; -- TEST: exit a schema region when there is no region active -- + {end_schema_region_stmt}: err -- + Error % you must begin a schema region before you can end one -- +1 Error @end_schema_region; -- TEST: try to enter a schema region that is not known -- + {begin_schema_region_stmt}: err -- + Error % unknown schema region 'what_is_this_region' -- +1 Error @begin_schema_region what_is_this_region; -- TEST: try to use schema region declaration inside of a procedure -- + {create_proc_stmt}: err -- + {declare_schema_region_stmt}: err -- + Error % schema region directives may not appear inside of a procedure -- +1 Error create proc decl_region_in_proc() begin @declare_schema_region fooey; end; -- TEST: try to use begin schema region inside of a procedure -- + {create_proc_stmt}: err -- + {begin_schema_region_stmt}: err -- + Error % schema region directives may not appear inside of a procedure -- +1 Error create proc begin_region_in_proc() begin @begin_schema_region fooey; end; -- TEST: try to use end schema region inside of a procedure -- + {create_proc_stmt}: err -- + {end_schema_region_stmt}: err -- + Error % schema region directives may not appear inside of a procedure -- +1 Error create proc end_region_in_proc() begin @end_schema_region; end; -- TEST: division of reals is ok (promotes to real) -- + {assign}: my_real: real variable -- + {div}: real notnull -- - Error set my_real := 1.3 / 2; -- TEST: modulus of reals is NOT ok (this makes no sense) -- + {mod}: err -- + Error % operands must be an integer type, not real '%' -- +1 Error set X := 1.3 % 2; -- TEST: make sure || aborts if one of the args is already an error -- + {select_stmt}: err -- + {concat}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error select (NOT 'x') || 'plugh'; @begin_schema_region root_region; create table a_table_in_root_region(id integer); create trigger a_trigger_in_root_region before delete on a_table_in_root_region begin delete from a_table_in_root_region where id > 3; end; create index a_index_in_root_region on a_table_in_root_region(id); @end_schema_region; @begin_schema_region dep_region; create table a_table_in_dep_region(id integer); -- TEST: create a legal view using tables from two regions -- + {create_view_stmt}: a_view_in_dep_region: { id1: integer, id2: integer } -- - Error create view a_view_in_dep_region as select T1.id as id1, T2.id as id2 from a_table_in_root_region T1 inner join a_table_in_dep_region T2 using(id); -- TEST: try to drop a non-region trigger from dep_region -- + {drop_trigger_stmt}: err -- + {name trigger2} -- + Error % trigger in drop statement was not declared (while in schema region 'dep_region', accessing an object that isn't in a region is invalid) 'trigger2' -- +1 Error drop trigger trigger2; -- TEST: try to drop a non-region view from dep_region -- + {drop_view_stmt}: err -- + Error % view in drop statement does not exist (while in schema region 'dep_region', accessing an object that isn't in a region is invalid) 'MyView' -- +1 Error drop view MyView; -- TEST: try to drop a non-region table from dep_region -- + {drop_table_stmt}: err -- + Error % table in drop statement does not exist (while in schema region 'dep_region', accessing an object that isn't in a region is invalid) 'foo' -- +1 Error drop table foo; -- TEST: try to drop a non-region index from dep_region -- + {drop_index_stmt}: err -- + Error % index in drop statement was not declared (while in schema region 'dep_region', accessing an object that isn't in a region is invalid) 'index_1' -- +1 Error drop index index_1; -- TEST: create a table like non-region table from dep_region -- + {create_table_stmt}: a_table_like_table_in_dep_region: { id: integer notnull } -- - Error create table a_table_like_table_in_dep_region (like foo); -- TEST: create a table like view in dep_region from dep_region -- + {create_table_stmt}: a_table_like_table_in_dep_region_2: { id1: integer, id2: integer } -- - Error create table a_table_like_table_in_dep_region_2 (like a_view_in_dep_region); -- TEST: create a table like a non-region view from dep_region -- + {create_table_stmt}: a_table_like_view_in_dep_region: { f1: integer notnull, f2: integer notnull, f3: integer notnull } -- - Error create table a_table_like_view_in_dep_region (like MyView); -- TEST: create a table like a non-region proc from dep_region -- + {create_table_stmt}: a_table_like_proc_in_dep_region: { id: integer notnull, name: text, rate: longint } -- - Error create table a_table_like_proc_in_dep_region (like with_result_set); @end_schema_region; -- entering a different region now, it partly overlaps @begin_schema_region dep2_region; -- TEST: create a legal view using tables from root region -- + {create_view_stmt}: ok_view_in_dep2_region: { id: integer } -- - Error create view ok_view_in_dep2_region as select * from a_table_in_root_region; -- TEST: try to access objects in dep_region -- + {create_view_stmt}: err -- + Error % table/view not defined (object is in schema region 'dep_region' not accessible from region 'dep2_region') 'a_table_in_dep_region' -- +1 Error create view bogus_view_in_dep2_region as select T1.id as id1, T2.id as id2 from a_table_in_root_region T1 inner join a_table_in_dep_region T2 using(id); -- TEST: try to use a non-region object while in a region -- + {create_view_stmt}: err -- + Error % table/view not defined (while in schema region 'dep2_region', accessing an object that isn't in a region is invalid) 'bar' -- +1 Error create view bogus_due_to_non_region_object as select * from bar; @end_schema_region; -- TEST: enter a schema region that has diamond shaped dependencies -- + {begin_schema_region_stmt}: ok -- + {name diamond_region} -- - Error @begin_schema_region diamond_region; -- TEST: drop a dep_region table from diamond_region -- + {drop_table_stmt}: ok -- - Error drop table a_table_like_proc_in_dep_region; -- TEST: drop a root_region table from diamond_region -- + {drop_table_stmt}: ok -- - Error drop table a_table_in_root_region; -- TEST: drop a dep_region view from diamond_region -- + {drop_view_stmt}: ok -- - Error drop view a_view_in_dep_region; -- TEST: drop a root_region trigger from diamond_region -- + {drop_trigger_stmt}: ok -- - Error drop trigger a_trigger_in_root_region; -- TEST: drop a root_region index from diamond_region -- + {drop_index_stmt}: ok -- - Error drop index a_index_in_root_region; -- TEST: creating a table for use later, we'll try to create an index on the wrong group -- - Error create table diamond_region_table(id integer) @recreate(d_group); @end_schema_region; -- TEST: try to create an index on the diamond group table from not in the same region -- it's a recreate table so that's not allowed -- + {create_index_stmt}: err -- + Error % if a table is marked @recreate, its indices must be in its schema region 'invalid_wrong_group_index' -- +1 Error create index invalid_wrong_group_index on diamond_region_table(id); -- TEST: try to use a WITH_SELECT form in a select expression -- + {assign}: X: integer variable -- + {with_select_stmt}: _anon: integer notnull -- - Error SET x := (WITH threads2 (count) AS (SELECT 1 foo) SELECT COUNT(*) FROM threads2); -- TEST: declare a table valued function -- + {declare_select_func_stmt}: select: { foo: text } select_func -- + {name tvf}: select: { foo: text } -- - Error declare select function tvf(id integer) (foo text); -- TEST: table valued functions may not appear in an expression context -- + {select_stmt}: err -- + Error % table valued functions may not be used in an expression context 'tvf' -- + Error select 1 where tvf(5) = 1; -- TEST: use a table valued function -- + {create_proc_stmt}: select: { foo: text } dml_proc -- + {select_stmt}: select: { foo: text } -- - Error create proc using_tvf() begin select * from tvf(1); end; -- TEST: use a table valued function but with a arg error -- + {select_stmt}: err -- + {table_function}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create proc using_tvf_invalid_arg() begin select * from tvf(NOT 'x'); end; -- TEST: use a table valued function but with a bogus arg type -- + {select_stmt}: err -- + {table_function}: err -- + Error % incompatible types in expression 'id' -- +1 Error create proc using_tvf_arg_mismatch() begin select * from tvf('x'); end; -- TEST: use a table valued function -- + {create_proc_stmt}: select: { foo: text } dml_proc -- + {select_stmt}: select: { foo: text } -- + {dot}: foo: text -- - Error create proc using_tvf_unaliased() begin select * from tvf(1) where tvf.foo = 'x'; end; -- TEST: use a table valued function aliased -- + {create_proc_stmt}: select: { foo: text } dml_proc -- + {select_stmt}: select: { foo: text } -- + {dot}: foo: text -- - Error create proc using_tvf_aliased() begin select * from tvf(1) T1 where T1.foo = 'x'; end; -- TEST: use a non-table-valued function in FROM -- + {select_stmt}: err -- + {table_function}: err -- + Error % function is not a table-valued-function 'SqlUserFunc' -- +1 Error create proc using_not_a_tvf() begin select * from SqlUserFunc(1); end; -- TEST: use a invalid symbol in FROM -- + {select_stmt}: err -- + {table_function}: err -- + Error % table-valued function not declared 'ThisDoesNotExist' -- +1 Error create proc using_not_a_func() begin select * from ThisDoesNotExist(1); end; -- TEST: declare table valued function that consumes an object -- + {declare_select_func_stmt}: select: { id: integer } select_func -- + {params}: ok -- + {param}: rowset: object<rowset> variable in -- - Error declare select function ReadFromRowset(rowset Object<rowset>) (id integer); -- TEST: use a table valued function that consumes an object -- + {create_proc_stmt}: select: { id: integer } dml_proc -- + {table_function}: TABLE { ReadFromRowset: select } -- + {name ReadFromRowset}: TABLE { ReadFromRowset: select } -- + {name rowset}: rowset: object<rowset> variable in -- - Error create proc rowset_object_reader(rowset Object<rowset>) begin select * from ReadFromRowset(rowset); end; -- TEST: convert pointer to long for binding -- + {assign}: ll: longint notnull variable -- + {name ptr}: longint notnull -- - Error set ll := (select ptr(obj_var)); -- TEST: convert pointer to long for binding -- failure case -- + {assign}: err -- + {arg_list}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error set ll := (select ptr(not 'x')); -- TEST: try to use 'ptr' outside of sql context -- + {assign}: err -- + {call}: err -- + Error % function may not appear in this context 'ptr' -- +1 Error set ll := ptr(obj_var); -- TEST: try to use 'ptr' with wrong arg count -- + {assign}: err -- + {call}: err -- + Error % function got incorrect number of arguments 'ptr' -- +1 Error set ll := ptr(obj_var, 1); -- TEST: try to alias a column with a local variable of the same name -- + {assign}: err -- + {select_stmt}: err -- + Error % a variable name might be ambiguous with a column name, this is an anti-pattern 'id' -- +1 Error create proc variable_conflict() begin declare id integer; set id := (select id from foo); end; -- TEST: try to alias rowid with a local variable of the same name -- + {assign}: err -- + {select_stmt}: err -- + Error % a variable name might be ambiguous with a column name, this is an anti-pattern 'rowid' -- +1 Error create proc variable_conflict_rowid() begin declare rowid integer; set rowid := (select rowid from foo); end; -- TEST: group concat has to preserve sensitivity -- + {select_stmt}: select: { gc: text sensitive } -- - Error select group_concat(name) gc from with_sensitive; -- TEST: group concat must always return nullable -- + {select_stmt}: select: { gc: text } -- + {strlit 'not-null'}: text notnull -- - Error select group_concat('not-null') gc from foo; -- TEST: min/max (same code) only accept numerics and strings -- + {create_proc_stmt}: err -- + {select_stmt}: err -- + Error % argument must be a string or numeric in 'min' -- +1 Error create proc min_gets_blob(a_blob blob) begin select min(a_blob) from foo; end; -- TEST: non aggregate version basic test -- this version of min is still allowed to return not null, it isn't an aggregate -- it also doesn't need a from clause -- + {select_expr_list_con}: select: { min_stuff: real notnull } -- - Error set my_real := (select min(1.2, 2, 3) as min_stuff); -- TEST: create a sum using a bool -- + {select_stmt}: select: { _anon: integer } -- + {and}: bool notnull -- - Error select sum(1 and 1) from foo; -- TEST: create a sum using a long integer -- + {select_stmt}: select: { _anon: longint } -- - Error select sum(1L) from foo; -- TEST: create a sum using a real -- + {select_stmt}: select: { _anon: real } -- - Error select sum(1.2) from foo; -- TEST: try to do a min with incompatible arguments (non aggregate form) -- + {select_stmt}: err -- + Error % incompatible types in expression 'min' -- +1 Error select min(1, 'x'); -- TEST: try to do a min with non-numeric arguments (first position) (non aggregate form) -- + {select_stmt}: err -- + Error % argument must be a string or numeric in 'min' -- +1 Error select min(NULL, 'x'); -- TEST: try to do a min with non-numeric arguments (not first position) (non aggregate form) -- + {select_stmt}: err -- + Error % argument must be a string or numeric in 'min' -- +1 Error select min('x', NULL, 'y'); -- TEST: min on strings -- + {select_stmt}: select: { _anon: text notnull } -- - Error select min('x', 'y'); -- TEST: min on numerics (upgraded to real in this case) -- + {select_stmt}: select: { _anon: real notnull } -- - Error select min(1, 1.2); -- TEST: min on numerics (checks sensitivy and nullable) -- + {select_stmt}: select: { _anon: longint sensitive } -- - Error select min(_sens, 1L); -- TEST: create a non-recreate table that references a recreated table -- + create_table_stmt}: err -- + col_attrs_fk}: err -- +1 Error % referenced table can be independently recreated so it cannot be used in a foreign key 'recreatable' -- + Error create table recreatable_reference_1( id integer primary key references recreatable(id), name text ); -- TEST: create a recreate table that references a recreated table -- + create_table_stmt}: err -- + col_attrs_fk}: err -- +1 Error % referenced table can be independently recreated so it cannot be used in a foreign key 'recreatable' -- + Error create table recreatable_reference_2( id integer primary key references recreatable(id), name text ) @recreate; -- TEST: make a recreate table, put it in a group "rtest" -- + {create_table_stmt}: in_group_test: { id: integer notnull primary_key, name: text } @recreate(rtest) -- + {recreate_attr} -- + {name rtest} -- - Error create table in_group_test( id integer primary key, name text ) @recreate(rtest); -- TEST: create a recreate table that references a recreated table, it's in a group, but I'm not -- + create_table_stmt}: err -- + col_attrs_fk}: err -- +1 Error % referenced table can be independently recreated so it cannot be used in a foreign key 'in_group_test' -- + Error create table recreatable_reference_3( id integer primary key references in_group_test(id), name text ) @recreate; -- TEST: create a recreate table that references a recreated table, it's in a group, but I'm in a different group -- + create_table_stmt}: err -- + col_attrs_fk}: err -- +1 Error % referenced table can be independently recreated so it cannot be used in a foreign key 'in_group_test' -- + Error create table recreatable_reference_4( id integer primary key references in_group_test(id), name text ) @recreate(rtest_other_group); -- TEST: create a recreate table that references a recreated table, it's in the same group so this one is ok (finally) -- + {create_table_stmt}: recreatable_reference_5: { id: integer notnull primary_key foreign_key, name: text } @recreate(rtest) -- + {recreate_attr} -- + {name rtest} -- + {name in_group_test} -- + {col_attrs_fk}: ok -- - Error create table recreatable_reference_5( id integer primary key references in_group_test(id) on delete cascade on update cascade, name text ) @recreate(rtest); -- TEST: once we have found one error in the constraint section it's not safe to proceed to look for more -- errors because the semantic type of the node has already been changed to "error" -- so we have to early out. To prove this is happening we force an error in the PK section here -- this error will not be reported becuase we bail before that. -- + {create_table_stmt}: err -- + Error % foreign key refers to non-existent table 'table_not_found' -- + {pk_def} -- - {pk_def}: err -- +1 Error CREATE TABLE early_out_on_errs( result_index INTEGER NOT NULL, query TEXT NOT NULL, FOREIGN KEY (query) REFERENCES table_not_found(q), PRIMARY KEY (garbonzo) ) @RECREATE; -- TEST: attributes not allowed inside of a procedure -- + {create_table_stmt}: err -- + Error % versioning attributes may not be used on DDL inside a procedure -- +1 Error create proc invalid_ddl_1() begin create table inv_1( id integer ) @recreate(xyx); end; -- TEST: attributes not allowed inside of a procedure -- + {create_table_stmt}: err -- + Error % versioning attributes may not be used on DDL inside a procedure -- +1 Error create proc invalid_ddl_2() begin create table inv2( id integer ) @create(1); end; -- TEST: attributes not allowed inside of a procedure -- + {create_table_stmt}: err -- + Error % versioning attributes may not be used on DDL inside a procedure -- +1 Error create proc invalid_ddl_3() begin create table inv3( id integer ) @delete(2); end; -- TEST: attributes not allowed inside of a procedure -- + {create_index_stmt}: err -- + Error % versioning attributes may not be used on DDL inside a procedure -- +1 Error create proc invalid_ddl_4() begin create index inv_4 on bar(x) @delete(2); end; -- TEST: attributes not allowed inside of a procedure -- + {create_view_stmt}: err -- + Error % versioning attributes may not be used on DDL inside a procedure -- +1 Error create proc invalid_ddl_5() begin create view inv_5 as select 1 as f1 @delete(2); end; -- TEST: attributes not allowed inside of a procedure -- + {create_trigger_stmt}: err -- + Error % versioning attributes may not be used on DDL inside a procedure -- +1 Error create proc invalid_ddl_6() begin create trigger if not exists trigger2 after insert on bar begin delete from bar where rate > new.id; end @delete(2); end; -- TEST: enable strict join mode -- + {enforce_strict_stmt}: ok -- + {int 3} -- - Error @enforce_strict join; -- TEST: non-ansi join is used... error in strict mode -- + {select_stmt}: err -- + Error % non-ANSI joins are forbidden if strict join mode is enabled -- +1 Error select * from foo, bar; -- TEST: try to use an out cursor like a statement cursor, not valid -- + {create_proc_stmt}: err -- + {declare_cursor}: err -- + Error % use FETCH FROM for procedures that returns a cursor with OUT 'C' -- +1 Error create proc bar() begin declare C cursor for call out_cursor_proc(); end; -- TEST: can't use offset without limit -- + {select_stmt}: err -- + {opt_offset}: err -- + Error % the OFFSET clause may only be used if LIMIT is also present -- +1 Error select * from foo offset 1; -- TEST: upsert with insert/select and do nothing statement -- + {create_proc_stmt}: ok dml_proc -- + {name upsert_do_nothing}: ok dml_proc -- + {upsert_stmt}: ok -- + {insert_stmt}: ok -- + {upsert_update}: ok -- + {conflict_target}: excluded: { id: integer notnull } -- - Error create proc upsert_do_nothing() begin insert into foo select id from bar where 1 on conflict(id) do nothing; end; -- TEST: with upsert with insert/select and do nothing statement -- + {create_proc_stmt}: ok dml_proc -- + {name with_upsert_do_nothing}: ok dml_proc -- + {with_upsert_stmt}: ok -- + {insert_stmt}: ok -- + {upsert_update}: ok -- + {conflict_target}: excluded: { id: integer notnull } -- - Error create proc with_upsert_do_nothing() begin with data(id) as (values (1), (2), (3)) insert into foo select id from data where 1 on conflict(id) do nothing; end; -- TEST: with upsert with error in the CTE -- + {create_proc_stmt}: err -- + {with_upsert_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create proc with_upsert_cte_err() begin with data(id) as (values (not 'x')) insert into foo select id from data where 1 on conflict(id) do nothing; end; -- TEST: with upsert with error in the insert -- + {create_proc_stmt}: err -- + {with_upsert_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create proc with_upsert_insert_err() begin with data(id) as (values (1)) insert into foo select id from data where not 'x' on conflict(id) do nothing; end; -- TEST: upsert with insert and do nothing statement -- + {create_proc_stmt}: ok dml_proc -- + {name upsert_without_conflict_target}: ok dml_proc -- + {upsert_stmt}: ok -- + {insert_stmt}: ok -- + {upsert_update}: ok -- + {conflict_target}: excluded: { id: integer notnull } -- - Error create proc upsert_without_conflict_target() begin insert into foo(id) values(1) on conflict do nothing; end; -- TEST: upsert or update statement -- + {create_proc_stmt}: ok dml_proc -- + {name upsert_update}: ok dml_proc -- + {upsert_stmt}: ok -- + {insert_stmt}: ok -- + {update_stmt}: foo: { id: integer notnull primary_key autoinc } -- + {upsert_update}: ok -- + {conflict_target}: excluded: { id: integer notnull } -- + {opt_where}: bool notnull -- - Error create proc upsert_update() begin insert into foo(id) values(1) on conflict(id) where id=10 do update set id=id+1 where id=20; end; -- TEST: upsert with conflict on unknown column -- + {create_proc_stmt}: err -- + {upsert_stmt}: err -- + {conflict_target}: err -- + Error % name not found 'bogus' -- +1 Error create proc upsert_conflict_on_unknown_column() begin insert into foo(id) values(1) on conflict(id, bogus) do nothing; end; -- TEST: upsert with table name added to update statement -- + {create_proc_stmt}: err -- + {upsert_stmt}: err -- + {update_stmt}: err -- + Error % upsert statement does not include table name in the update statement 'foo' -- +1 Error create proc upsert_invalid_update_stmt() begin insert into foo(id) values(1) on conflict(id) do update foo set id = 0; end; -- TEST: upsert with select statement without WHERE -- + {create_proc_stmt}: err -- + {upsert_stmt}: err -- + {insert_stmt}: err -- + Error % upsert statement requires a where clause if the insert clause uses select -- +1 Error create proc upsert_no_where_stmt() begin insert into foo select id from (select * from bar) on conflict(id) do nothing; end; -- TEST: upsert with a not normal insert statement -- + {create_proc_stmt}: err -- + {name upsert_or_ignore}: err -- + {upsert_stmt}: err -- + {insert_stmt}: err -- + Error % upsert syntax only supports INSERT INTO 'foo' -- + Error create proc upsert_or_ignore() begin insert or ignore into foo select id from bar where 1 on conflict(id) do nothing; end; -- TEST: upsert with bogus column where statement -- + {create_proc_stmt}: err -- + {name upsert_with_bogus_where_stmt}: err -- + {upsert_stmt}: err -- + {insert_stmt}: ok -- + {upsert_update}: err -- + {conflict_target}: err -- + {name bogus}: err -- + Error % name not found 'bogus' -- + Error create proc upsert_with_bogus_where_stmt() begin insert into foo(id) values(1) on conflict(id) where bogus=1 do nothing; end; -- TEST: update statement without table name -- + {create_proc_stmt}: err -- + {name update_without_table_name}: err -- + {create_trigger_stmt}: err -- + {update_stmt}: err -- + Error % update statement require table name -- +1 Error create proc update_without_table_name() begin create temp trigger update_without_table_name_trigger before delete on bar begin update set id=1 where id=9; end; end; -- TEST: upsert statement. The unique column in conflict target is not a unique key -- + {create_proc_stmt}: err -- + {name upsert_conflict_target_column_not_unique_key}: err -- + {upsert_stmt}: err -- + {conflict_target}: err -- + Error % the set of columns referenced in the conflict target should match exactly a unique key in table we apply upsert -- +1 Error create proc upsert_conflict_target_column_not_unique_key() begin insert into bar(id) values(1) on conflict(name) do nothing; end; -- TEST: upsert statement. The set of columns in conflict target do match unique key -- + {create_proc_stmt}: ok dml_proc -- + {name upsert_conflict_target_columns_valid}: ok dml_proc -- + {upsert_stmt}: ok -- + {insert_stmt}: ok -- + {upsert_update}: ok -- + {conflict_target}: excluded: { a: integer notnull, b: text, c: real, d: longint } -- - Error create proc upsert_conflict_target_columns_valid() begin insert into simple_ak_table_2(a, b, c, d) values(1, "t", 1.7, 1) on conflict(a, b) do nothing; end; -- TEST: enforce strict upsert statement -- + @ENFORCE_STRICT UPSERT STATEMENT; -- + {enforce_strict_stmt}: ok -- + {int 4} -- - Error @enforce_strict upsert statement; -- TEST: upsert statement failed validation in strict mode -- + {upsert_stmt}: err -- + Error % upsert statement are forbidden if strict upsert statement mode is enabled -- +1 Error insert into bar(id) values(1) on conflict do nothing; -- TEST: enforcement normal upsert statement -- + @ENFORCE_NORMAL UPSERT STATEMENT; -- + {enforce_normal_stmt}: ok -- + {int 4} @enforce_normal upsert statement; -- TEST: upsert statement succeed validation in normal mode -- + {upsert_stmt}: ok -- - Error insert into bar(id) values(1) on conflict do nothing; -- TEST: enforce strict window function -- + @ENFORCE_STRICT WINDOW FUNCTION; -- + {enforce_strict_stmt}: ok -- + {int 5} -- - Error @enforce_strict window function; -- TEST: window function invocaction failed validation in strict mode -- + {window_func_inv}: err -- + Error % window function invocation are forbidden if strict window function mode is enabled -- +1 Error select id, rank() over () from foo; -- TEST: enforcement normal window function -- + @ENFORCE_NORMAL WINDOW FUNCTION; -- + {enforce_normal_stmt}: ok -- + {int 5} @enforce_normal window function; -- TEST: window function invocation succeed validation in normal mode -- + {window_func_inv}: integer notnull -- - Error select id, rank() over () from foo; -- TEST: min/max may not appear outside of a SQL statement -- (there is no codegen support for this, though it could be added) -- the code path for min an max is identical so one test suffices -- + {assign}: err -- + {call}: err -- + Error % function may not appear in this context 'max' set X := max(1,2); -- TEST: substr may not appear outside of a SQL statement -- (there is no codegen support for this, though it could be added) -- + {assign}: err -- + {call}: err -- + Error % function may not appear in this context 'substr' set a_string := substr('x', 1, 2); -- TEST: simple success -- substr not nullable string -- + {create_proc_stmt}: select: { t: text notnull } dml_proc -- + {name substr}: text notnull -- - Error create proc substr_test_notnull(t text not null) begin select substr(t, 1, 2) as t ; end; -- TEST: simple success -- substr not nullable string one arg -- + {create_proc_stmt}: select: { t: text notnull } dml_proc -- + {name substr}: text notnull -- - Error create proc substr_test_onearg(t text not null) begin select substr(t, 1) as t ; end; -- TEST: simple success -- substr nullable string -- + {create_proc_stmt}: select: { t: text } dml_proc -- + {name substr}: text -- - Error create proc substr_test_nullable(t text) begin select substr(t, 1, 2) as t; end; -- TEST: simple success -- substr sensitive string -- + {create_proc_stmt}: select: { t: text sensitive } dml_proc -- + {name substr}: text sensitive -- - Error create proc substr_test_sensitive(t text @sensitive) begin select substr(t, 1, 2) as t; end; -- TEST: substr error -- arg1 is not a string -- + {create_proc_stmt}: err -- + {select_stmt}: err -- + {call}: err -- + Error % first argument must be a string in function 'substr' -- +1 Error create proc substr_test_notstring() begin select substr(3, 1, 2); end; -- TEST: substr error -- arg2 is not a number -- + {create_proc_stmt}: err -- + {select_stmt}: err -- + {call}: err -- + Error % argument must be numeric 'substr' -- +1 Error create proc substr_test_arg2string() begin select substr('x', '1', 2); end; -- TEST: substr error -- arg3 is not a number -- + {create_proc_stmt}: err -- + {select_stmt}: err -- + {call}: err -- + Error % argument must be numeric 'substr' -- +1 Error create proc substr_test_arg3string() begin select substr('x', 1, '2'); end; -- TEST: substr error -- too few arguments -- + {create_proc_stmt}: err -- + {select_stmt}: err -- + {call}: err -- + Error % function got incorrect number of arguments 'substr' -- +1 Error create proc substr_test_toofew() begin select substr('x'); end; -- TEST: substr error -- too many arguments -- + {create_proc_stmt}: err -- + {select_stmt}: err -- + {call}: err -- + Error % function got incorrect number of arguments 'substr' -- +1 Error create proc substr_test_toomany() begin select substr('x', 1, 2, 4); end; -- TEST: The replace function requires exactly three arguments, not two. -- + {select_stmt}: err -- + {call}: err -- + Error % function got incorrect number of arguments 'replace' -- +1 Error select replace('a', 'b'); -- TEST: The replace function requires exactly three arguments, not four. -- + {select_stmt}: err -- + {call}: err -- + Error % function got incorrect number of arguments 'replace' -- +1 Error select replace('a', 'b', 'c', 'd'); -- TEST: The replace function can only be used in SQL. -- + {call}: err -- Error % function may not appear in this context 'replace' -- +1 Error let dummy := replace('a', 'b', 'c'); -- TEST: The first argument to replace must be a string. -- + {select_stmt}: err -- + {call}: err -- + Error % all arguments must be strings 'replace' -- +1 Error select replace(0, 'b', 'c'); -- TEST: The second argument to replace must be a string. -- + {select_stmt}: err -- + {call}: err -- + Error % all arguments must be strings 'replace' -- +1 Error select replace('a', 0, 'c'); -- TEST: The third argument to replace must be a string. -- + {select_stmt}: err -- + {call}: err -- + Error % all arguments must be strings 'replace' -- +1 Error select replace('a', 'b', 0); -- TEST: The replace function has a TEXT NOT NULL result type if ALL of its -- arguments are nonnull. -- + {select_stmt}: select: { _anon: text notnull } -- + {call}: text notnull -- + {name replace}: text notnull -- - Error select replace('a', 'b', 'c'); -- TEST: The replace function has a nullable TEXT result type if its first -- argument is nullable. -- + {select_stmt}: select: { _anon: text } -- + {call}: text -- + {name replace}: text -- - Error select replace(nullable('a'), 'b', 'c'); -- TEST: The replace function has a nullable TEXT result type if its second -- argument is nullable. -- + {select_stmt}: select: { _anon: text } -- + {call}: text -- + {name replace}: text -- - Error select replace('a', nullable('b'), 'c'); -- TEST: The replace function has a nullable TEXT result type if its third -- argument is nullable. -- + {select_stmt}: select: { _anon: text } -- + {call}: text -- + {name replace}: text -- - Error select replace('a', 'b', nullable('c')); -- TEST: The first argument to replace must not be the literal NULL. -- + {select_stmt}: err -- + {call}: err -- + Error % all arguments must be strings 'replace' -- +1 Error select replace(null, 'b', 'c'); -- TEST: The second argument to replace must not be the literal NULL. -- + {select_stmt}: err -- + {call}: err -- + Error % all arguments must be strings 'replace' -- +1 Error select replace('a', null, 'c'); -- TEST: The third argument to replace must not be the literal NULL. -- + {select_stmt}: err -- + {call}: err -- + Error % all arguments must be strings 'replace' -- +1 Error select replace('a', 'b', null); -- TEST: The result of replace is sensitive if its first argument is sensitive. -- + {select_stmt}: select: { _anon: text notnull sensitive } -- + {call}: text notnull sensitive -- + {name replace}: text notnull sensitive -- - Error select replace(sensitive('a'), 'b', 'c'); -- TEST: The result of replace is sensitive if its second argument is sensitive. -- + {select_stmt}: select: { _anon: text notnull sensitive } -- + {call}: text notnull sensitive -- + {name replace}: text notnull sensitive -- - Error select replace('a', sensitive('b'), 'c'); -- TEST: The result of replace is sensitive if its third argument is sensitive. -- + {select_stmt}: select: { _anon: text notnull sensitive } -- + {call}: text notnull sensitive -- + {name replace}: text notnull sensitive -- - Error select replace('a', 'b', sensitive('c')); -- TEST: create ad hoc version migration -- success -- + {schema_ad_hoc_migration_stmt}: ok -- + {version_annotation} -- + {int 5} -- + {name MyAdHocMigration} -- - Error @schema_ad_hoc_migration(5, MyAdHocMigration); -- TEST: create ad hoc version migration -- bogus name -- + Error % the name of a migration procedure may not end in '_crc' 'not_allowed_crc' -- +1 Error @schema_ad_hoc_migration(5, not_allowed_crc); -- TEST: create ad hoc version migration -- duplicate proc -- + {schema_ad_hoc_migration_stmt}: err -- + Error % a procedure can appear in only one annotation 'MyAdHocMigration' -- +1 Error @schema_ad_hoc_migration(5, MyAdHocMigration); -- TEST: create ad hoc version migration -- missing proc -- + {schema_ad_hoc_migration_stmt}: err -- + Error % ad hoc schema migration directive must provide a procedure to run -- +1 Error @schema_ad_hoc_migration(2); -- make a test table for the upsert test with a pk and some columns create table upsert_test( id integer primary key, name text, rate real); -- TEST: use the excluded version of the names in an upsert -- + {upsert_stmt}: ok -- + {insert_stmt}: ok -- + {name upsert_test}: upsert_test: { id: integer notnull primary_key, name: text, rate: real } -- + {conflict_target}: excluded: { id: integer notnull, name: text } -- + {update_stmt}: upsert_test: { id: integer notnull primary_key, name: text, rate: real } -- - Error insert into upsert_test(id, name) values(1, 'name') on conflict(id) do update set name = excluded.name, rate = id+1; -- TEST: upsert statement with insert default values -- + {upsert_stmt}: err -- + {insert_stmt}: err -- + {name_columns_values} -- + {name foo}: foo: { id: integer notnull primary_key autoinc } -- + {default_columns_values} -- + {upsert_update} -- + {conflict_target} -- +1 Error % the upsert-clause is not compatible with DEFAULT VALUES -- + Error insert into foo default values on conflict do nothing; -- TEST declare a value fetcher that doesn't use DML -- + {declare_proc_stmt}: val_fetch: { id: text } uses_out -- - dml_proc -- + DECLARE PROC val_fetch (seed INTEGER NOT NULL) OUT (id TEXT); -- - USING TRANSACTION DECLARE PROC val_fetch (seed INTEGER NOT NULL) OUT (id TEXT); -- TEST declare a value fetcher that does use DML -- + {declare_proc_stmt}: val_fetch_dml: { id: text } dml_proc uses_out -- + DECLARE PROC val_fetch_dml (seed INTEGER NOT NULL) OUT (id TEXT) USING TRANSACTION; DECLARE PROC val_fetch_dml (seed INTEGER NOT NULL) OUT (id TEXT) USING TRANSACTION; -- TEST: declare a valid root deployable region -- + {declare_deployable_region_stmt}: root_deployable_region: region deployable -- + {name root_deployable_region} -- - Error @declare_deployable_region root_deployable_region; -- TEST: create an error in a deployoable region (duplicate name) -- + {declare_deployable_region_stmt}: err -- + Error % schema region already defined 'root_deployable_region' -- +1 Error @declare_deployable_region root_deployable_region; -- TEST: a simple leaves to use -- + {declare_schema_region_stmt}: leaf1: region -- - Error @declare_schema_region leaf1; -- + {declare_schema_region_stmt}: leaf2: region -- - Error @declare_schema_region leaf2; -- + {declare_schema_region_stmt}: leaf3: region -- - Error @declare_schema_region leaf3; -- TEST: this looks ok but leaf region will be subsumed later... so we will create an error later -- + {declare_schema_region_stmt}: err -- This node won't be an error when it's created, the error is emitted later when uses_leaf_3 is declared so no error message yet -- The node does ultimately resolve into an error -- - Error at @declare_schema_region pending_leaf_user using leaf3; -- TEST leaf region is claimed, this makes pending_leaf_user in error -- + {declare_deployable_region_stmt}: err -- + Error % region links into the middle of a deployable region; you must point to the root of 'uses_leaf_3' not into the middle: 'pending_leaf_user' -- +1 Error @declare_deployable_region uses_leaf_3 using leaf3; -- TEST: declare a valid deployable region with dependencies -- + {declare_deployable_region_stmt}: depl1: region deployable -- + {name depl1} -- + {name leaf1} -- + {name leaf2} -- - Error @declare_deployable_region depl1 using leaf1, leaf2; -- TEST: make a region that links into into the middle of outer_deployable_region -- + Error % region links into the middle of a deployable region; you must point to the root of 'depl1' not into the middle: 'error_region' -- +1 Error at @declare_schema_region error_region using leaf1; -- TEST: this is a procedure that emits several rows "manually" -- + {create_proc_stmt}: C: select: { A: integer notnull, B: integer notnull } variable dml_proc shape_storage uses_out_union value_cursor -- +2 {out_union_stmt}: C: select: { A: integer notnull, B: integer notnull } variable shape_storage value_cursor -- - Error create proc many_row_emitter() begin declare C cursor like out_cursor_proc; fetch C from call out_cursor_proc(); out union C; out union C; end; -- TEST: compound selects are allowed as a select expression, they can still return one row -- + {create_proc_stmt}: ok dml_proc -- + {assign}: x: integer variable -- + {name x}: x: integer variable -- + {select_stmt}: _anon: integer notnull -- + {select_core_compound} -- + {int 1} -- - Error create proc compound_select_expr() begin declare x integer; set x := (select 1 where 0 union select 2 limit 1); end; -- TEST: declare a region with a private interior -- + {declare_schema_region_stmt}: region_hiding_something: region -- + | {name region_hiding_something} -- + | {region_list} -- + | {region_spec} -- + | {name depl1} -- + | {int 1} -- - Error @declare_schema_region region_hiding_something using depl1 private; -- TEST: declare a region with non-private interior -- + {declare_schema_region_stmt}: region_not_hiding_something: region -- + | {name region_not_hiding_something} -- + | {region_list} -- + | {region_spec} -- + | {name depl1} -- + | {int 0} -- - Error @declare_schema_region region_not_hiding_something using depl1; -- - Error @enforce_normal foreign key on update; -- - Error @enforce_normal foreign key on delete; -- test regions the innermost one here "private_region" can't be reached from client_region -- - Error @declare_schema_region private_region; -- - Error @declare_schema_region containing_region using private_region private; -- - Error @declare_schema_region client_region using containing_region; -- - Error @begin_schema_region private_region; -- - Error create table private_region_table(id integer primary key); -- - Error @end_schema_region; -- - Error @begin_schema_region containing_region; -- - Error create table containing_region_table(id integer primary key references private_region_table(id)); -- - Error @end_schema_region; -- - Error @begin_schema_region client_region; -- TEST : not able to access private region -- + {create_table_stmt}: err -- + Error % (object is in schema region 'private_region' not accessible from region 'client_region') 'private_region_table' -- +1 Error create table client_region_table_1(id integer primary key references private_region_table(id)); -- TEST: non-private table is good to go -- + {create_table_stmt}: client_region_table_2: { id: integer notnull primary_key foreign_key } -- + {fk_target_options} -- + | {fk_target} -- + | | {name containing_region_table} -- - Error create table client_region_table_2(id integer primary key references containing_region_table(id)); -- - Error @end_schema_region; -- TEST: explain not supported -- + {explain_stmt}: err -- + {int 1} -- + Error % Only [EXPLAIN QUERY PLAN ...] statement is supported -- +1 Error explain select 1; -- TEST: explain query plan with select -- + {explain_stmt}: explain_query: { iselectid: integer notnull, iorder: integer notnull, ifrom: integer notnull, zdetail: text notnull } -- + {int 2} -- + {select_stmt}: select: { id: integer notnull, id: integer notnull, name: text, rate: longint } -- - Error explain query plan select * from foo inner join bar where foo.id = 1; -- TEST: explain query plan with update -- + {explain_stmt}: explain_query: { iselectid: integer notnull, iorder: integer notnull, ifrom: integer notnull, zdetail: text notnull } -- + {int 2} -- + {update_stmt}: bar: { id: integer notnull, name: text, rate: longint } -- - Error explain query plan update bar set id = 1 where name = 'Stella'; -- TEST: explain query plan with incorrect select stmt -- + {explain_stmt}: err -- + {int 2} -- + {select_stmt}: err -- + Error % name not found 'bogus' -- +1 Error explain query plan select bogus; -- TEST: explain query plan as result set of a proc -- + {create_proc_stmt}: explain_query: { iselectid: integer notnull, iorder: integer notnull, ifrom: integer notnull, zdetail: text notnull } dml_proc -- + {name explain_query}: explain_query: { iselectid: integer notnull, iorder: integer notnull, ifrom: integer notnull, zdetail: text notnull } -- + {explain_stmt}: explain_query: { iselectid: integer notnull, iorder: integer notnull, ifrom: integer notnull, zdetail: text notnull } -- + {int 2} -- - Error create proc explain_query() begin explain query plan select 1; end; -- TEST: explain query plan cursor -- + {declare_cursor}: c: explain_query: { iselectid: integer notnull, iorder: integer notnull, ifrom: integer notnull, zdetail: text notnull } variable -- + {name c}: c: explain_query: { iselectid: integer notnull, iorder: integer notnull, ifrom: integer notnull, zdetail: text notnull } variable -- + {explain_stmt}: explain_query: { iselectid: integer notnull, iorder: integer notnull, ifrom: integer notnull, zdetail: text notnull } -- + {int 2} -- - Error declare c cursor for explain query plan select * from foo inner join bar; -- TEST: explain query plan cursor in proc -- + {create_proc_stmt}: ok dml_proc -- + {name explain_query_with_cursor}: ok dml_proc -- + {declare_cursor}: c: explain_query: { iselectid: integer notnull, iorder: integer notnull, ifrom: integer notnull, zdetail: text notnull } variable dml_proc -- + {name c}: c: explain_query: { iselectid: integer notnull, iorder: integer notnull, ifrom: integer notnull, zdetail: text notnull } variable dml_proc shape_storage -- + {explain_stmt}: explain_query: { iselectid: integer notnull, iorder: integer notnull, ifrom: integer notnull, zdetail: text notnull } -- + {int 2} -- - Error create proc explain_query_with_cursor() begin declare c cursor for explain query plan select 1; fetch c; end; -- TEST: test nullability result on column X in a union select -- + {select_stmt}: union_all: { X: text } -- + {select_core_list}: union_all: { X: text } -- + {select_core}: select: { X: text notnull } -- + {select_core_list}: select: { X: null } -- + {select_core}: select: { X: null } select "x" as X union all select null as X; -- TEST: test nullability result on column X in a union select without alias -- + {create_proc_stmt}: union_all: { X: text } dml_proc -- + {name mixed_union}: union_all: { X: text } dml_proc -- + {select_stmt}: union_all: { X: text } -- + {select_core_list}: union_all: { X: text } -- + {select_core}: select: { X: text notnull } -- + {select_core_list}: select: { X: null } -- + {select_core}: select: { X: null } create proc mixed_union() begin select "x" X union all select null X; end; -- TEST: test nullability result on column X in a union select without alias -- + {create_proc_stmt}: select: { X: text } dml_proc -- + {name mixed_union_cte}: select: { x: text } -- + {with_select_stmt}: select: { X: text } -- + {select_stmt}: union_all: { X: text } -- + {select_core_list}: union_all: { X: text } -- + {select_core}: select: { X: text notnull } -- + {select_core_list}: select: { X: null } -- + {select_core}: select: { X: null } -- + {select_stmt}: select: { x: text } -- + {select_core_list}: select: { x: text } create proc mixed_union_cte() begin with core(x) as ( select "x" X union all select null X ) select * from core; end; -- TEST: select with a basic window function invocation -- + {select_stmt}: select: { id: integer notnull, row_num: integer notnull } -- + {select_expr}: row_num: integer notnull -- + {window_func_inv}: integer notnull -- + {call}: integer notnull -- + {name row_number}: integer notnull -- + {call_filter_clause} -- + {window_defn}: ok -- + {opt_as_alias} -- + {name row_number} -- - Error select id, row_number() over () as row_num from foo; -- TEST: window function invocation like regular function -- + {select_stmt}: err -- + {select_expr}: err -- + {call}: err -- + Error % function may not appear in this context 'row_number' -- + Error select id, row_number() as row_num from foo; -- TEST: window function invocation outside [SELECT expr] statement -- + {select_stmt}: err -- + {select_from_etc}: err -- + {opt_where}: err -- + {window_func_inv}: err -- + {call} -- + Error % Window function invocations can only appear in the select list of a select statement -- + Error select 1 where row_number() over (); -- TEST: test invalid number of argument on window function row_number() -- + {select_stmt}: err -- + {window_func_inv}: err -- + {call}: err -- + {name row_number}: err -- + {select_from_etc}: TABLE { foo: foo } -- + Error % function got incorrect number of arguments 'row_number' -- + Error select id, row_number(1) over () as row_num from foo; -- TEST: window function invocatin with a window clause -- + {select_stmt}: select: { id: integer notnull, _anon: integer notnull, _anon: integer notnull } -- + {select_expr}: integer notnull -- +2 {window_func_inv}: integer notnull -- +2 {call}: integer notnull -- +2 {name row_number}: integer notnull -- +2 {call_filter_clause} -- + {name win1} -- + {name win2} -- + {opt_select_window}: ok -- + {window_clause}: ok -- +2 {window_name_defn_list} -- +2 {window_name_defn}: ok -- + {name win1} -- + {name win2} -- +2 {window_defn}: ok -- - Error select id, row_number() over win1, row_number() over win2 from foo window win1 as (), win2 as () order by id; -- TEST: test invalid window name -- + {select_stmt}: err -- + {window_func_inv}: err -- + {call_filter_clause} -- + {name bogus}: err -- + Error % Window name is not defined 'bogus' -- + Error select id, row_number() over bogus from foo; -- TEST: test window name definition not used -- + {select_stmt}: err -- + {opt_select_window}: err -- + {window_clause}: err -- + {window_name_defn}: err -- + {name win}: err -- + {window_defn} -- + Error % Window name definition is not used 'win' -- + Error select id from foo window win as (); -- TEST: test filter clause in window function invocation -- + {select_stmt}: select: { id: integer notnull, row_num: text } -- + {select_expr}: row_num: text -- + {window_func_inv}: text -- + {call}: text -- + {name group_concat}: text -- + {arg_list}: ok -- + {name id}: id: integer notnull -- + {arg_list} -- + {strlit '.'}: text notnull -- + {call_filter_clause} -- + {opt_filter_clause}: bool notnull -- + {opt_where}: bool notnull -- + {ge}: bool notnull -- + {name id}: id: integer notnull -- + {int 99}: integer notnull -- + {window_defn}: ok -- + {opt_as_alias} -- + {name row_num} -- - Error select id, group_concat(id, '.') filter (where id >= 99) over () as row_num from foo; -- TEST: test filter clause do not support referencing on alias column -- + {select_stmt}: err -- + {select_expr}: err -- + {window_func_inv}: err -- + {call}: err -- + {name avg} -- + {arg_list} -- + {name id} -- + {call_filter_clause} -- + {opt_filter_clause}: err -- + {opt_where}: err -- + {eq}: err -- + {name alias}: err -- + Error % name not found 'alias' -- + Error select id as alias, avg(id) filter (where alias = 0) over () from foo; -- TEST: test FILTER clause may only be used with aggregate window functions -- + {select_stmt}: err -- + {window_func_inv}: err -- + {call}: err -- + {name row_number} -- + Error % function may not appear in this context 'row_number' -- + Error select 1, row_number() filter (where 1) over (); -- TEST: test partition by grammar -- + {select_stmt}: select: { id: integer notnull, _anon: integer notnull } -- + {window_func_inv}: integer notnull -- + {call_filter_clause} -- + {window_defn}: ok -- + {opt_partition_by}: ok -- + {expr_list} -- + {name id}: id: integer notnull -- - Error select id, row_number() over (partition by id) from foo; -- TEST: test order by grammar -- + {select_stmt}: select: { id: integer notnull, _anon: integer notnull } -- + {window_func_inv}: integer notnull -- + {call_filter_clause} -- + {window_defn}: ok -- + {opt_orderby}: ok -- + {groupby_list}: ok -- + {name id}: id: integer notnull -- - Error select id, row_number() over (order by id asc) from foo; -- TEST: test order by bogus value -- + {select_stmt}: err -- + {window_func_inv}: err -- + {call_filter_clause} -- + {window_defn}: err -- + {opt_orderby}: err -- + {groupby_list}: err -- + {name bogus}: err -- + Error % name not found 'bogus' -- + Error select id, row_number() over (order by bogus asc) from foo; -- TEST: test frame spec grammar combination -- + {select_stmt}: select: { id: integer notnull, avg: real, _anon: integer notnull } -- + {select_expr}: id: integer notnull -- + {select_expr}: avg: real -- + {select_expr}: integer notnull -- + {window_func_inv}: real -- +2 {opt_frame_spec}: ok -- + {int 131084} -- +2 {expr_list} -- + {window_func_inv}: integer notnull -- + {opt_frame_spec}: ok -- + {int 36994} -- - Error select id, avg(id) filter (where id > 0) over (groups unbounded preceding exclude ties) as avg, row_number() over (rows between id = 1 preceding and id = 45 following exclude current row) from foo; -- TEST: test frame spec grammar combination -- + {select_stmt}: select: { id: integer notnull, _anon: integer notnull } -- + {select_expr}: id: integer notnull -- + {select_expr}: integer notnull -- + {window_func_inv}: integer notnull -- + {opt_frame_spec}: ok -- - Error select id, row_number() over (rows between current row and unbounded following exclude group) from foo; -- TEST: test frame spec grammar combination -- + {select_stmt}: select: { id: integer notnull, _anon: integer notnull } -- + {select_expr}: id: integer notnull -- + {select_expr}: integer notnull -- + {window_func_inv}: integer notnull -- + {opt_frame_spec}: ok -- - Error select id, row_number() over (rows id > 0 preceding exclude ties) from foo; -- TEST: test frame spec grammar with bogus expr -- + {select_stmt}: err -- + {select_expr}: err -- + {window_func_inv}: err -- + {opt_frame_spec}: err -- + {name bogus}: err -- + Error % name not found 'bogus' -- + Error select id, row_number() over (rows bogus = null preceding exclude ties) from foo; -- TEST: test rank() window function -- + {select_stmt}: select: { id: integer notnull, _anon: integer notnull } -- + {select_expr}: integer notnull -- + {window_func_inv}: integer notnull -- + {call}: integer notnull -- + {name rank}: integer notnull -- - Error select id, rank() over () from foo; -- TEST: test dense_rank() window function -- + {select_stmt}: select: { id: integer notnull, _anon: integer notnull } -- + {select_expr}: integer notnull -- + {window_func_inv}: integer notnull -- + {call}: integer notnull -- + {name dense_rank}: integer notnull -- - Error select id, dense_rank() over () from foo; -- TEST: test percent_rank() window function -- + {select_stmt}: select: { id: integer notnull, _anon: real notnull } -- + {select_expr}: real notnull -- + {window_func_inv}: real notnull -- + {call}: real notnull -- + {name percent_rank}: real notnull -- - Error select id, percent_rank() over () from foo; -- TEST: test cume_dist() window function -- + {select_stmt}: select: { id: integer notnull, _anon: real notnull } -- + {select_expr}: real notnull -- + {window_func_inv}: real notnull -- + {call}: real notnull -- + {name cume_dist}: real notnull -- - Error select id, cume_dist() over () from foo; -- TEST: test ntile() window function -- + {select_stmt}: select: { id: integer notnull, _anon: integer notnull } -- + {select_expr}: integer notnull -- + {window_func_inv}: integer notnull -- + {call}: integer notnull -- + {name ntile}: integer notnull -- + {int 7}: integer notnull -- - Error select id, ntile(7) over () from foo; -- TEST: test ntile() window function with a non integer param -- + {select_stmt}: err -- + {select_expr}: err -- + {window_func_inv}: err -- + {call}: err -- + {name ntile} -- + {longint 9898989889989}: longint notnull -- + Error % Argument must be an integer (between 1 and max integer) in function 'ntile' -- +1 Error select id, ntile(9898989889989) over () from foo; -- TEST: test ntile() window function with invalid int param -- + {select_stmt}: err -- + {select_expr}: err -- + {window_func_inv}: err -- + {call}: err -- + {name ntile} -- + {arg_list}: err -- + {int 0}: integer notnull -- + Error % Argument must be an integer (between 1 and max integer) in function 'ntile' -- +1 Error select id, ntile(0) over () from foo; -- TEST: test ntile() window function with too many params -- + {select_stmt}: err -- + {select_expr}: err -- + {window_func_inv}: err -- + {call}: err -- + {name ntile} -- + {arg_list}: -- + {int 1}: integer notnull -- + {int 2}: integer notnull -- + Error % function got incorrect number of arguments 'ntile' -- +1 Error select id, ntile(1, 2) over () from foo; -- TEST: test ntile() window function outside window context -- + {select_stmt}: err -- + {select_where} -- + {opt_where}: err -- + {call}: err -- + {name ntile} -- + {int 7}: integer notnull -- + Error % function may not appear in this context 'ntile' -- +1 Error select id from foo where ntile(7); -- TEST: test lag() window function -- + {select_stmt}: select: { id: integer notnull, id: integer notnull } -- + {select_expr}: id: integer notnull -- + {window_func_inv}: id: integer notnull -- + {call}: id: integer notnull -- + {name lag}: id: integer notnull -- + {arg_list}: ok -- + {name id}: id: integer notnull -- + {int 1}: integer notnull -- + {int 0}: integer notnull -- - Error select id, lag(id, 1, 0) over () from foo; -- TEST: kind not compatible in lag between arg3 and arg1 -- + {select_stmt}: err -- + Error % expressions of different kinds can't be mixed: 'dollars' vs. 'some_key' -- + Error % The first and third arguments must be compatible in function 'lag' -- +2 Error select lag(cost, 1, id) over () from with_kind; -- TEST lag with non integer offset -- + {select_stmt}: err -- + Error % The second argument must be an integer (between 0 and max integer) in function 'lag' -- +1 Error select id, lag(id, 1.3, 0) over () from foo; -- TEST: test lag() window function with non constant index (this is ok) -- + {select_stmt}: select: { id: integer notnull, id: integer notnull } -- - Error select id, lag(id, X, 0) over () from foo; -- TEST: test lag() window function with lag() nullable even though id is not nullable -- + {select_stmt}: select: { id: integer notnull, id: integer } -- + {select_expr}: id: integer -- + {window_func_inv}: id: integer -- + {call}: id: integer -- + {name lag}: id: integer -- + {arg_list}: ok -- + {name id}: id: integer notnull -- + {int 1}: integer notnull -- - Error select id, lag(id, 1) over () from foo; -- TEST: test lag() window function with first param sensitive -- + {select_stmt}: select: { id: integer, info: integer sensitive } -- + {select_expr}: info: integer sensitive -- + {window_func_inv}: info: integer sensitive -- + {call}: info: integer sensitive -- + {name lag}: info: integer sensitive -- + {arg_list}: ok -- + {name info}: info: integer sensitive -- + {int 1}: integer notnull -- - Error select id, lag(info, 1) over () from with_sensitive; -- TEST: test lag() window function with third param sensitive -- + {select_stmt}: select: { id: integer, _anon: integer sensitive } -- + {select_expr}: integer -- + {window_func_inv}: integer sensitive -- + {call}: integer sensitive -- + {arg_list}: ok -- + {mul}: integer -- + {int 1}: integer notnul -- + {name info}: info: integer sensitive -- - Error select id, lag(id * 3, 1, info) over () from with_sensitive; -- TEST: test lag() window function with negative integer param -- + {select_stmt}: err -- + {select_expr}: err -- + {window_func_inv}: err -- + {call}: err -- + {name lag} -- + {arg_list}: err -- + Error % Argument must be an integer (between 0 and max integer) in function 'lag' -- +1 Error select id, lag(id, -1) over () from foo; -- TEST: test lag() window function with invalid first param -- + {select_stmt}: err -- + {select_expr}: err -- + {window_func_inv}: err -- + {call}: err -- + {name lag} -- + {arg_list}: err -- + Error % right operand cannot be a string in '|' -- +1 Error select id, lag(id | " ") over () from foo; -- TEST: test lag() window function with first and third param are not same type -- + {select_stmt}: err -- + {select_expr}: err -- + {window_func_inv}: err -- + {call}: err -- + {name lag} -- + {arg_list}: err -- + Error % The first and third arguments must be compatible in function 'lag' -- +2 Error select id, lag(id, 0, 0.7) over () from foo; -- TEST: test lag() window function with no param -- + {select_stmt}: err -- + {select_expr}: err -- + {window_func_inv}: err -- + {call}: err -- + {name lag} -- + Error % function got incorrect number of arguments 'lag' -- +1 Error select id, lag() over () from foo; -- TEST: test lead() window function -- + {select_stmt}: select: { id: integer notnull, id: integer notnull } -- + {select_expr}: id: integer notnull -- + {window_func_inv}: id: integer notnull -- + {call}: id: integer notnull -- + {name lead}: id: integer notnull -- + {arg_list}: ok -- + {name id}: id: integer notnull -- + {int 1}: integer notnull -- + {mul}: integer notnull -- - Error select id, lead(id, 1, id * 3) over () from foo; -- TEST: test first_value() window function -- + {select_stmt}: select: { id: integer notnull, first: integer notnull } -- + {select_expr}: id: integer notnull -- + {window_func_inv}: integer notnull -- + {call}: integer notnull -- + {name first_value}: integer notnull -- + {arg_list}: ok -- + {name id}: id: integer notnull -- - Error select id, first_value(id) over () as first from foo; -- TEST: ensure the kind of the first_value is preserved -- + {select_stmt}: select: { first: integer<some_key> } -- + {window_func_inv}: integer<some_key> -- - Error select first_value(id) over () as first from with_kind; -- TEST: ensure the kind of the first_value is preserved -- + {select_stmt}: select: { last: integer<some_key> } -- + {window_func_inv}: integer<some_key> -- - Error select last_value(id) over () as last from with_kind; -- TEST: ensure the kind of the nth_value is preserved -- + {select_stmt}: select: { nth: integer<some_key> } -- + {window_func_inv}: integer<some_key> -- - Error select nth_value(id, 5) over () as nth from with_kind; -- TEST: test first_value() window function outside window context -- + {select_stmt}: err -- + {select_where} -- + {opt_where}: err -- + {call}: err -- + {name first_value} -- + {int 7}: integer notnull -- + Error % function may not appear in this context 'first_value' -- +1 Error select id from foo where first_value(7); -- TEST: test last_value() window function -- + {select_stmt}: select: { id: integer notnull, last: integer notnull } -- + {select_expr}: id: integer notnull -- + {window_func_inv}: integer notnull -- + {call}: integer notnull -- + {name last_value}: integer notnull -- + {arg_list}: ok -- + {name id}: id: integer notnull -- - Error select id, last_value(id) over () as last from foo; -- TEST: test nth_value() window function -- + {select_stmt}: select: { id: integer notnull, nth: integer } -- + {select_expr}: id: integer -- + {window_func_inv}: integer -- + {call}: integer -- + {name nth_value}: integer -- + {arg_list}: ok -- + {name id}: id: integer notnull -- - Error select id, nth_value(id, 1) over () as nth from foo; -- TEST: test nth_value() window function outside window context -- + {select_stmt}: err -- + {select_where} -- + {opt_where}: err -- + {call}: err -- + {name nth_value} -- + {int 7}: integer notnull -- + Error % function may not appear in this context 'nth_value' -- +1 Error select id from foo where nth_value(7, 1); -- TEST: test nth_value() window function with incorrect number of param -- + {select_stmt}: err -- + {select_expr}: err -- + {window_func_inv}: err -- + {call}: err -- + {name nth_value} -- + Error % function got incorrect number of arguments 'nth_value' -- +1 Error select id, nth_value(id) over () from foo; -- TEST: test nth_value() window function with invalid value on second param -- + {select_stmt}: err -- + {select_expr}: err -- + {window_func_inv}: err -- + {call}: err -- + {name nth_value}: ok -- + {name id}: id: integer notnull -- + {int 0}: integer notnull -- + Error % The second argument must be an integer between 1 and max integer in function 'nth_value' -- +1 Error select id, nth_value(id, 0) over () as nth from foo; -- TEST: try total functions with sensitive param -- + {select_stmt}: select: { t: real notnull sensitive } -- + {name total}: real notnull sensitive -- + {name info}: info: integer sensitive -- - Error select total(info) as t from with_sensitive; -- TEST: combine dummy data and FROM arguments in INSERT -- This is all sugar -- + INSERT INTO referenceable(a, b, c, d, e) VALUES(x, y, printf('c_%d', _seed_), printf('d_%d', _seed_), _seed_) @DUMMY_SEED(1) @DUMMY_NULLABLES; -- - Error create proc insert_using_args_with_dummy(x integer not null, y real not null) begin insert into referenceable(a, b) from arguments @dummy_seed(1) @dummy_nullables; end; -- TEST: combine dummy data and FROM arguments in FETCH -- This is all sugar -- + FETCH C(a, b, c, d, e) FROM VALUES(x, y, printf('c_%d', _seed_), printf('d_%d', _seed_), _seed_) @DUMMY_SEED(1) @DUMMY_NULLABLES; -- - Error create proc fetch_using_args_with_dummy(x integer not null, y real not null) begin declare C cursor like referenceable; fetch C(a,b) from arguments @dummy_seed(1) @dummy_nullables; end; -- TEST: ensure that empty list is expanded -- + FETCH C(a, b, c, d, e) FROM VALUES(1, 2, 'x', 'y', 5); -- - Error create proc fetch_from_empty_col_list() begin declare C cursor like referenceable; fetch C from values(1, 2, 'x', 'y', 5); out C; END; -- we'll need this cursor for the FROM cursor tests declare c_bar cursor like referenceable; -- TEST: verify that we can insert from a match cursor -- This is a sugar feature, so we only need to check the rewrite -- Further semantic validation of the expansion happens normally as though the fields had been typed manually -- + INSERT INTO referenceable(a, b, c, d, e) VALUES(c_bar.a, c_bar.b, c_bar.c, c_bar.d, c_bar.e); -- + {insert_stmt}: ok -- + {name referenceable}: referenceable: { a: integer notnull primary_key, b: real unique_key, c: text, d: text, e: longint } -- - Error insert into referenceable from cursor c_bar; -- TEST: try to use no columns from the cursor -- + {insert_stmt}: err -- + Error % FROM [shape] is redundant if column list is empty -- +1 Error insert into referenceable() from cursor c_bar; -- TEST: try to use a cursor that has no storage (a non automatic cursor) -- + {insert_stmt}: err -- + Error % cannot read from a cursor without fields 'fetch_cursor' -- +1 Error insert into referenceable from cursor fetch_cursor; -- we need this cursor with only one field to test the case where the cursor is too small declare small_cursor cursor like select 1 x; -- TEST: try to use a cursor that has not enough fields -- + {insert_stmt}: err -- + Error % [shape] has too few fields 'small_cursor' -- +1 Error insert into referenceable from cursor small_cursor; -- TEST: try to use something that isn't a cursor -- + {insert_stmt}: err -- + Error % variable is not a cursor 'X' -- +1 Error insert into referenceable from cursor X; -- TEST -- simple use of update cursor statement -- + {update_cursor_stmt}: ok -- + | {name small_cursor}: small_cursor: select: { x: integer notnull } variable shape_storage value_cursor -- + | {columns_values} -- + | {column_spec} -- + | | {name_list} -- + | | {name x}: x: integer notnull -- + | {insert_list} -- + | {int 2}: integer notnull -- - Error update cursor small_cursor(x) from values (2); -- TEST -- wrong type -- + {update_cursor_stmt}: err -- + Error % incompatible types in expression 'x' -- +1 Error update cursor small_cursor(x) from values ('x'); -- TEST -- wrong number of columns -- + {update_cursor_stmt}: err -- + Error % count of columns differs from count of values -- +1 Error update cursor small_cursor(x) from values (1, 2); -- TEST -- invalid column -- + {update_cursor_stmt}: err -- + Error % name not found 'w' -- +1 Error update cursor small_cursor(w) from values (1); -- TEST -- not an auto cursor -- + {update_cursor_stmt}: err -- + Error % cursor was not used with 'fetch [cursor]' 'my_cursor' -- +1 Error update cursor my_cursor(one) from values (2); -- TEST -- like statement can't be resolved in an update statement -- + Error % must be a cursor, proc, table, or view 'not_a_symbol' -- +1 Error update cursor my_cursor(like not_a_symbol) from values(1); -- TEST -- not a cursor -- + {update_cursor_stmt}: err -- + Error % variable is not a cursor 'X' -- +1 Error update cursor X(one) from values (2); -- TEST -- CTE * rewrite -- This is just sugar so all we have to do is verify that we -- did the rewrite correctly -- + foo (a, b, c) AS (SELECT 1 AS a, 'b' AS b, 3.0 AS c) -- + {with_select_stmt}: select: { a: integer notnull, b: text notnull, c: real notnull } -- - Error with foo(*) as (select 1 a, 'b' b, 3.0 c) select * from foo; -- TEST -- CTE * rewrite but some columns were anonymous -- + {with_select_stmt}: err -- + Error % all columns in the select must have a name -- +1 Error with foo(*) as (select 1) select * from foo; -- we never actully make this table, we just use its shape create temp table foo_data ( c1 text not null, c2 integer, c3 real, c4 real, c5 real, c6 real, c7 real, c8 real, c9 real, c10 real ); -- make a cursor on it declare nully_cursor cursor like foo_data; -- TEST: use the "null fill" feature of value cursors to rewrite this monster into valid full row fetch -- + FETCH nully_cursor(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) FROM VALUES('x', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -- + {fetch_values_stmt}: ok -- +10 {insert_list} -- +9 {null}: null -- - Error fetch nully_cursor(c1) from values('x'); -- TEST: the one and only non-null column is missing, that's an error -- + Error % required column missing in FETCH statement 'c1' -- +1 Error -- + {fetch_values_stmt}: err fetch nully_cursor(c2) from values('x'); -- make a small cursor and load it up, it has only 2 of the columns declare c1c7 cursor like select 'x' c1, nullable(3.2) c7; fetch c1c7 from values('x', 3.2); -- TEST: rewrite to use the columns of small cursor -- + UPDATE CURSOR nully_cursor(c1, c7) FROM VALUES(c1c7.c1, c1c7.c7); -- + {update_cursor_stmt}: ok -- - Error update cursor nully_cursor(like c1c7) from values (c1c7.c1, c1c7.c7); -- TEST: full rewrite to use the columns of small cursor -- + UPDATE CURSOR nully_cursor(c1, c7) FROM VALUES(c1c7.c1, c1c7.c7); -- + {update_cursor_stmt}: ok -- - Error update cursor nully_cursor(like c1c7) from cursor c1c7; -- TEST: try to update cursor from a bogus symbol -- + {update_cursor_stmt}: err -- + Error % cursor not found 'not_a_symbol' -- +1 Error update cursor nully_cursor(like c1c7) from cursor not_a_symbol; -- TEST: rewrite to use the columns of small cursor -- note that c7 did not get null and it's out of order, that confirms it came form the LIKE expression -- + FETCH nully_cursor(c1, c7, c2, c3, c4, c5, c6, c8, c9, c10) FROM VALUES(c1c7.c1, c1c7.c7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -- + {fetch_values_stmt}: ok -- - Error fetch nully_cursor(like c1c7) from values (c1c7.c1, c1c7.c7); -- TEST: full rewrite get the values from the cursor, same as above -- + FETCH nully_cursor(c1, c7, c2, c3, c4, c5, c6, c8, c9, c10) FROM VALUES(c1c7.c1, c1c7.c7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -- + {fetch_values_stmt}: ok -- - Error fetch nully_cursor(like c1c7) from cursor c1c7; -- TEST: fetch cursor form bogus cursor -- + {fetch_values_stmt}: err -- + Error % cursor not found 'not_a_symbol' -- +1 Error fetch nully_cursor(like c1c7) from cursor not_a_symbol; -- TEST: fetch using like form -- bogus symbol -- + {fetch_values_stmt}: err -- + Error % must be a cursor, proc, table, or view 'not_a_symbol' -- +1 Error fetch nully_cursor(like not_a_symbol) from values (1, 2); -- make a cursor with some of the bar columns declare id_name_cursor cursor like select 1 id, 'x' name; -- TEST: rewrite the columns of an insert from a cursor source -- + INSERT INTO bar(id, name) VALUES(1, 'x'); -- + {insert_stmt}: ok -- - Error insert into bar(like id_name_cursor) values(1, 'x'); -- TEST: insert using the like form, bogus symbol -- + {insert_stmt}: err -- + Error % must be a cursor, proc, table, or view 'not_a_symbol' -- +1 Error insert into bar(like not_a_symbol) values(1, 'x'); -- TEST: fetch using from a cursor using the like form -- this is sugar, again we just verify the rewrite -- we got a subset of the nully_cursor columns as desired. -- + FETCH c1c7(c1, c7) FROM VALUES(nully_cursor.c1, nully_cursor.c7); -- + {fetch_values_stmt}: ok -- - Error fetch c1c7 from cursor nully_cursor(like c1c7); -- TEST: fetch from cursor using the like form, bogus symbol -- + {fetch_values_stmt}: err -- + Error % must be a cursor, proc, table, or view 'not_a_symbol' -- +1 Error fetch c1c7 from cursor nully_cursor(like not_a_symbol); -- TEST: try to declare a procedure that uses out union -- + DECLARE PROC out_union_user (x INTEGER) OUT UNION (id INTEGER, x TEXT); -- + {declare_proc_stmt}: out_union_user: { id: integer, x: text } uses_out_union -- - Error declare proc out_union_user(x integer) out union (id integer, x text); -- TEST: make a cursor for an externally defined out union func -- + {declare_cursor}: out_union_cursor: out_union_user: { id: integer, x: text } variable uses_out_union -- - Error declare out_union_cursor cursor for call out_union_user(2); -- a table with one sensitive column create table sens_table(t text @sensitive); -- TEST: introduce a declaration for the proc we are about to create, it has a sensitive result. -- + {declare_proc_stmt}: sens_result_proc: { t: text sensitive } dml_proc -- - Error declare proc sens_result_proc () (t text @sensitive); -- TEST this is compatible with the above declaration, it won't be if SENSITIVE is not preserved. -- + {create_proc_stmt}: select: { t: text sensitive } dml_proc -- - Error @attribute(cql:autotest=(dummy_test)) create proc sens_result_proc() begin select * from sens_table; end; -- TEST: simple proc decl declare proc incompatible_result_proc () (t text); -- TEST: this is compatible with the above declaration, it won't be if SENSITIVE is not preserved. -- + Incompatible declarations found -- + Error % in declare_proc_stmt : DECLARE PROC incompatible_result_proc () (t TEXT) -- + Error % in create_proc_stmt : DECLARE PROC incompatible_result_proc () (t INTEGER NOT NULL) -- + The above must be identical. -- + Error % procedure declarations/definitions do not match 'incompatible_result_proc' -- + {create_proc_stmt}: err @attribute(cql:autotest=(dummy_test)) create proc incompatible_result_proc () begin select 1 t; end; -- TEST: use collate in an expression -- + {groupby_item} -- + {collate}: name: text -- + {name name}: name: text -- + {name nocase} -- - Error select * from bar order by name collate nocase; -- TEST: verify collate cannot be used in a loose expression -- + {collate}: err -- + Error % COLLATE may only appear in the context of a SQL statement -- +1 Error set a_string := 'x' collate nocase; -- TEST: Verify error propogation through collate -- + {collate}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error select (not 'x') collate nocase; -- TEST: verify that duplicate table with different "IF NOT EXISTS" is still ok -- + {create_table_stmt}: foo: { id: integer notnull primary_key autoinc } -- + {table_flags_attrs} -- + {int 2} -- - Error create table if not exists foo( id integer PRIMARY KEY AUTOINCREMENT ); -- TEST: verify that duplicate view with different "IF NOT EXISTS" is still ok -- + {create_view_stmt}: MyView: { f1: integer notnull, f2: integer notnull, f3: integer notnull } -- + {int 2} -- - Error create view if not exists MyView as select 1 as f1, 2 as f2, 3 as f3; -- TEST: verify that duplicate trigger with different "IF NOT EXISTS" is still ok -- + {create_trigger_stmt}: ok -- + {int 2} -- - Error create trigger if not exists trigger2 after insert on bar begin delete from bar where rate > new.id; end; -- TEST: verify that duplicate index with different "IF NOT EXISTS" is still ok -- + {create_index_stmt}: ok -- + {int 2} -- - Error create index if not exists index_1 on foo(id); -- TEST: verify blob literal semantic type -- + {select_stmt}: select: { _anon: blob notnull } -- + {blob x'FAB1'}: blob notnull -- - Error select x'FAB1'; -- TEST: verify that blob literals can be copied in a tree copy op -- This sets up a fragment with a blob literal in it that has to be copied -- - Error @attribute(cql:base_fragment=blob_stuff) create proc blob_base_fragment(id_ integer not null) begin with blob_stuff(*) as (select id_ id, x'123456' bl) select * from blob_stuff; end; -- TEST: verify that blob literals can be copied in a tree copy op -- This sets up a fragment with a blob literal in it that has to be copied -- - Error @attribute(cql:extension_fragment=blob_stuff) create proc blob_ext_fragment(id_ integer not null) begin with blob_stuff(*) as (select 1 id, x'123456' bl), blob_ext(*) as (select blob_stuff.*, T2.* from blob_stuff left outer join (select x'abcd' bl2) as T2) select * from blob_ext; end; -- TEST: verify that blob literals can be copied in a tree copy op -- This fragment had to copy blob literals to create this text which verifies the tree copy is ok -- + @ATTRIBUTE(cql:assembly_fragment=blob_stuff) -- + CREATE PROC blob_stuff (id_ INTEGER NOT NULL) -- + BEGIN -- + WITH -- + blob_stuff (id, bl) AS (SELECT id_ AS id, x'123456' AS bl), -- + blob_ext (id, bl, bl2) AS (SELECT blob_stuff.*, T2.* -- + FROM blob_stuff -- + LEFT OUTER JOIN (SELECT x'abcd' AS bl2) AS T2) -- + SELECT * -- + FROM blob_ext; -- + END; -- - Error @attribute(cql:assembly_fragment=blob_stuff) create proc blob_stuff(id_ integer not null) begin with blob_stuff(*) as (select 1 id, x'123456' bl) select * from blob_stuff; end; -- TEST: blob literals are good in SQL only -- + {assign}: err -- + {blob x'12abcdef'}: err -- + Error % blob literals may only appear in the context of a SQL statement -- +1 Error create proc blob_literal_out(out b blob) begin set b := x'12abcdef'; end; -- TEST: test nullif with one param -- + {select_stmt}: err -- + {call}: err -- + {name nullif}: err -- + Error % function got incorrect number of arguments 'nullif' -- +1 Error select nullif(id) from bar; -- TEST: test nullif with non null integer column table -- + {select_stmt}: select: { n: integer } -- + {call}: integer -- + {name nullif}: integer -- + {name id}: id: integer notnull -- - Error select nullif(id, 1) as n from bar; -- TEST: kind preserved and matches -- + {select_stmt}: select: { p: real<dollars> variable } -- + {call}: real<dollars> variable -- - Error select nullif(price_d, price_d) as p; -- TEST: kind preserved and doesn't match -> error -- + {select_stmt}: err -- + Error % expressions of different kinds can't be mixed: 'dollars' vs. 'euros' -- +1 Error select nullif(price_d, price_e); -- TEST: test nullif with incompatble type -- + {select_stmt}: err -- + Error % incompatible types in expression 'NULLIF' -- +1 Error select id, nullif(name, 1) from bar; -- TEST: nullif may not appear outside of a SQL statement -- + {assign}: err -- + {call}: err -- + Error % function may not appear in this context 'nullif' set a_string := nullif('x', 1); -- TEST: test nullif with sensitive value -- + {select_stmt}: select: { n: text sensitive } -- + {call}: text sensitive -- + {name nullif}: text sensitive -- + {name name}: name: text sensitive -- - Error select nullif(name, 'a') as n from with_sensitive; -- TEST: declare a select function with name match SQLite function. -- + {declare_select_func_stmt}: err -- + Error % select function does not require a declaration, it is a CQL built-in 'nullif' -- +1 Error declare select function nullif(value INT, defaultValue int not null) int; -- TEST: test upper with sensitive value -- + {select_stmt}: select: { _anon: text sensitive } -- + {call}: text sensitive -- + {name upper}: text sensitive -- + {name name}: name: text sensitive -- - Error select upper(name) from with_sensitive; -- TEST: test upper with incompatible param type -- + {select_stmt}: err -- + {call}: err -- + {name upper} -- + Error % first argument must be a string in function 'upper' -- +1 Error select upper(id) from bar; -- TEST: test upper with incompatible param count -- + {select_stmt}: err -- + {call}: err -- + {name upper} -- + Error % function got incorrect number of arguments 'upper' -- +1 Error select upper(name, 1) from bar; -- TEST: upper may not appear outside of a SQL statement -- + {assign}: err -- + {call}: err -- + Error % function may not appear in this context 'upper' set a_string := upper('x'); -- TEST: test char with sensitive value -- + {select_stmt}: select: { c: text sensitive } -- + {call}: text sensitive -- + {name char}: text sensitive -- + {name id}: id: integer -- + {name info}: info: integer sensitive -- - Error select char(id, info) as c from with_sensitive; -- TEST: test char with incompatible param type -- + {select_stmt}: err -- + {call}: err -- + {name name}: name: text -- + Error % char function arguments must be integer 'char' -- +1 Error select char(name) from bar; -- TEST: test char with incompatible param count -- + {select_stmt}: err -- + {call}: err -- + Error % function got incorrect number of arguments 'char' -- +1 Error select char() from bar; -- TEST: char may not appear outside of a SQL statement -- + {assign}: err -- + {call}: err -- + Error % function may not appear in this context 'char' set a_string := char(1); -- TEST: test abs with sensitive value -- + {select_stmt}: select: { info: integer sensitive } -- + {call}: info: integer sensitive -- + {name abs}: info: integer sensitive -- + {name info}: info: integer sensitive -- - Error select abs(info) from with_sensitive; -- TEST: abs should preserve kind -- + {assign}: price_d: real<dollars> variable -- + {call}: price_d: real<dollars> variable -- - Error set price_d := (select abs(price_d)); -- TEST: test abs with incompatible param count -- + {select_stmt}: err -- + {call}: err -- + Error % function got incorrect number of arguments 'abs' -- +1 Error select abs() from bar; -- TEST: test abs with non numeric param -- + {select_stmt}: err -- + {call}: err -- + {name abs} -- + Error % argument must be numeric 'abs' -- + Error select abs('Horty'); -- TEST: test abs with null param -- + {select_stmt}: select: { _anon: null } -- + {call}: null -- + {name abs}: null -- - Error select abs(null); -- TEST: instr may not appear outside of a SQL statement -- + {assign}: err -- + {call}: err -- +1 Error % function may not appear in this context 'instr' set an_int := instr(1); -- TEST: test instr with incompatible param count -- + {select_stmt}: err -- + {call}: err -- + Error % function got incorrect number of arguments 'instr' -- +1 Error select instr(); -- TEST: test instr with sensitive value -- + {select_stmt}: select: { x: integer sensitive } -- + {call}: integer sensitive -- + {name name}: name: text sensitive -- - Error select instr(name, 'a') as x from with_sensitive; -- TEST: test instr with all param not null -- + {select_stmt}: select: { _anon: integer notnull } -- + {call}: integer notnull -- +2 {strlit 'a'}: text notnull -- - Error select instr('a', 'a'); -- TEST: test instr with all param not null -- + {select_stmt}: err -- + {call}: err -- + {name instr} -- + Error % CQL0085: all arguments must be strings 'instr' -- +1 Error select instr(1, 'a'); -- TEST: you can use other literal types as values, they are just ignored -- This is not a valid base fragment, it just gets normal processing -- if it were a base fragment it would be full of errors. -- + {create_proc_stmt}: ok -- - Error @attribute(cql:base_fragment=1) create proc wonky_value_type(id_ integer) begin declare x integer; end; -- TEST: no mixed or duplicate fragment type annotations are allowed -- + Error % more than one fragment annotation on procedure 'dup_base' -- +1 Error @attribute(cql:base_fragment=foo) @attribute(cql:base_fragment=goo) create proc dup_base(id_ integer) begin declare x integer; end; -- TEST: no mixed or duplicate fragment type annotations are allowed -- + Error % more than one fragment annotation on procedure -- +1 Error @attribute(cql:extension_fragment=foo) @attribute(cql:base_fragment=goo) create proc mixed_frag_types1(id_ integer) begin declare x integer; end; -- TEST: no mixed or duplicate fragment type annotations are allowed -- + Error % more than one fragment annotation on procedure -- +1 Error @attribute(cql:extension_fragment=foo) @attribute(cql:assembly_fragment=goo) create proc mixed_frag_types2(id_ integer) begin declare x integer; end; -- TEST: no mixed or duplicate fragment type annotations are allowed -- + Error % more than one fragment annotation on procedure -- +1 Error @attribute(cql:assembly_fragment=foo) @attribute(cql:base_fragment=goo) create proc mixed_frag_types3(id_ integer) begin declare x integer; end; -- TEST: use the wrong name for the assembly fragment -- + {create_proc_stmt}: err -- + Error % the name of the assembly procedure must match the name of the base fragment 'wrong_assembly_frag_name' -- +1 Error @attribute(cql:assembly_fragment=core) create proc wrong_assembly_frag_name(id_ integer not null) begin with core(x,y,z) as (select id,name,rate from bar where id = id_) select * from core; end; -- TEST: base_fragment attribute, not using '*' (no from clause) -- + Error % fragment must end with exactly 'SELECT * FROM core' -- +1 Error @attribute(cql:base_fragment=core) create proc base_frag_broken_1(id_ integer not null) begin with core(*) as (select * from foo) select 1 x; end; -- TEST: base_fragment attribute, selecting from not a table -- + Error % fragment must end with exactly 'SELECT * FROM core' -- +1 Error @attribute(cql:base_fragment=core) create proc base_frag_broken_2(id_ integer not null) begin with core(*) as (select * from foo) select * from (select 1 x) y; end; -- TEST: enable normal join mode @enforce_normal join; -- TEST: base_fragment attribute, selecting from two tables -- + Error % fragment must end with exactly 'SELECT * FROM core' -- +1 Error @attribute(cql:base_fragment=core) create proc base_frag_broken_3(id_ integer not null) begin with core(*) as (select * from foo) select * from foo, (select 1 xyz); end; -- TEST: base_fragment attribute, selecting from the wrong table -- + Error % fragment must end with exactly 'SELECT * FROM core' -- +1 Error @attribute(cql:base_fragment=core) create proc base_frag_broken_4(id_ integer not null) begin with core(*) as (select * from foo) select * from foo inner join (select 2 x) T; end; -- TEST: refer to non-existent table in an fk -- + {create_table_stmt}: err -- + Error % foreign key refers to non-existent table 'this_table_does_not_exist' -- +1 Error -- the @delete is necessary so that there will be table flags create table bogus_reference_in_fk( col1 text, col2 int, foreign key(col2) references this_table_does_not_exist(col1) on update cascade on delete cascade ) @delete(1); -- TEST: try to call an undeclared proc while in strict mode -- + Error % calls to undeclared procedures are forbidden; declaration missing or typo 'some_external_thing' -- +1 Error call some_external_thing(); -- TEST: let this be usable -- + {declare_proc_no_check_stmt}: ok -- - Error DECLARE PROC some_external_thing NO CHECK; -- TEST: same call in non stict mode -> fine -- - Error call some_external_thing('x', 5.0); -- TEST: unchecked procs cannot be used in expressions (unless re-declared with -- DECLARE FUNCTION or DECLARE SELECT FUNCTION) -- + {call}: err -- + Error % procedure of an unknown type used in an expression -- 'some_external_thing' +1 Error let result_of_some_external_thing := some_external_thing('x', 5.0); -- TEST: re-declare an unchecked proc with DECLARE FUNCTION -- + {declare_func_stmt}: integer -- + {param}: t: text variable in -- + {param}: r: real variable in -- + {type_int}: integer -- - Error declare function some_external_thing(t text, r real) int; -- TEST: works fine after re-declaring -- + {let_stmt}: result_of_some_external_thing: integer variable -- + {call}: integer -- - Error let result_of_some_external_thing := some_external_thing('x', 5.0); -- a proc with a return type for use declare proc _stuff() (id integer, name text); -- TEST: type list base case, simple replacement -- checking the rewrite (that's all that matters here) -- + DECLARE PROC _stuff1 () (id INTEGER, name TEXT); -- - Error declare proc _stuff1() (like _stuff); -- TEST: type list insert in the middle of some other args, and dedupe -- checking the rewrite (that's all that matters here) -- + DECLARE PROC _stuff2 () (h1 INTEGER, id INTEGER, name TEXT, t1 INTEGER); -- - Error declare proc _stuff2() ( h1 integer, like _stuff1, like _stuff, t1 integer); -- TEST: type list insert in the middle of some other args, and dedupe -- checking the rewrite (that's all that matters here) -- + DECLARE PROC _stuff3 () (h2 INTEGER, h1 INTEGER, id INTEGER, name TEXT, t1 INTEGER, t2 INTEGER); -- - Error declare proc _stuff3() ( h2 integer, like _stuff2, t2 integer); -- TEST: try to make a name list from a bogus type -- {declare_proc_stmt}: err -- + Error % must be a cursor, proc, table, or view 'invalid_type_name' -- +1 Error declare proc _stuff4() (like invalid_type_name); -- TEST: rewrite with formal name, formals all duplicated with no qualifier -- + DECLARE PROC _stuff5 () (id INTEGER, name TEXT); -- - Error declare proc _stuff5() (like _stuff1, like _stuff1); -- TEST: rewrite with formal name for each shape -- + DECLARE PROC _stuff6 () (x_id INTEGER, x_name TEXT, y_id INTEGER, y_name TEXT); -- - Error declare proc _stuff6() (x like _stuff1, y like _stuff1); -- TEST: access shape args using dot notation -- + {dot}: x_id: integer variable create proc using_like_shape(x like _stuff1) begin call printf("%s\n", x.id); end; -- TEST: access invald shape args using dot notation -- + Error % field not found in shape 'xyzzy' -- +1 Error create proc using_like_shape_bad_name(x like _stuff1) begin call printf("%s\n", x.xyzzy); end; -- TEST try to pass some of my args along -- + CREATE PROC arg_shape_forwarder (args_arg1 INTEGER, args_arg2 TEXT, extra_args_id INTEGER, extra_args_name TEXT) -- + CALL proc2(args.arg1, args.arg2); -- - Error create proc arg_shape_forwarder(args like proc2 arguments, extra_args like _stuff1) begin call proc2(from args); end; -- create a table in the future -- - Error create table from_the_future( col1 text primary key ) @create(5); -- TEST: trying to reference the future in an FK is an error -- + {create_table_stmt}: err -- + Error % referenced table was created in a later version so it cannot be used in a foreign key 'from_the_future' -- +1 Error create table in_the_past( col1 text, foreign key (col1) references from_the_future(col1) ) @create(4); -- TEST: ok to reference in the same version -- + {create_table_stmt}: in_the_future: { col1: text foreign_key } @create(5) -- - Error create table in_the_future( col1 text, foreign key (col1) references from_the_future(col1) ) @create(5); -- Set up a proc we could call -- - Error declare proc basic_source() out union (id integer, name text); -- TEST: this proc should be OUT not OUT UNION -- + {create_proc_stmt}: C: basic_source: { id: integer, name: text } variable dml_proc shape_storage uses_out -- - {create_proc_stmt}: % uses_out_union -- - Error create proc basic_wrapper_out() begin declare C cursor for call basic_source(); fetch C; out C; end; -- TEST: this proc should be OUT not OUT UNION -- + {create_proc_stmt}: C: basic_source: { id: integer, name: text } variable dml_proc shape_storage uses_out_union -- - {create_proc_stmt}: % uses_out %uses_out_union -- - {create_proc_stmt}: % uses_out_union %uses_out -- - Error create proc basic_wrapper_out_union() begin declare C cursor for call basic_source(); fetch C; out union C; end; -- TEST: simple self reference -- + {create_table_stmt}: self_ref1: { id: integer notnull primary_key, id2: integer foreign_key } -- - Error create table self_ref1( id integer primary key, id2 integer references self_ref1(id) ); -- TEST: simple self reference with constraint notation -- + {create_table_stmt}: self_ref2: { id: integer notnull primary_key, id2: integer foreign_key } -- - Error create table self_ref2( id integer primary key, id2 integer, foreign key (id2) references self_ref2(id) ); -- TEST: refer to a column in myself -- column does not exist -- + {create_table_stmt}: err -- + Error % name not found 'idx' -- +1 Error create table self_ref3( id integer primary key, id2 integer references self_ref3(idx) ); -- TEST: refer to a column in myself -- column does not exist -- via constraint -- + {create_table_stmt}: err -- + Error % name not found 'idx' -- +1 Error create table self_ref4( id integer primary key, id2 integer, foreign key (id2) references self_ref4(idx) ); -- TEST: refer to a column in myself -- column not a key -- via constraint -- + {create_table_stmt}: err -- + Error % the set of columns referenced in the foreign key statement should match exactly a unique key in the parent table 'self_ref5' -- +1 Error create table self_ref5( id integer primary key, id2 integer, foreign key (id2) references self_ref5(id2) ); -- TEST: refer to a table id that isn't a part of a PK/UK via the attribute -- + {create_table_stmt}: err -- + Error % the set of columns referenced in the foreign key statement should match exactly a unique key in the parent table 'self_ref2' -- +1 Error create table fk_to_non_key( id integer references self_ref2(id2) ); -- TEST: make sure we can parse the dummy test params that include null -- + {create_proc_stmt}: select: { id: integer notnull, id2: integer } dml_proc -- + | {null}: ok -- - Error @attribute(cql:autotest=((dummy_test, (self_ref1, (id, id2), (1, null), (2, 1))))) create proc self_ref_proc_table() begin select * from self_ref1; end; -- TEST: test ok_scan_table attribution -- + {stmt_and_attr}: ok -- + {misc_attrs}: ok -- + {name cql} -- + {name ok_table_scan} -- + {name foo}: ok -- - Error @attribute(cql:ok_table_scan=foo) create proc ok_table_scan() begin select * from foo; end; -- TEST: test list of value for ok_scan_table attribution -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {name cql} -- + {name ok_table_scan} -- + {name foo}: ok -- + {int 1}: err -- + Error % ok_table_scan attribute must be a name -- +1 Error @attribute(cql:ok_table_scan=(foo, 1)) create proc ok_table_scan_value() begin select * from foo; end; -- TEST: bogus table name in ok_scan_table attribution -- + misc_attrs}: err -- + {name bogus}: err -- + {name foo} -- Error % the table name in ok_table_scan does not exist 'bogus' -- +1 Error @attribute(cql:ok_table_scan=bogus) @attribute(cql:attr) create proc ok_table_scan_bogus() begin select * from foo; end; -- TEST: bogus integer in ok_scan_table attribution -- + misc_attrs}: err -- + {int 1}: err -- Error % ok_table_scan attribute must be a name -- +1 Error @attribute(cql:ok_table_scan=1) create proc ok_table_scan_value_int() begin select * from foo; end; -- TEST: ok_scan_table attribution not on a create proc statement -- + misc_attrs}: err -- + {select_stmt}: err -- Error % ok_table_scan attribute can only be used in a create procedure statement -- +1 Error @attribute(cql:ok_table_scan=foo) select * from foo; -- TEST: no_scan_table attribution is not on create table node -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {select_stmt}: err -- Error % no_table_scan attribute may only be added to a create table statement -- +1 Error @attribute(cql:no_table_scan) select * from foo; -- TEST: no_scan_table attribution on create table node -- + {stmt_and_attr}: ok -- + {misc_attrs}: ok -- - Error @attribute(cql:no_table_scan) create table no_table_scan(id text); -- TEST: no_scan_table attribution with a value -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {select_stmt}: err -- + {int 1}: err -- Error % a value should not be assigned to no_table_scan attribute -- +1 Error @attribute(cql:no_table_scan=1) select * from foo; -- TEST: test select with values clause -- + {select_stmt}: values: { column1: integer notnull } -- + {select_core_list}: values: { column1: integer notnull } -- + {select_core}: values: { column1: integer notnull } -- + {values}: values: { column1: integer notnull } -- + {int 1}: integer notnull -- - Error values (1); -- TEST: test select with values clause (multi row values) -- + {select_stmt}: values: { column1: integer notnull } -- + {values}: values: { column1: integer notnull } -- + {int 1}: integer notnull -- + {int 5}: integer notnull -- - Error values (1), (5); -- TEST: test sensitive value carry on in values clause -- + {select_stmt}: values: { column1: integer sensitive } -- + {values}: values: { column1: integer sensitive } -- + {name _sens}: _sens: integer variable sensitive -- - Error values (1), (_sens); -- TEST: number of column values not identical in values clause -- + {select_stmt}: err -- + {values}: err -- + {dbl 4.5}: err -- + Error % the number of columns values for each row should be identical in VALUES clause -- +1 Error values (1), (3, 4.5); -- TEST: incompatible types in values clause -- + {select_stmt}: err -- + {values}: err -- + {int 1}: err -- + Error % incompatible types in expression 'VALUES clause' -- +1 Error values ("ok"), (1); -- TEST: test values clause compounded in insert stmt with dummy_seed -- + {insert_stmt}: err -- + Error % @dummy_seed @dummy_nullables @dummy_defaults many only be used with a single VALUES row -- +1 Error insert into foo (id) values (1) union values(2) @dummy_seed(1); -- TEST: test values from a with statement, and seed, this not a supported form -- + {insert_stmt}: err -- + Error % @dummy_seed @dummy_nullables @dummy_defaults many only be used with a single VALUES row -- +1 Error insert into foo with T(x) as (values (1), (2), (3)) select * from T @dummy_seed(1); -- TEST: test values from a with statement, no seed, this is fine. -- + {insert_stmt}: ok -- + {with_select_stmt}: select: { x: integer notnull } insert into foo with T(x) as (values (1), (2), (3)) select * from T; -- TEST: test values from simple select statement, and seed, this not a supported form -- + {insert_stmt}: err -- + Error % @dummy_seed @dummy_nullables @dummy_defaults many only be used with a single VALUES row -- +1 Error insert into foo select 1 @dummy_seed(1); -- TEST: test multi row values in values clause with dummy_seed -- + {insert_stmt}: err -- + Error % @dummy_seed @dummy_nullables @dummy_defaults many only be used with a single VALUES row -- +1 Error insert into foo (id) values (1), (2) @dummy_seed(1); -- TEST: test invalid expr in values clause -- + {insert_stmt}: err -- + {name bogus}: err -- + Error % name not found 'bogus' -- +1 Error insert into foo values (bogus) @dummy_seed(1); -- TEST: test null type expr in values clause with dummy_seed -- + {insert_stmt}: ok -- + {columns_values}: ok -- + {null}: null -- - Error insert into foo values (null) @dummy_seed(1); -- TEST: test incompatible type in values clause with dummy_seed -- + {insert_stmt}: err -- + {strlit 'k'}: err -- + Error % incompatible types in expression 'id' -- +1 Error insert into foo values ("k") @dummy_seed(1); -- TEST: test invalid expr in values clause -- + {select_stmt}: err -- + {values}: err -- + Error % name not found 'l' -- + {name l}: err -- +1 Error values (l); -- TEST: test insert statement with compound select -- + {insert_stmt}: ok -- + {select_stmt}: UNION ALL: { column1: integer notnull } -- + {select_core}: values: { column1: integer notnull } -- + {select_core}: select: { column1: integer notnull } -- - Error insert into foo values (1) union all select 2 column1; -- TEST: test multi row values in values clause with dummy_seed -- + {insert_stmt}: err -- + Error % @dummy_seed @dummy_nullables @dummy_defaults many only be used with a single VALUES row -- +1 Error insert into foo (id) values (1), (2) @dummy_seed(1); -- TEST: number of column in second row is not correct in values clause -- + {select_stmt}: err -- + {values}: err -- + {int 10}: err -- + Error % the number of columns values for each row should be identical in VALUES clause -- +1 Error values (1, 2), (10); -- TEST: test invalid value in second row in values clause -- + {select_stmt}: err -- + {values}: err -- + {strlit 'ok'}: text notnull -- + {name bogus}: err -- + Error % name not found 'bogus' -- +1 Error values ("ok"), (bogus); -- TEST: basic table to test columns in wrong order in the insert statement create table values_table( id integer PRIMARY KEY AUTOINCREMENT, name text ); -- TEST: test columns in wrong order in insert statement. -- + {insert_stmt}: ok -- + {select_stmt}: values: { column1: text notnull, column2: null } insert into values_table(name, id) values ("ok", null); -- TEST: enforce strict without rowid -- + @ENFORCE_STRICT WITHOUT ROWID; -- + {enforce_strict_stmt}: ok -- + {int 7} -- - Error @enforce_strict without rowid; -- TEST: without rowid failed validation in strict mode -- + {create_table_stmt}: err -- + Error % WITHOUT ROWID tables are forbidden if strict without rowid mode is enabled 'table_with_invalid_without_rowid_mode' -- +1 Error create table table_with_invalid_without_rowid_mode( id integer primary key ) without rowid; -- TEST: enforcement normal without rowid -- + @ENFORCE_NORMAL WITHOUT ROWID; -- + {enforce_normal_stmt}: ok -- + {int 7} @enforce_normal without rowid; -- TEST: without rowid succeed validation in normal mode -- + {create_table_stmt}: table_with_valid_without_rowid_mode: { id: integer notnull primary_key } -- - Error create table table_with_valid_without_rowid_mode( id integer primary key ) without rowid; -- TEST: negating 9223372036854775808L requires first representing the positive value -- this value does not fit in 64 bits signed. As a consequence the numeric representation -- of integers cannot just be an int64_t. To avoid all these problems and more we -- simply hold the string value of the integer as the need for math is very limited, nearly zero -- anyway due to lack of constant folding and whatnot. -- the text in the comment has the original string with the L -- the positive version of the integer does not and there is -- no kidding around negation going on here. -- + SELECT -9223372036854775808L AS x; -- + {create_proc_stmt}: select: { x: longint notnull } dml_proc -- + {uminus}: longint notnull -- + {longint 9223372036854775808}: longint notnull CREATE PROC min_int_64_test () BEGIN SELECT -9223372036854775808L AS x; END; -- TEST: complex floating point and integer literals -- first verify round trip through the AST -- + SELECT 2147483647 AS a, 2147483648L AS b, 3.4e11 AS c, .001e+5 AS d, .4e-9 AS e; -- + {int 2147483647}: integer notnull -- + {longint 2147483648}: longint notnull -- + {dbl 3.4e11}: real notnull -- + {dbl .001e+5}: real notnull -- + {dbl .4e-9}: real notnull create proc exotic_literals() begin select 2147483647 a, 2147483648 b, 3.4e11 c, .001e+5 d, .4e-9 e; end; -- TEST: hex literal processing -- + SELECT 0x13aF AS a, 0x234L AS b, 0x123456789L AS c; -- + {int 0x13aF}: integer notnull -- + {longint 0x234}: longint notnull -- + {longint 0x123456789}: longint notnull create proc hex_literals() begin select 0x13aF a, 0x234L b, 0x123456789 c; end; -- a type shape we will use for making args and cursors declare proc shape() (x integer not null, y text not null); -- just one column of the type, we'll use this to call with a slice of the cursor declare proc small_shape() (y text not null); -- some procedure we can call declare proc shape_consumer(like shape); -- TEST: try to call shape_consumer from a suitable cursor -- This is strictly a rewrite so all we have to do here is make sure that we are calling the proc correctly -- + CALL shape_consumer(C.x, C.y); -- - Error create proc shape_all_columns() begin declare C cursor like shape; fetch C from values(1, 'x'); call shape_consumer(from C); end; -- TEST: try to call shape_consumer from not a cursor... -- This is strictly a rewrite so all we have to do here is make sure that we are calling the proc correctly -- + {create_proc_stmt}: err -- + {call_stmt}: err -- + Error % cursor not found 'not_a_cursor' -- +1 Error create proc shape_thing_bogus_cursor() begin call shape_consumer(from not_a_cursor); end; -- TEST: try to call shape_consumer using a statement cursor. This is bogus... -- + {create_proc_stmt}: err -- + {call_stmt}: err -- + Error % Cursor was not used with 'fetch [cursor]' 'C' -- +1 Error create proc shape_some_columns_statement_cursor() begin declare C cursor for select 1 x, 'y' y; call shape_consumer(from C); end; declare proc shape_y_only(like small_shape); -- TEST: try to call shape_y_only using the LIKE form -- This is strictly a rewrite so all we have to do here is make sure that we are calling the proc correctly -- + CALL shape_y_only(C.y); -- - Error create proc shape_some_columns() begin declare C cursor like shape; fetch C(x, y) from values(1, 'x'); call shape_y_only(from C like small_shape); end; -- TEST: try to call shape_y_only using the LIKE form with bogus like name -- + Error % must be a cursor, proc, table, or view 'not_a_real_shape' -- +1 Error create proc shape_some_columns_bogus_name() begin declare C cursor like shape; fetch C(x, y) from values(1, 'x'); call shape_y_only(from C like not_a_real_shape); end; declare proc lotsa_ints(a integer not null, b integer not null, c integer not null, d integer not null); -- TEST: try inserting arguments into the middle of the arg list -- + CALL lotsa_ints(C.x, C.y, 1, 2); -- + CALL lotsa_ints(1, C.x, C.y, 2); -- + CALL lotsa_ints(1, 2, C.x, C.y); -- + CALL lotsa_ints(C.x, C.y, C.x, C.y); -- - Error create proc shape_args_middle() begin declare C cursor like select 1 x, 2 y; fetch C from values(1, 2); call lotsa_ints(from C, 1, 2); call lotsa_ints(1, from C, 2); call lotsa_ints(1, 2, from C); call lotsa_ints(from C, from C); end; -- TEST: try a variety of standard arg replacements -- Just rewrites to verify -- + CALL lotsa_ints(x, y, 1, 2); -- + CALL lotsa_ints(1, x, y, 2); -- + CALL lotsa_ints(1, 2, x, y); -- + CALL lotsa_ints(x, y, x, y); -- - Error create proc arg_rewrite_simple(x integer not null, y integer not null) begin call lotsa_ints(from arguments, 1, 2); call lotsa_ints(1, from arguments, 2); call lotsa_ints(1, 2, from arguments); call lotsa_ints(from arguments, from arguments); end; -- TEST: try from arguments with no arguments -- + Error % FROM ARGUMENTS used in a procedure with no arguments 'arg_rewrite_no_args' -- +1 Error create proc arg_rewrite_no_args() begin call lotsa_ints(from arguments, 1, 2); end; -- TEST: try to use from arguments outside of any procedure -- + Error % FROM ARGUMENTS construct is only valid inside a procedure -- +1 Error call lotsa_ints(from arguments, 1, 2); -- TEST: try a variety of standard arg replacements with type constraint -- Just rewrites to verify -- + CALL lotsa_ints(y, 1, 2, 3); -- + CALL lotsa_ints(1, y, 2, 3); -- + CALL lotsa_ints(1, 2, y, 3); -- + CALL lotsa_ints(1, 2, 3, y); -- + CALL lotsa_ints(y, y, y, y); -- - Error create proc arg_rewrite_with_like(x integer not null, y integer not null) begin call lotsa_ints(from arguments like small_shape, 1, 2, 3); call lotsa_ints(1, from arguments like small_shape, 2, 3); call lotsa_ints(1, 2, from arguments like small_shape, 3); call lotsa_ints(1, 2, 3, from arguments like small_shape); call lotsa_ints(from arguments like small_shape, from arguments like small_shape, from arguments like small_shape, from arguments like small_shape); end; -- TEST: try a variety of standard arg replacements with type constraint -- this version matches the arg with a trailing underscore -- Just rewrites to verify -- + CALL lotsa_ints(y_, 1, 2, 3); -- + CALL lotsa_ints(1, y_, 2, 3); -- + CALL lotsa_ints(1, 2, y_, 3); -- + CALL lotsa_ints(1, 2, 3, y_); -- + CALL lotsa_ints(y_, y_, y_, y_); -- - Error create proc arg_rewrite_with_like_with_underscore(x integer not null, y_ integer not null) begin call lotsa_ints(from arguments like small_shape, 1, 2, 3); call lotsa_ints(1, from arguments like small_shape, 2, 3); call lotsa_ints(1, 2, from arguments like small_shape, 3); call lotsa_ints(1, 2, 3, from arguments like small_shape); call lotsa_ints(from arguments like small_shape, from arguments like small_shape, from arguments like small_shape, from arguments like small_shape); end; -- TEST: try a variety of standard arg replacements with type constraint -- this version matches the arg with a trailing underscore -- this version also writes more than one column -- Just rewrites to verify -- + CALL lotsa_ints(x_, y_, 1, 2); -- + CALL lotsa_ints(1, x_, y_, 2); -- + CALL lotsa_ints(1, 2, x_, y_); -- + CALL lotsa_ints(x_, y_, x_, y_); -- - Error create proc arg_rewrite_with_like_many_cols_with_underscore(x_ integer not null, y_ integer not null) begin call lotsa_ints(from arguments like shape, 1, 2); call lotsa_ints(1, from arguments like shape, 2); call lotsa_ints(1, 2, from arguments like shape); call lotsa_ints(from arguments like shape, from arguments like shape); end; -- TEST: try to do from arguments with a type but there is no matching arg -- + {call_stmt}: err -- + Error % expanding FROM ARGUMENTS, there is no argument matching 'id' -- +1 Error create proc call_with_missing_type(x integer) begin -- the table foo has a column 'id' but we have no such arg call lotsa_ints(1, 2, 3, from arguments like foo); end; -- TEST: try to do from arguments with a type but there is no such type -- + {call_stmt}: err -- + {expr_list}: err -- + Error % must be a cursor, proc, table, or view 'no_such_type_dude' -- +1 Error create proc call_from_arguments_bogus_type(x integer) begin -- the table foo has a column 'id' but we have no such arg call lotsa_ints(1, 2, 3, from arguments like no_such_type_dude); end; -- this procedure ends with an out arg, can be called as a function declare proc funclike(like shape, out z integer not null); -- TEST: use argument expansion in a function call context -- This is strictly a rewrite -- + CREATE PROC arg_caller (x_ INTEGER NOT NULL, y_ TEXT NOT NULL, OUT z INTEGER NOT NULL) -- + SET z := funclike(x_, y_); -- - Error create proc arg_caller(like shape, out z integer not null) begin set z := funclike(from arguments like shape); end; -- TEST: use argument expansion in a function call context -- + Error % must be a cursor, proc, table, or view 'not_a_shape' -- +1 Error -- + {call}: err -- + {arg_list}: err -- + {name not_a_shape}: err -- from arguments not replaced because the rewrite failed -- + {from_shape} create proc arg_caller_bogus_shape(like shape, out z integer not null) begin set z := funclike(from arguments like not_a_shape); end; -- TEST: @proc in bad context (assign) -- + {assign}: err -- + Error % @PROC literal can only appear inside of procedures -- +1 Error set a_string := @PROC; -- TEST: @proc in bad context (savepoint) -- + {savepoint_stmt}: err -- + Error savepoint @proc; -- TEST: @proc in bad context (release) -- + {release_savepoint_stmt}: err -- + Error % @PROC literal can only appear inside of procedures -- +1 Error release savepoint @proc; -- TEST: @proc in bad context (rollback) -- + {rollback_trans_stmt}: err -- + Error % @PROC literal can only appear inside of procedures -- +1 Error rollback transaction to savepoint @proc; -- TEST: @proc rewrites -- + SET p := 'savepoint_proc_stuff'; -- + SAVEPOINT savepoint_proc_stuff; -- + ROLLBACK TO savepoint_proc_stuff; -- + RELEASE savepoint_proc_stuff; -- - Error create proc savepoint_proc_stuff() begin declare p text; set p := @proc; savepoint @proc; rollback transaction to savepoint @proc; release savepoint @proc; end; -- TEST: call cql_cursor_diff_col with non variable arguments -- + {assign}: err -- + {call}: err -- + Error % argument must be a variable in function 'cql_cursor_diff_col' -- +1 Error set a_string := cql_cursor_diff_col(1, "bogus"); -- TEST: call cql_cursor_diff_col with invalid variable arguments -- + {assign}: err -- + {call}: err -- + Error % variable is not a cursor 'an_int' -- +1 Error set a_string := cql_cursor_diff_col(an_int, an_int2); -- TEST: call cql_cursor_diff_col with incorrect number of arguments -- + {assign}: err -- + {call}: err -- + {name cql_cursor_diff_col}: err -- + Error % function got incorrect number of arguments 'cql_cursor_diff_col' -- +1 Error set a_string := cql_cursor_diff_col(an_int, an_int2, 1); -- TEST: call cql_cursor_diff_val with incorrect number of arguments -- + {assign}: err -- + {call}: err -- + {name cql_cursor_diff_val}: err -- + Error % function got incorrect number of arguments 'cql_cursor_diff_val' -- +1 Error set a_string := cql_cursor_diff_val(an_int, an_int2, 1); -- TEST: call cql_cursor_diff_col with cursor with fetch value and same shape -- + {create_proc_stmt}: err -- + {assign}: err -- + {call}: err -- + {name c1}: err -- + Error % cursor was not used with 'fetch [cursor]' 'c1' -- +1 Error create proc cql_cursor_diff_col_without_cursor_arg() begin declare c1 cursor for select 1 x, 'y' y; declare c2 cursor for select 1 x, 'y' y; fetch c2; set a_string := cql_cursor_diff_col(c1, c2); end; -- TEST: call cql_cursor_diff_col with incompatible cursor types -- + {create_proc_stmt}: err -- + {assign}: err -- + {call}: err -- the expected type does not get error marking -- - {name c1}: err -- + {name c2}: err -- + Error % in cql_cursor_diff_col, all columns must be an exact type match (expected integer notnull; found text notnull) 'x' -- +1 Error create proc cql_cursor_diff_col_wrong_cursor_type() begin declare c1 cursor for select 1 x; declare c2 cursor for select '1' x; fetch c1; fetch c2; set a_string := cql_cursor_diff_col(c1, c2); end; -- TEST: call cql_cursor_diff_col with invalid column count arguments -- + {create_proc_stmt}: err -- + {assign}: err -- + {call}: err -- + Error % the cursor arguments must have identical column count 'cql_cursor_diff_col' -- +1 Error create proc cql_cursor_diff_col_with_wrong_col_count_arg() begin declare c1 cursor for select 1 x, 'z' z; declare c2 cursor for select 1 x; fetch c1; fetch c2; set a_string := cql_cursor_diff_col(c1, c2); end; -- TEST: call cql_cursor_diff_col with valid cursor param but different column name -- + {create_proc_stmt}: err -- + {assign}: err -- + {call}: err -- + Error % in cql_cursor_diff_col, all column names must be identical so they have unambiguous names 'z' -- +1 Error create proc cql_cursor_diff_col_compatible_cursor_with_diff_col_name() begin declare c1 cursor for select 1 x, 'y' y; declare c2 cursor for select 1 z, 'v' v; fetch c1; fetch c2; set a_string := cql_cursor_diff_col(c1, c2); end; -- TEST: call cql_cursor_diff_col with cursor with fetch value and same shape -- + {create_proc_stmt}: ok dml_proc -- + {assign}: a_string: text variable -- + SET a_string := CASE WHEN c1.x IS NOT c2.x THEN 'x' -- + WHEN c1.y IS NOT c2.y THEN 'y' -- + END; -- - Error create proc cql_cursor_diff_col_with_shape_storage() begin declare c1 cursor for select 1 x, 'y' y; declare c2 cursor for select 1 x, 'y' y; fetch c1; fetch c2; set a_string := cql_cursor_diff_col(c1, c2); end; -- TEST: call cql_cursor_diff_col from another func -- + {create_proc_stmt}: ok dml_proc -- + {call_stmt}: ok -- + CALL printf(CASE WHEN c1.x IS NOT c2.x THEN 'x' -- + WHEN c1.y IS NOT c2.y THEN 'y' -- + END); -- - Error create proc print_call_cql_cursor_diff_col() begin declare c1 cursor for select 1 x, 'y' y; declare c2 cursor for select 1 x, 'v' y; fetch c1; fetch c2; call printf(cql_cursor_diff_col(c1, c2)); end; -- TEST: call cql_cursor_diff_val from another func -- + {create_proc_stmt}: ok dml_proc -- + {call_stmt}: ok -- + CALL printf(CASE WHEN c1.x IS NOT c2.x THEN printf('column:%s c1:%s c2:%s', 'x', CASE WHEN c1.x IS NULL THEN 'null' -- + ELSE printf('%d', c1.x) -- + END, CASE WHEN c2.x IS NULL THEN 'null' -- + ELSE printf('%d', c2.x) -- + END) -- + WHEN c1.y IS NOT c2.y THEN printf('column:%s c1:%s c2:%s', 'y', CASE WHEN nullable(c1.y) IS NULL THEN 'null' -- + ELSE printf('%s', c1.y) -- + END, CASE WHEN nullable(c2.y) IS NULL THEN 'null' -- + ELSE printf('%s', c2.y) -- + END) -- + END); -- - Error create proc print_call_cql_cursor_diff_val() begin declare c1 cursor for select nullable(1) x, 'y' y; declare c2 cursor for select nullable(1) x, 'v' y; fetch c1; fetch c2; call printf(cql_cursor_diff_val(c1, c2)); end; -- TEST: simple trim call (two args) -- + {call}: text notnull -- + {name trim}: text notnull -- - sensitive -- - Error set a_string := (select trim("x", "y")); -- TEST: simple trim call (one arg) -- + {call}: text notnull -- + {name trim}: text notnull -- - sensitive -- - Error set a_string := (select trim("x")); declare kind_string text<surname>; -- TEST: substr preserves kind -- + {select_stmt}: _anon: text<surname> -- + {name kind_string}: kind_string: text<surname> variable -- - Error set kind_string := (select substr(kind_string, 2, 3)); -- TEST: replace preserves kind -- + {select_stmt}: _anon: text<surname> -- + {name kind_string}: kind_string: text<surname> variable -- - Error set kind_string := (select replace(kind_string, 'b', 'c')); -- TEST: verify that kind is preserved -- + {select_stmt}: _anon: text<surname> -- + {name kind_string}: kind_string: text<surname> variable -- - Error set kind_string := (select trim(kind_string)); -- TEST: verify that kind is preserved -- + {select_stmt}: _anon: text<surname> -- + {name kind_string}: kind_string: text<surname> variable -- - Error set kind_string := (select upper(kind_string)); -- TEST: verify that kind is preserved -- + {select_stmt}: _anon: text<surname> -- + {name kind_string}: kind_string: text<surname> variable -- - Error set kind_string := (select lower(kind_string)); -- TEST: simple ltrim call -- + {call}: text notnull -- + {name ltrim}: text notnull -- - sensitive -- - Error set a_string := (select ltrim("x", "y")); -- TEST: simple rtrim call -- + {call}: text notnull -- + {name rtrim}: text notnull -- - sensitive -- - Error set a_string := (select rtrim("x", "y")); -- TEST: trim failure: no args -- + {call}: err -- + Error % function got incorrect number of arguments 'trim' -- +1 Error set a_string := (select trim()); -- TEST: trim failure: three args -- + {call}: err -- + Error % function got incorrect number of arguments 'trim' -- +1 Error set a_string := (select trim(1,2,3)); -- TEST: trim failure: arg 1 is not a string -- + {call}: err -- + Error % all arguments must be strings 'trim' -- +1 Error set a_string := (select trim(1,"x")); -- TEST: trim failure: arg 2 is not a string -- + {call}: err -- + Error % all arguments must be strings 'trim' -- +1 Error set a_string := (select trim("x", 1)); -- TEST: trim failure: not in a SQL context -- + {call}: err -- + Error % function may not appear in this context 'trim' -- +1 Error set a_string := trim("x", 1); -- TEST: trim must preserve sensitivity -- + {call}: text sensitive -- + {name trim}: text sensitive -- - Error set sens_text := (select trim(name) from with_sensitive); -- TEST: trim must preserve sensitivity (2nd arg too, 1st arg not null) -- + {select_stmt}: result: text notnull sensitive -- + {call}: text notnull sensitive -- + {name trim}: text notnull sensitive -- - Error set sens_text := (select trim("xyz", name) result from with_sensitive); -- TEST: call cql_cursor_format on a auto cursor -- + {create_proc_stmt}: ok dml_proc -- + DECLARE c1 CURSOR FOR SELECT TRUE AS a, 1 AS b, 99L AS c, 'x' AS d, nullable(1.1) AS e, CAST('y' AS BLOB) AS f; -- + FETCH c1; -- + SET a_string := printf('a:%s|b:%s|c:%s|d:%s|e:%s|f:%s', CASE WHEN nullable(c1.a) IS NULL THEN 'null' -- + ELSE printf('%d', c1.a) -- + END, CASE WHEN nullable(c1.b) IS NULL THEN 'null' -- + ELSE printf('%d', c1.b) -- + END, CASE WHEN nullable(c1.c) IS NULL THEN 'null' -- + ELSE printf('%lld', c1.c) -- + END, CASE WHEN nullable(c1.d) IS NULL THEN 'null' -- + ELSE printf('%s', c1.d) -- + END, CASE WHEN c1.e IS NULL THEN 'null' -- + ELSE printf('%f', c1.e) -- + END, CASE WHEN nullable(c1.f) IS NULL THEN 'null' -- + ELSE printf('length %lld blob', cql_get_blob_size(c1.f)) -- + END); -- - Error create proc print_call_cql_cursor_format() begin declare c1 cursor for select TRUE a, 1 b, 99L c, 'x' d, nullable(1.1) e, cast('y' as blob) f; fetch c1; set a_string := cql_cursor_format(c1); end; -- TEST: call cql_cursor_format in select context -- + {create_proc_stmt}: err -- + {select_stmt}: err -- + {call}: err -- + Error % function may not appear in this context 'cql_cursor_format' -- +1 Error create proc select_cql_cursor_format() begin declare c1 cursor for select 1 as a; fetch c1; select cql_cursor_format(c1) as p; end; -- TEST: call cql_cursor_format on a not auto cursor -- + {create_proc_stmt}: err -- + {call}: err -- + {name c}: err -- + Error % cursor was not used with 'fetch [cursor]' 'c' -- +1 Error create proc print_call_cql_not_fetch_cursor_format() begin declare c cursor for select 1; set a_string := cql_cursor_format(c); end; -- TEST: test cql_cursor_format with a non cursor params -- + {assign}: err -- + {call}: err -- + Error % argument must be a variable in function 'cql_cursor_format' -- +1 Error set a_string := cql_cursor_format(1); -- TEST: test cql_cursor_format with a non variable cursor -- + {assign}: err -- + {call}: err -- + Error % function got incorrect number of arguments 'cql_cursor_format' -- +1 Error set a_string := cql_cursor_format(1, 2); -- TEST: assigning an int64 to an int is not ok -- + {assign}: err -- + Error % lossy conversion from type 'LONG_INT' -- +1 Error set an_int := 1L; -- TEST: assigning a real to an int is not ok -- + {assign}: err -- + Error % lossy conversion from type 'REAL' -- +1 Error set an_int := 1.0; -- TEST: assigning a real to a long int is not ok -- + {assign}: err -- + Error % lossy conversion from type 'REAL' -- +1 Error set ll := 1.0; -- TEST: length failure: no args -- + {call}: err -- + Error % function got incorrect number of arguments 'length' -- +1 Error set an_int := (select length()); -- TEST: length failure: arg is not a string -- + {call}: err -- + Error % all arguments must be strings 'length' -- +1 Error set an_int := (select length(1)); -- TEST: length failure: not in a SQL context -- + {call}: err -- + Error % function may not appear in this context 'length' -- +1 Error set an_int := length("x"); -- TEST: length must preserve sensitivity -- + {call}: integer sensitive -- + {name length}: integer sensitive -- - Error set _sens := (select length(name) from with_sensitive); -- TEST: length must preserve nullability -- + {assign}: an_int: integer variable -- + {select_stmt}: _anon: integer notnull -- + {call}: integer notnull -- - Error set an_int := (select length("x")); -- TEST: box a cursor (success path) -- + {name C}: C: select: { id: integer notnull, name: text, rate: longint } variable dml_proc -- + {set_from_cursor}: C: select: { id: integer notnull, name: text, rate: longint } variable dml_proc boxed -- - Error create proc cursor_box(out B object<bar cursor>) begin declare C cursor for select * from bar; set B from cursor C; end; -- TEST: unbox a cursor (success path) -- + {declare_cursor}: C: bar: { id: integer notnull, name: text, rate: longint } variable boxed -- + {name C}: C: bar: { id: integer notnull, name: text, rate: longint } variable boxed -- + {name box}: box: object<bar CURSOR> variable in -- - Error create proc cursor_unbox(box object<bar cursor>) begin declare C cursor for box; end; -- TEST: unbox from an object that has no type spec -- + Error % the variable must be of type object<T cursor> where T is a valid shape name 'box' -- +1 Error create proc cursor_unbox_untyped(box object) begin declare C cursor for box; end; -- TEST: unbox from an object that is not marked CURSOR -- + Error % the variable must be of type object<T cursor> where T is a valid shape name 'box' -- +1 Error create proc cursor_unbox_not_cursor(box object<bar>) begin declare C cursor for box; end; -- TEST: unbox from an object that has a type spec that isn't a valid shape -- + Error % must be a cursor, proc, table, or view 'not_a_type' -- +1 Error create proc cursor_unbox_not_a_type(box object<not_a_type cursor>) begin declare C cursor for box; end; -- TEST: unbox and attempt to redeclare the same cursor -- + Error % duplicate variable name in the same scope 'C' -- +1 Error create proc cursor_unbox_duplicate(box object<bar cursor>) begin declare C cursor for box; declare C cursor for box; end; -- TEST: unbox from a variable that does not exist -- + Error % name not found 'box' -- +1 Error create proc cursor_unbox_not_exists() begin declare C cursor for box; end; -- TEST: try to box a value cursor -- + Error % the cursor did not originate from a SQLite statement, it only has values 'C' -- +1 Error create proc cursor_box_value(out box object<bar cursor>) begin declare C cursor like bar; set box from cursor C; end; -- TEST: try to box but the type isn't a shape -- + Error % must be a cursor, proc, table, or view 'barf' -- +1 Error create proc cursor_box_not_a_shape(out box object<barf cursor>) begin declare C cursor for select * from bar; set box from cursor C; end; -- TEST: try to box but the type doesn't match -- + Error % in the cursor and the variable type, all must have the same column count -- +1 Error create proc cursor_box_wrong_shape(out box object<foo cursor>) begin declare C cursor for select * from bar; set box from cursor C; end; -- TEST: try to box but the source isnt a cursor -- + Error % cursor not found 'XYZZY' -- +1 Error create proc cursor_box_not_a_cursor(out box object<foo cursor>) begin set box from cursor XYZZY; end; -- TEST: try to box but the source isnt a cursor -- + Error % variable not found 'box' -- +1 Error create proc cursor_box_var_not_found() begin declare C cursor for select * from bar; set box from cursor C; end; -- TEST: test cql_get_blob_size cql builtin function -- + {assign}: an_long: longint variable -- + {name cql_get_blob_size}: longint -- - Error set an_long := cql_get_blob_size(blob_var); -- TEST: test cql_get_blob_size with too many arguments -- + {assign}: err -- + {name cql_get_blob_size}: err -- + Error % function got incorrect number of arguments 'cql_get_blob_size' -- +1 Error set an_long := cql_get_blob_size(blob_var, 0); -- TEST: test cql_get_blob_size with invalid argument type -- + {assign}: err -- + {call}: err -- + {name cql_get_blob_size} -- + Error % the argument must be of type blob 'cql_get_blob_size' -- +1 Error set an_long := cql_get_blob_size(an_int); -- TEST: test cql_get_blob_size used in SQL context -- + {assign}: err -- + {call}: err -- + {name cql_get_blob_size} -- + Error % function may not appear in this context 'cql_get_blob_size' -- +1 Error set an_long := (select cql_get_blob_size(an_int)); declare proc some_proc(id integer, t text, t1 text not null, b blob, out x integer not null); -- TEST: make a cursor using the arguments of a procedure as the shape -- + DECLARE Q CURSOR LIKE some_proc ARGUMENTS; -- + {declare_cursor_like_name}: Q: some_proc[arguments]: { id: integer in, t: text in, t1: text notnull in, b: blob in, x: integer notnull in } variable shape_storage value_cursor -- - Error declare Q cursor like some_proc arguments; -- TEST: make a procedure using a declared shape (rewrite test) -- + CREATE PROC some_proc_proxy (id INTEGER, t TEXT, t1 TEXT NOT NULL, b BLOB, OUT x INTEGER NOT NULL) -- - Error create proc some_proc_proxy(like some_proc arguments) begin call some_proc(from arguments); end; declare proc some_proc2(inout id integer, t text, t1 text not null, b blob, out x integer not null); -- TEST: make a procedure using a declared shape (rewrite test) -- + CREATE PROC some_proc2_proxy (INOUT id INTEGER, t TEXT, t1 TEXT NOT NULL, b BLOB, OUT x INTEGER NOT NULL) -- - Error create proc some_proc2_proxy(like some_proc2 arguments) begin call some_proc(from arguments); end; -- TEST: there is no some_proc3 -- error -- + CREATE PROC some_proc3_proxy (LIKE some_proc3 ARGUMENTS) -- + Error % name not found 'some_proc3' -- +1 Error create proc some_proc3_proxy(like some_proc3 arguments) begin call some_proc(from arguments); end; -- TEST: there is no some_proc3 -- error -- + Error % LIKE ... ARGUMENTS used on a procedure with no arguments 'proc1' -- +1 Error create proc some_proc4_proxy(like proc1 arguments) begin end; -- TEST: object arguments are supported -- + {declare_cursor_like_name}: cursor_with_object: obj_proc[arguments]: { an_obj: object in } variable shape_storage value_cursor -- + {like}: obj_proc[arguments]: { an_obj: object in } -- - Error declare cursor_with_object cursor like obj_proc arguments; -- TEST: try to make a proc that emits a cursor with an object in it -- + {stmt_list}: ok -- + {create_proc_stmt}: cursor_with_object: obj_proc[arguments]: { an_obj: object in } variable shape_storage uses_out value_cursor -- + {out_stmt}: cursor_with_object: obj_proc[arguments]: { an_obj: object in } variable shape_storage value_cursor -- + {name try_to_emit_object}: cursor_with_object: obj_proc[arguments]: { an_obj: object in } variable shape_storage uses_out value_cursor -- - Error create proc try_to_emit_object() begin out cursor_with_object; end; -- TEST: test rewrite for [FETCH [c] USING ... ] grammar -- + {create_proc_stmt}: ok -- + FETCH C(id, name, rate) FROM VALUES(1, NULL, 99); -- - Error create proc test_fetch_using() begin declare C cursor like bar; fetch C using 1 id, NULL as name, 99 rate; end; -- TEST: test rewrite for [FETCH [c] USING ... ] grammar with dummy_seed -- + {create_proc_stmt}: ok -- + FETCH C(id, name, rate) FROM VALUES(1, printf('name_%d', _seed_), _seed_) @DUMMY_SEED(9) @DUMMY_DEFAULTS @DUMMY_NULLABLES; -- - Error create proc test_fetch_using_with_dummy_seed() begin declare C cursor like bar; fetch C using 1 id @dummy_seed(9) @dummy_defaults @dummy_nullables; end; -- TEST: try to return object from a select function -- + {declare_select_func_stmt}: err -- + Error % select function may not return type OBJECT 'returns_object_is_bogus' -- +1 Error declare select function returns_object_is_bogus() object; -- TEST: simple check expression -> valid case -- + {create_table_stmt}: with_check: { id: integer, lo: integer has_check, hi: integer } -- + {col_attrs_check}: ok -- + {le}: bool -- + {name lo}: lo: integer -- + {name hi}: hi: integer -- - Error create table with_check ( id integer, lo integer check (lo <= hi), hi integer ); -- TEST: simple check expression -> bogus identifier -- + {create_table_stmt}: err -- + {col_attrs_check}: err -- + {le}: err -- + Error % name not found 'hip' -- +1 Error create table with_check_bogus_column ( id integer, lo integer check (lo <= hip), hi integer ); -- TEST: simple collate, no problem -- + {create_table_stmt}: with_collate: { id: integer, t: text has_collate } -- + {col_attrs_collate}: ok -- - Error create table with_collate ( id integer, t text collate garbonzo ); -- TEST: simple collate, bogus column type -- + {create_table_stmt}: err -- + {col_attrs_collate}: err -- + Error % collate applied to a non-text column 'i' -- +1 Error create table with_collate ( id integer, i real collate garbonzo ); -- TEST: make sure all constraints come after all columns -- + {create_table_stmt}: err -- + Error % column definitions may not come after constraints 'id' -- +1 Error create table bad_order( id integer, primary key (id), t text ); -- TEST: test rewrite for [INSERT name USING ... ] grammar -- + {create_proc_stmt}: ok dml_proc -- + INSERT INTO foo(id) VALUES(1); -- - Error create proc test_insert_using() begin insert into foo using 1 id; end; -- TEST: test rewrite for [INSERT name USING ... ] grammar with dummy_seed -- + {create_proc_stmt}: ok dml_proc -- + INSERT INTO bar(id, name, rate) VALUES(1, printf('name_%d', _seed_), _seed_) @DUMMY_SEED(9) @DUMMY_DEFAULTS @DUMMY_NULLABLES -- - Error create proc test_insert_using_with_dummy_seed() begin insert into bar using 1 id @dummy_seed(9) @dummy_defaults @dummy_nullables; end; -- TEST: test rewrite for [INSERT name USING ... ] grammar printed -- + {create_proc_stmt}: err -- note: because the proc is a duplicate it won't be further analyzed -- which means that we get to see the printout of the proc before -- it is rewritten so this is a test for printing the before SQL -- not a semantic test of the rewrite. gen_sql code is exercised here. -- + INSERT INTO foo USING 1 AS bogus; -- + Error % duplicate stored proc name 'test_insert_using' -- +1 Error create proc test_insert_using() begin insert into foo using 1 bogus; end; -- TEST: test rewrite for IIF func -- + {select_stmt}: select: { _anon: integer notnull } -- + SELECT CASE WHEN an_int IS NULL THEN 3 -- + ELSE 2 -- + END; -- - Error select iif(an_int is null, 3, 2); -- TEST: test rewrite for IIF func with invalid argument count -- + {select_stmt}: err -- + Error % function got incorrect number of arguments 'iif' -- +1 Error select iif(an_int is null, 2, 3, 4); -- TEST: exercise iif analysis with a bad first argument -- + {select_stmt}: err -- + {name not_found}: err -- +1 Error select iif(not_found, 2, 3); -- TEST: exercise iif analysis with a bad second argument -- + {select_stmt}: err -- + {name not_found}: err -- +1 Error select iif(1, not_found, 3); -- TEST: exercise iif analysis with a bad third argument -- + {select_stmt}: err -- + {name not_found}: err -- +1 Error select iif(1, 2, not_found); -- TEST: test rewrite for IIF func with non-numeric first argument -- + {select_stmt}: err -- + Error % incompatible types in expression 'iif' -- +1 Error select iif('x', 2, 3); -- TEST: test rewrite for IIF func with incompatible types -- + {select_stmt}: err -- + Error % incompatible types in expression 'iif' -- +1 Error select iif(an_int is null, 2, x'23'); -- TEST: test rewrite for IIF func out of sql context -- + {assign}: an_int: integer variable -- + SET an_int := CASE WHEN an_int IS NULL THEN CASE WHEN 4 THEN 5 -- + ELSE 6 -- + END -- + ELSE 2 -- + END; -- - Error set an_int := iif(an_int is null, iif(4, 5, 6), 2); -- TEST: test rewrite for [UPDATE cursor USING ... ] grammar -- + {create_proc_stmt}: ok dml_proc -- + UPDATE CURSOR small_cursor(x) FROM VALUES(2); -- - Error create proc test_update_cursor_using() begin update cursor small_cursor using 2 x; end; -- TEST basic use of proc savepoint rollback return and commit return -- + {create_proc_stmt}: ok dml_proc -- + {name proc_savepoint_basic}: ok dml_proc -- + {proc_savepoint_stmt}: ok -- + {rollback_return_stmt}: ok -- + {commit_return_stmt}: ok create proc proc_savepoint_basic() begin proc savepoint begin if 1 then rollback return; else commit return; end if; end; end; -- TEST proc savepoint with an error, the outer statement should be marked error -- + {create_proc_stmt}: err -- + {proc_savepoint_stmt}: err -- + Error % string operand not allowed in 'NOT' create proc proc_savepoint_error_in_stmt_list() begin proc savepoint begin set X := not 'x'; end; end; -- TEST: proc savepoint invalid outside of a proc -- + {proc_savepoint_stmt}: err -- + Error % should be in a procedure and at the top level -- +1 Error proc savepoint begin end; -- TEST: proc savepoint invalid outside of a proc -- + {proc_savepoint_stmt}: err -- + Error % should be in a procedure and at the top level -- +1 Error create proc savepoint_nested() begin if 1 then proc savepoint begin end; end if; end; -- TEST: rollback return invalid outside of proc savepoint -- + {rollback_return_stmt}: err -- + Error % statement must appear inside of a PROC SAVEPOINT block -- +1 Error create proc rollback_return_invalid() begin if 1 then rollback return; end if; end; -- TEST: commit return invalid outside of proc savepoint -- + {commit_return_stmt}: err -- + Error % statement must appear inside of a PROC SAVEPOINT block -- +1 Error create proc commit_return_invalid() begin if 1 then commit return; end if; end; -- TEST: may not use a return statement inside of a savepoint block -- + {create_proc_stmt}: err -- + {proc_savepoint_stmt}: err -- + {return_stmt}: err -- + Error % use COMMIT RETURN or ROLLBACK RETURN in within a proc savepoint block -- +1 Error create proc regular_return_invalid() begin proc savepoint begin return; end; end; -- TEST: create an integer enum -- + {declare_enum_stmt}: integer_things: integer -- + {name pen}: integer = 1 -- + {name paper}: integer = 7 -- + {name pencil}: integer = 8 declare enum integer_things integer ( pen, paper = 7, pencil ); declare proc test_shape() (x integer_things); -- TEST: ensure that the type kind is preserved on cursor read -- + {name z}: z: integer<integer_things> notnull variable -- -Error create proc enum_users() begin declare C cursor like test_shape; fetch C using integer_things.pen x; let z := C.x; end; -- TEST: ensure that the type kind is preserved from an arg bundle -- proof that the cursor fields had the right type when extracted -- + {name u}: u: integer<integer_things> notnull variable -- proof that the b_x arg has the right type -- + {name v}: v: integer<integer_things> notnull variable -- rewrite includes the KIND -- + CREATE PROC enum_in_bundle (b_x INTEGER<integer_things> NOT NULL) -- -Error create proc enum_in_bundle(b like test_shape) begin let u := b.x; let v := b_x; -- the param normal name end; -- TEST: verify typed names preserve kind -- verify the rewrite include the enum type -- + DECLARE PROC shape_result_test () (x INTEGER<integer_things> NOT NULL); declare proc shape_result_test() (like test_shape); -- TEST: create an integer enum exact copy is OK! -- + {declare_enum_stmt}: integer_things: integer -- + {name pen}: integer = 1 -- + {name paper}: integer = 7 -- + {name pencil}: integer = 8 declare enum integer_things integer ( pen, paper = 7, pencil ); -- TEST: create an real enum -- + {declare_enum_stmt}: real_things: real -- + {name pen}: real = 1.000000e+00 -- + {name paper}: real = 7.000000e+00 -- + {name pencil}: real = 8.000000e+00 declare enum real_things real ( pen, paper = 7, pencil ); -- TEST: x is declared with correct type and kind (real and <real_things> -- + {declare_vars_type}: real<real_things> notnull -- + {name rt}: rt: real<real_things> notnull variable -- - Error declare rt real_things; -- TEST: ok to assign a pen to a x because it's a real_thing -- + {assign}: rt: real<real_things> notnull variable -- + {name rt}: rt: real<real_things> notnull variable -- + {dbl 1.000000e+00}: real<real_things> notnull set rt := real_things.pen; -- TEST: not ok to assign integer_things.pen because it's the wrong kind -- + {assign}: err -- + {name rt}: rt: real<real_things> notnull variable -- + {int 1}: integer<integer_things> notnull -- + Error % expressions of different kinds can't be mixed: 'real_things' vs. 'integer_things' -- +1 Error set rt := integer_things.pen; -- TEST: try to use an enum value, this is a rewrite -- + SELECT 8.000000e+00; select real_things.pencil; -- TEST: try to use an enum value, invalid name -- + {select_stmt}: err -- + {dot}: err -- + Error % enum does not contain 'nope' -- +1 Error select real_things.nope; -- TEST: create a bool enum (it all becomes true/false) -- + {declare_enum_stmt}: bool_things: bool -- + {name pen}: bool = 1 -- + {name paper}: bool = 1 -- + {name pencil}: bool = 0 declare enum bool_things bool ( pen, paper = 7, pencil ); -- TEST: create a long integer enum -- + {declare_enum_stmt}: long_things: longint -- + {name pen}: longint = 1 -- + {name paper}: longint = -7 -- + {name pencil}: longint = -6 declare enum long_things long_int ( pen, paper = -7, pencil ); -- TEST: duplicate enum name -- + {declare_enum_stmt}: err -- + Error % enum definitions do not match 'long_things' -- there will be three reports, 1 each for the two versions and one overall error -- +3 Error declare enum long_things integer ( foo ); -- TEST: duplicate enum member name -- + {declare_enum_stmt}: err -- + Error % duplicate enum member 'two' -- +1 Error declare enum duplicated_things integer ( two, two ); -- TEST: invalid enum member -- + {declare_enum_stmt}: err -- + Error % evaluation failed 'boo' -- +1 Error declare enum invalid_things integer ( boo = 1/0 ); -- TEST: refer to the enum from within itself -- + DECLARE ENUM sizes REAL ( -- + big = 100, -- + medium = 1.000000e+02 / 2 -- + small = 5.000000e+01 / 2 -- + tiny = 2.500000e+01 / 2 -- + {name big}: real = 1.000000e+02 -- + {name medium}: real = 5.000000e+01 -- + {name small}: real = 2.500000e+01 -- + {name tiny}: real = 1.250000e+01 -- - Error declare enum sizes real ( big = 100, medium = big/2, small = medium/2, tiny = small/2 ); -- TEST: reference other enums in this enum -- + DECLARE ENUM misc REAL ( -- + one = 1.000000e+02 - 2.500000e+01, -- + two = 7.500000e+01 - 1.250000e+01 -- + ); -- + {name one}: real = 7.500000e+01 -- + {name two}: real = 6.250000e+01 -- - Error declare enum misc real ( one = sizes.big - sizes.small, two = one - sizes.tiny ); -- TEST: enum declarations must be top level -- + {create_proc_stmt}: err -- + {declare_enum_stmt}: err -- + Error % declared enums must be top level 'bogus_inside_proc' -- +1 Error create proc enum_in_proc_bogus() begin declare enum bogus_inside_proc integer (foo); end; create table SalesInfo( month integer, amount real ); -- TEST: sum is not allowed in a window range -- + Error % function may not appear in this context 'sum' -- +1 Error SELECT month, amount, AVG(amount) OVER (ORDER BY month ROWS BETWEEN 1 PRECEDING AND sum(month) FOLLOWING) SalesMovingAverage FROM SalesInfo; -- TEST: sum is not allowed in a window range -- + Error % function may not appear in this context 'sum' -- +1 Error SELECT month, amount, AVG(amount) OVER (PARTITION BY sum(month) ROWS BETWEEN 1 PRECEDING AND 3 FOLLOWING) SalesMovingAverage FROM SalesInfo; -- TEST: sum is not allowed in a window range -- + Error % function may not appear in this context 'sum' -- +1 Error SELECT month, amount, AVG(amount) OVER (ORDER BY month ROWS BETWEEN sum(month) PRECEDING AND 1 FOLLOWING) SalesMovingAverage FROM SalesInfo; -- TEST: sum is not allowed in a filter expression -- + Error % function may not appear in this context 'sum' -- +1 Error SELECT month, amount, AVG(amount) FILTER(WHERE sum(month) = 1) OVER (ORDER BY month ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING EXCLUDE NO OTHERS) SalesMovingAverage FROM SalesInfo; create table AB( a integer, b text ); create table CD( c integer, d text ); create table BA( b integer, a text ); declare proc use_c() (c integer); -- TEST: arg bundle with a specific column -- + INSERT INTO AB(a) VALUES(a2.c); -- - Error create proc arg_bundle_1(a1 like AB, a2 like CD) begin insert into AB(a) from a2(c); end; -- TEST: arg bundle with a specific column using LIKE -- + INSERT INTO AB(a) VALUES(a2.c); -- - Error create proc arg_bundle_2(a1 like AB, a2 like CD) begin insert into AB(a) from a2(like use_c); end; -- TEST: arg bundle one column, in order -- + INSERT INTO AB(a) VALUES(a2.c); -- - Error create proc arg_bundle_3(a1 like AB, a2 like CD) begin insert into AB(a) from a2; end; -- TEST: arg bundle all columns -- + INSERT INTO AB(a, b) VALUES(a1.a, a1.b); -- - Error create proc arg_bundle_4(a1 like AB, a2 like CD) begin insert into AB from a1; end; -- TEST: arg bundle reverse order using LIKE (arg mismatch) -- + INSERT INTO AB(a, b) VALUES(a1.b, a1.a); -- + incompatible types in expression 'a' -- +1 Error create proc arg_bundle_5(a1 like AB, a2 like CD) begin insert into AB from a1(like BA); end; -- TEST: arg bundle reverse order using LIKE both reversed -- + INSERT INTO AB(b, a) VALUES(a1.b, a1.a); -- - Error create proc arg_bundle_6(a1 like AB, a2 like CD) begin insert into AB(like BA) from a1(like BA); end; -- TEST: arg bundle non-name matching columns (this is ok, all in order) -- + INSERT INTO AB(a, b) VALUES(a2.c, a2.d); -- - Error create proc arg_bundle_7(a1 like AB, a2 like CD) begin insert into AB from a2; end; -- TEST: arg bundle out of order, no autoexpand (types mismatch) -- + INSERT INTO AB(b, a) VALUES(a1.a, a1.b); -- + Error % incompatible types in expression 'b' -- +1 Error create proc arg_bundle_8(a1 like AB, a2 like CD) begin insert into AB(b,a) from a1; end; -- TEST: arg bundle out of order, no autoexpand, loading from alternate names (types mismatch) -- + INSERT INTO AB(b, a) VALUES(a2.c, a2.d); -- + Error % incompatible types in expression 'b' -- +1 Error create proc arg_bundle_9(a1 like AB, a2 like CD) begin insert into AB(b,a) from a2; end; -- TEST: arg bundle into cursor in order but field names different -- + FETCH C(a, b) FROM VALUES(a2.c, a2.d); -- - Error create proc arg_bundle_10(a1 like AB, a2 like CD) begin declare C cursor like AB; fetch C from a2; end; -- TEST: arg bundle into cursor in order field names same -- + FETCH C(a, b) FROM VALUES(a1.a, a1.b); -- - Error create proc arg_bundle_11(a1 like AB, a2 like CD) begin declare C cursor like AB; fetch C from a1; end; -- TEST: arg bundle into cursor in order, but not all fields -- + FETCH C(a, b) FROM VALUES(a1.a, NULL); -- - Error create proc arg_bundle_12(a1 like AB, a2 like CD) begin declare C cursor like AB; fetch C(a) from a1; end; -- TEST: arg bundle update cursor, all fields, autoexpand -- + UPDATE CURSOR C(a, b) FROM VALUES(a1.a, a1.b); -- - Error create proc arg_bundle_13(a1 like AB, a2 like CD) begin declare C cursor like AB; update cursor C from a1; end; -- TEST: arg bundle update cursor, one field, name doesn't match -- + UPDATE CURSOR C(a) FROM VALUES(a2.c); -- - Error create proc arg_bundle_14(a1 like AB, a2 like CD) begin declare C cursor like AB; update cursor C(a) from a2; end; -- TEST: arg bundle update cursor, all fields, names don't match -- + UPDATE CURSOR C(a, b) FROM VALUES(a2.c, a2.d); -- - Error create proc arg_bundle_15(a1 like AB, a2 like CD) begin declare C cursor like AB; update cursor C from a2; end; -- TEST: arg bundle update cursor, all fields, names don't match -- + UPDATE CURSOR C(a, b) FROM VALUES(a2.c, a2.d); -- - Error create proc arg_bundle_16(a1 like AB, a2 like CD) begin declare C cursor like a1; update cursor C from a2; end; -- TEST: a simple virtual table form -- + {create_virtual_table_stmt}: basic_virtual: { id: integer, t: text } virtual @recreate -- the exact module name encodes this list so keeping the whole tree shape here -- misc attributes are tested elsewhere so there's no need to go crazy on arg varieties here -- + | {module_info} -- + | | {name module_name} -- + | | {misc_attr_value_list} -- + | | {name this} -- + | | {misc_attr_value_list} -- + | | {name that} -- + | | {misc_attr_value_list} -- + | | {name the_other} create virtual table basic_virtual using module_name(this, that, the_other) as ( id integer, t text ); -- TEST: virtual table error case -- + {create_virtual_table_stmt}: err -- + {create_table_stmt}: err -- + Error % duplicate column name 'id' -- +1 Error create virtual table broken_virtual_table using module_name as ( id integer, id integer ); -- TEST: no indices on virtual tables -- + {create_index_stmt}: err -- + Error % cannot add an index to a virtual table 'basic_virtual' -- +1 Error create index some_index on basic_virtual(id); -- TEST: no triggers on virtual tables -- + {create_trigger_stmt}: err -- + Error % cannot add a trigger to a virtual table 'basic_virtual' -- +1 Error create trigger no_triggers_on_virtual before delete on basic_virtual begin delete from bar where rate > id; end; -- TEST: no alters on virtual tables -- + {alter_table_add_column_stmt}: err -- + Error % cannot use ALTER TABLE on a virtual table 'basic_virtual' -- +1 Error alter table basic_virtual add column xname text; -- TEST: must specify appropriate delete attribute -- + {create_virtual_table_stmt}: err -- + Error % when deleting a virtual table you must specify @delete(nn, cql:module_must_not_be_deleted_see_docs_for_CQL0392) as a reminder not to delete the module for this virtual table 'deleting_virtual' -- +1 Error create virtual table deleting_virtual using module_name(this, that, the_other) as ( id integer, t text ) @delete(1); -- TEST: using module attribute in an invalid location -- + {create_table_stmt}: err -- + Error % built-in migration procedure not valid in this context 'cql:module_must_not_be_deleted_see_docs_for_CQL0392' -- +1 Error create table any_table_at_all( id integer, t text ) @create(1, cql:module_must_not_be_deleted_see_docs_for_CQL0392); -- TEST: must specify appropriate delete attribute, done correctly -- + {create_virtual_table_stmt}: deleting_virtual_correctly: { id: integer, t: text } deleted virtual @delete(1) -- - Error create virtual table deleting_virtual_correctly using module_name(this, that, the_other) as ( id integer, t text ) @delete(1, cql:module_must_not_be_deleted_see_docs_for_CQL0392); -- TEST: emit an enum -- + {emit_enums_stmt}: ok -- - Error @emit_enums ints; -- TEST: emit an enum (failed case) -- + {emit_enums_stmt}: err -- + Error % enum not found 'bogus_enum_name' -- +1 Error @emit_enums bogus_enum_name; -- TEST: try a check expression -- + {create_table_stmt}: with_check_expr: { v: integer } -- + {check_def}: ok -- + {gt}: bool -- + {name v}: v: integer -- + {int 5}: integer notnull -- + CHECK (v > 5) -- - Error create table with_check_expr( v integer, check (v > 5) ); -- TEST: can't use random in a constraint expression -- + {create_table_stmt}: err -- + Error % function may not appear in this context 'random' -- +1 Error create table with_check_expr_random( v integer, check (v > random()) ); -- TEST: can't use changes in a constraint expression -- + {create_table_stmt}: err -- + Error % function may not appear in this context 'changes' -- +1 Error create table with_check_expr_changes( v integer, check (v > changes()) ); -- TEST: can't use UDF in a constraint expression -- + {create_table_stmt}: err -- + Error % User function cannot appear in a constraint expression 'SqlUserFunc' -- +1 Error create table with_check_expr_udf( v integer, check (v > SqlUserFunc(1)) ); -- TEST: random takes no args -- + {select_stmt}: err -- + Error % function got incorrect number of arguments 'random' -- +1 Error select random(5); -- TEST: random success case -- + {select_stmt}: select: { _anon: longint notnull } -- + {name random}: longint notnull -- - Error select random(); -- TEST: can't use nested select in a constraint expression -- + {create_table_stmt}: err -- + Error % Nested select expressions may not appear inside of a constraint expression -- +1 Error create table with_check_expr_select( v integer, check (v > (select 5)) ); -- TEST: can't use 'now' in strftime in a constraint expression -- + {create_table_stmt}: err -- + Error % function may not appear in this context 'strftime' -- +1 Error create table with_check_expr_strftime( t text check (t > strftime('%s', 'now')) ); -- TEST: can't use 'now' in time in a constraint expression -- + {create_table_stmt}: err -- + Error % function may not appear in this context 'date' -- +1 Error create table with_check_expr_date( t text check (t > date('now')) ); -- TEST: check expression error -- + {create_table_stmt}: err -- + {check_def}: err -- + Error % name not found 'q' -- +1 Error create table with_bogus_check_expr( v integer, check (q > 5) ); -- TEST: declare type definition -- + {declare_named_type}: text sensitive -- + {name my_type}: text sensitive -- + {sensitive_attr}: text sensitive -- + {type_text}: text -- - Error declare my_type type text @sensitive; -- TEST: can't add sensitive again -- + Error % an attribute was specified twice '@sensitive' -- +1 Error declare redundant_sensitive my_type @sensitive; -- TEST: ok to add not null, it's not there already -- verify the rewrite and also the type info -- + DECLARE adding_notnull TEXT @SENSITIVE NOT NULL; -- + {declare_vars_type}: text notnull sensitive -- + {name_list}: adding_notnull: text notnull variable sensitive -- - Error declare adding_notnull my_type not null; -- TEST: verify the check in the context of func create -- + {declare_func_stmt}: err -- + Error % an attribute was specified twice '@sensitive' -- +1 Error declare function adding_attr_to_func_redundant() create my_type @sensitive; -- TEST: just verify this is correct -- + {declare_named_type}: text notnull -- + {name text_nn}: text notnull -- - Error declare text_nn type text not null; -- TEST: try to add not null more than once, force the error inside of sensitive ast -- + {declare_vars_type}: err -- + Error % an attribute was specified twice 'not null' -- +1 Error declare nn_var_redundant text_nn not null @sensitive; -- TEST: ok to add @sensitive -- + {declare_vars_type}: text notnull sensitive -- + {name_list}: nn_var_sens: text notnull variable sensitive -- - Error declare nn_var_sens text_nn @sensitive; -- TEST: declare type using another declared type -- + DECLARE my_type_1 TYPE TEXT @SENSITIVE; -- - Error declare my_type_1 type my_type; -- TEST: declare type using another declared type -- + DECLARE my_type_2 TYPE TEXT @SENSITIVE; -- - Error declare my_type_2 type my_type_1; -- TEST: declare type using another declared type -- + {declare_named_type}: err -- + Error % unknown type 'bogus_type' -- +1 Error declare my_type type bogus_type; -- TEST: duplicate declare type definition -- + {declare_named_type}: err -- + Error % duplicate type declaration 'my_type' -- +1 Error declare my_type type integer; -- TEST: use declared type in variable declaration -- + DECLARE my_var TEXT @SENSITIVE; -- + {declare_vars_type}: text sensitive -- - Error declare my_var my_type; -- TEST: use bogus declared type in variable declaration -- + {declare_vars_type}: err -- + {name bogus_type}: err -- + Error % unknown type 'bogus_type' -- +1 Error declare my_var bogus_type; -- TEST: create local named type with same name. the local type have priority -- + {create_proc_stmt}: ok -- + DECLARE my_type TYPE INTEGER; -- + DECLARE my_var INTEGER; create proc named_type () begin declare my_type type integer; declare my_var my_type; end; -- TEST declare a sensitive and not null type -- + DECLARE my_type_sens_not TYPE TEXT NOT NULL @SENSITIVE; -- - Error declare my_type_sens_not type text not null @sensitive; -- TEST: declared type in column definition -- + id TEXT @SENSITIVE NOT NULL -- + {create_table_stmt}: t: { id: text notnull sensitive } -- + {col_def}: id: text notnull sensitive -- + {col_def_type_attrs}: ok -- + {name id} -- + {type_text}: text -- + {sensitive_attr}: ok -- + {col_attrs_not_null} -- - Error create table t(id my_type_sens_not); -- TEST: declared type in column definition with error -- + {create_table_stmt}: err -- + {col_def}: err -- + {col_def_type_attrs}: err -- + {name bogus_type} -- + Error % unknown type 'bogus_type' -- +1 Error create table t(id bogus_type); -- TEST: declared type in cast expr -- + SELECT CAST(1 AS TEXT); -- + {select_stmt}: select: { _anon: text notnull } -- - Error select cast(1 as my_type); -- TEST: declared type in cast expr with error -- + SELECT CAST(1 AS bogus_type); -- + {name bogus_type}: err -- + Error % unknown type 'bogus_type' -- +1 Error select cast(1 as bogus_type); -- TEST: declared type in param -- + CREATE PROC decl_type (label TEXT @SENSITIVE) -- + {create_proc_stmt}: ok -- - Error create proc decl_type(label my_type) begin end; -- TEST: declared type in param with error -- + {create_proc_stmt}: err -- + {name bogus_type}: err -- + Error % unknown type 'bogus_type' -- +1 Error create proc decl_type_err(label bogus_type) begin end; -- TEST: declared type in declare function -- + DECLARE FUNC decl_type_func (arg1 INTEGER) TEXT @SENSITIVE; -- + {declare_func_stmt}: text sensitive -- - Error declare func decl_type_func (arg1 integer) my_type; -- TEST: declared type in declare function with err -- + DECLARE FUNC decl_type_func_err (arg1 INTEGER) bogus_type; -- + {declare_func_stmt}: err -- + {name bogus_type}: err -- + Error % unknown type 'bogus_type' -- +1 Error declare func decl_type_func_err (arg1 integer) bogus_type; create table to_copy( f1 integer, f2 integer not null, f3 integer not null @sensitive, f4 integer @sensitive ); -- TEST: ensure all attributes correctly copied -- + CREATE TABLE the_copy( -- + f1 INTEGER, -- + f2 INTEGER NOT NULL, -- + f3 INTEGER @SENSITIVE NOT NULL, -- + f4 INTEGER @SENSITIVE -- - Error create table the_copy( like to_copy ); -- TEST: ensure proc arguments are rewritten correctly -- + CREATE PROC uses_complex_table_attrs (f1_ INTEGER, f2_ INTEGER NOT NULL, f3_ INTEGER NOT NULL @SENSITIVE, f4_ INTEGER @SENSITIVE) -- - Error create proc uses_complex_table_attrs(like to_copy) begin end; -- TEST: ensure proc arguments are rewritten correctly -- + DECLARE PROC uses_complex_table_attrs (f1_ INTEGER, f2_ INTEGER NOT NULL, f3_ INTEGER NOT NULL @SENSITIVE, f4_ INTEGER @SENSITIVE) -- - Error declare proc uses_complex_table_attrs(like to_copy); -- TEST: ensure func arguments are rewritten correctly -- + DECLARE FUNC function_uses_complex_table_attrs (f1_ INTEGER, f2_ INTEGER NOT NULL, f3_ INTEGER NOT NULL @SENSITIVE, f4_ INTEGER @SENSITIVE) INTEGER; -- - Error declare function function_uses_complex_table_attrs(like to_copy) integer; -- TEST: ensure cursor includes not-null and sensitive -- + {declare_cursor_like_name}: complex_attr_cursor: to_copy: { f1: integer, f2: integer notnull, f3: integer notnull sensitive, f4: integer sensitive } variable shape_storage value_cursor -- - Error declare complex_attr_cursor cursor like to_copy; -- TEST: make a function that creates sensitive -- + {declare_func_stmt}: object create_func sensitive -- + {create_data_type}: object create_func sensitive -- + {sensitive_attr}: object sensitive -- + {type_object}: object -- - Error declare function maybe_create_func_sensitive() create object @sensitive; -- TEST: make a function that creates blob -- + {declare_func_stmt}: blob notnull create_func -- + {create_data_type}: blob notnull create_func -- + {notnull}: blob notnull -- + {type_blob}: blob -- - Error declare function maybe_create_func_blob() create blob not null; -- TEST: make a function that creates text -- + {declare_func_stmt}: text create_func -- + {create_data_type}: text create_func -- + {type_text}: text -- - Error declare function maybe_create_func_text() create text; -- TEST: make a function that creates int -- + {declare_func_stmt}: err -- + {create_data_type}: err -- + Error % Return data type in a create function declaration can only be Text, Blob or Object -- +1 Error declare function maybe_create_func_int() create int; -- TEST: make a function that creates bool -- + {declare_func_stmt}: err -- + {create_data_type}: err -- + Error % Return data type in a create function declaration can only be Text, Blob or Object -- +1 Error declare function maybe_create_func_bool() create bool; -- TEST: make a function that creates long -- + {declare_func_stmt}: err -- + {create_data_type}: err -- + Error % Return data type in a create function declaration can only be Text, Blob or Object -- +1 Error declare function maybe_create_func_long() create long not null @sensitive; -- TEST: declare a named type for object Foo -- + {declare_named_type}: object<Foo> notnull sensitive -- + {sensitive_attr}: object<Foo> notnull sensitive -- + {notnull}: object<Foo> notnull -- + {type_object}: object<Foo> -- + {name Foo} -- - Error declare type_obj_foo type object<Foo> not null @sensitive; -- TEST: declared function that return create object -- + DECLARE FUNC type_func_return_create_obj () CREATE OBJECT<Foo> NOT NULL @SENSITIVE; -- + {declare_func_stmt}: object<Foo> notnull create_func sensitive -- - Error declare function type_func_return_create_obj() create type_obj_foo; -- TEST: declared function that return create bogus object -- + {declare_func_stmt}: err -- + {create_data_type}: err -- + Error % unknown type 'bogus_type' -- +1 Error declare function type_func_return_create_bogus_obj() create bogus_type; -- TEST: declared function that return object -- + DECLARE FUNC type_func_return_obj () OBJECT<Foo> NOT NULL @SENSITIVE; -- + {declare_func_stmt}: object<Foo> notnull sensitive -- - Error declare function type_func_return_obj() type_obj_foo; -- TEST: declare type as enum name -- + DECLARE my_enum_type TYPE INTEGER<ints> NOT NULL; -- + {declare_named_type}: integer<ints> notnull -- + {notnull}: integer<ints> notnull -- - Error declare my_enum_type type ints; -- TEST: used a named type's name to declare an enum -- + {declare_enum_stmt}: err -- + Error % duplicate type declaration 'my_type' -- +1 Error declare enum my_type integer ( negative_one = -1, postive_one = 1 ); -- TEST: make x coordinate for use later, validate that it has a kind -- + {type_int}: integer<x_coord> -- - Error declare x1, x2, x3 integer<x_coord>; -- TEST: make x coordinate for use later, validate that it has a kind -- + {type_int}: integer<y_coord> -- - Error declare y1, y2, y3 integer<y_coord>; -- TEST: try to assign an x to a y -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set x1 := y1; -- TEST: try to assign an x to a y -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set x1 := y1; -- TEST: try to add and x and a y -- + {add}: err -- + {name x1}: x1: integer<x_coord> variable -- + {name y1}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set x1 := x1 + y1; -- TEST: this is ok, it's still an x -- + {mul}: integer<x_coord> -- - Error set x1 := x1 * 2; -- TEST: this is ok, it's still an x -- + {add}: integer<x_coord> -- - Error set x1 := x1 + x2; declare bb bool; -- TEST: this is ok, comparison of same types (equality) -- + {eq}: bool -- - Error set bb := x1 = x2; -- TEST: this is ok, comparison of same types (inequality) -- + {lt}: bool -- - Error set bb := x1 < x2; -- TEST: comparison of two incompatible types (equality) -- + {eq}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set bb := x1 = y1; -- TEST: comparison of two incompatible types (inequality) -- + {lt}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set bb := x1 < y1; -- TEST: make an alias for an integer with kind (x) -- + {declare_named_type}: integer<x_coord> -- + {name _x}: integer<x_coord> -- + {type_int}: integer<x_coord> -- + {name x_coord} -- - Error declare _x type integer<x_coord>; -- TEST: make an alias for an integer with kind (y) -- + {name y_coord} -- - Error declare _y type integer<y_coord>; -- TEST: declare an integer with the type alias -- + DECLARE x4 INTEGER<x_coord>; -- + {declare_vars_type}: integer<x_coord> -- + {name_list}: x4: integer<x_coord> variable -- + {name x4}: x4: integer<x_coord> variable -- + {type_int}: integer<x_coord> -- + {name x_coord} -- - Error declare x4 _x; -- TEST: use the named type version, should be the same -- + {assign}: x1: integer<x_coord> variable -- + {name x1}: x1: integer<x_coord> variable -- + {name x4}: x4: integer<x_coord> variable -- - Error set x1 := x4; -- TEST: make a table that has mixed kinds -- + {create_table_stmt}: xy: { x: integer<x_coord>, y: integer<y_coord> } -- + {col_def}: x: integer<x_coord> -- + {col_def}: y: integer<y_coord> create table xy( x _x, y _y ); -- TEST: valid insert the kinds match -- + {insert_stmt}: ok -- + {name xy}: xy: { x: integer<x_coord>, y: integer<y_coord> } -- - Error insert into xy using x1 x, y1 y; -- TEST: invalid insert the kinds don't match (y1 is not an xcoord) -- + {insert_stmt}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error insert into xy using y1 x, x1 y; -- TEST: insert into the table with matching coordinates -- + {insert_stmt}: ok -- + {name xy}: xy: { x: integer<x_coord>, y: integer<y_coord> } insert into xy select xy.x, xy.y from xy where xy.x = 1; -- TEST: insert into the table with coordinates reversed (error) -- + {insert_stmt}: err -- + Error % expressions of different kinds can't be mixed: 'y_coord' vs. 'x_coord' -- +1 Error insert into xy select xy.y, xy.x from xy where xy.x = 1; -- TEST: compound select with matching object kinds (use as to make the names match) -- + {select_stmt}: UNION ALL: { x: integer<x_coord>, y: integer<y_coord> } -- - Error select x1 as x, y1 as y union all select x2 as x, y2 as y; -- TEST: compound select with not matching object kinds (as makes the name match) -- but the kind is wrong so you still get an error (!) -- + {select_stmt}: err -- + Error % expressions of different kinds can't be mixed: 'y_coord' vs. 'x_coord' -- +1 Error select x1 as x, y1 as y union all select y2 as x, x2 as y; -- TEST: insert into xy with values, kinds are ok -- + {insert_stmt}: ok -- - Error insert into xy values (x1, y1), (x2, y2); -- TEST: insert into xy with values, kinds are ok -- + {insert_stmt}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error insert into xy values (x1, y1), (y2, x2), (x3, y3); -- TEST: cursor should have the correct shape including kinds -- + {declare_cursor_like_name}: xy_curs: xy: { x: integer<x_coord>, y: integer<y_coord> } variable shape_storage value_cursor declare xy_curs cursor like xy; -- TEST: fetch cursor, ok, kinds match -- + {fetch_values_stmt}: ok -- + {name xy_curs}: xy_curs: xy: { x: integer<x_coord>, y: integer<y_coord> } variable shape_storage value_cursor -- - Error fetch xy_curs from values(x1, y1); -- TEST: fetch cursor but kinds do not match -- + Error % expressions of different kinds can't be mixed: 'y_coord' vs. 'x_coord' -- +1 Error fetch xy_curs from values(y1, x1); -- some variables of a different type -- - Error declare v1, v2, v3 integer<v>; -- TEST: when with matching variable kinds this is ok, it's x1 or x1 -- + {assign}: x1: integer<x_coord> variable -- + {name x1}: x1: integer<x_coord> variable -- + {case_expr}: integer<x_coord> -- - Error set x1 := case when 1 then x1 else x1 end; -- TEST: when with non-matching variable x and y mixed -- + {case_expr}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set x1 := case when 1 then x1 else y1 end; -- TEST: case expressions match (x and x), this is ok -- + {assign}: v1: integer<v> variable -- + {name v1}: v1: integer<v> variable -- - Error set v1 := case x1 when x2 then v1 else v2 end; -- TEST: invalid mixing of x and y in the when expression -- note extra line breaks to ensure any reported errors are on different lines for help with diagnosis -- + {case_expr}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set v1 := case x1 when x2 then v1 when y1 then v2 else v3 end; -- TEST: need a bool for the subsequent stuff -- - Error declare b0 bool; -- TEST: in expression has valid kinds, no problem here -- + {assign}: b0: bool variable -- + {in_pred}: bool -- + {name x1}: x1: integer<x_coord> variable -- + {expr_list}: x1: integer<x_coord> variable -- + {expr_list}: x2: integer<x_coord> variable -- + {expr_list}: x3: integer<x_coord> variable -- - Error set b0 := x1 in (x1, x2, x3); -- TEST: in expression has mixed kinds -- + {assign}: err -- + {in_pred}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set b0 := x1 in (x1, y2, x3); -- TEST: in expression using select -- + {assign}: b0: bool variable -- + {in_pred}: bool -- + {select_stmt}: x2: integer<x_coord> variable set b0 := (select x1 in (select x2)); -- TEST: in expression using select, but select result is the wrong kind -- + {assign}: err -- + {in_pred}: err -- + {select_stmt}: err -- + {select_core_list}: select: { y1: integer<y_coord> variable } -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set b0 := (select x1 in (select y1)); -- TEST: between with kinds, all matching -- + {assign}: b0: bool variable -- + {between_rewrite}: bool -- - Error set b0 := x1 between x2 and x3; -- TEST: left between operand is of the wrong kind -- + {assign}: err -- + {between}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set b0 := x1 between y2 and 12; -- TEST: right between operand is of the wrong kind -- + {assign}: err -- + {between}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set b0 := x1 between 34 and y3; -- TEST: left and right could be used but they don't match each other -- + {assign}: err -- + {between}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set b0 := 56 between x2 and y3; -- TEST: negation preserves the kind, kind ok so this works -- + {assign}: x1: integer<x_coord> variable -- + | {name x1}: x1: integer<x_coord> variable -- + | {uminus}: integer<x_coord> set x1 := -x2; -- TEST: negation preserves the kind, hence we get an error -- + {assign}: err -- + {uminus}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set x1 := -y1; -- TEST: coalesce compatible kinds (should preserve kind) -- + {assign}: x1: integer<x_coord> variable -- + {call}: integer<x_coord> -- - Error set x1 := coalesce(x1, x2, x3); -- TEST: coalesce incompatible kinds (should preserve kind) -- + {assign}: err -- + {call}: err -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set x1 := coalesce(x1, y2, x3); -- TEST: cast ok direct conversion -- + {assign}: x1: integer<x_coord> variable -- + {name x1}: x1: integer<x_coord> variable -- + {cast_expr}: integer<x_coord> -- - Error set x1 := cast(y1 as integer<x_coord>); -- TEST: cast ok direct conversion (using type name) (check for rewrite too) -- + SET x1 := CAST(y1 AS INTEGER<x_coord>); -- + {assign}: x1: integer<x_coord> variable -- + {name x1}: x1: integer<x_coord> variable -- + {cast_expr}: integer<x_coord> -- - Error set x1 := cast(y1 as _x); -- TEST: cast ok, strip kind explicitly -- + {assign}: x1: integer<x_coord> variable -- + {name x1}: x1: integer<x_coord> variable -- + {cast_expr}: integer -- + {name y1}: y1: integer<y_coord> variable -- - Error set x1 := cast(y1 as integer); -- TEST: cast bad, kinds don't match now -- + {assign}: err -- + {name x1}: x1: integer<x_coord> variable -- + Error % expressions of different kinds can't be mixed: 'x_coord' vs. 'y_coord' -- +1 Error set x1 := cast(x1 as integer<y_coord>); -- TEST: vault_sensitive attribution is not supported on select table node -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {select_stmt}: err -- Error % vault_sensitive attribute may only be added to a create procedure statement -- +1 Error @attribute(cql:vault_sensitive) select * from foo; -- TEST: vault_sensitive attribution with invalid value -- + {stmt_and_attr}: err -- + Error % vault_sensitive column does not exist in result set 'bogus' -- + Error % vault_sensitive column does not exist in result set 'nan' -- +2 Error @attribute(cql:vault_sensitive=(bogus, nan)) create proc vault_sensitive_with_invalid_values() begin select * from bar; end; -- TEST: vault_sensitive attribution with valid value -- + {stmt_and_attr}: ok -- - Error @attribute(cql:vault_sensitive=(name, rate)) create proc vault_sensitive_with_valid_values() begin select * from bar; end; -- TEST: vault_sensitive attribution with invalid single column -- + Error % vault_sensitive column does not exist in result set 'bogus' -- +1 Error @attribute(cql:vault_sensitive=bogus) create proc vault_sensitive_with_invalid_single_column() begin select * from bar; end; -- TEST: vault_sensitive attribution with an not string value -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {create_proc_stmt}: err -- + {int 1}: err -- Error % all arguments must be names 'vault_sensitive' -- +1 Error @attribute(cql:vault_sensitive=1) create proc vault_sensitive_with_not_string_value_proc_val() begin end; -- TEST: vault_sensitive attribution with an not string value -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {create_proc_stmt}: err -- + {int 1}: err -- Error % all arguments must be names 'vault_sensitive' -- +1 Error @attribute(cql:vault_sensitive=(name, 1, 'lol')) create proc vault_sensitive_with_not_strings_value_proc_val() begin end; -- TEST: vault_sensitive attribution with literal string -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {create_proc_stmt}: err -- + {strlit 'lol'}: err -- + Error % all arguments must be names 'vault_sensitive' -- +1 Error @attribute(cql:vault_sensitive='lol') create proc vault_sensitive_with_lit_string_value_proc_val() begin end; -- TEST: vault_sensitive attribution with invalid encode context and encode column -- + {stmt_and_attr}: err -- + Error % vault_sensitive column does not exist in result set 'bogus' -- + Error % vault_sensitive column does not exist in result set 'nan' -- +2 Error @attribute(cql:vault_sensitive=(bogus, (nan))) create proc vault_sensitive_with_invalid_encode_context_columns() begin select * from bar; end; -- TEST: vault_sensitive attribution with an not string value encode context -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {create_proc_stmt}: err -- + {int 1}: err -- Error % all arguments must be names 'vault_sensitive' -- +1 Error @attribute(cql:vault_sensitive=(1, (name))) create proc vault_sensitive_with_not_string_vault_context_proc_val() begin end; -- TEST: vault_sensitive attribution with literal string encode context -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {create_proc_stmt}: err -- + {strlit 'lol'}: err -- Error % all arguments must be names 'vault_sensitive' -- +1 Error @attribute(cql:vault_sensitive=('lol', (name))) create proc vault_sensitive_with_literal_string_vault_context_proc_val() begin end; -- TEST: vault_sensitive attribution with an not string value encode column -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {create_proc_stmt}: err -- + {int 1}: err -- Error % all arguments must be names 'vault_sensitive' -- +1 Error @attribute(cql:vault_sensitive=(name, (1))) create proc vault_sensitive_with_not_string_vault_column_proc_val() begin end; -- TEST: test table with both sensitive and non-sensitive columns -- + {create_table_stmt}: bar_with_sensitive: { id: integer notnull, name: text sensitive, title: text sensitive, intro: text } -- - Error create table bar_with_sensitive( id integer not null, name text @sensitive @create(2), title text @sensitive @create(2), intro text @create(2) ); -- TEST: vault_sensitive attribution with sensitive encode column -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {create_proc_stmt}: err -- Error % encode context column can't be sensitive 'name' -- +1 Error @attribute(cql:vault_sensitive=(name, (id, title))) create proc vault_sensitive_with_sensitive_encode_context_column_proc_val() begin select * from bar_with_sensitive; end; -- TEST: vault_sensitive attribution with invalid nested encode columns -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {create_proc_stmt}: err -- Error % all arguments must be names 'vault_sensitive' -- +1 Error @attribute(cql:vault_sensitive=(intro, (id, (title)))) create proc vault_sensitive_with_invalid_nested_vault_column_proc_val() begin select * from bar_with_sensitive; end; -- TEST: vault_sensitive attribution with multi encode context columns -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- + {create_proc_stmt}: err -- Error % encode context column can be only specified in front 'id' -- +1 Error @attribute(cql:vault_sensitive=(intro, (name), id)) create proc vault_sensitive_with_multi_encode_context_columns_proc_val() begin select * from bar_with_sensitive; end; -- TEST: vault_sensitive attribution with valid context and encode columns -- + {stmt_and_attr}: ok -- - Error @attribute(cql:vault_sensitive=(intro, (name, title))) create proc vault_sensitive_with_valid_context_and_encode_columns() begin select * from bar_with_sensitive; end; -- TEST: strict encode context column -- + {enforce_strict_stmt}: ok -- - Error; @enforce_strict encode context column; -- TEST: vault_sensitive attribution with only encode column list -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- Error % context column must be specified if strict encode context column mode is enabled -- +1 Error @attribute(cql:vault_sensitive=(name, rate)) create proc vault_sensitive_with_only_encode_columns_strict_mode() begin select * from bar; end; -- TEST: vault_sensitive attribution with only one encode column -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- Error % context column must be specified if strict encode context column mode is enabled -- +1 Error @attribute(cql:vault_sensitive=name) create proc vault_sensitive_with_only_encode_column_strict_mode() begin select * from bar; end; -- TEST: vault_sensitive attribution with no columns -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- Error % context column must be specified if strict encode context column mode is enabled -- +1 Error @attribute(cql:vault_sensitive) create proc vault_sensitive_with_no_columns_strict_mode() begin select * from bar; end; -- TEST: vault_sensitive attribution with integer encode context -- + {stmt_and_attr}: ok -- - Error @attribute(cql:vault_sensitive=(id, (name))) create proc vault_sensitive_with_integer_encode_context() begin select * from bar; end; -- TEST: strict encode context type integer -- + {enforce_strict_stmt}: ok -- - Error; @enforce_strict encode context type integer; -- TEST: vault_sensitive attribution with integer encode context and strict mode -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- Error % encode context column in vault_senstive attribute must match the specified type in strict mode -- +1 Error @attribute(cql:vault_sensitive=(name, (rate))) create proc vault_sensitive_encode_context_integer_strict_mode() begin select * from bar; end; -- TEST verify back to normal mode -- + {enforce_normal_stmt}: ok -- - Error @enforce_normal encode context type integer; -- TEST: strict encode context type long_integer -- + {enforce_strict_stmt}: ok -- - Error; @enforce_strict encode context type long_integer; -- TEST: vault_sensitive attribution with long integer encode context and strict mode -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- Error % encode context column in vault_senstive attribute must match the specified type in strict mode -- +1 Error @attribute(cql:vault_sensitive=(name, (rate))) create proc vault_sensitive_encode_context_long_integer_strict_mode() begin select * from bar; end; -- TEST verify back to normal mode -- + {enforce_normal_stmt}: ok -- - Error @enforce_normal encode context type long_integer; -- TEST: strict encode context type real -- + {enforce_strict_stmt}: ok -- - Error; @enforce_strict encode context type real; -- TEST: vault_sensitive attribution with real encode context and strict mode -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- Error % encode context column in vault_senstive attribute must match the specified type in strict mode -- +1 Error @attribute(cql:vault_sensitive=(name, (rate))) create proc vault_sensitive_encode_context_real_strict_mode() begin select * from bar; end; -- TEST verify back to normal mode -- + {enforce_normal_stmt}: ok -- - Error @enforce_normal encode context type real; -- TEST: strict encode context type bool -- + {enforce_strict_stmt}: ok -- - Error; @enforce_strict encode context type bool; -- TEST: vault_sensitive attribution with bool encode context and strict mode -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- Error % encode context column in vault_senstive attribute must match the specified type in strict mode -- +1 Error @attribute(cql:vault_sensitive=(name, (rate))) create proc vault_sensitive_encode_context_bool_strict_mode() begin select * from bar; end; -- TEST verify back to normal mode -- + {enforce_normal_stmt}: ok -- - Error @enforce_normal encode context type bool; -- TEST: strict encode context type blob -- + {enforce_strict_stmt}: ok -- - Error; @enforce_strict encode context type blob; -- TEST: vault_sensitive attribution with blob encode context and strict mode -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- Error % encode context column in vault_senstive attribute must match the specified type in strict mode -- +1 Error @attribute(cql:vault_sensitive=(name, (rate))) create proc vault_sensitive_encode_context_blob_strict_mode() begin select * from bar; end; -- TEST verify back to normal mode -- + {enforce_normal_stmt}: ok -- - Error @enforce_normal encode context type blob; -- TEST: strict encode context type text -- + {enforce_strict_stmt}: ok -- - Error; @enforce_strict encode context type text; -- TEST: vault_sensitive attribution with integer encode context and strict mode -- + {stmt_and_attr}: err -- + {misc_attrs}: err -- Error % encode context column in vault_senstive attribute must match the specified type in strict mode -- +1 Error @attribute(cql:vault_sensitive=(id, (name, rate))) create proc vault_sensitive_with_integer_encode_context_strict_mode() begin select * from bar; end; -- TEST: vault_sensitive attribution with text encode context -- + {stmt_and_attr}: ok -- - Error @attribute(cql:vault_sensitive=(name, (rate))) create proc vault_sensitive_with_text_encode_context_strict_mode() begin select * from bar; end; -- TEST verify back to normal mode -- + {enforce_normal_stmt}: ok -- - Error @enforce_normal encode context type text; -- TEST verify back to normal mode -- + {enforce_normal_stmt}: ok -- - Error @enforce_normal encode context column; -- TEST: no_scan_table attribution on create proc node -- + {stmt_and_attr}: ok -- + {misc_attrs}: ok -- - Error @attribute(cql:vault_sensitive) create proc vault_sensitive_proc() begin end; -- TEST: validate vault_sensitive annotation only use with dml proc -- + {stmt_and_attr}: err -- + {create_proc_stmt}: err -- Error % vault_sensitive annotation can only go on a procedure that uses the database -- +1 Error @attribute(cql:vault_sensitive) create proc vault_sensitive_proc_dml() begin declare y text; end; -- TEST: ensure that ifnull parses properly after else, it's not "else if" -- + SELECT CASE WHEN 1 THEN 2 -- + ELSE ifnull(x, y) -- + END; -- + {call}: integer -- + {name ifnull} -- - Error select case when 1 then 2 else ifnull(x, y) end; -- TEST: hidden ignored on non-virtual tables -- + {create_table_stmt}: hidden_ignored_on_normal_tables: { x: integer notnull, y: integer } -- - Error create table hidden_ignored_on_normal_tables( x integer hidden not null, y integer ); -- TEST: hidden applied on virtual tables -- + {create_table_stmt}: virtual_with_hidden: { x: integer notnull hidden_col, y: integer } virtual @recreate -- - Error create virtual table virtual_with_hidden using module_name as ( x integer hidden not null, y integer ); -- TEST: hidden applied on virtual tables -- + Error % the HIDDEN column attribute must be the first attribute if present -- +1 Error create virtual table virtual_with_hidden_wrong using module_name as ( x integer not null hidden, y integer ); -- TEST: save the current state -- + {enforce_push_stmt}: ok -- - Error @enforce_push; -- force this on so we can verify that it is turned off @enforce_strict foreign key on update; -- get to a known state -- + {enforce_reset_stmt}: ok -- - Error @enforce_reset; -- TEST fk enforcement should be off -- + {create_table_stmt}: fk_strict_err_0: { id: integer foreign_key } -- - Error create table fk_strict_err_0 ( id integer REFERENCES foo(id) ); -- TEST: save the current state again -- + {enforce_push_stmt}: ok -- - Error @enforce_push; @enforce_strict foreign key on update; -- TEST enforcement should be on -- + Error % strict FK validation requires that some ON UPDATE option be selected for every foreign key -- +1 Error create table fk_strict_err_1 ( id integer REFERENCES foo(id) ); -- TEST: restore the previous state -- + {enforce_pop_stmt}: ok -- - Error @enforce_pop; -- TEST enforcement should be off -- + {create_table_stmt}: fk_strict_err_2: { id: integer foreign_key } -- - Error create table fk_strict_err_2 ( id integer REFERENCES foo(id) ); -- TEST: restore the state before our first push -- + {enforce_pop_stmt}: ok -- - Error @enforce_pop; -- TEST: pop too many enforcement options off the stack -- + {enforce_pop_stmt}: err -- + Error % @enforce_pop used but there is nothing to pop -- +1 Error @enforce_pop; -- TEST verify strict mode -- + {enforce_strict_stmt}: ok -- - Error @enforce_strict transaction; -- + Error % transaction operations disallowed while STRICT TRANSACTION enforcement is on. -- +1 Error -- + {begin_trans_stmt}: err begin transaction; -- TEST verify back to normal mode -- + {enforce_normal_stmt}: ok -- - Error @enforce_normal transaction; -- TEST transactions ok again -- + {begin_trans_stmt}: ok -- - Error begin transaction; -- TEST: strict if nothing -- + {enforce_strict_stmt}: ok -- - Error; @enforce_strict select if nothing; -- TEST: normal select is disallowed -- + {assign}: err -- + {select_stmt}: err -- + Error % strict select if nothing requires that all (select ...) expressions include 'if nothing' -- +1 Error set price_d := (select id from foo); -- TEST: nested select in SQL (e.g. correlated subquery) is ok even in strict select if nothing mode -- + SELECT ( SELECT 1 ); -- + {select_stmt}: select: { _anon: integer notnull } -- - Error select (select 1); -- TEST: select if nothing is allowed -- - Error set price_d := (select 1 if nothing -1); -- TEST: select if nothing or null is allowed -- - Error set price_d := (select 1 if nothing or null -1); -- TEST: select nothing or null null is redundant -- + {assign}: err -- + {select_if_nothing_or_null_expr}: err -- + Error % SELECT ... IF NOTHING OR NULL NULL is redundant; use SELECT ... IF NOTHING NULL instead -- +1 Error set price_d := (select 1 if nothing or null null); -- TEST: select nothing or null some_nullable is okay -- + {select_if_nothing_or_null_expr}: integer -- - Error set price_d := (select 1 if nothing or null (select null or 1)); -- TEST: nested select is not allowed either -- + {assign}: err -- + {select_stmt}: err -- + Error % strict select if nothing requires that all (select ...) expressions include 'if nothing' -- +1 Error set price_d := (select 1 if nothing (select id from foo)); -- TEST: nested select is ok if it has no from clause -- - Error set price_d := (select 1 if nothing (select 1)); -- TEST: explicit if nothing throw is ok -- + {select_if_nothing_throw_expr}: id: integer notnull -- - Error set price_d := (select id from foo if nothing throw); -- TEST: normal if nothing -- + {enforce_normal_stmt}: ok -- - Error; @enforce_normal select if nothing; -- TEST: simple select with else -- + {assign}: price_d: real<dollars> variable -- + {select_if_nothing_expr}: real notnull -- + {select_stmt}: _anon: integer notnull -- + {dbl 2.0}: real notnull -- - Error set price_d := (select 1 if nothing 2.0); -- TEST: simple select with else (upgrade from the left) -- + {assign}: price_d: real<dollars> variable -- + {select_if_nothing_expr}: real notnull -- + {select_stmt}: _anon: real notnull -- + {int 4}: integer notnull -- - Error set price_d := (select 3.0 if nothing 4); -- TEST: simple select with else (upgrade from the left) -- + {assign}: err -- + {select_if_nothing_expr}: err -- + {select_stmt}: _anon: real notnull -- + {name price_e}: price_e: real<euros> variable -- + Error % expressions of different kinds can't be mixed: 'dollars' vs. 'euros' -- +1 Error set price_d := (select 3.0 if nothing price_e); -- TEST: simple select with else (upgrade from the left) -- + {assign}: err -- + {select_if_nothing_expr}: err -- + {select_stmt}: price_d: real<dollars> variable -- + {name price_e}: err -- + Error % expressions of different kinds can't be mixed: 'dollars' vs. 'euros' -- +1 Error set my_real := (select price_d if nothing price_e); -- TEST: simple select with else (upgrade from the left) -- + {assign}: err -- + {select_if_nothing_or_null_expr}: err -- + {select_stmt}: _anon: text notnull -- + {name price_e}: price_e: real<euros> variable -- + Error % incompatible types in expression 'IF NOTHING OR NULL' -- +1 Error set price_d := (select "x" if nothing or null price_e); -- TEST: simple select with else (upgrade from the left) -- + {assign}: err -- + {select_if_nothing_or_null_expr}: err -- + {select_stmt}: _anon: text notnull -- + {name obj_var}: obj_var: object variable -- + Error % right operand cannot be an object in 'IF NOTHING OR NULL' -- +1 Error set price_d := (select "x" if nothing or null obj_var); -- - Error declare real_nn real not null; -- TEST: if nothing or null gets not null result if right side is not null -- + {assign}: real_nn: real notnull variable -- + {select_if_nothing_or_null_expr}: real notnull -- + {select_stmt}: my_real: real variable -- + {dbl 1.0}: real notnull -- - Error set real_nn := (select my_real if nothing or null 1.0); -- TEST: if nothing does NOT get not null result if only right side is not null -- + {assign}: err -- + Error % cannot assign/copy possibly null expression to not null target 'real_nn' -- +1 Error set real_nn := (select my_real if nothing 1.0); -- TEST: error inside the operator should prop out -- + {assign}: err -- + {select_if_nothing_expr}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error set real_nn := (select not 'x' if nothing 1.0); -- TEST: error inside of any other DML -- + {select_stmt}: err -- + Error % CQL0369: The (select ... if nothing) construct is for use in top level expressions, not inside of other DML -- +1 Error select (select 0 if nothing -1); -- TEST: error inside of any other DML -- + {delete_stmt}: err -- + Error % CQL0369: The (select ... if nothing) construct is for use in top level expressions, not inside of other DML -- +1 Error delete from foo where id = (select 33 if nothing 0); -- TEST: nested select with count will be not null because count must return a row -- + {select_stmt}: select: { _anon: integer notnull } -- - Error select (select count(*) from foo where 0); -- TEST: nested select with select * is not examined for not nullness, but no crashes or anything -- + {select_stmt}: select: { x: integer } -- - Error select (select * from (select 1 x) T); -- TEST: sum can return null, that's not a special case (sum(id) is weird but whatever) -- + {select_stmt}: select: { _anon: integer } -- - Error select (select sum(id) from foo where 0); -- TEST: any non aggregate with a where clause might be null -- + {select_stmt}: select: { _anon: integer } -- - Error select (select 1+3 where 0); -- TEST: with form is not simple, it doesn't get the treatment -- + {select_stmt}: select: { x: integer } -- - Error select (with y(*) as (select 1 x) select * from y); -- TEST: compound form is not simple, it doesn't get the treatment -- + {select_stmt}: select: { x: integer } -- - Error select (select 1 union all select 2) as x; @enforce_strict insert select; -- TEST: ok to insert with a simple select -- + {insert_stmt}: ok -- - Error insert into foo(id) select 1; -- TEST: top level compound select not ok -- + {insert_stmt}: err -- + Error % CQL0370: due to a memory leak bug in old SQLite versions, -- +1 Error insert into foo(id) select 1 union all select 1; -- TEST: top level join not ok -- + {insert_stmt}: err -- + Error % CQL0370: due to a memory leak bug in old SQLite versions, -- +1 Error insert into foo(id) select 1 from (select 1) as T1 inner join (select 2) as T2; -- TEST: WITH inside the insert is ok too if it has no join -- + {insert_stmt}: ok -- - Error insert into foo(id) with cte(id) as ( select 1) select * from cte; -- TEST: values are ok -- + {insert_stmt}: ok -- - Error insert into foo(id) values (1), (2), (3); @enforce_normal insert select; @enforce_strict table function; -- TEST: TVF in inner join is ok -- + {select_stmt}: select: { id: integer notnull, foo: text } -- - Error select * from foo inner join tvf(1); -- TEST: TVF on right of left join is an error -- + {select_stmt}: err -- + Error % table valued function used in a left/right/cross context; this would hit a SQLite bug. Wrap it in a CTE instead. -- +1 Error select * from foo left join tvf(1); -- TEST: TVF on left of right join is an error -- note SQLite doesn't support right join yet so this won't ever run -- + {select_stmt}: err -- + Error % table valued function used in a left/right/cross context; this would hit a SQLite bug. Wrap it in a CTE instead. -- +1 Error select * from tvf(1) right join foo; -- TEST: non TVF cross join is ok -- + {select_stmt}: select: { id: integer notnull, id: integer notnull } -- - Error select * from foo T1 cross join foo T2; @enforce_normal table function; -- TEST: LET stmt, int -- + {let_stmt}: int_var: integer notnull variable -- + {name int_var}: int_var: integer notnull variable -- - Error LET int_var := 1; -- TEST: LET stmt, long -- + {let_stmt}: long_var: longint notnull variable -- + {name long_var}: long_var: longint notnull variable -- - Error LET long_var := 1L; -- TEST: LET stmt, real with kind -- + {let_stmt}: price_dd: real<dollars> variable -- + {name price_dd}: price_dd: real<dollars> variable -- - Error LET price_dd := price_d; -- TEST: LET stmt, bool -- + {let_stmt}: bool_var: bool notnull variable -- + {name bool_var}: bool_var: bool notnull variable -- - Error LET bool_var := 1=1; -- TEST: LET stmt, bool -- + {let_stmt}: pen_var: real<real_things> notnull variable -- + {name pen_var}: pen_var: real<real_things> notnull variable -- - Error LET pen_var := real_things.pen; -- TEST: create function -> extra bits should be stripped -- - {let_stmt}: created_obj: object notnull variable create_func -- - {name created_obj}: created_obj: object notnull variable create_func -- + {let_stmt}: created_obj: object notnull variable -- + {name created_obj}: created_obj: object notnull variable -- + {call}: object notnull create_func -- - Error LET created_obj := creater_func(); -- TEST: LET stmt, NULL (null has no type) -- + {let_stmt}: err -- + Error % NULL expression has no type to imply the declaration of variable 'null_is_no_good' -- +1 Error LET null_is_no_good := NULL; -- TEST: LET error cases: bad expression -- + {let_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error LET bad_result := NOT 'x'; -- TEST: LET error cases: duplicate variable -- + {let_stmt}: err -- + Error % duplicate variable name in the same scope 'created_obj' -- +1 Error LET created_obj := 1; -- a not null variable for the switch tests LET z := 1; -- TEST: switch statement with bogus expression -- + {switch_stmt}: err -- + {int 0} -- + {switch_body} -- + Error % string operand not allowed in 'NOT' -- +1 Error switch not 'x' when 1 then nothing end; -- TEST: switch statement with bogus switch expression -- + {switch_stmt}: err -- + {int 0} -- + {switch_body} -- + Error % case expression must be a not-null integral type -- +1 Error switch 1.5 when 1 then nothing end; -- TEST: switch statement with when expression of the wrong type -- + {switch_stmt}: err -- + {int 0} -- + {switch_body} -- + Error % the type of a WHEN expression is bigger than the type of the SWITCH expression -- +1 Error switch z when 1L then nothing end; -- TEST: switch statement with not constant when expression -- + {switch_stmt}: err -- + {int 0} -- + {switch_body} -- + Error % the WHEN expression cannot be evaluated to a constant -- +1 Error switch z when 1+x then nothing end; -- TEST: switch statement with bogus when expression -- + {switch_stmt}: err -- + {int 0} -- + {switch_body} -- + Error % string operand not allowed in 'NOT' -- +1 Error switch z when not "x" then nothing end; -- TEST: switch statement with bogus statement list -- + {switch_stmt}: err -- + {int 0} -- + {switch_body} -- + {stmt_list}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error switch z when 1 then if not "x" then end if; end; -- TEST: switch statement with no actual code in it -- + {switch_stmt}: err -- + {int 0} -- + {switch_body} -- + {switch_case}: err -- + Error % switch statement did not have any actual statements in it -- +1 Error switch z when 1 then nothing -- no cases with statements when 2 then nothing -- no cases with statements end; let thing := integer_things.pen; -- TEST: switch statement combining ALL VALUES and ELSE is a joke -- + {switch_stmt}: err -- + {int 1} -- + {switch_body} -- - {expr_list}: err -- 2 {expr_list}: ok -- + Error % switch ... ALL VALUES is useless with an ELSE clause -- +1 Error switch thing all values when integer_things.pen, integer_things.pencil then set x := 10; when integer_things.paper then set x := 20; else set x := 30; end; -- TEST: switch statement with duplicate values -- + {switch_stmt}: err -- + {int 1} -- + Error % WHEN clauses contain duplicate values '2' -- +1 Error switch z when 1, 2 then set x := 10; when 2 then set x := 20; else set x := 30; end; -- TEST: switch statement with nullable switch expr -- + {switch_stmt}: err -- + {int 0} -- + {switch_body} -- + Error % case expression must be a not-null integral type -- +1 Error switch x when 1 then nothing end; -- TEST: switch statement that actually works, 3 cases, 3 expressions -- + {switch_stmt}: ok -- +2 {expr_list}: ok -- + {int 1}: integer notnull -- + {int 2}: integer notnull -- + {int 3}: integer notnull -- no stmt list for "nothing" -- +2 {stmt_list}: ok -- - Error switch z when 1, 2 then set y := 1; when 3 then nothing else set y := 2; end; -- we need this for the "all values" test, it's just a sample enum declare enum three_things integer ( zip = 0, -- an alias zero = 0, one = 1, two = 2, _count = 3 ); -- TEST: switch with all values test: all good here -- + {switch_stmt}: ok -- +1 {expr_list}: ok -- - Error switch three_things.zero all values when three_things.zero, three_things.one, three_things.two then set x := 1; end; -- TEST: all values used but the expression isn't an enum -- + {switch_stmt}: err -- + Error % SWITCH ... ALL VALUES is used but the switch expression is not an enum type -- +1 Error switch 1 all values when three_things.one, three_things.two then set x := 1; end; -- TEST: switch with all values test: three_things.zero is missing -- + {switch_stmt}: err -- + Error % a value exists in the enum that is not present in the switch 'zero' -- +1 Error switch three_things.zero all values when three_things.one, three_things.two then set x := 1; end; -- TEST: switch with all values test: three_things.one is missing -- + {switch_stmt}: err -- + Error % a value exists in the enum that is not present in the switch 'one' -- +1 Error switch three_things.zero all values when three_things.zero, three_things.two then set x := 1; end; -- TEST: switch with all values test: three_things.two is missing -- + {switch_stmt}: err -- + Error % a value exists in the enum that is not present in the switch 'two' -- +1 Error switch three_things.zero all values when three_things.zero, three_things.one then set x := 1; end; -- TEST: switch with all values test: -1 is extra -- + {switch_stmt}: err -- + Error % a value exists in the switch that is not present in the enum '-1' -- +1 Error switch three_things.zero all values when -1, three_things.zero, three_things.one, three_things.two then set x := 1; end; -- TEST: switch with all values test: 5 is extra -- + {switch_stmt}: err -- + Error % a value exists in the switch that is not present in the enum '5' -- +1 Error switch three_things.zero all values when three_things.zero, three_things.one, three_things.two, 5 then set x := 1; end; -- TEST: checking if something is NULL with '=' is an error -- + {eq}: err -- + Error % Comparing against NULL always yields NULL; use IS and IS NOT instead -- +1 Error select (1 = NULL); -- TEST: checking if something is not null with '<>' is an error -- + {ne}: err -- + Error % Comparing against NULL always yields NULL; use IS and IS NOT instead -- +1 Error select (1 <> NULL); -- TEST: a select expression with a null type is an error -- + {select_expr}: err -- + Error % SELECT expression is equivalent to NULL -- +1 Error select (1 + (SELECT NULL)); -- used in the next suite of tests declare proc out2_proc(x integer, out y integer not null, out z integer not null); -- TEST: try to do declare out on a non-existent procedure -- + {declare_out_call_stmt}: err -- + Error % DECLARE OUT requires that the procedure be already declared 'not_defined' -- +1 Error declare out call not_defined(); -- TEST: try to call a proc with no out args -- + {declare_out_call_stmt}: err -- + Error % DECLARE OUT CALL used on a procedure with no missing OUT arguments 'decl1' -- +1 Error declare out call decl1(1); -- TEST: try to call a proc but the args have errors -- + {declare_out_call_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error create proc decl_test_err() begin declare out call out2_proc(not 'x', u, v); end; -- TEST: try to call a proc but the proc had errors -- + {declare_out_call_stmt}: err -- + Error % CQL0213: procedure had errors, can't call 'decl_test_err' -- +1 Error declare out call decl_test_err(1, 2, 3); -- TEST: non-variable out arg in declare out -- + {declare_out_call_stmt}: err -- + Error % expected a variable name for out argument 'y' create proc out_decl_test_2(x integer) begin declare out call out2_proc(x, 1+3, v); end; -- we need a deleted table for the next test CREATE TABLE this_table_is_deleted( id INTEGER ) @DELETE(1); -- TEST: it's ok to have an index refer to a deleted table if the index is deleted -- the index now refers to a stub column, that's ok because we're only generating -- a drop for this index -- + CREATE INDEX deleted_index ON this_table_is_deleted (xyx) @DELETE(1); -- + {create_index_stmt}: err -- + Error % object is an orphan because its table is deleted. Remove rather than @delete 'deleted_index' -- +1 Error CREATE INDEX deleted_index ON this_table_is_deleted (xyx) @DELETE(1); -- TEST: it's ok to have a trigger be based on a deleted table if the trigger is also deleted -- + CREATE TRIGGER trigger_deleted -- + BEFORE DELETE ON this_table_is_deleted -- + BEGIN -- + SELECT 1; -- + END @DELETE(1); -- + {create_trigger_stmt}: err -- + Error % object is an orphan because its table is deleted. Remove rather than @delete 'trigger_deleted' -- +1 Error create trigger trigger_deleted before delete on this_table_is_deleted begin select 1; end @DELETE(1); -- TEST: standard usage of declare out -- + {declare_out_call_stmt}: ok -- + {call_stmt}: ok -- + {name u}: u: integer notnull variable implicit -- + {name v}: v: integer notnull variable implicit -- - Error create proc out_decl_test_3(x integer) begin declare out call out2_proc(x, u, v); end; -- + {declare_out_call_stmt}: ok -- + {call_stmt}: ok -- +1 {name u}: u: integer notnull variable implicit -- +2 {name u}: u: integer notnull variable -- - Error create proc out_decl_test_4(x integer) begin declare out call out2_proc(x, u, u); end; -- + {declare_out_call_stmt}: ok -- + {call_stmt}: ok -- +1 {name u}: u: integer notnull variable implicit -- +3 {name u}: u: integer notnull variable -- +1 {name v}: v: integer notnull variable implicit -- +1 {name v}: v: integer notnull variable -- - Error create proc out_decl_test_5(x integer) begin declare out call out2_proc(x, u, u); declare out call out2_proc(x, u, v); end; -- TEST: try the select using form -- we only need to verify the rewrite, all else is normal processing -- {insert_stmt}: ok -- + INSERT INTO with_kind(id, cost, value) SELECT 1 AS id, 3.5 AS cost, 4.8 AS value; -- - Error insert into with_kind using select 1 id, 3.5 cost, 4.8 value; -- TEST: try the select using form -- anonymous columns not allowed in this form -- {insert_stmt}: err -- + Error % all columns in the select must have a name -- +1 Error insert into with_kind using select 1, 3.5 cost, 4.8 value; -- TEST: try the select using form -- errors in the select must prop up -- {insert_stmt}: err -- + Error % string operand not allowed in 'NOT' -- +1 Error insert into with_kind using select not 'x', 3.5 cost, 4.8 value; -- TEST: try the select using form (and with clause) -- we only need to verify the rewrite, all else is normal processing -- {insert_stmt}: ok -- + INSERT INTO with_kind(id, cost, value) WITH -- + goo (x) AS (SELECT 1) -- + SELECT goo.x AS id, 3.5 AS cost, 4.8 AS value -- + FROM goo; -- - Error insert into with_kind using with goo(x) as (select 1) select goo.x id, 3.5 cost, 4.8 value from goo; -- TEST: use built-in migration -- + {create_table_stmt}: moving_to_recreate: { id: integer } @create(1) -- + {dot}: ok -- + {name cql} -- + {name from_recreate} -- - Error create table moving_to_recreate ( id integer ) @create(1, cql:from_recreate); -- TEST: try to use some bogus migrator -- + {create_table_stmt}: err -- + {dot}: err -- + Error % unknown built-in migration procedure 'cql:fxom_recreate' -- +1 Error create table bogus_builtin_migrator ( id integer ) @create(1, cql:fxom_recreate); -- TEST: try to use valid migrator in a column entry instead of the table entry -- + {create_table_stmt}: err -- + {dot}: err -- + Error % built-in migration procedure not valid in this context 'cql:from_recreate' -- +1 Error create table bogus_builtin_migrator_placement ( id integer, id2 integer @create(2, cql:from_recreate) ) @create(1); -- TEST: test sensitive flag on out param in declare proc using transaction -- + {declare_proc_stmt}: ok dml_proc -- + {param}: code_: text notnull variable out sensitive -- - Error DECLARE PROC proc_as_func(IN transport_key_ TEXT, OUT code_ TEXT NOT NULL @sensitive) USING TRANSACTION; -- TEST: test sensitive flag on pr variable for LET stmt -- + {let_stmt}: pr: text notnull variable sensitive -- + {name pr}: pr: text notnull variable sensitive -- + {call}: text notnull sensitive -- - Error LET pr := proc_as_func("t"); -- TEST: helper variable DECLARE pr2 text; -- TEST: test sensitive flag on pr variable for SET stmt -- + {assign}: err -- + {call}: text notnull sensitive -- + Error % cannot assign/copy sensitive expression to non-sensitive target 'pr2' -- +1 Error SET pr2 := proc_as_func("t"); -- TEST: test create table with not null column on conflict clause abort -- + {create_table_stmt}: conflict_clause_t: { id: integer notnull } -- + {col_attrs_not_null}: ok -- + {int 2} -- - Error create table conflict_clause_t(id int not null on conflict fail); -- TEST: test create table with pk column on conflict clause rollback -- + {create_table_stmt}: conflict_clause_pk: { id: integer notnull } -- + {indexed_columns_conflict_clause} -- + {int 0} -- - Error create table conflict_clause_pk( id int not null, constraint pk1 primary key (id) on conflict rollback ); -- TEST: a base fragment for the test case below -- - Error @attribute(cql:base_fragment=id_frag) create proc id_frag_base() begin with id_frag(id) as (select 1) select * from id_frag; end; -- TEST: Make sure that the types match exactly between extension columns and base columns -- here the issue is that 3.5 is type compatible with the integer type of the base -- and that's not good enough for an extension proc. We need an additional check -- + {create_proc_stmt}: err -- + Error % in extension fragment, all columns must be an exact type match (expected integer notnull; found real notnull) 'id' -- +1 Error @attribute(cql:extension_fragment=id_frag) create proc bogus_ext() begin with id_frag(id) as (select * from foo), ext1(*) as ( select * from id_frag union all select 3.5 id) select * from ext1; end; create table foo(id integer); -- TEST: Variables can be improved to NOT NULL via a conditional, but only -- within the body of the THEN. -- + {let_stmt}: x0: integer variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: x2: integer variable -- + {let_stmt}: x3: integer notnull variable -- + {let_stmt}: x4: integer variable -- + {let_stmt}: x5: integer variable -- - Error create proc conditionals_improve_nullable_variables() begin declare a int; declare b int; declare c int; let x0 := a; if a is not null then let x1 := a; else let x2 := a; if a is not null then let x3 := a; else let x4 := a; end if; end if; let x5 := a; end; -- TEST: Conditionals only improve along the spine of ANDs. -- + {declare_cursor}: c0: select: { a0: text notnull variable, b0: text variable, c0: text variable } -- + {declare_cursor}: c1: select: { a1: text notnull variable, b1: text variable, c1: text notnull variable } variable dml_proc -- + {declare_cursor}: c2: select: { a2: text notnull variable, b2: text notnull variable, c2: text notnull variable } variable dml_proc -- - Error create proc conditionals_only_improve_through_ands() begin declare a text; declare b text; declare c text; if a is not null and (b is not null or c is not null) then declare c0 cursor for select a as a0, b as b0, c as c0; if (b is not null or a like "hello") and c is not null then declare c1 cursor for select a as a1, b as b1, c as c1; if b is not null then declare c2 cursor for select a as a2, b as b2, c as c2; end if; end if; end if; end; -- TEST: Nullability improvements for locals cease at corresponding SETs to -- nullables. -- + {let_stmt}: x0: integer variable -- + {let_stmt}: y0: integer variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: y1: integer notnull variable -- + {let_stmt}: x2: integer notnull variable -- + {let_stmt}: y2: integer variable -- + {let_stmt}: x3: integer notnull variable -- + {let_stmt}: y3: integer notnull variable -- + {let_stmt}: x4: integer variable -- + {let_stmt}: y4: integer notnull variable -- + {let_stmt}: x5: integer variable -- + {let_stmt}: y5: integer variable -- + {let_stmt}: x6: integer variable -- + {let_stmt}: y6: integer variable -- - Error create proc local_improvements_persist_until_set_to_a_nullable() begin declare a int; declare b int; let x0 := a; let y0 := b; if a is not null and b is not null then let x1 := a; let y1 := b; set b := null; let x2 := a; let y2 := b; if b is not null then let x3 := a; let y3 := b; set a := null; let x4 := a; let y4 := b; set b := null; end if; let x5 := a; let y5 := b; end if; let x6 := a; let y6 := b; end; -- TEST: SET can improve a type if set to something known to be not null. -- + {let_stmt}: x0: integer variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: x2: integer variable -- - Error create proc set_can_improve_a_type_if_set_to_something_not_null() begin declare a int; let x0 := a; set a := 42; let x1 := a; set a := null; let x2 := a; end; -- TEST: `x1` should be nullable because `set a := 42` may not have happened. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc improvements_added_by_set_do_not_persist_outside_the_statement_list() begin declare a int; if 0 then set a := 42; let x0 := a; end if; let x1 := a; end; -- TEST: `x1` should be nullable because `set a := null` may have happened. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc improvements_removed_by_set_do_persist_outside_the_statement_list() begin declare a int; if a is not null then let x0 := a; if 1 then set a := null; end if; end if; let x1 := a; end; -- TEST: Improvements work in CASE expressions. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: y0: integer notnull variable -- + {let_stmt}: x1: integer variable -- + {let_stmt}: y1: integer variable -- - Error create proc improvements_work_in_case_expressions() begin declare a int; declare b int; -- `a` is nonnull when the condition is true let x0 := case when a is not null then a + a else 42 end; -- `b` is nonnull in the last two branches when previous conditions are false let y0 := case when b is null then 42 when 0 then b + b else b + b end; -- nullable as the improvements are no longer in effect let x1 := a; let y1 := b; end; -- TEST: Improvements do not work in CASE expressions that match on an -- expression. -- + {let_stmt}: x: integer variable -- - Error create proc improvements_do_not_work_in_case_expressions_with_matching() begin declare a int; let x := case false -- match the first false expression when a is not null then a + a -- actually used when `a` IS null else 42 end; end; -- TEST: Improvements work in IIF expressions. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: y0: integer notnull variable -- + {let_stmt}: x1: integer variable -- + {let_stmt}: y1: integer variable -- - Error create proc improvements_work_in_iif_expressions() begin declare a int; declare b int; -- `a` is nonnull when the condition is true let x0 := iif(a is not null, a + a, 42); -- `b` is nonnull when the condition is false let y0 := iif(b is null, 42, b + b); -- nullable as the improvements are no longer in effect let x1 := a; let y1 := b; end; -- TEST: Used in the following test. -- - Error create proc sets_out(out a int, out b int) begin end; -- TEST: Nullability improvements for locals persist until used as an OUT arg. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: y0: integer notnull variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: y1: integer variable -- + {let_stmt}: x2: integer variable -- + {let_stmt}: y2: integer variable -- + {let_stmt}: x3: integer notnull variable -- + {let_stmt}: y3: integer notnull variable -- + {let_stmt}: x4: integer variable -- + {let_stmt}: y4: integer variable -- - Error create proc local_improvements_persist_until_used_as_out_arg() begin declare a int; declare b int; declare x int; if a is not null and b is not null then let x0 := a; let y0 := b; call sets_out(x, b); let x1 := a; let y1 := b; call sets_out(a, x); let x2 := a; let y2 := b; end if; if a is not null and b is not null then let x3 := a; let y3 := b; call sets_out(a, b); let x4 := a; let y4 := b; end if; end; -- Used in the following tests. -- - Error create table tnull (xn int, yn int); -- TEST: Nullability improvements for locals cease at corresponding FETCH INTOs. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: y0: integer notnull variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: y1: integer variable -- + {let_stmt}: x2: integer variable -- + {let_stmt}: y2: integer variable -- + {let_stmt}: x3: integer notnull variable -- + {let_stmt}: y3: integer notnull variable -- + {let_stmt}: x4: integer variable -- + {let_stmt}: y4: integer variable -- - Error create proc local_improvements_persist_until_fetch_into() begin declare a int; declare b int; declare x int; declare c cursor for select * from tnull; if a is not null and b is not null then let x0 := a; let y0 := b; fetch c into x, b; let x1 := a; let y1 := b; fetch c into a, x; let x2 := a; let y2 := b; end if; if a is not null and b is not null then let x3 := a; let y3 := b; fetch c into a, b; let x4 := a; let y4 := b; end if; end; -- We need this for our following tests. -- - Error declare c_global cursor like tnull; -- TEST: Improvements work for auto cursors. -- + {let_stmt}: x0: integer variable -- + {let_stmt}: y0: integer variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: y1: integer notnull variable -- + {let_stmt}: x2: integer variable -- + {let_stmt}: y2: integer variable -- - Error create proc improvements_work_for_auto_cursors() begin declare c cursor for select * from tnull; fetch c; let x0 := c.xn; let y0 := c.yn; if c.xn is not null and c.yn is not null then let x1 := c.xn; let y1 := c.yn; fetch c; let x2 := c.xn; let y2 := c.yn; end if; end; -- TEST: Improvements work for local auto cursors that do not shadow a global -- cursor. This test exercises our code that checks whether or not a dot that -- has been found should be tracked as a global. There is no global cursor named -- `c0`, so it must be local and can be improved. -- + {let_stmt}: x0: integer variable -- + {let_stmt}: y0: integer variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: y1: integer notnull variable -- + {let_stmt}: x2: integer variable -- + {let_stmt}: y2: integer variable -- - Error create proc improvements_work_for_local_auto_cursors_that_do_not_shadow_a_global() begin declare c_local cursor like tnull; fetch c_local from values (0, 0); let x0 := c_local.xn; let y0 := c_local.yn; if c_local.xn is not null and c_local.yn is not null then let x1 := c_local.xn; let y1 := c_local.yn; fetch c_local from values (0, 0); let x2 := c_local.xn; let y2 := c_local.yn; end if; end; -- TEST: Improvements work for local auto cursors that shadow a global cursor -- (in this case, `c_global`). This test exercises our code that checks whether -- or not a dot that has been found should be tracked as a global. There is a -- global cursor named `c_global`, but it's not the same one as the one in the -- nearest enclosing scope that we want to improve here, so we can do the -- improvement. -- + {let_stmt}: x0: integer variable -- + {let_stmt}: y0: integer variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: y1: integer notnull variable -- + {let_stmt}: x2: integer variable -- + {let_stmt}: y2: integer variable -- - Error create proc improvements_work_for_auto_cursors_that_shadow_a_global() begin declare c_global cursor like select nullable(1) as xn, nullable(2) as yn; fetch c_global from values (0, 0); let x0 := c_global.xn; let y0 := c_global.yn; if c_global.xn is not null and c_global.yn is not null then let x1 := c_global.xn; let y1 := c_global.yn; fetch c_global from values (0, 0); let x2 := c_global.xn; let y2 := c_global.yn; end if; end; -- TEST: Improvements work for global auto cursors. -- + {let_stmt}: x0: integer variable -- + {let_stmt}: y0: integer variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: y1: integer notnull variable -- + {let_stmt}: x2: integer variable -- + {let_stmt}: y2: integer variable -- + {let_stmt}: x3: integer notnull variable -- + {let_stmt}: y3: integer notnull variable -- + {let_stmt}: x4: integer variable -- + {let_stmt}: y4: integer variable -- - Error create proc improvements_work_for_global_auto_cursors() begin fetch c_global from values (0, 0); let x0 := c_global.xn; let y0 := c_global.yn; if c_global.xn is not null and c_global.yn is not null then -- improved due to true condition let x1 := c_global.xn; let y1 := c_global.yn; fetch c_global from values (0, 0); -- un-improved due to fetch let x2 := c_global.xn; let y2 := c_global.yn; if c_global.xn is null or c_global.yn is null return; -- improved due to false condition let x3 := c_global.xn; let y3 := c_global.yn; call proc1(); -- un-improved due to procedure call let x4 := c_global.xn; let y4 := c_global.yn; end if; end; -- TEST: Improvements work on IN arguments. -- + {let_stmt}: x: integer notnull variable -- - Error create proc improvements_work_for_in_args(a int) begin if a is not null then let x := a; end if; end; -- Used in the following test. -- - Error create proc requires_notnull_out(OUT a INT NOT NULL) begin end; -- TEST: Improvements do NOT work for OUT arguments. -- + {call_stmt}: err -- + Error % proc out parameter: arg must be an exact type match (even nullability) (expected integer notnull; found integer) 'a' -- +1 Error create proc improvements_do_not_work_for_out() begin declare a int; if a is not null then call requires_notnull_out(a); end if; end; -- Used in the following test. -- - Error create proc requires_notnull_inout(INOUT a INT NOT NULL) begin end; -- TEST: Improvements do NOT work for INOUT arguments. -- + {call_stmt}: err -- + Error % cannot assign/copy possibly null expression to not null target 'a' -- +1 Error create proc improvements_do_not_work_for_inout() begin declare a int; if a is not null then call requires_notnull_inout(a); end if; end; -- TEST: Improvements work in SQL. -- + {create_proc_stmt}: select: { b: integer notnull } dml_proc -- - Error create proc improvements_work_in_sql() begin declare a int; if a is not null then select (1 + a) as b; end if; end; -- TEST: Improvements are not applied if an id or dot is not the entirety of the -- expression left of IF NOT NULL. -- + {let_stmt}: b: integer variable -- - Error create proc improvements_are_not_applied_if_not_an_id_or_dot() begin declare a int; if a + 1 is not null then let b := a; end if; end; -- Used in the following test. -- - Error declare some_global int; -- Used in the following test. -- - Error create proc requires_not_nulls(a int not null, b int not null, c int not null) begin end; -- Used in the following test. -- - Error create proc returns_int_not_null(out a int not null) begin end; -- TEST: Improvements work for globals. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: x2: integer notnull variable -- + {let_stmt}: x3: integer notnull variable -- + {let_stmt}: x4: integer variable -- + {let_stmt}: x5: integer notnull variable -- + {let_stmt}: x6: integer variable -- + {let_stmt}: x7: integer notnull variable -- + {let_stmt}: x8: integer variable -- + {let_stmt}: x9: integer notnull variable -- + {let_stmt}: x10: integer notnull variable -- + {let_stmt}: x11: integer variable -- + {let_stmt}: x12: integer notnull variable -- + {let_stmt}: x13: integer variable -- - Error create proc improvements_work_for_globals() begin if some_global is not null then -- `some_global` is improved here. let x0 := some_global; -- Both uses are improved here because we have yet to encounter a call to a -- stored procedure. let x1 := iif(0, some_global, some_global); -- It's still improved after calling an external function (which cannot -- mutate a global). call some_external_thing(); let x2 := some_global; -- The same is true for built-in functions. select round(4.2) as a; let x3 := some_global; -- After calling a stored procedure, it's no longer improved. call proc1(); let x4 := some_global; -- Re-improve the global. if some_global is null return; let x5 := some_global; -- This type checks because it remains improved until after the call. call requires_not_nulls(some_global, some_global, some_global); -- Now, however, it is un-improved due to the call. let x6 := some_global; -- Re-improve the global. if some_global is null return; let x7 := some_global; -- Here, the result is nullable because calls in previous subexpressions -- un-improve, as well. let x8 := returns_int_not_null() + some_global; -- Re-improve the global. if some_global is null return; let x9 := some_global; -- In contrast, here the result is nonnull despite the call in a previous -- subexpression due to branch-independent analysis. let x10 := iif(0, returns_int_not_null(), some_global); -- Fetching from a procedure will also invalidate the improvement. declare c cursor fetch from call out_cursor_proc(); let x11 := some_global; -- Re-improve the global. if some_global is null return; let x12 := some_global; end if; -- Finally, `some_global` is nullable as the scope in which it was improved -- has ended. let x13 := some_global; end; -- TEST: Improvements work on columns resulting from a select *. -- + {create_proc_stmt}: select: { xn: integer, yn: integer notnull } dml_proc -- - Error create proc improvements_work_for_select_star() begin select * from tnull where yn is not null; end; -- Used in the following tests. -- - Error create table another_table_with_nullables (xn integer, zn integer); -- TEST: Improvements work on columns resulting from a SELECT table.*. -- + {create_proc_stmt}: select: { xn: integer notnull, yn: integer notnull, xn0: integer, zn: integer notnull } dml_proc -- - Error create proc improvements_work_for_select_table_star() begin select tnull.*, another_table_with_nullables.xn as xn0, another_table_with_nullables.zn from tnull inner join another_table_with_nullables on tnull.xn = another_table_with_nullables.xn where tnull.xn is not null and yn is not null and zn is not null; end; -- TEST: Improvements work for select expressions. -- + {create_proc_stmt}: select: { xn: integer notnull, yn: integer notnull } dml_proc -- - Error create proc improvements_work_for_select_expressions() begin select xn, yn from tnull where xn is not null and yn is not null; end; -- TEST: Improvements correctly handle nested selects. -- + {create_proc_stmt}: select: { xn: integer notnull, yn: integer, yn0: integer, yn1: integer notnull } dml_proc -- - Error create proc improvements_correctly_handle_nested_selects() begin select (select xn), (select yn from tnull), (select yn from tnull where yn is not null) as yn0, (select yn) as yn1 from tnull where xn is not null and yn is not null; end; -- TEST: We actually want `yn` to be improved in the result even though `xn is -- not null` because `yn` is an alias for `xn + xn` and `xn is not null`. `yn0` -- should not be improved even though it is an alias for `yn` because that is a -- different `yn` from the one we're improving (it's actually `tnull.yn`). -- + {create_proc_stmt}: select: { yn: integer notnull, yn0: integer } dml_proc -- - Error create proc improvements_apply_in_select_exprs() begin select xn + xn as yn, yn as yn0 from tnull where xn is not null; end; -- TEST: WHERE clauses only see aliases if not shadowed by a column in the FROM -- clause. We must only improve an alias, therefore, if it is not shadowed. -- + {create_proc_stmt}: select: { yn: integer, zn: integer notnull } dml_proc -- - Error create proc aliases_are_improved_if_not_shadowed_by_a_column_in_from() begin select xn as yn, -- shadowed; don't improve it xn as zn -- not shadowed; improve it from tnull where yn is not null and zn is not null; end; -- TEST: We do not improve a result column merely because a variable with the -- same name is improved in an enclosing scope. -- + {create_proc_stmt}: select: { xn: integer, yn: integer } dml_proc -- - Error create proc local_variable_improvements_do_not_affect_result_columns() begin declare xn int; if xn is null return; select * from tnull; end; -- TEST: Due to the circularity in SELECT that SQLite allows between a WHERE -- clause and an expression list, we have to analyze expression lists with -- improvements from WHEREs clauses before analyzing the WHEREs clauses -- themselves. In doing so, we may attempt to improve an identifier in a WHERE -- clause that is unbound. This test exists to make sure we don't crash and do -- eventually flag the error after analyzing the expression list. -- + {select_expr}: xn: integer -- + {opt_where}: err -- + Error % name not found 'zn' -- +1 Error create proc where_clauses_with_unbound_identifiers_do_not_crash() begin select xn from tnull where zn is not null; end; -- TEST: Improvements work on the result of joins. -- + {create_proc_stmt}: select: { xn0: integer notnull } dml_proc -- - Error create proc improvements_work_on_join_results() begin select tnull.xn as xn0 from tnull inner join another_table_with_nullables on tnull.xn = another_table_with_nullables.xn where xn0 is not null; end; -- TEST: TODO: Improvements do not yet work for ON clauses. -- + {create_proc_stmt}: select: { xn0: integer } dml_proc -- - Error create proc improvements_do_not_work_for_on_clauses() begin select tnull.xn as xn0 from tnull inner join another_table_with_nullables on tnull.xn = another_table_with_nullables.xn and tnull.xn is not null; end; -- TEST: We do not want `SEM_TYPE_INFERRED_NOTNULL` flags to be copied via LIKE. -- Copying the flag would incorrectly imply an inferred NOT NULL status. We also -- ensure here that there is no aliasing of struct pointers between `c` and `d`. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: y0: integer notnull variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: y1: integer notnull variable -- + {let_stmt}: x2: integer variable -- + {let_stmt}: y2: integer variable -- - Error create proc notnull_inferred_does_not_get_copied_via_declare_cursor_like_cursor() begin declare c cursor like tnull; fetch c from values (1, 2); if c.xn is not null and c.yn is not null then let x0 := c.xn; let y0 := c.yn; declare d cursor like c; let x1 := c.xn; let y1 := c.yn; let x2 := d.xn; let y2 := d.yn; end if; end; -- TEST: Ensure that `c.a is not null` does not result in an improvement that -- shows up in the params of `improvements_work_for_in_args` via unintentional -- aliasing. -- + {declare_cursor_like_name}: c: improvements_work_for_in_args[arguments]: { a: integer in } variable shape_storage value_cursor -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: x2: integer variable -- + {declare_cursor_like_name}: d: improvements_work_for_in_args[arguments]: { a: integer in } variable shape_storage value_cursor -- + {declare_cursor_like_name}: e: improvements_work_for_in_args[arguments]: { a: integer in } variable shape_storage value_cursor -- - Error create proc notnull_inferred_does_not_get_copied_via_declare_cursor_like_proc() begin declare c cursor like improvements_work_for_in_args arguments; fetch c from values (0); if c.a is not null then let x0 := c.a; declare d cursor like improvements_work_for_in_args arguments; fetch d from values (0); let x1 := c.a; let x2 := d.a; declare e cursor like improvements_work_for_in_args arguments; end if; end; -- Used in the following test. -- - Error create proc returns_nullable_int() begin declare c cursor like select nullable(0) as a; out c; end; -- TEST: Verify that `returns_nullable_int` does not get improved when we -- improve `args like returns_nullable_int` (which would indicate aliasing). -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc notnull_inferred_does_not_get_copied_via_arguments_like_proc(args like returns_nullable_int) begin if args.a is not null then let x0 := args.a; declare c cursor fetch from call returns_nullable_int(); let x1 := c.a; end if; end; -- TEST: Verify that rewrites for nullability work correctly within CTEs and do -- not get applied twice. -- + {create_proc_stmt}: select: { b: integer notnull } dml_proc -- +1 {name cql_inferred_notnull}: a: integer notnull variable -- - Error create proc improvements_work_within_ctes() begin declare a int; if a is not null then with recursive foo(b) as (select a) select b from foo; end if; end; -- TEST: A commit return guard can improve nullability. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc improvements_work_for_commit_return_guards(a int) begin proc savepoint begin if 1 then if a is null commit return; let x0 := a; end if; let x1 := a; end; end; -- TEST: A continue guard can improve nullability. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc improvements_work_for_continue_guards(a int) begin while 1 begin if a is null continue; let x0 := a; end; let x1 := a; end; -- TEST: A leave guard can improve nullability. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc improvements_work_for_leave_guards(a int) begin while 1 begin if a is null leave; let x0 := a; end; let x1 := a; end; -- TEST: A return guard can improve nullability. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc improvements_work_for_return_guards(a int) begin if 1 then if a is null return; let x0 := a; end if; let x1 := a; end; -- TEST: A rollback return guard can improve nullability. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc improvements_work_for_rollback_return_guards(a int) begin proc savepoint begin if 1 then if a is null rollback return; let x0 := a; end if; let x1 := a; end; end; -- TEST: A throw guard can improve nullability. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc improvements_work_for_throw_guards(a int) begin proc savepoint begin if 1 then if a is null throw; let x0 := a; end if; let x1 := a; end; end; -- TEST: Guard improvements work for cursor fields. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc guard_improvements_work_for_cursor_fields() begin declare c cursor for select nullable(1) a; fetch c; if 1 then if c.a is null return; let x0 := c.a; end if; let x1 := c.a; end; -- TEST: OR allows guards to introduce multiple improvements. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: y0: integer notnull variable -- + {let_stmt}: z0: integer notnull variable -- + {let_stmt}: x1: integer variable -- + {let_stmt}: y1: integer variable -- + {let_stmt}: z1: integer variable -- - Error create proc multiple_improvements_are_possible_via_one_guard(a int, b int, c int) begin if 1 then if a is null or b is null or c is null return; let x0 := a; let y0 := b; let z0 := c; end if; let x1 := a; let y1 := b; let z1 := c; end; -- TEST: Checks not along the outermost spine of ORs result in no improvement. -- + {let_stmt}: x: integer variable -- + {let_stmt}: y: integer variable -- + {let_stmt}: z: integer variable -- - Error create proc guard_improvements_only_work_for_outermost_ors(a int, b int, c int) begin if a is null and (b is null or c is null) return; let x := a; let y := b; let z := c; end; -- TEST: Not explicitly using IS NULL results in no improvement. create proc guard_improvements_only_work_for_is_null(a int) begin if not a return; let x := a; end; -- TEST: Bad conditions in guards are handled as in if statements. -- + {if_stmt}: err -- + Error % name not found 'some_undefined_variable' -- +1 Error create proc guard_improvements_handle_semantic_issues_like_if() begin if some_undefined_variable is null return; end; -- TEST: Improvements work for IFs that follow the guard pattern. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: y0: integer notnull variable -- + {let_stmt}: z0: integer notnull variable -- + {let_stmt}: x1: integer variable -- + {let_stmt}: y1: integer variable -- + {let_stmt}: z1: integer variable -- - Error create proc improvements_work_for_guard_pattern_ifs() begin declare a int; declare b int; declare c int; if 1 then if a is null or b is null or c is null then return; end if; let x0 := a; let y0 := b; let z0 := c; end if; let x1 := a; let y1 := b; let z1 := c; end; -- TEST: Improvements work for IFs that follow the guard pattern when statements -- are present before the control statement. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: y0: integer notnull variable -- + {let_stmt}: z0: integer notnull variable -- + {let_stmt}: x1: integer variable -- + {let_stmt}: y1: integer variable -- + {let_stmt}: z1: integer variable -- - Error create proc improvements_work_for_guard_pattern_ifs_with_preceding_statements() begin declare a int; declare b int; declare c int; if 1 then if a is null or b is null or c is null then call printf("Hello, world!\n"); return; end if; let x0 := a; let y0 := b; let z0 := c; end if; let x1 := a; let y1 := b; let z1 := c; end; -- TEST: Improvements work for IFs that follow the guard pattern even if they -- set the variable that's going to be improved after END IF to NULL. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc improvements_work_for_guard_pattern_ifs_that_set_the_id_to_null() begin declare a int; if 1 then if a is null then set a := null; return; end if; let x0 := a; end if; let x1 := a; end; -- TEST: Improvements do not work for IFs that would be following the guard -- pattern if not for the presence of ELSE. -- + {let_stmt}: x: integer variable -- - Error create proc improvements_do_not_work_for_guard_like_ifs_with_else() begin declare a int; if a is null then return; else -- We could set `a` to null here, hence we can't improve it after END IF. end if; let x := a; -- nullable end; -- TEST: Improvements do not work for IFs that would be following the guard -- pattern if not for the presence of ELSE IF. -- + {let_stmt}: x: integer variable -- - Error create proc improvements_do_not_work_for_guard_like_ifs_with_else_if() begin declare a int; if a is null then return; else if 1 then -- We could set `a` to null here, hence we can't improve it after END IF. end if; let x := a; -- nullable end; -- TEST: Improvements do not work for IS NULL checks after the first branch. -- + {let_stmt}: x: integer variable -- - Error create proc improvements_do_not_work_for_is_null_checks_in_else_ifs() begin declare a int; if 0 then return; else if a is null then return; end if; let x := a; -- nullable end; -- TEST: Later branches are improved via the assumption that earlier branches -- must not have been taken. -- + {let_stmt}: x0: integer variable -- + {let_stmt}: y0: integer variable -- + {let_stmt}: z0: integer variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: y1: integer variable -- + {let_stmt}: z1: integer variable -- + {let_stmt}: x2: integer notnull variable -- + {let_stmt}: y2: integer variable -- + {let_stmt}: z2: integer variable -- + {let_stmt}: x3: integer notnull variable -- + {let_stmt}: y3: integer notnull variable -- + {let_stmt}: z3: integer notnull variable -- + {let_stmt}: x4: integer variable -- + {let_stmt}: y4: integer variable -- + {let_stmt}: z4: integer variable create proc false_conditions_of_earlier_branches_improve_later_branches() begin declare a int; declare b int; declare c int; if a is null then let x0 := a; let y0 := b; let z0 := c; else if 0 then -- `a` is improved here let x1 := a; let y1 := b; let z1 := c; else if b is null or c is null then -- `a` is still improved here let x2 := a; let y2 := b; let z2 := c; else -- `a`, `b`, and `c` are improved here let x3 := a; let y3 := b; let z3 := c; end if; let x4 := a; let y4 := b; let z4 := c; end; -- Used in the following tests. create proc requires_out_returns_bool(out a integer, out b bool) begin end; -- TEST: Improvements are not made for identifiers that are later used as OUT -- (or INOUT) arguments within the same true conditional. -- + {let_stmt}: x: integer variable -- + {let_stmt}: y: integer notnull variable -- + {let_stmt}: z: integer notnull variable -- - Error create proc improvements_respect_out_args_in_true_conditions() begin declare a int; declare b int; declare c int; if a is not null and requires_out_returns_bool(a) then -- nullable because `requires_out_returns_bool` may have set `a` to false let x := a; end if; if requires_out_returns_bool(b) and b is not null then -- nonnull because the null check was performed after the mutation let y := b; end if; if c is not null and requires_out_returns_bool(c) and c is not null then -- nonnull because a second null check was performed after the mutation let z := c; end if; end; -- TEST: Improvements are not made for identifiers that are later used as OUT -- (or INOUT) arguments within the same false conditional. -- + {let_stmt}: x: integer variable -- + {let_stmt}: y: integer notnull variable -- + {let_stmt}: z: integer notnull variable -- - Error create proc improvements_respect_out_args_in_false_conditions() begin declare a int; declare b int; declare c int; if a is null or requires_out_returns_bool(a) then let dummy0 := 0; else -- nullable because `requires_out_returns_bool` may have set `a` to false let x := a; end if; if requires_out_returns_bool(b) or b is null then let dummy1 := 0; else -- nonnull because the null check was performed after the mutation let y := b; end if; if c is null or requires_out_returns_bool(c) or c is null then let dummy2 := 0; else -- nonnull because a second null check was performed after the mutation let z := c; end if; end; -- TEST: Improvements are not made for identifiers that are later used as OUT -- (or INOUT) arguments within the same false conditional for guards. -- + {let_stmt}: x: integer variable -- + {let_stmt}: y: integer notnull variable -- + {let_stmt}: z: integer notnull variable -- - Error create proc improvements_respect_out_args_in_false_conditions_for_guards() begin declare a int; declare b int; declare c int; if a is null or requires_out_returns_bool(a) then return; end if; -- nullable because `requires_out_returns_bool` may have set `a` to false let x := a; if requires_out_returns_bool(b) or b is null then return; end if; -- nonnull because the null check was performed after the mutation let y := b; if c is null or requires_out_returns_bool(c) or c is null then return; end if; -- nonnull because a second null check was performed after the mutation let z := c; end; -- TEST: Improvements are not made for identifiers that are later used as OUT -- (or INOUT) arguments within the same false conditional for CASE. -- + {let_stmt}: x: integer variable -- + {let_stmt}: y: integer notnull variable -- + {let_stmt}: z: integer notnull variable create proc improvements_respect_out_args_in_false_conditions_for_case() begin declare a int; declare b int; declare c int; -- nullable because `requires_out_returns_bool` may have set `a` to false let x := case when a is null or requires_out_returns_bool(a) then 42 else a end; -- nonnull because the null check was performed after the mutation let y := case when requires_out_returns_bool(b) or b is null then 42 else b end; -- nonnull because a second null check was performed after the mutation let z := case when c is null or requires_out_returns_bool(c) or c is null then 42 else c end; end; -- TEST: Improvements are not made for identifiers that are later used as OUT -- (or INOUT) arguments within the same false conditional for IIF. -- + {let_stmt}: x: integer variable -- + {let_stmt}: y: integer notnull variable -- + {let_stmt}: z: integer notnull variable create proc improvements_respect_out_args_in_false_conditions_for_iif() begin declare a int; declare b int; declare c int; -- nullable because `requires_out_returns_bool` may have set `a` to false let x := iif(a is null or requires_out_returns_bool(a), 42, a); -- nonnull because the null check was performed after the mutation let y := iif(requires_out_returns_bool(b) or b is null, 42, b); -- nonnull because a second null check was performed after the mutation let z := iif(c is null or requires_out_returns_bool(c) or c is null, 42, c); end; -- TEST: Un-improvements in one branch do not negatively affect later branches. -- + {let_stmt}: x0: integer variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: x2: integer variable -- + {let_stmt}: x3: integer notnull variable -- + {let_stmt}: x4: integer variable -- + {let_stmt}: x5: integer notnull variable -- + {let_stmt}: x6: integer variable -- - Error create proc unimprovements_do_not_negatively_affect_later_branches() begin declare a int; -- nullable let x0 := a; if a is null return; -- nonnull due to the guard let x1 := a; if 0 then set a := null; -- nullable due to the set let x2 := a; else if 0 then -- nonnull due to the guard despite the set in an earlier branch let x3 := a; set a := null; -- nullable due to the set let x4 := a; else -- nonnull due to the guard despite the sets in earlier branches let x5 := a; end if; -- nullable because at least one branch had a hazard let x6 := a; end; -- TEST: Un-improvements in one branch do not negatively affect other branches -- even if the un-improvements occurred within a nested branch. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: y0: integer notnull variable -- + {let_stmt}: z0: integer notnull variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: y1: integer notnull variable -- + {let_stmt}: z1: integer variable -- + {let_stmt}: x2: integer notnull variable -- + {let_stmt}: y2: integer variable -- + {let_stmt}: z2: integer variable -- + {let_stmt}: x3: integer variable -- + {let_stmt}: y3: integer notnull variable -- + {let_stmt}: z3: integer notnull variable -- + {let_stmt}: x4: integer variable -- + {let_stmt}: y4: integer notnull variable -- + {let_stmt}: z4: integer notnull variable -- + {let_stmt}: x5: integer variable -- + {let_stmt}: y5: integer variable -- + {let_stmt}: z5: integer variable -- + {let_stmt}: x6: integer variable -- + {let_stmt}: y6: integer variable -- + {let_stmt}: z6: integer variable -- + {let_stmt}: x7: integer notnull variable -- + {let_stmt}: y7: integer notnull variable -- + {let_stmt}: z7: integer notnull variable -- + {let_stmt}: x8: integer variable -- + {let_stmt}: y8: integer variable -- + {let_stmt}: z8: integer variable -- + {let_stmt}: x9: integer notnull variable -- + {let_stmt}: y9: integer notnull variable -- + {let_stmt}: z9: integer notnull variable -- + {let_stmt}: x10: integer variable -- + {let_stmt}: y10: integer variable -- + {let_stmt}: z10: integer variable -- - Error create proc nested_unimprovements_do_not_negatively_affect_later_branches() begin declare a int; declare b int; declare c int; if a is null or b is null or c is null return; let x0 := a; -- nonnull due to guard let y0 := b; -- nonnull due to guard let z0 := c; -- nonnull due to guard if 0 then if 0 then set a := null; if 0 then set b := null; else set a := 42; set c := null; let x1 := a; -- nonnull due to set improvement let y1 := b; -- nonnull due to guard despite previous set let z1 := c; -- nullable due to previous set set a := null; if a is null then set a := null; else if c is null then set b := null; let x2 := a; -- nonnull due to improvement from false condition let y2 := b; -- nullable due to previous set let z2 := c; -- nullable due to previous set else if requires_out_returns_bool(a) then let x3 := a; -- nullable due to use as out arg in condition let y3 := b; -- nonnull due to guard despite previous set let z3 := c; -- nonnull due to improvement from false condition set b := null; set c := null; else let x4 := a; -- nullable due to use as out arg in previous condition let y4 := b; -- nonnull due to guard despite previous set let z4 := c; -- nonnull due to improvement from false condition end if; let x5 := a; -- nullable due to use as out arg in condition let y5 := b; -- nullable due to set in previous branch let z5 := c; -- nullable due to previous set in this statement list set a := 42; -- won't affect nullability below because it may not occur set b := 42; -- won't affect nullability below because it may not occur set c := 42; -- won't affect nullability below because it may not occur end if; let x6 := a; -- nullable due to previous set in this statement list let y6 := b; -- nullable due to previous set in previous branch let z6 := c; -- nullable due to previous set in previous branch else let x7 := a; -- nonnull due to guard despite previous set let y7 := b; -- nonnull due to guard despite previous set let z7 := c; -- nonnull due to guard despite previous set end if; let x8 := a; -- nullable due to previous set in previous branch let y8 := b; -- nullable due to previous set in previous branch let z8 := c; -- nullable due to previous set in previous branch else let x9 := a; -- nonnull due to guard despite previous set let y9 := b; -- nonnull due to guard despite previous set let z9 := c; -- nonnull due to guard despite previous set end if; let x10 := a; -- nullable due to previous set in previous branch let y10 := b; -- nullable due to previous set in previous branch let z10 := c; -- nullable due to previous set in previous branch end; -- TEST: Reverting improvements and un-improvements restores the original state. -- In particular, an un-improvement within a contingent nullability context is -- only re-improved if it was originally improved when said contingent context -- was entered. -- + {let_stmt}: x0: integer variable -- + {let_stmt}: y0: integer notnull variable -- + {let_stmt}: z0: integer notnull variable -- + {let_stmt}: w0: integer variable -- + {let_stmt}: x1: integer notnull variable -- + {let_stmt}: y1: integer notnull variable -- + {let_stmt}: z1: integer notnull variable -- + {let_stmt}: w1: integer variable -- + {let_stmt}: x2: integer notnull variable -- + {let_stmt}: y2: integer variable -- + {let_stmt}: z2: integer variable -- + {let_stmt}: w2: integer notnull variable -- + {let_stmt}: x3: integer variable -- + {let_stmt}: y3: integer variable -- + {let_stmt}: z3: integer variable -- + {let_stmt}: w3: integer variable -- + {let_stmt}: x4: integer variable -- + {let_stmt}: y4: integer notnull variable -- + {let_stmt}: z4: integer notnull variable -- + {let_stmt}: w4: integer variable -- + {let_stmt}: x5: integer variable -- + {let_stmt}: y5: integer variable -- + {let_stmt}: z5: integer variable -- + {let_stmt}: w5: integer variable -- - Error create proc reverting_improvements_and_unimprovements_restores_original_state() begin declare a int; declare b int; declare c int; declare d int; if b is null return; set c := 42; let x0 := a; -- nullable let y0 := b; -- nonnull due to guard let z0 := c; -- nonnull due to set let w0 := d; -- nullable if 0 then if a is not null then let x1 := a; -- nonnull due to true condition let y1 := b; -- nonnull due to guard let z1 := c; -- nonnull due to set let w1 := d; -- nullable set b := null; -- un-improve `b` set c := null; -- un-improve `c` if c is not null then -- re-improve c let dummy := 0; -- un-improve `c` at the end of the statement list end if; set d := 42; -- improve `d` let x2 := a; -- nonnull due to true condition let y2 := b; -- nullable due to set let z2 := c; -- nullable due to most recent then block ending let w2 := d; -- nonnull due to set -- un-improve `a` at the end of the statement list -- un-improve `d` at the end of the statement list end if; let x3 := a; -- nullable again because then branch is over let y3 := b; -- nullable due to set let z3 := c; -- nullable due to innermost then branch ending let w3 := d; -- nullable due to previous statement list ending set a := null; -- does not un-improve `a` as it is already not improved else let x4 := a; -- not re-improved as it began nullable for previous branch -- (before the improvement for the condition was set) let y4 := b; -- re-improved as it began nonnull for previous branch let z4 := c; -- re-improved as it began nonnull for previous branch let w4 := d; -- not re-improved as it began nullable for previous branch end if; let x5 := a; -- nullable as then branch in which it was improved is over let y5 := b; -- nullable because of set let z5 := c; -- nullable because of set let w5 := d; -- nullable as statement list in which it was improved is over end; -- Used in the following tests. create proc requires_out_returns_int_not_null(out a int, out b int not null) begin end; -- TEST: Un-improvements in one branch do not negatively affect later branches -- for CASE. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc unimprovements_do_not_negatively_affect_later_branches_for_case() begin declare a int; if a is null return; let x0 := case when 0 then case when 0 then requires_out_returns_int_not_null(a) when 0 then a -- nonnull despite use as out arg else case when 0 then requires_out_returns_int_not_null(a) when 0 then a -- nonnull despite use as out arg else a -- nonnull despite use as out arg end end when 0 then case when 0 then requires_out_returns_int_not_null(a) when 0 then a -- nonnull despite use as out arg else case when 0 then requires_out_returns_int_not_null(a) when 0 then a -- nonnull despite use as out arg else a -- nonnull despite use as out arg end end else a -- nonnull despite use as out arg end; -- nullable due to use as out arg let x1 := a; end; -- TEST: Un-improvements in one branch do not negatively affect later branches -- for IIF. -- + {let_stmt}: x0: integer notnull variable -- + {let_stmt}: x1: integer variable -- - Error create proc unimprovements_do_not_negatively_affect_later_branches_for_iif() begin declare a int; if a is null return; -- `a` is nonnull at all non-OUT positions despite use as OUT arg let x0 := iif( 0, iif(0, iif(0, requires_out_returns_int_not_null(a), a), a), iif(0, iif(0, requires_out_returns_int_not_null(a), a), a) ); -- nullable due to use as out arg let x1 := a; end; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- NOT is weaker than +, parens stay even though this is a special case -- the parens could be elided becuse it's on the right of the + -- + SELECT 1 + (NOT 2 IS NULL); select 1 + not 2 is null; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- NOT is weaker than +, parens stay even though this is a special case -- the parens could be elided becuse it's on the right of the + -- + SELECT (NOT 1) + (NOT 2 IS NULL); select (not 1) + not 2 is null; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- IS is weaker than + , parens must stay -- + SELECT NOT 1 + (2 IS NULL); select not 1 + (2 is null); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- plus is stronger than IS -- + SELECT NOT 1 + 2 IS NULL; select not 1 + 2 is null; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- NOT is weaker than IS, parens must stay -- + SELECT 1 + (NOT 2) IS NULL; select 1 + (not 2) is null; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- NOT is weaker than IS, parens must stay -- + SELECT 1 IS NOT NULL AND 2 + (NOT 3) IS NULL; select 1 is not null and 2 + (not 3) is null; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- NOT is weaker than +, parens stay even though this is a special case -- the parens could be elided becuse it's on the right of the + -- + SELECT 1 IS NOT NULL AND 2 + (NOT 3 IS NULL) select 1 is not null and 2 + not 3 is null; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not is weaker than between, no parens needed -- + SELECT NOT 0 BETWEEN -1 AND 2; select not 0 between -1 and 2; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not is weaker than between, must keep parens -- + SELECT (NOT 0) BETWEEN -1 AND 2; select (not 0) between -1 and 2; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not is weaker than between, no parens needed -- + SELECT NOT 0 BETWEEN -1 AND 2; select not (0 between -1 and 2); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- between is weaker than =, don't need parens -- + SELECT 1 = 2 BETWEEN 2 AND 2; select 1=2 between 2 and 2; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- between is the same as =, but it binds left to right, keep the parens -- + SELECT 1 = (2 BETWEEN 2 AND 2); select 1=(2 between 2 and 2); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- between is the same as =, but it binds left to right -- + SELECT 1 = 2 BETWEEN 2 AND 2; select (1=2) between 2 and 2; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- between is the same as =, but it binds left to right -- + SELECT 0 BETWEEN -2 AND -1 = 4; select 0 between -2 and -1 = 4; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- between is the same as =, but it binds left to right (no parens needed) -- + SELECT 0 BETWEEN -2 AND -1 = 4; select (0 between -2 and -1) = 4; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- between is the same as =, but it binds left to right -- + SELECT 0 BETWEEN -2 AND (-1 = 4); select 0 between -2 and (-1 = 4); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens need to be added in the natural order (and its left associative) -- + SELECT 0 BETWEEN 0 AND 3 BETWEEN 2 AND 3; select 0 between 0 and 3 between 2 and 3; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens are needed here, this is left associative, the parens are redundant -- + SELECT 0 BETWEEN 0 AND 3 BETWEEN 2 AND 3; select (0 between 0 and 3) between 2 and 3; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- must keep the parens on the right arg, between is left associative -- + SELECT 0 BETWEEN 0 AND (3 BETWEEN 2 AND 3); select 0 between 0 and (3 between 2 and 3); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens are needed for the left arg of the between range -- + SELECT 0 BETWEEN 1 BETWEEN 3 AND 4 AND (3 BETWEEN 2 AND 3); select 0 between (1 between 3 and 4) and (3 between 2 and 3); -- TEST: order of operations, verifying gen_sql agrees with tree parse ---- TILDE is stronger than CONCAT -- + SELECT ~1 || 2; -- - Error select ~ 1||2; --> -22 -- TEST: order of operations, verifying gen_sql agrees with tree parse ---- TILDE is stronger than CONCAT -- + SELECT ~1 || 2; -- - Error select (~ 1)||2; --> -22 -- TEST: order of operations, verifying gen_sql agrees with tree parse ---- TILDE is stronger than CONCAT , parens must stay -- + SELECT ~(1 || 2); -- + Error % string operand not allowed in '~' select ~ (1||2); --> -13 -- TEST: order of operations, verifying gen_sql agrees with tree parse --- NEGATION is stronger than CONCAT, no parens generated -- SELECT -0 || 1; -- - Error select -0||1; --> 01 -- TEST: order of operations, verifying gen_sql agrees with tree parse --- NEGATION is stronger than CONCAT, parens can be removed -- SELECT -0 || 1; -- - Error select (-0)||1; --> 01 -- TEST: order of operations, verifying gen_sql agrees with tree parse --- NEGATION is stronger than CONCAT, parens must stay -- + SELECT -(0 || 1); -- + Error % string operand not allowed in '-' select -(0||1); --> -1 -- TEST: order of operations, verifying gen_sql agrees with tree parse --- COLLATE is stronger than CONCAT, parens must stay -- + SELECT 'x' || 'y' COLLATE foo; select 'x' || 'y' collate foo; -- TEST: order of operations, verifying gen_sql agrees with tree parse --- COLLATE is stronger than CONCAT, parens must stay -- + SELECT 'x' || 'y' COLLATE foo; select 'x' || ('y' collate foo); -- TEST: order of operations, verifying gen_sql agrees with tree parse --- COLLATE is stronger than CONCAT, parens must stay -- + SELECT ('x' || 'y') COLLATE foo; select ('x' || 'y') collate foo; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not is weaker than not between, no parens needed -- + SELECT NOT 0 NOT BETWEEN -1 AND 2; select not 0 not between -1 and 2; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not is weaker than not between, must keep parens -- + SELECT (NOT 0) NOT BETWEEN -1 AND 2; select (not 0 ) not between -1 and 2; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not is weaker than not between, no parens needed -- + SELECT NOT 0 NOT BETWEEN -1 AND 2; select not (0 not between -1 and 2); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not between is weaker than =, don't need parens -- + SELECT 1 = 2 NOT BETWEEN 2 AND 2; select 1=2 not between 2 and 2; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not between is the same as =, but it binds left to right, keep the parens -- + SELECT 1 = (2 NOT BETWEEN 2 AND 2); select 1=(2 not between 2 and 2); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not between is the same as =, but it binds left to right -- + SELECT 1 = 2 NOT BETWEEN 2 AND 2; select (1=2) not between 2 and 2; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not between is the same as =, but it binds left to right -- + SELECT 0 NOT BETWEEN -2 AND -1 = 4; select 0 not between -2 and -1 = 4; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not between is the same as =, but it binds left to right (no parens needed) -- + SELECT 0 NOT BETWEEN -2 AND -1 = 4; select (0 not between -2 and -1) = 4; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- not between is the same as =, but it binds left to right -- + SELECT 0 NOT BETWEEN -2 AND (-1 = 4); select 0 not between -2 and (-1 = 4); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens need to be added in the natural order (and its left associative) -- + SELECT 0 NOT BETWEEN 0 AND 3 NOT BETWEEN 2 AND 3; select 0 not between 0 and 3 not between 2 and 3; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens are needed here, this is left associative, the parens are redundant -- + SELECT 0 NOT BETWEEN 0 AND 3 NOT BETWEEN 2 AND 3; select (0 not between 0 and 3) not between 2 and 3; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- must keep the parens on the right arg, not between is left associative -- + SELECT 0 NOT BETWEEN 0 AND (3 NOT BETWEEN 2 AND 3); select 0 not between 0 and (3 not between 2 and 3); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens are needed for the left arg of the not between range -- + SELECT 0 NOT BETWEEN 1 NOT BETWEEN 3 AND 4 AND (3 NOT BETWEEN 2 AND 3); select 0 not between (1 not between 3 and 4) and (3 not between 2 and 3); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens are needed becasuse NOT like is the same strength as = and left to right -- + SELECT 'x' NOT LIKE 'y' = 1; -- - Error select 'x' not like 'y' = 1; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens are needed becasuse NOT like is the same strength as = and left to right -- + SELECT 'x' NOT LIKE 'y' = 1; -- - Error select ('x' not like 'y') = 1; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- parens must stay for the for the right arg because that's not the normal order -- this doesn't make sense semantically but it should still parse correctly -- hence the error but still good tree shape -- + SELECT 'x' NOT LIKE ('y' = 1); -- + Error % incompatible types in expression '=' select 'x' not like ('y' = 1); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- conversion to IS NULL requires parens -- + SELECT (nullable(5) IS NULL) + 3; -- - Error select nullable(5) isnull + 3; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens needed left to right works -- + SELECT 5 IS NULL IS NULL; -- + Error % Cannot use IS NULL or IS NOT NULL on a value of a NOT NULL type '5' -- +1 Error select 5 isnull isnull; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- conversion to IS NOT NULL requires parens -- + SELECT (nullable(5) IS NOT NULL) + 3; -- - Error select nullable(5) notnull + 3; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens needed left to right works -- + SELECT 5 IS NOT NULL IS NULL; -- + Error % Cannot use IS NULL or IS NOT NULL on a value of a NOT NULL type '5' -- +1 Error select 5 notnull isnull; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens added -- + SELECT NOT 1 IS TRUE; -- - Error select NOT 1 is true; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- IS TRUE is stronger than NOT, parens can be removed -- - Error -- + SELECT NOT 1 IS TRUE; select NOT (1 is true); -- TEST: order of operations, verifying gen_sql agrees with tree parse -- IS TRUE is stronger than NOT, parens must stay -- - Error -- + SELECT (NOT 1) IS TRUE; select (NOT 1) is true; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- no parens added -- + SELECT 1 < 5 IS TRUE; -- - Error select 1 < 5 is true; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- IS TRUE is weaker than <, the parens can be removed -- - Error -- + SELECT 1 < 5 IS TRUE; select (1 < 5) is true; -- TEST: order of operations, verifying gen_sql agrees with tree parse -- IS TRUE is weaker than <, the parens must stay -- + SELECT 1 < (5 IS TRUE); -- - Error select 1 < (5 is true); -- TEST: is true doesn't work on non numerics -- + {assign}: err -- + {is_true}: err -- + Error % string operand not allowed in 'IS TRUE' SET fal := 'x' is true; -- TEST: is false should fail on bogus args -- + {assign}: err -- + {is_false}: err -- + Error % string operand not allowed in 'NOT' SET fal := ( not 'x') is false; -- TEST: printf must be called with at least one argument -- + {select_expr}: err -- + Error % function got incorrect number of arguments 'printf' -- +1 Error select printf(); -- TEST: printf requires a string literal for its first argument -- + {select_expr}: err -- + Error % first argument must be a string literal 'printf' -- +1 Error select printf(a_string); -- TEST: printf disallows excess arguments -- + {select_expr}: err -- + Error % more arguments provided than expected by format string 'printf' -- +1 Error select printf("%d %f", 0, 0.0, "str"); -- TEST: printf disallows insufficient arguments -- + {select_expr}: err -- + Error % fewer arguments provided than expected by format string 'printf' -- +1 Error select printf("%d %f %s", 0, 0.0); -- TEST: printf works with no substitutions -- + {select_expr}: text notnull -- - Error select printf('Hello!\n'); -- TEST: printf understands '%%' requires no arguments -- + {select_expr}: text notnull -- - Error select printf("Hello %% there %%!\n"); -- TEST: printf disallows arguments of the wrong type -- + {select_expr}: err -- + Error % incompatible types in expression 'printf' -- +1 Error select printf("%s %s", "hello", 42); -- TEST: printf disallows loss of precision -- + {select_expr}: err -- + Error % lossy conversion from type 'LONG_INT' in 0L -- +1 Error select printf("%d", 0L); -- TEST: printf allows null arguments -- + {select_expr}: text notnull -- - Error select printf("%s %d", null, null); -- TEST: printf allows all sensible type specifiers -- + {select_expr}: text notnull -- - Error select printf("%d %i %u %f %e %E %g %G %x %X %o %s", 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, "str"); -- TEST: printf does not allow %c -- + {select_expr}: err -- + Error % type specifier not allowed in CQL 'c' -- +1 Error select printf("%c", "x"); -- TEST: printf does not allow %p -- + {select_expr}: err -- + Error % type specifier not allowed in CQL 'p' -- +1 Error select printf("%p", 0x123456789L); -- TEST: printf does not allow %n -- + {select_expr}: err -- + Error % type specifier not allowed in CQL 'n' -- +1 Error select printf("%n", 0x123456789L); -- TEST: printf does not allow %q -- + {select_expr}: err -- + Error % type specifier not allowed in CQL 'q' -- +1 Error select printf("%q", "hello"); -- TEST: printf does not allow %Q -- + {select_expr}: err -- + Error % type specifier not allowed in CQL 'Q' -- +1 Error select printf("%Q", "hello"); -- TEST: printf does not allow %w -- + {select_expr}: err -- + Error % type specifier not allowed in CQL 'w' -- +1 Error select printf("%w", "hello"); -- TEST: printf allows 'll' with all integer type specifiers -- + {select_expr}: text notnull -- - Error select printf("%lld %lli %llu %llx %llX %llo", 0L, 0L, 0L, 0L, 0L, 0L); -- TEST: printf disallows the use of the 'l' -- + {select_expr}: err -- + Error % 'l' length specifier has no effect; consider 'll' instead -- +1 Error select printf("%ld", 0L); -- TEST: printf disallows use of 'll' with non-integer type specifiers -- + {select_expr}: err -- + Error % type specifier cannot be combined with length specifier 's' -- +1 Error select printf("%lls", "hello"); -- TEST: printf allows numeric widths for all type specifiers -- + {select_expr}: text notnull -- - Error select printf("%12d %12i %12u %12f %12e %12E %12g %12G %12x %12X %12o %12s", 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, "str"); -- TEST: printf allows use of the '*' width and verifies that an integer -- argument is provided for the width -- + {select_expr}: text notnull -- - Error select printf("%*s %*f", 10, "hello", 20, 3.14); -- TEST: printf disallows following a numeric width with '*' -- + {select_expr}: err -- Error % unrecognized type specifier '*' -- +1 Error select printf("%10*s", 10, "hello"); -- TEST: printf disallows following '*' with a numeric width -- + {select_expr}: err -- Error % unrecognized type specifier '1' -- +1 Error select printf("%*10s", 10, "hello"); -- TEST: printf disallows incomplete substitutions containing '*' -- + {select_expr}: err -- + Error % incomplete substitution in format string -- +1 Error select printf("%*", 10); -- TEST: printf allows a precision to be specified for all type specifiers -- + {select_expr}: text notnull -- - Error select printf("%.12d %.12i %.12u %.12f %.12e %.12E %.12g %.12G %.12x %.12X %.12o %.12s", 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, "str"); -- TEST: printf allows a width and precision to be specified together for all type specifiers -- + {select_expr}: text notnull -- - Error select printf("%9.12d %9.12i %9.12u %9.12f %9.12e %9.12E %9.12g %9.12G %9.12x %9.12X %9.12o %9.12s", 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, "str"); -- TEST: printf allows '-' to be used with all type specifiers -- + {select_expr}: text notnull -- - Error select printf("%-16d %-16i %-16u %-16f %-16e %-16E %-16g %-16G %-16x %-16X %-16o %-16s", 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, "str"); -- TEST: printf requires that '-' be used with a width -- + {select_expr}: err -- + Error % width required when using flag in substitution '-' -- +1 Error select printf("%-s", "hello"); -- TEST: printf disallows the same flag appearing twice -- + {select_expr}: err -- + Error % duplicate flag in substitution '-' -- +1 Error select printf("%--10s", "hello"); -- TEST: printf allows '+' for signed numeric type specifiers -- + {select_expr}: text notnull -- - Error select printf("%+d %+i", 42, -100); -- TEST: printf disallows '+' for other type specifiers -- + {select_expr}: err -- + Error % type specifier combined with inappropriate flags 'u' -- +1 Error select printf("%+u", 42); -- TEST: printf allows the space flag for signed numeric type specifiers -- + {select_expr}: text notnull -- - Error select printf("% d % i", 42, -100); -- TEST: printf disallows the space flag for other type specifiers -- + {select_expr}: err -- + Error % type specifier combined with inappropriate flags 'u' -- +1 Error select printf("% u", 42); -- TEST: printf disallows the '+' and space flags being used together -- + {select_expr}: err -- + Error % cannot combine '+' flag with space flag -- +1 Error select printf("%+ u", 42); -- TEST: printf disallows combining a length specifier and the '!' flag -- + {select_expr}: err -- + Error % length specifier cannot be combined with '!' flag -- +1 Error select printf("%!lld", 0); -- TEST: printf allows the '0' flag with numeric type specifiers -- + {select_expr}: text notnull -- - Error select printf("%09d", 42); -- TEST: printf disallows the '0' flag with non-numeric type specifiers -- + {select_expr}: err -- + Error % type specifier combined with inappropriate flags 's' -- +1 Error select printf("%09s", "hello"); -- TEST: printf requires that '0' be used with a width -- + {select_expr}: err -- + Error % width required when using flag in substitution '0' -- +1 Error select printf("%0d", 42); -- TEST: printf allows the '#' flag with the appropriate type specifiers -- + {select_expr}: text notnull -- - Error select printf("%#g %#G %#o %#x %#X", 0.0, 0.0, 00, 0x0, 0x0); -- TEST: printf disallows the '#' flag with other type specifiers -- + {select_expr}: err -- + Error % type specifier combined with inappropriate flags 's' -- +1 Error select printf("%#s", "hello"); -- TEST: printf allows the ',' flag with signed integer type specifiers -- + {select_expr}: text notnull -- - Error select printf("%,d %,i", 0, 0); -- TEST: printf disallows the ',' flag with other type specifiers -- + {select_expr}: err -- + Error % type specifier combined with inappropriate flags 'u' -- +1 Error select printf("%,u", 0); -- TEST: printf allows the '!' flag with floating point and string type -- specifiers -- + {select_expr}: text notnull -- - Error select printf("%!f %!e %!E %!g %!G %!s", 0.0, 0.0, 0.0, 0.0, 0.0, "str"); -- TEST: printf disallows the '!' flag with other type specifiers -- + {select_expr}: err -- + Error % type specifier combined with inappropriate flags 'd' -- +1 Error select printf("%!d", 0); -- TEST: printf allows all valid combinations of flags for signed integer type -- specifiers -- + {select_expr}: text notnull -- - Error select printf("%-+0,10d %, 0-7lli", 0, 0); -- TEST: printf allows all valid combinations of flags for the unsigned integer -- type specifier -- + {select_expr}: text notnull -- - Error select printf("%0-7llu %-042u", 0, 0); -- TEST: printf allows all valid combinations of flags for floating point type -- specifiers -- + {select_expr}: text notnull -- - Error select printf("%-0#!8f %!#-016e %0!#-12E %!0#-24g %-0!#100G", 0.0, 0.0, 0.0, 0.0, 0.0); -- TEST: printf allows all valid combinations of flags for hex and octal type -- specifiers -- + {select_expr}: text notnull -- - Error select printf("%#0-32o %-#016x %0-#24X", 00, 0x0, 0x0); -- TEST: printf allows all valid combinations of flags for the string specifier -- + {select_expr}: text notnull -- - Error select printf("%-!8s %!-16s", "hello", "world"); -- TEST: printf even allows this -- + {select_expr}: text notnull -- - Error select printf("%%s%%%-#123.0194llX%%%.241o.%!.32s% -0,14.234llds%#-!1.000E", 0x0, 00, "str", 0, 0.0); -- TEST: substr uses zero based indices -- + {select_stmt}: err -- + {call}: err -- + {int 0}: err -- + Error % substr uses 1 based indices, the 2nd argument of substr may not be zero -- +1 Error select substr("123", 0, 2); -- TEST: cannot use IS NULL on a nonnull type -- + Error % Cannot use IS NULL or IS NOT NULL on a value of a NOT NULL type 'not_null_object' -- +1 Error let not_null_object_is_null := not_null_object is null; -- TEST: cannot use IS NOT NULL on a nonnull type -- + Error % Cannot use IS NULL or IS NOT NULL on a value of a NOT NULL type 'not_null_object' -- +1 Error let not_null_object_is_not_null := not_null_object is not null; -- TEST: validate parsing and non-enforcement for NULL CHECK ON NOT NULL -- + @ENFORCE_NORMAL NULL CHECK ON NOT NULL -- + {enforce_normal_stmt}: ok -- + {int 12} @enforce_normal null check on not null; -- TEST: okay when NULL CHECK ON NOT NULL is disabled -- - Error let not_null_object_is_null := not_null_object is null; -- TEST: okay when NULL CHECK ON NOT NULL is disabled -- - Error let not_null_object_is_not_null := not_null_object is not null; -- re-enable for subsequent tests @enforce_strict null check on not null;
the_stack
-- -- BugNET 0.7 Upgrade Script -- -- -- -- -- -- -- IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE id=OBJECT_ID('tempdb..#tmpErrors')) DROP TABLE #tmpErrors GO CREATE TABLE #tmpErrors (Error int) GO SET XACT_ABORT ON GO BEGIN TRANSACTION GO SET TRANSACTION ISOLATION LEVEL SERIALIZABLE GO -- Remove foreign key constraints ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Environment] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Hardware] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_OperatingSystem] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Priority] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Resolution] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Status] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Type] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugAttachment] DROP CONSTRAINT [FK_BugAttachment_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugComment] DROP CONSTRAINT [FK_BugComment_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugHistory] DROP CONSTRAINT [FK_BugHistory_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugNotification] DROP CONSTRAINT [FK_BugNotification_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugTimeEntry] DROP CONSTRAINT [FK_BugTimeEntry_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[RelatedBug] DROP CONSTRAINT [FK_RelatedBug_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Bug -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Bug' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_Bug] ( [BugID] [int] NOT NULL IDENTITY (1, 1) , [Summary] [nvarchar] (500) NOT NULL , [Description] [ntext] NOT NULL , [ReportedDate] [datetime] NOT NULL , [StatusID] [int] NOT NULL , [PriorityID] [int] NOT NULL , [TypeID] [int] NOT NULL , [ComponentID] [int] NOT NULL , [ProjectID] [int] NOT NULL , [ResolutionID] [int] NOT NULL , [VersionID] [int] NOT NULL , [LastUpdate] [datetime] NOT NULL , [ReporterUserId] [uniqueidentifier] NOT NULL , [AssignedToUserId] [uniqueidentifier] NULL , [LastUpdateUserId] [uniqueidentifier] NOT NULL , [DueDate] [datetime] NULL , [FixedInVersionId] [int] NOT NULL , [Visibility] [int] NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from syscolumns where id=OBJECT_ID('[dbo].[tmp_sc_Bug]') and name='DueDate' and cdefault>0) EXEC ('sp_unbindefault ''[dbo].[tmp_sc_Bug].[DueDate]''') IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Bug] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_Bug] ([BugID], [Summary], [Description], [ReportedDate], [StatusID], [PriorityID], [TypeID], [ComponentID], [ProjectID], [ResolutionID], [VersionID], [LastUpdate],[Visibility],[FixedInVersionId],[LastUpdateUserId],[ReporterUserId],[AssignedToUserId]) SELECT [BugID], [Summary], [Description], [ReportedDate], [StatusID], [PriorityID], [TypeID], [ComponentID], [ProjectID], [ResolutionID], [VersionID], [LastUpdate], 0,-1, (SELECT aspnet_users.UserId From aspnet_users join Users on Bug.LastUpdateUser = Users.UserId where Users.Username = aspnet_users.username ), (SELECT aspnet_users.UserId From aspnet_users join Users on Bug.ReportedUser = Users.UserId where Users.Username = aspnet_users.username), (SELECT aspnet_users.UserId From aspnet_users join Users on Bug.AssignedTo = Users.UserId where Users.Username = aspnet_users.username) FROM [dbo].[Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Bug] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Bug]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_Bug', 'Bug' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] WITH NOCHECK ADD CONSTRAINT [PK__Bug__145C0A3F] PRIMARY KEY CLUSTERED ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[Bug] WITH NOCHECK ADD CONSTRAINT [FK_Bug_Priority] FOREIGN KEY ([PriorityID]) REFERENCES [dbo].[Priority] ([PriorityID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] CHECK CONSTRAINT [FK_Bug_Priority] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] WITH NOCHECK ADD CONSTRAINT [FK_Bug_Project] FOREIGN KEY ([ProjectID]) REFERENCES [dbo].[Project] ([ProjectID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] CHECK CONSTRAINT [FK_Bug_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] WITH NOCHECK ADD CONSTRAINT [FK_Bug_Resolution] FOREIGN KEY ([ResolutionID]) REFERENCES [dbo].[Resolution] ([ResolutionID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] CHECK CONSTRAINT [FK_Bug_Resolution] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] WITH NOCHECK ADD CONSTRAINT [FK_Bug_Status] FOREIGN KEY ([StatusID]) REFERENCES [dbo].[Status] ([StatusID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] CHECK CONSTRAINT [FK_Bug_Status] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] WITH NOCHECK ADD CONSTRAINT [FK_Bug_Type] FOREIGN KEY ([TypeID]) REFERENCES [dbo].[Type] ([TypeID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] CHECK CONSTRAINT [FK_Bug_Type] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugAttachment] WITH NOCHECK ADD CONSTRAINT [FK_BugAttachment_Bug] FOREIGN KEY ([BugID]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugAttachment] CHECK CONSTRAINT [FK_BugAttachment_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugComment] WITH NOCHECK ADD CONSTRAINT [FK_BugComment_Bug] FOREIGN KEY ([BugID]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugComment] CHECK CONSTRAINT [FK_BugComment_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugHistory] WITH NOCHECK ADD CONSTRAINT [FK_BugHistory_Bug] FOREIGN KEY ([BugID]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugHistory] CHECK CONSTRAINT [FK_BugHistory_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugNotification] WITH NOCHECK ADD CONSTRAINT [FK_BugNotification_Bug] FOREIGN KEY ([BugID]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugNotification] CHECK CONSTRAINT [FK_BugNotification_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugTimeEntry] WITH NOCHECK ADD CONSTRAINT [FK_BugTimeEntry_Bug] FOREIGN KEY ([BugId]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugTimeEntry] CHECK CONSTRAINT [FK_BugTimeEntry_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[RelatedBug] WITH NOCHECK ADD CONSTRAINT [FK_RelatedBug_Bug] FOREIGN KEY ([BugID]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[RelatedBug] CHECK CONSTRAINT [FK_RelatedBug_Bug] GO /* Bug Attachment Table */ -- Remove foreign key constraints ALTER TABLE [dbo].[BugAttachment] DROP CONSTRAINT [FK_BugAttachment_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugAttachment -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugAttachment' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_BugAttachment] ( [BugAttachmentID] [int] NOT NULL IDENTITY (1, 1) , [BugID] [int] NOT NULL , [FileName] [nvarchar] (100) NOT NULL , [Description] [nvarchar] (80) NOT NULL , [FileSize] [int] NOT NULL , [Type] [nvarchar] (50) NOT NULL , [UploadedDate] [datetime] NOT NULL , [UploadedUserId] [uniqueidentifier] NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_BugAttachment] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_BugAttachment] ([BugAttachmentID], [BugID], [FileName], [Description], [FileSize], [Type], [UploadedDate],[UploadedUserId]) SELECT [BugAttachmentID], [BugID], [FileName], [Description], [FileSize], [Type], [UploadedDate] , (SELECT aspnet_users.UserId From aspnet_users join Users on BugAttachment.UploadedUser = Users.UserId where Users.Username = aspnet_users.username ) FROM [dbo].[BugAttachment] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_BugAttachment] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugAttachment]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[BugAttachment] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_BugAttachment', 'BugAttachment' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugAttachment] WITH NOCHECK ADD CONSTRAINT [PK__BugAttachment__1273C1CD] PRIMARY KEY CLUSTERED ([BugAttachmentID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[BugAttachment] WITH NOCHECK ADD CONSTRAINT [FK_BugAttachment_Bug] FOREIGN KEY ([BugID]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugAttachment] CHECK CONSTRAINT [FK_BugAttachment_Bug] GO /* Bug Comment Table */ -- Remove foreign key constraints ALTER TABLE [dbo].[BugComment] DROP CONSTRAINT [FK_BugComment_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugComment -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugComment' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_BugComment] ( [BugCommentID] [int] NOT NULL IDENTITY (1, 1) , [BugID] [int] NOT NULL , [CreatedDate] [datetime] NOT NULL , [Comment] [ntext] NOT NULL , [CreatedUserId] [uniqueidentifier] NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_BugComment] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_BugComment] ([BugCommentID], [BugID], [CreatedDate], [Comment],[CreatedUserId]) SELECT [BugCommentID], [BugID], [CreatedDate], [Comment],(SELECT aspnet_users.UserId From aspnet_users join Users on BugComment.UserId = Users.UserId where Users.Username = aspnet_users.username ) FROM [dbo].[BugComment] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_BugComment] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugComment]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[BugComment] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_BugComment', 'BugComment' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugComment] WITH NOCHECK ADD CONSTRAINT [PK__BugComment__164452B1] PRIMARY KEY CLUSTERED ([BugCommentID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[BugComment] WITH NOCHECK ADD CONSTRAINT [FK_BugComment_Bug] FOREIGN KEY ([BugID]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugComment] CHECK CONSTRAINT [FK_BugComment_Bug] GO /* Bug History Table */ -- Remove foreign key constraints ALTER TABLE [dbo].[BugHistory] DROP CONSTRAINT [FK_BugHistory_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugHistory -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugHistory' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_BugHistory] ( [BugHistoryID] [int] NOT NULL IDENTITY (1, 1) , [BugID] [int] NOT NULL , [FieldChanged] [nvarchar] (50) NOT NULL , [OldValue] [nvarchar] (50) NOT NULL , [NewValue] [nvarchar] (50) NOT NULL , [CreatedDate] [datetime] NOT NULL , [CreatedUserId] [uniqueidentifier] NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_BugHistory] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_BugHistory] ([BugHistoryID], [BugID], [FieldChanged], [OldValue], [NewValue], [CreatedDate],[CreatedUserId]) SELECT [BugHistoryID], [BugID], [FieldChanged], [OldValue], [NewValue], [CreatedDate], (SELECT aspnet_users.UserId From aspnet_users join Users on BugHistory.UserId = Users.UserId where Users.Username = aspnet_users.username ) FROM [dbo].[BugHistory] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_BugHistory] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugHistory]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[BugHistory] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_BugHistory', 'BugHistory' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugHistory] WITH NOCHECK ADD CONSTRAINT [PK__BugHistory__182C9B23] PRIMARY KEY CLUSTERED ([BugHistoryID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[BugHistory] WITH NOCHECK ADD CONSTRAINT [FK_BugHistory_Bug] FOREIGN KEY ([BugID]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugHistory] CHECK CONSTRAINT [FK_BugHistory_Bug] GO /* Bug Notfication Table */ -- Remove foreign key constraints ALTER TABLE [dbo].[BugNotification] DROP CONSTRAINT [FK_BugNotification_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNotification -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNotification' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_BugNotification] ( [BugNotificationID] [int] NOT NULL IDENTITY (1, 1) , [BugID] [int] NOT NULL , [CreatedUserId] [uniqueidentifier] NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_BugNotification] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_BugNotification] ([BugNotificationID], [BugID],[CreatedUserId]) SELECT [BugNotificationID], [BugID], (SELECT aspnet_users.UserId From aspnet_users join Users on BugNotification.UserId = Users.UserId where Users.Username = aspnet_users.username ) FROM [dbo].[BugNotification] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_BugNotification] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNotification]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[BugNotification] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_BugNotification', 'BugNotification' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugNotification] WITH NOCHECK ADD CONSTRAINT [PK_BugNotification] PRIMARY KEY CLUSTERED ([BugNotificationID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[BugNotification] WITH NOCHECK ADD CONSTRAINT [FK_BugNotification_Bug] FOREIGN KEY ([BugID]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugNotification] CHECK CONSTRAINT [FK_BugNotification_Bug] GO /* Bug Time Entry Table */ -- Remove foreign key constraints ALTER TABLE [dbo].[BugTimeEntry] DROP CONSTRAINT [FK_BugTimeEntry_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugTimeEntry -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugTimeEntry' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_BugTimeEntry] ( [BugTimeEntryId] [int] NOT NULL IDENTITY (1, 1) , [BugId] [int] NOT NULL , [WorkDate] [datetime] NOT NULL , [Duration] [decimal] (4, 2) NOT NULL , [BugCommentId] [int] NOT NULL , [CreatedUserId] [uniqueidentifier] NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_BugTimeEntry] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_BugTimeEntry] ([BugTimeEntryId], [BugId], [WorkDate], [Duration], [BugCommentId],[CreatedUserId]) SELECT [BugTimeEntryId], [BugId], [WorkDate], [Duration], [BugCommentId], (SELECT aspnet_users.UserId From aspnet_users join Users on BugTimeEntry.UserId = Users.UserId where Users.Username = aspnet_users.username ) FROM [dbo].[BugTimeEntry] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_BugTimeEntry] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugTimeEntry]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[BugTimeEntry] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_BugTimeEntry', 'BugTimeEntry' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugTimeEntry] WITH NOCHECK ADD CONSTRAINT [PK_BugTimeEntry] PRIMARY KEY CLUSTERED ([BugTimeEntryId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[BugTimeEntry] WITH NOCHECK ADD CONSTRAINT [FK_BugTimeEntry_Bug] FOREIGN KEY ([BugId]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[BugTimeEntry] CHECK CONSTRAINT [FK_BugTimeEntry_Bug] GO /* User Projects Table */ -- Remove foreign key constraints ALTER TABLE [dbo].[UserProjects] DROP CONSTRAINT [FK_UserProjects_Users] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.UserProjects -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.UserProjects' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_UserProjects] ( [UserId] [uniqueidentifier] NOT NULL , [ProjectId] [int] NOT NULL , [UserProjectId] [int] NOT NULL IDENTITY (1, 1) , [CreatedDate] [datetime] NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_UserProjects] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_UserProjects] ([UserId], [ProjectId], [UserProjectId], [CreatedDate]) SELECT (SELECT aspnet_users.UserId From aspnet_users join Users on UserProjects.UserId = Users.UserId where Users.Username = aspnet_users.username ), [ProjectId], [UserProjectId], [CreatedDate] FROM [dbo].[UserProjects] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_UserProjects] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[UserProjects]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[UserProjects] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_UserProjects', 'UserProjects' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[UserProjects] WITH NOCHECK ADD CONSTRAINT [PK_UserProjects_1] PRIMARY KEY CLUSTERED ([UserId], [ProjectId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Project Table */ -- Remove foreign key constraints ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Component] DROP CONSTRAINT [FK_Component_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectMailBox] DROP CONSTRAINT [FK_ProjectMailBox_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Version] DROP CONSTRAINT [FK_Version_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Project -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Project' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Project] DROP CONSTRAINT [DF_Project_Active] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_Project] ( [ProjectID] [int] NOT NULL IDENTITY (1, 1) , [Name] [nvarchar] (50) NOT NULL , [Code] [nvarchar] (3) NOT NULL , [Description] [nvarchar] (80) NOT NULL , [UploadPath] [nvarchar] (80) NOT NULL , [CreateDate] [datetime] NOT NULL , [Active] [int] NOT NULL , [AccessType] [int] NOT NULL , [ManagerUserID] [uniqueidentifier] NOT NULL , [CreatorUserID] [uniqueidentifier] NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from syscolumns where id=OBJECT_ID('[dbo].[tmp_sc_Project]') and name='Active' and cdefault>0) EXEC ('sp_unbindefault ''[dbo].[tmp_sc_Project].[Active]''') ALTER TABLE [dbo].[tmp_sc_Project] WITH NOCHECK ADD CONSTRAINT [DF_Project_Active] DEFAULT ((1)) FOR [Active] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Project] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_Project] ([ProjectID], [Name], [Code], [Description], [UploadPath], [CreateDate], [Active], [AccessType], [CreatorUserID],[ManagerUserId]) SELECT [ProjectID], [Name], [Code], [Description], [UploadPath], [CreateDate], [Active], [AccessType], (SELECT aspnet_users.UserId From aspnet_users join Users on Project.CreatorUserId = Users.UserId where Users.Username = aspnet_users.username ), (SELECT aspnet_users.UserId From aspnet_users join Users on Project.ManagerId = Users.UserId where Users.Username = aspnet_users.username ) FROM [dbo].[Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Project] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Project]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_Project', 'Project' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Project] WITH NOCHECK ADD CONSTRAINT [PK__Product__1DE57479] PRIMARY KEY CLUSTERED ([ProjectID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[Bug] WITH NOCHECK ADD CONSTRAINT [FK_Bug_Project] FOREIGN KEY ([ProjectID]) REFERENCES [dbo].[Project] ([ProjectID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] CHECK CONSTRAINT [FK_Bug_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectMailBox] WITH NOCHECK ADD CONSTRAINT [FK_ProjectMailBox_Project] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project] ([ProjectID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectMailBox] CHECK CONSTRAINT [FK_ProjectMailBox_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Version] WITH NOCHECK ADD CONSTRAINT [FK_Version_Project] FOREIGN KEY ([ProjectID]) REFERENCES [dbo].[Project] ([ProjectID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Version] CHECK CONSTRAINT [FK_Version_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Project Mailbox Table */ -- Remove foreign key constraints ALTER TABLE [dbo].[ProjectMailBox] DROP CONSTRAINT [FK_ProjectMailBox_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.ProjectMailBox -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.ProjectMailBox' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_ProjectMailBox] ( [ProjectMailboxId] [int] NOT NULL IDENTITY (1, 1) , [MailBox] [nvarchar] (100) NOT NULL , [ProjectId] [int] NOT NULL , [AssignToUserId] [uniqueidentifier] NULL , [IssueTypeId] [int] NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_ProjectMailBox] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_ProjectMailBox] ([ProjectMailboxId], [MailBox], [ProjectId], [AssignToUserId], [IssueTypeId]) SELECT [ProjectMailboxId], [MailBox], [ProjectId], (SELECT aspnet_users.UserId From aspnet_users join Users on ProjectMailBox.AssignToUserId = Users.UserId where Users.Username = aspnet_users.username ), [IssueTypeId] FROM [dbo].[ProjectMailBox] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_ProjectMailBox] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[ProjectMailBox]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[ProjectMailBox] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_ProjectMailBox', 'ProjectMailBox' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectMailBox] WITH NOCHECK ADD CONSTRAINT [PK_ProjectMailBox] PRIMARY KEY CLUSTERED ([ProjectMailboxId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[ProjectMailBox] WITH NOCHECK ADD CONSTRAINT [FK_ProjectMailBox_Project] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project] ([ProjectID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectMailBox] CHECK CONSTRAINT [FK_ProjectMailBox_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Component Table */ -- -- Script for dbo.Component -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Component' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Component] DROP CONSTRAINT [DF_Component_ParentComponentID] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_Component] ( [ComponentID] [int] NOT NULL IDENTITY (1, 1) , [ProjectID] [int] NOT NULL , [Name] [nvarchar] (50) NOT NULL , [ParentComponentID] [int] NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from syscolumns where id=OBJECT_ID('[dbo].[tmp_sc_Component]') and name='ParentComponentID' and cdefault>0) EXEC ('sp_unbindefault ''[dbo].[tmp_sc_Component].[ParentComponentID]''') ALTER TABLE [dbo].[tmp_sc_Component] WITH NOCHECK ADD CONSTRAINT [DF_Component_ParentComponentID] DEFAULT ((0)) FOR [ParentComponentID] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Component] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_Component] ([ComponentID], [ProjectID], [Name], [ParentComponentID]) SELECT [ComponentID], [ProjectID], [Name], [ParentComponentID] FROM [dbo].[Component] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Component] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Component]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Component] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_Component', 'Component' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Component] WITH NOCHECK ADD CONSTRAINT [PK__Component__09DE7BCC] PRIMARY KEY CLUSTERED ([ComponentID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Log Table */ -- -- Script for dbo.Log -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Log' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[Log] ( [Id] [int] NOT NULL IDENTITY (1, 1) , [Date] [datetime] NOT NULL , [Thread] [varchar] (255) NOT NULL , [Level] [varchar] (50) NOT NULL , [Logger] [varchar] (255) NOT NULL , [User] [nvarchar] (50) NOT NULL , [Message] [varchar] (4000) NOT NULL , [Exception] [varchar] (2000) NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Permission Table */ -- Remove foreign key constraints ALTER TABLE [dbo].[RolePermission] DROP CONSTRAINT [FK_RolePermission_Permission] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Permission -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Permission' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_Permission] ( [PermissionId] [int] NOT NULL , [PermissionKey] [nvarchar] (50) NOT NULL , [Name] [nvarchar] (50) NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_Permission] ([PermissionId], [PermissionKey], [Name]) SELECT [PermissionId], [PermissionKey], [Name] FROM [dbo].[Permission] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Permission]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Permission] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_Permission', 'Permission' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Permission] WITH NOCHECK ADD CONSTRAINT [PK_Permission] PRIMARY KEY CLUSTERED ([PermissionId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[RolePermission] WITH NOCHECK ADD CONSTRAINT [FK_RolePermission_Permission] FOREIGN KEY ([PermissionId]) REFERENCES [dbo].[Permission] ([PermissionId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[RolePermission] CHECK CONSTRAINT [FK_RolePermission_Permission] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Role Permission Table */ -- Remove foreign key constraints ALTER TABLE [dbo].[RolePermission] DROP CONSTRAINT [FK_RolePermission_Permission] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[RolePermission] DROP CONSTRAINT [FK_RolePermission_Roles] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.RolePermission -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.RolePermission' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_RolePermission] ( [RolePermissionId] [int] NOT NULL IDENTITY (1, 1) , [RoleId] [uniqueidentifier] NOT NULL , [PermissionId] [int] NOT NULL ) if exists (select * from sysobjects where id=object_id('[dbo].[RolePermission]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[RolePermission] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_RolePermission', 'RolePermission' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[RolePermission] WITH NOCHECK ADD CONSTRAINT [PK_RolePermission] PRIMARY KEY CLUSTERED ([RolePermissionId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[RolePermission] WITH NOCHECK ADD CONSTRAINT [FK_RolePermission_Permission] FOREIGN KEY ([PermissionId]) REFERENCES [dbo].[Permission] ([PermissionId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[RolePermission] CHECK CONSTRAINT [FK_RolePermission_Permission] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Priority Table */ -- Remove foreign key constraints ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Priority] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Priority -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Priority' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_Priority] ( [PriorityID] [int] NOT NULL IDENTITY (1, 1) , [Name] [nvarchar] (50) NOT NULL , [ImageUrl] [nvarchar] (50) NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Priority] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_Priority] ([PriorityID], [Name], [ImageUrl]) SELECT [PriorityID], [Name], [ImageUrl] FROM [dbo].[Priority] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Priority] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Priority]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Priority] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_Priority', 'Priority' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Priority] WITH NOCHECK ADD CONSTRAINT [PK__Priority__07F6335A] PRIMARY KEY CLUSTERED ([PriorityID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[Bug] WITH NOCHECK ADD CONSTRAINT [FK_Bug_Priority] FOREIGN KEY ([PriorityID]) REFERENCES [dbo].[Priority] ([PriorityID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] CHECK CONSTRAINT [FK_Bug_Priority] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Custom Fields Tables */ -- -- Script for dbo.ProjectCustomFields -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.ProjectCustomFields' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[ProjectCustomFields] ( [CustomFieldId] [int] NOT NULL IDENTITY (1, 1) , [ProjectId] [int] NOT NULL , [CustomFieldName] [nvarchar] (50) NOT NULL , [CustomFieldRequired] [bit] NOT NULL , [CustomFieldDataType] [int] NOT NULL , [CustomFieldTypeId] [int] NOT NULL ) ALTER TABLE [dbo].[ProjectCustomFields] WITH NOCHECK ADD CONSTRAINT [PK_ProjectCustomFields] PRIMARY KEY CLUSTERED ([CustomFieldId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.ProjectCustomFieldSelection -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.ProjectCustomFieldSelection' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[ProjectCustomFieldSelection] ( [CustomFieldSelectionId] [int] NOT NULL IDENTITY (1, 1) , [CustomFieldId] [int] NOT NULL , [CustomFieldSelectionValue] [nchar] (255) NOT NULL , [CustomFieldSelectionName] [nchar] (255) NOT NULL , [CustomFieldSelectionSortOrder] [int] NOT NULL ) ALTER TABLE [dbo].[ProjectCustomFieldSelection] ADD CONSTRAINT [DF_ProjectCustomFieldSelection_CustomFieldSelectionSortOrder] DEFAULT ((0)) FOR [CustomFieldSelectionSortOrder] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectCustomFieldSelection] WITH NOCHECK ADD CONSTRAINT [PK_ProjectCustomFieldSelection] PRIMARY KEY CLUSTERED ([CustomFieldSelectionId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.ProjectCustomFieldType -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.ProjectCustomFieldType' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[ProjectCustomFieldType] ( [CustomFieldTypeId] [int] NOT NULL IDENTITY (1, 1) , [CustomFieldTypeName] [nvarchar] (50) NOT NULL ) ALTER TABLE [dbo].[ProjectCustomFieldType] WITH NOCHECK ADD CONSTRAINT [PK_ProjectCustomFieldType] PRIMARY KEY CLUSTERED ([CustomFieldTypeId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.ProjectCustomFieldValues -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.ProjectCustomFieldValues' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[ProjectCustomFieldValues] ( [CustomFieldValueId] [int] NOT NULL IDENTITY (1, 1) , [BugId] [int] NOT NULL , [CustomFieldId] [int] NOT NULL , [CustomFieldValue] [ntext] NOT NULL ) ALTER TABLE [dbo].[ProjectCustomFieldValues] WITH NOCHECK ADD CONSTRAINT [PK_ProjectCustomFieldValues] PRIMARY KEY CLUSTERED ([CustomFieldValueId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[ProjectCustomFields] WITH NOCHECK ADD CONSTRAINT [FK_ProjectCustomFields_Project] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project] ([ProjectID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectCustomFields] CHECK CONSTRAINT [FK_ProjectCustomFields_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectCustomFields] WITH NOCHECK ADD CONSTRAINT [FK_ProjectCustomFields_ProjectCustomFieldType] FOREIGN KEY ([CustomFieldTypeId]) REFERENCES [dbo].[ProjectCustomFieldType] ([CustomFieldTypeId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectCustomFields] CHECK CONSTRAINT [FK_ProjectCustomFields_ProjectCustomFieldType] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectCustomFieldSelection] WITH NOCHECK ADD CONSTRAINT [FK_ProjectCustomFieldSelection_ProjectCustomFields] FOREIGN KEY ([CustomFieldId]) REFERENCES [dbo].[ProjectCustomFields] ([CustomFieldId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectCustomFieldSelection] CHECK CONSTRAINT [FK_ProjectCustomFieldSelection_ProjectCustomFields] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectCustomFieldValues] WITH NOCHECK ADD CONSTRAINT [FK_ProjectCustomFieldValues_Bug] FOREIGN KEY ([BugId]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectCustomFieldValues] CHECK CONSTRAINT [FK_ProjectCustomFieldValues_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectCustomFieldValues] WITH NOCHECK ADD CONSTRAINT [FK_ProjectCustomFieldValues_ProjectCustomFields] FOREIGN KEY ([CustomFieldId]) REFERENCES [dbo].[ProjectCustomFields] ([CustomFieldId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectCustomFieldValues] CHECK CONSTRAINT [FK_ProjectCustomFieldValues_ProjectCustomFields] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Remaining Tables */ -- Remove foreign key constraints ALTER TABLE [dbo].[RelatedBug] DROP CONSTRAINT [FK_RelatedBug_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Resolution] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Status] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] DROP CONSTRAINT [FK_Bug_Type] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Version] DROP CONSTRAINT [FK_Version_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.ProjectRoles -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.ProjectRoles' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[ProjectRoles] ( [ProjectRoleId] [int] NOT NULL IDENTITY (1, 1) , [RoleId] [uniqueidentifier] NOT NULL , [ProjectId] [int] NOT NULL , [CreatedDate] [datetime] NOT NULL ) ALTER TABLE [dbo].[ProjectRoles] WITH NOCHECK ADD CONSTRAINT [PK_ProjectRoles] PRIMARY KEY CLUSTERED ([ProjectRoleId]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.RelatedBug -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.RelatedBug' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_RelatedBug] ( [RelatedBugID] [int] NOT NULL IDENTITY (1, 1) , [BugID] [int] NOT NULL , [LinkedBugID] [int] NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_RelatedBug] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_RelatedBug] ([RelatedBugID], [BugID], [LinkedBugID]) SELECT [RelatedBugID], [BugID], [LinkedBugID] FROM [dbo].[RelatedBug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_RelatedBug] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[RelatedBug]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[RelatedBug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_RelatedBug', 'RelatedBug' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[RelatedBug] WITH NOCHECK ADD CONSTRAINT [PK_BugRelation] PRIMARY KEY CLUSTERED ([RelatedBugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Resolution -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Resolution' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_Resolution] ( [ResolutionID] [int] NOT NULL IDENTITY (1, 1) , [Name] [nvarchar] (50) NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Resolution] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_Resolution] ([ResolutionID], [Name]) SELECT [ResolutionID], [Name] FROM [dbo].[Resolution] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Resolution] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Resolution]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Resolution] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_Resolution', 'Resolution' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Resolution] WITH NOCHECK ADD CONSTRAINT [PK__Resolution__00551192] PRIMARY KEY CLUSTERED ([ResolutionID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Status -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Status' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_Status] ( [StatusID] [int] NOT NULL IDENTITY (1, 1) , [Name] [nvarchar] (50) NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Status] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_Status] ([StatusID], [Name]) SELECT [StatusID], [Name] FROM [dbo].[Status] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Status] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Status]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Status] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_Status', 'Status' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Status] WITH NOCHECK ADD CONSTRAINT [PK__Status__023D5A04] PRIMARY KEY CLUSTERED ([StatusID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Type -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Type' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_Type] ( [TypeID] [int] NOT NULL IDENTITY (1, 1) , [Name] [nvarchar] (50) NOT NULL , [ImageUrl] [nvarchar] (50) NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Type] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_Type] ([TypeID], [Name], [ImageUrl]) SELECT [TypeID], [Name], [ImageUrl] FROM [dbo].[Type] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Type] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Type]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Type] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_Type', 'Type' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Type] WITH NOCHECK ADD CONSTRAINT [PK_Type] PRIMARY KEY CLUSTERED ([TypeID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Version -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Version' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE TABLE [dbo].[tmp_sc_Version] ( [VersionID] [int] NOT NULL IDENTITY (1, 1) , [ProjectID] [int] NOT NULL , [Name] [nvarchar] (50) NOT NULL , [SortOrder] [int] NOT NULL ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Version] ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO [dbo].[tmp_sc_Version] ([VersionID], [ProjectID], [Name],[SortOrder]) SELECT [VersionID], [ProjectID], [Name],[VersionID] FROM [dbo].[Version] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET IDENTITY_INSERT [dbo].[tmp_sc_Version] OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Version]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Version] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO sp_rename 'dbo.tmp_sc_Version', 'Version' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Version] WITH NOCHECK ADD CONSTRAINT [PK__Version__0425A276] PRIMARY KEY CLUSTERED ([VersionID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- Add foreign key constraints ALTER TABLE [dbo].[ProjectRoles] WITH NOCHECK ADD CONSTRAINT [FK_ProjectRoles_Project] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project] ([ProjectID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[ProjectRoles] CHECK CONSTRAINT [FK_ProjectRoles_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[RelatedBug] WITH NOCHECK ADD CONSTRAINT [FK_RelatedBug_Bug] FOREIGN KEY ([BugID]) REFERENCES [dbo].[Bug] ([BugID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[RelatedBug] CHECK CONSTRAINT [FK_RelatedBug_Bug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] WITH NOCHECK ADD CONSTRAINT [FK_Bug_Resolution] FOREIGN KEY ([ResolutionID]) REFERENCES [dbo].[Resolution] ([ResolutionID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] CHECK CONSTRAINT [FK_Bug_Resolution] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] WITH NOCHECK ADD CONSTRAINT [FK_Bug_Status] FOREIGN KEY ([StatusID]) REFERENCES [dbo].[Status] ([StatusID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] CHECK CONSTRAINT [FK_Bug_Status] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] WITH NOCHECK ADD CONSTRAINT [FK_Bug_Type] FOREIGN KEY ([TypeID]) REFERENCES [dbo].[Type] ([TypeID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Bug] CHECK CONSTRAINT [FK_Bug_Type] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Version] WITH NOCHECK ADD CONSTRAINT [FK_Version_Project] FOREIGN KEY ([ProjectID]) REFERENCES [dbo].[Project] ([ProjectID]) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[Version] CHECK CONSTRAINT [FK_Version_Project] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Stored Procs & Views */ -- -- Script for dbo.BugsView -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugsView' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugsView]') and OBJECTPROPERTY(id, 'IsView')=1) drop view [dbo].[BugsView] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Handles 'unassigned' version */ CREATE VIEW [dbo].[BugsView] AS SELECT dbo.Bug.BugID, dbo.Bug.Summary, dbo.Bug.Description, dbo.Bug.ReportedDate, dbo.Bug.StatusID, dbo.Bug.PriorityID, dbo.Bug.TypeID, dbo.Bug.ComponentID, dbo.Bug.ProjectID, dbo.Bug.ResolutionID, dbo.Bug.VersionID, dbo.Bug.LastUpdate, dbo.Bug.ReporterUserId, dbo.Bug.AssignedToUserId, dbo.Bug.LastUpdateUserId, dbo.Status.Name AS StatusName, ISNULL(dbo.Component.Name, 'All Components') AS ComponentName, dbo.Priority.Name AS PriorityName, dbo.Project.Name AS ProjectName, dbo.Project.Code AS ProjectCode, dbo.Resolution.Name AS ResolutionName, dbo.Type.Name AS TypeName, ISNULL(dbo.Version.Name, 'Unassigned') AS VersionName, LastUpdateUsers.UserName AS LastUpdateUserName, ReportedUsers.UserName AS ReporterUserName, ISNULL(AssignedUsers.UserName, 'Unassigned') AS AssignedToUserName, dbo.Bug.DueDate, dbo.Bug.FixedInVersionId, ISNULL(FixedInVersion.Name, 'Unassigned') AS FixedInVersionName, dbo.Bug.Visibility FROM dbo.Bug LEFT OUTER JOIN dbo.Component ON dbo.Bug.ComponentID = dbo.Component.ComponentID LEFT OUTER JOIN dbo.Priority ON dbo.Bug.PriorityID = dbo.Priority.PriorityID LEFT OUTER JOIN dbo.Project ON dbo.Bug.ProjectID = dbo.Project.ProjectID LEFT OUTER JOIN dbo.Resolution ON dbo.Bug.ResolutionID = dbo.Resolution.ResolutionID LEFT OUTER JOIN dbo.Status ON dbo.Bug.StatusID = dbo.Status.StatusID LEFT OUTER JOIN dbo.Type ON dbo.Bug.TypeID = dbo.Type.TypeID LEFT OUTER JOIN dbo.Version ON dbo.Bug.VersionID = dbo.Version.VersionID LEFT OUTER JOIN dbo.aspnet_Users AS AssignedUsers ON dbo.Bug.AssignedToUserId = AssignedUsers.UserId LEFT OUTER JOIN dbo.aspnet_Users AS ReportedUsers ON dbo.Bug.ReporterUserId = ReportedUsers.UserId LEFT OUTER JOIN dbo.aspnet_Users AS LastUpdateUsers ON dbo.Bug.LastUpdateUserId = LastUpdateUsers.UserId LEFT OUTER JOIN dbo.Version AS FixedInVersion ON dbo.Bug.FixedInVersionId = FixedInVersion.VersionID GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_ApplicationLog_ClearLog -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_ApplicationLog_ClearLog' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_ApplicationLog_ClearLog] AS DELETE FROM Log GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_ApplicationLog_GetLog -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_ApplicationLog_GetLog' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_ApplicationLog_GetLog] AS SELECT * FROM Log GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Attachment_CreateNewAttachment -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Attachment_CreateNewAttachment' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Attachment_CreateNewAttachment]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Attachment_CreateNewAttachment] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Attachment_CreateNewAttachment] @BugId int, @FileName nvarchar(100), @Description nvarchar(80), @FileSize Int, @ContentType nvarchar(50), @UploadedUserName nvarchar(255) AS -- Get Uploaded UserID DECLARE @UploadedUserId UniqueIdentifier SELECT @UploadedUserId = UserId FROM aspnet_users WHERE Username = @UploadedUserName INSERT BugAttachment ( BugID, FileName, Description, FileSize, Type, UploadedDate, UploadedUserId ) VALUES ( @BugId, @FileName, @Description, @FileSize, @ContentType, GetDate(), @UploadedUserId ) RETURN @@IDENTITY GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Attachment_DeleteAttachment -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Attachment_DeleteAttachment' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Attachment_DeleteAttachment] @AttachmentId Int AS DELETE BugAttachment WHERE BugAttachmentId = @AttachmentId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Attachment_GetAttachmentById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Attachment_GetAttachmentById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Attachment_GetAttachmentById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Attachment_GetAttachmentById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Attachment_GetAttachmentById] @AttachmentId INT AS SELECT BugAttachmentId, BugId, FileName, Description, FileSize, Type, UploadedDate, UploadedUserId, Creators.UserName CreatorUserName FROM BugAttachment INNER JOIN aspnet_users Creators ON Creators.UserId = BugAttachment.UploadedUserId WHERE BugAttachmentId = @AttachmentId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Attachment_GetAttachmentsByBugId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Attachment_GetAttachmentsByBugId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Attachment_GetAttachmentsByBugId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Attachment_GetAttachmentsByBugId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Attachment_GetAttachmentsByBugId] @BugId INT AS SELECT BugAttachmentId, BugId, FileName, Description, FileSize, Type, UploadedDate, UploadedUserId, Creators.UserName CreatorUserName FROM BugAttachment INNER JOIN aspnet_users Creators ON Creators.UserId = BugAttachment.UploadedUserId WHERE BugId = @BugId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_CreateNewBug -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_CreateNewBug' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_CreateNewBug]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_CreateNewBug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_CreateNewBug] @Summary nvarchar(500), @Description ntext, @ProjectId Int, @ComponentId Int, @StatusId Int, @PriorityId Int, @VersionId Int, @TypeId Int, @ResolutionId Int, @AssignedToUserName NVarChar(255), @ReporterUserName NVarChar(255), @DueDate datetime, @FixedInVersionId int, @Visibility int AS DECLARE @newIssueId Int -- Get Reporter UserID DECLARE @AssignedToUserId UNIQUEIDENTIFIER DECLARE @ReporterUserId UNIQUEIDENTIFIER SELECT @AssignedToUserId = UserId FROM aspnet_users WHERE Username = @AssignedToUserName SELECT @ReporterUserId = UserId FROM aspnet_users WHERE Username = @ReporterUserName INSERT Bug ( Summary, Description, ReporterUserId, ReportedDate, StatusId, PriorityId, TypeId, ComponentId, AssignedToUserId, ProjectId, ResolutionId, VersionId, LastUpdateUserId, LastUpdate, DueDate, FixedInVersionId, Visibility ) VALUES ( @Summary, @Description, @ReporterUserId, GetDate(), @StatusId, @PriorityId, @TypeId, @ComponentId, @AssignedToUserId, @ProjectId, @ResolutionId, @VersionId, @ReporterUserId, GetDate(), @DueDate, @FixedInVersionId, @Visibility ) RETURN scope_identity() GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_Delete -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_Delete' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_Delete] @BugId Int AS DELETE Bug WHERE BugId = @BugId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetBugById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetBugById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetBugById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetBugById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetBugById] @BugId Int AS SELECT * FROM BugsView WHERE BugId = @BugId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetBugComponentCountByProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetBugComponentCountByProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetBugComponentCountByProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetBugComponentCountByProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetBugComponentCountByProject] @ProjectId int, @ComponentId int AS SELECT Count(BugId) From Bug Where ProjectId = @ProjectId AND ComponentId = @ComponentId AND StatusId <> 4 AND StatusId <> 5 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetBugPriorityCountByProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetBugPriorityCountByProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetBugPriorityCountByProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetBugPriorityCountByProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetBugPriorityCountByProject] @ProjectId int AS SELECT p.Name, COUNT(nt.PriorityID) AS Number, p.PriorityID FROM Priority p LEFT OUTER JOIN (SELECT PriorityID, ProjectID FROM Bug b WHERE (b.StatusID <> 4) AND (b.StatusID <> 5)) nt ON p.PriorityID = nt.PriorityID AND nt.ProjectID = @ProjectId GROUP BY p.Name, p.PriorityID GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetBugsByCriteria -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetBugsByCriteria' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetBugsByCriteria]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetBugsByCriteria] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetBugsByCriteria] ( @ProjectId int = NULL, @ComponentId int = NULL, @VersionId int = NULL, @PriorityId int = NULL, @TypeId int = NULL, @ResolutionId int = NULL, @StatusId int = NULL, @AssignedToUserName nvarchar(256) = NULL, @Keywords nvarchar(256) = NULL, @IncludeComments bit = NULL, @ReporterUserName nvarchar(255) = NULL, @FixedInVersionId int = NULL ) AS DECLARE @AssignedToUserId UNIQUEIDENTIFIER SELECT @AssignedToUserId = UserId FROM aspnet_users WHERE Username = @AssignedToUserName DECLARE @ReporterUserId UNIQUEIDENTIFIER SELECT @ReporterUserId = UserId FROM aspnet_users WHERE Username = @ReporterUserName IF @StatusId = 0 SELECT * FROM BugsView WHERE ((@ProjectId IS NULL) OR (ProjectId = @ProjectId)) AND ((@ComponentId IS NULL) OR (ComponentId = @ComponentId)) AND ((@VersionId IS NULL) OR (VersionId = @VersionId)) AND ((@FixedInVersionId IS NULL) OR (FixedInVersionId = @FixedInVersionId)) AND ((@PriorityId IS NULL) OR (PriorityId = @PriorityId))AND ((@TypeId IS NULL) OR (TypeId = @TypeId)) AND ((@ResolutionId IS NULL) OR (ResolutionId = @ResolutionId)) AND ((@StatusId IS NULL) OR (StatusId In (1,2,3))) AND ((@ReporterUserId IS NULL) OR (ReporterUserId = @ReporterUserId)) AND ((@Keywords IS NULL) OR (Description LIKE '%' + @Keywords + '%' ) OR (Summary LIKE '%' + @Keywords + '%' ) ) AND ((@AssignedToUserName IS NULL) OR (@AssignedToUserName = '-1' AND AssignedToUserId IS NULL) OR (AssignedToUserId IS NOT NULL AND AssignedToUserId = @AssignedToUserId)) ORDER BY PriorityId ASC ELSE SELECT * FROM BugsView WHERE ((@ProjectId IS NULL) OR (ProjectId = @ProjectId)) AND ((@ComponentId IS NULL) OR (ComponentId = @ComponentId)) AND ((@VersionId IS NULL) OR (VersionId = @VersionId)) AND ((@FixedInVersionId IS NULL) OR (FixedInVersionId = @FixedInVersionId)) AND ((@PriorityId IS NULL) OR (PriorityId = @PriorityId))AND ((@TypeId IS NULL) OR (TypeId = @TypeId)) AND ((@ResolutionId IS NULL) OR (ResolutionId = @ResolutionId)) AND ((@StatusId IS NULL) OR (StatusId = @StatusId)) AND ((@AssignedToUserName IS NULL) OR (@AssignedToUserName = '-1' AND AssignedToUserId IS NULL) OR (AssignedToUserId IS NOT NULL AND AssignedToUserId = @AssignedToUserId)) AND ((@ReporterUserId IS NULL) OR (ReporterUserId = @ReporterUserId)) AND ((@Keywords IS NULL) OR (Description LIKE '%' + @Keywords + '%' ) OR (Summary LIKE '%' + @Keywords + '%' )) ORDER BY PriorityId ASC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetBugsByProjectId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetBugsByProjectId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetBugsByProjectId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetBugsByProjectId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetBugsByProjectId] @ProjectId int As Select * from BugsView WHERE ProjectId = @ProjectId Order By PriorityId,StatusId ASC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetBugStatusCountByProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetBugStatusCountByProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetBugStatusCountByProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetBugStatusCountByProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetBugStatusCountByProject] @ProjectId int AS SELECT s.Name,Count(b.StatusID) as 'Number',s.StatusID From Status s LEFT JOIN Bug b on s.StatusID = b.StatusID AND b.ProjectID = @ProjectId Group BY s.Name,s.StatusID Order By s.StatusID ASC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetBugTypeCountByProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetBugTypeCountByProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetBugTypeCountByProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetBugTypeCountByProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetBugTypeCountByProject] @ProjectId int AS SELECT t.Name, COUNT(nt.TypeID) AS Number, t.TypeID, t.ImageUrl FROM Type t LEFT OUTER JOIN (SELECT TypeID, ProjectID FROM Bug b WHERE (b.StatusID <> 4) AND (b.StatusID <> 5)) nt ON t.TypeID = nt.TypeID AND nt.ProjectID = @ProjectId GROUP BY t.Name, t.TypeID,t.ImageUrl GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetBugUnassignedCountByProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetBugUnassignedCountByProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetBugUnassignedCountByProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetBugUnassignedCountByProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetBugUnassignedCountByProject] @ProjectId int AS SELECT COUNT(BugID) AS Number FROM Bug WHERE (AssignedToUserId IS NULL) AND (ProjectID = @ProjectId) AND (StatusID <> 4) AND (StatusID <> 5) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetBugUserCountByProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetBugUserCountByProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetBugUserCountByProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetBugUserCountByProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetBugUserCountByProject] @ProjectId int AS SELECT u.UserID,u.Username, COUNT(b.BugID) AS Number FROM UserProjects pm LEFT OUTER JOIN aspnet_Users u ON pm.UserId = u.UserId LEFT OUTER JOIN Bug b ON b.AssignedToUserId = u.UserId WHERE (pm.ProjectID = @ProjectId) AND (b.ProjectID = @ProjectId ) AND (b.StatusID <> 4) AND (b.StatusID <> 5) GROUP BY u.Username, u.UserID GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetBugVersionCountByProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetBugVersionCountByProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetBugVersionCountByProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetBugVersionCountByProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetBugVersionCountByProject] @ProjectId int AS SELECT v.Name, COUNT(nt.VersionID) AS Number, v.VersionID FROM Version v LEFT OUTER JOIN (SELECT VersionID FROM Bug b WHERE (b.StatusID <> 4) AND (b.StatusID <> 5)) nt ON v.VersionID = nt.VersionID WHERE (v.ProjectID = @ProjectId) GROUP BY v.Name, v.VersionID,v.SortOrder ORDER BY v.SortOrder ASC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetChangeLog -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetChangeLog' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetChangeLog]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetChangeLog] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetChangeLog] @ProjectId int AS Select * from BugsView WHERE ProjectId = @ProjectId AND StatusID = 5 Order By FixedInVersionId DESC,ComponentName ASC, TypeName ASC, AssignedToUserName ASC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetMonitoredBugsByUser -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetMonitoredBugsByUser' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetMonitoredBugsByUser] @UserName nvarchar(255) AS DECLARE @UserId UNIQUEIDENTIFIER SELECT @UserId = UserId FROM aspnet_users WHERE Username = @UserName SELECT * FROM BugsView INNER JOIN BugNotification on BugsView.BugId = BugNotification.BugId AND BugNotification.CreatedUserId = @UserId WHERE StatusId In (1,2,3) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetRecentlyAddedBugsByProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetRecentlyAddedBugsByProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_GetRecentlyAddedBugsByProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_GetRecentlyAddedBugsByProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetRecentlyAddedBugsByProject] @ProjectId int AS SELECT TOP 5 * FROM BugsView WHERE ProjectId = @ProjectId ORDER BY BugID DESC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetRoadMap -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetRoadMap' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetRoadMap] @ProjectId int AS Select * from BugsView WHERE ProjectId = @ProjectId AND FixedInVersionId <> -1 Order By FixedInVersionId DESC,StatusID ASC,ComponentName ASC, TypeName ASC, AssignedToUserName ASC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_GetRoadMapProgress -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_GetRoadMapProgress' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_GetRoadMapProgress] @ProjectId int, @FixedInVersionId int AS /* SET NOCOUNT ON */ SELECT (SELECT Count(*) from BugsView WHERE ProjectId = @ProjectId AND FixedInVersionId = @FixedInVersionId AND StatusId In (4,5) AND FixedInVersionId <> -1) As ClosedCount , (SELECT Count(*) from BugsView WHERE ProjectId = @ProjectId AND FixedInVersionId = @FixedInVersionId AND FixedInVersionId <> -1) As TotalCount GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Bug_UpdateBug -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Bug_UpdateBug' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Bug_UpdateBug]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Bug_UpdateBug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Bug_UpdateBug] @BugId Int, @Summary nvarchar(500), @Description ntext, @ProjectId Int, @ComponentId Int, @StatusId Int, @PriorityId Int, @VersionId Int, @TypeId Int, @ResolutionId Int, @AssignedToUserName nvarchar(255), @LastUpdateUserName NVarChar(255), @DueDate datetime, @FixedInVersionId int, @Visibility int AS DECLARE @newIssueId Int -- Get Last Update UserID DECLARE @LastUpdateUserId UniqueIdentifier DECLARE @AssignedToUserId UniqueIdentifier SELECT @LastUpdateUserId = UserId FROM aspnet_users WHERE UserName = @LastUpdateUserName SELECT @AssignedToUserId = UserId FROM aspnet_users WHERE UserName = @AssignedToUserName Update Bug Set Summary = @Summary, Description = @Description, StatusID =@StatusId, PriorityID =@PriorityId, TypeId = @TypeId, ComponentID = @ComponentId, AssignedToUserId=@AssignedToUserId, ProjectId =@ProjectId, ResolutionId =@ResolutionId, VersionId =@VersionId, LastUpdateUserId = @LastUpdateUserId, LastUpdate = GetDate(), DueDate = @DueDate, FixedInVersionId = @FixedInVersionId, Visibility = @Visibility WHERE BugId = @BugId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_BugNotification_CreateNewBugNotification -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_BugNotification_CreateNewBugNotification' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_BugNotification_CreateNewBugNotification]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_BugNotification_CreateNewBugNotification] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_BugNotification_CreateNewBugNotification] @BugId Int, @NotificationUsername NVarChar(255) AS DECLARE @UserId UniqueIdentifier SELECT @UserId = UserId FROM aspnet_Users WHERE Username = @NotificationUsername IF NOT EXISTS( SELECT BugNotificationId FROM BugNotification WHERE CreatedUserId = @UserId AND BugId = @BugId) BEGIN INSERT BugNotification ( BugId, CreatedUserId ) VALUES ( @BugId, @UserId ) END GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_BugNotification_DeleteBugNotification -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_BugNotification_DeleteBugNotification' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_BugNotification_DeleteBugNotification]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_BugNotification_DeleteBugNotification] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_BugNotification_DeleteBugNotification] @BugId Int, @Username NVarChar(255) AS DECLARE @UserId uniqueidentifier SELECT @UserId = UserId FROM aspnet_Users WHERE Username = @Username DELETE BugNotification WHERE BugId = @BugId AND CreatedUserId = @UserId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_BugNotification_GetBugNotificationsByBugId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_BugNotification_GetBugNotificationsByBugId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_BugNotification_GetBugNotificationsByBugId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_BugNotification_GetBugNotificationsByBugId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_BugNotification_GetBugNotificationsByBugId] @BugId Int AS SELECT BugNotificationId, BugId, Username NotificationUsername, Membership.Email NotificationEmail FROM BugNotification INNER JOIN aspnet_Users Users ON BugNotification.CreatedUserId = Users.UserId INNER JOIN aspnet_membership Membership on BugNotification.CreatedUserId = Membership.UserId WHERE BugId = @BugId ORDER BY Username GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Comment_CreateNewComment -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Comment_CreateNewComment' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Comment_CreateNewComment]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Comment_CreateNewComment] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Comment_CreateNewComment] @BugId int, @CreatorUserName NVarChar(255), @Comment ntext AS -- Get Last Update UserID DECLARE @CreatorUserId uniqueidentifier SELECT @CreatorUserId = UserId FROM aspnet_users WHERE Username = @CreatorUserName INSERT BugComment ( BugId, CreatedUserId, CreatedDate, Comment ) VALUES ( @BugId, @CreatorUserId, GetDate(), @Comment ) /* Update the LastUpdate fields of this bug*/ UPDATE Bug SET LastUpdate = GetDate(),LastUpdateUserId = @CreatorUserId WHERE BugId = @BugId RETURN @@IDENTITY GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Comment_DeleteComment -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Comment_DeleteComment' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Comment_DeleteComment]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Comment_DeleteComment] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Comment_DeleteComment] @BugCommentId Int AS DELETE BugComment WHERE BugCommentId = @BugCommentId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Comment_GetCommentById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Comment_GetCommentById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Comment_GetCommentById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Comment_GetCommentById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Comment_GetCommentById] @BugCommentId INT AS SELECT BugCommentId, BugId, BugComment.CreatedUserId, CreatedDate, BugComment.Comment, Creators.UserName CreatorUserName, Membership.Email CreatorEmail FROM BugComment INNER JOIN aspnet_users Creators ON Creators.UserId = BugComment.CreatedUserId INNER JOIN aspnet_membership Membership on Creators.UserId = Membership.UserId WHERE BugCommentId = @BugCommentId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Comment_GetCommentsByBugId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Comment_GetCommentsByBugId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Comment_GetCommentsByBugId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Comment_GetCommentsByBugId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Comment_GetCommentsByBugId] @BugId INT AS SELECT BugCommentId, BugId, BugComment.CreatedUserId, CreatedDate, BugComment.Comment, Creators.UserName CreatorUserName, Membership.Email CreatorEmail FROM BugComment INNER JOIN aspnet_users Creators ON Creators.UserId = BugComment.CreatedUserId INNER JOIN aspnet_membership Membership on Creators.UserId = Membership.UserId WHERE BugId = @BugId ORDER BY CreatedDate DESC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Comment_UpdateComment -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Comment_UpdateComment' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Comment_UpdateComment]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Comment_UpdateComment] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Comment_UpdateComment] @BugCommentId int, @BugId int, @CreatorUserName nvarchar(255), @Comment ntext AS DECLARE @CreatorUserId uniqueidentifier SELECT @CreatorUserId = UserId FROM aspnet_users WHERE Username = @CreatorUserName UPDATE BugComment SET BugId = @BugId, CreatedUserId = @CreatorUserId, Comment = @Comment WHERE BugCommentId= @BugCommentId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Component_CreateNewComponent -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Component_CreateNewComponent' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Component_CreateNewComponent]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Component_CreateNewComponent] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Component_CreateNewComponent] @ProjectId int, @Name nvarchar(50), @ParentComponentId int AS INSERT Component ( ProjectID, Name, ParentComponentID ) VALUES ( @ProjectId, @Name, @ParentComponentId ) RETURN @@IDENTITY GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Component_DeleteComponent -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Component_DeleteComponent' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Component_DeleteComponent]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Component_DeleteComponent] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Component_DeleteComponent] @ComponentId Int AS DELETE Component WHERE ComponentId = @ComponentId IF @@ROWCOUNT > 0 RETURN 0 ELSE RETURN 1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Component_GetChildComponentsByComponentId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Component_GetChildComponentsByComponentId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Component_GetChildComponentsByComponentId] @ComponentId int AS SELECT ComponentId, ProjectId, Name, ParentComponentId, (SELECT COUNT(*) FROM Component WHERE ParentComponentId=c.ComponentId) ChildCount FROM Component c WHERE c.ParentComponentId = @ComponentId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Component_GetComponentById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Component_GetComponentById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Component_GetComponentById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Component_GetComponentById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Component_GetComponentById] @ComponentId int AS SELECT ComponentId, ProjectId, Name, ParentComponentId, (SELECT COUNT(*) FROM Component WHERE ParentComponentId=c.ComponentId) ChildCount FROM Component c WHERE ComponentId = @ComponentId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Component_GetComponentsByProjectId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Component_GetComponentsByProjectId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Component_GetComponentsByProjectId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Component_GetComponentsByProjectId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Component_GetComponentsByProjectId] @ProjectId int AS SELECT ComponentId, ProjectId, Name, ParentComponentId, (SELECT COUNT(*) FROM Component WHERE ParentComponentId=c.ComponentId) ChildCount FROM Component c WHERE ProjectId = @ProjectId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Component_GetRootComponentsByProjectId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Component_GetRootComponentsByProjectId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Component_GetRootComponentsByProjectId] @ProjectId int AS SELECT ComponentId, ProjectId, Name, ParentComponentId, (SELECT COUNT(*) FROM Component WHERE ParentComponentId=c.ComponentId) ChildCount FROM Component c WHERE ProjectId = @ProjectId AND c.ParentComponentId = 0 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_CustomField_CreateNewCustomField -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_CustomField_CreateNewCustomField' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_CustomField_CreateNewCustomField] @ProjectId Int, @CustomFieldName NVarChar(50), @CustomFieldDataType Int, @CustomFieldRequired Bit, @CustomFieldTypeId int AS IF NOT EXISTS(SELECT CustomFieldId FROM ProjectCustomFields WHERE ProjectID = @ProjectID AND LOWER(CustomFieldName) = LOWER(@CustomFieldName) ) BEGIN INSERT ProjectCustomFields ( ProjectId, CustomFieldName, CustomFieldDataType, CustomFieldRequired, CustomFieldTypeId ) VALUES ( @ProjectId, @CustomFieldName, @CustomFieldDataType, @CustomFieldRequired, @CustomFieldTypeId ) RETURN @@IDENTITY END RETURN 0 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_CustomField_DeleteCustomField -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_CustomField_DeleteCustomField' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_CustomField_DeleteCustomField] @CustomIdToDelete INT AS DELETE FROM ProjectCustomFields WHERE CustomFieldId = @CustomIdToDelete GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_CustomField_GetCustomFieldsByBugId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_CustomField_GetCustomFieldsByBugId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_CustomField_GetCustomFieldsByBugId] @BugId Int AS DECLARE @ProjectId Int SELECT @ProjectId = ProjectId FROM Bug WHERE BugId = @BugId SELECT Fields.ProjectId, Fields.CustomFieldId, Fields.CustomFieldName, Fields.CustomFieldDataType, Fields.CustomFieldRequired, ISNULL(CustomFieldValue,'') CustomFieldValue, Fields.CustomFieldTypeId FROM ProjectCustomFields Fields LEFT OUTER JOIN ProjectCustomFieldValues FieldValues ON (Fields.CustomFieldId = FieldValues.CustomFieldId AND FieldValues.BugId = @BugId) WHERE Fields.ProjectId = @ProjectId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_CustomField_GetCustomFieldsByProjectId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_CustomField_GetCustomFieldsByProjectId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_CustomField_GetCustomFieldsByProjectId] @ProjectId Int AS SELECT ProjectId, CustomFieldId, CustomFieldName, CustomFieldDataType, CustomFieldRequired, '' CustomFieldValue, CustomFieldTypeId FROM ProjectCustomFields WHERE ProjectId = @ProjectId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_CustomField_SaveCustomFieldValue -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_CustomField_SaveCustomFieldValue' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_CustomField_SaveCustomFieldValue] @BugId Int, @CustomFieldId Int, @CustomFieldValue NVarChar(255) AS UPDATE ProjectCustomFieldValues SET CustomFieldValue = @CustomFieldValue WHERE BugId = @BugId AND CustomFieldId = @CustomFieldId IF @@ROWCOUNT = 0 INSERT ProjectCustomFieldValues ( BugId, CustomFieldId, CustomFieldValue ) VALUES ( @BugId, @CustomFieldId, @CustomFieldValue ) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_CustomFieldSelection_CreateNewCustomFieldSelection -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_CustomFieldSelection_CreateNewCustomFieldSelection' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_CustomFieldSelection_CreateNewCustomFieldSelection] @CustomFieldId Int, @CustomFieldSelectionValue NVarChar(255), @CustomFieldSelectionName NVarChar(255) AS DECLARE @CustomFieldSelectionSortOrder int SELECT @CustomFieldSelectionSortOrder = ISNULL(MAX(CustomFieldSelectionSortOrder),0) + 1 FROM ProjectCustomFieldSelection IF NOT EXISTS(SELECT CustomFieldSelectionId FROM ProjectCustomFieldSelection WHERE CustomFieldId = @CustomFieldId AND LOWER(CustomFieldSelectionName) = LOWER(@CustomFieldSelectionName) ) BEGIN INSERT ProjectCustomFieldSelection ( CustomFieldId, CustomFieldSelectionValue, CustomFieldSelectionName, CustomFieldSelectionSortOrder ) VALUES ( @CustomFieldId, @CustomFieldSelectionValue, @CustomFieldSelectionName, @CustomFieldSelectionSortOrder ) RETURN @@IDENTITY END RETURN 0 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_CustomFieldSelection_DeleteCustomFieldSelection -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_CustomFieldSelection_DeleteCustomFieldSelection' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_CustomFieldSelection_DeleteCustomFieldSelection] @CustomSelectionIdToDelete INT AS DELETE FROM ProjectCustomFieldSelection WHERE CustomFieldSelectionId = @CustomSelectionIdToDelete GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_CustomFieldSelection_GetCustomFieldSelection -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_CustomFieldSelection_GetCustomFieldSelection' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_CustomFieldSelection_GetCustomFieldSelection] @CustomFieldSelectionId Int AS SELECT CustomFieldSelectionId, CustomFieldId, CustomFieldSelectionName, CustomFieldSelectionValue, CustomFieldSelectionSortOrder FROM ProjectCustomFieldSelection WHERE CustomFieldSelectionId = @CustomFieldSelectionId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_CustomFieldSelection_GetCustomFieldSelectionsByCustomFieldId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_CustomFieldSelection_GetCustomFieldSelectionsByCustomFieldId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_CustomFieldSelection_GetCustomFieldSelectionsByCustomFieldId] @CustomFieldId Int AS SELECT CustomFieldSelectionId, CustomFieldId, CustomFieldSelectionName, rtrim(CustomFieldSelectionValue) CustomFieldSelectionValue, CustomFieldSelectionSortOrder FROM ProjectCustomFieldSelection WHERE CustomFieldId = @CustomFieldId ORDER BY CustomFieldSelectionSortOrder GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_CustomFieldSelection_Update -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_CustomFieldSelection_Update' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_CustomFieldSelection_Update] @CustomFieldSelectionId int, @CustomFieldId int, @CustomFieldSelectionName nvarchar(255), @CustomFieldSelectionValue nvarchar(255), @CustomFieldSelectionSortOrder int AS UPDATE ProjectCustomFieldSelection SET CustomFieldId = @CustomFieldId, CustomFieldSelectionName = @CustomFieldSelectionName, CustomFieldSelectionValue = @CustomFieldSelectionValue, CustomFieldSelectionSortOrder = @CustomFieldSelectionSortOrder WHERE CustomFieldSelectionId= @CustomFieldSelectionId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_History_CreateNewHistory -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_History_CreateNewHistory' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_History_CreateNewHistory]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_History_CreateNewHistory] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_History_CreateNewHistory] @BugId int, @CreatedUserName nvarchar(255), @FieldChanged nvarchar(50), @OldValue nvarchar(50), @NewValue nvarchar(50) AS DECLARE @CreatedUserId UniqueIdentifier SELECT @CreatedUserId = UserId FROM aspnet_users WHERE UserName = @CreatedUserName INSERT BugHistory ( BugId, CreatedUserId, FieldChanged, OldValue, NewValue, CreatedDate ) VALUES ( @BugId, @CreatedUserId, @FieldChanged, @OldValue, @NewValue, GetDate() ) RETURN @@IDENTITY GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_History_GetHistoryByBugId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_History_GetHistoryByBugId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_History_GetHistoryByBugId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_History_GetHistoryByBugId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_History_GetHistoryByBugId] @BugId int AS SELECT BugHistoryID, BugId, CreateUser.UserName, FieldChanged, OldValue, NewValue, CreatedDate FROM BugHistory JOIN aspnet_users CreateUser ON BugHistory.CreatedUserId = CreateUser.UserId WHERE BugId = @BugId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_HostSettings_GetHostSettings -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_HostSettings_GetHostSettings' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_HostSettings_GetHostSettings]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_HostSettings_GetHostSettings] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_HostSettings_GetHostSettings] AS SELECT SettingName, SettingValue FROM HostSettings GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_HostSettings_UpdateHostSetting -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_HostSettings_UpdateHostSetting' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_HostSettings_UpdateHostSetting]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_HostSettings_UpdateHostSetting] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_HostSettings_UpdateHostSetting] @SettingName nvarchar(50), @SettingValue nvarchar(256) AS UPDATE HostSettings SET SettingName = @SettingName, SettingValue = @SettingValue WHERE SettingName = @SettingName GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Permission_AddRolePermission -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Permission_AddRolePermission' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Permission_AddRolePermission]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Permission_AddRolePermission] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Permission_AddRolePermission] @PermissionId int, @RoleName nvarchar(200) AS DECLARE @RoleId UNIQUEIDENTIFIER SELECT @RoleId = RoleId FROM aspnet_roles WHERE Rolename = @RoleName IF NOT EXISTS (SELECT PermissionId FROM RolePermission WHERE PermissionId = @PermissionId AND RoleId = @RoleId) BEGIN INSERT RolePermission ( PermissionId, RoleId ) VALUES ( @PermissionId, @RoleId ) END GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Permission_DeleteRolePermission -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Permission_DeleteRolePermission' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Permission_DeleteRolePermission]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Permission_DeleteRolePermission] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Permission_DeleteRolePermission] @PermissionId Int, @RoleName nvarchar(200) AS DECLARE @RoleId UNIQUEIDENTIFIER SELECT @RoleId = RoleId FROM aspnet_roles WHERE Rolename = @RoleName DELETE RolePermission WHERE PermissionId = @PermissionId AND RoleId = @RoleId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Permission_GetAllPermissions -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Permission_GetAllPermissions' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Permission_GetAllPermissions]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Permission_GetAllPermissions] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Permission_GetAllPermissions] AS SELECT PermissionId,PermissionKey, Name FROM Permission GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Permission_GetPermissionsByRole -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Permission_GetPermissionsByRole' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Permission_GetPermissionsByRole]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Permission_GetPermissionsByRole] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Permission_GetPermissionsByRole] @RoleName nvarchar(200) AS DECLARE @RoleId UNIQUEIDENTIFIER SELECT @RoleId = RoleId FROM aspnet_roles WHERE Rolename = @RoleName SELECT Permission.PermissionId,PermissionKey, Name FROM Permission Inner join RolePermission on RolePermission.PermissionId = Permission.PermissionId WHERE RoleId = @RoleId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Permission_GetRolePermission -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Permission_GetRolePermission' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Permission_GetRolePermission]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Permission_GetRolePermission] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Permission_GetRolePermission] AS Select R.RoleId, ProjectRoles.ProjectId,P.PermissionId,P.PermissionKey,R.RoleName FROM RolePermission RP JOIN Permission P ON RP.PermissionId = P.PermissionId JOIN aspnet_roles R ON RP.RoleId = R.RoleId JOIN ProjectRoles ON R.RoleId = ProjectRoles.RoleId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Priority_GetAllPriorities -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Priority_GetAllPriorities' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Priority_GetAllPriorities]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Priority_GetAllPriorities] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Priority_GetAllPriorities] AS SELECT PriorityId, Name, ImageUrl FROM Priority GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Priority_GetPriorityById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Priority_GetPriorityById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Priority_GetPriorityById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Priority_GetPriorityById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Priority_GetPriorityById] @PriorityId int AS SELECT PriorityId, Name, ImageUrl FROM Priority WHERE PriorityId = @PriorityId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_AddUserToProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_AddUserToProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_AddUserToProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_AddUserToProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_AddUserToProject] @UserName nvarchar(255), @ProjectId int AS DECLARE @UserId UNIQUEIDENTIFIER SELECT @UserId = UserId FROM aspnet_users WHERE Username = @UserName IF NOT EXISTS (SELECT UserId FROM UserProjects WHERE UserId = @UserId AND ProjectId = @ProjectId) BEGIN INSERT UserProjects ( UserId, ProjectId, CreatedDate ) VALUES ( @UserId, @ProjectId, getdate() ) END GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_CreateNewProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_CreateNewProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_CreateNewProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_CreateNewProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_CreateNewProject] @Name nvarchar(50), @Code nvarchar(3), @Description nvarchar(80), @ManagerUserName nvarchar(255), @UploadPath nvarchar(80), @Active int, @AccessType int, @CreatorUserName nvarchar(255) AS IF NOT EXISTS( SELECT ProjectId,Code FROM Project WHERE LOWER(Name) = LOWER(@Name) OR LOWER(Code) = LOWER(@Code) ) BEGIN DECLARE @ManagerUserId UNIQUEIDENTIFIER DECLARE @CreatorUserId UNIQUEIDENTIFIER SELECT @ManagerUserId = UserId FROM aspnet_users WHERE Username = @ManagerUserName SELECT @CreatorUserId = UserId FROM aspnet_users WHERE Username = @CreatorUserName INSERT Project ( Name, Code, Description, UploadPath, ManagerUserId, CreateDate, CreatorUserId, AccessType, Active ) VALUES ( @Name, @Code, @Description, @UploadPath, @ManagerUserId , GetDate(), @CreatorUserId, @AccessType, @Active ) RETURN @@IDENTITY END ELSE RETURN 0 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_CreateProjectMailbox -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_CreateProjectMailbox' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_CreateProjectMailbox]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_CreateProjectMailbox] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_CreateProjectMailbox] @MailBox nvarchar (100), @ProjectId int, @AssignToUserName nvarchar(255), @IssueTypeID int AS DECLARE @AssignToUserId UNIQUEIDENTIFIER SELECT @AssignToUserId = UserId FROM aspnet_users WHERE Username = @AssignToUserName INSERT ProjectMailBox ( MailBox, ProjectId, AssignToUserId, IssueTypeID ) VALUES ( @MailBox, @ProjectId, @AssignToUserId, @IssueTypeId ) RETURN @@IDENTITY GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_DeleteProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_DeleteProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_DeleteProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_DeleteProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_DeleteProject] @ProjectId int AS DELETE FROM Project where ProjectId = @ProjectId IF @@ROWCOUNT > 0 RETURN 0 ELSE RETURN 1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_DeleteProjectMailbox -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_DeleteProjectMailbox' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_DeleteProjectMailbox]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_DeleteProjectMailbox] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_DeleteProjectMailbox] @ProjectMailboxId int AS DELETE ProjectMailBox WHERE ProjectMailboxId = @ProjectMailboxId IF @@ROWCOUNT > 0 RETURN 0 ELSE RETURN 1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_GetAllProjects -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_GetAllProjects' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_GetAllProjects]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_GetAllProjects] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_GetAllProjects] AS SELECT ProjectId, Name, Code, Description, UploadPath, ManagerUserId, CreatorUserId, CreateDate, Project.Active, AccessType, Managers.UserName ManagerDisplayName, Creators.UserName CreatorDisplayName FROM Project INNER JOIN aspnet_users AS Managers ON Managers.UserId = Project.ManagerUserId INNER JOIN aspnet_users AS Creators ON Creators.UserId = Project.CreatorUserId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_GetMailboxByProjectId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_GetMailboxByProjectId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_GetMailboxByProjectId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_GetMailboxByProjectId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_GetMailboxByProjectId] @ProjectId int AS SELECT ProjectMailbox.*, u.Username AssignToName, Type.Name IssueTypeName FROM ProjectMailbox INNER JOIN aspnet_Users u ON u.UserId = AssignToUserID INNER JOIN Type ON Type.TypeId = IssueTypeId WHERE ProjectId = @ProjectId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_GetProjectByCode -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_GetProjectByCode' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_GetProjectByCode]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_GetProjectByCode] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_GetProjectByCode] @ProjectCode nvarchar(3) AS SELECT ProjectId, Name, Code, Description, UploadPath, ManagerUserId, CreatorUserId, CreateDate, Project.Active, AccessType, Managers.UserName ManagerDisplayName, Creators.UserName CreatorDisplayName FROM Project INNER JOIN aspnet_users AS Managers ON Managers.UserId = Project.ManagerUserId INNER JOIN aspnet_users AS Creators ON Creators.UserId = Project.CreatorUserId WHERE Code = @ProjectCode GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_GetProjectById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_GetProjectById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_GetProjectById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_GetProjectById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_GetProjectById] @ProjectId INT AS SELECT ProjectId, Name, Code, Description, UploadPath, ManagerUserId, CreatorUserId, CreateDate, Project.Active, AccessType, Managers.UserName ManagerDisplayName, Creators.UserName CreatorDisplayName FROM Project INNER JOIN aspnet_users AS Managers ON Managers.UserId = Project.ManagerUserId INNER JOIN aspnet_users AS Creators ON Creators.UserId = Project.CreatorUserId WHERE ProjectId = @ProjectId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_GetProjectByMailbox -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_GetProjectByMailbox' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_GetProjectByMailbox] ( @mailbox nvarchar(256) ) AS SET NOCOUNT ON SELECT Mailbox,ProjectMailbox.ProjectId,IssueTypeId,Users.UserName as AssignToName, AssignToUserId FROM Project INNER JOIN ProjectMailbox ON ProjectMailbox.ProjectId = Project.ProjectId INNER JOIN aspnet_users Users ON ProjectMailbox.AssignToUserId = Users.UserId WHERE ProjectMailbox.Mailbox = @mailbox GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_GetProjectMembers -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_GetProjectMembers' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_GetProjectMembers] @ProjectId Int AS SELECT Username FROM aspnet_users LEFT OUTER JOIN UserProjects ON aspnet_users.UserId = UserProjects.UserId WHERE UserProjects.ProjectId = @ProjectId ORDER BY Username ASC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_GetProjectsByUserName -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_GetProjectsByUserName' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO Create PROCEDURE [dbo].[BugNet_Project_GetProjectsByUserName] @UserName nvarchar(255), @ActiveOnly bit AS DECLARE @UserId UNIQUEIDENTIFIER SELECT @UserId = UserId FROM aspnet_users WHERE Username = @UserName SELECT DISTINCT Project.ProjectId, Name, Code, Description, UploadPath, ManagerUserId, CreatorUserId, CreateDate, Project.Active, AccessType, Managers.UserName ManagerDisplayName, Creators.UserName CreatorDisplayName FROM Project INNER JOIN aspnet_users AS Managers ON Managers.UserId = Project.ManagerUserId INNER JOIN aspnet_users AS Creators ON Creators.UserId = Project.CreatorUserId Left JOIN UserProjects ON UserProjects.ProjectId = Project.ProjectId WHERE (Project.AccessType = 1 AND Project.Active = @ActiveOnly) OR (Project.AccessType = 2 AND Project.Active = @ActiveOnly AND UserProjects.UserId = @UserId) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_GetPublicProjects -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_GetPublicProjects' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_GetPublicProjects]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_GetPublicProjects] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_GetPublicProjects] AS SELECT ProjectId, Name, Code, Description, UploadPath, ManagerUserId, CreatorUserId, CreateDate, Project.Active, AccessType, Managers.UserName ManagerDisplayName, Creators.UserName CreatorDisplayName FROM Project INNER JOIN aspnet_users AS Managers ON Managers.UserId = Project.ManagerUserId INNER JOIN aspnet_users AS Creators ON Creators.UserId = Project.CreatorUserId WHERE AccessType = 1 AND Project.Active = 1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_IsUserProjectMember -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_IsUserProjectMember' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_IsUserProjectMember] @UserName nvarchar(255), @ProjectId int AS DECLARE @UserId UNIQUEIDENTIFIER SELECT @UserId = UserId FROM aspnet_users WHERE Username = @UserName IF EXISTS( SELECT UserId FROM UserProjects WHERE UserId = @UserId AND ProjectId = @ProjectId) RETURN 0 ELSE RETURN -1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_RemoveUserFromProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_RemoveUserFromProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_RemoveUserFromProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_RemoveUserFromProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_RemoveUserFromProject] @UserName nvarchar(255), @ProjectId Int AS DECLARE @UserId UNIQUEIDENTIFIER SELECT @UserId = UserId FROM aspnet_users WHERE Username = @UserName DELETE UserProjects WHERE UserId = @UserId AND ProjectId = @ProjectId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_UpdateProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_UpdateProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_UpdateProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_UpdateProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Project_UpdateProject] @ProjectId int, @Name nvarchar(50), @Code nvarchar(3), @Description nvarchar(80), @ManagerUserName nvarchar(255), @UploadPath nvarchar(80), @AccessType int, @Active int AS DECLARE @ManagerUserId UNIQUEIDENTIFIER SELECT @ManagerUserId = UserId FROM aspnet_users WHERE Username = @ManagerUserName UPDATE Project SET Name = @Name, Code = @Code, Description = @Description, ManagerUserId = @ManagerUserId, UploadPath = @UploadPath, AccessType = @AccessType, Active = @Active WHERE ProjectId = @ProjectId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_RelatedBug_CreateNewRelatedBug -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_RelatedBug_CreateNewRelatedBug' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_RelatedBug_CreateNewRelatedBug]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_RelatedBug_CreateNewRelatedBug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_RelatedBug_CreateNewRelatedBug] @BugId Int, @LinkedBugId int AS IF NOT EXISTS( SELECT RelatedBugId FROM RelatedBug WHERE @BugId = @BugId AND LinkedBugId = @LinkedBugId) BEGIN INSERT RelatedBug ( BugId, LinkedBugId ) VALUES ( @BugId, @LinkedBugId ) INSERT RelatedBug ( BugId, LinkedBugId ) VALUES ( @LinkedBugId, @BugId ) END GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_RelatedBug_DeleteRelatedBug -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_RelatedBug_DeleteRelatedBug' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_RelatedBug_DeleteRelatedBug]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_RelatedBug_DeleteRelatedBug] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_RelatedBug_DeleteRelatedBug] @BugId Int, @LinkedBugId int AS DELETE RelatedBug WHERE BugId = @BugId AND LinkedBugId = @LinkedBugId DELETE RelatedBug WHERE BugId = @LinkedBugId AND LinkedBugId = @BugId IF @@ROWCOUNT > 0 RETURN 0 ELSE RETURN 1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_RelatedBug_GetRelatedBugsByBugId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_RelatedBug_GetRelatedBugsByBugId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_RelatedBug_GetRelatedBugsByBugId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_RelatedBug_GetRelatedBugsByBugId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_RelatedBug_GetRelatedBugsByBugId] @BugId int As Select * from BugsView join RelatedBug on BugsView.BugId = RelatedBug.LinkedBugId WHERE RelatedBug.BugId = @BugId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Resolution_GetAllResolutions -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Resolution_GetAllResolutions' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Resolution_GetAllResolutions]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Resolution_GetAllResolutions] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Resolution_GetAllResolutions] AS SELECT ResolutionId, Name FROM Resolution GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Resolution_GetResolutionById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Resolution_GetResolutionById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Resolution_GetResolutionById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Resolution_GetResolutionById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Resolution_GetResolutionById] @ResolutionId int AS SELECT ResolutionId, Name FROM Resolution WHERE ResolutionId = @ResolutionId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_AddRoleToProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_AddRoleToProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Role_AddRoleToProject] @RoleName nvarchar(255), @ProjectId int AS DECLARE @RoleId UNIQUEIDENTIFIER SELECT @RoleId = RoleId FROM aspnet_roles WHERE RoleName = @RoleName IF NOT EXISTS (SELECT RoleId FROM ProjectRoles WHERE RoleId = @RoleId AND ProjectId = @ProjectId) BEGIN INSERT ProjectRoles ( RoleId, ProjectId, CreatedDate ) VALUES ( @RoleId, @ProjectId, getdate() ) END GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_GetRolesByProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_GetRolesByProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_GetRolesByProject]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_GetRolesByProject] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Role_GetRolesByProject] @ProjectId int AS SELECT RoleName FROM aspnet_roles JOIN ProjectRoles ON aspnet_roles.RoleId = ProjectRoles.RoleId WHERE ProjectRoles.ProjectId = @ProjectId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_GetRolesByUser -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_GetRolesByUser' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_GetRolesByUser]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_GetRolesByUser] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE procedure [dbo].[BugNet_Role_GetRolesByUser] @UserName nvarchar(255), @ProjectId int as DECLARE @UserId UNIQUEIDENTIFIER SELECT @UserId = UserId FROM aspnet_users WHERE Username = @UserName SELECT PR.ProjectRoleId, PR.RoleId, PR.ProjectId, PR.CreatedDate, R.ApplicationId, R.RoleId AS Expr1, R.RoleName, R.LoweredRoleName, R.Description FROM ProjectRoles AS PR INNER JOIN aspnet_Roles AS R ON PR.RoleId = R.RoleId INNER JOIN aspnet_UsersInRoles AS UR ON PR.RoleId = UR.RoleId WHERE (PR.ProjectId = @ProjectId) AND (UR.UserId = @UserID) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_RemoveRoleFromProject -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_RemoveRoleFromProject' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREate PROCEDURE [dbo].[BugNet_Role_RemoveRoleFromProject] @RoleName nvarchar(255), @ProjectId Int AS DECLARE @RoleId UNIQUEIDENTIFIER SELECT @RoleId = RoleId FROM aspnet_roles WHERE RoleName = @RoleName DELETE ProjectRoles WHERE RoleId = @RoleId AND ProjectId = @ProjectId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Status_GetAllStatus -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Status_GetAllStatus' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Status_GetAllStatus]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Status_GetAllStatus] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Status_GetAllStatus] AS SELECT StatusId, Name FROM Status GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Status_GetStatusById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Status_GetStatusById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Status_GetStatusById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Status_GetStatusById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Status_GetStatusById] @StatusId int AS SELECT StatusId, Name FROM Status WHERE StatusId = @StatusId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_TimeEntry_CreateNewTimeEntry -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_TimeEntry_CreateNewTimeEntry' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_TimeEntry_CreateNewTimeEntry]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_TimeEntry_CreateNewTimeEntry] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_TimeEntry_CreateNewTimeEntry] @BugId int, @CreatorUserName nvarchar(255), @WorkDate datetime , @Duration decimal(4,2), @BugCommentId int AS -- Get Last Update UserID DECLARE @CreatorUserId uniqueidentifier SELECT @CreatorUserId = UserId FROM aspnet_users WHERE Username = @CreatorUserName INSERT BugTimeEntry ( BugId, CreatedUserId, WorkDate, Duration, BugCommentId ) VALUES ( @BugId, @CreatorUserId, @WorkDate, @Duration, @BugCommentID ) RETURN @@IDENTITY GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_TimeEntry_DeleteTimeEntry -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_TimeEntry_DeleteTimeEntry' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_TimeEntry_DeleteTimeEntry]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_TimeEntry_DeleteTimeEntry] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_TimeEntry_DeleteTimeEntry] @BugTimeEntryId int AS DELETE BugTimeEntry WHERE BugTimeEntryId = @BugTimeEntryId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_TimeEntry_GetProjectWorkerWorkReport -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_TimeEntry_GetProjectWorkerWorkReport' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_TimeEntry_GetProjectWorkerWorkReport]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_TimeEntry_GetProjectWorkerWorkReport] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_TimeEntry_GetProjectWorkerWorkReport] @ProjectId INT, @ReporterUsername NVARCHAR(255) AS DECLARE @UserId UNIQUEIDENTIFIER SELECT @UserId = UserId FROM aspnet_users WHERE Username = @ReporterUsername SELECT Project.ProjectId, Project.Name as ProjectName,Project.Code + '-' + str(Bug.BugId) as FullId, Bug.BugId, Bug.Summary, Creators.UserName AS Reporter, BugTimeEntry.Duration, BugTimeEntry.WorkDate, ISNULL(BugComment.Comment, '') AS Comment FROM BugTimeEntry INNER JOIN aspnet_users Creators ON Creators.UserId = BugTimeEntry.CreatedUserId INNER JOIN Bug ON BugTimeEntry.BugId = Bug.BugId INNER JOIN Project ON Bug.ProjectId = Project.ProjectId LEFT OUTER JOIN BugComment ON BugComment.BugCommentId = BugTimeEntry.BugCommentId WHERE Project.ProjectID = @ProjectId AND BugTimeEntry.CreatedUserId = @UserId ORDER BY Reporter, WorkDate GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_TimeEntry_GetWorkerOverallWorkReportByWorkerId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_TimeEntry_GetWorkerOverallWorkReportByWorkerId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_TimeEntry_GetWorkerOverallWorkReportByWorkerId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_TimeEntry_GetWorkerOverallWorkReportByWorkerId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_TimeEntry_GetWorkerOverallWorkReportByWorkerId] @ReporterUserName nvarchar(255) AS DECLARE @ReporterUserId uniqueidentifier SELECT @ReporterUserId = UserId FROM aspnet_users WHERE Username = @ReporterUserName SELECT Project.ProjectId, Project.Name, Bug.BugId, Bug.Summary, Creators.UserName AS CreatorDisplayName, BugTimeEntry.Duration, ISNULL(BugComment.Comment, '') AS Comment FROM BugTimeEntry INNER JOIN aspnet_users Creators ON Creators.UserID = BugTimeEntry.CreatedUserId INNER JOIN Bug ON BugTimeEntry.BugId = Bug.BugId INNER JOIN Project ON Bug.ProjectId = Project.ProjectId LEFT OUTER JOIN BugComment ON BugComment.BugCommentId = BugTimeEntry.BugCommentId WHERE BugTimeEntry.CreatedUserId = @ReporterUserId ORDER BY WorkDate GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_TimeEntry_GetWorkReportByBugId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_TimeEntry_GetWorkReportByBugId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_TimeEntry_GetWorkReportByBugId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_TimeEntry_GetWorkReportByBugId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_TimeEntry_GetWorkReportByBugId] @BugId INT AS SELECT BugTimeEntry.*, Creators.UserName AS CreatorUserName, Membership.Email AS CreatorEmail, ISNULL(BugComment.Comment, '') Comment FROM BugTimeEntry INNER JOIN aspnet_users Creators ON Creators.UserID = BugTimeEntry.CreatedUserId INNER JOIN aspnet_membership Membership ON Creators.UserId = Membership.UserId LEFT OUTER JOIN BugComment ON BugComment.BugCommentId = BugTimeEntry.BugCommentId WHERE BugTimeEntry.BugId = @BugId ORDER BY WorkDate DESC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_TimeEntry_GetWorkReportByProjectId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_TimeEntry_GetWorkReportByProjectId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_TimeEntry_GetWorkReportByProjectId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_TimeEntry_GetWorkReportByProjectId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_TimeEntry_GetWorkReportByProjectId] @ProjectId INT AS SELECT Project.ProjectID, Project.Name as ProjectName,Project.Code + '-' + str(Bug.BugID) as FullId,Bug.BugId, Bug.Summary, Creators.UserName AS Reporter, BugTimeEntry.Duration, BugTimeEntry.WorkDate, ISNULL(BugComment.Comment, '') AS Comment FROM BugTimeEntry INNER JOIN aspnet_users Creators ON Creators.UserId = BugTimeEntry.CreatedUserId INNER JOIN Bug ON BugTimeEntry.BugId = Bug.BugId INNER JOIN Project ON Bug.ProjectId = Project.ProjectId LEFT OUTER JOIN BugComment ON BugComment.BugCommentId = BugTimeEntry.BugCommentId WHERE Project.ProjectId = @ProjectId ORDER BY WorkDate GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Type_GetAllTypes -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Type_GetAllTypes' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Type_GetAllTypes]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Type_GetAllTypes] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Type_GetAllTypes] AS SELECT TypeId, Name, ImageUrl FROM Type GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Type_GetTypeById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Type_GetTypeById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Type_GetTypeById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Type_GetTypeById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Type_GetTypeById] @TypeId int AS SELECT TypeId, Name, ImageUrl FROM Type WHERE TypeId = @TypeId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Version_CreateNewVersion -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Version_CreateNewVersion' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Version_CreateNewVersion]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Version_CreateNewVersion] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Version_CreateNewVersion] @ProjectId int, @Name nvarchar(50), @SortOrder int AS INSERT Version ( ProjectID, Name, SortOrder ) VALUES ( @ProjectId, @Name, @SortOrder ) RETURN @@IDENTITY GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Version_DeleteVersion -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Version_DeleteVersion' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Version_DeleteVersion]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Version_DeleteVersion] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Version_DeleteVersion] @VersionId Int AS DELETE Version WHERE VersionId = @VersionId /*We need to delete all bugs with this version too */ DELETE Bug WHERE VersionId = @VersionId IF @@ROWCOUNT > 0 RETURN 0 ELSE RETURN 1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Version_GetVersionById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Version_GetVersionById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Version_GetVersionById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Version_GetVersionById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Version_GetVersionById] @VersionId INT AS SELECT VersionId, ProjectId, Name, SortOrder FROM Version WHERE VersionId = @VersionId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Version_GetVersionByProjectId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Version_GetVersionByProjectId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Version_GetVersionByProjectId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Version_GetVersionByProjectId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Version_GetVersionByProjectId] @ProjectId INT AS SELECT VersionId, ProjectId, Name, SortOrder FROM Version WHERE ProjectId = @ProjectId ORDER BY SortOrder ASC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Version_Update -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Version_Update' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO CREATE PROCEDURE [dbo].[BugNet_Version_Update] @VersionId int, @ProjectId int, @Name nvarchar(255), @SortOrder int AS UPDATE Version SET ProjectId = @ProjectId, [Name] = @Name, SortOrder = @SortOrder WHERE VersionId= @VersionId GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET QUOTED_IDENTIFIER OFF GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO SET ANSI_NULLS ON GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Drop Unused Tables and Stored Procs */ ALTER TABLE [dbo].[UserRoles] DROP CONSTRAINT [FK_UserRoles_Users] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE [dbo].[UserRoles] DROP CONSTRAINT [FK_UserRoles_Roles] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_User_UpdateUser -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_User_UpdateUser' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_User_UpdateUser]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_User_UpdateUser] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_User_IsProjectMember -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_User_IsProjectMember' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_User_IsProjectMember]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_User_IsProjectMember] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_User_GetUsersByProjectId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_User_GetUsersByProjectId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_User_GetUsersByProjectId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_User_GetUsersByProjectId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_User_GetUserByUsername -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_User_GetUserByUsername' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_User_GetUserByUsername]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_User_GetUserByUsername] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_User_GetUserById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_User_GetUserById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_User_GetUserById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_User_GetUserById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_User_GetAllUsers -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_User_GetAllUsers' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_User_GetAllUsers]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_User_GetAllUsers] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_User_CreateNewUser -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_User_CreateNewUser' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_User_CreateNewUser]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_User_CreateNewUser] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_User_Authenticate -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_User_Authenticate' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_User_Authenticate]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_User_Authenticate] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_UpdateRole -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_UpdateRole' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_UpdateRole]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_UpdateRole] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_RoleHasPermission -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_RoleHasPermission' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_RoleHasPermission]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_RoleHasPermission] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_RemoveUserFromRole -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_RemoveUserFromRole' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_RemoveUserFromRole]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_RemoveUserFromRole] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_IsUserInRole -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_IsUserInRole' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_IsUserInRole]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_IsUserInRole] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_GetRolesByUserId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_GetRolesByUserId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_GetRolesByUserId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_GetRolesByUserId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_GetRoleById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_GetRoleById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_GetRoleById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_GetRoleById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_GetAllRoles -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_GetAllRoles' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_GetAllRoles]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_GetAllRoles] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_DeleteRole -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_DeleteRole' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_DeleteRole]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_DeleteRole] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_CreateNewRole -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_CreateNewRole' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_CreateNewRole]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_CreateNewRole] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Role_AddUserToRole -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Role_AddUserToRole' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Role_AddUserToRole]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Role_AddUserToRole] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Project_GetProjectsByUserId -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Project_GetProjectsByUserId' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Project_GetProjectsByUserId]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Project_GetProjectsByUserId] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_OperatingSystem_GetOperatingSystemById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_OperatingSystem_GetOperatingSystemById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_OperatingSystem_GetOperatingSystemById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_OperatingSystem_GetOperatingSystemById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_OperatingSystem_GetAllOperatingSystems -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_OperatingSystem_GetAllOperatingSystems' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_OperatingSystem_GetAllOperatingSystems]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_OperatingSystem_GetAllOperatingSystems] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Hardware_GetHardwareById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Hardware_GetHardwareById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Hardware_GetHardwareById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Hardware_GetHardwareById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Hardware_GetAllHardware -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Hardware_GetAllHardware' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Hardware_GetAllHardware]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Hardware_GetAllHardware] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Environment_GetEnvironmentById -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Environment_GetEnvironmentById' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Environment_GetEnvironmentById]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Environment_GetEnvironmentById] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.BugNet_Environment_GetAllEnvironments -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.BugNet_Environment_GetAllEnvironments' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[BugNet_Environment_GetAllEnvironments]') and OBJECTPROPERTY(id, 'IsProcedure')=1) drop procedure [dbo].[BugNet_Environment_GetAllEnvironments] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Users -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Users' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Users]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Users] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.UserRoles -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.UserRoles' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[UserRoles]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[UserRoles] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Roles -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Roles' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Roles]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Roles] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.OperatingSystem -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.OperatingSystem' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[OperatingSystem]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[OperatingSystem] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Hardware -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Hardware' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Hardware]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Hardware] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO -- -- Script for dbo.Environment -- Foreign keys etc. will appear at the end -- PRINT 'Updating dbo.Environment' GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO if exists (select * from sysobjects where id=object_id('[dbo].[Environment]') and OBJECTPROPERTY(id, 'IsUserTable')=1) drop table [dbo].[Environment] GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO /* Data Migration Updates */ PRINT 'Updating Host Settings' UPDATE HostSettings SET SettingValue = '0.7.719.0' WHERE SettingName = 'Version' GO UPDATE HostSettings SET SettingValue = '60000' WHERE SettingName = 'Pop3Interval' GO INSERT INTO HostSettings (SettingName, SettingValue) VALUES ('ADPath','') GO INSERT INTO HostSettings (SettingName, SettingValue) VALUES ('EmailErrors','False') GO INSERT INTO HostSettings (SettingName, SettingValue) VALUES ('ErrorLoggingEmailAddress','youremail@domain.com') GO INSERT INTO HostSettings(SettingName,SettingValue) Values('SMTPUseSSL','false') GO INSERT INTO HostSettings(SettingName,SettingValue) Values('SMTPPort','25') GO INSERT INTO ProjectCustomFieldType(CustomFieldTypeName) Values ('Text') GO INSERT INTO ProjectCustomFieldType(CustomFieldTypeName) Values ('Drop Down List') GO INSERT INTO ProjectCustomFieldType(CustomFieldTypeName) Values ('Date') GO INSERT INTO ProjectCustomFieldType(CustomFieldTypeName) Values ('Rich Text') GO INSERT INTO ProjectCustomFieldType(CustomFieldTypeName) Values ('Yes / No') GO INSERT INTO ProjectCustomFieldType(CustomFieldTypeName) Values ('User List') PRINT 'Adding Default Roles' DECLARE @ApplicationName varchar(255) SET @ApplicationName = 'BugNET' EXEC dbo.aspnet_Roles_CreateRole @ApplicationName,@RoleName = 'Super Users' EXEC dbo.aspnet_Roles_CreateRole @ApplicationName,@RoleName = 'Project Administrators' EXEC dbo.aspnet_Roles_CreateRole @ApplicationName,@RoleName = 'Read Only' EXEC dbo.aspnet_Roles_CreateRole @ApplicationName,@RoleName = 'Reporter' EXEC dbo.aspnet_Roles_CreateRole @ApplicationName,@RoleName = 'Developer' EXEC dbo.aspnet_Roles_CreateRole @ApplicationName,@RoleName = 'Quality Assurance' GO PRINT 'Adding Permissions' DECLARE @RoleName varchar(255) SET @RoleName = 'Project Administrators' EXEC dbo.BugNet_Permission_AddRolePermission 1, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 2, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 3, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 4, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 5, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 6, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 7, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 8, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 9, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 10, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 11, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 12, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 13, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 14, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 15, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 16, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 17, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 18, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 19, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 20, @RoleName SET @RoleName = 'Read Only' EXEC dbo.BugNet_Permission_AddRolePermission 5, @RoleName SET @RoleName = 'Reporter' EXEC dbo.BugNet_Permission_AddRolePermission 2, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 7, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 10, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 12, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 15, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 3, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 5, @RoleName SET @RoleName = 'Developer' EXEC dbo.BugNet_Permission_AddRolePermission 2, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 7, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 10, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 12, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 15, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 3, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 4, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 5, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 19, @RoleName SET @RoleName = 'Quality Assurance' EXEC dbo.BugNet_Permission_AddRolePermission 2, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 7, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 10, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 12, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 15, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 3, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 4, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 5, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 19, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 17, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 14, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 1, @RoleName EXEC dbo.BugNet_Permission_AddRolePermission 6, @RoleName GO PRINT 'Updating Project Role Mappings' /* Create Project - Roles Mapping */ declare @pId int declare @RowNum int declare @ProjectCount int set @RowNum = 0 select @ProjectCount = count(ProjectId) from Project select top 1 @pId = ProjectId from Project WHILE @RowNum < @ProjectCount BEGIN set @RowNum = @RowNum + 1 exec BugNet_Role_AddRoleToProject @ProjectId = @pID, @RoleName = 'Project Administrators' exec BugNet_Role_AddRoleToProject @ProjectId = @pID, @RoleName = 'Read Only' exec BugNet_Role_AddRoleToProject @ProjectId = @pID, @RoleName = 'Reporter' exec BugNet_Role_AddRoleToProject @ProjectId = @pID, @RoleName = 'Developer' exec BugNet_Role_AddRoleToProject @ProjectId = @pID, @RoleName = 'Quality Assurance' select top 1 @pId=ProjectId from Project where ProjectId > @pID END /* Transaction Script */ IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO IF EXISTS (SELECT * FROM #tmpErrors) ROLLBACK TRANSACTION GO IF @@TRANCOUNT>0 BEGIN PRINT 'The database update succeeded' COMMIT TRANSACTION END ELSE PRINT 'The database update failed' GO DROP TABLE #tmpErrors GO
the_stack
LOAD 'pg_hint_plan'; -- We cannot do ALTER USER current_user SET ... DELETE FROM pg_db_role_setting WHERE setrole = (SELECT oid FROM pg_roles WHERE rolname = current_user); INSERT INTO pg_db_role_setting (SELECT 0, (SELECT oid FROM pg_roles WHERE rolname = current_user), '{client_min_messages=log,pg_hint_plan.debug_print=on}'); ALTER SYSTEM SET session_preload_libraries TO 'pg_hint_plan'; SELECT pg_reload_conf(); SET pg_hint_plan.enable_hint TO on; SET pg_hint_plan.debug_print TO on; SET client_min_messages TO LOG; SET search_path TO public; SET max_parallel_workers_per_gather TO 0; EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1; EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10; EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)'; ---- ---- No. S-1-1 specified pattern of the object name ---- -- No. S-1-1-1 /*+SeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; -- No. S-1-1-2 /*+SeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1 WHERE t_1.c1 = 1; -- No. S-1-1-3 /*+SeqScan(t_1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1 WHERE t_1.c1 = 1; ---- ---- No. S-1-2 specified schema name in the hint option ---- -- No. S-1-2-1 /*+SeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; -- No. S-1-2-2 /*+SeqScan(s1.t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; ---- ---- No. S-1-3 table doesn't exist in the hint option ---- -- No. S-1-3-1 /*+SeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; -- No. S-1-3-2 /*+SeqScan(t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; ---- ---- No. S-1-4 conflict table name ---- -- No. S-1-4-1 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = 1 AND t1.c1 = t2.c1; /*+SeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = 1 AND t1.c1 = t2.c1; -- No. S-1-4-2 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2.t1.c1; /*+BitmapScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2.t1.c1; /*+BitmapScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2t1.c1; /*+BitmapScan(s2t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2t1.c1; -- No. S-1-4-3 EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 WHERE s1.t1.c1 = 1) FROM s1.t1 WHERE s1.t1.c1 = 1; /*+BitmapScan(t1)*/ EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 WHERE s1.t1.c1 = 1) FROM s1.t1 WHERE s1.t1.c1 = 1; /*+BitmapScan(t11)*/ EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 t11 WHERE t11.c1 = 1) FROM s1.t1 t12 WHERE t12.c1 = 1; /*+BitmapScan(t12)*/ EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 t11 WHERE t11.c1 = 1) FROM s1.t1 t12 WHERE t12.c1 = 1; ---- ---- No. S-1-5 object type for the hint ---- -- No. S-1-5-1 /*+SeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; -- No. S-1-5-2 EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE p1.c1 = 1; /*+IndexScan(p1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE p1.c1 = 1; -- No. S-1-5-3 EXPLAIN (COSTS false) SELECT * FROM s1.ul1 WHERE ul1.c1 = 1; /*+SeqScan(ul1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ul1 WHERE ul1.c1 = 1; -- No. S-1-5-4 CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL); EXPLAIN (COSTS false) SELECT * FROM tm1 WHERE tm1.c1 = 1; /*+SeqScan(tm1)*/ EXPLAIN (COSTS false) SELECT * FROM tm1 WHERE tm1.c1 = 1; -- No. S-1-5-5 EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class WHERE oid = 1; /*+SeqScan(pg_class)*/ EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class WHERE oid = 1; -- No. S-1-5-6 -- refer ut-fdw.sql -- No. S-1-5-7 EXPLAIN (COSTS false) SELECT * FROM s1.f1() AS ft1 WHERE ft1.c1 = 1; /*+SeqScan(ft1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.f1() AS ft1 WHERE ft1.c1 = 1; -- No. S-1-5-8 EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1; /*+SeqScan(val1)*/ EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1; /*+SeqScan(*VALUES*)*/ EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1; -- No. S-1-5-9 EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(c1) FROM s1.t1 WHERE t1.c1 = 1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = 1 AND t1.c1 = c1.c1; /*+SeqScan(c1)*/ EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(c1) FROM s1.t1 WHERE t1.c1 = 1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = 1 AND t1.c1 = c1.c1; -- No. S-1-5-10 EXPLAIN (COSTS false) SELECT * FROM s1.v1 WHERE v1.c1 = 1; /*+SeqScan(v1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.v1 WHERE v1.c1 = 1; -- No. S-1-5-11 EXPLAIN (COSTS false) SELECT * FROM (SELECT * FROM s1.t1 WHERE t1.c1 = 1) AS s1 WHERE s1.c1 = 1; /*+SeqScan(s1)*/ EXPLAIN (COSTS false) SELECT * FROM (SELECT * FROM s1.t1 WHERE t1.c1 = 1) AS s1 WHERE s1.c1 = 1; ---- ---- No. S-2-1 some complexity query blocks ---- -- No. S-2-1-1 EXPLAIN (COSTS false) SELECT max(bmt1.c1), ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 ; /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4) TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1), ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 ; -- No. S-2-1-2 EXPLAIN (COSTS false) SELECT max(bmt1.c1), ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1 ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 ; /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4) TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey) BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1), ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1 ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 ; -- No. S-2-1-3 EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = sbmt4.c1; /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = sbmt4.c1; -- No. S-2-1-4 EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT * FROM s1.t3 bmt3) sbmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1; /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT * FROM s1.t3 bmt3) sbmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1; -- No. S-2-1-5 EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 <> ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ) ; /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4) TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 <> ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ) ; -- No. S-2-1-6 EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 <> ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ) AND bmt1.c1 <> ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1 ) ; /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4) TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey) BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey) */ EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 <> ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ) AND bmt1.c1 <> ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1 ) ; -- No. S-2-1-7 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 , c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1 ; /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4) TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 , c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1 ; -- No. S-2-1-8 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ) , c2 (c1) AS ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1 ) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 , c1, c2 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1 AND bmt1.c1 = c2.c1 ; /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4) TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey) BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1 ) , c2 (c1) AS ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1 ) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 , c1, c2 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1 AND bmt1.c1 = c2.c1 ; ---- ---- No. S-2-2 the number of the tables per quiry block ---- -- No. S-2-2-1 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1 ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1 ) FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1 ) ; /*+SeqScan(bmt1) TidScan(b1t1) BitmapScan(b2t1 t1_pkey) IndexScan(b3t1 t1_pkey) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1 ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1 ) FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1 ) ; -- No. S-2-2-2 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' ) ; /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey) TidScan(b1t1)SeqScan(b1t2) BitmapScan(b2t1 t1_pkey)TidScan(b2t2) IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' ) ; -- No. S-2-2-3 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)' ) ; /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4) TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey) BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey) IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey)TidScan(b3t3)SeqScan(b3t4) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)' ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)' ) ; -- No. S-2-2-4 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1 ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' ) ; /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4) TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey) BitmapScan(b2t1 t1_pkey) IndexScan(b3t1 t1_pkey) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)' ) SELECT max(bmt1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1 ) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1 AND bmt1.c1 <> ( SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' ) ; ---- ---- No. S-2-3 RULE or VIEW ---- -- No. S-2-3-1 EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey) SeqScan(r1)*/ EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey) SeqScan(r1_)*/ EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-2-3-2 EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey) SeqScan(r2)*/ EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey) BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey) SeqScan(r2_)*/ EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-2-3-3 EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey) SeqScan(r3)*/ EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; /*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey) BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey) IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey)TidScan(b3t3)SeqScan(b3t4) SeqScan(r3_)*/ EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-2-3-4 EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1; /*+BitmapScan(v1t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1; -- No. S-2-3-5 EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1; /*+SeqScan(v1t1)BitmapScan(v1t1_)*/ EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1; -- No. S-2-3-6 EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1; /*+BitmapScan(r4t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1; -- No. S-2-3-7 EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1; /*+SeqScan(r4t1)BitmapScan(r5t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1; ---- ---- No. S-2-4 VALUES clause ---- -- No. S-2-4-1 EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1; /*+SeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1; /*+SeqScan(*VALUES*)*/ EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1; -- No. S-2-4-2 EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1; /*+SeqScan(t1 t2)*/ EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1; /*+SeqScan(*VALUES*)*/ EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1; ---- ---- No. S-3-1 scan method hint ---- -- No. S-3-1-1 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1; /*+SeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1; -- No. S-3-1-2 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; /*+SeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; -- No. S-3-1-3 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; /*+IndexScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; -- No. S-3-1-4 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1; /*+IndexScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1; -- No. S-3-1-5 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10; /*+BitmapScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10; -- No. S-3-1-6 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; /*+BitmapScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; -- No. S-3-1-7 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)'; /*+TidScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)'; -- No. S-3-1-8 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid IN ('(1,1)', '(2,2)', '(3,3)'); /*+TidScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid IN ('(1,1)', '(2,2)', '(3,3)'); -- No. S-3-1-9 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1; /*+NoSeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1; -- No. S-3-1-10 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; /*+NoSeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; -- No. S-3-1-11 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; /*+NoIndexScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; -- No. S-3-1-12 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1; /*+NoIndexScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1; -- No. S-3-1-13 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10; /*+NoBitmapScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10; -- No. S-3-1-14 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; /*+NoBitmapScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; -- No. S-3-1-15 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)'; /*+NoTidScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)'; -- No. S-3-1-16 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; /*+NoTidScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; -- No. S-3-1-17 EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1; /*+IndexOnlyScan(t1)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1; -- No. S-3-1-18 EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1; /*+IndexOnlyScan(t1)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1; -- No. S-3-1-19 EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1; /*+NoIndexOnlyScan(t1)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1; -- No. S-3-1-20 EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1; /*+NoIndexOnlyScan(t1)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1; ---- ---- No. S-3-3 index name specified ---- EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)'; SET enable_tidscan TO off; EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)'; SET enable_indexscan TO off; EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)'; RESET enable_tidscan; RESET enable_indexscan; EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1; -- No. S-3-3-1 /*+IndexScan(ti1 ti1_i3)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)'; -- No. S-3-3-2 /*+IndexScan(ti1 ti1_i3 ti1_i2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)'; -- No. S-3-3-3 /*+IndexScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)'; -- No. S-3-3-4 /*+BitmapScan(ti1 ti1_i3)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)'; -- No. S-3-3-5 /*+BitmapScan(ti1 ti1_i3 ti1_i2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)'; -- No. S-3-3-6 /*+BitmapScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)'; -- No. S-3-3-7 /*+IndexOnlyScan(ti1 ti1_i3)*/ EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1; -- No. S-3-3-8 /*+IndexOnlyScan(ti1 ti1_i3 ti1_i2)*/ EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1; -- No. S-3-3-9 /*+IndexOnlyScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/ EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1; ---- ---- No. S-3-4 index type ---- \d s1.ti1 EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-1 /*+IndexScan(ti1 ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-2 /*+IndexScan(ti1 ti1_hash)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-3 /*+IndexScan(ti1 ti1_gist)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-4 /*+IndexScan(ti1 ti1_gin)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-5 /*+IndexScan(ti1 ti1_expr)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-6 /*+IndexScan(ti1 ti1_pred)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-7 /*+IndexScan(ti1 ti1_uniq)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-8 /*+IndexScan(ti1 ti1_multi)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-9 /*+IndexScan(ti1 ti1_ts)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-10 /*+IndexScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-11 /*+IndexScan(ti1 ti1_c2_key)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-12 /*+BitmapScan(ti1 ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-13 /*+BitmapScan(ti1 ti1_hash)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-14 /*+BitmapScan(ti1 ti1_gist)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-15 /*+BitmapScan(ti1 ti1_gin)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-16 /*+BitmapScan(ti1 ti1_expr)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-17 /*+BitmapScan(ti1 ti1_pred)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-18 /*+BitmapScan(ti1 ti1_uniq)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-19 /*+BitmapScan(ti1 ti1_multi)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-20 /*+BitmapScan(ti1 ti1_ts)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-21 /*+BitmapScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-22 /*+BitmapScan(ti1 ti1_c2_key)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)'; -- No. S-3-4-23 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1; /*+IndexOnlyScan(ti1 ti1_btree)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1; -- No. S-3-4-24 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1; /*+IndexOnlyScan(ti1 ti1_hash)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1; -- No. S-3-4-25 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 1; /*+IndexOnlyScan(ti1 ti1_gist)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 1; -- No. S-3-4-26 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1; /*+IndexOnlyScan(ti1 ti1_gin)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1; -- No. S-3-4-27 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 100; /*+IndexOnlyScan(ti1 ti1_expr)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 100; -- No. S-3-4-28 EXPLAIN (COSTS false) SELECT c4 FROM s1.ti1 WHERE lower(c4) >= '1'; /*+IndexOnlyScan(ti1 ti1_pred)*/ EXPLAIN (COSTS false) SELECT c4 FROM s1.ti1 WHERE lower(c4) >= '1'; -- No. S-3-4-29 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1; /*+IndexOnlyScan(ti1 ti1_uniq)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1; -- No. S-3-4-30 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1; /*+IndexOnlyScan(ti1 ti1_multi)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1; -- No. S-3-4-31 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE to_tsvector('english', c4) @@ 'a & b'; /*+IndexOnlyScan(ti1 ti1_ts)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE to_tsvector('english', c4) @@ 'a & b'; -- No. S-3-4-32 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1; /*+IndexOnlyScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1; -- No. S-3-4-33 EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE c2 >= 1; /*+IndexOnlyScan(ti1 ti1_c2_key)*/ EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE c2 >= 1; ---- ---- No. S-3-5 not used index ---- -- No. S-3-5-1 \o results/ut-S.tmpout /*+IndexScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100; \o \! sql/maskout.sh results/ut-S.tmpout -- No. S-3-5-2 \o results/ut-S.tmpout /*+BitmapScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100; \o \! sql/maskout.sh results/ut-S.tmpout -- No. S-3-5-3 \o results/ut-S.tmpout /*+IndexOnlyScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100; \o \! sql/maskout.sh results/ut-S.tmpout -- No. S-3-5-4 \o results/ut-S.tmpout /*+IndexScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100; \o \! sql/maskout.sh results/ut-S.tmpout -- No. S-3-5-5 \o results/ut-S.tmpout /*+BitmapScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100; \o \! sql/maskout.sh results/ut-S.tmpout -- No. S-3-5-6 \o results/ut-S.tmpout /*+IndexOnlyScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100; \o \! sql/maskout.sh results/ut-S.tmpout -- No. S-3-5-7 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1; \o results/ut-S.tmpout /*+TidScan(t1)*/ EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1; \o \! sql/maskout.sh results/ut-S.tmpout ---- ---- No. S-3-6 query structure ---- EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)'; -- No. S-3-6-1 /*+SeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE c1 = 100; -- No. S-3-6-2 /*+SeqScan(t1)BitmapScan(t2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)'; -- No. S-3-6-3 /*+SeqScan(t1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)'; ---- ---- No. S-3-7 number of tables in a query block ---- -- No. S-3-7-1 EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.c1 = 1) SELECT max(b3t1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1 ) FROM s1.t1 b3t1 WHERE b3t1.c1 = ( SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1); /*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1) */ EXPLAIN (COSTS false) WITH c1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.c1 = 1) SELECT max(b3t1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1 ) FROM s1.t1 b3t1 WHERE b3t1.c1 = ( SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1); -- No. S-3-7-2 EXPLAIN (COSTS false) WITH cte1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1) SELECT max(b3t1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 JOIN s1.t2 b2t2 ON(b2t1.c1 = b2t2.c1) WHERE b2t1.c1 = 1 ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = ( SELECT max(b4t1.c1) FROM s1.t1 b4t1 JOIN s1.t2 b4t2 ON(b4t1.c1 = b4t2.c1) WHERE b4t1.c1 = 1); /*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1) TidScan(b1t2)SeqScan(b2t2)IndexScan(b3t2 t2_pkey)BitmapScan(b4t2 t2_pkey) */ EXPLAIN (COSTS false) WITH cte1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1) SELECT max(b3t1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 JOIN s1.t2 b2t2 ON(b2t1.c1 = b2t2.c1) WHERE b2t1.c1 = 1 ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = ( SELECT max(b4t1.c1) FROM s1.t1 b4t1 JOIN s1.t2 b4t2 ON(b4t1.c1 = b4t2.c1) WHERE b4t1.c1 = 1); -- No. S-3-7-3 EXPLAIN (COSTS false) WITH cte1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1) SELECT max(b3t1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1 ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = ( SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1); /*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1) TidScan(b1t2)IndexScan(b3t2 t2_pkey) */ EXPLAIN (COSTS false) WITH cte1 (c1) AS ( SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1) SELECT max(b3t1.c1), ( SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1 ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = ( SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1); ---- ---- No. S-3-8 inheritance table select/update type ---- -- No. S-3-8-1 EXPLAIN (COSTS false) SELECT * FROM ONLY s1.p1 WHERE c1 = 1; /*+IndexScan(p1)*/ EXPLAIN (COSTS false) SELECT * FROM ONLY s1.p1 WHERE c1 = 1; -- No. S-3-8-2 EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1; /*+IndexScan(p1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1; -- No. S-3-8-3 EXPLAIN (COSTS false) UPDATE ONLY s1.p1 SET c4 = c4 WHERE c1 = 1; /*+IndexScan(p1)*/ EXPLAIN (COSTS false) UPDATE ONLY s1.p1 SET c4 = c4 WHERE c1 = 1; /*+IndexScan(p1 p1_pkey)*/ EXPLAIN (COSTS false) UPDATE ONLY s1.p1 SET c4 = c4 WHERE c1 = 1; -- No. S-3-8-4 EXPLAIN (COSTS false) UPDATE s1.p1 SET c4 = c4 WHERE c1 = 1; /*+IndexScan(p1)*/ EXPLAIN (COSTS false) UPDATE s1.p1 SET c4 = c4 WHERE c1 = 1; /*+IndexScan(p1 p1_pkey)*/ EXPLAIN (COSTS false) UPDATE s1.p1 SET c4 = c4 WHERE c1 = 1; ---- ---- No. S-3-9 inheritance table number ---- -- No. S-3-9-1 EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1; /*+IndexScan(p1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1; -- No. S-3-9-2 EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1; /*+IndexScan(p2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1; ---- ---- No. S-3-10 inheritance table specified table ---- EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1; -- No. S-3-10-1 /*+IndexScan(p2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1; -- No. S-3-10-2 /*+IndexScan(p2c1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1; -- No. S-3-10-3 \o results/ut-S.tmpout EXPLAIN SELECT c4 FROM s1.p1 WHERE c2 * 2 < 100 AND c1 < 10; \o \! sql/maskout.sh results/ut-S.tmpout \o results/ut-S.tmpout /*+IndexScan(p1 p1_parent)*/ EXPLAIN SELECT c4 FROM s1.p1 WHERE c2 * 2 < 100 AND c1 < 10; \o \! sql/maskout.sh results/ut-S.tmpout -- No. S-3-10-4 \o results/ut-S.tmpout /*+IndexScan(p1 p1_i2)*/ EXPLAIN SELECT c2 FROM s1.p1 WHERE c2 = 1; \o \! sql/maskout.sh results/ut-S.tmpout -- No. S-3-10-5 \o results/ut-S.tmpout /*+IndexScan(p2 p2c1_pkey)*/ EXPLAIN (COSTS true) SELECT * FROM s1.p2 WHERE c1 = 1; \o \! sql/maskout.sh results/ut-S.tmpout ---- ---- No. S-3-12 specified same table ---- -- No. S-3-12-1 /*+IndexScan(ti1) BitmapScan(ti1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-12-2 /*+IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-12-3 /*+BitmapScan(ti1) IndexScan(ti1) BitmapScan(ti1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-12-4 /*+BitmapScan(ti1 ti1_hash) IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; ---- ---- No. S-3-13 message output of hint ---- -- No. S-3-13-1 /*+SeqScan(ti1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-2 /*+SeqScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-3 /*+SeqScan(ti1 ti1_pkey ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-4 /*+IndexScan(ti1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-5 /*+IndexScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-6 /*+IndexScan(ti1 ti1_pkey ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-7 /*+BitmapScan(ti1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-8 /*+BitmapScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-9 /*+BitmapScan(ti1 ti1_pkey ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-10 /*+TidScan(ti1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-11 /*+TidScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-12 /*+TidScan(ti1 ti1_pkey ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-13 /*+NoSeqScan(ti1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-14 /*+NoSeqScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-15 /*+NoSeqScan(ti1 ti1_pkey ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-16 /*+NoIndexScan(ti1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-17 /*+NoIndexScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-18 /*+NoIndexScan(ti1 ti1_pkey ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-19 /*+NoBitmapScan(ti1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-20 /*+NoBitmapScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-21 /*+NoBitmapScan(ti1 ti1_pkey ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-22 /*+NoTidScan(ti1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-23 /*+NoTidScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-24 /*+NoTidScan(ti1 ti1_pkey ti1_btree)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)'; -- No. S-3-13-25 /*+IndexOnlyScan(ti1)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1; -- No. S-3-13-26 /*+IndexOnlyScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1; -- No. S-3-13-27 /*+IndexOnlyScan(ti1 ti1_pkey ti1_btree)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1; -- No. S-3-13-28 /*+NoIndexOnlyScan(ti1)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1; -- No. S-3-13-29 /*+NoIndexOnlyScan(ti1 ti1_pkey)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1; -- No. S-3-13-30 /*+NoIndexOnlyScan(ti1 ti1_pkey ti1_btree)*/ EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1; ---- ---- No. S-3-14 regular expression ---- EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1; -- No. S-3-14-1 /*+IndexScanRegexp(ti1 ti1_.*_key)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1; -- No. S-3-14-2 /*+IndexScanRegexp(ti1 ti1_i.)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1; -- No. S-3-14-3 /*+IndexScanRegexp(ti1 no.*_exist)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1; -- No. S-3-14-4 /*+IndexScanRegexp(p1 .*pkey)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1; -- No. S-3-14-5 /*+IndexScanRegexp(p1 p1.*i)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1; -- No. S-3-14-6 /*+IndexScanRegexp(p1 no.*_exist)*/ EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1; ---- ---- No. S-3-15 message output of index candidate ---- -- No. S-3-15-1 /*+IndexScan(ti1 ti1_i1)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1; -- No. S-3-15-2 /*+IndexScan(ti1 not_exist)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1; -- No. S-3-15-3 /*+IndexScan(ti1 ti1_i1 ti1_i2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1; -- No. S-3-15-4 /*+IndexScan(ti1 ti1_i1 not_exist)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1; -- No. S-3-15-5 /*+IndexScan(ti1 not_exist1 not_exist2)*/ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1; DELETE FROM pg_db_role_setting WHERE setrole = (SELECT oid FROM pg_roles WHERE rolname = current_user); ALTER SYSTEM SET session_preload_libraries TO DEFAULT; SELECT pg_reload_conf(); \! rm results/ut-S.tmpout
the_stack
-- -- This SQL file is meant to be used to initialize tables in a test database prior to unit tests. -- The commands in this file were generated by running ./make_create_tables_script.sh. -- Whenever the tables change, these commands should be updated by running that script again. -- -- -- PostgreSQL database dump -- -- Dumped from database version 11.5 -- Dumped by pg_dump version 11.5 SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; SET row_security = off; -- -- Name: dev; Type: SCHEMA; Schema: -; Owner: - -- CREATE SCHEMA dev; SET default_tablespace = ''; SET default_with_oids = false; -- -- Name: boundingbox; Type: TABLE; Schema: dev; Owner: - -- CREATE TABLE dev.boundingbox ( id integer NOT NULL, created_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL, updated_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL, entity_id integer NOT NULL, source text NOT NULL, page integer NOT NULL, "left" real NOT NULL, top real NOT NULL, width real NOT NULL, height real NOT NULL ); -- -- Name: boundingbox_id_seq; Type: SEQUENCE; Schema: dev; Owner: - -- CREATE SEQUENCE dev.boundingbox_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: boundingbox_id_seq; Type: SEQUENCE OWNED BY; Schema: dev; Owner: - -- ALTER SEQUENCE dev.boundingbox_id_seq OWNED BY dev.boundingbox.id; -- -- Name: entity; Type: TABLE; Schema: dev; Owner: - -- CREATE TABLE dev.entity ( id integer NOT NULL, created_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL, updated_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL, paper_id character varying(255) NOT NULL, version integer NOT NULL, type text NOT NULL, within_paper_id text, source text NOT NULL ); -- -- Name: entity_id_seq; Type: SEQUENCE; Schema: dev; Owner: - -- CREATE SEQUENCE dev.entity_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: entity_id_seq; Type: SEQUENCE OWNED BY; Schema: dev; Owner: - -- ALTER SEQUENCE dev.entity_id_seq OWNED BY dev.entity.id; -- -- Name: entitydata; Type: TABLE; Schema: dev; Owner: - -- CREATE TABLE dev.entitydata ( id integer NOT NULL, created_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL, updated_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL, entity_id integer NOT NULL, source text NOT NULL, key text NOT NULL, value text, item_type text NOT NULL, of_list boolean NOT NULL, relation_type text, CONSTRAINT entitydata_check CHECK ((((item_type = 'relation-id'::text) AND (relation_type IS NOT NULL)) OR ((item_type <> 'relation-id'::text) AND (relation_type IS NULL)))) ); -- -- Name: entitydata_id_seq; Type: SEQUENCE; Schema: dev; Owner: - -- CREATE SEQUENCE dev.entitydata_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: entitydata_id_seq; Type: SEQUENCE OWNED BY; Schema: dev; Owner: - -- ALTER SEQUENCE dev.entitydata_id_seq OWNED BY dev.entitydata.id; -- -- Name: paper; Type: TABLE; Schema: dev; Owner: - -- CREATE TABLE dev.paper ( s2_id character varying(255) NOT NULL, arxiv_id character varying(255) ); -- -- Name: summary; Type: TABLE; Schema: dev; Owner: - -- CREATE TABLE dev.summary ( id integer NOT NULL, paper_id character varying(255) NOT NULL, title text NOT NULL, authors text NOT NULL, doi text, venue text, year integer, abstract text ); -- -- Name: summary_id_seq; Type: SEQUENCE; Schema: dev; Owner: - -- CREATE SEQUENCE dev.summary_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: summary_id_seq; Type: SEQUENCE OWNED BY; Schema: dev; Owner: - -- ALTER SEQUENCE dev.summary_id_seq OWNED BY dev.summary.id; -- -- Name: version; Type: TABLE; Schema: dev; Owner: - -- CREATE TABLE dev.version ( id integer NOT NULL, created_at timestamp without time zone DEFAULT now() NOT NULL, paper_id character varying(255) NOT NULL, index integer NOT NULL, session_id text ); -- -- Name: version_id_seq; Type: SEQUENCE; Schema: dev; Owner: - -- CREATE SEQUENCE dev.version_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: version_id_seq; Type: SEQUENCE OWNED BY; Schema: dev; Owner: - -- ALTER SEQUENCE dev.version_id_seq OWNED BY dev.version.id; -- -- Name: boundingbox id; Type: DEFAULT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.boundingbox ALTER COLUMN id SET DEFAULT nextval('dev.boundingbox_id_seq'::regclass); -- -- Name: entity id; Type: DEFAULT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.entity ALTER COLUMN id SET DEFAULT nextval('dev.entity_id_seq'::regclass); -- -- Name: entitydata id; Type: DEFAULT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.entitydata ALTER COLUMN id SET DEFAULT nextval('dev.entitydata_id_seq'::regclass); -- -- Name: summary id; Type: DEFAULT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.summary ALTER COLUMN id SET DEFAULT nextval('dev.summary_id_seq'::regclass); -- -- Name: version id; Type: DEFAULT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.version ALTER COLUMN id SET DEFAULT nextval('dev.version_id_seq'::regclass); -- -- Name: boundingbox boundingbox_pkey; Type: CONSTRAINT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.boundingbox ADD CONSTRAINT boundingbox_pkey PRIMARY KEY (id); -- -- Name: entity entity_pkey; Type: CONSTRAINT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.entity ADD CONSTRAINT entity_pkey PRIMARY KEY (id); -- -- Name: entitydata entitydata_pkey; Type: CONSTRAINT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.entitydata ADD CONSTRAINT entitydata_pkey PRIMARY KEY (id); -- -- Name: paper paper_pkey; Type: CONSTRAINT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.paper ADD CONSTRAINT paper_pkey PRIMARY KEY (s2_id); -- -- Name: summary summary_pkey; Type: CONSTRAINT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.summary ADD CONSTRAINT summary_pkey PRIMARY KEY (id); -- -- Name: version version_pkey; Type: CONSTRAINT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.version ADD CONSTRAINT version_pkey PRIMARY KEY (id); -- -- Name: boundingbox_entity_id; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX boundingbox_entity_id ON dev.boundingbox USING btree (entity_id); -- -- Name: boundingbox_source; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX boundingbox_source ON dev.boundingbox USING btree (source); -- -- Name: entity_paper_id; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX entity_paper_id ON dev.entity USING btree (paper_id); -- -- Name: entity_paper_id_version_type_within_paper_id; Type: INDEX; Schema: dev; Owner: - -- CREATE UNIQUE INDEX entity_paper_id_version_type_within_paper_id ON dev.entity USING btree (paper_id, version, type, within_paper_id); -- -- Name: entity_source; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX entity_source ON dev.entity USING btree (source); -- -- Name: entity_type; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX entity_type ON dev.entity USING btree (type); -- -- Name: entity_version; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX entity_version ON dev.entity USING btree (version); -- -- Name: entity_within_paper_id; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX entity_within_paper_id ON dev.entity USING btree (within_paper_id); -- -- Name: entitydata_entity_id; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX entitydata_entity_id ON dev.entitydata USING btree (entity_id); -- -- Name: entitydata_item_type; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX entitydata_item_type ON dev.entitydata USING btree (item_type); -- -- Name: entitydata_key; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX entitydata_key ON dev.entitydata USING btree (key); -- -- Name: entitydata_of_list; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX entitydata_of_list ON dev.entitydata USING btree (of_list); -- -- Name: entitydata_relation_type; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX entitydata_relation_type ON dev.entitydata USING btree (relation_type); -- -- Name: entitydata_source; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX entitydata_source ON dev.entitydata USING btree (source); -- -- Name: paper_arxiv_id; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX paper_arxiv_id ON dev.paper USING btree (arxiv_id); -- -- Name: summary_paper_id; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX summary_paper_id ON dev.summary USING btree (paper_id); -- -- Name: summary_venue; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX summary_venue ON dev.summary USING btree (venue); -- -- Name: summary_year; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX summary_year ON dev.summary USING btree (year); -- -- Name: version_index; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX version_index ON dev.version USING btree (index); -- -- Name: version_paper_id; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX version_paper_id ON dev.version USING btree (paper_id); -- -- Name: version_paper_id_index; Type: INDEX; Schema: dev; Owner: - -- CREATE UNIQUE INDEX version_paper_id_index ON dev.version USING btree (paper_id, index); -- -- Name: version_paper_id_session_id; Type: INDEX; Schema: dev; Owner: - -- CREATE UNIQUE INDEX version_paper_id_session_id ON dev.version USING btree (paper_id, session_id); -- -- Name: version_session_id; Type: INDEX; Schema: dev; Owner: - -- CREATE INDEX version_session_id ON dev.version USING btree (session_id); -- -- Name: boundingbox boundingbox_entity_id_fkey; Type: FK CONSTRAINT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.boundingbox ADD CONSTRAINT boundingbox_entity_id_fkey FOREIGN KEY (entity_id) REFERENCES dev.entity(id) ON DELETE CASCADE; -- -- Name: entity entity_paper_id_fkey; Type: FK CONSTRAINT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.entity ADD CONSTRAINT entity_paper_id_fkey FOREIGN KEY (paper_id) REFERENCES dev.paper(s2_id) ON DELETE CASCADE; -- -- Name: entitydata entitydata_entity_id_fkey; Type: FK CONSTRAINT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.entitydata ADD CONSTRAINT entitydata_entity_id_fkey FOREIGN KEY (entity_id) REFERENCES dev.entity(id) ON DELETE CASCADE; -- -- Name: summary summary_paper_id_fkey; Type: FK CONSTRAINT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.summary ADD CONSTRAINT summary_paper_id_fkey FOREIGN KEY (paper_id) REFERENCES dev.paper(s2_id) ON DELETE CASCADE; -- -- Name: version version_paper_id_fkey; Type: FK CONSTRAINT; Schema: dev; Owner: - -- ALTER TABLE ONLY dev.version ADD CONSTRAINT version_paper_id_fkey FOREIGN KEY (paper_id) REFERENCES dev.paper(s2_id); -- -- PostgreSQL database dump complete -- ALTER SCHEMA dev RENAME TO test;
the_stack
1. create package imitation CREATE SCHEMA IF NOT EXISTS qa_tests AUTHORIZATION devv5; ALTER DEFAULT PRIVILEGES IN SCHEMA qa_tests GRANT SELECT ON TABLES TO PUBLIC; ALTER DEFAULT PRIVILEGES IN SCHEMA qa_tests GRANT EXECUTE ON FUNCTIONS TO PUBLIC; GRANT USAGE ON SCHEMA qa_tests TO PUBLIC; 2. in DEVV5: CREATE TABLE DEVV5.DEV_SUMMARY ( table_name VARCHAR (100), vocabulary_id_1 VARCHAR (100), vocabulary_id_2 VARCHAR (100), concept_class_id VARCHAR (100), relationship_id VARCHAR (100), invalid_reason VARCHAR (10), cnt int4, cnt_delta int4 ); 3. procedures: CREATE OR REPLACE FUNCTION qa_tests.create_dev_table () RETURNS void SET client_min_messages = error AS $BODY$ BEGIN /* CREATE TABLE DEVV5.DEV_SUMMARY ( table_name VARCHAR (100), vocabulary_id_1 VARCHAR (100), vocabulary_id_2 VARCHAR (100), domain_id VARCHAR (100), concept_class_id VARCHAR (100), relationship_id VARCHAR (100), invalid_reason VARCHAR (10), cnt int4, cnt_delta int4 ); */ IF NOT PG_TRY_ADVISORY_XACT_LOCK(HASHTEXT(CURRENT_SCHEMA)) THEN RAISE EXCEPTION 'This function is already in use in another session'; END IF; CREATE TABLE IF NOT EXISTS DEV_SUMMARY (LIKE DEVV5.DEV_SUMMARY); END ; $BODY$ LANGUAGE 'plpgsql' SECURITY INVOKER; CREATE OR REPLACE FUNCTION qa_tests.purge_cache () RETURNS void AS $BODY$ BEGIN PERFORM qa_tests.create_dev_table(); TRUNCATE TABLE DEV_SUMMARY; END ; $BODY$ LANGUAGE 'plpgsql' SECURITY INVOKER; CREATE OR REPLACE FUNCTION qa_tests.get_summary ( table_name varchar, pCompareWith VARCHAR DEFAULT 'PRODV5' ) RETURNS TABLE ( vocabulary_id_1 varchar, vocabulary_id_2 varchar, domain_id varchar, concept_class_id varchar, relationship_id varchar, invalid_reason varchar, concept_delta integer ) AS $BODY$ DECLARE z int2; iTable_name CONSTANT VARCHAR (100) := SUBSTR (LOWER (table_name), 0, 100); BEGIN IF iTable_name NOT IN ('concept', 'concept_relationship', 'concept_ancestor') THEN RAISE EXCEPTION 'WRONG_TABLE_NAME'; END IF; PERFORM qa_tests.create_dev_table(); SELECT COUNT (*) INTO z FROM DEV_SUMMARY; --fill the table if it empty (caching) IF z = 0 THEN --summary for 'concept' EXECUTE ' INSERT INTO DEV_SUMMARY SELECT ''concept'' AS table_name, c.vocabulary_id, NULL, c.domain_id, c.concept_class_id, NULL AS relationship_id, c.invalid_reason, COUNT (*) AS cnt, NULL AS cnt_delta FROM '||pCompareWith||'.concept c GROUP BY c.vocabulary_id, c.domain_id, c.concept_class_id, c.invalid_reason'; WITH to_be_upserted as ( SELECT 'concept'::varchar AS table_name, c.vocabulary_id AS vocabulary_id_1, NULL, c.domain_id, c.concept_class_id, NULL AS relationship_id, c.invalid_reason, COUNT (*) AS cnt, NULL::int4 AS cnt_delta FROM concept c GROUP BY c.vocabulary_id, c.domain_id, c.concept_class_id, c.invalid_reason ), to_be_updated as ( UPDATE DEV_SUMMARY dv SET cnt_delta = up.cnt - dv.cnt FROM to_be_upserted up WHERE dv.cnt_delta IS NULL AND dv.table_name = up.table_name AND dv.vocabulary_id_1 = up.vocabulary_id_1 AND dv.concept_class_id = up.concept_class_id AND dv.domain_id = up.domain_id AND COALESCE (dv.invalid_reason, 'X') = COALESCE (up.invalid_reason, 'X') RETURNING dv.* ) INSERT INTO DEV_SUMMARY SELECT tpu.table_name, tpu.vocabulary_id_1, NULL, tpu.domain_id, tpu.concept_class_id, NULL, tpu.invalid_reason, NULL::int4, tpu.cnt FROM to_be_upserted tpu WHERE (tpu.table_name, tpu.vocabulary_id_1, tpu.domain_id, tpu.concept_class_id, COALESCE (tpu.invalid_reason, 'X')) NOT IN (SELECT up.table_name, up.vocabulary_id_1, up.domain_id, up.concept_class_id, COALESCE (up.invalid_reason, 'X') from to_be_updated up); --summary for concept_relationship EXECUTE ' INSERT INTO DEV_SUMMARY SELECT ''concept_relationship'' AS table_name, c1.vocabulary_id, c2.vocabulary_id, NULL as domain_id, NULL AS concept_class_id, r.relationship_id, r.invalid_reason, COUNT (*) AS cnt, NULL AS cnt_delta FROM '||pCompareWith||'.concept c1, '||pCompareWith||'.concept c2, '||pCompareWith||'.concept_relationship r WHERE c1.concept_id = r.concept_id_1 AND c2.concept_id = r.concept_id_2 GROUP BY c1.vocabulary_id, c2.vocabulary_id, r.relationship_id, r.invalid_reason'; WITH to_be_upserted as ( SELECT 'concept_relationship'::varchar AS table_name, c1.vocabulary_id AS vocabulary_id_1, c2.vocabulary_id AS vocabulary_id_2, NULL::varchar as domain_id, NULL::varchar AS concept_class_id, r.relationship_id, r.invalid_reason, COUNT (*) AS cnt, NULL::int4 AS cnt_delta FROM concept c1, concept c2, concept_relationship r WHERE c1.concept_id = r.concept_id_1 AND c2.concept_id = r.concept_id_2 GROUP BY c1.vocabulary_id, c2.vocabulary_id, r.relationship_id, r.invalid_reason ), to_be_updated as ( UPDATE DEV_SUMMARY dv SET cnt_delta = up.cnt - dv.cnt FROM to_be_upserted up WHERE dv.cnt_delta IS NULL AND dv.table_name = up.table_name AND dv.vocabulary_id_1 = up.vocabulary_id_1 AND dv.vocabulary_id_2 = up.vocabulary_id_2 AND dv.relationship_id = up.relationship_id AND COALESCE (dv.invalid_reason, 'X') = COALESCE (up.invalid_reason, 'X') RETURNING dv.* ) INSERT INTO DEV_SUMMARY SELECT tpu.table_name, tpu.vocabulary_id_1, tpu.vocabulary_id_2, NULL, NULL, tpu.relationship_id, tpu.invalid_reason, NULL::int4, tpu.cnt FROM to_be_upserted tpu WHERE (tpu.table_name, tpu.vocabulary_id_1, tpu.vocabulary_id_2, tpu.relationship_id, COALESCE (tpu.invalid_reason, 'X')) NOT IN (SELECT up.table_name, up.vocabulary_id_1, up.vocabulary_id_2, up.relationship_id, COALESCE (up.invalid_reason, 'X') from to_be_updated up); --summary for concept_ancestor EXECUTE ' INSERT INTO DEV_SUMMARY SELECT ''concept_ancestor'' AS table_name, c.vocabulary_id, NULL, NULL AS concept_class_id, NULL as domain_id, NULL AS relationship_id, NULL AS invalid_reason, COUNT (*) AS cnt, NULL AS cnt_delta FROM '||pCompareWith||'.concept c, '||pCompareWith||'.concept_ancestor ca WHERE c.concept_id = ca.ancestor_concept_id GROUP BY c.vocabulary_id'; WITH to_be_upserted as ( SELECT 'concept_ancestor'::varchar AS table_name, c.vocabulary_id AS vocabulary_id_1, NULL::varchar, NULL::varchar, NULL::varchar AS concept_class_id, NULL::varchar AS relationship_id, NULL::varchar AS invalid_reason, COUNT (*) AS cnt, NULL::int4 AS cnt_delta FROM concept c, concept_ancestor ca WHERE c.concept_id = ca.ancestor_concept_id GROUP BY c.vocabulary_id ), to_be_updated as ( UPDATE DEV_SUMMARY dv SET cnt_delta = up.cnt - dv.cnt FROM to_be_upserted up WHERE dv.cnt_delta IS NULL AND dv.table_name = up.table_name AND dv.vocabulary_id_1 = up.vocabulary_id_1 RETURNING dv.* ) INSERT INTO DEV_SUMMARY SELECT tpu.table_name, tpu.vocabulary_id_1, NULL, NULL, NULL, NULL, NULL, NULL::int4, tpu.cnt FROM to_be_upserted tpu WHERE (tpu.table_name, tpu.vocabulary_id_1) NOT IN (SELECT up.table_name, up.vocabulary_id_1 from to_be_updated up); END IF; IF iTable_name = 'concept' THEN RETURN QUERY SELECT ds.vocabulary_id_1, NULL::varchar, ds.domain_id, ds.concept_class_id, NULL::varchar, ds.invalid_reason, COALESCE (ds.cnt_delta, -cnt) AS cnt_delta FROM DEV_SUMMARY ds WHERE COALESCE (ds.cnt_delta, -cnt) <> 0 AND ds.table_name = iTable_name; ELSIF iTable_name = 'concept_relationship' THEN RETURN QUERY SELECT ds.vocabulary_id_1, ds.vocabulary_id_2, NULL::varchar, NULL::varchar, ds.relationship_id, ds.invalid_reason, COALESCE (ds.cnt_delta, -cnt) AS cnt_delta FROM DEV_SUMMARY ds WHERE COALESCE (ds.cnt_delta, -cnt) <> 0 AND ds.table_name = iTable_name; ELSIF iTable_name = 'concept_ancestor' THEN RETURN QUERY SELECT ds.vocabulary_id_1, NULL::varchar, NULL::varchar, NULL::varchar, NULL::varchar, NULL::varchar, COALESCE (ds.cnt_delta, -cnt) AS cnt_delta FROM DEV_SUMMARY ds WHERE COALESCE (ds.cnt_delta, -cnt) <> 0 AND ds.table_name = iTable_name; END IF; END; $BODY$ LANGUAGE 'plpgsql' SECURITY INVOKER; CREATE type qa_tests.type_get_checks AS ( check_id int4, check_name VARCHAR(1000), concept_id_1 int4, concept_id_2 int4, relationship_id VARCHAR(20), valid_start_date DATE, valid_end_date DATE, invalid_reason VARCHAR(1) ); CREATE OR REPLACE FUNCTION qa_tests.get_checks (checkid IN INT DEFAULT NULL) RETURNS SETOF qa_tests.type_get_checks SET max_parallel_workers_per_gather=4 SET work_mem='4GB' AS $BODY$ --relationships cycle SELECT 1 check_id, 'relationships cycle' AS check_name, r.* FROM concept_relationship r, concept_relationship r_int WHERE r.invalid_reason IS NULL AND r_int.concept_id_1 = r.concept_id_2 AND r_int.concept_id_2 = r.concept_id_1 AND r.concept_id_1 <> r.concept_id_2 AND r_int.relationship_id = r.relationship_id AND r_int.invalid_reason IS NULL AND COALESCE(checkid, 1) = 1 UNION ALL --opposing relationships between same pair of concepts SELECT 2 check_id, 'opposing relationships between same pair of concepts' AS check_name, r.* FROM concept_relationship r, concept_relationship r_int, relationship rel WHERE r.invalid_reason IS NULL AND r.relationship_id = rel.relationship_id AND r_int.concept_id_1 = r.concept_id_1 AND r_int.concept_id_2 = r.concept_id_2 AND r.concept_id_1 <> r.concept_id_2 AND r_int.relationship_id = rel.reverse_relationship_id AND r_int.invalid_reason IS NULL AND COALESCE(checkid, 2) = 2 UNION ALL --relationships without reverse SELECT 3 check_id, 'relationships without reverse' AS check_name, r.* FROM concept_relationship r, relationship rel WHERE r.relationship_id = rel.relationship_id AND NOT EXISTS ( SELECT 1 FROM concept_relationship r_int WHERE r_int.relationship_id = rel.reverse_relationship_id AND r_int.concept_id_1 = r.concept_id_2 AND r_int.concept_id_2 = r.concept_id_1 ) AND COALESCE(checkid, 3) = 3 UNION ALL /*--replacement relationships between different vocabularies (exclude RxNorm to RxNorm Ext OR RxNorm Ext to RxNorm OR SNOMED<->SNOMED Veterinary replacement relationships) --deprecated 20190227 SELECT 4 check_id, r.* FROM concept_relationship r, concept c1, concept c2 WHERE r.invalid_reason IS NULL AND r.concept_id_1 <> r.concept_id_2 AND c1.concept_id = r.concept_id_1 AND c2.concept_id = r.concept_id_2 AND c1.vocabulary_id <> c2.vocabulary_id AND NOT ( c1.vocabulary_id IN ( 'RxNorm', 'RxNorm Extension' ) AND c2.vocabulary_id IN ( 'RxNorm', 'RxNorm Extension' ) ) AND NOT ( c1.vocabulary_id IN ( 'SNOMED', 'SNOMED Veterinary' ) AND c2.vocabulary_id IN ( 'SNOMED', 'SNOMED Veterinary' ) ) AND r.relationship_id IN ( 'Concept replaced by', 'Concept same_as to', 'Concept alt_to to', 'Concept poss_eq to', 'Concept was_a to' ) AND COALESCE(checkid, 4) = 4 UNION ALL*/ --wrong relationships: 'Maps to' to 'D' or 'U'; replacement relationships to 'D' SELECT 5 check_id, $$wrong relationships: 'Maps to' TO 'D' OR 'U'; replacement relationships TO 'D'$$ AS check_name, r.* FROM concept c2, concept_relationship r WHERE c2.concept_id = r.concept_id_2 AND ( ( c2.invalid_reason IN ( 'D', 'U' ) AND r.relationship_id = 'Maps to' ) OR ( c2.invalid_reason = 'D' AND r.relationship_id IN ( 'Concept replaced by', 'Concept same_as to', 'Concept alt_to to', 'Concept poss_eq to', 'Concept was_a to' ) ) ) AND r.invalid_reason IS NULL AND COALESCE(checkid, 5) = 5 UNION ALL --direct and reverse mappings are not same SELECT 6 check_id, 'direct and reverse mappings are not same' AS check_name, r.* FROM concept_relationship r, relationship rel, concept_relationship r_int WHERE r.relationship_id = rel.relationship_id AND r_int.relationship_id = rel.reverse_relationship_id AND r_int.concept_id_1 = r.concept_id_2 AND r_int.concept_id_2 = r.concept_id_1 AND ( r.valid_end_date <> r_int.valid_end_date OR COALESCE(r.invalid_reason, 'X') <> COALESCE(r_int.invalid_reason, 'X') ) AND COALESCE(checkid, 6) = 6 UNION ALL --wrong valid_start_date, valid_end_date or invalid_reason for the concept SELECT 7 check_id, 'wrong valid_start_date, valid_end_date or invalid_reason for the concept' AS check_name, c.concept_id, NULL, c.vocabulary_id, c.valid_start_date, c.valid_end_date, c.invalid_reason FROM concept c JOIN vocabulary_conversion vc ON vc.vocabulary_id_v5 = c.vocabulary_id WHERE ( c.valid_end_date < c.valid_start_date OR ( c.valid_end_date = TO_DATE('20991231', 'YYYYMMDD') AND c.invalid_reason IS NOT NULL ) OR ( c.valid_end_date <> TO_DATE('20991231', 'YYYYMMDD') AND c.invalid_reason IS NULL AND c.vocabulary_id NOT IN (SELECT TRIM(v) FROM UNNEST(STRING_TO_ARRAY((SELECT var_value FROM devv5.config$ WHERE var_name='special_vocabularies'),',')) v) ) OR c.valid_start_date > COALESCE(vc.latest_update, CURRENT_DATE) + INTERVAL '15 year' --some concepts might be from near future (e.g. GGR, HCPCS) [AVOF-1015]/increased 20180928 for some NDC concepts OR c.valid_start_date < TO_DATE('19000101', 'yyyymmdd') -- some concepts have a real date < 1970 ) AND COALESCE(checkid, 7) = 7 UNION ALL --wrong valid_start_date, valid_end_date or invalid_reason for the concept_relationship SELECT 8 check_id, 'wrong valid_start_date, valid_end_date or invalid_reason for the concept_relationship' AS check_name, s0.concept_id_1, s0.concept_id_2, s0.relationship_id, s0.valid_start_date, s0.valid_end_date, s0.invalid_reason FROM ( SELECT r.*, CASE WHEN ( r.valid_end_date = TO_DATE('20991231', 'YYYYMMDD') AND r.invalid_reason IS NOT NULL ) OR ( r.valid_end_date <> TO_DATE('20991231', 'YYYYMMDD') AND r.invalid_reason IS NULL ) OR r.valid_start_date > CURRENT_DATE OR r.valid_start_date < TO_DATE('19700101', 'yyyymmdd') THEN 1 ELSE 0 END check_flag FROM concept_relationship r ) AS s0 WHERE check_flag = 1 AND COALESCE(checkid, 8) = 8 UNION ALL --RxE to Rx name duplications --tempopary disabled /* SELECT 9 check_id, 'RxE to Rx name duplications' AS check_name, c2.concept_id, c1.concept_id, 'Concept replaced by' AS relationship_id, NULL AS valid_start_date, NULL AS valid_end_date, NULL AS invalid_reason FROM concept c1 JOIN concept c2 ON upper(c2.concept_name) = upper(c1.concept_name) AND c2.concept_class_id = c1.concept_class_id AND c2.vocabulary_id = 'RxNorm Extension' AND c2.invalid_reason IS NULL WHERE c1.vocabulary_id = 'RxNorm' AND c1.standard_concept = 'S' AND COALESCE(checkid, 9) = 9 UNION ALL*/ --Rxnorm/Rxnorm Extension name duplications --tempopary disabled (never used) /*SELECT 9 check_id, c_int.concept_id_1, c_int.concept_id_2, 'Concept replaced by' AS relationship_id, NULL AS valid_start_date, NULL AS valid_end_date, NULL AS invalid_reason FROM ( SELECT FIRST_VALUE(c.concept_id) OVER ( PARTITION BY d.concept_name ORDER BY c.vocabulary_id DESC, c.concept_name, c.concept_id ) AS concept_id_1, c.concept_id AS concept_id_2, c.vocabulary_id FROM concept c JOIN ( SELECT LOWER(concept_name) AS concept_name, concept_class_id FROM concept c_int WHERE c_int.vocabulary_id LIKE 'RxNorm%' AND c_int.concept_name NOT LIKE '%...%' AND c_int.invalid_reason IS NULL GROUP BY LOWER(c_int.concept_name), c_int.concept_class_id HAVING COUNT(*) > 1 EXCEPT SELECT LOWER(c_int.concept_name), c_int.concept_class_id FROM concept c_int WHERE c_int.vocabulary_id = 'RxNorm' AND c_int.concept_name NOT LIKE '%...%' AND c_int.invalid_reason IS NULL GROUP BY LOWER(c_int.concept_name), c_int.concept_class_id HAVING COUNT(*) > 1 ) d ON LOWER(c.concept_name) = d.concept_name AND c.vocabulary_id LIKE 'RxNorm%' AND c.invalid_reason IS NULL ) c_int JOIN concept c1 ON c1.concept_id = c_int.concept_id_1 JOIN concept c2 ON c2.concept_id = c_int.concept_id_2 WHERE c_int.concept_id_1 <> c_int.concept_id_2 AND NOT ( c1.vocabulary_id = 'RxNorm' AND c2.vocabulary_id = 'RxNorm' ) --AVOF-1434 (20190125) AND NOT EXISTS ( SELECT 1 FROM drug_strength ds1, drug_strength ds2 WHERE ds1.drug_concept_id = c1.concept_id AND ds2.drug_concept_id = c2.concept_id AND ds1.ingredient_concept_id = ds2.ingredient_concept_id AND ds1.amount_value = ds2.numerator_value AND ds1.amount_unit_concept_id = ds2.numerator_unit_concept_id AND ds1.amount_unit_concept_id IN ( 9325, 9324 ) ) AND COALESCE(checkid, 9) = 9 UNION ALL*/ --one concept has multiple replaces SELECT 10 check_id, 'one concept has multiple replaces' AS check_name, r.* FROM concept_relationship r WHERE ( r.concept_id_1, r.relationship_id ) IN ( SELECT r_int.concept_id_1, r_int.relationship_id FROM concept_relationship r_int WHERE r_int.relationship_id IN ( 'Concept replaced by', 'Concept same_as to', 'Concept alt_to to', 'Concept poss_eq to', 'Concept was_a to' ) AND r_int.invalid_reason IS NULL GROUP BY r_int.concept_id_1, r_int.relationship_id HAVING COUNT(*) > 1 ) AND COALESCE(checkid, 10) = 10 UNION ALL --wrong concept_name [AVOF-1438] SELECT 11 check_id, 'wrong concept_name ("OMOP generated", but should be OMOPxxx)' AS check_name, c.concept_id, NULL, c.vocabulary_id, c.valid_start_date, c.valid_end_date, c.invalid_reason FROM concept c WHERE c.domain_id <> 'Metadata' AND c.concept_code = 'OMOP generated' AND COALESCE(checkid, 11) = 11 UNION ALL --duplicate 'OMOP generated' concepts [AVOF-2000] SELECT 12 check_id, 'duplicate ''OMOP generated'' concepts' AS check_name, s0.concept_id, NULL, s0.vocabulary_id, s0.valid_start_date, s0.valid_end_date, NULL FROM ( SELECT c.concept_id, c.vocabulary_id, c.valid_start_date, c.valid_end_date, COUNT(*) OVER ( PARTITION BY c.concept_name, c.concept_code, c.vocabulary_id ) AS cnt FROM concept c WHERE c.invalid_reason IS NULL AND c.concept_code = 'OMOP generated' ) AS s0 WHERE s0.cnt > 1 AND COALESCE(checkid, 12) = 12; $BODY$ language 'sql' STABLE PARALLEL RESTRICTED SECURITY INVOKER; CREATE OR REPLACE FUNCTION qa_tests.check_stage_tables () RETURNS TABLE ( error_text TEXT, rows_count BIGINT ) AS $BODY$ BEGIN RETURN QUERY SELECT reason, COUNT(*) FROM ( --concept_relationship_stage SELECT CASE WHEN v1.vocabulary_id IS NOT NULL AND v2.vocabulary_id IS NOT NULL AND COALESCE (v1.latest_update, v2.latest_update) IS NULL THEN 'concept_relationship_stage contains a vocabulary, that is not affected by the SetLatestUpdate: '||crs.vocabulary_id_1 WHEN crs.valid_start_date IS NULL THEN 'concept_relationship_stage.valid_start_date is null' WHEN crs.valid_end_date IS NULL THEN 'concept_relationship_stage.valid_end_date is null' WHEN ((crs.invalid_reason IS NULL AND crs.valid_end_date <> TO_DATE('20991231', 'yyyymmdd')) OR (crs.invalid_reason IS NOT NULL AND crs.valid_end_date = TO_DATE('20991231', 'yyyymmdd'))) THEN 'wrong concept_relationship_stage.invalid_reason: '||COALESCE(crs.invalid_reason,'NULL')||' for '||TO_CHAR(crs.valid_end_date,'YYYYMMDD') WHEN crs.valid_end_date < crs.valid_start_date THEN 'concept_relationship_stage.valid_end_date < concept_relationship_stage.valid_start_date: '||TO_CHAR(crs.valid_end_date,'YYYYMMDD')||'+'||TO_CHAR(crs.valid_start_date,'YYYYMMDD') WHEN date_trunc('day', (crs.valid_start_date)) <> crs.valid_start_date THEN 'wrong format for concept_relationship_stage.valid_start_date (not truncated): '||TO_CHAR(crs.valid_start_date,'YYYYMMDD HH24:MI:SS') WHEN date_trunc('day', (crs.valid_end_date)) <> crs.valid_end_date THEN 'wrong format for concept_relationship_stage.valid_end_date (not truncated to YYYYMMDD): '||TO_CHAR(crs.valid_end_date,'YYYYMMDD HH24:MI:SS') WHEN COALESCE(crs.invalid_reason, 'D') <> 'D' THEN 'wrong value for concept_relationship_stage.invalid_reason: '||crs.invalid_reason WHEN crs.concept_code_1 = '' THEN 'concept_relationship_stage contains concept_code_1 which is empty ('''')' WHEN crs.concept_code_2 = '' THEN 'concept_relationship_stage contains concept_code_2 which is empty ('''')' WHEN c1.concept_code IS NULL AND cs1.concept_code IS NULL THEN 'concept_code_1+vocabulary_id_1 not found in the concept/concept_stage: '||crs.concept_code_1||'+'||crs.vocabulary_id_1 WHEN c2.concept_code IS NULL AND cs2.concept_code IS NULL THEN 'concept_code_2+vocabulary_id_2 not found in the concept/concept_stage: '||crs.concept_code_2||'+'||crs.vocabulary_id_2 WHEN v1.vocabulary_id IS NULL THEN 'vocabulary_id_1 not found in the vocabulary: '||CASE WHEN crs.vocabulary_id_1='' THEN '''''' ELSE crs.vocabulary_id_1 END WHEN v2.vocabulary_id IS NULL THEN 'vocabulary_id_2 not found in the vocabulary: '||CASE WHEN crs.vocabulary_id_2='' THEN '''''' ELSE crs.vocabulary_id_2 END WHEN rl.relationship_id IS NULL THEN 'relationship_id not found in the relationship: '||CASE WHEN crs.relationship_id='' THEN '''''' ELSE crs.relationship_id END WHEN crs.valid_start_date > CURRENT_DATE THEN 'concept_relationship_stage.valid_start_date is greater than the current date: '||TO_CHAR(crs.valid_start_date,'YYYYMMDD') WHEN crs.valid_start_date < TO_DATE ('19000101', 'yyyymmdd') THEN 'concept_stage.valid_start_date is before 1900: '||TO_CHAR(crs.valid_start_date,'YYYYMMDD') ELSE NULL END AS reason FROM concept_relationship_stage crs LEFT JOIN concept c1 ON c1.concept_code = crs.concept_code_1 AND c1.vocabulary_id = crs.vocabulary_id_1 LEFT JOIN concept_stage cs1 ON cs1.concept_code = crs.concept_code_1 AND cs1.vocabulary_id = crs.vocabulary_id_1 LEFT JOIN concept c2 ON c2.concept_code = crs.concept_code_2 AND c2.vocabulary_id = crs.vocabulary_id_2 LEFT JOIN concept_stage cs2 ON cs2.concept_code = crs.concept_code_2 AND cs2.vocabulary_id = crs.vocabulary_id_2 LEFT JOIN vocabulary v1 ON v1.vocabulary_id = crs.vocabulary_id_1 LEFT JOIN vocabulary v2 ON v2.vocabulary_id = crs.vocabulary_id_2 LEFT JOIN relationship rl ON rl.relationship_id = crs.relationship_id UNION ALL SELECT 'duplicates in concept_relationship_stage were found: '||crs.concept_code_1||'+'||crs.concept_code_2||'+'||crs.vocabulary_id_1||'+'||crs.vocabulary_id_2||'+'||crs.relationship_id AS reason FROM concept_relationship_stage crs GROUP BY crs.concept_code_1, crs.concept_code_2, crs.vocabulary_id_1, crs.vocabulary_id_2, crs.relationship_id HAVING COUNT (*) > 1 UNION ALL --concept_stage SELECT CASE WHEN v.vocabulary_id IS NOT NULL AND v.latest_update IS NULL THEN 'concept_stage contains a vocabulary, that is not affected by the SetLatestUpdate: '||cs.vocabulary_id WHEN v.vocabulary_id IS NULL THEN 'concept_stage.vocabulary_id not found in the vocabulary: '||CASE WHEN cs.vocabulary_id='' THEN '''''' ELSE cs.vocabulary_id END WHEN cs.valid_end_date < cs.valid_start_date THEN --it's absolutely ok if valid_end_date < valid_start_date when valid_start_date = latest_update, because generic_update keeps the old date. check it CASE WHEN cs.valid_start_date<>v.latest_update THEN 'concept_stage.valid_end_date < concept_stage.valid_start_date: '||TO_CHAR(cs.valid_end_date,'YYYYMMDD')||'+'||TO_CHAR(cs.valid_start_date,'YYYYMMDD') ELSE --but even if valid_start_date = latest_update we should check what if valid_start_date in the 'concept' bigger than valid_end_date in the 'concept_stage'? CASE WHEN cs.valid_end_date<c.valid_start_date THEN 'concept_stage.valid_end_date < concept.valid_start_date: '||TO_CHAR(cs.valid_end_date,'YYYYMMDD')||'+'||TO_CHAR(c.valid_start_date,'YYYYMMDD') END END WHEN COALESCE(cs.invalid_reason, 'D') NOT IN ('D','U') THEN 'wrong value for concept_stage.invalid_reason: '||CASE WHEN cs.invalid_reason='' THEN '''''' ELSE cs.invalid_reason END WHEN date_trunc('day', (cs.valid_start_date)) <> cs.valid_start_date THEN 'wrong format for concept_stage.valid_start_date (not truncated): '||TO_CHAR(cs.valid_start_date,'YYYYMMDD HH24:MI:SS') WHEN date_trunc('day', (cs.valid_end_date)) <> cs.valid_end_date THEN 'wrong format for concept_stage.valid_end_date (not truncated to YYYYMMDD): '||TO_CHAR(cs.valid_end_date,'YYYYMMDD HH24:MI:SS') WHEN (((cs.invalid_reason IS NULL AND cs.valid_end_date <> TO_DATE('20991231', 'yyyymmdd')) AND cs.vocabulary_id NOT IN (SELECT TRIM(v) FROM UNNEST(STRING_TO_ARRAY((SELECT var_value FROM devv5.config$ WHERE var_name='special_vocabularies'),',')) v)) OR (cs.invalid_reason IS NOT NULL AND cs.valid_end_date = TO_DATE('20991231', 'yyyymmdd'))) THEN 'wrong concept_stage.invalid_reason: '||COALESCE(cs.invalid_reason,'NULL')||' for '||TO_CHAR(cs.valid_end_date,'YYYYMMDD') WHEN d.domain_id IS NULL AND cs.domain_id IS NOT NULL THEN 'domain_id not found in the domain: '||CASE WHEN cs.domain_id='' THEN '''''' ELSE cs.domain_id END WHEN cc.concept_class_id IS NULL AND cs.concept_class_id IS NOT NULL THEN 'concept_class_id not found in the concept_class: '||CASE WHEN cs.concept_class_id='' THEN '''''' ELSE cs.concept_class_id END WHEN COALESCE(cs.standard_concept, 'S') NOT IN ('C','S') THEN 'wrong value for standard_concept: '||CASE WHEN cs.standard_concept='' THEN '''''' ELSE cs.standard_concept END WHEN cs.valid_start_date IS NULL THEN 'concept_stage.valid_start_date is null' WHEN cs.valid_end_date IS NULL THEN 'concept_stage.valid_end_date is null' WHEN cs.valid_start_date < TO_DATE ('19000101', 'yyyymmdd') THEN 'concept_stage.valid_start_date is before 1900: '||TO_CHAR(cs.valid_start_date,'YYYYMMDD') WHEN COALESCE(cs.concept_name, '') = '' THEN 'empty concept_stage.concept_name ('''')' WHEN cs.concept_code = '' THEN 'empty concept_stage.concept_code ('''')' WHEN cs.concept_name<>TRIM(cs.concept_name) THEN 'concept_stage.concept_name not trimmed for concept_code: '||cs.concept_code WHEN cs.concept_code<>TRIM(cs.concept_code) THEN 'concept_stage.concept_code not trimmed for concept_name: '||cs.concept_name ELSE NULL END AS reason FROM concept_stage cs LEFT JOIN vocabulary v ON v.vocabulary_id = cs.vocabulary_id LEFT JOIN domain d ON d.domain_id = cs.domain_id LEFT JOIN concept_class cc ON cc.concept_class_id = cs.concept_class_id LEFT JOIN concept c ON c.concept_code = cs.concept_code AND c.vocabulary_id=cs.vocabulary_id UNION ALL --concept_synonym_stage SELECT CASE WHEN v.vocabulary_id IS NOT NULL AND v.latest_update IS NULL THEN 'concept_synonym_stage contains a vocabulary, that is not affected by the SetLatestUpdate: '||css.synonym_vocabulary_id WHEN v.vocabulary_id IS NULL THEN 'concept_synonym_stage.synonym_vocabulary_id not found in the vocabulary: '||CASE WHEN css.synonym_vocabulary_id='' THEN '''''' ELSE css.synonym_vocabulary_id END WHEN css.synonym_name = '' THEN 'empty synonym_name ('''')' WHEN css.synonym_concept_code = '' THEN 'empty synonym_concept_code ('''')' WHEN c.concept_code IS NULL AND cs.concept_code IS NULL THEN 'synonym_concept_code+synonym_vocabulary_id not found in the concept/concept_stage: '||css.synonym_concept_code||'+'||css.synonym_vocabulary_id WHEN css.synonym_name<>TRIM(css.synonym_name) THEN 'synonym_name not trimmed for concept_code: '||css.synonym_concept_code WHEN css.synonym_concept_code<>TRIM(css.synonym_concept_code) THEN 'synonym_concept_code not trimmed for synonym_name: '||css.synonym_name WHEN c_lng.concept_id IS NULL THEN 'language_concept_id not found in the concept: '||css.language_concept_id ELSE NULL END AS reason FROM concept_synonym_stage css LEFT JOIN vocabulary v ON v.vocabulary_id = css.synonym_vocabulary_id LEFT JOIN concept c ON c.concept_code = css.synonym_concept_code AND c.vocabulary_id = css.synonym_vocabulary_id LEFT JOIN concept_stage cs ON cs.concept_code = css.synonym_concept_code AND cs.vocabulary_id = css.synonym_vocabulary_id LEFT JOIN concept c_lng ON c_lng.concept_id = css.language_concept_id UNION ALL SELECT 'duplicates in concept_stage were found: '||cs.concept_code||'+'||cs.vocabulary_id AS reason FROM concept_stage cs GROUP BY cs.concept_code, cs.vocabulary_id HAVING COUNT (*) > 1 UNION ALL --pack_content_stage SELECT 'duplicates in pack_content_stage were found: '||pcs.pack_concept_code||'+'||pcs.pack_vocabulary_id||pcs.drug_concept_code||'+'||pcs.drug_vocabulary_id||'+'||pcs.amount AS reason FROM pack_content_stage pcs GROUP BY pcs.pack_concept_code, pcs.pack_vocabulary_id, pcs.drug_concept_code, pcs.drug_vocabulary_id, pcs.amount HAVING COUNT (*) > 1 UNION ALL --drug_strength_stage SELECT 'duplicates in drug_strength_stage were found: '||dcs.drug_concept_code||'+'||dcs.vocabulary_id_1|| dcs.ingredient_concept_code||'+'||dcs.vocabulary_id_2||'+'||TO_CHAR(dcs.amount_value, 'FM9999999999999999999990.999999999999999999999') AS reason FROM drug_strength_stage dcs GROUP BY dcs.drug_concept_code, dcs.vocabulary_id_1, dcs.ingredient_concept_code, dcs.vocabulary_id_2, dcs.amount_value HAVING COUNT (*) > 1 ) AS s0 WHERE reason IS NOT NULL GROUP BY reason; END; $BODY$ LANGUAGE 'plpgsql' SECURITY INVOKER;
the_stack
-- @@@ START COPYRIGHT @@@ -- -- Licensed to the Apache Software Foundation (ASF) under one -- or more contributor license agreements. See the NOTICE file -- distributed with this work for additional information -- regarding copyright ownership. The ASF licenses this file -- to you under the Apache License, Version 2.0 (the -- "License"); you may not use this file except in compliance -- with the License. You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, -- software distributed under the License is distributed on an -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -- KIND, either express or implied. See the License for the -- specific language governing permissions and limitations -- under the License. -- -- @@@ END COPYRIGHT @@@ /* This test tests NAR support with indexes. * * * * */ /* --multiple indexes create table rownum10 (a int not null, b int not null, c int not null, d int not null, primary key (a)); create unique index rownum10idx1 on rownum10(b); create unique index rownum10idx2 on rownum10(c); create unique index rownum10idx3 on rownum10(d); */ #include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h> #define MINOF(X,Y) (X <= Y ? X : Y) #define NAR00 30022 #define NAR01 30022 #define SIZE 100 #define RATE 100 void display_diagnosis(); EXEC SQL MODULE CAT.SCH.NARINT3 NAMES ARE ISO88591; /* globals */ EXEC SQL BEGIN DECLARE SECTION; ROWSET [SIZE] Int32 a_int; ROWSET [SIZE] Int32 b_int; ROWSET [SIZE] Int32 c_int; ROWSET [SIZE] Int32 d_int; ROWSET [SIZE] char b_char[97]; Int32 numRows ; Int32 loop, inp, inp1, trynum, rate, numiter; Int32 savesqlcode; EXEC SQL END DECLARE SECTION; EXEC SQL BEGIN DECLARE SECTION; /**** host variables for get diagnostics *****/ NUMERIC(5) i; NUMERIC(5) hv_num; Int32 hv_sqlcode; Int32 hv_rowindex; Int32 hv_rowcount; char hv_msgtxt[256]; char hv_sqlstate[6]; char hv_tabname[129]; char SQLSTATE[6]; Int32 SQLCODE; EXEC SQL END DECLARE SECTION; exec sql whenever sqlerror call display_diagnosis; Int32 main() { /* typedef long long int Int64; */ Int32 i=0; for (i=0; i<SIZE; i++) { a_int[i] = i+1; b_int[i] = (i+1)*10; c_int[i] = (i+1)*100; d_int[i] = (i+1)*1000; } inp = 20; /* EXEC SQL CONTROL QUERY DEFAULT INSERT_VSBB 'OFF' ; */ /*******************************************************************************************************/ EXEC SQL DELETE FROM rownum10; // Expecting the whole rowset insert to succeed EXEC SQL ROWSET FOR INPUT SIZE :inp INSERT INTO rownum10 VALUES (:a_int , :b_int, :c_int, :d_int) NOT ATOMIC; if (SQLCODE !=0) display_diagnosis(); EXEC SQL COMMIT ; /***************************************************************************************/ EXEC SQL DELETE FROM rownum10; for (i=0; i<SIZE; i++) { a_int[i] = i+1; b_int[i] = (i+1)*10; c_int[i] = (i+1)*100; d_int[i] = (i+1)*1000; } // Expecting error from basetable insert . Only 19 rows should be inserted printf("\n *** Expecting -8102 on row 10 ***\n"); a_int[10] = 5; // Introduce a duplicate primary key EXEC SQL ROWSET FOR INPUT SIZE :inp INSERT INTO rownum10 VALUES (:a_int , :b_int, :c_int, :d_int) NOT ATOMIC; if (SQLCODE !=0) display_diagnosis(); EXEC SQL COMMIT ; /*************************************************************************************/ EXEC SQL DELETE FROM rownum10; for (i=0; i<SIZE; i++) { a_int[i] = i+1; b_int[i] = (i+1)*10; c_int[i] = (i+1)*100; d_int[i] = (i+1)*1000; } // Expecting error from first index insert. Only 19 rows should be inserted printf("\n *** Expecting -8102 on row 10 ***\n"); a_int[10] = 200; // Introduce a duplicate unique index key value b_int[10] = 110; c_int[10] = 200; d_int[10] = 200; EXEC SQL ROWSET FOR INPUT SIZE :inp INSERT INTO rownum10 VALUES (:a_int , :b_int, :c_int, :d_int) NOT ATOMIC; if (SQLCODE !=0) display_diagnosis(); EXEC SQL COMMIT ; /*************************************************************************************/ EXEC SQL DELETE FROM rownum10; for (i=0; i<SIZE; i++) { a_int[i] = i+1; b_int[i] = (i+1)*10; c_int[i] = (i+1)*100; d_int[i] = (i+1)*1000; } // Expecting errors from basetable and all indexes. Only 17 rows should be inserted a_int[15] = 5; // Introduce a duplicate primary key a_int[16] = 60; // Introduce a duplicate unique index key value in first index b_int[16] = 60; c_int[16] = 60; d_int[16] = 60; a_int[17] = 700; // Introduce a duplicate unique index key value in second index b_int[17] = 700; c_int[17] = 700; d_int[17] = 700; a_int[18] = 8000; // Introduce a duplicate unique index key value in third index b_int[18] = 8000; c_int[18] = 8000; d_int[18] = 8000; printf("\n *** Expecting -8102 on row 15,16,17,18 ***\n"); EXEC SQL ROWSET FOR INPUT SIZE :inp INSERT INTO rownum10 VALUES (:a_int , :b_int, :c_int, :d_int) NOT ATOMIC; if (SQLCODE !=0) display_diagnosis(); EXEC SQL COMMIT ; /*************************************************************************************/ /* SET table tests */ /*************************************************************************************/ EXEC SQL DELETE FROM rownum10set; for (i=0; i<SIZE; i++) { a_int[i] = i+1; b_int[i] = (i+1)*10; c_int[i] = (i+1)*100; d_int[i] = (i+1)*1000; } // Expecting no errors. Only 17 rows should be inserted a_int[16] = 6; // Introduce a dup row at index 16 b_int[16] = 60; c_int[16] = 600; d_int[16] = 6000; a_int[17] = 7; // Introduce a duplicate row at index 17 b_int[17] = 70; c_int[17] = 700; d_int[17] = 7000; a_int[18] = 8; // Introduce a duplicate row at index 18 b_int[18] = 80; c_int[18] = 800; d_int[18] = 8000; printf("\n *** Expecting 0 errors .. 17 rows inserted ***\n"); EXEC SQL ROWSET FOR INPUT SIZE :inp INSERT INTO rownum10set VALUES (:a_int , :b_int, :c_int, :d_int) NOT ATOMIC; if (SQLCODE !=0) display_diagnosis(); EXEC SQL COMMIT ; /*************************************************************************************/ /*************************************************************************************/ EXEC SQL DELETE FROM rownum10set; for (i=0; i<SIZE; i++) { a_int[i] = i+1; b_int[i] = (i+1)*10; c_int[i] = (i+1)*100; d_int[i] = (i+1)*1000; } // Expecting no errors from basetable and some 8102 from indexes indexes. Only 17 rows should be inserted a_int[15] = 5; // Introduce a dup row b_int[15] = 50; c_int[15] = 500; d_int[15] = 5000; a_int[16] = 60; // Introduce a duplicate unique index key value in first index b_int[16] = 60; c_int[16] = 60; d_int[16] = 60; a_int[17] = 700; // Introduce a duplicate unique index key value in second index b_int[17] = 700; c_int[17] = 700; d_int[17] = 700; a_int[18] = 8000; // Introduce a duplicate unique index key value in third index b_int[18] = 8000; c_int[18] = 8000; d_int[18] = 8000; printf("\n *** Expecting -8102 on row 16,17,18 : 16 rows inserted ***\n"); EXEC SQL ROWSET FOR INPUT SIZE :inp INSERT INTO rownum10set VALUES (:a_int , :b_int, :c_int, :d_int) NOT ATOMIC; if (SQLCODE !=0) display_diagnosis(); EXEC SQL COMMIT ; /*************************************************************************************/ /*************************************************************************************/ EXEC SQL DELETE FROM rownum10set; for (i=0; i<SIZE; i++) { a_int[i] = i+1; b_int[i] = (i+1)*10; c_int[i] = (i+1)*100; d_int[i] = (i+1)*1000; } // Expecting one error from basetable . Only 18 rows should be inserted a_int[15] = 5; // Introduce a duplicate primary key a_int[16] = 6; // Introduce a duplicate row b_int[16] = 60; c_int[16] = 600; d_int[16] = 6000; printf("\n *** Expecting -8102 on row 15: 18 rows should be inserted ***\n"); EXEC SQL ROWSET FOR INPUT SIZE :inp INSERT INTO rownum10set VALUES (:a_int , :b_int, :c_int, :d_int) NOT ATOMIC; if (SQLCODE !=0) display_diagnosis(); EXEC SQL COMMIT ; /*************************************************************************************/ return(0); } /*****************************************************/ void display_diagnosis() /*****************************************************/ { Int32 rowcondnum = 103; Int32 retcode ; savesqlcode = SQLCODE ; hv_rowcount = -1 ; hv_rowindex = -2 ; exec sql get diagnostics :hv_num = NUMBER, :hv_rowcount = ROW_COUNT; memset(hv_msgtxt,' ',sizeof(hv_msgtxt)); hv_msgtxt[255]='\0'; memset(hv_sqlstate,' ',sizeof(hv_sqlstate)); hv_sqlstate[6]='\0'; printf("Number of conditions : %d\n", hv_num); printf("Number of rows inserted: %d\n", hv_rowcount); printf("\n"); for (i = 1; i <= hv_num; i++) { exec sql get diagnostics exception :i :hv_tabname = TABLE_NAME, :hv_sqlcode = SQLCODE, :hv_sqlstate = RETURNED_SQLSTATE, /* :hv_rowindex = ROW_INDEX, */ :hv_msgtxt = MESSAGE_TEXT; retcode = SQL_EXEC_GetDiagnosticsCondInfo2(rowcondnum, i, &hv_rowindex, 0,0,0); printf("Condition number : %d\n", i); printf("ROW INDEX : %d\n", hv_rowindex); printf("SQLCODE : %d\n", hv_sqlcode); printf("SQLSTATE : %s\n", hv_sqlstate); printf("MESSAGE : %s\n", hv_msgtxt); printf("TABLE : %s\n", hv_tabname); printf("\n"); memset(hv_msgtxt,' ',sizeof(hv_msgtxt)); hv_msgtxt[255]='\0'; memset(hv_tabname,' ',sizeof(hv_tabname)); hv_tabname[128]='\0'; memset(hv_sqlstate,' ',sizeof(hv_sqlstate)); hv_sqlstate[6]='\0'; } SQLCODE = savesqlcode ; }
the_stack
--I1. 建表 create schema tpch; set current_schema=tpch; drop table if exists customer; drop table if exists lineitem; drop table if exists nation; drop table if exists orders; drop table if exists part; drop table if exists partsupp; drop table if exists region; drop table if exists supplier; CREATE TABLE customer ( c_custkey integer NOT NULL, c_name character varying(25) NOT NULL, c_address character varying(40) NOT NULL, c_nationkey integer NOT NULL, c_phone character(15) NOT NULL, c_acctbal numeric(15,2) NOT NULL, c_mktsegment character(10) NOT NULL, c_comment character varying(117) NOT NULL ) with (orientation = column) DISTRIBUTE BY HASH (c_custkey); CREATE TABLE lineitem ( l_orderkey integer NOT NULL, l_partkey integer NOT NULL, l_suppkey integer NOT NULL, l_linenumber integer NOT NULL, l_quantity numeric(15,2) NOT NULL, l_extendedprice numeric(15,2) NOT NULL, l_discount numeric(15,2) NOT NULL, l_tax numeric(15,2) NOT NULL, l_returnflag character(1) NOT NULL, l_linestatus character(1) NOT NULL, l_shipdate date NOT NULL, l_commitdate date NOT NULL, l_receiptdate date NOT NULL, l_shipinstruct character(25) NOT NULL, l_shipmode character(10) NOT NULL, l_comment character varying(44) NOT NULL ) with (orientation = column) DISTRIBUTE BY HASH (l_orderkey); CREATE TABLE nation ( n_nationkey integer NOT NULL, n_name character(25) NOT NULL, n_regionkey integer NOT NULL, n_comment character varying(152) ) with (orientation = column) DISTRIBUTE BY REPLICATION; CREATE TABLE orders ( o_orderkey integer NOT NULL, o_custkey integer NOT NULL, o_orderstatus character(1) NOT NULL, o_totalprice numeric(15,2) NOT NULL, o_orderdate date NOT NULL, o_orderpriority character(15) NOT NULL, o_clerk character(15) NOT NULL, o_shippriority integer NOT NULL, o_comment character varying(79) NOT NULL ) with (orientation = column) DISTRIBUTE BY HASH (o_orderkey); CREATE TABLE part ( p_partkey integer NOT NULL, p_name character varying(55) NOT NULL, p_mfgr character(25) NOT NULL, p_brand character(10) NOT NULL, p_type character varying(25) NOT NULL, p_size integer NOT NULL, p_container character(10) NOT NULL, p_retailprice numeric(15,2) NOT NULL, p_comment character varying(23) NOT NULL ) with (orientation = column) DISTRIBUTE BY HASH (p_partkey); CREATE TABLE partsupp ( ps_partkey integer NOT NULL, ps_suppkey integer NOT NULL, ps_availqty integer NOT NULL, ps_supplycost numeric(15,2) NOT NULL, ps_comment character varying(199) NOT NULL ) with (orientation = column) DISTRIBUTE BY HASH (ps_partkey); CREATE TABLE region ( r_regionkey integer NOT NULL, r_name character(25) NOT NULL, r_comment character varying(152) ) with (orientation = column) DISTRIBUTE BY REPLICATION; CREATE TABLE supplier ( s_suppkey integer NOT NULL, s_name character(25) NOT NULL, s_address character varying(40) NOT NULL, s_nationkey integer NOT NULL, s_phone character(15) NOT NULL, s_acctbal numeric(15,2) NOT NULL, s_comment character varying(101) NOT NULL ) with (orientation = column) DISTRIBUTE BY HASH (s_suppkey); SET explain_perf_mode=pretty; --I1.q1 --S1. explain plan set statement_id='q1' for select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedprice) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)/1000) as sum_charge, --add /1000 avg(l_quantity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_disc, count(*) as count_order from lineitem where l_shipdate <= date '1998-12-01' - interval '3 day' group by l_returnflag, l_linestatus order by l_returnflag, l_linestatus; --S2 select id,operation,options,object_name,object_type,object_owner,projection from plan_table_data where statement_id='q1' order by id; --S3 explain(costs off) select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedprice) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)/1000) as sum_charge, --add /1000 avg(l_quantity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_disc, count(*) as count_order from lineitem where l_shipdate <= date '1998-12-01' - interval '3 day' group by l_returnflag, l_linestatus order by l_returnflag, l_linestatus; --I3.q2 --S2. explain plan set statement_id='q2' for select s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment from part, supplier, partsupp, nation, region where p_partkey = ps_partkey and s_suppkey = ps_suppkey and p_size = 15 and p_type like 'SMALL%' and s_nationkey = n_nationkey and n_regionkey = r_regionkey and r_name = 'EUROPE ' and ps_supplycost = ( select min(ps_supplycost) from partsupp, supplier, nation, region where p_partkey = ps_partkey and s_suppkey = ps_suppkey and s_nationkey = n_nationkey and n_regionkey = r_regionkey and n_regionkey = r_regionkey and r_name = 'EUROPE ' ) order by s_acctbal desc, n_name, s_name, p_partkey limit 100 ; --S2. select id,operation,options,object_name,object_type,object_owner,projection from plan_table_data where statement_id='q2' order by id; --S3. explain(costs off) select s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment from part, supplier, partsupp, nation, region where p_partkey = ps_partkey and s_suppkey = ps_suppkey and p_size = 15 and p_type like 'SMALL%' and s_nationkey = n_nationkey and n_regionkey = r_regionkey and r_name = 'EUROPE ' and ps_supplycost = ( select min(ps_supplycost) from partsupp, supplier, nation, region where p_partkey = ps_partkey and s_suppkey = ps_suppkey and s_nationkey = n_nationkey 1,1 Top and s_nationkey = n_nationkey and n_regionkey = r_regionkey and r_name = 'EUROPE ' ) order by s_acctbal desc, n_name, s_name, p_partkey limit 100 ; --I3.q3 --S1. explain plan set statement_id='q3' for select l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate, o_shippriority from customer, orders, lineitem where c_mktsegment = 'BUILDING' and c_custkey = o_custkey and l_orderkey = o_orderkey and o_orderdate < '1995-03-15'::date and l_shipdate > '1995-03-15'::date group by l_orderkey, o_orderdate, o_shippriority order by revenue desc, o_orderdate limit 10 ; --S2. select id,operation,options,object_name,object_type,object_owner,projection from plan_table_data where statement_id='q3' order by id; --S3. explain(costs off) select l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate, o_shippriority from customer, orders, lineitem where c_mktsegment = 'BUILDING' and c_custkey = o_custkey and l_orderkey = o_orderkey and o_orderdate < '1995-03-15'::date and l_shipdate > '1995-03-15'::date group by l_orderkey, o_orderdate, o_shippriority order by revenue desc, o_orderdate limit 10 ; --I4.q4 explain plan set statement_id='q4' for select o_orderpriority, count(*) as order_count from orders where o_orderdate >= '1993-07-01'::date and o_orderdate < '1993-07-01'::date + interval '3 month' and exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate < l_receiptdate ) group by o_orderpriority order by o_orderpriority; --S2. select id,operation,options,object_name,object_type,object_owner,projection from plan_table_data where statement_id='q4' order by id; --S3. explain(costs off) select o_orderpriority, count(*) as order_count from orders where o_orderdate >= '1993-07-01'::date and o_orderdate < '1993-07-01'::date + interval '3 month' and exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate < l_receiptdate ) group by o_orderpriority order by o_orderpriority; --I5.q5 explain plan set statement_id='q5' for select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where c_custkey = o_custkey and l_orderkey = o_orderkey and l_suppkey = s_suppkey and c_nationkey = s_nationkey and s_nationkey = n_nationkey and n_regionkey = r_regionkey and r_name = 'ASIA' and o_orderdate >= '1994-01-01'::date and o_orderdate < '1994-01-01'::date + interval '1 year' group by n_name order by revenue desc; --S2. select id,operation,options,object_name,object_type,object_owner,projection from plan_table_data where statement_id='q5' order by id; --S3. explain(costs off) select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where c_custkey = o_custkey and l_orderkey = o_orderkey and l_suppkey = s_suppkey and c_nationkey = s_nationkey and s_nationkey = n_nationkey and n_regionkey = r_regionkey and r_name = 'ASIA' and o_orderdate >= '1994-01-01'::date and o_orderdate < '1994-01-01'::date + interval '1 year' group by n_name order by revenue desc; --I6.q6 explain plan set statement_id='q6' for select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= '1994-01-01'::date and l_shipdate < '1994-01-01'::date + interval '1 year' and l_discount between 0.06 - 0.01 and 0.06 + 0.01 and l_quantity < 24; --S2. select id,operation,options,object_name,object_type,object_owner,projection from plan_table_data where statement_id='q6' order by id; --S3. explain(costs off) select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= '1994-01-01'::date and l_shipdate < '1994-01-01'::date + interval '1 year' and l_discount between 0.06 - 0.01 and 0.06 + 0.01 and l_quantity < 24; --I7.q7 explain plan set statement_id='q7' for select supp_nation, cust_nation, l_year, sum(volume) as revenue from ( select n1.n_name as supp_nation, n2.n_name as cust_nation, extract(year from l_shipdate) as l_year, l_extendedprice * (1 - l_discount) as volume from supplier, lineitem, orders, customer, nation n1, nation n2 where s_suppkey = l_suppkey and o_orderkey = l_orderkey and c_custkey = o_custkey and s_nationkey = n1.n_nationkey and c_nationkey = n2.n_nationkey and ( (n1.n_name = 'FRANCE' and n2.n_name = 'GERMANY') or (n1.n_name = 'GERMANY' and n2.n_name = 'FRANCE') ) and l_shipdate between date '1995-01-01' and date '1996-12-31' ) as shipping group by supp_nation, cust_nation, l_year order by supp_nation, cust_nation, l_year; --S2. select id,operation,options,object_name,object_type,object_owner,projection from plan_table_data where statement_id='q7' order by id; --S3. explain(costs off) select supp_nation, cust_nation, l_year, sum(volume) as revenue from ( select n1.n_name as supp_nation, n2.n_name as cust_nation, extract(year from l_shipdate) as l_year, l_extendedprice * (1 - l_discount) as volume from supplier, lineitem, orders, customer, nation n1, nation n2 where s_suppkey = l_suppkey and o_orderkey = l_orderkey and c_custkey = o_custkey and s_nationkey = n1.n_nationkey and c_nationkey = n2.n_nationkey and ( (n1.n_name = 'FRANCE' and n2.n_name = 'GERMANY') or (n1.n_name = 'GERMANY' and n2.n_name = 'FRANCE') ) and l_shipdate between date '1995-01-01' and date '1996-12-31' ) as shipping group by supp_nation, cust_nation, l_year order by supp_nation, cust_nation, l_year; --I8.q8 explain plan set statement_id='q8' for select o_year, sum(case when nation = 'BRAZIL' then volume else 0 end) / sum(volume) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier, lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_partkey and s_suppkey = l_suppkey and l_orderkey = o_orderkey and o_custkey = c_custkey and c_nationkey = n1.n_nationkey and n1.n_regionkey = r_regionkey and r_name = 'AMERICA' and s_nationkey = n2.n_nationkey and o_orderdate between date '1995-01-01' and date '1996-12-31' and p_type = 'ECONOMY ANODIZED STEEL' ) as all_nations group by o_year order by o_year; --S2. select id,operation,options,object_name,object_type,object_owner,projection from plan_table_data where statement_id='q8' order by id; --S3. explain(costs off) select o_year, sum(case when nation = 'BRAZIL' then volume else 0 end) / sum(volume) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier, lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_partkey and s_suppkey = l_suppkey and l_orderkey = o_orderkey and o_custkey = c_custkey and c_nationkey = n1.n_nationkey and n1.n_regionkey = r_regionkey and r_name = 'AMERICA' and s_nationkey = n2.n_nationkey and o_orderdate between date '1995-01-01' and date '1996-12-31' and p_type = 'ECONOMY ANODIZED STEEL' ) as all_nations group by o_year order by o_year; --I9.q9 explain plan set statement_id='q9' for select nation, o_year, sum(amount) as sum_profit from ( select n_name as nation, extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount from part, supplier, lineitem, partsupp, orders, nation where s_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partkey = l_partkey and p_partkey = l_partkey and o_orderkey = l_orderkey and s_nationkey = n_nationkey and p_name like '%green%' ) as profit group by nation, o_year order by nation, o_year desc; --S2. select id,operation,options,object_name,object_type,object_owner,projection from plan_table_data where statement_id='q9' order by id; --S3. explain(costs off) select nation, o_year, sum(amount) as sum_profit from ( select n_name as nation, extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount from part, supplier, lineitem, partsupp, orders, nation where s_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partkey = l_partkey and p_partkey = l_partkey and o_orderkey = l_orderkey and s_nationkey = n_nationkey and p_name like '%green%' ) as profit group by nation, o_year order by nation, o_year desc; --清理 delete from plan_table_data; drop schema tpch cascade;
the_stack
--/**************************************************************************** -- (c) Copyright IBM Corp. 2008 All rights reserved. -- -- The following sample of source code ("Sample") is owned by International -- Business Machines Corporation or one of its subsidiaries ("IBM") and is -- copyrighted and licensed, not sold. You may use, copy, modify, and -- distribute the Sample in any form without payment to IBM, for the purpose of -- assisting you in the development of your applications. -- -- The Sample code is provided to you on an "AS IS" basis, without warranty of -- any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR -- IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do -- not allow for the exclusion or limitation of implied warranties, so the above -- limitations or exclusions may not apply to you. IBM shall not be liable for -- any damages you suffer as a result of using, copying, modifying or -- distributing the Sample, even if IBM has been advised of the possibility of -- such damages. -- ****************************************************************************** -- -- SAMPLE FILE NAME: autonomous_transaction.db2 -- -- PURPOSE : The purpose of this sample is to demonstrate the use of -- the AUTONOMOUS keyword in the CREATE PROCEDURE statement. -- -- USAGE SCENARIO : In an enterprise, each employee has some privileges on -- certain tables and procedures. The employees use stored -- procedures to perform operations on the table. The employees -- cannot access those tables on which they do not have access -- privileges. If any employee tries to access any restricted -- data, an autonomous procedure will log the complete event and -- store the details in a log table. At the end of day, the -- administrator can check all the events. -- -- PREREQUISITE : The following users should exist in the operating system. -- -- john with password "john12345" in SYSADM group -- bob with password "bob12345" -- pat with password "pat12345" -- -- EXECUTION : db2 -td@ -vf autonomous_transaction.db2 -- -- INPUTS : NONE -- -- OUTPUT : Successful execution of autonomous procedure. -- -- OUTPUT FILE : autonomous_transaction.out (available in the online documentation) -- -- DEPENDENCIES : NONE -- -- SQL STATEMENTS USED: -- CREATE TABLE -- CREATE PROCEDURE -- DROP TABLE -- DROP PROCEDURE -- INSERT -- SELECT -- UPDATE TABLE -- -- ************************************************************************* -- -- For more information about the command line processor (CLP) scripts, -- see the README file. -- -- For information on using SQL statements, see the SQL Reference. -- -- For the latest information on programming, building, and running DB2 -- applications, visit the DB2 application development website: -- -- http://www.ibm.com/software/data/db2/ad/ -- -- ************************************************************************* -- -- SAMPLE DESCRIPTION -- -- 1. The data is stored in the following tables: -- a) TEMP_EMPLOYEE : Contains employee details. -- b) TEMP_PAYROLL : Contains the employees' salary details. -- c) EVENT_LOG : Contains the details of all the events performed -- by the user. -- 2. The application is processed using the following procedures: -- -- a) UPDATE_SALARY : Procedure to update the salary. The user passes the -- employee's experience, work department, and new salary -- as the parameters. -- -- b) REPORT_GENERATE : Procedure to generate the employee's salary report. -- -- c) EVENT_LOG : An autonomous procedure to store the events performed -- by the user. -- -- SAMPLE DETAILS -- -- (1) The user JOHN is the administrator with SYSADM authority. JOHN -- creates two stored procedures; UPDATE_SALARY, REPORT_GENERATE, -- and an autonomous procedure EVENT_LOG. A table EVENT_LOG is -- also created by JOHN to store all the events. -- -- (2) BOB and PAT are non-administrator users. BOB is from the Payroll -- department and has access to the TEMP_PAYROLL table and TEMP_EMPLOYEE table. -- BOB can also update the employees' salary with the help of a stored -- procedure UPDATE_SALARY. -- -- (3) The user PAT is also from the Payroll department and his job is to generate the -- reports. This is done with the help of a stored procedure REPORT_GENERATE. -- -- (4) BOB invokes the procedure UPDATE_SALARY to update the salary and PAT -- invokes the procedure REPORT_GENERATE to generate the report. -- -- (5) When PAT tries to invoke the procedure UPDATE_SALARY to access the -- TEMP_PAYROLL and TEMP_EMPLOYEE tables, an autonomous procedure EVENT_LOG is -- automatically invoked as PAT does not have sufficient privileges to -- perform this operation. Hence, the transaction is rolled back and the event -- is logged in the EVENT_TABLE. -- -- (6) Later, the administrator (JOHN) will invoke the table EVENT_LOG to track -- all the events in the EVENT_LOG table. -- -- ************************************************************************* -- *************************************************************************/ -- SET UP */ -- *************************************************************************/ -- /******************************************************/ -- /* User JOHN creates the tables */ -- /******************************************************/ -- Connect to sample database CONNECT TO sample USER john USING john12345@ echo@ echo **************************@ echo CREATE TABLES @ echo **************************@ echo@ -- Create table temp_employee under 'JOHN' schema CREATE TABLE temp_employee( empno CHAR(6), empname VARCHAR(10), lastname VARCHAR(10), workdept CHAR(3), bonus DECIMAL(9,2), hiredate DATE)@ -- Create table temp_payroll under 'JOHN' schema CREATE TABLE temp_payroll( empno CHAR(6), salary DECIMAL(9,2))@ -- Create table event_log under 'JOHN' schema. -- The event_log table stores the session user, the event performed by the user, -- the event time, and the event date. CREATE TABLE event_log( user_name VARCHAR(10), event VARCHAR(65), event_time TIME, event_date DATE)@ echo@ echo **************************@ echo INSERT DATA INTO TABLES @ echo **************************@ echo@ -- Insert data into temp_employee table from employee table INSERT INTO temp_employee VALUES ('000010', 'CHRISTINE', 'HAAS', 'A00', 1000.00, '01/01/1995')@ INSERT INTO temp_employee VALUES ('000020', 'MICHAEL', 'THOMPSON', 'B01', 800.00, '10/10/2003')@ INSERT INTO temp_employee VALUES ('000030', 'SALLY', 'KWAN', 'C01', 800.00, '04/05/2005')@ INSERT INTO temp_employee VALUES ('000050', 'JACK', 'GEYER', 'E01', 800.00, '08/17/1979')@ INSERT INTO temp_employee VALUES ('000060', 'IRVING', 'STERN', 'D11', 500.00, '09/14/2003')@ INSERT INTO temp_employee VALUES ('000070', 'EVA', 'PULASKI', 'D21', 700.00, '09/30/2005')@ INSERT INTO temp_employee VALUES ('000090', 'EILEEN', 'HENDERSON', 'E11', 600.00, '08/15/2000')@ INSERT INTO temp_employee VALUES ('000100', 'THEODORE', 'SPENSER', 'E21', 500.00, '06/19/2000')@ INSERT INTO temp_employee VALUES ('000110', 'VINCENZO', 'LUCCHESSI', 'A00', 900.00, '05/16/1988')@ -- Insert data into temp_payroll table INSERT INTO temp_payroll VALUES ('000010', 10000.500)@ INSERT INTO temp_payroll VALUES ('000020', 12000.430)@ INSERT INTO temp_payroll VALUES ('000030', 11600.600)@ INSERT INTO temp_payroll VALUES ('000050', 10560.450)@ INSERT INTO temp_payroll VALUES ('000060', 13000.500)@ INSERT INTO temp_payroll VALUES ('000070', 11640.600)@ INSERT INTO temp_payroll VALUES ('000090', 12560.450)@ INSERT INTO temp_payroll VALUES ('000100', 13894.556)@ echo@ echo **************************@ echo FETCH DATA FROM TABLES @ echo **************************@ echo@ -- Fetch data from temp_employee SELECT * FROM temp_employee@ -- Fetch data from temp_payroll SELECT * FROM temp_payroll@ echo@ echo@ echo **************************@ echo CREATE PROCEDURE event_log@ echo **************************@ echo@ echo@ -- Create autonomous procedure "event_log" to log the event. Each procedure -- will call this procedure before any operation. While calling -- event_log procedure, each procedure will pass the event name as an argument. -- "event_log" procedure inserts the event in "event_log" table. CREATE PROCEDURE event_log(IN event CHAR(1)) AUTONOMOUS LANGUAGE SQL BEGIN CASE event WHEN 'U' THEN INSERT INTO event_log VALUES(SESSION_USER, 'CALLING salary_update PROCEDURE TO UPDATE THE SALARY', CURRENT TIME, CURRENT DATE); WHEN 'S' THEN INSERT INTO event_log VALUES(SESSION_USER, 'CALLING report_generate PROCEDURE TO VIEW EMPLOYEES SALARY', CURRENT TIME, CURRENT DATE); END CASE; END@ echo@ echo@ echo *******************************@ echo CREATE PROCEDURE update_salary @ echo *******************************@ echo@ echo@ -- Create procedure "update_salary" to perform the salary update. -- Caller user passes the employees' total experience, -- work department, and new salary as arguments. The "update_salary" -- procedure will update the salary of employees' whose work department -- and total experience is equal to the passed arguments. Only the user -- BOB can update the salary. CREATE PROCEDURE update_salary (IN exp INTEGER, IN workdpt CHAR(3), IN new_salary INTEGER) LANGUAGE SQL BEGIN CALL event_log('U'); UPDATE temp_payroll SET salary = salary + new_salary WHERE empno = (SELECT empno FROM temp_employee WHERE workdept = workdpt AND (CURRENT DATE - hiredate) > exp); IF (USER <> 'BOB') THEN ROLLBACK; END IF; END@ echo@ echo@ echo *********************************@ echo CREATE PROCEDURE report_generate @ echo *********************************@ echo@ echo@ -- Create procedure "report_generate". This procedure -- will generate the report of employee salary details. Only the user -- PAT can generate the report. CREATE PROCEDURE report_generate() LANGUAGE SQL BEGIN DECLARE v_empfn CHAR(10); DECLARE v_empln CHAR(10); DECLARE v_empsal DECIMAL(9,2); DECLARE c_report_gen CURSOR; SET c_report_gen= CURSOR FOR SELECT empname, lastname, salary FROM temp_employee t1, temp_payroll t2 WHERE t1.empno = t2.empno; CALL event_log('S'); IF (USER <> 'PAT') THEN ROLLBACK; ELSE OPEN c_report_gen; CALL DBMS_OUTPUT.NEW_LINE; CALL DBMS_OUTPUT.PUT_LINE('---------------'); CALL DBMS_OUTPUT.PUT_LINE('EMPLOYEE REPORT'); CALL DBMS_OUTPUT.PUT_LINE('---------------'); CALL DBMS_OUTPUT.NEW_LINE; CALL DBMS_OUTPUT.PUT_LINE(''); CALL DBMS_OUTPUT.PUT ('EMP NAME '||' '||'LASTNAME '||' '||'SALARY'); CALL DBMS_OUTPUT.NEW_LINE; CALL DBMS_OUTPUT.PUT ('-----------'||' '||'-----------'||' '||'-----------'); CALL DBMS_OUTPUT.NEW_LINE; fetch_loop: LOOP FETCH FROM c_report_gen INTO v_empfn, v_empln, v_empsal; IF c_report_gen IS NOT FOUND THEN LEAVE fetch_loop; END IF; CALL DBMS_OUTPUT.PUT(v_empfn); CALL DBMS_OUTPUT.PUT(' '); CALL DBMS_OUTPUT.PUT(v_empln); CALL DBMS_OUTPUT.PUT(' '); CALL DBMS_OUTPUT.PUT(v_empsal); CALL DBMS_OUTPUT.NEW_LINE; END LOOP fetch_loop; CLOSE c_report_gen; END IF; END@ -- /*************************************************** -- /* GRANT EXECUTE privileges to users -- /*************************************************** echo@ echo@ echo ************************************************@ echo GRANT EXECUTE PRIVILEGES ON PROCEDURES TO USERS @ echo ************************************************@ echo@ echo@ -- Grant execute privilege to user BOB on procedure update_salary GRANT EXECUTE ON PROCEDURE update_salary TO USER bob@ -- Grant execute privilege to user BOB on procedure report_generate GRANT EXECUTE ON PROCEDURE report_generate TO USER bob@ -- Grant execute privilege to user PAT on procedure report_generate GRANT EXECUTE ON PROCEDURE report_generate TO USER pat@ -- Grant execute privilege to user PAT on procedure update_salary GRANT EXECUTE ON PROCEDURE update_salary TO USER pat@ -- RESET CONNECTION CONNECT RESET@ -- CALL PROCEDURES TO PERFORM DIFFERENT OPERATIONS@ echo@ echo@ echo ***************************************@ echo FETCH SALARY OF EMPLOYEES BEFORE @ echo CALLING update_salary STORED PROECDURE @ echo ***************************************@ echo@ echo@ -- Fetch salary of employees before calling update_salary procedure -- by user BOB. -- Connect to database CONNECT TO sample USER john USING john12345@ SELECT salary FROM temp_payroll WHERE empno = (SELECT empno FROM temp_employee WHERE workdept = 'D11' AND (CURRENT DATE - hiredate) > 5)@ -- CALL Procedure update_salary to update the salary echo@ echo User BOB calls procedure update_salary @ echo TO UPDATE THE SALARY@ echo@ -- RESET CONNECTION CONNECT RESET@ -- Connect to database CONNECT TO sample user bob using bob12345@ CALL JOHN.update_salary(5, 'D11', 2000)@ echo@ echo@ echo ***************************************@ echo FETCH SALARY OF EMPLOYEES AFTER @ echo CALLING update_salary STORED PROECDURE @ echo ***************************************@ echo@ echo@ -- Fetch salary of employees after calling update_salary procedure -- by user BOB. -- RESET CONNECTION CONNECT RESET@ -- Connect to database CONNECT TO sample user john using john12345@ SELECT salary FROM temp_payroll WHERE empno = (SELECT empno FROM temp_employee WHERE workdept = 'D11' AND (CURRENT DATE - hiredate) > 5)@ echo@ echo@ echo ****************************************@ echo USER PAT CALLS PROCEDURE report_generate@ echo TO GENERATE THE REPORTS @ echo ****************************************@ echo@ echo@ -- RESET CONNECTION CONNECT RESET@ -- Connect to sample database CONNECT TO sample user pat using pat12345@ -- CALL procedure to generate the report SET SERVEROUTPUT ON@ CALL JOHN.report_generate()@ -- The only user who has the appropriate privilege to execute the procedure -- "update_salary" is BOB. So when the user PAT invokes the procedure -- "update_salary", the procedure will check if the user is BOB. If the user -- is not BOB, all the transactions will be rolled back but the event will be -- logged as the event is passed as argument to the autonomous procedure. echo@ echo@ echo **************************************@ echo FETCH SALARY OF EMPLOYEES BEFORE @ echo CALLING update_salary STORED PROECDURE@ echo **************************************@ echo@ echo@ -- RESET CONNECTION CONNECT RESET@ -- Select salary of employees before calling update_salary procedure -- by user PAT. -- Connect to database CONNECT TO sample user john using john12345@ SELECT salary FROM temp_payroll WHERE empno = (SELECT empno FROM temp_employee WHERE workdept = 'D11' AND (CURRENT DATE - hiredate) > 5)@ echo@ echo@ echo ***************************************@ echo USER PAT CALLS PROCEDURE update_salary @ echo TO UPDATE THE SALARY @ echo ***************************************@ echo@ echo@ -- RESET CONNECTION CONNECT RESET@ -- Connect to database CONNECT TO sample user pat using pat12345@ CALL JOHN.update_salary(5, 'D11', 2000)@ echo@ echo@ echo ***************************************@ echo FETCH SALARY OF EMPLOYEES AFTER @ echo CALLING update_salary STORED PROECDURE @ echo ***************************************@ echo@ echo@ -- Select salary of employees after calling update_salary procedure -- by user PAT. -- RESET CONNECTION CONNECT RESET@ -- Connect to database CONNECT TO sample user john using john12345@ SELECT salary FROM temp_payroll WHERE empno = (SELECT empno FROM temp_employee WHERE workdept = 'D11' AND (CURRENT DATE - hiredate) > 5)@ echo@ echo The above output is expected as the session user is not BOB.@ echo So all the transactions will be rolled back and salary will @ echo remain same but the event will be logged in event_log table.@ echo@ -- RESET CONNECTION CONNECT RESET@ -- Connect to database CONNECT TO sample user bob using bob12345@ echo@ echo@ echo ****************************************@ echo USER bob CALLS PROCEDURE report_generate@ echo TO GENERATE THE REPORT @ echo ****************************************@ echo@ echo@ CALL JOHN.report_generate()@ SET SERVEROUTPUT ON@ echo@ echo The above output is expected as session user is not PAT. @ echo So report will not generate but the event will be logged in@ echo event_log table. @ echo@ -- RESET CONNECTION CONNECT RESET@ -- Track all the events. CONNECT TO sample USER john USING john12345@ echo@ echo@ echo ********************************@ echo FETCH DATA FROM event_log TABLE @ echo ********************************@ echo@ echo@ SELECT * FROM event_log@ -- Disconnect from sample database CONNECT RESET@ -- ************************************************* -- CLEAN UP -- ************************************************* echo@ echo@ echo *******************************@ echo DROP ALL TABLES AND PROCEDURES @ echo *******************************@ echo@ echo@ -- Drop tables and procedures CONNECT TO sample USER john USING john12345@ -- Drop table temp_employee DROP TABLE temp_employee@ -- Drop table temp_payroll DROP TABLE temp_payroll@ -- Drop table event_log DROP TABLE event_log@ -- Drop procedure update_salary DROP PROCEDURE update_salary@ -- Drop procedure report_generate DROP PROCEDURE report_generate@ -- Drop procedure event_log DROP PROCEDURE event_log@ -- Connect reset CONNECT RESET@
the_stack
-- 2021-02-10T12:31:20.028Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,578756,0,'Source_Currency_ID',TO_TIMESTAMP('2021-02-10 14:31:19','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Source Currency','Source Currency',TO_TIMESTAMP('2021-02-10 14:31:19','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-10T12:31:20.042Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=578756 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2021-02-10T12:32:26.316Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2021-02-10 14:32:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578756 AND AD_Language='en_US' ; -- 2021-02-10T12:32:26.403Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578756,'en_US') ; -- 2021-02-10T12:33:30.232Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FacetFilterSeqNo,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutoApplyValidationRule,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsFacetFilter,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsSelectionColumn,IsShowFilterIncrementButtons, -- IsShowFilterInline, IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence, MaxFacetsToFetch,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version ) VALUES (0,572799,578756,0,30,112,335,'Source_Currency_ID',TO_TIMESTAMP('2021-02-10 14:33:30','YYYY-MM-DD HH24:MI:SS'),100,'N','D',0,10,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N', -- 'N', 'N','N','N','Y','N', 0,'Source Currency',0,0,TO_TIMESTAMP('2021-02-10 14:33:30','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2021-02-10T12:33:30.239Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Column_ID=572799 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2021-02-10T12:33:30.246Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_Column_Translation_From_AD_Element(578756) ; -- 2021-02-10T12:33:36.903Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('C_Payment','ALTER TABLE public.C_Payment ADD COLUMN Source_Currency_ID NUMERIC(10)') ; -- 2021-02-10T12:33:37.221Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator ALTER TABLE C_Payment ADD CONSTRAINT SourceCurrency_CPayment FOREIGN KEY (Source_Currency_ID) REFERENCES public.C_Currency DEFERRABLE INITIALLY DEFERRED ; -- 2021-02-10T12:34:38.572Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DDL_NoForeignKey,Description,EntityType,FacetFilterSeqNo,FieldLength,Help,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutoApplyValidationRule,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsFacetFilter,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsSelectionColumn,IsShowFilterIncrementButtons, -- IsShowFilterInline, IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence, MaxFacetsToFetch,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version ) VALUES (0,572800,253,0,22,335,'CurrencyRate',TO_TIMESTAMP('2021-02-10 14:34:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Wechselkurs für Währung','D',0,10,'"Wechselkurs" bezeichnet den Kurs für die Umrechnung einer Ausgangswährung in eine Buchführungswährung','Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N', -- 'N', 'N','N','N','Y','N', 0,'Wechselkurs',0,0,TO_TIMESTAMP('2021-02-10 14:34:38','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2021-02-10T12:34:38.576Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Column_ID=572800 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2021-02-10T12:34:38.580Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_Column_Translation_From_AD_Element(253) ; -- 2021-02-10T12:34:38.824Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('C_Payment','ALTER TABLE public.C_Payment ADD COLUMN CurrencyRate NUMERIC') ; -- 2021-02-10T12:35:13.192Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Tab_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,IsActive,Created,CreatedBy,IsReadOnly,Updated,UpdatedBy,AD_Field_ID,IsDisplayedGrid,AD_Column_ID,EntityType,Name,AD_Org_ID) VALUES (330,'N',10,'N','N','N','N',0,'Y',TO_TIMESTAMP('2021-02-10 14:35:12','YYYY-MM-DD HH24:MI:SS'),100,'N',TO_TIMESTAMP('2021-02-10 14:35:12','YYYY-MM-DD HH24:MI:SS'),100,631589,'N',572799,'D','Source Currency',0) ; -- 2021-02-10T12:35:13.195Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Field_ID=631589 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2021-02-10T12:35:13.198Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(578756) ; -- 2021-02-10T12:35:13.220Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=631589 ; -- 2021-02-10T12:35:13.227Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(631589) ; -- 2021-02-10T12:35:22.893Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Tab_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,IsActive,Created,CreatedBy,IsReadOnly,Updated,UpdatedBy,Help,AD_Field_ID,IsDisplayedGrid,AD_Column_ID,Description,EntityType,Name,AD_Org_ID) VALUES (330,'N',10,'N','N','N','N',0,'Y',TO_TIMESTAMP('2021-02-10 14:35:22','YYYY-MM-DD HH24:MI:SS'),100,'N',TO_TIMESTAMP('2021-02-10 14:35:22','YYYY-MM-DD HH24:MI:SS'),100,'"Wechselkurs" bezeichnet den Kurs für die Umrechnung einer Ausgangswährung in eine Buchführungswährung',631590,'N',572800,'Wechselkurs für Währung','D','Wechselkurs',0) ; -- 2021-02-10T12:35:22.899Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Field_ID=631590 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2021-02-10T12:35:22.907Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(253) ; -- 2021-02-10T12:35:22.926Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=631590 ; -- 2021-02-10T12:35:22.937Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(631590) ; -- 2021-02-10T12:45:48.032Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Element_ID,AD_UI_ElementGroup_ID,AD_UI_ElementType,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayed_SideList,IsDisplayedGrid,Name,SeqNo,SeqNo_SideList,SeqNoGrid,Updated,UpdatedBy) VALUES (0,631590,0,330,577769,540064,'F',TO_TIMESTAMP('2021-02-10 14:45:47','YYYY-MM-DD HH24:MI:SS'),100,'Wechselkurs für Währung','"Wechselkurs" bezeichnet den Kurs für die Umrechnung einer Ausgangswährung in eine Buchführungswährung','Y','N','Y','N','N','Wechselkurs',100,0,0,TO_TIMESTAMP('2021-02-10 14:45:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-10T12:46:06.607Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Element_ID,AD_UI_ElementGroup_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayed_SideList,IsDisplayedGrid,Name,SeqNo,SeqNo_SideList,SeqNoGrid,Updated,UpdatedBy) VALUES (0,631589,0,330,577770,540064,'F',TO_TIMESTAMP('2021-02-10 14:46:06','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Source Currency',110,0,0,TO_TIMESTAMP('2021-02-10 14:46:06','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-10T12:47:04.188Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Source_Currency_ID/0@>0',Updated=TO_TIMESTAMP('2021-02-10 14:47:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=631589 ; -- 2021-02-10T12:47:17.174Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Source_Currency_ID/0@>0',Updated=TO_TIMESTAMP('2021-02-10 14:47:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=631590 ;
the_stack
CREATE TABLE A (x INT); -- error 42601: syntax error: near "A" CREATE TABLE ABSOLUTE (x INT); -- error 42601: syntax error: near "ABSOLUTE" CREATE TABLE ACTION (x INT); -- error 42601: syntax error: near "ACTION" CREATE TABLE ADA (x INT); -- error 42601: syntax error: near "ADA" CREATE TABLE ADD (x INT); -- error 42601: syntax error: near "ADD" CREATE TABLE ADMIN (x INT); -- error 42601: syntax error: near "ADMIN" CREATE TABLE AFTER (x INT); -- error 42601: syntax error: near "AFTER" CREATE TABLE ALWAYS (x INT); -- error 42601: syntax error: near "ALWAYS" CREATE TABLE ASC (x INT); -- error 42601: syntax error: near "ASC" CREATE TABLE ASSERTION (x INT); -- error 42601: syntax error: near "ASSERTION" CREATE TABLE ASSIGNMENT (x INT); -- error 42601: syntax error: near "ASSIGNMENT" CREATE TABLE ATTRIBUTE (x INT); -- error 42601: syntax error: near "ATTRIBUTE" CREATE TABLE ATTRIBUTES (x INT); -- error 42601: syntax error: near "ATTRIBUTES" CREATE TABLE BEFORE (x INT); -- error 42601: syntax error: near "BEFORE" CREATE TABLE BERNOULLI (x INT); -- error 42601: syntax error: near "BERNOULLI" CREATE TABLE BREADTH (x INT); -- error 42601: syntax error: near "BREADTH" CREATE TABLE C (x INT); -- error 42601: syntax error: near "C" CREATE TABLE CASCADE (x INT); -- error 42601: syntax error: near "CASCADE" CREATE TABLE CATALOG (x INT); -- error 42601: syntax error: near "CATALOG" CREATE TABLE CATALOG_NAME (x INT); -- error 42601: syntax error: near "CATALOG_NAME" CREATE TABLE CHAIN (x INT); -- error 42601: syntax error: near "CHAIN" CREATE TABLE CHAINING (x INT); -- error 42601: syntax error: near "CHAINING" CREATE TABLE CHARACTER_SET_CATALOG (x INT); -- error 42601: syntax error: near "CHARACTER_SET_CATALOG" CREATE TABLE CHARACTER_SET_NAME (x INT); -- error 42601: syntax error: near "CHARACTER_SET_NAME" CREATE TABLE CHARACTER_SET_SCHEMA (x INT); -- error 42601: syntax error: near "CHARACTER_SET_SCHEMA" CREATE TABLE CHARACTERISTICS (x INT); -- error 42601: syntax error: near "CHARACTERISTICS" CREATE TABLE CHARACTERS (x INT); -- error 42601: syntax error: near "CHARACTERS" CREATE TABLE CLASS_ORIGIN (x INT); -- error 42601: syntax error: near "CLASS_ORIGIN" CREATE TABLE COBOL (x INT); -- error 42601: syntax error: near "COBOL" CREATE TABLE COLLATION (x INT); -- error 42601: syntax error: near "COLLATION" CREATE TABLE COLLATION_CATALOG (x INT); -- error 42601: syntax error: near "COLLATION_CATALOG" CREATE TABLE COLLATION_NAME (x INT); -- error 42601: syntax error: near "COLLATION_NAME" CREATE TABLE COLLATION_SCHEMA (x INT); -- error 42601: syntax error: near "COLLATION_SCHEMA" CREATE TABLE COLUMNS (x INT); -- error 42601: syntax error: near "COLUMNS" CREATE TABLE COLUMN_NAME (x INT); -- error 42601: syntax error: near "COLUMN_NAME" CREATE TABLE COMMAND_FUNCTION (x INT); -- error 42601: syntax error: near "COMMAND_FUNCTION" CREATE TABLE COMMAND_FUNCTION_CODE (x INT); -- error 42601: syntax error: near "COMMAND_FUNCTION_CODE" CREATE TABLE COMMITTED (x INT); -- error 42601: syntax error: near "COMMITTED" CREATE TABLE CONDITIONAL (x INT); -- error 42601: syntax error: near "CONDITIONAL" CREATE TABLE CONDITION_NUMBER (x INT); -- error 42601: syntax error: near "CONDITION_NUMBER" CREATE TABLE CONNECTION (x INT); -- error 42601: syntax error: near "CONNECTION" CREATE TABLE CONNECTION_NAME (x INT); -- error 42601: syntax error: near "CONNECTION_NAME" CREATE TABLE CONSTRAINT_CATALOG (x INT); -- error 42601: syntax error: near "CONSTRAINT_CATALOG" CREATE TABLE CONSTRAINT_NAME (x INT); -- error 42601: syntax error: near "CONSTRAINT_NAME" CREATE TABLE CONSTRAINT_SCHEMA (x INT); -- error 42601: syntax error: near "CONSTRAINT_SCHEMA" CREATE TABLE CONSTRAINTS (x INT); -- error 42601: syntax error: near "CONSTRAINTS" CREATE TABLE CONSTRUCTOR (x INT); -- error 42601: syntax error: near "CONSTRUCTOR" CREATE TABLE CONTINUE (x INT); -- error 42601: syntax error: near "CONTINUE" CREATE TABLE CURSOR_NAME (x INT); -- error 42601: syntax error: near "CURSOR_NAME" CREATE TABLE DATA (x INT); -- error 42601: syntax error: near "DATA" CREATE TABLE DATETIME_INTERVAL_CODE (x INT); -- error 42601: syntax error: near "DATETIME_INTERVAL_CODE" CREATE TABLE DATETIME_INTERVAL_PRECISION (x INT); -- error 42601: syntax error: near "DATETIME_INTERVAL_PRECISION" CREATE TABLE DEFAULTS (x INT); -- error 42601: syntax error: near "DEFAULTS" CREATE TABLE DEFERRABLE (x INT); -- error 42601: syntax error: near "DEFERRABLE" CREATE TABLE DEFERRED (x INT); -- error 42601: syntax error: near "DEFERRED" CREATE TABLE DEFINED (x INT); -- error 42601: syntax error: near "DEFINED" CREATE TABLE DEFINER (x INT); -- error 42601: syntax error: near "DEFINER" CREATE TABLE DEGREE (x INT); -- error 42601: syntax error: near "DEGREE" CREATE TABLE DEPTH (x INT); -- error 42601: syntax error: near "DEPTH" CREATE TABLE DERIVED (x INT); -- error 42601: syntax error: near "DERIVED" CREATE TABLE DESC (x INT); -- error 42601: syntax error: near "DESC" CREATE TABLE DESCRIBE_CATALOG (x INT); -- error 42601: syntax error: near "DESCRIBE_CATALOG" CREATE TABLE DESCRIBE_NAME (x INT); -- error 42601: syntax error: near "DESCRIBE_NAME" CREATE TABLE DESCRIBE_PROCEDURE_SPECIFIC_CATALOG (x INT); -- error 42601: syntax error: near "DESCRIBE_PROCEDURE_SPECIFIC_CATALOG" CREATE TABLE DESCRIBE_PROCEDURE_SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "DESCRIBE_PROCEDURE_SPECIFIC_NAME" CREATE TABLE DESCRIBE_PROCEDURE_SPECIFIC_SCHEMA (x INT); -- error 42601: syntax error: near "DESCRIBE_PROCEDURE_SPECIFIC_SCHEMA" CREATE TABLE DESCRIBE_SCHEMA (x INT); -- error 42601: syntax error: near "DESCRIBE_SCHEMA" CREATE TABLE DESCRIPTOR (x INT); -- error 42601: syntax error: near "DESCRIPTOR" CREATE TABLE DIAGNOSTICS (x INT); -- error 42601: syntax error: near "DIAGNOSTICS" CREATE TABLE DISPATCH (x INT); -- error 42601: syntax error: near "DISPATCH" CREATE TABLE DOMAIN (x INT); -- error 42601: syntax error: near "DOMAIN" CREATE TABLE DYNAMIC_FUNCTION (x INT); -- error 42601: syntax error: near "DYNAMIC_FUNCTION" CREATE TABLE DYNAMIC_FUNCTION_CODE (x INT); -- error 42601: syntax error: near "DYNAMIC_FUNCTION_CODE" CREATE TABLE ENCODING (x INT); -- error 42601: syntax error: near "ENCODING" CREATE TABLE ENFORCED (x INT); -- error 42601: syntax error: near "ENFORCED" CREATE TABLE ERROR (x INT); -- error 42601: syntax error: near "ERROR" CREATE TABLE EXCLUDE (x INT); -- error 42601: syntax error: near "EXCLUDE" CREATE TABLE EXCLUDING (x INT); -- error 42601: syntax error: near "EXCLUDING" CREATE TABLE EXPRESSION (x INT); -- error 42601: syntax error: near "EXPRESSION" CREATE TABLE FINAL (x INT); -- error 42601: syntax error: near "FINAL" CREATE TABLE FINISH (x INT); -- error 42601: syntax error: near "FINISH" CREATE TABLE FINISH_CATALOG (x INT); -- error 42601: syntax error: near "FINISH_CATALOG" CREATE TABLE FINISH_NAME (x INT); -- error 42601: syntax error: near "FINISH_NAME" CREATE TABLE FINISH_PROCEDURE_SPECIFIC_CATALOG (x INT); -- error 42601: syntax error: near "FINISH_PROCEDURE_SPECIFIC_CATALOG" CREATE TABLE FINISH_PROCEDURE_SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "FINISH_PROCEDURE_SPECIFIC_NAME" CREATE TABLE FINISH_PROCEDURE_SPECIFIC_SCHEMA (x INT); -- error 42601: syntax error: near "FINISH_PROCEDURE_SPECIFIC_SCHEMA" CREATE TABLE FINISH_SCHEMA (x INT); -- error 42601: syntax error: near "FINISH_SCHEMA" CREATE TABLE FIRST (x INT); -- error 42601: syntax error: near "FIRST" CREATE TABLE FLAG (x INT); -- error 42601: syntax error: near "FLAG" CREATE TABLE FOLLOWING (x INT); -- error 42601: syntax error: near "FOLLOWING" CREATE TABLE FORMAT (x INT); -- error 42601: syntax error: near "FORMAT" CREATE TABLE FORTRAN (x INT); -- error 42601: syntax error: near "FORTRAN" CREATE TABLE FOUND (x INT); -- error 42601: syntax error: near "FOUND" CREATE TABLE FULFILL (x INT); -- error 42601: syntax error: near "FULFILL" CREATE TABLE FULFILL_CATALOG (x INT); -- error 42601: syntax error: near "FULFILL_CATALOG" CREATE TABLE FULFILL_NAME (x INT); -- error 42601: syntax error: near "FULFILL_NAME" CREATE TABLE FULFILL_PROCEDURE_SPECIFIC_CATALOG (x INT); -- error 42601: syntax error: near "FULFILL_PROCEDURE_SPECIFIC_CATALOG" CREATE TABLE FULFILL_PROCEDURE_SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "FULFILL_PROCEDURE_SPECIFIC_NAME" CREATE TABLE FULFILL_PROCEDURE_SPECIFIC_SCHEMA (x INT); -- error 42601: syntax error: near "FULFILL_PROCEDURE_SPECIFIC_SCHEMA" CREATE TABLE FULFILL_SCHEMA (x INT); -- error 42601: syntax error: near "FULFILL_SCHEMA" CREATE TABLE G (x INT); -- error 42601: syntax error: near "G" CREATE TABLE GENERAL (x INT); -- error 42601: syntax error: near "GENERAL" CREATE TABLE GENERATED (x INT); -- error 42601: syntax error: near "GENERATED" CREATE TABLE GO (x INT); -- error 42601: syntax error: near "GO" CREATE TABLE GOTO (x INT); -- error 42601: syntax error: near "GOTO" CREATE TABLE GRANTED (x INT); -- error 42601: syntax error: near "GRANTED" CREATE TABLE HAS_PASS_THROUGH_COLUMNS (x INT); -- error 42601: syntax error: near "HAS_PASS_THROUGH_COLUMNS" CREATE TABLE HAS_PASS_THRU_COLS (x INT); -- error 42601: syntax error: near "HAS_PASS_THRU_COLS" CREATE TABLE HIERARCHY (x INT); -- error 42601: syntax error: near "HIERARCHY" CREATE TABLE IGNORE (x INT); -- error 42601: syntax error: near "IGNORE" CREATE TABLE IMMEDIATE (x INT); -- error 42601: syntax error: near "IMMEDIATE" CREATE TABLE IMMEDIATELY (x INT); -- error 42601: syntax error: near "IMMEDIATELY" CREATE TABLE IMPLEMENTATION (x INT); -- error 42601: syntax error: near "IMPLEMENTATION" CREATE TABLE INCLUDING (x INT); -- error 42601: syntax error: near "INCLUDING" CREATE TABLE INCREMENT (x INT); -- error 42601: syntax error: near "INCREMENT" CREATE TABLE INITIALLY (x INT); -- error 42601: syntax error: near "INITIALLY" CREATE TABLE INPUT (x INT); -- error 42601: syntax error: near "INPUT" CREATE TABLE INSTANCE (x INT); -- error 42601: syntax error: near "INSTANCE" CREATE TABLE INSTANTIABLE (x INT); -- error 42601: syntax error: near "INSTANTIABLE" CREATE TABLE INSTEAD (x INT); -- error 42601: syntax error: near "INSTEAD" CREATE TABLE INVOKER (x INT); -- error 42601: syntax error: near "INVOKER" CREATE TABLE ISOLATION (x INT); -- error 42601: syntax error: near "ISOLATION" CREATE TABLE IS_PRUNABLE (x INT); -- error 42601: syntax error: near "IS_PRUNABLE" CREATE TABLE JSON (x INT); -- error 42601: syntax error: near "JSON" CREATE TABLE K (x INT); -- error 42601: syntax error: near "K" CREATE TABLE KEEP (x INT); -- error 42601: syntax error: near "KEEP" CREATE TABLE KEY (x INT); -- error 42601: syntax error: near "KEY" CREATE TABLE KEYS (x INT); -- error 42601: syntax error: near "KEYS" CREATE TABLE KEY_MEMBER (x INT); -- error 42601: syntax error: near "KEY_MEMBER" CREATE TABLE KEY_TYPE (x INT); -- error 42601: syntax error: near "KEY_TYPE" CREATE TABLE LAST (x INT); -- error 42601: syntax error: near "LAST" CREATE TABLE LENGTH (x INT); -- error 42601: syntax error: near "LENGTH" CREATE TABLE LEVEL (x INT); -- error 42601: syntax error: near "LEVEL" CREATE TABLE LOCATOR (x INT); -- error 42601: syntax error: near "LOCATOR" CREATE TABLE M (x INT); -- error 42601: syntax error: near "M" CREATE TABLE MAP (x INT); -- error 42601: syntax error: near "MAP" CREATE TABLE MATCHED (x INT); -- error 42601: syntax error: near "MATCHED" CREATE TABLE MAXVALUE (x INT); -- error 42601: syntax error: near "MAXVALUE" CREATE TABLE MESSAGE_LENGTH (x INT); -- error 42601: syntax error: near "MESSAGE_LENGTH" CREATE TABLE MESSAGE_OCTET_LENGTH (x INT); -- error 42601: syntax error: near "MESSAGE_OCTET_LENGTH" CREATE TABLE MESSAGE_TEXT (x INT); -- error 42601: syntax error: near "MESSAGE_TEXT" CREATE TABLE MINVALUE (x INT); -- error 42601: syntax error: near "MINVALUE" CREATE TABLE MORE (x INT); -- error 42601: syntax error: near "MORE" CREATE TABLE MUMPS (x INT); -- error 42601: syntax error: near "MUMPS" CREATE TABLE NAME (x INT); -- error 42601: syntax error: near "NAME" CREATE TABLE NAMES (x INT); -- error 42601: syntax error: near "NAMES" CREATE TABLE NESTED (x INT); -- error 42601: syntax error: near "NESTED" CREATE TABLE NESTING (x INT); -- error 42601: syntax error: near "NESTING" CREATE TABLE NEXT (x INT); -- error 42601: syntax error: near "NEXT" CREATE TABLE NFC (x INT); -- error 42601: syntax error: near "NFC" CREATE TABLE NFD (x INT); -- error 42601: syntax error: near "NFD" CREATE TABLE NFKC (x INT); -- error 42601: syntax error: near "NFKC" CREATE TABLE NFKD (x INT); -- error 42601: syntax error: near "NFKD" CREATE TABLE NORMALIZED (x INT); -- error 42601: syntax error: near "NORMALIZED" CREATE TABLE NULLABLE (x INT); -- error 42601: syntax error: near "NULLABLE" CREATE TABLE NULLS (x INT); -- error 42601: syntax error: near "NULLS" CREATE TABLE NUMBER (x INT); -- error 42601: syntax error: near "NUMBER" CREATE TABLE OBJECT (x INT); -- error 42601: syntax error: near "OBJECT" CREATE TABLE OCTETS (x INT); -- error 42601: syntax error: near "OCTETS" CREATE TABLE OPTION (x INT); -- error 42601: syntax error: near "OPTION" CREATE TABLE OPTIONS (x INT); -- error 42601: syntax error: near "OPTIONS" CREATE TABLE ORDERING (x INT); -- error 42601: syntax error: near "ORDERING" CREATE TABLE ORDINALITY (x INT); -- error 42601: syntax error: near "ORDINALITY" CREATE TABLE OTHERS (x INT); -- error 42601: syntax error: near "OTHERS" CREATE TABLE OUTPUT (x INT); -- error 42601: syntax error: near "OUTPUT" CREATE TABLE OVERFLOW (x INT); -- error 42601: syntax error: near "OVERFLOW" CREATE TABLE OVERRIDING (x INT); -- error 42601: syntax error: near "OVERRIDING" CREATE TABLE P (x INT); -- error 42601: syntax error: near "P" CREATE TABLE PAD (x INT); -- error 42601: syntax error: near "PAD" CREATE TABLE PARAMETER_MODE (x INT); -- error 42601: syntax error: near "PARAMETER_MODE" CREATE TABLE PARAMETER_NAME (x INT); -- error 42601: syntax error: near "PARAMETER_NAME" CREATE TABLE PARAMETER_ORDINAL_POSITION (x INT); -- error 42601: syntax error: near "PARAMETER_ORDINAL_POSITION" CREATE TABLE PARAMETER_SPECIFIC_CATALOG (x INT); -- error 42601: syntax error: near "PARAMETER_SPECIFIC_CATALOG" CREATE TABLE PARAMETER_SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "PARAMETER_SPECIFIC_NAME" CREATE TABLE PARAMETER_SPECIFIC_SCHEMA (x INT); -- error 42601: syntax error: near "PARAMETER_SPECIFIC_SCHEMA" CREATE TABLE PARTIAL (x INT); -- error 42601: syntax error: near "PARTIAL" CREATE TABLE PASCAL (x INT); -- error 42601: syntax error: near "PASCAL" CREATE TABLE PASS (x INT); -- error 42601: syntax error: near "PASS" CREATE TABLE PASSING (x INT); -- error 42601: syntax error: near "PASSING" CREATE TABLE PAST (x INT); -- error 42601: syntax error: near "PAST" CREATE TABLE PATH (x INT); -- error 42601: syntax error: near "PATH" CREATE TABLE PLACING (x INT); -- error 42601: syntax error: near "PLACING" CREATE TABLE PLAN (x INT); -- error 42601: syntax error: near "PLAN" CREATE TABLE PLI (x INT); -- error 42601: syntax error: near "PLI" CREATE TABLE PRECEDING (x INT); -- error 42601: syntax error: near "PRECEDING" CREATE TABLE PRESERVE (x INT); -- error 42601: syntax error: near "PRESERVE" CREATE TABLE PRIOR (x INT); -- error 42601: syntax error: near "PRIOR" CREATE TABLE PRIVATE (x INT); -- error 42601: syntax error: near "PRIVATE" CREATE TABLE PRIVATE_PARAMETERS (x INT); -- error 42601: syntax error: near "PRIVATE_PARAMETERS" CREATE TABLE PRIVATE_PARAMS_S (x INT); -- error 42601: syntax error: near "PRIVATE_PARAMS_S" CREATE TABLE PRIVILEGES (x INT); -- error 42601: syntax error: near "PRIVILEGES" CREATE TABLE PRUNE (x INT); -- error 42601: syntax error: near "PRUNE" CREATE TABLE PUBLIC (x INT); -- error 42601: syntax error: near "PUBLIC" CREATE TABLE QUOTES (x INT); -- error 42601: syntax error: near "QUOTES" CREATE TABLE READ (x INT); -- error 42601: syntax error: near "READ" CREATE TABLE RELATIVE (x INT); -- error 42601: syntax error: near "RELATIVE" CREATE TABLE REPEATABLE (x INT); -- error 42601: syntax error: near "REPEATABLE" CREATE TABLE RESPECT (x INT); -- error 42601: syntax error: near "RESPECT" CREATE TABLE RESTART (x INT); -- error 42601: syntax error: near "RESTART" CREATE TABLE RESTRICT (x INT); -- error 42601: syntax error: near "RESTRICT" CREATE TABLE RETURNED_CARDINALITY (x INT); -- error 42601: syntax error: near "RETURNED_CARDINALITY" CREATE TABLE RETURNED_LENGTH (x INT); -- error 42601: syntax error: near "RETURNED_LENGTH" CREATE TABLE RETURNED_OCTET_LENGTH (x INT); -- error 42601: syntax error: near "RETURNED_OCTET_LENGTH" CREATE TABLE RETURNED_SQLSTATE (x INT); -- error 42601: syntax error: near "RETURNED_SQLSTATE" CREATE TABLE RETURNING (x INT); -- error 42601: syntax error: near "RETURNING" CREATE TABLE RETURNS_ONLY_PASS_THROUGH (x INT); -- error 42601: syntax error: near "RETURNS_ONLY_PASS_THROUGH" CREATE TABLE RET_ONLY_PASS_THRU (x INT); -- error 42601: syntax error: near "RET_ONLY_PASS_THRU" CREATE TABLE ROLE (x INT); -- error 42601: syntax error: near "ROLE" CREATE TABLE ROUTINE (x INT); -- error 42601: syntax error: near "ROUTINE" CREATE TABLE ROUTINE_CATALOG (x INT); -- error 42601: syntax error: near "ROUTINE_CATALOG" CREATE TABLE ROUTINE_NAME (x INT); -- error 42601: syntax error: near "ROUTINE_NAME" CREATE TABLE ROUTINE_SCHEMA (x INT); -- error 42601: syntax error: near "ROUTINE_SCHEMA" CREATE TABLE ROW_COUNT (x INT); -- error 42601: syntax error: near "ROW_COUNT" CREATE TABLE SCALAR (x INT); -- error 42601: syntax error: near "SCALAR" CREATE TABLE SCALE (x INT); -- error 42601: syntax error: near "SCALE" CREATE TABLE SCHEMA (x INT); -- error 42601: syntax error: near "SCHEMA" CREATE TABLE SCHEMA_NAME (x INT); -- error 42601: syntax error: near "SCHEMA_NAME" CREATE TABLE SCOPE_CATALOG (x INT); -- error 42601: syntax error: near "SCOPE_CATALOG" CREATE TABLE SCOPE_NAME (x INT); -- error 42601: syntax error: near "SCOPE_NAME" CREATE TABLE SCOPE_SCHEMA (x INT); -- error 42601: syntax error: near "SCOPE_SCHEMA" CREATE TABLE SECTION (x INT); -- error 42601: syntax error: near "SECTION" CREATE TABLE SECURITY (x INT); -- error 42601: syntax error: near "SECURITY" CREATE TABLE SELF (x INT); -- error 42601: syntax error: near "SELF" CREATE TABLE SEQUENCE (x INT); -- error 42601: syntax error: near "SEQUENCE" CREATE TABLE SERIALIZABLE (x INT); -- error 42601: syntax error: near "SERIALIZABLE" CREATE TABLE SERVER_NAME (x INT); -- error 42601: syntax error: near "SERVER_NAME" CREATE TABLE SESSION (x INT); -- error 42601: syntax error: near "SESSION" CREATE TABLE SETS (x INT); -- error 42601: syntax error: near "SETS" CREATE TABLE SIMPLE (x INT); -- error 42601: syntax error: near "SIMPLE" CREATE TABLE SIZE (x INT); -- error 42601: syntax error: near "SIZE" CREATE TABLE SOURCE (x INT); -- error 42601: syntax error: near "SOURCE" CREATE TABLE SPACE (x INT); -- error 42601: syntax error: near "SPACE" CREATE TABLE SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "SPECIFIC_NAME" CREATE TABLE START_CATALOG (x INT); -- error 42601: syntax error: near "START_CATALOG" CREATE TABLE START_NAME (x INT); -- error 42601: syntax error: near "START_NAME" CREATE TABLE START_PROCEDURE_SPECIFIC_CATALOG (x INT); -- error 42601: syntax error: near "START_PROCEDURE_SPECIFIC_CATALOG" CREATE TABLE START_PROCEDURE_SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "START_PROCEDURE_SPECIFIC_NAME" CREATE TABLE START_PROCEDURE_SPECIFIC_SCHEMA (x INT); -- error 42601: syntax error: near "START_PROCEDURE_SPECIFIC_SCHEMA" CREATE TABLE START_SCHEMA (x INT); -- error 42601: syntax error: near "START_SCHEMA" CREATE TABLE STATE (x INT); -- error 42601: syntax error: near "STATE" CREATE TABLE STATEMENT (x INT); -- error 42601: syntax error: near "STATEMENT" CREATE TABLE STRING (x INT); -- error 42601: syntax error: near "STRING" CREATE TABLE STRUCTURE (x INT); -- error 42601: syntax error: near "STRUCTURE" CREATE TABLE STYLE (x INT); -- error 42601: syntax error: near "STYLE" CREATE TABLE SUBCLASS_ORIGIN (x INT); -- error 42601: syntax error: near "SUBCLASS_ORIGIN" CREATE TABLE T (x INT); -- error 42601: syntax error: near "T" CREATE TABLE TABLE_NAME (x INT); -- error 42601: syntax error: near "TABLE_NAME" CREATE TABLE TABLE_SEMANTICS (x INT); -- error 42601: syntax error: near "TABLE_SEMANTICS" CREATE TABLE TEMPORARY (x INT); -- error 42601: syntax error: near "TEMPORARY" CREATE TABLE THROUGH (x INT); -- error 42601: syntax error: near "THROUGH" CREATE TABLE TIES (x INT); -- error 42601: syntax error: near "TIES" CREATE TABLE TOP_LEVEL_COUNT (x INT); -- error 42601: syntax error: near "TOP_LEVEL_COUNT" CREATE TABLE TRANSACTION (x INT); -- error 42601: syntax error: near "TRANSACTION" CREATE TABLE TRANSACTION_ACTIVE (x INT); -- error 42601: syntax error: near "TRANSACTION_ACTIVE" CREATE TABLE TRANSACTIONS_COMMITTED (x INT); -- error 42601: syntax error: near "TRANSACTIONS_COMMITTED" CREATE TABLE TRANSACTIONS_ROLLED_BACK (x INT); -- error 42601: syntax error: near "TRANSACTIONS_ROLLED_BACK" CREATE TABLE TRANSFORM (x INT); -- error 42601: syntax error: near "TRANSFORM" CREATE TABLE TRANSFORMS (x INT); -- error 42601: syntax error: near "TRANSFORMS" CREATE TABLE TRIGGER_CATALOG (x INT); -- error 42601: syntax error: near "TRIGGER_CATALOG" CREATE TABLE TRIGGER_NAME (x INT); -- error 42601: syntax error: near "TRIGGER_NAME" CREATE TABLE TRIGGER_SCHEMA (x INT); -- error 42601: syntax error: near "TRIGGER_SCHEMA" CREATE TABLE TYPE (x INT); -- error 42601: syntax error: near "TYPE" CREATE TABLE UNBOUNDED (x INT); -- error 42601: syntax error: near "UNBOUNDED" CREATE TABLE UNCOMMITTED (x INT); -- error 42601: syntax error: near "UNCOMMITTED" CREATE TABLE UNCONDITIONAL (x INT); -- error 42601: syntax error: near "UNCONDITIONAL" CREATE TABLE UNDER (x INT); -- error 42601: syntax error: near "UNDER" CREATE TABLE UNNAMED (x INT); -- error 42601: syntax error: near "UNNAMED" CREATE TABLE USAGE (x INT); -- error 42601: syntax error: near "USAGE" CREATE TABLE USER_DEFINED_TYPE_CATALOG (x INT); -- error 42601: syntax error: near "USER_DEFINED_TYPE_CATALOG" CREATE TABLE USER_DEFINED_TYPE_CODE (x INT); -- error 42601: syntax error: near "USER_DEFINED_TYPE_CODE" CREATE TABLE USER_DEFINED_TYPE_NAME (x INT); -- error 42601: syntax error: near "USER_DEFINED_TYPE_NAME" CREATE TABLE USER_DEFINED_TYPE_SCHEMA (x INT); -- error 42601: syntax error: near "USER_DEFINED_TYPE_SCHEMA" CREATE TABLE UTF16 (x INT); -- error 42601: syntax error: near "UTF16" CREATE TABLE UTF32 (x INT); -- error 42601: syntax error: near "UTF32" CREATE TABLE UTF8 (x INT); -- error 42601: syntax error: near "UTF8" CREATE TABLE VIEW (x INT); -- error 42601: syntax error: near "VIEW" CREATE TABLE WORK (x INT); -- error 42601: syntax error: near "WORK" CREATE TABLE WRAPPER (x INT); -- error 42601: syntax error: near "WRAPPER" CREATE TABLE WRITE (x INT); -- error 42601: syntax error: near "WRITE" CREATE TABLE ZONE (x INT); -- error 42601: syntax error: near "ZONE" CREATE TABLE absolute (x INT); -- error 42601: syntax error: near "ABSOLUTE" CREATE TABLE t2 (absolute INT); -- error 42601: syntax error: near "ABSOLUTE"
the_stack
SET search_path = 'musicbrainz', 'public'; BEGIN; \ir ../sql/artist_release_sample_data.sql INSERT INTO artist_release SELECT * FROM get_artist_release_rows(NULL); INSERT INTO artist_release_group SELECT * FROM get_artist_release_group_rows(NULL); SET CONSTRAINTS ALL IMMEDIATE; SELECT no_plan(); PREPARE sorted_artist_releases AS SELECT jsonb_strip_nulls(jsonb_build_object( 'is_track_artist', is_track_artist, 'artist', artist, 'first_release_date', first_release_date, 'catalog_numbers', catalog_numbers, 'country_code', country_code, 'barcode', barcode, 'sort_character', sort_character, 'release', release )) FROM artist_release ORDER BY is_track_artist, artist, first_release_date NULLS LAST, catalog_numbers NULLS LAST, country_code NULLS LAST, barcode NULLS LAST, sort_character; PREPARE sorted_artist_release_groups AS SELECT jsonb_strip_nulls(jsonb_build_object( 'is_track_artist', is_track_artist, 'artist', artist, 'unofficial', unofficial, 'primary_type', primary_type, 'secondary_types', secondary_types, 'first_release_date', first_release_date, 'sort_character', sort_character, 'release_group', release_group )) FROM artist_release_group ORDER BY is_track_artist, artist, unofficial, primary_type NULLS FIRST, secondary_types NULLS FIRST, first_release_date NULLS LAST, sort_character; SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB) $$ ); SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "sort_character": "A", "release": 1 }'::JSONB) $$ ); -- Test a_ins_release_slave_safe AFTER INSERT ON release SET CONSTRAINTS ALL DEFERRED; INSERT INTO release VALUES (2, '03475f88-adef-4bed-a3e4-01bd5b48f4ea', 'A', 60, 1, NULL, NULL, NULL, NULL, NULL, '', 0, -1, '2021-04-19 16:17:32.986082+00'); -- Constraints are set to IMMEDIATE in order to apply the changes from -- the *_pending_update tables. This would normally happen at the end -- of the transaction. (We first make sure they're reset to DEFERRED -- above, otherwise the triggers meant to be DEFERRED may actually -- run first and find that the *_pending_update tables are empty.) SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "sort_character": "A", "release": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "sort_character": "A", "release": 2 }'::JSONB) $$ ); -- Test a_ins_track_slave_safe AFTER INSERT ON track SET CONSTRAINTS ALL DEFERRED; INSERT INTO medium (id, release, position, format, name, edits_pending, last_updated, track_count) VALUES (1, 2, 1, 1, 'A', 0, now(), 1); INSERT INTO recording (id, gid, name, artist_credit, length, comment, edits_pending, last_updated, video) VALUES (1, '939e34d3-0aea-41d9-b296-b095993fbfe8', 'A', 2046742, 300000, '', 0, now(), FALSE); INSERT INTO track (id, gid, recording, medium, position, number, name, artist_credit, length, edits_pending, last_updated, is_data_track) VALUES (1, 'b9d1c753-bf42-4010-a894-5d3f8fab7bfd', 1, 1, 1, '1', 'A', 2046742, 300000, 0, now(), FALSE); SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "sort_character": "A", "release": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "sort_character": "A", "release": 2 }'::JSONB) $$ ); SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB) $$ ); -- Test a_ins_release_group_slave_safe AFTER INSERT ON release_group SET CONSTRAINTS ALL DEFERRED; INSERT INTO musicbrainz.release_group (id, gid, name, artist_credit, type, comment, edits_pending, last_updated) VALUES (2, '914a7adf-a4c0-4161-919b-21712d38cf1a', 'A', 60, NULL, '', 0, now()); SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB) $$ ); -- Test a_upd_release_slave_safe AFTER UPDATE ON release SET CONSTRAINTS ALL DEFERRED; UPDATE release SET name = 'B' WHERE id = 1; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "sort_character": "A", "release": 2 }'::JSONB) $$ ); SET CONSTRAINTS ALL DEFERRED; UPDATE release SET barcode = '1234567890' WHERE id = 1; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "sort_character": "A", "release": 2 }'::JSONB) $$ ); SET CONSTRAINTS ALL DEFERRED; UPDATE release SET release_group = 2, status = 2 WHERE id = 1; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "unofficial": true, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB) $$ ); SET CONSTRAINTS ALL DEFERRED; UPDATE release SET artist_credit = 2046742 WHERE id = 2; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 2107, "sort_character": "A", "release": 2 }'::JSONB) $$ ); SET CONSTRAINTS ALL DEFERRED; UPDATE release SET artist_credit = 60 WHERE id = 2; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "sort_character": "A", "release": 2 }'::JSONB) $$ ); -- Test a_upd_track_slave_safe AFTER UPDATE ON track SET CONSTRAINTS ALL DEFERRED; UPDATE track SET artist_credit = 2060761 WHERE id = 1; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "sort_character": "A", "release": 2 }'::JSONB) $$ ); SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "unofficial": true, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB) $$ ); -- Test a_ins_release_country_slave_safe AFTER INSERT ON release_country SET CONSTRAINTS ALL DEFERRED; INSERT INTO release_country (release, country) VALUES (2, 38); SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "country_code": "CA", "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "country_code": "CA", "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "country_code": "CA", "sort_character": "A", "release": 2 }'::JSONB) $$ ); -- Test a_upd_release_country_slave_safe AFTER UPDATE ON release_country SET CONSTRAINTS ALL DEFERRED; UPDATE release_country SET country = 222 WHERE release = 2; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "country_code": "US", "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "country_code": "US", "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "country_code": "US", "sort_character": "A", "release": 2 }'::JSONB) $$ ); -- Test a_del_release_country_slave_safe AFTER DELETE ON release_country SET CONSTRAINTS ALL DEFERRED; DELETE FROM release_country WHERE release = 2; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "sort_character": "A", "release": 2 }'::JSONB) $$ ); -- Test a_ins_release_label_slave_safe AFTER INSERT ON release_label SET CONSTRAINTS ALL DEFERRED; INSERT INTO release_label (release, label, catalog_number) VALUES (2, 95, 'ABC-123'), (2, 95, 'ABC-456'); SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "catalog_numbers": ["ABC-123", "ABC-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "catalog_numbers": ["ABC-123", "ABC-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "catalog_numbers": ["ABC-123", "ABC-456"], "sort_character": "A", "release": 2 }'::JSONB) $$ ); -- Test a_upd_release_label_slave_safe AFTER UPDATE ON release_label SET CONSTRAINTS ALL DEFERRED; UPDATE release_label SET catalog_number = 'DEF-456' WHERE catalog_number = 'ABC-456'; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "catalog_numbers": ["ABC-123", "DEF-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "catalog_numbers": ["ABC-123", "DEF-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "catalog_numbers": ["ABC-123", "DEF-456"], "sort_character": "A", "release": 2 }'::JSONB) $$ ); -- Test a_del_release_label_slave_safe AFTER DELETE ON release_label SET CONSTRAINTS ALL DEFERRED; DELETE FROM release_label WHERE catalog_number = 'ABC-123'; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB) $$ ); -- Test a_ins_release_first_release_date_slave_safe AFTER INSERT ON release_first_release_date SET CONSTRAINTS ALL DEFERRED; INSERT INTO release_unknown_country (release, date_year, date_month, date_day) VALUES (1, 1990, 1, 1); SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "first_release_date": 19900101, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB) $$ ); SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "first_release_date": 19900101, "unofficial": true, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB) $$ ); -- Test a_upd_release_first_release_date_slave_safe AFTER UPDATE ON release_first_release_date -- Test a_upd_release_group_meta_slave_safe AFTER UPDATE ON release_group_meta SET CONSTRAINTS ALL DEFERRED; INSERT INTO release_country (release, country, date_year, date_month, date_day) VALUES (1, 38, 1989, 1, 1); SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "country_code": "CA", "first_release_date": 19890101, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB) $$ ); SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "first_release_date": 19890101, "unofficial": true, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB) $$ ); -- Test a_del_release_first_release_date_slave_safe AFTER DELETE ON release_first_release_date SET CONSTRAINTS ALL DEFERRED; DELETE FROM release_country WHERE release = 1; DELETE FROM release_unknown_country WHERE release = 1; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB) $$ ); SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "unofficial": true, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "unofficial": false, "sort_character": "A", "release_group": 1 }'::JSONB) $$ ); -- Test a_ins_release_group_secondary_type_join_slave_safe AFTER INSERT ON release_group_secondary_type_join SET CONSTRAINTS ALL DEFERRED; INSERT INTO release_group_secondary_type_join (release_group, secondary_type) VALUES (1, 1), (1, 2); SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "secondary_types": [1, 2], "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "unofficial": true, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "unofficial": false, "secondary_types": [1, 2], "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "unofficial": false, "secondary_types": [1, 2], "sort_character": "A", "release_group": 1 }'::JSONB) $$ ); -- Test a_del_release_group_secondary_type_join_slave_safe AFTER DELETE ON release_group_secondary_type_join SET CONSTRAINTS ALL DEFERRED; DELETE FROM release_group_secondary_type_join WHERE release_group = 1 AND secondary_type = 1; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "secondary_types": [2], "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "unofficial": true, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "unofficial": false, "secondary_types": [2], "sort_character": "A", "release_group": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "unofficial": false, "secondary_types": [2], "sort_character": "A", "release_group": 1 }'::JSONB) $$ ); -- Test a_upd_release_group_slave_safe AFTER UPDATE ON release_group SET CONSTRAINTS ALL DEFERRED; UPDATE release_group SET name = 'B' WHERE id = 1; UPDATE release_group SET type = 1, artist_credit = 2046742 WHERE id = 2; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "secondary_types": [2], "sort_character": "B", "release_group": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "primary_type": 1, "unofficial": true, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 2107, "primary_type": 1, "unofficial": true, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": true, "artist": 197, "unofficial": false, "secondary_types": [2], "sort_character": "B", "release_group": 1 }'::JSONB), ('{ "is_track_artist": true, "artist": 2107, "unofficial": false, "secondary_types": [2], "sort_character": "B", "release_group": 1 }'::JSONB) $$ ); -- Test a_del_track_slave_safe AFTER DELETE ON track SET CONSTRAINTS ALL DEFERRED; DELETE FROM track WHERE id = 1; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "barcode": 1234567890, "sort_character": "B", "release": 1 }'::JSONB) $$ ); SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "secondary_types": [2], "sort_character": "B", "release_group": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "primary_type": 1, "unofficial": true, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 2107, "primary_type": 1, "unofficial": true, "sort_character": "A", "release_group": 2 }'::JSONB) $$ ); -- Test a_del_release_slave_safe AFTER DELETE ON release SET CONSTRAINTS ALL DEFERRED; DELETE FROM release WHERE id = 1; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_releases', $$VALUES ('{ "is_track_artist": false, "artist": 60, "catalog_numbers": ["DEF-456"], "sort_character": "A", "release": 2 }'::JSONB) $$ ); SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "secondary_types": [2], "sort_character": "B", "release_group": 1 }'::JSONB), ('{ "is_track_artist": false, "artist": 60, "primary_type": 1, "unofficial": false, "sort_character": "A", "release_group": 2 }'::JSONB), ('{ "is_track_artist": false, "artist": 2107, "primary_type": 1, "unofficial": false, "sort_character": "A", "release_group": 2 }'::JSONB) $$ ); -- Test a_del_release_group_slave_safe AFTER DELETE ON release_group SET CONSTRAINTS ALL DEFERRED; DELETE FROM release_group WHERE id = 2; SET CONSTRAINTS ALL IMMEDIATE; SELECT results_eq( 'sorted_artist_release_groups', $$VALUES ('{ "is_track_artist": false, "artist": 60, "unofficial": false, "secondary_types": [2], "sort_character": "B", "release_group": 1 }'::JSONB) $$ ); SELECT finish(); ROLLBACK;
the_stack
SET @sName = 'bx_timeline'; -- TABLES CREATE TABLE IF NOT EXISTS `bx_timeline_events` ( `id` int(11) NOT NULL auto_increment, `owner_id` int(11) unsigned NOT NULL default '0', `type` varchar(255) NOT NULL, `action` varchar(255) NOT NULL, `object_id` text NOT NULL, `object_privacy_view` int(11) NOT NULL default '3', `content` text NOT NULL, `title` varchar(255) NOT NULL, `description` text NOT NULL, `views` int(11) unsigned NOT NULL default '0', `rate` float NOT NULL default '0', `votes` int(11) unsigned NOT NULL default '0', `score` int(11) NOT NULL default '0', `sc_up` int(11) NOT NULL default '0', `sc_down` int(11) NOT NULL default '0', `comments` int(11) unsigned NOT NULL default '0', `reports` int(11) unsigned NOT NULL default '0', `reposts` int(11) unsigned NOT NULL default '0', `date` int(11) NOT NULL default '0', `active` tinyint(4) NOT NULL default '1', `hidden` tinyint(4) NOT NULL default '0', `pinned` int(11) NOT NULL default '0', `promoted` int(11) NOT NULL default '0', PRIMARY KEY (`id`), KEY `owner_id` (`owner_id`), FULLTEXT KEY `search_fields` (`title`, `description`) ); CREATE TABLE IF NOT EXISTS `bx_timeline_handlers` ( `id` int(11) NOT NULL auto_increment, `group` varchar(64) NOT NULL default '', `type` enum('insert','update','delete') NOT NULL DEFAULT 'insert', `alert_unit` varchar(64) NOT NULL default '', `alert_action` varchar(64) NOT NULL default '', `content` text NOT NULL, `privacy` varchar(64) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE `handler` (`group`, `type`), UNIQUE `alert` (`alert_unit`, `alert_action`) ); INSERT INTO `bx_timeline_handlers`(`group`, `type`, `alert_unit`, `alert_action`, `content`) VALUES ('common_post', 'insert', 'timeline_common_post', '', ''), ('common_repost', 'insert', 'timeline_common_repost', '', ''), ('profile', 'delete', 'profile', 'delete', ''); -- TABLES: STORAGES, TRANSCODERS, UPLOADERS CREATE TABLE IF NOT EXISTS `bx_timeline_photos` ( `id` int(11) NOT NULL AUTO_INCREMENT, `profile_id` int(10) unsigned NOT NULL, `remote_id` varchar(128) NOT NULL, `path` varchar(255) NOT NULL, `file_name` varchar(255) NOT NULL, `mime_type` varchar(128) NOT NULL, `ext` varchar(32) NOT NULL, `size` int(11) NOT NULL, `added` int(11) NOT NULL, `modified` int(11) NOT NULL, `private` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `remote_id` (`remote_id`) ); CREATE TABLE IF NOT EXISTS `bx_timeline_photos_processed` ( `id` int(11) NOT NULL AUTO_INCREMENT, `profile_id` int(10) unsigned NOT NULL, `remote_id` varchar(128) NOT NULL, `path` varchar(255) NOT NULL, `file_name` varchar(255) NOT NULL, `mime_type` varchar(128) NOT NULL, `ext` varchar(32) NOT NULL, `size` int(11) NOT NULL, `added` int(11) NOT NULL, `modified` int(11) NOT NULL, `private` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `remote_id` (`remote_id`) ); CREATE TABLE IF NOT EXISTS `bx_timeline_photos2events` ( `id` int(11) NOT NULL AUTO_INCREMENT, `event_id` int(11) NOT NULL DEFAULT '0', `media_id` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `media` (`event_id`, `media_id`) ); CREATE TABLE IF NOT EXISTS `bx_timeline_videos` ( `id` int(11) NOT NULL AUTO_INCREMENT, `profile_id` int(10) unsigned NOT NULL, `remote_id` varchar(128) NOT NULL, `path` varchar(255) NOT NULL, `file_name` varchar(255) NOT NULL, `mime_type` varchar(128) NOT NULL, `ext` varchar(32) NOT NULL, `size` int(11) NOT NULL, `added` int(11) NOT NULL, `modified` int(11) NOT NULL, `private` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `remote_id` (`remote_id`) ); CREATE TABLE IF NOT EXISTS `bx_timeline_videos_processed` ( `id` int(11) NOT NULL AUTO_INCREMENT, `profile_id` int(10) unsigned NOT NULL, `remote_id` varchar(128) NOT NULL, `path` varchar(255) NOT NULL, `file_name` varchar(255) NOT NULL, `mime_type` varchar(128) NOT NULL, `ext` varchar(32) NOT NULL, `size` int(11) NOT NULL, `added` int(11) NOT NULL, `modified` int(11) NOT NULL, `private` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `remote_id` (`remote_id`) ); CREATE TABLE IF NOT EXISTS `bx_timeline_videos2events` ( `id` int(11) NOT NULL AUTO_INCREMENT, `event_id` int(11) NOT NULL DEFAULT '0', `media_id` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `media` (`event_id`, `media_id`) ); -- TABLES: LINKS CREATE TABLE IF NOT EXISTS `bx_timeline_links` ( `id` int(11) NOT NULL AUTO_INCREMENT, `profile_id` int(10) unsigned NOT NULL, `media_id` int(11) NOT NULL DEFAULT '0', `url` varchar(255) NOT NULL, `title` varchar(255) NOT NULL, `text` text NOT NULL, `added` int(11) NOT NULL, PRIMARY KEY (`id`) ); CREATE TABLE IF NOT EXISTS `bx_timeline_links2events` ( `id` int(11) NOT NULL AUTO_INCREMENT, `event_id` int(11) NOT NULL DEFAULT '0', `link_id` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `link` (`event_id`, `link_id`) ); -- TABLES: REPOSTS CREATE TABLE IF NOT EXISTS `bx_timeline_reposts_track` ( `event_id` int(11) NOT NULL default '0', `author_id` int(11) NOT NULL default '0', `author_nip` int(11) unsigned NOT NULL default '0', `reposted_id` int(11) NOT NULL default '0', `date` int(11) NOT NULL default '0', UNIQUE KEY `event_id` (`event_id`), KEY `repost` (`reposted_id`, `author_nip`) ); -- TABLES: COMMENTS CREATE TABLE IF NOT EXISTS `bx_timeline_comments` ( `cmt_id` int(11) NOT NULL AUTO_INCREMENT, `cmt_parent_id` int(11) NOT NULL DEFAULT '0', `cmt_vparent_id` int(11) NOT NULL DEFAULT '0', `cmt_object_id` int(11) NOT NULL DEFAULT '0', `cmt_author_id` int(10) unsigned NOT NULL DEFAULT '0', `cmt_level` int(11) NOT NULL DEFAULT '0', `cmt_text` text NOT NULL, `cmt_time` int(11) unsigned NOT NULL DEFAULT '0', `cmt_replies` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`cmt_id`), KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`), FULLTEXT KEY `search_fields` (`cmt_text`) ); -- TABLE: views CREATE TABLE IF NOT EXISTS `bx_timeline_views_track` ( `object_id` int(11) NOT NULL default '0', `viewer_id` int(11) NOT NULL default '0', `viewer_nip` int(11) unsigned NOT NULL default '0', `date` int(11) NOT NULL default '0', KEY `id` (`object_id`,`viewer_id`,`viewer_nip`) ); -- TABLES: VOTES CREATE TABLE IF NOT EXISTS `bx_timeline_votes` ( `object_id` int(11) NOT NULL default '0', `count` int(11) NOT NULL default '0', `sum` int(11) NOT NULL default '0', UNIQUE KEY `object_id` (`object_id`) ); CREATE TABLE IF NOT EXISTS `bx_timeline_votes_track` ( `id` int(11) NOT NULL AUTO_INCREMENT, `object_id` int(11) NOT NULL default '0', `author_id` int(11) NOT NULL default '0', `author_nip` int(11) unsigned NOT NULL default '0', `value` tinyint(4) NOT NULL default '0', `date` int(11) NOT NULL default '0', PRIMARY KEY (`id`), KEY `vote` (`object_id`, `author_nip`) ); -- TABLE: metas CREATE TABLE IF NOT EXISTS `bx_timeline_meta_keywords` ( `object_id` int(10) unsigned NOT NULL, `keyword` varchar(255) NOT NULL, KEY `object_id` (`object_id`), KEY `keyword` (`keyword`) ); CREATE TABLE IF NOT EXISTS `bx_timeline_meta_locations` ( `object_id` int(10) unsigned NOT NULL, `lat` double NOT NULL, `lng` double NOT NULL, `country` varchar(2) NOT NULL, `state` varchar(255) NOT NULL, `city` varchar(255) NOT NULL, `zip` varchar(255) NOT NULL, `street` varchar(255) NOT NULL, `street_number` varchar(255) NOT NULL, PRIMARY KEY (`object_id`), KEY `country_state_city` (`country`,`state`(8),`city`(8)) ); CREATE TABLE IF NOT EXISTS `bx_timeline_meta_mentions` ( `object_id` int(10) unsigned NOT NULL, `profile_id` int(10) unsigned NOT NULL, KEY `object_id` (`object_id`), KEY `profile_id` (`profile_id`) ); -- TABLE: reports CREATE TABLE IF NOT EXISTS `bx_timeline_reports` ( `object_id` int(11) NOT NULL default '0', `count` int(11) NOT NULL default '0', UNIQUE KEY `object_id` (`object_id`) ); CREATE TABLE IF NOT EXISTS `bx_timeline_reports_track` ( `id` int(11) NOT NULL AUTO_INCREMENT, `object_id` int(11) NOT NULL default '0', `author_id` int(11) NOT NULL default '0', `author_nip` int(11) unsigned NOT NULL default '0', `type` varchar(32) NOT NULL default '', `text` text NOT NULL default '', `date` int(11) NOT NULL default '0', PRIMARY KEY (`id`), KEY `report` (`object_id`, `author_nip`) ); -- TABLE: hot track CREATE TABLE IF NOT EXISTS `bx_timeline_hot_track` ( `id` int(11) NOT NULL AUTO_INCREMENT, `event_id` int(11) NOT NULL default '0', `value` tinyint(4) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `event_id` (`event_id`) ); -- TABLE: scores CREATE TABLE IF NOT EXISTS `bx_timeline_scores` ( `object_id` int(11) NOT NULL default '0', `count_up` int(11) NOT NULL default '0', `count_down` int(11) NOT NULL default '0', UNIQUE KEY `object_id` (`object_id`) ); CREATE TABLE IF NOT EXISTS `bx_timeline_scores_track` ( `id` int(11) NOT NULL AUTO_INCREMENT, `object_id` int(11) NOT NULL default '0', `author_id` int(11) NOT NULL default '0', `author_nip` int(11) unsigned NOT NULL default '0', `type` varchar(8) NOT NULL default '', `date` int(11) NOT NULL default '0', PRIMARY KEY (`id`), KEY `vote` (`object_id`, `author_nip`) ); -- STORAGES, TRANSCODERS, UPLOADERS SET @sStorageEngine = (SELECT `value` FROM `sys_options` WHERE `name` = 'sys_storage_default'); INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `override_class_file`) VALUES ('bx_timeline_simple_photo', 1, 'BxTimelineUploaderSimplePhoto', 'modules/boonex/timeline/classes/BxTimelineUploaderSimplePhoto.php'), ('bx_timeline_simple_video', 1, 'BxTimelineUploaderSimpleVideo', 'modules/boonex/timeline/classes/BxTimelineUploaderSimpleVideo.php'); INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES ('bx_timeline_photos', @sStorageEngine, '', 360, 2592000, 3, 'bx_timeline_photos', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0), ('bx_timeline_photos_processed', @sStorageEngine, '', 360, 2592000, 3, 'bx_timeline_photos_processed', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0), ('bx_timeline_videos', @sStorageEngine, '', 360, 2592000, 3, 'bx_timeline_videos', 'allow-deny', 'avi,flv,mpg,mpeg,wmv,mp4,m4v,mov,divx,xvid,3gp,webm,jpg', '', 0, 0, 0, 0, 0, 0), ('bx_timeline_videos_processed', @sStorageEngine, '', 360, 2592000, 3, 'bx_timeline_videos_processed', 'allow-deny', 'avi,flv,mpg,mpeg,wmv,mp4,m4v,mov,divx,xvid,3gp,webm,jpg', '', 0, 0, 0, 0, 0, 0); INSERT INTO `sys_objects_transcoder` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`, `override_class_name`, `override_class_file`) VALUES ('bx_timeline_photos_preview', 'bx_timeline_photos_processed', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_photos";}', 'no', '1', '2592000', '0', '', ''), ('bx_timeline_photos_view', 'bx_timeline_photos_processed', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_photos";}', 'no', '1', '2592000', '0', '', ''), ('bx_timeline_photos_medium', 'bx_timeline_photos_processed', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_photos";}', 'no', '1', '2592000', '0', '', ''), ('bx_timeline_photos_big', 'bx_timeline_photos_processed', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_photos";}', 'no', '1', '2592000', '0', '', ''), ('bx_timeline_videos_poster', 'bx_timeline_videos_processed', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_videos";}', 'no', '0', '0', '0', 'BxDolTranscoderVideo', ''), ('bx_timeline_videos_mp4', 'bx_timeline_videos_processed', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_videos";}', 'no', '0', '0', '0', 'BxDolTranscoderVideo', ''), ('bx_timeline_videos_webm', 'bx_timeline_videos_processed', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_videos";}', 'no', '0', '0', '0', 'BxDolTranscoderVideo', ''); INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES ('bx_timeline_photos_preview', 'Resize', 'a:3:{s:1:"w";s:3:"100";s:1:"h";s:3:"100";s:13:"square_resize";s:1:"1";}', '0'), ('bx_timeline_photos_view', 'Resize', 'a:3:{s:1:"w";s:3:"300";s:1:"h";s:3:"300";s:13:"square_resize";s:1:"1";}', '0'), ('bx_timeline_photos_medium', 'Resize', 'a:3:{s:1:"w";s:3:"600";s:1:"h";s:3:"600";s:13:"square_resize";s:1:"1";}', '0'), ('bx_timeline_photos_big', 'Resize', 'a:2:{s:1:"w";s:4:"1200";s:1:"h";s:4:"1200";}', '0'), ('bx_timeline_videos_poster', 'Poster', 'a:2:{s:1:"h";s:3:"318";s:10:"force_type";s:3:"jpg";}', 0), ('bx_timeline_videos_mp4', 'Mp4', 'a:2:{s:1:"h";s:3:"318";s:10:"force_type";s:3:"mp4";}', 0), ('bx_timeline_videos_webm', 'Webm', 'a:2:{s:1:"h";s:3:"318";s:10:"force_type";s:4:"webm";}', 0); -- Forms -> Post INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES ('bx_timeline_post', @sName, '_bx_timeline_form_post', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, 'BxTimelineFormPost', 'modules/boonex/timeline/classes/BxTimelineFormPost.php'); INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES ('bx_timeline_post_add', @sName, 'bx_timeline_post', '_bx_timeline_form_post_display_add', 0), ('bx_timeline_post_add_public', @sName, 'bx_timeline_post', '_bx_timeline_form_post_display_add_public', 0), ('bx_timeline_post_add_profile', @sName, 'bx_timeline_post', '_bx_timeline_form_post_display_add_profile', 0), ('bx_timeline_post_edit', @sName, 'bx_timeline_post', '_bx_timeline_form_post_display_edit', 0); INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES ('bx_timeline_post', @sName, 'type', 'post', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_type', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0), ('bx_timeline_post', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0), ('bx_timeline_post', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0), ('bx_timeline_post', @sName, 'text', '', '', 0, 'textarea', '_bx_timeline_form_post_input_sys_text', '_bx_timeline_form_post_input_text', '', 0, 0, 3, 'a:1:{s:12:"autocomplete";s:3:"off";}', '', '', '', '', '', 'XssHtml', '', 1, 0), ('bx_timeline_post', @sName, 'date', '', '', 0, 'datetime', '_bx_timeline_form_post_input_sys_date', '_bx_timeline_form_post_input_date', '_bx_timeline_form_post_input_date_info', 0, 0, 0, '', '', '', '', '', '', 'DateTimeUtc', '', 1, 0), ('bx_timeline_post', @sName, 'object_privacy_view', '', '', 0, 'custom', '_bx_timeline_form_post_input_sys_object_privacy_view', '_bx_timeline_form_post_input_object_privacy_view', '', 1, 0, 0, '', '', '', '', '', '', '', '', 1, 0), ('bx_timeline_post', @sName, 'location', '', '', 0, 'location', '_sys_form_input_sys_location', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0), ('bx_timeline_post', @sName, 'link', '', '', 0, 'custom', '_bx_timeline_form_post_input_sys_link', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0), ('bx_timeline_post', @sName, 'photo', 'a:1:{i:0;s:24:"bx_timeline_simple_photo";}', 'a:1:{s:24:"bx_timeline_simple_photo";s:26:"_sys_uploader_simple_title";}', 0, 'files', '_bx_timeline_form_post_input_sys_photo', '_bx_timeline_form_post_input_photo', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0), ('bx_timeline_post', @sName, 'video', 'a:1:{i:0;s:24:"bx_timeline_simple_video";}', 'a:1:{s:24:"bx_timeline_simple_video";s:26:"_sys_uploader_simple_title";}', 0, 'files', '_bx_timeline_form_post_input_sys_video', '_bx_timeline_form_post_input_video', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0), ('bx_timeline_post', @sName, 'attachments', '', '', 0, 'custom', '_bx_timeline_form_post_input_sys_attachments', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0), ('bx_timeline_post', @sName, 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0), ('bx_timeline_post', @sName, 'do_submit', '_bx_timeline_form_post_input_do_submit', '', 0, 'submit', '_bx_timeline_form_post_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0), ('bx_timeline_post', @sName, 'do_cancel', '_bx_timeline_form_post_input_do_cancel', '', 0, 'button', '_bx_timeline_form_post_input_sys_do_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:51:"{js_object_view}.editPostCancel(this, {content_id})";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 0, 0); INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES ('bx_timeline_post_add', 'type', 2147483647, 1, 1), ('bx_timeline_post_add', 'action', 2147483647, 1, 2), ('bx_timeline_post_add', 'text', 2147483647, 1, 3), ('bx_timeline_post_add', 'owner_id', 2147483647, 1, 4), ('bx_timeline_post_add', 'object_privacy_view', 2147483647, 1, 5), ('bx_timeline_post_add', 'date', 192, 1, 6), ('bx_timeline_post_add', 'location', 2147483647, 1, 7), ('bx_timeline_post_add', 'link', 2147483647, 1, 8), ('bx_timeline_post_add', 'photo', 2147483647, 1, 9), ('bx_timeline_post_add', 'video', 2147483647, 1, 10), ('bx_timeline_post_add', 'attachments', 2147483647, 1, 11), ('bx_timeline_post_add', 'do_submit', 2147483647, 1, 12), ('bx_timeline_post_add_public', 'type', 2147483647, 1, 1), ('bx_timeline_post_add_public', 'action', 2147483647, 1, 2), ('bx_timeline_post_add_public', 'owner_id', 2147483647, 1, 3), ('bx_timeline_post_add_public', 'text', 2147483647, 1, 4), ('bx_timeline_post_add_public', 'object_privacy_view', 2147483647, 1, 5), ('bx_timeline_post_add_public', 'date', 192, 1, 6), ('bx_timeline_post_add_public', 'location', 2147483647, 1, 7), ('bx_timeline_post_add_public', 'link', 2147483647, 1, 8), ('bx_timeline_post_add_public', 'photo', 2147483647, 1, 9), ('bx_timeline_post_add_public', 'video', 2147483647, 1, 10), ('bx_timeline_post_add_public', 'attachments', 2147483647, 1, 11), ('bx_timeline_post_add_public', 'do_submit', 2147483647, 1, 12), ('bx_timeline_post_add_profile', 'type', 2147483647, 1, 1), ('bx_timeline_post_add_profile', 'action', 2147483647, 1, 2), ('bx_timeline_post_add_profile', 'owner_id', 2147483647, 1, 3), ('bx_timeline_post_add_profile', 'text', 2147483647, 1, 4), ('bx_timeline_post_add_profile', 'object_privacy_view', 2147483647, 1, 5), ('bx_timeline_post_add_profile', 'date', 192, 1, 6), ('bx_timeline_post_add_profile', 'location', 2147483647, 1, 7), ('bx_timeline_post_add_profile', 'link', 2147483647, 1, 8), ('bx_timeline_post_add_profile', 'photo', 2147483647, 1, 9), ('bx_timeline_post_add_profile', 'video', 2147483647, 1, 10), ('bx_timeline_post_add_profile', 'attachments', 2147483647, 1, 11), ('bx_timeline_post_add_profile', 'do_submit', 2147483647, 1, 12), ('bx_timeline_post_edit', 'type', 2147483647, 1, 1), ('bx_timeline_post_edit', 'action', 2147483647, 1, 2), ('bx_timeline_post_edit', 'owner_id', 2147483647, 1, 3), ('bx_timeline_post_edit', 'text', 2147483647, 1, 4), ('bx_timeline_post_edit', 'date', 192, 1, 5), ('bx_timeline_post_edit', 'location', 2147483647, 1, 6), ('bx_timeline_post_edit', 'controls', 2147483647, 1, 7), ('bx_timeline_post_edit', 'do_submit', 2147483647, 1, 8), ('bx_timeline_post_edit', 'do_cancel', 2147483647, 1, 9); -- Forms -> Attach link INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES ('bx_timeline_attach_link', @sName, '_bx_timeline_form_attach_link', '', '', 'do_submit', 'bx_timeline_links', 'id', '', '', '', 0, 1, '', ''); INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES ('bx_timeline_attach_link_add', @sName, 'bx_timeline_attach_link', '_bx_timeline_form_attach_link_display_add', 0); INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES ('bx_timeline_attach_link', @sName, 'url', '', '', 0, 'text', '_bx_timeline_form_attach_link_input_sys_url', '_bx_timeline_form_attach_link_input_url', '', 0, 0, 0, '', '', '', 'Preg', 'a:1:{s:4:"preg";s:0:"";}', '_bx_timeline_form_attach_link_input_url_err', '', '', 0, 0), ('bx_timeline_attach_link', @sName, 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0), ('bx_timeline_attach_link', @sName, 'do_submit', '_bx_timeline_form_attach_link_input_do_submit', '', 0, 'submit', '_bx_timeline_form_attach_link_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0), ('bx_timeline_attach_link', @sName, 'do_cancel', '_bx_timeline_form_attach_link_input_do_cancel', '', 0, 'button', '_bx_timeline_form_attach_link_input_do_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:45:"$(''.bx-popup-applied:visible'').dolPopupHide()";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 0, 0); INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES ('bx_timeline_attach_link_add', 'url', 2147483647, 1, 1), ('bx_timeline_attach_link_add', 'controls', 2147483647, 1, 2), ('bx_timeline_attach_link_add', 'do_submit', 2147483647, 1, 3), ('bx_timeline_attach_link_add', 'do_cancel', 2147483647, 1, 4); -- STUDIO PAGE & WIDGET INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES (3, 'bx_timeline', '_bx_timeline', '_bx_timeline', 'bx_timeline@modules/boonex/timeline/|std-icon.svg'); SET @iPageId = LAST_INSERT_ID(); SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home'); SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId); INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES (@iPageId, 'bx_timeline', '{url_studio}module.php?name=bx_timeline', '', 'bx_timeline@modules/boonex/timeline/|std-icon.svg', '_bx_timeline', '', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}'); INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));
the_stack
-- complain if script is sourced in psql, rather than via ALTER EXTENSION \echo Use "ALTER EXTENSION ""babelfishpg_tsql"" UPDATE TO '2.2.0'" to load this file. \quit -- add 'sys' to search path for the convenience SELECT set_config('search_path', 'sys, '||current_setting('search_path'), false); -- Drops a view if it does not have any dependent objects. -- Is a temporary procedure for use by the upgrade script. Will be dropped at the end of the upgrade. -- Please have this be one of the first statements executed in this upgrade script. CREATE OR REPLACE PROCEDURE babelfish_drop_deprecated_view(schema_name varchar, view_name varchar) AS $$ DECLARE error_msg text; query1 text; query2 text; BEGIN query1 := format('alter extension babelfishpg_tsql drop view %s.%s', schema_name, view_name); query2 := format('drop view %s.%s', schema_name, view_name); execute query1; execute query2; EXCEPTION when object_not_in_prerequisite_state then --if 'alter extension' statement fails GET STACKED DIAGNOSTICS error_msg = MESSAGE_TEXT; raise warning '%', error_msg; when dependent_objects_still_exist then --if 'drop view' statement fails GET STACKED DIAGNOSTICS error_msg = MESSAGE_TEXT; raise warning '%', error_msg; end $$ LANGUAGE plpgsql; -- Drops a function if it does not have any dependent objects. -- Is a temporary procedure for use by the upgrade script. Will be dropped at the end of the upgrade. -- Please have this be one of the first statements executed in this upgrade script. CREATE OR REPLACE PROCEDURE babelfish_drop_deprecated_function(schema_name varchar, func_name varchar) AS $$ DECLARE error_msg text; query1 text; query2 text; BEGIN query1 := format('alter extension babelfishpg_tsql drop function %s.%s', schema_name, func_name); query2 := format('drop function %s.%s', schema_name, func_name); execute query1; execute query2; EXCEPTION when object_not_in_prerequisite_state then --if 'alter extension' statement fails GET STACKED DIAGNOSTICS error_msg = MESSAGE_TEXT; raise warning '%', error_msg; when dependent_objects_still_exist then --if 'drop function' statement fails GET STACKED DIAGNOSTICS error_msg = MESSAGE_TEXT; raise warning '%', error_msg; end $$ LANGUAGE plpgsql; -- Removes a member object from the extension. The object is not dropped, only disassociated from the extension. -- It is a temporary procedure for use by the upgrade script. Will be dropped at the end of the upgrade. CREATE OR REPLACE PROCEDURE babelfish_remove_object_from_extension(obj_type varchar, qualified_obj_name varchar) AS $$ DECLARE error_msg text; query text; BEGIN query := format('alter extension babelfishpg_tsql drop %s %s', obj_type, qualified_obj_name); execute query; EXCEPTION when object_not_in_prerequisite_state then --if 'alter extension' statement fails GET STACKED DIAGNOSTICS error_msg = MESSAGE_TEXT; raise warning '%', error_msg; END $$ LANGUAGE plpgsql; -- please add your SQL here CREATE OR REPLACE FUNCTION sys.tsql_get_constraintdef(IN constraint_id OID DEFAULT NULL) RETURNS text AS 'babelfishpg_tsql', 'tsql_get_constraintdef' LANGUAGE C IMMUTABLE PARALLEL SAFE; CREATE OR REPLACE VIEW information_schema_tsql.check_constraints AS SELECT CAST(nc.dbname AS sys.nvarchar(128)) AS "CONSTRAINT_CATALOG", CAST(extc.orig_name AS sys.nvarchar(128)) AS "CONSTRAINT_SCHEMA", CAST(c.conname AS sys.sysname) AS "CONSTRAINT_NAME", CAST(sys.tsql_get_constraintdef(c.oid) AS sys.nvarchar(4000)) AS "CHECK_CLAUSE" FROM sys.pg_namespace_ext nc LEFT OUTER JOIN sys.babelfish_namespace_ext extc ON nc.nspname = extc.nspname, pg_constraint c, pg_class r WHERE nc.oid = c.connamespace AND nc.oid = r.relnamespace AND c.conrelid = r.oid AND c.contype = 'c' AND r.relkind IN ('r', 'p') AND (NOT pg_is_other_temp_schema(nc.oid)) AND (pg_has_role(r.relowner, 'USAGE') OR has_table_privilege(r.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') OR has_any_column_privilege(r.oid, 'SELECT, INSERT, UPDATE, REFERENCES')) AND extc.dbid = cast(sys.db_id() as oid); GRANT SELECT ON information_schema_tsql.check_constraints TO PUBLIC; ALTER VIEW sys.foreign_keys RENAME TO foreign_keys_deprecated; CREATE OR replace view sys.foreign_keys AS SELECT CAST(c.conname AS sys.SYSNAME) AS name , CAST(c.oid AS INT) AS object_id , CAST(NULL AS INT) AS principal_id , CAST(sch.schema_id AS INT) AS schema_id , CAST(c.conrelid AS INT) AS parent_object_id , CAST('F' AS CHAR(2)) AS type , CAST('FOREIGN_KEY_CONSTRAINT' AS NVARCHAR(60)) AS type_desc , CAST(NULL AS sys.DATETIME) AS create_date , CAST(NULL AS sys.DATETIME) AS modify_date , CAST(0 AS sys.BIT) AS is_ms_shipped , CAST(0 AS sys.BIT) AS is_published , CAST(0 AS sys.BIT) as is_schema_published , CAST(c.confrelid AS INT) AS referenced_object_id , CAST(c.conindid AS INT) AS key_index_id , CAST(0 AS sys.BIT) AS is_disabled , CAST(0 AS sys.BIT) AS is_not_for_replication , CAST(0 AS sys.BIT) AS is_not_trusted , CAST( (CASE c.confdeltype WHEN 'a' THEN 0 WHEN 'r' THEN 0 WHEN 'c' THEN 1 WHEN 'n' THEN 2 WHEN 'd' THEN 3 END) AS sys.TINYINT) AS delete_referential_action , CAST( (CASE c.confdeltype WHEN 'a' THEN 'NO_ACTION' WHEN 'r' THEN 'NO_ACTION' WHEN 'c' THEN 'CASCADE' WHEN 'n' THEN 'SET_NULL' WHEN 'd' THEN 'SET_DEFAULT' END) AS sys.NVARCHAR(60)) AS delete_referential_action_desc , CAST( (CASE c.confupdtype WHEN 'a' THEN 0 WHEN 'r' THEN 0 WHEN 'c' THEN 1 WHEN 'n' THEN 2 WHEN 'd' THEN 3 END) AS sys.TINYINT) AS update_referential_action , CAST( (CASE c.confupdtype WHEN 'a' THEN 'NO_ACTION' WHEN 'r' THEN 'NO_ACTION' WHEN 'c' THEN 'CASCADE' WHEN 'n' THEN 'SET_NULL' WHEN 'd' THEN 'SET_DEFAULT' END) AS sys.NVARCHAR(60)) update_referential_action_desc , CAST(1 AS sys.BIT) AS is_system_named FROM pg_constraint c INNER JOIN sys.schemas sch ON sch.schema_id = c.connamespace WHERE has_schema_privilege(sch.schema_id, 'USAGE') AND c.contype = 'f'; GRANT SELECT ON sys.foreign_keys TO PUBLIC; create or replace view sys.objects as select CAST(t.name as sys.sysname) as name , CAST(t.object_id as int) as object_id , CAST(t.principal_id as int) as principal_id , CAST(t.schema_id as int) as schema_id , CAST(t.parent_object_id as int) as parent_object_id , CAST('U' as char(2)) as type , CAST('USER_TABLE' as sys.nvarchar(60)) as type_desc , CAST(t.create_date as sys.datetime) as create_date , CAST(t.modify_date as sys.datetime) as modify_date , CAST(t.is_ms_shipped as sys.bit) as is_ms_shipped , CAST(t.is_published as sys.bit) as is_published , CAST(t.is_schema_published as sys.bit) as is_schema_published from sys.tables t union all select CAST(v.name as sys.sysname) as name , CAST(v.object_id as int) as object_id , CAST(v.principal_id as int) as principal_id , CAST(v.schema_id as int) as schema_id , CAST(v.parent_object_id as int) as parent_object_id , CAST('V' as char(2)) as type , CAST('VIEW' as sys.nvarchar(60)) as type_desc , CAST(v.create_date as sys.datetime) as create_date , CAST(v.modify_date as sys.datetime) as modify_date , CAST(v.is_ms_shipped as sys.bit) as is_ms_shipped , CAST(v.is_published as sys.bit) as is_published , CAST(v.is_schema_published as sys.bit) as is_schema_published from sys.views v union all select CAST(f.name as sys.sysname) as name , CAST(f.object_id as int) as object_id , CAST(f.principal_id as int) as principal_id , CAST(f.schema_id as int) as schema_id , CAST(f.parent_object_id as int) as parent_object_id , CAST('F' as char(2)) as type , CAST('FOREIGN_KEY_CONSTRAINT' as sys.nvarchar(60)) as type_desc , CAST(f.create_date as sys.datetime) as create_date , CAST(f.modify_date as sys.datetime) as modify_date , CAST(f.is_ms_shipped as sys.bit) as is_ms_shipped , CAST(f.is_published as sys.bit) as is_published , CAST(f.is_schema_published as sys.bit) as is_schema_published from sys.foreign_keys f union all select CAST(p.name as sys.sysname) as name , CAST(p.object_id as int) as object_id , CAST(p.principal_id as int) as principal_id , CAST(p.schema_id as int) as schema_id , CAST(p.parent_object_id as int) as parent_object_id , CAST('PK' as char(2)) as type , CAST('PRIMARY_KEY_CONSTRAINT' as sys.nvarchar(60)) as type_desc , CAST(p.create_date as sys.datetime) as create_date , CAST(p.modify_date as sys.datetime) as modify_date , CAST(p.is_ms_shipped as sys.bit) as is_ms_shipped , CAST(p.is_published as sys.bit) as is_published , CAST(p.is_schema_published as sys.bit) as is_schema_published from sys.key_constraints p where p.type = 'PK' union all select CAST(pr.name as sys.sysname) as name , CAST(pr.object_id as int) as object_id , CAST(pr.principal_id as int) as principal_id , CAST(pr.schema_id as int) as schema_id , CAST(pr.parent_object_id as int) as parent_object_id , CAST(pr.type as char(2)) as type , CAST(pr.type_desc as sys.nvarchar(60)) as type_desc , CAST(pr.create_date as sys.datetime) as create_date , CAST(pr.modify_date as sys.datetime) as modify_date , CAST(pr.is_ms_shipped as sys.bit) as is_ms_shipped , CAST(pr.is_published as sys.bit) as is_published , CAST(pr.is_schema_published as sys.bit) as is_schema_published from sys.procedures pr union all select CAST(def.name as sys.sysname) as name , CAST(def.object_id as int) as object_id , CAST(def.principal_id as int) as principal_id , CAST(def.schema_id as int) as schema_id , CAST(def.parent_object_id as int) as parent_object_id , CAST(def.type as char(2)) as type , CAST(def.type_desc as sys.nvarchar(60)) as type_desc , CAST(def.create_date as sys.datetime) as create_date , CAST(def.modified_date as sys.datetime) as modify_date , CAST(def.is_ms_shipped as sys.bit) as is_ms_shipped , CAST(def.is_published as sys.bit) as is_published , CAST(def.is_schema_published as sys.bit) as is_schema_published from sys.default_constraints def union all select CAST(chk.name as sys.sysname) as name , CAST(chk.object_id as int) as object_id , CAST(chk.principal_id as int) as principal_id , CAST(chk.schema_id as int) as schema_id , CAST(chk.parent_object_id as int) as parent_object_id , CAST(chk.type as char(2)) as type , CAST(chk.type_desc as sys.nvarchar(60)) as type_desc , CAST(chk.create_date as sys.datetime) as create_date , CAST(chk.modify_date as sys.datetime) as modify_date , CAST(chk.is_ms_shipped as sys.bit) as is_ms_shipped , CAST(chk.is_published as sys.bit) as is_published , CAST(chk.is_schema_published as sys.bit) as is_schema_published from sys.check_constraints chk union all select CAST(p.relname as sys.sysname) as name , CAST(p.oid as int) as object_id , CAST(null as int) as principal_id , CAST(s.schema_id as int) as schema_id , CAST(0 as int) as parent_object_id , CAST('SO' as char(2)) as type , CAST('SEQUENCE_OBJECT' as sys.nvarchar(60)) as type_desc , CAST(null as sys.datetime) as create_date , CAST(null as sys.datetime) as modify_date , CAST(0 as sys.bit) as is_ms_shipped , CAST(0 as sys.bit) as is_published , CAST(0 as sys.bit) as is_schema_published from pg_class p inner join sys.schemas s on s.schema_id = p.relnamespace and p.relkind = 'S' and has_schema_privilege(s.schema_id, 'USAGE') union all select CAST(('TT_' || tt.name || '_' || tt.type_table_object_id) as sys.sysname) as name , CAST(tt.type_table_object_id as int) as object_id , CAST(tt.principal_id as int) as principal_id , CAST(tt.schema_id as int) as schema_id , CAST(0 as int) as parent_object_id , CAST('TT' as char(2)) as type , CAST('TABLE_TYPE' as sys.nvarchar(60)) as type_desc , CAST(null as sys.datetime) as create_date , CAST(null as sys.datetime) as modify_date , CAST(1 as sys.bit) as is_ms_shipped , CAST(0 as sys.bit) as is_published , CAST(0 as sys.bit) as is_schema_published from sys.table_types tt; GRANT SELECT ON sys.objects TO PUBLIC; CALL sys.babelfish_drop_deprecated_view('sys', 'foreign_keys_deprecated'); ALTER FUNCTION OBJECTPROPERTY(INT, SYS.VARCHAR) RENAME TO objectproperty_deprecated_2_1_0; CREATE OR REPLACE FUNCTION objectproperty( id INT, property SYS.VARCHAR ) RETURNS INT AS $$ BEGIN IF NOT EXISTS(SELECT ao.object_id FROM sys.all_objects ao WHERE object_id = id) THEN RETURN NULL; END IF; property := RTRIM(LOWER(COALESCE(property, ''))); IF property = 'ownerid' -- OwnerId THEN RETURN ( SELECT CAST(COALESCE(t1.principal_id, pn.nspowner) AS INT) FROM sys.all_objects t1 INNER JOIN pg_catalog.pg_namespace pn ON pn.oid = t1.schema_id WHERE t1.object_id = id); ELSEIF property = 'isdefaultcnst' -- IsDefaultCnst THEN RETURN (SELECT count(distinct dc.object_id) FROM sys.default_constraints dc WHERE dc.object_id = id); ELSEIF property = 'execisquotedidenton' -- ExecIsQuotedIdentOn THEN RETURN (SELECT CAST(sm.uses_quoted_identifier as int) FROM sys.all_sql_modules sm WHERE sm.object_id = id); ELSEIF property = 'tablefulltextpopulatestatus' -- TableFullTextPopulateStatus THEN IF NOT EXISTS (SELECT object_id FROM sys.tables t WHERE t.object_id = id) THEN RETURN NULL; END IF; RETURN 0; ELSEIF property = 'tablehasvardecimalstorageformat' -- TableHasVarDecimalStorageFormat THEN IF NOT EXISTS (SELECT object_id FROM sys.tables t WHERE t.object_id = id) THEN RETURN NULL; END IF; RETURN 0; ELSEIF property = 'ismsshipped' -- IsMSShipped THEN RETURN (SELECT CAST(ao.is_ms_shipped AS int) FROM sys.all_objects ao WHERE ao.object_id = id); ELSEIF property = 'isschemabound' -- IsSchemaBound THEN RETURN (SELECT CAST(sm.is_schema_bound AS int) FROM sys.all_sql_modules sm WHERE sm.object_id = id); ELSEIF property = 'execisansinullson' -- ExecIsAnsiNullsOn THEN RETURN (SELECT CAST(sm.uses_ansi_nulls AS int) FROM sys.all_sql_modules sm WHERE sm.object_id = id); ELSEIF property = 'isdeterministic' -- IsDeterministic THEN RETURN 0; ELSEIF property = 'isprocedure' -- IsProcedure THEN RETURN (SELECT count(distinct object_id) from sys.all_objects WHERE object_id = id and type = 'P'); ELSEIF property = 'istable' -- IsTable THEN RETURN (SELECT count(distinct object_id) from sys.all_objects WHERE object_id = id and type in ('IT', 'TT', 'U', 'S')); ELSEIF property = 'isview' -- IsView THEN RETURN (SELECT count(distinct object_id) from sys.all_objects WHERE object_id = id and type = 'V'); ELSEIF property = 'isusertable' -- IsUserTable THEN RETURN (SELECT count(distinct object_id) from sys.all_objects WHERE object_id = id and type = 'U' and is_ms_shipped = 0); ELSEIF property = 'istablefunction' -- IsTableFunction THEN RETURN (SELECT count(distinct object_id) from sys.all_objects WHERE object_id = id and type in ('IF', 'TF', 'FT')); ELSEIF property = 'isinlinefunction' -- IsInlineFunction THEN RETURN 0; ELSEIF property = 'isscalarfunction' -- IsScalarFunction THEN RETURN (SELECT count(distinct object_id) from sys.all_objects WHERE object_id = id and type in ('FN', 'FS')); ELSEIF property = 'isprimarykey' -- IsPrimaryKey THEN RETURN (SELECT count(distinct object_id) from sys.all_objects WHERE object_id = id and type = 'PK'); ELSEIF property = 'isindexed' -- IsIndexed THEN RETURN (SELECT count(distinct object_id) from sys.indexes WHERE object_id = id and index_id > 0); ELSEIF property = 'isdefault' -- IsDefault THEN RETURN 0; ELSEIF property = 'isrule' -- IsRule THEN RETURN 0; ELSEIF property = 'istrigger' -- IsTrigger THEN RETURN (SELECT count(distinct object_id) from sys.all_objects WHERE object_id = id and type in ('TA', 'TR')); END IF; RETURN NULL; END; $$ LANGUAGE plpgsql; CALL sys.babelfish_drop_deprecated_function('sys', 'objectproperty_deprecated_2_1_0'); CREATE OR REPLACE FUNCTION sys.DBTS() RETURNS sys.ROWVERSION AS $$ DECLARE eh_setting text; BEGIN eh_setting = (select s.setting FROM pg_catalog.pg_settings s where name = 'babelfishpg_tsql.escape_hatch_rowversion'); IF eh_setting = 'strict' THEN RAISE EXCEPTION 'DBTS is not currently supported in Babelfish. please use babelfishpg_tsql.escape_hatch_rowversion to ignore'; ELSE RETURN sys.get_current_full_xact_id()::sys.ROWVERSION; END IF; END; $$ STRICT LANGUAGE plpgsql; CREATE OR REPLACE VIEW sys.hash_indexes AS SELECT si.object_id, si.name, si.index_id, si.type, si.type_desc, si.is_unique, si.data_space_id, si.ignore_dup_key, si.is_primary_key, si.is_unique_constraint, si.fill_factor, si.is_padded, si.is_disabled, si.is_hypothetical, si.allow_row_locks, si.allow_page_locks, si.has_filter, si.filter_definition, CAST(0 as INT) AS bucket_count, si.auto_created FROM sys.indexes si WHERE FALSE; GRANT SELECT ON sys.hash_indexes TO PUBLIC; CREATE OR REPLACE VIEW sys.filetable_system_defined_objects AS SELECT CAST(0 as INT) AS object_id, CAST(0 as INT) AS parent_object_id WHERE FALSE; GRANT SELECT ON sys.filetable_system_defined_objects TO PUBLIC; CREATE OR REPLACE VIEW sys.database_filestream_options AS SELECT CAST(0 as INT) AS database_id, CAST('' as NVARCHAR(255)) AS directory_name, CAST(0 as TINYINT) AS non_transacted_access, CAST('' as NVARCHAR(60)) AS non_transacted_access_desc WHERE FALSE; GRANT SELECT ON sys.database_filestream_options TO PUBLIC; CREATE OR REPLACE FUNCTION sys.sid_binary(IN login sys.nvarchar) RETURNS SYS.VARBINARY AS $$ SELECT CAST(NULL AS SYS.VARBINARY); $$ LANGUAGE SQL IMMUTABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION sys.system_user() RETURNS sys.nvarchar(128) AS $BODY$ SELECT SESSION_USER; $BODY$ LANGUAGE SQL; -- Disassociate msdb objects from the extension CALL sys.babelfish_remove_object_from_extension('view', 'msdb_dbo.sysdatabases'); CALL sys.babelfish_remove_object_from_extension('schema', 'msdb_dbo'); -- Disassociate procedures under master_dbo schema from the extension CALL sys.babelfish_remove_object_from_extension('procedure', 'master_dbo.xp_qv(sys.nvarchar, sys.nvarchar)'); CALL sys.babelfish_remove_object_from_extension('procedure', 'master_dbo.xp_instance_regread(sys.nvarchar, sys.sysname, sys.nvarchar, int)'); CALL sys.babelfish_remove_object_from_extension('procedure', 'master_dbo.xp_instance_regread(sys.nvarchar, sys.sysname, sys.nvarchar, sys.nvarchar)'); CREATE OR REPLACE FUNCTION information_schema_tsql._pgtsql_numeric_precision(type text, typid oid, typmod int4) RETURNS integer LANGUAGE sql IMMUTABLE PARALLEL SAFE RETURNS NULL ON NULL INPUT AS $$ SELECT CASE typid WHEN 21 /*int2*/ THEN 5 WHEN 23 /*int4*/ THEN 10 WHEN 20 /*int8*/ THEN 19 WHEN 1700 /*numeric*/ THEN CASE WHEN typmod = -1 THEN null ELSE ((typmod - 4) >> 16) & 65535 END WHEN 700 /*float4*/ THEN 24 WHEN 701 /*float8*/ THEN 53 ELSE CASE WHEN type = 'tinyint' THEN 3 WHEN type = 'money' THEN 19 WHEN type = 'smallmoney' THEN 10 WHEN type = 'decimal' THEN CASE WHEN typmod = -1 THEN null ELSE ((typmod - 4) >> 16) & 65535 END ELSE null END END $$; CREATE OR REPLACE FUNCTION information_schema_tsql._pgtsql_numeric_scale(type text, typid oid, typmod int4) RETURNS integer LANGUAGE sql IMMUTABLE PARALLEL SAFE RETURNS NULL ON NULL INPUT AS $$ SELECT CASE WHEN typid IN (21, 23, 20) THEN 0 WHEN typid IN (1700) THEN CASE WHEN typmod = -1 THEN null ELSE (typmod - 4) & 65535 END WHEN type = 'tinyint' THEN 0 WHEN type IN ('money', 'smallmoney') THEN 4 WHEN type = 'decimal' THEN CASE WHEN typmod = -1 THEN NULL ELSE (typmod - 4) & 65535 END ELSE null END $$; -- Drops the temporary procedure used by the upgrade script. -- Please have this be one of the last statements executed in this upgrade script. DROP PROCEDURE sys.babelfish_drop_deprecated_view(varchar, varchar); DROP PROCEDURE sys.babelfish_remove_object_from_extension(varchar, varchar); DROP PROCEDURE sys.babelfish_drop_deprecated_function(varchar, varchar); -- Reset search_path to not affect any subsequent scripts SELECT set_config('search_path', trim(leading 'sys, ' from current_setting('search_path')), false);
the_stack
function render ( p_region in apex_plugin.t_region , p_plugin in apex_plugin.t_plugin , p_is_printer_friendly in boolean ) return apex_plugin.t_region_render_result as subtype plugin_attr is varchar2(32767); /* Global variables */ l_result apex_plugin.t_region_render_result; l_html varchar2(32767); /* t_plugin Attributes */ l_table_classes plugin_attr := p_plugin.attribute_01; l_thead_classes plugin_attr := p_plugin.attribute_02; l_th_classes plugin_attr := p_plugin.attribute_03; l_td_classes plugin_attr := p_plugin.attribute_04; /* t_region Attributes */ l_template_type plugin_attr := p_region.attribute_01; l_display_template_options boolean := p_region.attribute_02 = 'Y'; l_display_only_associated_to boolean := p_region.attribute_03 = 'Y'; l_display_all_group_choices boolean := p_region.attribute_04 = 'Y'; l_display_grid_attributes boolean := p_region.attribute_05 = 'Y'; l_display_custom_attributes boolean := p_region.attribute_06 = 'Y'; /* Calculated variables */ l_template_id varchar2(255); l_table_name varchar2(255); l_column_name varchar2(255); l_column_value varchar2(255); l_template_options varchar2(4000); /* c_parent_region */ cursor c_sibling_regions is select nvl(sibling_region.region_id, parent_region.region_id) region_id , nvl(sibling_region.region_name, parent_region.region_name) region_name from apex_application_page_regions plugin_region join apex_application_page_regions parent_region on parent_region.region_id = plugin_region.parent_region_id left join apex_application_page_regions sibling_region on sibling_region.parent_region_id = plugin_region.parent_region_id and sibling_region.region_id <> plugin_region.region_id where plugin_region.region_id = p_region.id order by sibling_region.display_sequence; /* helper functions */ procedure open_table ( p_html in out nocopy varchar2 , p_th1 in varchar2 , p_th2 in varchar2 , p_th3 in varchar2 default null ) is begin p_html := p_html || '<table class="ma-table-small ' || l_table_classes || '">' || '<thead class="' || l_thead_classes || '">' || '<tr>' || '<th class="' || l_th_classes || '">' || p_th1 || '</th>' || '<th class="' || l_th_classes || '">' || p_th2 || '</th>' || '<th class="' || l_th_classes || '">' || p_th3 || '</th>' || '</tr>' || '</thead>' || '<tbody>'; end open_table; procedure get_row ( p_html in out nocopy varchar2 , p_td1 in varchar2 , p_td2 in varchar2 , p_td3 in varchar2 default null ) is begin p_html := p_html || '<tr>' || '<td class="' || l_td_classes || '" nowrap>' || p_td1 || '</td>' || '<td class="' || l_td_classes || '">' || p_td2 || '</td>' || '<td class="' || l_td_classes || '">' || p_td3 || '</td>' || '</tr>'; end get_row; procedure close_table ( p_html in out nocopy varchar2 ) is begin p_html := p_html || '</tbody>' || '</table>'; end close_table; procedure get_region_title ( p_html in out nocopy varchar2 , p_template_type in varchar2 , p_component_name in varchar2 , p_template_name in varchar2 ) is begin p_html := p_html || '<div class="center m-t-2">' || '<strong>Component Name: ' || p_component_name || '</strong>' || '<br>' || '<small><i>Template: ' || p_template_name || '</i></small>' || '</div>' ; end get_region_title; procedure get_component_info ( p_template_type in varchar2 , p_region_id in number , p_table_name in out nocopy varchar2 , p_column_name in out nocopy varchar2 , p_column_value in out nocopy varchar2 , p_template_id in out nocopy number , p_template_options in out nocopy varchar2 ) is l_template_id_column varchar2(255); l_template_options_column varchar2(255); l_component_name_column varchar2(255); l_template_name_column varchar2(255); l_component_name varchar2(255); l_template_name varchar2(255); l_sql varchar2(4000); begin case p_template_type when 'BUTTON' then l_template_id_column := 'button_template_id'; l_template_options_column := 'button_template_options'; l_component_name_column := 'button_name'; l_template_name_column := 'button_template'; p_table_name := 'apex_application_page_buttons'; p_column_name := 'button_id'; when 'BREADCRUMB' then l_template_id_column := 'breadcrumb_template_id'; l_template_options_column := 'component_template_options'; l_component_name_column := 'region_name'; l_template_name_column := 'template'; p_table_name := 'apex_application_page_regions'; p_column_name := 'region_id'; when 'FIELD' then l_template_id_column := 'item_label_template_id'; l_template_options_column := 'item_template_options'; l_component_name_column := 'item_name'; l_template_name_column := 'item_label_template'; p_table_name := 'apex_application_page_items'; p_column_name := 'item_id'; when 'LIST' then l_template_id_column := 'list_template_override_id'; l_template_options_column := 'component_template_options'; l_component_name_column := 'region_name'; l_template_name_column := 'template'; p_table_name := 'apex_application_page_regions'; p_column_name := 'region_id'; when 'REGION' then l_template_id_column := 'template_id'; l_template_options_column := 'region_template_options'; l_component_name_column := 'region_name'; l_template_name_column := 'template'; p_table_name := 'apex_application_page_regions'; p_column_name := 'region_id'; when 'REPORT' then l_template_id_column := 'report_template_id'; l_template_options_column := 'component_template_options'; l_component_name_column := 'region_name'; l_template_name_column := 'template'; p_table_name := 'apex_application_page_regions'; p_column_name := 'region_id'; end case; l_sql := 'select ' || l_template_id_column || ' , ' || l_template_options_column || ' , ' || l_component_name_column || ' , ' || l_template_name_column || ' , ' || p_column_name || ' from ' || p_table_name || ' where region_id = :p_region_id and rownum = 1'; -- get first component -- todo loop over this? execute immediate l_sql into p_template_id , p_template_options , l_component_name , l_template_name , p_column_value using p_region_id; if l_display_template_options or l_display_grid_attributes or l_display_custom_attributes then get_region_title ( p_html => l_html , p_template_type => p_template_type , p_component_name => l_component_name , p_template_name => l_template_name ); end if; end get_component_info; procedure get_template_options ( p_html in out nocopy varchar2 , p_template_type in varchar2 , p_template_id in number , p_template_options in varchar2 ) is l_template_options apex_application_global.vc_arr2; /* c_template_options */ cursor c_template_options ( p_template_option varchar2 default null ) is select ato.display_sequence , ato.display_name , ato.help_text from apex_appl_template_options ato where ato.application_id = :APP_ID and ato.virtual_template_type = p_template_type and ato.group_id is null /* specific template */ and nvl(ato.virtual_template_id, p_template_id) = p_template_id /* specific css class */ and ato.css_classes = nvl(p_template_option, ato.css_classes) order by ato.display_sequence , ato.display_name; /* c_template_option_groups_all */ cursor c_template_option_groups ( p_template_option varchar2 default null ) is select atog.display_sequence group_display_sequence , atog.display_name group_name , atog.help_text group_help_text , ato.display_sequence , ato.display_name , ato.help_text from apex_appl_template_options ato join apex_appl_template_opt_groups atog on atog.template_opt_group_id = ato.group_id where ato.application_id = :APP_ID and ato.virtual_template_type = p_template_type /* specific template */ and nvl(ato.virtual_template_id, p_template_id) = p_template_id /* specific css class */ and ato.css_classes = nvl(p_template_option, ato.css_classes) order by group_display_sequence , group_name , display_sequence , display_name; /* c_template_option_groups_all */ cursor c_template_option_groups_all ( p_template_option varchar2 default null ) is select atog.display_sequence group_display_sequence , atog.display_name group_name , atog.help_text group_help_text , listagg(ato2.display_sequence, ', ') within group (order by ato2.display_sequence) display_sequence , listagg(ato2.display_name, ', ') within group (order by ato2.display_sequence) display_name , listagg(ato2.help_text, ', ') within group (order by ato2.display_sequence) help_text from apex_appl_template_options ato join apex_appl_template_opt_groups atog on atog.template_opt_group_id = ato.group_id join apex_appl_template_options ato2 on ato2.group_id = ato.group_id where ato.application_id = :APP_ID and ato.virtual_template_type = p_template_type /* specific template */ and nvl(ato.virtual_template_id, p_template_id) = p_template_id /* specific css class */ and ato.css_classes = nvl(p_template_option, ato.css_classes) group by atog.display_sequence , atog.display_name , atog.help_text order by group_display_sequence , group_name , display_sequence , display_name; begin open_table ( p_html => p_html , p_th1 => 'Template Option' , p_th2 => 'Value(s)' , p_th3 => 'Comments' ); if l_display_only_associated_to then l_template_options := apex_util.string_to_table(p_template_options); for i in 1 .. l_template_options.count loop if l_template_options(i) = '#DEFAULT#' then get_row ( p_html => p_html , p_td1 => 'Use Default' , p_td2 => 'Yes' ); else if i = 1 then get_row ( p_html => p_html , p_td1 => 'Use Default' , p_td2 => 'No' ); end if; for j in c_template_options ( p_template_option => l_template_options(i) ) loop get_row ( p_html => p_html , p_td1 => j.display_name , p_td2 => 'Yes' , p_td3 => j.help_text ); end loop; if l_display_all_group_choices then for j in c_template_option_groups_all ( p_template_option => l_template_options(i) ) loop get_row ( p_html => p_html , p_td1 => j.group_name , p_td2 => j.display_name , p_td3 => j.group_help_text ); end loop; else for j in c_template_option_groups ( p_template_option => l_template_options(i) ) loop get_row ( p_html => p_html , p_td1 => j.group_name , p_td2 => j.display_name , p_td3 => j.group_help_text ); end loop; end if; end if; end loop; else for j in c_template_options loop get_row ( p_html => p_html , p_td1 => j.display_name , p_td2 => 'Yes' , p_td3 => j.help_text ); end loop; for j in c_template_option_groups loop get_row ( p_html => p_html , p_td1 => j.group_name , p_td2 => j.display_name , p_td3 => j.group_help_text ); end loop; end if; close_table(p_html); end get_template_options; procedure get_grid_attributes ( p_html in out nocopy varchar2 , p_table_name in varchar2 , p_column_name in varchar2 , p_column_value in number ) is type t_grid is ref cursor; rc_grid t_grid; l_sql varchar2(4000); l_attribute varchar2(255); l_value varchar2(255); begin l_sql := 'select attribute, value from ( select to_char(new_grid) as new_grid ,to_char(new_grid_row) as new_grid_row ,to_char(new_grid_column) as new_grid_column ,to_char(grid_column) as grid_column ,to_char(grid_column_span) as grid_column_span ,to_char(grid_column_css_classes) as grid_column_css_classes ,to_char(grid_column_attributes) as grid_column_attributes from ' || p_table_name || ' where ' || p_column_name || '= :column_value ) unpivot exclude nulls (value for attribute in ( new_grid ,new_grid_row ,new_grid_column ,grid_column ,grid_column_span ,grid_column_css_classes ,grid_column_attributes ))'; open_table ( p_html => p_html , p_th1 => 'Grid Attribute' , p_th2 => 'Value' ); open rc_grid for l_sql using p_column_value; loop fetch rc_grid into l_attribute, l_value; get_row ( p_html => p_html , p_td1 => replace(initcap(l_attribute),'_',' ') , p_td2 => l_value ); exit when rc_grid%notfound; end loop; close rc_grid; close_table(p_html); end get_grid_attributes; procedure get_custom_attributes ( p_html in out nocopy varchar2 , p_template_type in varchar2 , p_column_value in varchar2 ) is /* c_button_custom_attributes */ cursor c_button_custom_attributes is select attribute, value from ( select to_char(image_name) as image_name , to_char(image_attributes) as image_attributes , to_char(button_css_classes) as button_css_classes , to_char(icon_css_classes) as icon_css_classes , to_char(button_attributes) as button_attributes , to_char(pre_element_text) as pre_element_text , to_char(post_element_text) as post_element_text from apex_application_page_buttons where button_id = p_column_value ) unpivot exclude nulls (value for attribute in ( image_name , image_attributes , button_css_classes , icon_css_classes , button_attributes , pre_element_text , post_element_text )); /* c_field_custom_attributes */ cursor c_field_custom_attributes is select attribute, value from ( select to_char(display_as) as display_as , to_char(placeholder) as placeholder , to_char(pre_element_text) as pre_element_text , to_char(post_element_text) as post_element_text , to_char(format_mask) as format_mask , to_char(html_form_element_css_classes) as html_form_element_css_classes , to_char(html_form_element_attributes) as html_form_element_attributes , to_char(form_element_option_attributes) as form_element_option_attributes , to_char(item_button_image) as item_button_image , to_char(item_button_image_attributes) as item_button_image_attributes from apex_application_page_items where item_id = p_column_value ) unpivot exclude nulls (value for attribute in ( display_as , placeholder , pre_element_text , post_element_text , format_mask , html_form_element_css_classes , html_form_element_attributes , form_element_option_attributes , item_button_image , item_button_image_attributes )); /* c_region_custom_attributes */ cursor c_region_custom_attributes is select attribute, value from ( select to_char(report_template) as report_template , to_char(icon_css_classes) as icon_css_classes , to_char(region_attributes_substitution) as region_attributes_substitution , to_char(report_column_headings) as report_column_headings , to_char(pagination_scheme) as pagination_scheme , to_char(pagination_display_position) as pagination_display_position , to_char(breaks) as breaks from apex_application_page_regions where region_id = p_column_value ) unpivot exclude nulls (value for attribute in ( icon_css_classes , region_attributes_substitution , report_template , report_column_headings , pagination_scheme , pagination_display_position , breaks )); /* c_list_custom_attributes */ cursor c_list_custom_attributes is select attribute, value from ( select to_char(atl.a01_label) as a01_label , to_char(atl.a02_label) as a02_label , to_char(atl.a03_label) as a03_label , to_char(atl.a04_label) as a04_label , to_char(atl.a05_label) as a05_label , to_char(atl.a06_label) as a06_label , to_char(atl.a07_label) as a07_label , to_char(atl.a08_label) as a08_label , to_char(atl.a09_label) as a09_label , to_char(atl.a10_label) as a10_label from apex_application_page_regions apr join apex_application_temp_list atl on atl.application_id = apr.application_id and atl.list_template_id = apr.list_template_override_id where apr.region_id = p_column_value ) unpivot exclude nulls (value for attribute in ( a01_label , a02_label , a03_label , a04_label , a05_label , a06_label , a07_label , a08_label , a09_label , a10_label )); begin open_table ( p_html => p_html , p_th1 => 'Custom Attribute' , p_th2 => 'Value' ); case p_template_type when 'BUTTON' then for i in c_button_custom_attributes loop get_row ( p_html => p_html , p_td1 => replace(initcap(i.attribute),'_',' ') , p_td2 => i.value ); end loop; when 'FIELD' then for i in c_field_custom_attributes loop get_row ( p_html => p_html , p_td1 => replace(initcap(i.attribute),'_',' ') , p_td2 => i.value ); end loop; when 'LIST' then for i in c_list_custom_attributes loop get_row ( p_html => p_html , p_td1 => replace(initcap(i.attribute),'_',' ') , p_td2 => i.value ); end loop; when 'REGION' then for i in c_region_custom_attributes loop get_row ( p_html => p_html , p_td1 => replace(initcap(i.attribute),'_',' ') , p_td2 => i.value ); end loop; when 'REPORT' then for i in c_region_custom_attributes loop get_row ( p_html => p_html , p_td1 => replace(initcap(i.attribute),'_',' ') , p_td2 => i.value ); end loop; else null; end case; close_table(p_html); end get_custom_attributes; begin /* debug information will be included */ if apex_application.g_debug then apex_plugin_util.debug_region ( p_plugin => p_plugin , p_region => p_region , p_is_printer_friendly => p_is_printer_friendly ); end if; /* plugin should always be a sub-region */ /* get the parent_region_id from this plugin */ for i in c_sibling_regions loop get_component_info ( p_template_type => l_template_type , p_region_id => i.region_id , p_table_name => l_table_name , p_column_name => l_column_name , p_column_value => l_column_value , p_template_id => l_template_id , p_template_options => l_template_options ); if l_display_template_options then get_template_options ( p_html => l_html , p_template_type => l_template_type , p_template_id => l_template_id , p_template_options => l_template_options ); end if; if l_display_grid_attributes then get_grid_attributes ( p_html => l_html , p_table_name => l_table_name , p_column_name => l_column_name , p_column_value => l_column_value ); end if; if l_display_custom_attributes then get_custom_attributes ( p_html => l_html , p_template_type => l_template_type , p_column_value => l_column_value ); end if; sys.htp.p(l_html); l_html := null; end loop; return l_result; end render;
the_stack
-- Licensed to the Apache Software Foundation (ASF) under one or more -- contributor license agreements. See the NOTICE file distributed with -- this work for additional information regarding copyright ownership. -- The ASF licenses this file to You under the Apache License, Version 2.0 -- (the "License"); you may not use this file except in compliance with -- the License. You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-30',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-03-31',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-11',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-12',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-15',5,5,0); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-20',10,0,0); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-23',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-24',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-03',11,0,0); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-05',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-06',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-17',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-18',2,2,2); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-29',1,1,1); insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-30',2,2,2);
the_stack
SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for auth_group -- ---------------------------- DROP TABLE IF EXISTS `auth_group`; CREATE TABLE `auth_group` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(80) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of auth_group -- ---------------------------- -- ---------------------------- -- Table structure for auth_group_permissions -- ---------------------------- DROP TABLE IF EXISTS `auth_group_permissions`; CREATE TABLE `auth_group_permissions` ( `id` int(11) NOT NULL AUTO_INCREMENT, `group_id` int(11) NOT NULL, `permission_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `auth_group_permissions_group_id_permission_id_0cd325b0_uniq` (`group_id`,`permission_id`), KEY `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` (`permission_id`), CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of auth_group_permissions -- ---------------------------- -- ---------------------------- -- Table structure for auth_permission -- ---------------------------- DROP TABLE IF EXISTS `auth_permission`; CREATE TABLE `auth_permission` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `content_type_id` int(11) NOT NULL, `codename` varchar(100) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `auth_permission_content_type_id_codename_01ab375a_uniq` (`content_type_id`,`codename`), CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=77 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of auth_permission -- ---------------------------- INSERT INTO `auth_permission` VALUES ('1', 'Can add log entry', '1', 'add_logentry'); INSERT INTO `auth_permission` VALUES ('2', 'Can change log entry', '1', 'change_logentry'); INSERT INTO `auth_permission` VALUES ('3', 'Can delete log entry', '1', 'delete_logentry'); INSERT INTO `auth_permission` VALUES ('4', 'Can view log entry', '1', 'view_logentry'); INSERT INTO `auth_permission` VALUES ('5', 'Can add permission', '2', 'add_permission'); INSERT INTO `auth_permission` VALUES ('6', 'Can change permission', '2', 'change_permission'); INSERT INTO `auth_permission` VALUES ('7', 'Can delete permission', '2', 'delete_permission'); INSERT INTO `auth_permission` VALUES ('8', 'Can view permission', '2', 'view_permission'); INSERT INTO `auth_permission` VALUES ('9', 'Can add group', '3', 'add_group'); INSERT INTO `auth_permission` VALUES ('10', 'Can change group', '3', 'change_group'); INSERT INTO `auth_permission` VALUES ('11', 'Can delete group', '3', 'delete_group'); INSERT INTO `auth_permission` VALUES ('12', 'Can view group', '3', 'view_group'); INSERT INTO `auth_permission` VALUES ('13', 'Can add content type', '4', 'add_contenttype'); INSERT INTO `auth_permission` VALUES ('14', 'Can change content type', '4', 'change_contenttype'); INSERT INTO `auth_permission` VALUES ('15', 'Can delete content type', '4', 'delete_contenttype'); INSERT INTO `auth_permission` VALUES ('16', 'Can view content type', '4', 'view_contenttype'); INSERT INTO `auth_permission` VALUES ('17', 'Can add session', '5', 'add_session'); INSERT INTO `auth_permission` VALUES ('18', 'Can change session', '5', 'change_session'); INSERT INTO `auth_permission` VALUES ('19', 'Can delete session', '5', 'delete_session'); INSERT INTO `auth_permission` VALUES ('20', 'Can view session', '5', 'view_session'); INSERT INTO `auth_permission` VALUES ('21', 'Can add site', '6', 'add_site'); INSERT INTO `auth_permission` VALUES ('22', 'Can change site', '6', 'change_site'); INSERT INTO `auth_permission` VALUES ('23', 'Can delete site', '6', 'delete_site'); INSERT INTO `auth_permission` VALUES ('24', 'Can view site', '6', 'view_site'); INSERT INTO `auth_permission` VALUES ('25', 'Can add 2-文章', '7', 'add_article'); INSERT INTO `auth_permission` VALUES ('26', 'Can change 2-文章', '7', 'change_article'); INSERT INTO `auth_permission` VALUES ('27', 'Can delete 2-文章', '7', 'delete_article'); INSERT INTO `auth_permission` VALUES ('28', 'Can view 2-文章', '7', 'view_article'); INSERT INTO `auth_permission` VALUES ('29', 'Can add 1-文章分类', '8', 'add_category'); INSERT INTO `auth_permission` VALUES ('30', 'Can change 1-文章分类', '8', 'change_category'); INSERT INTO `auth_permission` VALUES ('31', 'Can delete 1-文章分类', '8', 'delete_category'); INSERT INTO `auth_permission` VALUES ('32', 'Can view 1-文章分类', '8', 'view_category'); INSERT INTO `auth_permission` VALUES ('33', 'Can add 3-文章评论', '9', 'add_comment'); INSERT INTO `auth_permission` VALUES ('34', 'Can change 3-文章评论', '9', 'change_comment'); INSERT INTO `auth_permission` VALUES ('35', 'Can delete 3-文章评论', '9', 'delete_comment'); INSERT INTO `auth_permission` VALUES ('36', 'Can view 3-文章评论', '9', 'view_comment'); INSERT INTO `auth_permission` VALUES ('37', 'Can add 8-友情链接', '10', 'add_link'); INSERT INTO `auth_permission` VALUES ('38', 'Can change 8-友情链接', '10', 'change_link'); INSERT INTO `auth_permission` VALUES ('39', 'Can delete 8-友情链接', '10', 'delete_link'); INSERT INTO `auth_permission` VALUES ('40', 'Can view 8-友情链接', '10', 'view_link'); INSERT INTO `auth_permission` VALUES ('41', 'Can add 0-站点配置', '11', 'add_setting'); INSERT INTO `auth_permission` VALUES ('42', 'Can change 0-站点配置', '11', 'change_setting'); INSERT INTO `auth_permission` VALUES ('43', 'Can delete 0-站点配置', '11', 'delete_setting'); INSERT INTO `auth_permission` VALUES ('44', 'Can view 0-站点配置', '11', 'view_setting'); INSERT INTO `auth_permission` VALUES ('45', 'Can add 5-侧边栏', '12', 'add_sidebar'); INSERT INTO `auth_permission` VALUES ('46', 'Can change 5-侧边栏', '12', 'change_sidebar'); INSERT INTO `auth_permission` VALUES ('47', 'Can delete 5-侧边栏', '12', 'delete_sidebar'); INSERT INTO `auth_permission` VALUES ('48', 'Can view 5-侧边栏', '12', 'view_sidebar'); INSERT INTO `auth_permission` VALUES ('49', 'Can add 4-文章标签', '13', 'add_tag'); INSERT INTO `auth_permission` VALUES ('50', 'Can change 4-文章标签', '13', 'change_tag'); INSERT INTO `auth_permission` VALUES ('51', 'Can delete 4-文章标签', '13', 'delete_tag'); INSERT INTO `auth_permission` VALUES ('52', 'Can view 4-文章标签', '13', 'view_tag'); INSERT INTO `auth_permission` VALUES ('53', 'Can add 6-相册图片', '14', 'add_photo'); INSERT INTO `auth_permission` VALUES ('54', 'Can change 6-相册图片', '14', 'change_photo'); INSERT INTO `auth_permission` VALUES ('55', 'Can delete 6-相册图片', '14', 'delete_photo'); INSERT INTO `auth_permission` VALUES ('56', 'Can view 6-相册图片', '14', 'view_photo'); INSERT INTO `auth_permission` VALUES ('57', 'Can add 7-留言板', '15', 'add_guestbook'); INSERT INTO `auth_permission` VALUES ('58', 'Can change 7-留言板', '15', 'change_guestbook'); INSERT INTO `auth_permission` VALUES ('59', 'Can delete 7-留言板', '15', 'delete_guestbook'); INSERT INTO `auth_permission` VALUES ('60', 'Can view 7-留言板', '15', 'view_guestbook'); INSERT INTO `auth_permission` VALUES ('61', 'Can add 0-用户', '16', 'add_userprofile'); INSERT INTO `auth_permission` VALUES ('62', 'Can change 0-用户', '16', 'change_userprofile'); INSERT INTO `auth_permission` VALUES ('63', 'Can delete 0-用户', '16', 'delete_userprofile'); INSERT INTO `auth_permission` VALUES ('64', 'Can view 0-用户', '16', 'view_userprofile'); INSERT INTO `auth_permission` VALUES ('65', 'Can add 1-邮箱验证码', '17', 'add_emailverifycode'); INSERT INTO `auth_permission` VALUES ('66', 'Can change 1-邮箱验证码', '17', 'change_emailverifycode'); INSERT INTO `auth_permission` VALUES ('67', 'Can delete 1-邮箱验证码', '17', 'delete_emailverifycode'); INSERT INTO `auth_permission` VALUES ('68', 'Can view 1-邮箱验证码', '17', 'view_emailverifycode'); INSERT INTO `auth_permission` VALUES ('69', 'Can add 0-OAuth配置', '18', 'add_oauthconfig'); INSERT INTO `auth_permission` VALUES ('70', 'Can change 0-OAuth配置', '18', 'change_oauthconfig'); INSERT INTO `auth_permission` VALUES ('71', 'Can delete 0-OAuth配置', '18', 'delete_oauthconfig'); INSERT INTO `auth_permission` VALUES ('72', 'Can view 0-OAuth配置', '18', 'view_oauthconfig'); INSERT INTO `auth_permission` VALUES ('73', 'Can add 1-Oauth用户', '19', 'add_oauthuser'); INSERT INTO `auth_permission` VALUES ('74', 'Can change 1-Oauth用户', '19', 'change_oauthuser'); INSERT INTO `auth_permission` VALUES ('75', 'Can delete 1-Oauth用户', '19', 'delete_oauthuser'); INSERT INTO `auth_permission` VALUES ('76', 'Can view 1-Oauth用户', '19', 'view_oauthuser'); -- ---------------------------- -- Table structure for blog_article -- ---------------------------- DROP TABLE IF EXISTS `blog_article`; CREATE TABLE `blog_article` ( `id` int(11) NOT NULL AUTO_INCREMENT, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, `title` varchar(100) NOT NULL, `content` longtext NOT NULL, `order` int(11) NOT NULL, `views` int(10) unsigned NOT NULL, `author_id` int(11) NOT NULL, `category_id` int(11) NOT NULL, `type` varchar(1) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `title` (`title`), KEY `blog_article_author_id_905add38_fk_user_userprofile_id` (`author_id`), KEY `blog_article_category_id_7e38f15e_fk_blog_category_id` (`category_id`), CONSTRAINT `blog_article_author_id_905add38_fk_user_userprofile_id` FOREIGN KEY (`author_id`) REFERENCES `user_userprofile` (`id`), CONSTRAINT `blog_article_category_id_7e38f15e_fk_blog_category_id` FOREIGN KEY (`category_id`) REFERENCES `blog_category` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of blog_article -- ---------------------------- INSERT INTO `blog_article` VALUES ('1', '2019-05-31 14:24:07.528600', '2019-05-31 14:24:08.291600', '我是测试标题 1', '我是测试内容 1', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('2', '2019-05-31 14:24:08.308600', '2019-05-31 14:24:08.338600', '我是测试标题 2', '我是测试内容 2', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('3', '2019-05-31 14:24:08.357600', '2019-05-31 14:24:08.593600', '我是测试标题 3', '我是测试内容 3', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('4', '2019-05-31 14:24:08.611600', '2019-05-31 14:24:08.647600', '我是测试标题 4', '我是测试内容 4', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('5', '2019-05-31 14:24:08.667600', '2019-05-31 14:24:08.701600', '我是测试标题 5', '我是测试内容 5', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('6', '2019-05-31 14:24:08.925600', '2019-05-31 14:24:08.982600', '我是测试标题 6', '我是测试内容 6', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('7', '2019-05-31 14:24:09.001600', '2019-05-31 14:24:09.032600', '我是测试标题 7', '我是测试内容 7', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('8', '2019-05-31 14:24:09.051600', '2019-05-31 14:24:09.288600', '我是测试标题 8', '我是测试内容 8', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('9', '2019-05-31 14:24:09.305600', '2019-05-31 14:24:09.336600', '我是测试标题 9', '我是测试内容 9', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('10', '2019-05-31 14:24:09.355600', '2019-05-31 14:24:09.388600', '我是测试标题 10', '我是测试内容 10', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('11', '2019-05-31 14:24:09.612600', '2019-05-31 14:24:09.641600', '我是测试标题 11', '我是测试内容 11', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('12', '2019-05-31 14:24:09.660600', '2019-05-31 14:24:09.693600', '我是测试标题 12', '我是测试内容 12', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('13', '2019-05-31 14:24:09.714600', '2019-05-31 14:24:09.964600', '我是测试标题 13', '我是测试内容 13', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('14', '2019-05-31 14:24:09.982600', '2019-05-31 14:24:10.011600', '我是测试标题 14', '我是测试内容 14', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('15', '2019-05-31 14:24:10.030600', '2019-05-31 14:24:10.061600', '我是测试标题 15', '我是测试内容 15', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('16', '2019-05-31 14:24:10.285600', '2019-05-31 14:24:10.312600', '我是测试标题 16', '我是测试内容 16', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('17', '2019-05-31 14:24:10.330600', '2019-05-31 14:24:10.362600', '我是测试标题 17', '我是测试内容 17', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('18', '2019-05-31 14:24:10.382600', '2019-05-31 14:24:10.619600', '我是测试标题 18', '我是测试内容 18', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('19', '2019-05-31 14:24:10.635600', '2019-05-31 14:24:10.667600', '我是测试标题 19', '我是测试内容 19', '0', '0', '1', '2', 'a'); INSERT INTO `blog_article` VALUES ('20', '2019-05-31 14:24:10.687600', '2019-05-31 14:24:10.712600', '彬彬博客', '\n### 支持Markdown\n\n```python\nprint(\'支持语法高亮\')\n```\n ', '0', '0', '1', '2', 'a'); -- ---------------------------- -- Table structure for blog_article_tags -- ---------------------------- DROP TABLE IF EXISTS `blog_article_tags`; CREATE TABLE `blog_article_tags` ( `id` int(11) NOT NULL AUTO_INCREMENT, `article_id` int(11) NOT NULL, `tag_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `blog_article_tags_article_id_tag_id_b78a22e9_uniq` (`article_id`,`tag_id`), KEY `blog_article_tags_tag_id_88eb3ed9_fk_blog_tag_id` (`tag_id`), CONSTRAINT `blog_article_tags_article_id_82c02dd6_fk_blog_article_id` FOREIGN KEY (`article_id`) REFERENCES `blog_article` (`id`), CONSTRAINT `blog_article_tags_tag_id_88eb3ed9_fk_blog_tag_id` FOREIGN KEY (`tag_id`) REFERENCES `blog_tag` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of blog_article_tags -- ---------------------------- INSERT INTO `blog_article_tags` VALUES ('2', '1', '1'); INSERT INTO `blog_article_tags` VALUES ('1', '1', '2'); INSERT INTO `blog_article_tags` VALUES ('4', '2', '1'); INSERT INTO `blog_article_tags` VALUES ('3', '2', '3'); INSERT INTO `blog_article_tags` VALUES ('6', '3', '1'); INSERT INTO `blog_article_tags` VALUES ('5', '3', '4'); INSERT INTO `blog_article_tags` VALUES ('8', '4', '1'); INSERT INTO `blog_article_tags` VALUES ('7', '4', '5'); INSERT INTO `blog_article_tags` VALUES ('10', '5', '1'); INSERT INTO `blog_article_tags` VALUES ('9', '5', '6'); INSERT INTO `blog_article_tags` VALUES ('12', '6', '1'); INSERT INTO `blog_article_tags` VALUES ('11', '6', '7'); INSERT INTO `blog_article_tags` VALUES ('14', '7', '1'); INSERT INTO `blog_article_tags` VALUES ('13', '7', '8'); INSERT INTO `blog_article_tags` VALUES ('16', '8', '1'); INSERT INTO `blog_article_tags` VALUES ('15', '8', '9'); INSERT INTO `blog_article_tags` VALUES ('18', '9', '1'); INSERT INTO `blog_article_tags` VALUES ('17', '9', '10'); INSERT INTO `blog_article_tags` VALUES ('20', '10', '1'); INSERT INTO `blog_article_tags` VALUES ('19', '10', '11'); INSERT INTO `blog_article_tags` VALUES ('22', '11', '1'); INSERT INTO `blog_article_tags` VALUES ('21', '11', '12'); INSERT INTO `blog_article_tags` VALUES ('24', '12', '1'); INSERT INTO `blog_article_tags` VALUES ('23', '12', '13'); INSERT INTO `blog_article_tags` VALUES ('26', '13', '1'); INSERT INTO `blog_article_tags` VALUES ('25', '13', '14'); INSERT INTO `blog_article_tags` VALUES ('28', '14', '1'); INSERT INTO `blog_article_tags` VALUES ('27', '14', '15'); INSERT INTO `blog_article_tags` VALUES ('30', '15', '1'); INSERT INTO `blog_article_tags` VALUES ('29', '15', '16'); INSERT INTO `blog_article_tags` VALUES ('32', '16', '1'); INSERT INTO `blog_article_tags` VALUES ('31', '16', '17'); INSERT INTO `blog_article_tags` VALUES ('34', '17', '1'); INSERT INTO `blog_article_tags` VALUES ('33', '17', '18'); INSERT INTO `blog_article_tags` VALUES ('36', '18', '1'); INSERT INTO `blog_article_tags` VALUES ('35', '18', '19'); INSERT INTO `blog_article_tags` VALUES ('38', '19', '1'); INSERT INTO `blog_article_tags` VALUES ('37', '19', '20'); INSERT INTO `blog_article_tags` VALUES ('39', '20', '1'); -- ---------------------------- -- Table structure for blog_category -- ---------------------------- DROP TABLE IF EXISTS `blog_category`; CREATE TABLE `blog_category` ( `id` int(11) NOT NULL AUTO_INCREMENT, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, `name` varchar(30) NOT NULL, `slug` varchar(50) NOT NULL, `parent_category_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `blog_category_parent_category_id_f50c3c0c_fk_blog_category_id` (`parent_category_id`), KEY `blog_category_slug_92643dc5` (`slug`), CONSTRAINT `blog_category_parent_category_id_f50c3c0c_fk_blog_category_id` FOREIGN KEY (`parent_category_id`) REFERENCES `blog_category` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of blog_category -- ---------------------------- INSERT INTO `blog_category` VALUES ('1', '2019-05-31 14:24:07.506600', '2019-05-31 14:24:07.508600', 'python学习', 'pythonxue-xi', null); INSERT INTO `blog_category` VALUES ('2', '2019-05-31 14:24:07.514600', '2019-05-31 14:24:07.514600', 'django学习', 'djangoxue-xi', '1'); -- ---------------------------- -- Table structure for blog_comment -- ---------------------------- DROP TABLE IF EXISTS `blog_comment`; CREATE TABLE `blog_comment` ( `id` int(11) NOT NULL AUTO_INCREMENT, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, `content` longtext NOT NULL, `is_enable` tinyint(1) NOT NULL, `article_id` int(11) NOT NULL, `author_id` int(11) NOT NULL, `parent_comment_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `blog_comment_article_id_3d58bca6_fk_blog_article_id` (`article_id`), KEY `blog_comment_author_id_4f11e2e0_fk_user_userprofile_id` (`author_id`), KEY `blog_comment_parent_comment_id_26791b9a_fk_blog_comment_id` (`parent_comment_id`), CONSTRAINT `blog_comment_article_id_3d58bca6_fk_blog_article_id` FOREIGN KEY (`article_id`) REFERENCES `blog_article` (`id`), CONSTRAINT `blog_comment_author_id_4f11e2e0_fk_user_userprofile_id` FOREIGN KEY (`author_id`) REFERENCES `user_userprofile` (`id`), CONSTRAINT `blog_comment_parent_comment_id_26791b9a_fk_blog_comment_id` FOREIGN KEY (`parent_comment_id`) REFERENCES `blog_comment` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of blog_comment -- ---------------------------- -- ---------------------------- -- Table structure for blog_guestbook -- ---------------------------- DROP TABLE IF EXISTS `blog_guestbook`; CREATE TABLE `blog_guestbook` ( `id` int(11) NOT NULL AUTO_INCREMENT, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, `content` longtext NOT NULL, `author_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `blog_guestbook_author_id_a34aaf0d_fk_user_userprofile_id` (`author_id`), CONSTRAINT `blog_guestbook_author_id_a34aaf0d_fk_user_userprofile_id` FOREIGN KEY (`author_id`) REFERENCES `user_userprofile` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of blog_guestbook -- ---------------------------- -- ---------------------------- -- Table structure for blog_link -- ---------------------------- DROP TABLE IF EXISTS `blog_link`; CREATE TABLE `blog_link` ( `id` int(11) NOT NULL AUTO_INCREMENT, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, `name` varchar(30) NOT NULL, `order` int(11) NOT NULL, `url` varchar(200) NOT NULL, `is_enable` tinyint(1) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of blog_link -- ---------------------------- -- ---------------------------- -- Table structure for blog_photo -- ---------------------------- DROP TABLE IF EXISTS `blog_photo`; CREATE TABLE `blog_photo` ( `id` int(11) NOT NULL AUTO_INCREMENT, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, `title` varchar(50) NOT NULL, `desc` longtext, `image` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of blog_photo -- ---------------------------- INSERT INTO `blog_photo` VALUES ('1', '2019-05-31 14:24:00.000000', '2019-05-31 14:25:00.940600', '宠物狗', '', 'photo/宠物狗.宠物狗.宠物狗.jpg'); -- ---------------------------- -- Table structure for blog_setting -- ---------------------------- DROP TABLE IF EXISTS `blog_setting`; CREATE TABLE `blog_setting` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL, `desc` longtext NOT NULL, `keyword` longtext NOT NULL, `article_desc_len` int(11) NOT NULL, `sidebar_article_count` int(11) NOT NULL, `github_user` varchar(50) NOT NULL, `github_repository` varchar(50) NOT NULL, `enable_photo` tinyint(1) NOT NULL, `user_verify_email` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of blog_setting -- ---------------------------- INSERT INTO `blog_setting` VALUES ('1', 'BinBlog', '彬彬博客', 'python3, django2, blog, binblog', '250', '5', 'enjoy-binbin', 'binblog-Django', '1', '0'); -- ---------------------------- -- Table structure for blog_sidebar -- ---------------------------- DROP TABLE IF EXISTS `blog_sidebar`; CREATE TABLE `blog_sidebar` ( `id` int(11) NOT NULL AUTO_INCREMENT, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, `title` varchar(30) NOT NULL, `content` longtext NOT NULL, `order` int(11) NOT NULL, `is_enable` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of blog_sidebar -- ---------------------------- -- ---------------------------- -- Table structure for blog_tag -- ---------------------------- DROP TABLE IF EXISTS `blog_tag`; CREATE TABLE `blog_tag` ( `id` int(11) NOT NULL AUTO_INCREMENT, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, `name` varchar(25) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of blog_tag -- ---------------------------- INSERT INTO `blog_tag` VALUES ('1', '2019-05-31 14:24:07.521600', '2019-05-31 14:24:07.521600', 'Django'); INSERT INTO `blog_tag` VALUES ('2', '2019-05-31 14:24:08.278600', '2019-05-31 14:24:08.278600', '标签1'); INSERT INTO `blog_tag` VALUES ('3', '2019-05-31 14:24:08.325600', '2019-05-31 14:24:08.325600', '标签2'); INSERT INTO `blog_tag` VALUES ('4', '2019-05-31 14:24:08.581600', '2019-05-31 14:24:08.581600', '标签3'); INSERT INTO `blog_tag` VALUES ('5', '2019-05-31 14:24:08.632600', '2019-05-31 14:24:08.632600', '标签4'); INSERT INTO `blog_tag` VALUES ('6', '2019-05-31 14:24:08.687600', '2019-05-31 14:24:08.687600', '标签5'); INSERT INTO `blog_tag` VALUES ('7', '2019-05-31 14:24:08.970600', '2019-05-31 14:24:08.970600', '标签6'); INSERT INTO `blog_tag` VALUES ('8', '2019-05-31 14:24:09.021600', '2019-05-31 14:24:09.021600', '标签7'); INSERT INTO `blog_tag` VALUES ('9', '2019-05-31 14:24:09.275600', '2019-05-31 14:24:09.275600', '标签8'); INSERT INTO `blog_tag` VALUES ('10', '2019-05-31 14:24:09.323600', '2019-05-31 14:24:09.323600', '标签9'); INSERT INTO `blog_tag` VALUES ('11', '2019-05-31 14:24:09.375600', '2019-05-31 14:24:09.375600', '标签10'); INSERT INTO `blog_tag` VALUES ('12', '2019-05-31 14:24:09.629600', '2019-05-31 14:24:09.629600', '标签11'); INSERT INTO `blog_tag` VALUES ('13', '2019-05-31 14:24:09.680600', '2019-05-31 14:24:09.680600', '标签12'); INSERT INTO `blog_tag` VALUES ('14', '2019-05-31 14:24:09.953600', '2019-05-31 14:24:09.953600', '标签13'); INSERT INTO `blog_tag` VALUES ('15', '2019-05-31 14:24:09.999600', '2019-05-31 14:24:09.999600', '标签14'); INSERT INTO `blog_tag` VALUES ('16', '2019-05-31 14:24:10.049600', '2019-05-31 14:24:10.049600', '标签15'); INSERT INTO `blog_tag` VALUES ('17', '2019-05-31 14:24:10.302600', '2019-05-31 14:24:10.302600', '标签16'); INSERT INTO `blog_tag` VALUES ('18', '2019-05-31 14:24:10.348600', '2019-05-31 14:24:10.348600', '标签17'); INSERT INTO `blog_tag` VALUES ('19', '2019-05-31 14:24:10.607600', '2019-05-31 14:24:10.607600', '标签18'); INSERT INTO `blog_tag` VALUES ('20', '2019-05-31 14:24:10.653600', '2019-05-31 14:24:10.653600', '标签19'); -- ---------------------------- -- Table structure for django_admin_log -- ---------------------------- DROP TABLE IF EXISTS `django_admin_log`; CREATE TABLE `django_admin_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `action_time` datetime(6) NOT NULL, `object_id` longtext, `object_repr` varchar(200) NOT NULL, `action_flag` smallint(5) unsigned NOT NULL, `change_message` longtext NOT NULL, `content_type_id` int(11) DEFAULT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `django_admin_log_content_type_id_c4bce8eb_fk_django_co` (`content_type_id`), KEY `django_admin_log_user_id_c564eba6_fk_user_userprofile_id` (`user_id`), CONSTRAINT `django_admin_log_content_type_id_c4bce8eb_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), CONSTRAINT `django_admin_log_user_id_c564eba6_fk_user_userprofile_id` FOREIGN KEY (`user_id`) REFERENCES `user_userprofile` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of django_admin_log -- ---------------------------- INSERT INTO `django_admin_log` VALUES ('1', '2019-05-31 14:25:00.943600', '1', '宠物狗', '1', '[{\"added\": {}}]', '14', '1'); -- ---------------------------- -- Table structure for django_content_type -- ---------------------------- DROP TABLE IF EXISTS `django_content_type`; CREATE TABLE `django_content_type` ( `id` int(11) NOT NULL AUTO_INCREMENT, `app_label` varchar(100) NOT NULL, `model` varchar(100) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `django_content_type_app_label_model_76bd3d3b_uniq` (`app_label`,`model`) ) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of django_content_type -- ---------------------------- INSERT INTO `django_content_type` VALUES ('1', 'admin', 'logentry'); INSERT INTO `django_content_type` VALUES ('3', 'auth', 'group'); INSERT INTO `django_content_type` VALUES ('2', 'auth', 'permission'); INSERT INTO `django_content_type` VALUES ('7', 'blog', 'article'); INSERT INTO `django_content_type` VALUES ('8', 'blog', 'category'); INSERT INTO `django_content_type` VALUES ('9', 'blog', 'comment'); INSERT INTO `django_content_type` VALUES ('15', 'blog', 'guestbook'); INSERT INTO `django_content_type` VALUES ('10', 'blog', 'link'); INSERT INTO `django_content_type` VALUES ('14', 'blog', 'photo'); INSERT INTO `django_content_type` VALUES ('11', 'blog', 'setting'); INSERT INTO `django_content_type` VALUES ('12', 'blog', 'sidebar'); INSERT INTO `django_content_type` VALUES ('13', 'blog', 'tag'); INSERT INTO `django_content_type` VALUES ('4', 'contenttypes', 'contenttype'); INSERT INTO `django_content_type` VALUES ('18', 'oauth', 'oauthconfig'); INSERT INTO `django_content_type` VALUES ('19', 'oauth', 'oauthuser'); INSERT INTO `django_content_type` VALUES ('5', 'sessions', 'session'); INSERT INTO `django_content_type` VALUES ('6', 'sites', 'site'); INSERT INTO `django_content_type` VALUES ('17', 'user', 'emailverifycode'); INSERT INTO `django_content_type` VALUES ('16', 'user', 'userprofile'); -- ---------------------------- -- Table structure for django_migrations -- ---------------------------- DROP TABLE IF EXISTS `django_migrations`; CREATE TABLE `django_migrations` ( `id` int(11) NOT NULL AUTO_INCREMENT, `app` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, `applied` datetime(6) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of django_migrations -- ---------------------------- INSERT INTO `django_migrations` VALUES ('1', 'contenttypes', '0001_initial', '2019-05-31 14:23:39.382600'); INSERT INTO `django_migrations` VALUES ('2', 'contenttypes', '0002_remove_content_type_name', '2019-05-31 14:23:39.449600'); INSERT INTO `django_migrations` VALUES ('3', 'auth', '0001_initial', '2019-05-31 14:23:39.643600'); INSERT INTO `django_migrations` VALUES ('4', 'auth', '0002_alter_permission_name_max_length', '2019-05-31 14:23:39.682600'); INSERT INTO `django_migrations` VALUES ('5', 'auth', '0003_alter_user_email_max_length', '2019-05-31 14:23:39.690600'); INSERT INTO `django_migrations` VALUES ('6', 'auth', '0004_alter_user_username_opts', '2019-05-31 14:23:39.699600'); INSERT INTO `django_migrations` VALUES ('7', 'auth', '0005_alter_user_last_login_null', '2019-05-31 14:23:39.710600'); INSERT INTO `django_migrations` VALUES ('8', 'auth', '0006_require_contenttypes_0002', '2019-05-31 14:23:39.715600'); INSERT INTO `django_migrations` VALUES ('9', 'auth', '0007_alter_validators_add_error_messages', '2019-05-31 14:23:39.725600'); INSERT INTO `django_migrations` VALUES ('10', 'auth', '0008_alter_user_username_max_length', '2019-05-31 14:23:39.735600'); INSERT INTO `django_migrations` VALUES ('11', 'auth', '0009_alter_user_last_name_max_length', '2019-05-31 14:23:39.745600'); INSERT INTO `django_migrations` VALUES ('12', 'user', '0001_initial', '2019-05-31 14:23:39.999600'); INSERT INTO `django_migrations` VALUES ('13', 'admin', '0001_initial', '2019-05-31 14:23:40.105600'); INSERT INTO `django_migrations` VALUES ('14', 'admin', '0002_logentry_remove_auto_add', '2019-05-31 14:23:40.117600'); INSERT INTO `django_migrations` VALUES ('15', 'admin', '0003_logentry_add_action_flag_choices', '2019-05-31 14:23:40.131600'); INSERT INTO `django_migrations` VALUES ('16', 'blog', '0001_initial', '2019-05-31 14:23:40.794600'); INSERT INTO `django_migrations` VALUES ('17', 'blog', '0002_auto_20190310_1511', '2019-05-31 14:23:40.852600'); INSERT INTO `django_migrations` VALUES ('18', 'blog', '0003_auto_20190318_2034', '2019-05-31 14:23:40.867600'); INSERT INTO `django_migrations` VALUES ('19', 'blog', '0004_article_type', '2019-05-31 14:23:40.909600'); INSERT INTO `django_migrations` VALUES ('20', 'blog', '0005_photo', '2019-05-31 14:23:40.937600'); INSERT INTO `django_migrations` VALUES ('21', 'blog', '0006_guestbook', '2019-05-31 14:23:41.076600'); INSERT INTO `django_migrations` VALUES ('22', 'blog', '0007_auto_20190512_2311', '2019-05-31 14:23:41.196600'); INSERT INTO `django_migrations` VALUES ('23', 'blog', '0008_auto_20190512_2347', '2019-05-31 14:23:41.266600'); INSERT INTO `django_migrations` VALUES ('24', 'blog', '0009_auto_20190528_1022', '2019-05-31 14:23:41.373600'); INSERT INTO `django_migrations` VALUES ('25', 'blog', '0010_setting_user_verify_email', '2019-05-31 14:23:41.410600'); INSERT INTO `django_migrations` VALUES ('26', 'oauth', '0001_initial', '2019-05-31 14:23:41.522600'); INSERT INTO `django_migrations` VALUES ('27', 'oauth', '0002_auto_20190512_1129', '2019-05-31 14:23:41.532600'); INSERT INTO `django_migrations` VALUES ('28', 'oauth', '0003_auto_20190531_0914', '2019-05-31 14:23:41.550600'); INSERT INTO `django_migrations` VALUES ('29', 'sessions', '0001_initial', '2019-05-31 14:23:41.601600'); INSERT INTO `django_migrations` VALUES ('30', 'sites', '0001_initial', '2019-05-31 14:23:41.628600'); INSERT INTO `django_migrations` VALUES ('31', 'sites', '0002_alter_domain_unique', '2019-05-31 14:23:41.648600'); INSERT INTO `django_migrations` VALUES ('32', 'user', '0002_auto_20190530_1341', '2019-05-31 14:23:41.685600'); INSERT INTO `django_migrations` VALUES ('33', 'user', '0003_auto_20190531_0914', '2019-05-31 14:23:41.732600'); -- ---------------------------- -- Table structure for django_session -- ---------------------------- DROP TABLE IF EXISTS `django_session`; CREATE TABLE `django_session` ( `session_key` varchar(40) NOT NULL, `session_data` longtext NOT NULL, `expire_date` datetime(6) NOT NULL, PRIMARY KEY (`session_key`), KEY `django_session_expire_date_a5c62663` (`expire_date`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of django_session -- ---------------------------- INSERT INTO `django_session` VALUES ('uzxxjcnamzg8t229hncta2r5z2a5row9', 'OGE0MmEwYmExMmFiMTA5ZGJmMWVmNzlmM2ViNTRhY2Y3MGU4Mjg2OTp7Il9hdXRoX3VzZXJfaWQiOiIxIiwiX2F1dGhfdXNlcl9iYWNrZW5kIjoiZGphbmdvLmNvbnRyaWIuYXV0aC5iYWNrZW5kcy5BbGxvd0FsbFVzZXJzTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiNmY2ODhkYzMwYTkzYjMwOGNkYzYwMmEyOGM4MTBmNjZiN2EyODJjYSJ9', '2019-06-14 14:24:31.878600'); -- ---------------------------- -- Table structure for django_site -- ---------------------------- DROP TABLE IF EXISTS `django_site`; CREATE TABLE `django_site` ( `id` int(11) NOT NULL AUTO_INCREMENT, `domain` varchar(100) NOT NULL, `name` varchar(50) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `django_site_domain_a2e37b91_uniq` (`domain`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of django_site -- ---------------------------- INSERT INTO `django_site` VALUES ('1', 'example.com', 'example.com'); -- ---------------------------- -- Table structure for oauth_oauthconfig -- ---------------------------- DROP TABLE IF EXISTS `oauth_oauthconfig`; CREATE TABLE `oauth_oauthconfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(10) NOT NULL, `app_key` varchar(200) NOT NULL, `app_secret` varchar(200) NOT NULL, `callback_url` varchar(200) NOT NULL, `is_enable` tinyint(1) NOT NULL, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of oauth_oauthconfig -- ---------------------------- -- ---------------------------- -- Table structure for oauth_oauthuser -- ---------------------------- DROP TABLE IF EXISTS `oauth_oauthuser`; CREATE TABLE `oauth_oauthuser` ( `id` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(50) NOT NULL, `nickname` varchar(50) NOT NULL, `email` varchar(50) DEFAULT NULL, `avatar_url` varchar(350) DEFAULT NULL, `user_info` longtext, `openid` varchar(50) NOT NULL, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, `user_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `oauth_oauthuser_user_id_fe2a59af_fk_user_userprofile_id` (`user_id`), CONSTRAINT `oauth_oauthuser_user_id_fe2a59af_fk_user_userprofile_id` FOREIGN KEY (`user_id`) REFERENCES `user_userprofile` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of oauth_oauthuser -- ---------------------------- -- ---------------------------- -- Table structure for user_emailverifycode -- ---------------------------- DROP TABLE IF EXISTS `user_emailverifycode`; CREATE TABLE `user_emailverifycode` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(20) NOT NULL, `email` varchar(50) NOT NULL, `type` varchar(20) NOT NULL, `is_used` tinyint(1) NOT NULL, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, `task_id` varchar(36) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of user_emailverifycode -- ---------------------------- -- ---------------------------- -- Table structure for user_userprofile -- ---------------------------- DROP TABLE IF EXISTS `user_userprofile`; CREATE TABLE `user_userprofile` ( `id` int(11) NOT NULL AUTO_INCREMENT, `password` varchar(128) NOT NULL, `last_login` datetime(6) DEFAULT NULL, `is_superuser` tinyint(1) NOT NULL, `username` varchar(150) NOT NULL, `first_name` varchar(30) NOT NULL, `last_name` varchar(150) NOT NULL, `email` varchar(254) NOT NULL, `is_staff` tinyint(1) NOT NULL, `is_active` tinyint(1) NOT NULL, `date_joined` datetime(6) NOT NULL, `nickname` varchar(30) NOT NULL, `gender` varchar(6) NOT NULL, `add_time` datetime(6) NOT NULL, `modify_time` datetime(6) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of user_userprofile -- ---------------------------- INSERT INTO `user_userprofile` VALUES ('1', 'pbkdf2_sha256$120000$BEz96qKEQgHb$fc2MW/YeWQwuvs9Qnw5hzdNaYGBVdF2QI8uvVepNqpw=', '2019-05-31 14:24:31.845600', '1', 'fake_admin', '', '', 'fake_admin@qq.com', '1', '1', '2019-05-31 14:24:07.412600', '', 'male', '2019-05-31 14:24:07.412600', '2019-05-31 14:24:07.412600'); -- ---------------------------- -- Table structure for user_userprofile_groups -- ---------------------------- DROP TABLE IF EXISTS `user_userprofile_groups`; CREATE TABLE `user_userprofile_groups` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userprofile_id` int(11) NOT NULL, `group_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `user_userprofile_groups_userprofile_id_group_id_52847a61_uniq` (`userprofile_id`,`group_id`), KEY `user_userprofile_groups_group_id_98cc4038_fk_auth_group_id` (`group_id`), CONSTRAINT `user_userprofile_gro_userprofile_id_49724c40_fk_user_user` FOREIGN KEY (`userprofile_id`) REFERENCES `user_userprofile` (`id`), CONSTRAINT `user_userprofile_groups_group_id_98cc4038_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of user_userprofile_groups -- ---------------------------- -- ---------------------------- -- Table structure for user_userprofile_user_permissions -- ---------------------------- DROP TABLE IF EXISTS `user_userprofile_user_permissions`; CREATE TABLE `user_userprofile_user_permissions` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userprofile_id` int(11) NOT NULL, `permission_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `user_userprofile_user_pe_userprofile_id_permissio_2e86ceca_uniq` (`userprofile_id`,`permission_id`), KEY `user_userprofile_use_permission_id_7f559b23_fk_auth_perm` (`permission_id`), CONSTRAINT `user_userprofile_use_permission_id_7f559b23_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), CONSTRAINT `user_userprofile_use_userprofile_id_68dc814c_fk_user_user` FOREIGN KEY (`userprofile_id`) REFERENCES `user_userprofile` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of user_userprofile_user_permissions -- ----------------------------
the_stack
-- 2021-05-19T19:39:53.430Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Reference SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:39:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541317 ; -- 2021-05-19T19:41:06.472Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:41:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579160 ; -- 2021-05-19T19:41:57.472Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:41:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=982 ; -- 2021-05-19T19:43:09.240Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='D',Updated=TO_TIMESTAMP('2021-05-19 22:43:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=982 ; -- 2021-05-19T19:44:09.798Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Reference SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:44:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541318 ; -- 2021-05-19T19:45:24.849Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('C_BPartner_Alberta','ALTER TABLE C_BPartner_Alberta DROP COLUMN IF EXISTS IsAlbertaDoctor') ; -- 2021-05-19T19:45:25.037Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column_Trl WHERE AD_Column_ID=573869 ; -- 2021-05-19T19:45:25.047Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column WHERE AD_Column_ID=573869 ; -- 2021-05-19T19:46:07.877Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET FieldLength=29,Updated=TO_TIMESTAMP('2021-05-19 22:46:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=573867 ; -- 2021-05-19T19:46:49.430Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:46:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579163 ; -- 2021-05-19T19:48:03.935Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:48:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579185 ; -- 2021-05-19T19:48:26.459Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:48:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579183 ; -- 2021-05-19T19:49:22.578Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:49:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579187 ; -- 2021-05-19T19:49:52.227Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:49:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579181 ; -- 2021-05-19T19:50:16.674Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:50:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579182 ; -- 2021-05-19T19:50:40.498Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:50:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579168 ; -- 2021-05-19T19:51:01.641Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:51:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579169 ; -- 2021-05-19T19:51:33.847Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:51:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579184 ; -- 2021-05-19T19:51:50.233Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:51:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579174 ; -- 2021-05-19T19:52:19.918Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:52:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579173 ; -- 2021-05-19T19:52:40.059Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:52:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579172 ; -- 2021-05-19T19:52:58.821Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Reference SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:52:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541320 ; -- 2021-05-19T19:53:23.967Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:53:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579165 ; -- 2021-05-19T19:53:42.185Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:53:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579171 ; -- 2021-05-19T19:53:55.691Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:53:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579170 ; -- 2021-05-19T19:54:12.130Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:54:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579167 ; -- 2021-05-19T19:54:27.661Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:54:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579166 ; -- 2021-05-19T19:54:42.664Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Reference SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:54:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541319 ; -- 2021-05-19T19:55:08.414Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:55:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579186 ; -- 2021-05-19T19:56:37.893Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Trl SET Name='Caregiver',Updated=TO_TIMESTAMP('2021-05-19 22:56:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Table_ID=541645 ; -- 2021-05-19T19:56:40.826Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Trl SET Name='Caregiver',Updated=TO_TIMESTAMP('2021-05-19 22:56:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='nl_NL' AND AD_Table_ID=541645 ; -- 2021-05-19T19:56:43.790Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Trl SET Name='Caregiver',Updated=TO_TIMESTAMP('2021-05-19 22:56:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Table_ID=541645 ; -- 2021-05-19T19:56:46.353Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Trl SET Name='Caregiver',Updated=TO_TIMESTAMP('2021-05-19 22:56:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Table_ID=541645 ; -- 2021-05-19T19:57:00.739Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Trl SET Name='Patient',Updated=TO_TIMESTAMP('2021-05-19 22:57:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Table_ID=541644 ; -- 2021-05-19T19:57:04.226Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Trl SET Name='Patient',Updated=TO_TIMESTAMP('2021-05-19 22:57:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Table_ID=541644 ; -- 2021-05-19T19:57:07.761Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Trl SET Name='Patient',Updated=TO_TIMESTAMP('2021-05-19 22:57:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='nl_NL' AND AD_Table_ID=541644 ; -- 2021-05-19T19:57:10.203Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Trl SET Name='Patient',Updated=TO_TIMESTAMP('2021-05-19 22:57:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Table_ID=541644 ; -- 2021-05-19T19:57:43.378Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:57:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579177 ; -- 2021-05-19T19:58:01.789Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:58:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579176 ; -- 2021-05-19T19:58:15.441Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Reference SET EntityType='de.metas.vertical.healthcare.alberta',Updated=TO_TIMESTAMP('2021-05-19 22:58:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541321 ;
the_stack
SET check_function_bodies = false; SET default_tablespace = ''; SET default_with_oids = false; CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; -- COMMENT ON EXTENSION plpgsql -- IS 'PL/pgSQL procedural language'; -- -- Types section -- -- -- address_reference_type -- DROP TYPE IF EXISTS address_reference_type CASCADE; CREATE TYPE address_reference_type AS ENUM ( 'conditional_true', 'conditional_false', 'unconditional', 'switch', 'call_direct', 'call_indirect', 'call_virtual', 'data', 'data_string' ); COMMENT ON TYPE address_reference_type IS 'The address_reference_type defines all possible address reference types.'; -- -- architecture_type -- DROP TYPE IF EXISTS architecture_type CASCADE; CREATE TYPE architecture_type AS ENUM ( 'x86-32', 'x86-64', 'ARM-32', 'PowerPC-32', 'PowerPC-64', 'MIPS-32', 'MIPS-64', 'GENERIC-32', 'GENERIC-64', 'REIL', 'RREIL' ); COMMENT ON TYPE architecture_type IS 'The architecture_type defines all architectures known to BinNavi. Unknown architectures used the generic type.'; -- -- edge_type -- DROP TYPE IF EXISTS edge_type CASCADE; CREATE TYPE edge_type AS ENUM ( 'jump_conditional_true', 'jump_conditional_false', 'jump_unconditional', 'jump_switch', 'jump_conditional_true_loop', 'jump_conditional_false_loop', 'jump_unconditional_loop', 'enter_inlined_function', 'leave_inlined_function', 'inter_module', 'inter_addressspace_edge', 'textnode_edge', 'dummy' ); COMMENT ON TYPE edge_type IS 'The edge_type defines all possible types of an edge. This type is used in BinNavi to enable specific functions for an edge.'; -- -- function_type -- DROP TYPE IF EXISTS function_type CASCADE; CREATE TYPE function_type AS ENUM ( 'normal', 'library', 'import', 'thunk', 'adjustor_thunk', 'invalid' ); COMMENT ON TYPE function_type IS 'The function_type defines all possible function types. This type is used in BinNavi to enable specific functions for a function.'; -- -- node_type -- DROP TYPE IF EXISTS node_type CASCADE; CREATE TYPE node_type AS ENUM ( 'code', 'function', 'group', 'text' ); COMMENT ON TYPE node_type IS 'The node_type defines all possible node type. The type is used in BinNavi to enable specific functions for a node.'; -- -- permission type -- DROP TYPE IF EXISTS permission_type CASCADE; CREATE TYPE permission_type AS ENUM ( 'READ', 'WRITE', 'EXECUTE', 'READ_WRITE', 'READ_EXECUTE', 'READ_WRITE_EXECUTE', 'WRITE_EXECUTE' ); COMMENT ON TYPE permission_type IS 'The permission_type is used to describe the permission a section has. This information can either come from the exporter or from the debugger.'; -- -- tag_type -- DROP TYPE IF EXISTS tag_type CASCADE; CREATE TYPE tag_type AS ENUM ( 'view_tag', 'node_tag' ); COMMENT ON TYPE tag_type IS 'The tag_type defines to which taggable instance the tags belongs. A tag can either be a view tag or a node tag.'; -- -- view_type -- DROP TYPE IF EXISTS view_type CASCADE; CREATE TYPE view_type AS ENUM ( 'native', 'non-native' ); COMMENT ON TYPE view_type IS 'The view_type defines where a view comes from. Native views come from the export / disassembler. Non-native views have been generated in BinNavi. Native views are immutable.'; -- -- type_cagetory -- DROP TYPE IF EXISTS type_category CASCADE; CREATE TYPE type_category AS ENUM ( 'atomic', 'array', 'pointer', 'struct', 'union', 'function_pointer' ); COMMENT ON TYPE type_category IS 'The type_category enum specifies the category of a given base type as defined in a C type system.'; -- -- Begin trigger section. -- -- -- bn_sections_trigger() -- CREATE OR REPLACE FUNCTION bn_sections_trigger() RETURNS trigger AS $$ BEGIN IF ( TG_OP = 'INSERT' ) THEN PERFORM pg_notify('section_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.id ); RETURN NEW; ELSIF ( TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('section_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.id ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('section_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.module_id || ' ' || OLD.id ); RETURN OLD; END IF; END; $$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION bn_sections_trigger() IS 'The bn_sections_trigger is called for all altering operations on the bn_sections table and will perform a pg_notify with the altered information. This information will be used in BinNavi to provide synchronisation between multiple instances of BinNavi'; -- -- bn_types_trigger() -- CREATE OR REPLACE FUNCTION bn_types_trigger() RETURNS trigger AS $$ BEGIN IF ( TG_OP = 'INSERT' ) THEN PERFORM pg_notify('types_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.id ); RETURN NEW; ELSIF ( TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('types_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.id ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('types_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.module_id || ' ' || OLD.id ); RETURN OLD; END IF; END; $$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION bn_types_trigger() IS 'The bn_types_trigger is called for all altering operations on the bn_types table and will perform a pg_notify with the altered information. This information will be used in BinNavi to provide synchronisation between multiple instances of BinNavi'; -- -- bn_base_types_trigger() -- CREATE OR REPLACE FUNCTION bn_base_types_trigger() RETURNS trigger AS $$ BEGIN IF ( TG_OP = 'INSERT' ) THEN PERFORM pg_notify('types_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.id ); RETURN NEW; ELSIF ( TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('types_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.id ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('types_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.module_id || ' ' || OLD.id ); RETURN OLD; END IF; END; $$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION bn_base_types_trigger() IS 'The bn_base_types_trigger is called for all altering operations on the bn_base_types table and will perform a pg_notify with the altered information. This information will be used in BinNavi to provide synchronisation between multiple instances of BinNavi'; -- -- bn_type_instances_trigger() -- CREATE OR REPLACE FUNCTION bn_type_instances_trigger() RETURNS trigger AS $BODY$ BEGIN IF ( TG_OP = 'INSERT' ) THEN PERFORM pg_notify('type_instances_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.id ); RETURN NEW; ELSIF ( TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('type_instances_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.id ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('type_instances_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.module_id || ' ' || OLD.id ); RETURN OLD; END IF; END; $BODY$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION bn_type_instances_trigger() IS 'The bn_expression_type_instances_trigger is called for all altering operations on the bn_expression_type_instances table and will perform a pg_notify with the altered information. This information will be used in BinNavi to provide synchronisation between multiple instances of BinNavi.'; -- -- bn_type_instances_comment_trigger() -- CREATE OR REPLACE FUNCTION bn_type_instances_comment_trigger() RETURNS trigger AS $$ DECLARE comment text; BEGIN IF ( TG_OP = 'UPDATE') THEN IF ( NEW.comment_id is null) THEN comment = 'null'; ELSE comment = CAST(NEW.comment_id AS TEXT); END IF; PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.id || ' ' || comment ); RETURN NEW; END IF; END; $$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION bn_type_instances_comment_trigger() IS 'The bn_type_instances_comment_trigger is called for UPDATE operations on the bn_type_instances table an will perform a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of comments associated to type instances between multiple instances of BinNavi.'; -- -- bn_expression_types_trigger() -- CREATE OR REPLACE FUNCTION bn_expression_types_trigger() RETURNS trigger AS $$ BEGIN IF ( TG_OP = 'INSERT' ) THEN PERFORM pg_notify('types_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.address || ' ' || NEW."position" || ' ' || NEW.expression_id); RETURN NEW; ELSIF ( TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('types_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.address || ' ' || NEW."position" || ' ' || NEW.expression_id); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('types_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.module_id || ' ' || OLD.address || ' ' || OLD."position" || ' ' || OLD.expression_id); RETURN OLD; END IF; END; $$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION bn_expression_types_trigger() IS 'The bn_expression_types_trigger is called for all altering operations on the bn_expression_types table and will perform a pg_notify with the altered information. This information will be used in BinNavi to provide synchronization between multiple instances of BinNavi'; -- -- bn_ecpression_type_instances_trigger() -- CREATE OR REPLACE FUNCTION bn_expression_type_instances_trigger() RETURNS trigger AS $BODY$ BEGIN IF ( TG_OP = 'INSERT' ) THEN PERFORM pg_notify('type_instances_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.address || ' ' || NEW."position" || ' ' || NEW.expression_id || ' ' || NEW.type_instance_id); RETURN NEW; ELSIF ( TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('type_instances_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.address || ' ' || NEW."position" || ' ' || NEW.expression_id || ' ' || NEW.type_instance_id); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('type_instances_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.module_id || ' ' || OLD.address || ' ' || OLD."position" || ' ' || OLD.expression_id || ' ' || OLD.type_instance_id); RETURN OLD; END IF; END; $BODY$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION bn_expression_type_instances_trigger() IS 'The bn_expression_type_instances_trigger is called for all operations on the bn_expression_type_instances table an will perform a pg_notify with the altered information. This information is used in BinNavi to provide synchronization of type instances associated to type instances between multiple instances of BinNavi.'; -- -- bn_functions_trigger() -- CREATE OR REPLACE FUNCTION bn_functions_trigger() RETURNS trigger AS $$ BEGIN IF ( TG_OP = 'INSERT' ) THEN PERFORM pg_notify('function_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.address ); RETURN NEW; ELSIF ( TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('function_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.address ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('function_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.module_id || ' ' || OLD.address ); RETURN OLD; END IF; END; $$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION bn_functions_trigger() IS 'The bn_functions_trigger is called for all altering operations on the bn_functions table and will perform a pg_notify with the altered information. This information will be used in BinNavi to provide synchronisation between multiple instances of BinNavi'; -- -- bn_module_views_trigger() -- CREATE OR REPLACE FUNCTION bn_module_views_trigger() RETURNS trigger AS $$ BEGIN IF ( TG_OP = 'INSERT' ) THEN PERFORM pg_notify('view_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.view_id || ' ' || NEW.module_id ); RETURN NEW; ELSIF ( TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('view_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.view_id || ' ' || NEW.module_id ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('view_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.view_id || ' ' || OLD.module_id ); RETURN OLD; END IF; END; $$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION bn_module_views_trigger() IS 'The bn_module_views_trigger is called for all altering operations on the bn_module_views table and will perform a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of module views between multiple instances of BinNavi.'; -- -- bn_project_views_trigger() -- CREATE OR REPLACE FUNCTION bn_project_views_trigger() RETURNS trigger AS $$ BEGIN IF ( TG_OP = 'INSERT' ) THEN PERFORM pg_notify('view_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.view_id || ' ' || NEW.project_id ); RETURN NEW; ELSIF ( TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('view_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.view_id || ' ' || NEW.project_id ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('view_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.view_id || ' ' || OLD.project_id ); RETURN OLD; END IF; END; $$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION bn_project_views_trigger() IS 'The bn_project_views_trigger is called for all altering operations on the bn_project_views table and will perform a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of project views between multiple instances of BinNavi.'; -- -- bn_views_trigger() -- CREATE OR REPLACE FUNCTION bn_views_trigger() RETURNS trigger AS $$ BEGIN IF ( TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('view_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.id ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('view_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.id ); RETURN OLD; END IF; END; $$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION bn_views_trigger() IS 'The bn_views_trigger is called for UPDATE and DELETE operations on the bn_views table and will perform a pg_notify with the altered information. This infromation is used in BinNavi to provide synchronisation of views between multiple instances of BinNavi.'; -- -- bn_comments_trigger() -- CREATE OR REPLACE FUNCTION bn_comments_trigger() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE comment text; parentid text; BEGIN IF ( TG_OP = 'UPDATE') THEN IF ( NEW.comment_text IS NULL) THEN comment = 'null'; ELSE comment = CAST(NEW.comment_text AS TEXT); END IF; IF( NEW.parent_id IS NULL) THEN parentid = 'null'; ELSE parentid = CAST(NEW.parent_id AS TEXT); END IF; PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.id || ' ' || parentid || ' ' || NEW.user_id || ' ' || comment ); RETURN NEW; ELSIF (TG_OP = 'DELETE') THEN IF ( OLD.comment_text IS NULL) THEN comment = 'null'; ELSE comment = CAST(OLD.comment_text AS TEXT); END IF; IF( OLD.parent_id IS NULL) THEN parentid = 'null'; ELSE parentid = CAST(OLD.parent_id AS TEXT); END IF; PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.id || ' ' || parentid || ' ' || OLD.user_id || ' ' || comment ); RETURN OLD; END IF; END; $$; COMMENT ON FUNCTION bn_comments_trigger() IS 'The bn_comments_trigger is called for UPDATE and DELETE operations on the bn_comments table and will perform a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of comments between multiple instances of BinNavi.'; -- -- bn_code_node_comment_trigger() -- CREATE OR REPLACE FUNCTION bn_code_node_comment_trigger() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE comment text; BEGIN IF ( TG_OP = 'UPDATE') THEN IF ( NEW.comment_id is null) THEN comment = 'null'; ELSE comment = CAST(NEW.comment_id AS TEXT); END IF; PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.node_id || ' ' || NEW.parent_function || ' ' || comment ); RETURN NEW; END IF; END; $$; COMMENT ON FUNCTION bn_code_node_comment_trigger() IS 'The bn_bn_code_node_comment_trigger is called for UPDATE operations on the bn_code_nodes table an will perform a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of local comments associated to code nodes between multiple instances of BinNavi.'; -- -- bn_codenode_instructions_comment_trigger() -- CREATE OR REPLACE FUNCTION bn_codenode_instructions_comment_trigger() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE comment text; BEGIN IF ( TG_OP = 'UPDATE') THEN IF ( NEW.comment_id is null) THEN comment = 'null'; ELSE comment = CAST(NEW.comment_id AS TEXT); END IF; PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.node_id || ' ' || NEW.position || ' ' || NEW.address || ' ' || comment ); RETURN NEW; END IF; END; $$; COMMENT ON FUNCTION bn_codenode_instructions_comment_trigger() IS 'The bn_codenode_instructions_comment_trigger is called for UPDATE operations on the bn_codenode_instructions table and will perform a pg_notify with the altered information This information is used in BinNavi to provide synchronisation of local comments associated to instructions between multiple instances of BinNavi.'; -- -- bn_comments_audit_logger() -- CREATE OR REPLACE FUNCTION bn_comments_audit_logger() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN -- -- Create a row in bn_comments_audit to reflect the operation performed on bn_comments, -- IF (TG_OP = 'DELETE') THEN INSERT INTO bn_comments_audit SELECT 'D', now(), OLD.id, OLD.parent_id, OLD.user_id, OLD.comment_text; RETURN OLD; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO bn_comments_audit SELECT 'U', now(), NEW.id, NEW.parent_id, NEW.user_id, NEW.comment_text; RETURN NEW; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO bn_comments_audit SELECT 'I', now(), NEW.id, NEW.parent_id, NEW.user_id, NEW.comment_text; RETURN NEW; END IF; RETURN NULL; END; $$; COMMENT ON FUNCTION bn_comments_audit_logger() IS 'The bn_comments_audit_logger is called for all operations performed on the bn_comments table and saves the operation with the altered information in the table bn_comments_audit. This information can be used to track changes to comments which have been performed to a database over time.'; -- -- bn_edges_comment_trigger() -- CREATE OR REPLACE FUNCTION bn_edges_comment_trigger() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE comment text; BEGIN IF ( TG_OP = 'UPDATE') THEN IF ( NEW.comment_id is null) THEN comment = 'null'; ELSE comment = CAST(NEW.comment_id AS TEXT); END IF; PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.id || ' ' || comment ); RETURN NEW; END IF; END; $$; COMMENT ON FUNCTION bn_edges_comment_trigger() IS 'The bn_edges_comment_trigger is called for UPDATE operations on the bn_edges table and will perfrom a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of local comments associated to edges between multiple instances of BinNavi.'; -- -- bn_function_nodes_comment_trigger() -- CREATE OR REPLACE FUNCTION bn_function_nodes_comment_trigger() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE comment text; BEGIN IF ( TG_OP = 'UPDATE') THEN IF ( NEW.comment_id is null) THEN comment = 'null'; ELSE comment = CAST(NEW.comment_id AS TEXT); END IF; PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.node_id || ' ' || NEW.function || ' ' || comment ); RETURN NEW; END IF; END; $$; COMMENT ON FUNCTION bn_function_nodes_comment_trigger() IS 'The bn_function_nodes_comment_trigger is called for UPDATE operations on the bn_function_nodes table and will perfrom a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of comments associated to function nodes between multiple instances of BinNavi.'; -- -- bn_functions_comment_trigger() -- CREATE OR REPLACE FUNCTION bn_functions_comment_trigger() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE comment text; BEGIN IF ( TG_OP = 'UPDATE') THEN IF ( NEW.comment_id is null) THEN comment = 'null'; ELSE comment = CAST(NEW.comment_id AS TEXT); END IF; PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.address || ' ' || comment ); RETURN NEW; END IF; END; $$; COMMENT ON FUNCTION bn_functions_comment_trigger() IS 'The bn_functions_comment_trigger is called for UPDATE operations on the bn_function table and will perfrom a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of comments associated to functions between multiple instances of BinNavi.'; -- -- bn_global_edge_comments_trigger() -- CREATE OR REPLACE FUNCTION bn_global_edge_comments_trigger() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE BEGIN IF ( TG_OP = 'INSERT' OR TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.src_module_id || ' ' || NEW.dst_module_id || ' ' || NEW.src_address || ' ' || NEW.dst_address || ' ' || NEW.comment_id ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.src_module_id || ' ' || OLD.dst_module_id || ' ' || OLD.src_address || ' ' || OLD.dst_address); RETURN OLD; END IF; END; $$; COMMENT ON FUNCTION bn_global_edge_comments_trigger() IS 'The bn_global_edge_comments_trigger is called for all operations on the bn_global_edge_comments table and will perfrom a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of global comments associated to edges between multiple instances of BinNavi.'; -- -- bn_global_node_comments_trigger() -- CREATE OR REPLACE FUNCTION bn_global_node_comments_trigger() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE BEGIN IF ( TG_OP = 'INSERT' OR TG_OP = 'UPDATE' ) THEN PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.address || ' ' || NEW.comment_id ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.module_id || ' ' || OLD.address); RETURN OLD; END IF; END; $$; COMMENT ON FUNCTION bn_global_node_comments_trigger() IS 'The bn_global_node_comments_trigger is called for all operations on the bn_global_node_comments table and will perfrom a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of global comments associated to nodes between multiple instances of BinNavi.'; -- -- bn_group_nodes_comment_trigger() -- CREATE OR REPLACE FUNCTION bn_group_nodes_comment_trigger() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE comment text; BEGIN IF ( TG_OP = 'INSERT' OR TG_OP = 'UPDATE' ) THEN IF ( NEW.comment_id is null) THEN comment = 'null'; ELSE comment = CAST(NEW.comment_id AS TEXT); END IF; PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.node_id || ' ' || comment ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.node_id); RETURN OLD; END IF; END; $$; COMMENT ON FUNCTION bn_group_nodes_comment_trigger() IS 'The bn_group_nodes_comment_trigger is called for all operations on the bn_group_nodes table and will perfrom a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of comments associated to group nodes between multiple instances of BinNavi.'; -- -- bn_instructions_comment_trigger() -- CREATE OR REPLACE FUNCTION bn_instructions_comment_trigger() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE comment text; BEGIN IF ( TG_OP = 'UPDATE') THEN IF ( NEW.comment_id is null) THEN comment = 'null'; ELSE comment = CAST(NEW.comment_id AS TEXT); END IF; PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.module_id || ' ' || NEW.address || ' ' || comment ); RETURN NEW; END IF; END; $$; COMMENT ON FUNCTION bn_instructions_comment_trigger() IS 'The bn_instructions_comment_trigger is called for UPDATE operations on the bn_instructions table and will perfrom a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of global comments associated to instructions between multiple instances of BinNavi.'; -- -- bn_text_nodes_comment_trigger() -- CREATE OR REPLACE FUNCTION bn_text_nodes_comment_trigger() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE comment text; BEGIN IF ( TG_OP = 'INSERT' OR TG_OP = 'UPDATE' ) THEN IF ( NEW.comment_id is null) THEN comment = 'null'; ELSE comment = CAST(NEW.comment_id AS TEXT); END IF; PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || NEW.node_id || ' ' || comment ); RETURN NEW; ELSIF ( TG_OP = 'DELETE' ) THEN PERFORM pg_notify('comment_changes', TG_TABLE_NAME || ' ' || TG_OP || ' ' || OLD.node_id); RETURN OLD; END IF; END; $$; COMMENT ON FUNCTION bn_text_nodes_comment_trigger() IS 'The bn_text_nodes_comment_trigger is called for all operations on the bn_text_nodes table and will perfrom a pg_notify with the altered information. This information is used in BinNavi to provide synchronisation of comments associated to text nodes between multiple instances of BinNavi.'; -- -- Table section -- -- -- bn_debuggers -- CREATE SEQUENCE bn_debuggers_id_seq; COMMENT ON SEQUENCE bn_debuggers_id_seq IS 'This sequence is used by the table bn_debuggers id field.'; CREATE TABLE bn_debuggers ( id integer NOT NULL PRIMARY KEY DEFAULT nextval('bn_debuggers_id_seq'::regclass), name text NOT NULL, host text NOT NULL, port integer NOT NULL ); COMMENT ON TABLE bn_debuggers IS 'This table contains all information to connect to a debug client.'; COMMENT ON COLUMN bn_debuggers.id IS 'Id of the debug client.'; COMMENT ON COLUMN bn_debuggers.name IS 'Name of the debug client.'; COMMENT ON COLUMN bn_debuggers.host IS 'Host name of the debug client.'; COMMENT ON COLUMN bn_debuggers.port IS 'Port number of the debug client.'; ALTER SEQUENCE bn_debuggers_id_seq OWNED BY bn_debuggers.id; -- -- bn_modules -- CREATE SEQUENCE bn_modules_id_seq; COMMENT ON SEQUENCE bn_modules_id_seq IS 'This sequence is used in the table bn_modules id field.'; CREATE TABLE bn_modules ( id integer NOT NULL PRIMARY KEY DEFAULT nextval('bn_modules_id_seq'::regclass), raw_module_id integer, --REFERENCES modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, name text NOT NULL, description text NOT NULL, md5 character(32) NOT NULL, sha1 character(40) NOT NULL, debugger_id integer REFERENCES bn_debuggers(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, image_base bigint DEFAULT 0 NOT NULL, file_base bigint DEFAULT 0 NOT NULL, import_time timestamp without time zone DEFAULT now() NOT NULL, modification_date timestamp without time zone DEFAULT now() NOT NULL, data bytea, stared boolean DEFAULT false NOT NULL, initialization_state integer DEFAULT 0 NOT NULL ); COMMENT ON TABLE bn_modules IS 'This table holds the information about a BinNavi module.'; COMMENT ON COLUMN bn_modules.id IS 'The id of the module.'; COMMENT ON COLUMN bn_modules.raw_module_id IS 'The id of the corresponding raw module.'; COMMENT ON COLUMN bn_modules.name IS 'The name of the module.'; COMMENT ON COLUMN bn_modules.description IS 'The description of the module.'; COMMENT ON COLUMN bn_modules.md5 IS 'The md5 hash of the binary which corresponds to this module.'; COMMENT ON COLUMN bn_modules.sha1 IS 'The sha1 has of the binary which corresponds to this module.'; COMMENT ON COLUMN bn_modules.debugger_id IS 'The id of the debugger currently active for this module.'; COMMENT ON COLUMN bn_modules.image_base IS 'The image base of the executable represented by the module.'; COMMENT ON COLUMN bn_modules.file_base IS 'The file base of the executable represented by the module.'; COMMENT ON COLUMN bn_modules.import_time IS 'The time of import.'; COMMENT ON COLUMN bn_modules.modification_date IS 'The time when the database was last updated.'; COMMENT ON COLUMN bn_modules.data IS 'The data of binary represented by the module.'; COMMENT ON COLUMN bn_modules.stared IS 'Flags if the module has been stared.'; COMMENT ON COLUMN bn_modules.initialization_state IS 'Indicates the initialization state of the module'; ALTER SEQUENCE bn_modules_id_seq OWNED BY bn_modules.id; CREATE INDEX bn_modules_raw_module_id_idx ON bn_modules USING btree (raw_module_id); -- -- bn_address_references -- CREATE TABLE bn_address_references ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, address bigint NOT NULL, "position" integer NOT NULL, expression_id integer NOT NULL, type address_reference_type NOT NULL, target bigint NOT NULL, CONSTRAINT bn_address_references_pkey PRIMARY KEY (module_id, address, "position", expression_id, type, target) ); COMMENT ON TABLE bn_address_references IS 'This table stores all address references.'; COMMENT ON COLUMN bn_address_references.module_id IS 'The module id the address reference is associated to.'; COMMENT ON COLUMN bn_address_references.address IS 'The address where the reference is associated to.'; COMMENT ON COLUMN bn_address_references."position" IS 'The position of the operand tree to which the address reference is associated to.'; COMMENT ON COLUMN bn_address_references.expression_id IS 'The id of the expression in the operand tree the address reference is associated to.'; COMMENT ON COLUMN bn_address_references.type IS 'The type of the address reference see the address_reference_type type for details.'; COMMENT ON COLUMN bn_address_references.target IS 'The target where address reference points to.'; CREATE INDEX bn_address_references_module_id_address_position_expression_id_ ON bn_address_references USING btree (module_id, address, "position", expression_id); CREATE INDEX bn_address_references_module_id_idx ON bn_address_references USING btree (module_id); CREATE INDEX bn_address_references_target_idx ON bn_address_references USING btree (target); CREATE INDEX bn_address_references_type_idx ON bn_address_references USING btree (type); -- -- bn_projects -- CREATE SEQUENCE bn_projects_id_seq; COMMENT ON SEQUENCE bn_projects_id_seq IS 'This sequence is used by the table bn_projects id field.'; CREATE TABLE bn_projects ( id integer NOT NULL PRIMARY KEY DEFAULT nextval('bn_projects_id_seq'::regclass), name text NOT NULL, description text NOT NULL, creation_date timestamp without time zone DEFAULT now() NOT NULL, modification_date timestamp without time zone DEFAULT now() NOT NULL, stared boolean DEFAULT false NOT NULL ); COMMENT ON TABLE bn_projects IS 'This table stores all information about a project.'; COMMENT ON COLUMN bn_projects.id IS 'The id of the project. Backed by bn_projects_id_seq'; COMMENT ON COLUMN bn_projects.name IS 'The name of the project.'; COMMENT ON COLUMN bn_projects.description IS 'The description of the project.'; COMMENT ON COLUMN bn_projects.creation_date IS 'The creation date of the project.'; COMMENT ON COLUMN bn_projects.modification_date IS 'The modification date of the project.'; COMMENT ON COLUMN bn_projects.stared IS 'Flag which indicates if the project is stared.'; ALTER SEQUENCE bn_projects_id_seq OWNED BY bn_projects.id; -- -- bn_address_spaces -- CREATE SEQUENCE bn_address_spaces_id_seq; COMMENT ON SEQUENCE bn_address_spaces_id_seq IS 'This sequence is used by the table bn_address_spaces id field.'; CREATE TABLE bn_address_spaces ( id integer NOT NULL PRIMARY KEY DEFAULT nextval('bn_address_spaces_id_seq'::regclass), project_id integer NOT NULL REFERENCES bn_projects(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, debugger_id integer REFERENCES bn_debuggers(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, name text NOT NULL, description text NOT NULL, creation_date timestamp without time zone DEFAULT now() NOT NULL, modification_date timestamp without time zone DEFAULT now() NOT NULL ); COMMENT ON TABLE bn_address_spaces IS 'This table stores the information about address spaces associated to a project.'; COMMENT ON COLUMN bn_address_spaces.id IS 'The id of the address space which is backed by the sequence bn_address_spaces_id_seq'; COMMENT ON COLUMN bn_address_spaces.project_id IS 'The id of the project the address space is associated to.'; COMMENT ON COLUMN bn_address_spaces.debugger_id IS 'The id of the current debugger of the address space.'; COMMENT ON COLUMN bn_address_spaces.name IS 'The name of the address space.'; COMMENT ON COLUMN bn_address_spaces.description IS 'The description of the address space.'; COMMENT ON COLUMN bn_address_spaces.creation_date IS 'The creation date of the address space.'; COMMENT ON COLUMN bn_address_spaces.modification_date IS 'The modification date of the address space.'; ALTER SEQUENCE bn_address_spaces_id_seq OWNED BY bn_address_spaces.id; -- -- bn_base_types -- CREATE SEQUENCE bn_base_types_id_seq; COMMENT ON SEQUENCE bn_base_types_id_seq IS 'This sequence is used by the table bn_base_types id field.'; CREATE TABLE bn_base_types ( module_id integer NOT NULL, id integer NOT NULL, name text NOT NULL, size integer NOT NULL, pointer integer, signed boolean, category type_category NOT NULL, CONSTRAINT bn_base_types_pkey PRIMARY KEY (module_id, id), CONSTRAINT bn_base_types_pointer_fkey FOREIGN KEY (module_id, pointer) REFERENCES bn_base_types(module_id, id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_base_types IS 'This table stores all base types for the type system used in BinNavi.'; COMMENT ON COLUMN bn_base_types.module_id IS 'The module id the base type is associated to.'; COMMENT ON COLUMN bn_base_types.id IS 'The id of the base type.'; COMMENT ON COLUMN bn_base_types.name IS 'The name of the base type.'; COMMENT ON COLUMN bn_base_types.size IS 'The size of the base type in bits.'; COMMENT ON COLUMN bn_base_types.pointer IS 'A flag that indicates if the base type is a pointer or not.'; COMMENT ON COLUMN bn_base_types.signed IS 'A flag that indicates if the base type id signed or not.'; COMMENT ON COLUMN bn_base_types.category IS 'An enum that describes the category of this base type.'; ALTER SEQUENCE bn_base_types_id_seq OWNED BY bn_base_types.id; CREATE TRIGGER bn_base_types_trigger AFTER INSERT OR UPDATE OR DELETE ON bn_base_types FOR EACH ROW EXECUTE PROCEDURE bn_base_types_trigger(); -- -- bn_nodes -- CREATE SEQUENCE bn_nodes_id_seq; COMMENT ON SEQUENCE bn_nodes_id_seq IS 'This sequence is used by the table bn_nodes id field.'; CREATE TABLE bn_nodes ( id integer NOT NULL PRIMARY KEY DEFAULT nextval('bn_nodes_id_seq'::regclass), view_id integer NOT NULL, parent_id integer, type node_type NOT NULL, x double precision NOT NULL, y double precision NOT NULL, width double precision NOT NULL, height double precision NOT NULL, color integer NOT NULL, bordercolor integer DEFAULT 0 NOT NULL, selected boolean NOT NULL, visible boolean NOT NULL ); COMMENT ON TABLE bn_nodes IS 'This table holds the information representing a base node.'; COMMENT ON COLUMN bn_nodes.id IS 'The id of the node.'; COMMENT ON COLUMN bn_nodes.view_id IS 'The id of the view the node belongs to.'; COMMENT ON COLUMN bn_nodes.parent_id IS 'The potential parent node of this node in z-axis'; COMMENT ON COLUMN bn_nodes.type IS 'The type of the node see node_type.'; COMMENT ON COLUMN bn_nodes.x IS 'The x coordinate of the node.'; COMMENT ON COLUMN bn_nodes.y IS 'The y coordinate of the node.'; COMMENT ON COLUMN bn_nodes.width IS 'The width of the node.'; COMMENT ON COLUMN bn_nodes.height IS 'The height of the node.'; COMMENT ON COLUMN bn_nodes.color IS 'The color of the node.'; COMMENT ON COLUMN bn_nodes.bordercolor IS 'The border color of the node.'; COMMENT ON COLUMN bn_nodes.selected IS 'Flags if the node is selected.'; COMMENT ON COLUMN bn_nodes.visible IS 'Flags if the node is visible.'; ALTER SEQUENCE bn_nodes_id_seq OWNED BY bn_nodes.id; CREATE INDEX bn_nodes_type ON bn_nodes USING btree (type); CREATE INDEX bn_nodes_view_id ON bn_nodes USING btree (view_id); CREATE INDEX bn_nodes_view_id_type_idx ON bn_nodes USING btree (view_id, type); -- -- bn_users -- CREATE SEQUENCE bn_users_user_id_seq; COMMENT ON SEQUENCE bn_users_user_id_seq IS 'This sequence is used by the table bn_users id field.'; CREATE TABLE bn_users ( user_id integer NOT NULL PRIMARY KEY DEFAULT nextval('bn_users_user_id_seq'::regclass), user_name text, user_image bytea, user_image_filename text ); COMMENT ON TABLE bn_users IS 'This table holds all information about users in BinNavi'; COMMENT ON COLUMN bn_users.user_id IS 'The id of the user.'; COMMENT ON COLUMN bn_users.user_name IS 'The name of the user.'; COMMENT ON COLUMN bn_users.user_image IS 'Currently unused.'; COMMENT ON COLUMN bn_users.user_image_filename IS 'Currently unused.'; ALTER SEQUENCE bn_users_user_id_seq OWNED BY bn_users.user_id; -- -- bn_comments -- CREATE SEQUENCE bn_comments_id_seq; COMMENT ON SEQUENCE bn_comments_id_seq IS 'This sequence is used by the table bn_comments id field.'; CREATE TABLE bn_comments ( id integer NOT NULL PRIMARY KEY, parent_id integer REFERENCES bn_comments(id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, user_id integer NOT NULL REFERENCES bn_users(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, comment_text text NOT NULL ); COMMENT ON TABLE bn_comments IS 'This table stores all information about comments'; COMMENT ON COLUMN bn_comments.id IS 'The id of the comment used in all other tables as reference to this table.'; COMMENT ON COLUMN bn_comments.parent_id IS 'This column contains the id of the comment which is the parent of this comment.nThe idea here is that the latest generated comment will be refered to by the comment_id in the tables having a comment such that we will traverse the comments upwards to generate the complete comment stream '; COMMENT ON COLUMN bn_comments.user_id IS 'The owner of the comment which is the only person to be able to delete or edit this comment.nThis value does not provide any security it is just there to reduce concurrent modification problems.'; COMMENT ON COLUMN bn_comments.comment_text IS 'The actual comment.'; ALTER SEQUENCE bn_comments_id_seq OWNED BY bn_comments.id; CREATE INDEX bn_comments_parent_id_idx ON bn_comments USING btree (parent_id); CREATE INDEX bn_comments_user_id_idx ON bn_comments USING btree (user_id); CREATE TRIGGER bn_comments_audit_trigger AFTER INSERT OR DELETE OR UPDATE ON bn_comments FOR EACH ROW EXECUTE PROCEDURE bn_comments_audit_logger(); CREATE TRIGGER bn_comments_trigger AFTER UPDATE OR DELETE ON bn_comments FOR EACH ROW EXECUTE PROCEDURE bn_comments_trigger(); -- -- bn_code_nodes -- CREATE TABLE bn_code_nodes ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, node_id integer NOT NULL PRIMARY KEY REFERENCES bn_nodes(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, parent_function bigint, comment_id integer REFERENCES bn_comments(id) ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_code_nodes IS 'This table stores all information about code nodes.'; COMMENT ON COLUMN bn_code_nodes.module_id IS 'The module id the code node belongs to.'; COMMENT ON COLUMN bn_code_nodes.node_id IS 'The node id the code node is associated with.'; COMMENT ON COLUMN bn_code_nodes.parent_function IS 'The parent function of the code node.'; COMMENT ON COLUMN bn_code_nodes.comment_id IS 'The id of the comment associacted with the code node.'; CREATE INDEX bn_code_nodes_module_id_idx ON bn_code_nodes USING btree (module_id); CREATE INDEX bn_code_nodes_comment_id_idx ON bn_code_nodes USING btree (comment_id); CREATE TRIGGER bn_code_node_comment_trigger AFTER UPDATE OF comment_id ON bn_code_nodes FOR EACH ROW EXECUTE PROCEDURE bn_code_node_comment_trigger(); -- -- bn_codenode_instructions -- CREATE TABLE bn_codenode_instructions ( module_id integer NOT NULL, node_id integer NOT NULL REFERENCES bn_nodes(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, "position" integer NOT NULL, address bigint NOT NULL, comment_id integer REFERENCES bn_comments(id) ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED, CONSTRAINT bn_codenode_instructions_pkey PRIMARY KEY (node_id, "position") ); COMMENT ON TABLE bn_codenode_instructions IS 'This table stores the association between instructions and code nodes.'; COMMENT ON COLUMN bn_codenode_instructions.module_id IS 'The module id the association between instruction and code node belongs to.'; COMMENT ON COLUMN bn_codenode_instructions.node_id IS 'The node id to which the instruction is associated.'; COMMENT ON COLUMN bn_codenode_instructions.position IS 'The position within the node the instruction has.'; COMMENT ON COLUMN bn_codenode_instructions.address IS 'The address of the code node.'; COMMENT ON COLUMN bn_codenode_instructions.comment_id IS 'The id of the comment associated with the instruction in the code node.'; CREATE INDEX bn_codenode_instructions_address_idx ON bn_codenode_instructions USING btree (address); CREATE INDEX bn_codenode_instructions_module_id_address_idx ON bn_codenode_instructions USING btree (module_id, address); CREATE INDEX bn_codenode_instructions_comment_id_idx ON bn_codenode_instructions USING btree (comment_id); CREATE TRIGGER bn_codenode_instructions_comment_trigger AFTER UPDATE OF comment_id ON bn_codenode_instructions FOR EACH ROW EXECUTE PROCEDURE bn_codenode_instructions_comment_trigger(); -- -- bn_comments_audit -- CREATE TABLE bn_comments_audit ( operation bpchar NOT NULL, time_stamp timestamp with time zone DEFAULT ('now'::text)::date NOT NULL, id integer NOT NULL, parent_id integer, user_id integer NOT NULL, comment_text text NOT NULL, CONSTRAINT bn_comments_audit_pkey PRIMARY KEY (operation, time_stamp, id) ); COMMENT ON TABLE bn_comments_audit IS 'This table contains all operations that have been performed on the table bn_comments.nIts purpose is that for all operations done by multiple clients on the table bn_comments there will be a log of thier activity which can help debug issues if something goes wrong.'; COMMENT ON COLUMN bn_comments_audit.operation IS 'The operation that has been performed where: U is update, I is insert and D is delete.'; COMMENT ON COLUMN bn_comments_audit.time_stamp IS 'The time stamp of the operation such that it is possible to find out when a speciffic event has occured.'; COMMENT ON COLUMN bn_comments_audit.id IS 'see bn_comments.id for description.'; COMMENT ON COLUMN bn_comments_audit.parent_id IS 'see bn_comments.parent_id for description.'; COMMENT ON COLUMN bn_comments_audit.user_id IS 'see bn_comments.user_id for description.'; COMMENT ON COLUMN bn_comments_audit.comment_text IS 'see bn_comments.comment_text for description.'; -- -- bn_data_parts -- CREATE TABLE bn_data_parts ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, part_id integer NOT NULL, data bytea, PRIMARY KEY (module_id, part_id) ); COMMENT ON TABLE bn_data_parts IS 'This table is used to store the original binary data of the module in the database.'; COMMENT ON COLUMN bn_data_parts.module_id IS 'Module id of a data part.'; COMMENT ON COLUMN bn_data_parts.part_id IS 'Id of a data part.'; COMMENT ON COLUMN bn_data_parts.data IS 'The actual data of a data part.'; -- -- bn_edges -- CREATE SEQUENCE bn_edges_id_seq; COMMENT ON SEQUENCE bn_edges_id_seq IS 'This sequence is used by the table bn_edges id field.'; CREATE TABLE bn_edges ( id integer NOT NULL PRIMARY KEY DEFAULT nextval('bn_edges_id_seq'::regclass), source_node_id integer NOT NULL REFERENCES bn_nodes(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, target_node_id integer NOT NULL REFERENCES bn_nodes(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, x1 double precision NOT NULL, y1 double precision NOT NULL, x2 double precision NOT NULL, y2 double precision NOT NULL, type edge_type NOT NULL, color integer NOT NULL, visible boolean NOT NULL, selected boolean NOT NULL, comment_id integer REFERENCES bn_comments(id) ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_edges IS 'This table stores information about edges.'; COMMENT ON COLUMN bn_edges.id IS 'The id of the edge Globally unique in a single database.'; COMMENT ON COLUMN bn_edges.source_node_id IS 'The id of the node where the edge originates from.'; COMMENT ON COLUMN bn_edges.target_node_id IS 'The id of the node where the edge destined to.'; COMMENT ON COLUMN bn_edges.x1 IS 'The x1 coordinate of the edge.'; COMMENT ON COLUMN bn_edges.y1 IS 'The y1 coordinate of the edge.'; COMMENT ON COLUMN bn_edges.x2 IS 'The x2 coordinate of the edge.'; COMMENT ON COLUMN bn_edges.y2 IS 'The y2 coordinate of the edge.'; COMMENT ON COLUMN bn_edges.type IS 'The type of the edge see edge_type for all possible cases.'; COMMENT ON COLUMN bn_edges.color IS 'The color of the edge.'; COMMENT ON COLUMN bn_edges.visible IS 'Flags if the edge is currently visible or not.'; COMMENT On COLUMN bn_edges.selected IS 'Flags if the edge is currently selected or not.'; COMMENT ON COLUMN bn_edges.comment_id IS 'The id of the last comment in the comment list associated to the edge.'; ALTER SEQUENCE bn_edges_id_seq OWNED BY bn_edges.id; CREATE INDEX bn_edges_source_node_id_idx ON bn_edges USING btree (source_node_id); CREATE INDEX bn_edges_target_node_id_idx ON bn_edges USING btree (target_node_id); CREATE INDEX bn_edges_comment_id_idx ON bn_edges USING btree (comment_id); CREATE TRIGGER bn_edges_comment_trigger AFTER UPDATE OF comment_id ON bn_edges FOR EACH ROW EXECUTE PROCEDURE bn_edges_comment_trigger(); -- -- bn_edge_paths -- CREATE TABLE bn_edge_paths ( edge_id integer NOT NULL REFERENCES bn_edges(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, "position" integer NOT NULL, x double precision NOT NULL, y double precision NOT NULL, CONSTRAINT bn_edge_paths_pkey PRIMARY KEY (edge_id, "position") ); COMMENT ON TABLE bn_edge_paths IS 'This table stores the layout information of edges.'; COMMENT ON COLUMN bn_edge_paths.edge_id IS 'The id of the edge which the path information belongs to.'; COMMENT ON COLUMN bn_edge_paths."position" IS 'The position of the edge path.'; COMMENT ON COLUMN bn_edge_paths.x IS 'The x coordinate of the edge path'; COMMENT ON COLUMN bn_edge_paths.y IS 'The y coordinate of the edge path'; -- -- bn_expression_substitutions -- CREATE TABLE bn_expression_substitutions ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, address bigint NOT NULL, "position" integer NOT NULL, expression_id integer NOT NULL, replacement text NOT NULL, CONSTRAINT bn_expression_substitutions_pkey PRIMARY KEY (module_id, address, "position", expression_id) ); COMMENT ON TABLE bn_expression_substitutions IS 'This table defines the expression substitutions.'; COMMENT ON COLUMN bn_expression_substitutions.module_id IS 'The id of the module to which this expression substitution belongs.'; COMMENT ON COLUMN bn_expression_substitutions.address IS 'The address of the expression substitution.'; COMMENT ON COLUMN bn_expression_substitutions."position" IS 'The position of the expression substitution in regards to the operands.'; COMMENT ON COLUMN bn_expression_substitutions.expression_id IS 'The id of the expression to be substituted.'; COMMENT ON COLUMN bn_expression_substitutions.replacement IS 'The text replacement for this expression substitution.'; CREATE INDEX bn_expression_substitutions_module_id_idx ON bn_expression_substitutions USING btree (module_id); -- -- bn_expression_tree -- CREATE TABLE bn_expression_tree ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, id integer NOT NULL, type integer NOT NULL, symbol character varying(256), immediate bigint, "position" integer NOT NULL, parent_id integer, CONSTRAINT bn_expression_tree_pkey PRIMARY KEY (module_id, id) ); COMMENT ON TABLE bn_expression_tree IS 'This table defines the in BinNavi used expression trees'; COMMENT ON COLUMN bn_expression_tree.module_id IS 'The id of the module tio which the expression tree belongs.'; COMMENT ON COLUMN bn_expression_tree.id IS 'The id of the expression tree.'; COMMENT ON COLUMN bn_expression_tree.type IS 'The type of the expression tree.'; COMMENT ON COLUMN bn_expression_tree.symbol IS 'If the type is a symbol the string is saved here.'; COMMENT ON COLUMN bn_expression_tree.immediate IS 'If the type is an immediate the immediate is saved here.'; COMMENT ON COLUMN bn_expression_tree."position" IS 'The position of the expression tree.'; COMMENT ON COLUMN bn_expression_tree.parent_id IS 'If the tree has a parent tree id it is saved here.'; -- -- bn_expression_tree_ids -- CREATE TABLE bn_expression_tree_ids ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, id integer NOT NULL, CONSTRAINT bn_expression_tree_ids_pkey PRIMARY KEY (module_id, id) ); COMMENT ON TABLE bn_expression_tree_ids IS 'This table links expression tree ids to module ids.'; COMMENT ON COLUMN bn_expression_tree_ids.module_id IS 'Module id.'; COMMENT ON COLUMN bn_expression_tree_ids.id IS 'Expression tree id.'; CREATE INDEX bn_expression_tree_ids_module_id_idx ON bn_expression_tree_ids USING btree (module_id); -- -- bn_expression_tree_mapping -- CREATE TABLE bn_expression_tree_mapping ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, tree_id integer NOT NULL, tree_node_id integer NOT NULL, CONSTRAINT bn_expression_tree_mapping_pkey PRIMARY KEY (module_id, tree_id, tree_node_id) ); COMMENT ON TABLE bn_expression_tree_mapping IS 'This table maps a tree id of an expression tree to a tree node id of an expression tree.'; COMMENT ON COLUMN bn_expression_tree_mapping.module_id IS 'The module id of the mapping.'; COMMENT ON COLUMN bn_expression_tree_mapping.tree_id IS 'The tree id of the mapping.'; COMMENT ON COLUMN bn_expression_tree_mapping.tree_node_id IS 'The tree node id of the mapping.'; CREATE INDEX bn_expression_tree_mapping_module_id_idx ON bn_expression_tree_mapping USING btree (module_id); -- -- bn_types -- CREATE SEQUENCE bn_types_id_seq; COMMENT ON SEQUENCE bn_types_id_seq IS 'This sequence is used by the table bn_types id field.'; CREATE TABLE bn_types ( module_id integer NOT NULL, id integer NOT NULL DEFAULT nextval('bn_types_id_seq'::regclass), name text NOT NULL, base_type integer NOT NULL, parent_id integer, "offset" integer, argument integer, number_of_elements integer, CONSTRAINT bn_types_pkey PRIMARY KEY (module_id, id), CONSTRAINT bn_types_base_type_fkey FOREIGN KEY (module_id, base_type) REFERENCES bn_base_types(module_id, id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, CONSTRAINT bn_types_parent_id_fkey FOREIGN KEY (module_id, parent_id) REFERENCES bn_base_types(module_id, id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_types IS 'This table holds the information about concrete types.'; COMMENT ON COLUMN bn_types.module_id IS 'The id of the module the type is associated to.'; COMMENT ON COLUMN bn_types.id IS 'The id of the type.'; COMMENT ON COLUMN bn_types.name IS 'The name of the type.'; COMMENT ON COLUMN bn_types.base_type IS 'The base type of this type.'; COMMENT ON COLUMN bn_types.parent_id IS 'The potential parent type of this type.'; COMMENT ON COLUMN bn_types."offset" IS 'Used for struct types and object types to define the offset of the member within the compound type.'; COMMENT ON COLUMN bn_types.argument IS 'Used for function pointer types to indicate which argument this type is.'; COMMENT ON COLUMN bn_types.number_of_elements IS 'Used for array types to indicate the number of elements in an array'; ALTER SEQUENCE bn_types_id_seq OWNED BY bn_types.id; CREATE TRIGGER bn_types_trigger AFTER INSERT OR UPDATE OR DELETE ON bn_types FOR EACH ROW EXECUTE PROCEDURE bn_types_trigger(); -- -- bn_expression_types -- CREATE TABLE bn_expression_types ( module_id integer NOT NULL, address bigint NOT NULL, "position" integer NOT NULL, expression_id integer NOT NULL, base_type_id integer NOT NULL, path integer[], "offset" integer, PRIMARY KEY (module_id, address, "position", expression_id), CONSTRAINT bn_expression_types_module_id_member_id_fkey FOREIGN KEY (module_id, base_type_id) REFERENCES bn_base_types(module_id, id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_expression_types IS 'This table stores the type from the type system for a specific operand.'; COMMENT ON COLUMN bn_expression_types.module_id IS 'The module id the type is associated with.'; COMMENT ON COLUMN bn_expression_types.address IS 'The address where the type association is located.'; COMMENT ON COLUMN bn_expression_types."position" IS 'The position or the operand tree in the instruction where the type is associated to.'; COMMENT ON COLUMN bn_expression_types.expression_id IS 'The expression tree id the type is associated to.'; COMMENT ON COLUMN bn_expression_types.base_type_id IS 'The bn_base_types type which is associated here.'; COMMENT ON COLUMN bn_expression_types.path IS 'The path of the type substitution. Each integer here is an element from bn_types.'; COMMENT ON COLUMN bn_expression_types."offset" IS 'The offset of the type substitution.'; CREATE TRIGGER bn_expression_types_trigger AFTER INSERT OR UPDATE OR DELETE ON bn_expression_types FOR EACH ROW EXECUTE PROCEDURE bn_expression_types_trigger(); -- -- bn_sections -- CREATE SEQUENCE bn_sections_id_seq; COMMENT ON SEQUENCE bn_sections_id_seq IS 'This sequence is used by the table bn_sections id field.'; CREATE TABLE bn_sections ( module_id integer NOT NULL REFERENCES bn_modules (id) ON UPDATE NO ACTION ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, id integer NOT NULL DEFAULT nextval('bn_sections_id_seq'::regclass), name text NOT NULL, comment_id integer REFERENCES bn_comments (id) ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED, start_address bigint NOT NULL, end_address bigint NOT NULL, permission permission_type, data bytea, CONSTRAINT bn_sections_pkey PRIMARY KEY(module_id, id) ); ALTER SEQUENCE bn_sections_id_seq OWNED BY bn_sections.id; COMMENT ON TABLE bn_sections IS 'This table stores the information about sections known to BinNavi.'; COMMENT ON COLUMN bn_sections.module_id IS 'The module id the section belongs to.'; COMMENT ON COLUMN bn_sections.id IS 'The id of the section.'; COMMENT ON COLUMN bn_sections.name IS 'The name of the section.'; COMMENT ON COLUMN bn_sections.comment_id IS 'The id of the comment associated with this section.'; COMMENT ON COLUMN bn_sections.start_address IS 'The start address of the section.'; COMMENT ON COLUMN bn_sections.end_address IS 'The end address of the section.'; COMMENT ON COLUMN bn_sections.permission IS 'The permissions of the section see bn_permission_type for more information'; COMMENT ON COLUMN bn_sections.data IS 'The actual data of the section.'; CREATE INDEX bn_sections_comment_id_idx ON bn_sections USING btree (comment_id ); CREATE TRIGGER bn_sections_trigger AFTER INSERT OR DELETE OR UPDATE ON bn_sections FOR EACH ROW EXECUTE PROCEDURE bn_sections_trigger(); -- -- bn_type_instances -- CREATE SEQUENCE bn_type_instances_id_seq START 0 MINVALUE 0; COMMENT ON SEQUENCE bn_type_instances_id_seq IS 'This sequence is used by the table bn_type_instances id field.'; CREATE TABLE bn_type_instances ( module_id integer NOT NULL REFERENCES bn_modules (id) ON UPDATE NO ACTION ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, id integer NOT NULL DEFAULT nextval('bn_type_instances_id_seq'::regclass), name text, comment_id integer REFERENCES bn_comments (id) ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED, type_id integer NOT NULL, section_id integer NOT NULL, section_offset bigint NOT NULL, CONSTRAINT bn_type_instances_pkey PRIMARY KEY (module_id, id), CONSTRAINT bn_type_instances_module_id_type_id_fkey FOREIGN KEY (module_id, type_id) REFERENCES bn_base_types (module_id, id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, CONSTRAINT bn_type_instances_module_id_section_id_fkey FOREIGN KEY (module_id, section_id) REFERENCES bn_sections (module_id, id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); ALTER SEQUENCE bn_type_instances_id_seq OWNED BY bn_type_instances.id; COMMENT ON TABLE bn_type_instances IS 'This table stores the information about type instances known to BinNavi.'; COMMENT ON COLUMN bn_type_instances.module_id IS 'The module id the type instance belongs to.'; COMMENT ON COLUMN bn_type_instances.id IS 'The id of the type instance.'; COMMENT ON COLUMN bn_type_instances.name IS 'The name of the type instance.'; COMMENT ON COLUMN bn_type_instances.comment_id IS 'The id of the comment associated with this type instance.'; COMMENT ON COLUMN bn_type_instances.type_id IS 'The type id of the type that backs the type instance.'; COMMENT ON COLUMN bn_type_instances.section_id IS 'The id of the section where in combination with address types value can be found.'; COMMENT ON COLUMN bn_type_instances.section_offset IS 'The offset of the type instance in the section.'; CREATE INDEX bn_type_instances_comment_id_idx ON bn_type_instances USING btree (comment_id ); CREATE TRIGGER bn_type_instances_trigger AFTER INSERT OR DELETE OR UPDATE ON bn_type_instances FOR EACH ROW EXECUTE PROCEDURE bn_type_instances_trigger(); CREATE TRIGGER bn_type_instances_comment_trigger AFTER UPDATE OF comment_id ON bn_type_instances FOR EACH ROW EXECUTE PROCEDURE bn_type_instances_comment_trigger(); -- -- bn_expression_type_instances -- CREATE TABLE bn_expression_type_instances ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, address bigint NOT NULL, position integer NOT NULL, expression_id integer NOT NULL, type_instance_id integer NOT NULL, PRIMARY KEY(module_id, address, position, expression_id), CONSTRAINT bn_expression_type_instances_module_id_type_id_fkey FOREIGN KEY (module_id, type_instance_id) REFERENCES bn_type_instances (module_id, id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_expression_type_instances IS 'This table stores the information about data cross references. It provides the link between a type instance and an operand tree expression in the graph.'; COMMENT ON COLUMN bn_expression_type_instances.module_id IS 'The module id of the module this data xref belongs to.'; COMMENT ON COLUMN bn_expression_type_instances.address IS 'The address of the instruction to which the type instance substitution belongs.'; COMMENT ON COLUMN bn_expression_type_instances.position IS 'The position of the operand within the instruction the type instance substitution belongs to.'; COMMENT ON COLUMN bn_expression_type_instances.expression_id IS 'The expression tree id in the operand the type instance belongs to.'; COMMENT ON COLUMN bn_expression_type_instances.type_instance_id IS 'The type instance to which this substitution points.'; CREATE TRIGGER bn_expression_type_instances_trigger AFTER INSERT OR DELETE OR UPDATE ON bn_expression_type_instances FOR EACH ROW EXECUTE PROCEDURE bn_expression_type_instances_trigger(); -- -- bn_function_nodes -- CREATE TABLE bn_function_nodes ( module_id integer NOT NULL, node_id integer NOT NULL PRIMARY KEY REFERENCES bn_nodes(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, function bigint NOT NULL, comment_id integer REFERENCES bn_comments(id) ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_function_nodes IS 'This table holds the information about function nodes in a module.'; COMMENT ON COLUMN bn_function_nodes.module_id IS 'The module id of the function node.'; COMMENT ON COLUMN bn_function_nodes.node_id IS 'The node id the function node is associated to.'; COMMENT ON COLUMN bn_function_nodes.function IS 'The function address the function node is associated to.'; COMMENT ON COLUMN bn_function_nodes.comment_id IS 'The id of the comment associated to the function node.'; CREATE INDEX bn_function_nodes_function_idx ON bn_function_nodes USING btree (function); CREATE INDEX bn_function_nodes_module_id_function_idx ON bn_function_nodes USING btree (module_id, function); CREATE INDEX bn_function_nodes_module_id_idx ON bn_function_nodes USING btree (module_id); CREATE INDEX bn_function_nodes_comment_id_idx ON bn_function_nodes USING btree (comment_id); CREATE TRIGGER bn_function_nodes_comment_trigger AFTER UPDATE OF comment_id ON bn_function_nodes FOR EACH ROW EXECUTE PROCEDURE bn_function_nodes_comment_trigger(); -- -- bn_views -- CREATE SEQUENCE bn_views_id_seq; COMMENT ON SEQUENCE bn_views_id_seq IS 'This sequence is used by the table bn_views id field.'; CREATE TABLE bn_views ( id integer NOT NULL PRIMARY KEY DEFAULT nextval('bn_views_id_seq'::regclass), type view_type NOT NULL, name text NOT NULL, description text, creation_date timestamp without time zone DEFAULT now() NOT NULL, modification_date timestamp without time zone DEFAULT now() NOT NULL, stared boolean DEFAULT false NOT NULL, user_id integer REFERENCES bn_users(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_views IS 'This table holds the information about views.'; COMMENT ON COLUMN bn_views.id IS 'The id of the view.'; COMMENT ON COLUMN bn_views.type IS 'The type of the view see view_type.'; COMMENT ON COLUMN bn_views.name IS 'The name of the view.'; COMMENT ON COLUMN bn_views.description IS 'The description of the view.'; COMMENT ON COLUMN bn_views.creation_date IS 'The date when the view was originally created.'; COMMENT ON COLUMN bn_views.modification_date IS 'The date when the view was last modified.'; COMMENT ON COLUMN bn_views.stared IS 'Flags if the view is stared.'; COMMENT ON COLUMN bn_views.user_id IS 'Defines the owner of the view.'; ALTER SEQUENCE bn_views_id_seq OWNED BY bn_views.id; CREATE INDEX bn_views_user_id_idx ON bn_views USING btree (user_id); CREATE INDEX bn_views_type_idx ON bn_views USING btree (type); CREATE TRIGGER bn_views_trigger AFTER DELETE OR UPDATE ON bn_views FOR EACH ROW EXECUTE PROCEDURE bn_views_trigger(); -- -- bn_function_views -- CREATE TABLE bn_function_views ( module_id integer NOT NULL, view_id integer NOT NULL PRIMARY KEY REFERENCES bn_views(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, function bigint NOT NULL ); COMMENT ON TABLE bn_function_views IS 'This table holds the information about function views.'; COMMENT ON COLUMN bn_function_views.module_id IS 'The module id the function view is associated to.'; COMMENT ON COLUMN bn_function_views.view_id IS 'The view id the function view is associated to.'; COMMENT ON COLUMN bn_function_views.function IS 'The address of the function the function view is associated to.'; CREATE INDEX bn_function_views_module_id_function_idx ON bn_function_views USING btree (module_id, function); CREATE INDEX bn_function_views_module_id_idx ON bn_function_views USING btree (module_id); -- -- bn_functions -- CREATE TABLE bn_functions ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, address bigint NOT NULL, name text, original_name text NOT NULL, type function_type NOT NULL, description text, parent_module_name text, parent_module_id integer, parent_module_function integer, stack_frame integer, prototype integer, comment_id integer REFERENCES bn_comments(id) ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED, CONSTRAINT bn_functions_pkey PRIMARY KEY (module_id, address) ); COMMENT ON TABLE bn_functions IS 'This table holds the information about functions and thier relations.'; COMMENT ON COLUMN bn_functions.module_id IS 'The id of the module the function belongs to.'; COMMENT ON COLUMN bn_functions.address IS 'The address of the function.'; COMMENT ON COLUMN bn_functions.name IS 'The current name of the function.'; COMMENT ON COLUMN bn_functions.original_name IS 'The original name of the function.'; COMMENT ON COLUMN bn_functions.type IS 'The type of the function see the function_type type for more information.'; COMMENT ON COLUMN bn_functions.description IS 'The description of the function.'; COMMENT ON COLUMN bn_functions.parent_module_name IS 'If the function is forwarded the module name of the function where this function is forwarded to.'; COMMENT ON COLUMN bn_functions.parent_module_id IS 'If the function is forwarded the module id of the function where this function is forwarded to.'; COMMENT ON COLUMN bn_functions.parent_module_function IS 'If the function is forwarded the address of the function where this function is forwarded to.'; COMMENT ON COLUMN bn_functions.stack_frame IS 'The bn_base_types id of the stack frame that is associated with the function.'; COMMENT ON COLUMN bn_functions.prototype IS 'The bn_base_types id of the prototype that is associated with the functions.'; COMMENT ON COLUMN bn_functions.comment_id IS 'The id of the comment associated with the function.'; CREATE INDEX bn_functions_address_idx ON bn_functions USING btree (address); CREATE INDEX bn_functions_module_id_address_idx ON bn_functions USING btree (module_id, address); CREATE INDEX bn_functions_module_id_address_type_idx ON bn_functions USING btree (module_id, address, type); CREATE INDEX bn_functions_module_id_idx ON bn_functions USING btree (module_id); CREATE INDEX bn_functions_parent_module_id_parent_module_function_idx ON bn_functions USING btree (parent_module_id, parent_module_function); CREATE INDEX bn_functions_comment_id_idx ON bn_functions USING btree (comment_id); CREATE TRIGGER bn_functions_comment_trigger AFTER UPDATE OF comment_id ON bn_functions FOR EACH ROW EXECUTE PROCEDURE bn_functions_comment_trigger(); -- -- bn_global_edge_comments -- CREATE TABLE bn_global_edge_comments ( src_module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, dst_module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, src_address bigint NOT NULL, dst_address bigint NOT NULL, comment_id integer REFERENCES bn_comments(id) ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED, CONSTRAINT bn_global_edge_comments_pkey PRIMARY KEY (src_module_id, dst_module_id, src_address, dst_address) ); COMMENT ON TABLE bn_global_edge_comments IS 'This table holds all global edge comments.'; COMMENT ON COLUMN bn_global_edge_comments.src_module_id IS 'The module id of the module where the edge originates from.'; COMMENT ON COLUMN bn_global_edge_comments.dst_module_id IS 'The module if of the module where the edge destined to.'; COMMENT ON COLUMN bn_global_edge_comments.src_address IS 'The address of the source node of the edge.'; COMMENT ON COLUMN bn_global_edge_comments.dst_address IS 'The address of the destination node of the edge.'; COMMENT ON COLUMN bn_global_edge_comments.comment_id IS 'The id of the global comment'; CREATE INDEX bn_global_edge_comments_src_module_id_idx ON bn_global_edge_comments USING btree (src_module_id); CREATE INDEX bn_global_edge_comments_dst_module_id_idx ON bn_global_edge_comments USING btree (dst_module_id); CREATE INDEX bn_global_edge_comments_comment_id_idx ON bn_global_edge_comments USING btree (comment_id); CREATE TRIGGER bn_global_edge_comments_trigger AFTER INSERT OR DELETE OR UPDATE ON bn_global_edge_comments FOR EACH ROW EXECUTE PROCEDURE bn_global_edge_comments_trigger(); -- -- bn_global_node_comments -- CREATE TABLE bn_global_node_comments ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, address bigint NOT NULL, comment_id integer REFERENCES bn_comments(id) ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED, CONSTRAINT bn_global_node_comments_pkey PRIMARY KEY (module_id, address) ); COMMENT ON TABLE bn_global_node_comments IS 'This table holds all global node comments.'; COMMENT ON COLUMN bn_global_node_comments.module_id IS 'The module id of the node.'; COMMENT ON COLUMN bn_global_node_comments.address IS 'The address of the node.'; COMMENT ON COLUMN bn_global_node_comments.comment_id IS 'The id of the global node comment.'; CREATE INDEX bn_global_node_comments_comment_id_idx ON bn_global_node_comments USING btree (comment_id); CREATE TRIGGER bn_global_node_comments_trigger AFTER INSERT OR DELETE OR UPDATE ON bn_global_node_comments FOR EACH ROW EXECUTE PROCEDURE bn_global_node_comments_trigger(); -- -- bn_group_nodes -- CREATE TABLE bn_group_nodes ( node_id integer NOT NULL PRIMARY KEY REFERENCES bn_nodes(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, collapsed boolean NOT NULL, comment_id integer REFERENCES bn_comments(id) ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_group_nodes IS 'This table holds the information about group nodes.'; COMMENT ON COLUMN bn_group_nodes.node_id IS 'The node id of the group node.'; COMMENT ON COLUMN bn_group_nodes.collapsed IS 'Flag that indicates if the node is collapsed.'; COMMENT ON COLUMN bn_group_nodes.comment_id IS 'The id of the comment associated to the group node.'; CREATE INDEX bn_group_nodes_comments_id_idx ON bn_group_nodes USING btree (comment_id); CREATE TRIGGER bn_group_nodes_comment_trigger AFTER INSERT OR DELETE OR UPDATE ON bn_group_nodes FOR EACH ROW EXECUTE PROCEDURE bn_group_nodes_comment_trigger(); -- -- bn_instructions -- CREATE TABLE bn_instructions ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, address bigint NOT NULL, mnemonic character varying(32) NOT NULL, data bytea NOT NULL, native boolean NOT NULL, architecture architecture_type NOT NULL, comment_id integer REFERENCES bn_comments(id) ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED, CONSTRAINT bn_instructions_pkey PRIMARY KEY (module_id, address) ); COMMENT ON TABLE bn_instructions IS 'This table holds the information about instruction.'; COMMENT ON COLUMN bn_instructions.module_id IS 'The module of the instruction.'; COMMENT ON COLUMN bn_instructions.address IS 'The address of the instruction.'; COMMENT ON COLUMN bn_instructions.mnemonic IS 'The mnemonic of the instruction.'; COMMENT ON COLUMN bn_instructions.data IS 'The raw bytes of the instruction from the binary.'; COMMENT ON COLUMN bn_instructions.native IS 'Flag that indicates if the instruction has been build within BinNavi or came from external sources.'; COMMENT ON COLUMN bn_instructions.architecture IS 'The architecture of the instruction for more information about known architecture types see srchitecture_type type.'; COMMENT ON COLUMN bn_instructions.comment_id IS 'The id of the comment associated to the instruction.'; CREATE INDEX bn_instructions_comment_id_idx ON bn_instructions USING btree (comment_id); CREATE TRIGGER bn_instructions_comment_trigger AFTER UPDATE OF comment_id ON bn_instructions FOR EACH ROW EXECUTE PROCEDURE bn_instructions_comment_trigger(); -- -- bn_module_settings -- CREATE TABLE bn_module_settings ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, name character varying(255) NOT NULL, value text NOT NULL, CONSTRAINT bn_module_settings_pkey PRIMARY KEY (module_id, name) ); COMMENT ON TABLE bn_module_settings IS 'This table stores various settings for modules.'; COMMENT ON COLUMN bn_module_settings.module_id IS 'The module id of the setting.'; COMMENT ON COLUMN bn_module_settings.name IS 'The name of the setting.'; COMMENT ON COLUMN bn_module_settings.value IS 'The value of the setting.'; -- -- bn_traces -- CREATE SEQUENCE bn_traces_id_seq; COMMENT ON SEQUENCE bn_traces_id_seq IS 'This sequence is used by the table bn_traces id field.'; CREATE TABLE bn_traces ( id integer NOT NULL PRIMARY KEY DEFAULT nextval('bn_traces_id_seq'::regclass), view_id integer NOT NULL, name text NOT NULL, description text NOT NULL ); COMMENT ON TABLE bn_traces IS 'This table holds the information about traces.'; COMMENT ON COLUMN bn_traces.id IS 'The id of the trace.'; COMMENT ON COLUMN bn_traces.view_id IS 'The view id to which the trace is associated.'; COMMENT ON COLUMN bn_traces.name IS 'The name of the trace.'; COMMENT ON COLUMN bn_traces.description IS 'The description of the trace.'; ALTER SEQUENCE bn_traces_id_seq OWNED BY bn_traces.id; CREATE INDEX bn_traces_view_id_idx ON bn_traces USING btree (view_id); -- -- bn_trace_events -- CREATE TABLE bn_trace_events ( module_id integer REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, trace_id integer NOT NULL REFERENCES bn_traces(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, "position" integer NOT NULL, tid integer NOT NULL, address bigint NOT NULL, type integer, CONSTRAINT bn_trace_events_pkey PRIMARY KEY (trace_id, "position") ); COMMENT ON TABLE bn_trace_events IS 'This table holds the information about a single trace event.'; COMMENT ON COLUMN bn_trace_events.module_id IS 'The id of the module the trace is associated to.'; COMMENT ON COLUMN bn_trace_events.trace_id IS 'The id of the trace.'; COMMENT ON COLUMN bn_trace_events."position" IS 'The position of the trace event within the trace.'; COMMENT ON COLUMN bn_trace_events.tid IS 'The thread id of the trace event.'; COMMENT ON COLUMN bn_trace_events.address IS 'The address of the trace event.'; COMMENT ON COLUMN bn_trace_events.type IS 'The type of the trace event.'; CREATE INDEX bn_trace_events_module_id_idx ON bn_trace_events USING btree (module_id); -- -- bn_module_traces -- CREATE TABLE bn_module_traces ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, trace_id integer NOT NULL REFERENCES bn_traces(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, CONSTRAINT bn_module_traces_pkey PRIMARY KEY (module_id, trace_id) ); COMMENT ON TABLE bn_module_traces IS 'This table stores the association between modules and traces.'; COMMENT ON COLUMN bn_module_traces.module_id IS 'The module id a trace belongs to.'; COMMENT ON COLUMN bn_module_traces.trace_id IS 'The id of the trace.'; -- -- bn_module_views -- CREATE TABLE bn_module_views ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, view_id integer NOT NULL PRIMARY KEY REFERENCES bn_views(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_module_views IS 'This table stores the association between modules and views.'; COMMENT ON COLUMN bn_module_views.module_id IS 'The module id a view belongs to.'; COMMENT ON COLUMN bn_module_views.view_id IS 'The id of the view.'; CREATE INDEX bn_module_views_module_id_view_id_idx ON bn_module_views USING btree (module_id, view_id); CREATE INDEX bn_module_views_module_id_idx ON bn_module_views USING btree (module_id); CREATE TRIGGER bn_module_views_trigger AFTER INSERT OR UPDATE OR DELETE ON bn_module_views FOR EACH ROW EXECUTE PROCEDURE bn_module_views_trigger(); -- -- bn_nodes_spacemodules -- CREATE TABLE bn_nodes_spacemodules ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, node integer NOT NULL PRIMARY KEY REFERENCES bn_nodes(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, address_space integer REFERENCES bn_address_spaces(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_nodes_spacemodules IS 'This table holds the information about a nodes module association when in a project.'; COMMENT ON COLUMN bn_nodes_spacemodules.module_id IS 'The module id the node is associated to.'; COMMENT ON COLUMN bn_nodes_spacemodules.node IS 'The id of the node.'; COMMENT ON COLUMN bn_nodes_spacemodules.address_space IS 'The id of the address space.'; CREATE INDEX bn_nodes_spacemodules_address_space_idx ON bn_nodes_spacemodules USING btree (address_space); -- -- bn_operands -- CREATE TABLE bn_operands ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, address bigint NOT NULL, expression_tree_id integer NOT NULL, "position" integer NOT NULL, CONSTRAINT bn_operands_pkey PRIMARY KEY (module_id, address, "position") ); COMMENT ON TABLE bn_operands IS 'This table stores the information about operands.'; COMMENT ON COLUMN bn_operands.module_id IS 'The module id the operand belongs to.'; COMMENT ON COLUMN bn_operands.address IS 'The address where the operand can be found.'; COMMENT ON COLUMN bn_operands.expression_tree_id IS 'The expression tree id of the operand.'; COMMENT ON COLUMN bn_operands."position" IS 'The position of the operand.'; CREATE INDEX bn_operands_module_id_idx ON bn_operands USING btree (module_id); -- -- bn_project_debuggers -- CREATE TABLE bn_project_debuggers ( project_id integer NOT NULL REFERENCES bn_projects(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, debugger_id integer NOT NULL REFERENCES bn_debuggers(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_project_debuggers IS 'This table stores the information about debuggers associated to projects.'; COMMENT ON COLUMN bn_project_debuggers.project_id IS 'The id of a project.'; COMMENT ON COLUMN bn_project_debuggers.debugger_id IS 'The id of a debugger.'; CREATE INDEX bn_project_debuggers_debugger_id_idx ON bn_project_debuggers USING btree (debugger_id); -- -- bn_project_settings -- CREATE TABLE bn_project_settings ( project_id integer NOT NULL REFERENCES bn_projects(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, name character varying(255) NOT NULL, value text NOT NULL, CONSTRAINT bn_project_settings_pkey PRIMARY KEY (project_id, name) ); COMMENT ON TABLE bn_project_settings IS 'This table stores all settings of a project.'; COMMENT ON COLUMN bn_project_settings.project_id IS 'The id of the project the setting belongs to.'; COMMENT ON COLUMN bn_project_settings.name IS 'The name of the setting.'; COMMENT ON COLUMN bn_project_settings.value IS 'The value of the setting.'; -- -- bn_project_traces -- CREATE TABLE bn_project_traces ( project_id integer NOT NULL REFERENCES bn_projects(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, trace_id integer NOT NULL REFERENCES bn_traces(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, CONSTRAINT bn_project_traces_pkey PRIMARY KEY (project_id, trace_id) ); COMMENT ON TABLE bn_project_traces IS 'This table stores the association between a project and a trace.'; COMMENT ON COLUMN bn_project_traces.project_id IS 'The id of the project'; COMMENT ON COLUMN bn_project_traces.trace_id IS 'The id of the trace.'; CREATE INDEX bn_project_traces_trace_id_idx ON bn_project_traces USING btree (trace_id); -- -- bn_project_views -- CREATE TABLE bn_project_views ( project_id integer NOT NULL REFERENCES bn_projects(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, view_id integer NOT NULL PRIMARY KEY REFERENCES bn_views(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_project_views IS 'This table stores the association of a view to a project.'; COMMENT ON COLUMN bn_project_views.project_id IS 'The id of the project.'; COMMENT ON COLUMN bn_project_views.view_id IS 'The id of the view.'; CREATE INDEX bn_project_views_project_id_idx ON bn_project_views USING btree (project_id); CREATE TRIGGER bn_project_views_trigger AFTER INSERT OR UPDATE OR DELETE ON bn_project_views FOR EACH ROW EXECUTE PROCEDURE bn_project_views_trigger(); -- -- bn_space_modules -- CREATE TABLE bn_space_modules ( module_id integer NOT NULL REFERENCES bn_modules(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, address_space_id integer NOT NULL REFERENCES bn_address_spaces(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, image_base bigint NOT NULL, CONSTRAINT bn_space_modules_pkey PRIMARY KEY (address_space_id, module_id) ); COMMENT ON TABLE bn_space_modules IS 'This table stores the association between modules and address spaces.'; COMMENT ON COLUMN bn_space_modules.module_id IS 'The id of the module.'; COMMENT ON COLUMN bn_space_modules.address_space_id IS 'The id of the address space.'; COMMENT ON COLUMN bn_space_modules.image_base IS 'The image base of the module in the context of the address space.'; -- -- bn_tags -- CREATE SEQUENCE bn_tags_id_seq; COMMENT ON SEQUENCE bn_tags_id_seq IS 'This sequence is used by the table bn_tags id field.'; CREATE TABLE bn_tags ( id integer NOT NULL PRIMARY KEY DEFAULT nextval('bn_tags_id_seq'::regclass), parent_id integer REFERENCES bn_tags(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, name text NOT NULL, description text NOT NULL, type tag_type NOT NULL ); COMMENT ON TABLE bn_tags IS 'This table stores all information about tags'; COMMENT ON COLUMN bn_tags.id IS 'The id of the tag.'; COMMENT ON COLUMN bn_tags.parent_id IS 'The id of a potential parent tag.'; COMMENT ON COLUMN bn_tags.name IS 'The name of the tag.'; COMMENT ON COLUMN bn_tags.description IS 'The description of the tag.'; COMMENT ON COLUMN bn_tags.type IS 'The type of the tag.'; ALTER SEQUENCE bn_tags_id_seq OWNED BY bn_tags.id; CREATE INDEX bn_tags_parent_id_idx ON bn_tags USING btree (parent_id); -- -- bn_tagged_nodes -- CREATE TABLE bn_tagged_nodes ( node_id integer NOT NULL REFERENCES bn_nodes(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, tag_id integer NOT NULL REFERENCES bn_tags(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, CONSTRAINT bn_tagged_nodes_pkey PRIMARY KEY (node_id, tag_id) ); COMMENT ON TABLE bn_tagged_nodes IS 'This table stores the association between tags and nodes.'; COMMENT ON COLUMN bn_tagged_nodes.node_id IS 'The node id of a tagged node.'; COMMENT ON COLUMN bn_tagged_nodes.tag_id IS 'The id of a tag.'; -- -- bn_tagged_views -- CREATE TABLE bn_tagged_views ( view_id integer NOT NULL REFERENCES bn_views(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, tag_id integer NOT NULL REFERENCES bn_tags(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, CONSTRAINT bn_tagged_views_pkey PRIMARY KEY (view_id, tag_id) ); COMMENT ON TABLE bn_tagged_views IS 'This table stores the association between tags and views.'; COMMENT ON COLUMN bn_tagged_views.view_id IS 'The view id of a tagged view.'; COMMENT ON COLUMN bn_tagged_views.tag_id IS 'The id of a tag.'; CREATE INDEX bn_tagged_views_tag_id_idx ON bn_tagged_views USING btree (tag_id); -- -- bn_text_nodes -- CREATE TABLE bn_text_nodes ( node_id integer NOT NULL PRIMARY KEY REFERENCES bn_nodes(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, comment_id integer REFERENCES bn_comments(id) ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED ); COMMENT ON TABLE bn_text_nodes IS 'This table stores the information about text nodes.'; COMMENT ON COLUMN bn_text_nodes.node_id IS 'The node id of the text node.'; COMMENT ON COLUMN bn_text_nodes.comment_id IS 'The id of the comment associated to the text node.'; CREATE INDEX bn_text_nodes_comment_id_idx ON bn_text_nodes USING btree (comment_id); CREATE TRIGGER bn_text_nodes_comment_trigger AFTER INSERT OR DELETE OR UPDATE ON bn_text_nodes FOR EACH ROW EXECUTE PROCEDURE bn_text_nodes_comment_trigger(); -- -- bn_trace_event_values -- CREATE TABLE bn_trace_event_values ( trace_id integer NOT NULL REFERENCES bn_traces(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, "position" integer NOT NULL, register_name character varying(50) NOT NULL, register_value bigint NOT NULL, memory_value bytea NOT NULL, CONSTRAINT bn_trace_event_values_pkey PRIMARY KEY (trace_id, "position", register_name) ); COMMENT ON TABLE bn_trace_event_values IS 'This table holds the information about register contents for a trace event.'; COMMENT ON COLUMN bn_trace_event_values.trace_id IS 'The id of the trace the event values are associated to.'; COMMENT ON COLUMN bn_trace_event_values."position" IS 'The position of the values within the trace.'; COMMENT ON COLUMN bn_trace_event_values.register_name IS 'The name of the register for which we have the values.'; COMMENT ON COLUMN bn_trace_event_values.register_value IS 'The values of the register.'; COMMENT ON COLUMN bn_trace_event_values.memory_value IS 'The value of the memory pointed to by the register when there was valid memory available.'; CREATE INDEX bn_trace_event_values_trace_id_idx ON bn_trace_event_values USING btree (trace_id); -- -- bn_view_settings -- CREATE TABLE bn_view_settings ( view_id integer NOT NULL REFERENCES bn_views(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, name character varying(255) NOT NULL, value text NOT NULL, CONSTRAINT bn_view_settings_pkey PRIMARY KEY (view_id, name) ); COMMENT ON TABLE bn_view_settings IS 'This table holds configuration settings for a particular view.'; COMMENT ON COLUMN bn_view_settings.view_id IS 'The view id associated to this setting.'; COMMENT ON COLUMN bn_view_settings.name IS 'The name of the setting.'; COMMENT ON COLUMN bn_view_settings.value IS 'The value of the setting.'; -- -- Function section. -- -- -- import(IN rawmoduleid integer, IN moduleid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION import(IN rawmoduleid integer, IN moduleid integer, IN userid integer) RETURNS void AS $$ DECLARE arch text; viewid int; BEGIN -- -- Disable all trigger procedures during the import. -- SET session_replication_role = replica; SELECT architecture INTO arch FROM modules WHERE id = rawmoduleid; -- -- import expression tree ids. -- EXECUTE 'INSERT INTO bn_expression_tree_ids SELECT '|| moduleid ||', id FROM ex_'|| rawmoduleid ||'_expression_trees'; -- -- import expression trees. -- EXECUTE 'INSERT INTO bn_expression_tree (module_id, id, type, symbol, immediate, position, parent_id) SELECT '|| moduleid ||', id, type, symbol, immediate, position, parent_id FROM ex_'|| rawmoduleid ||'_expression_nodes'; -- -- Connect expression trees. -- EXECUTE 'INSERT INTO bn_expression_tree_mapping (SELECT '|| moduleid ||', expression_tree_id, expression_node_id FROM ex_'|| rawmoduleid ||'_expression_tree_nodes)'; -- -- import instructions. -- EXECUTE 'WITH comments_to_id(id, address, comment) AS ( SELECT nextval(''bn_comments_id_seq''::regclass), address, comment FROM ex_'|| rawmoduleid ||'_address_comments ), comments_table AS ( INSERT INTO bn_comments (id, parent_id, user_id, comment_text) SELECT id, null, '|| userid ||', comment FROM comments_to_id ) INSERT INTO bn_instructions (module_id, address, mnemonic, data, native, architecture, comment_id) SELECT '|| moduleid ||', isn.address, mnemonic, data, true, '|| quote_literal(arch) ||', com.id FROM ex_'|| rawmoduleid ||'_instructions AS isn LEFT JOIN comments_to_id AS com ON com.address = isn.address'; -- -- import operands. -- EXECUTE 'INSERT INTO bn_operands SELECT '|| moduleid ||', address, expression_tree_id, position FROM ex_'|| rawmoduleid ||'_operands'; -- -- import expression substitutions. -- EXECUTE 'INSERT INTO bn_expression_substitutions (module_id, address, position, expression_id, replacement) SELECT '|| moduleid ||', address, position, expression_node_id, replacement FROM ex_'|| rawmoduleid ||'_expression_substitutions'; -- -- Import address references. -- EXECUTE 'INSERT INTO bn_address_references (module_id, address, position, expression_id, type, target) SELECT '|| moduleid ||', address, position, expression_node_id, (ENUM_RANGE(NULL::address_reference_type))[type + 1], destination FROM ex_'|| rawmoduleid ||'_address_references WHERE position IS NOT NULL AND expression_node_id IS NOT NULL'; -- -- Import functions. -- EXECUTE 'INSERT INTO bn_functions (module_id, address, name, original_name, type, description, parent_module_name, parent_module_id, parent_module_function, comment_id, stack_frame, prototype) SELECT '|| moduleid ||', address, demangled_name, name, (ENUM_RANGE(NULL::function_type))[type + 1], null, module_name, null, null, null, stack_frame, prototype FROM ex_'|| rawmoduleid ||'_functions'; -- -- import base types. -- EXECUTE 'INSERT INTO bn_base_types SELECT '|| moduleid ||', id, name, size, pointer, signed, category::text::type_category FROM ex_'|| rawmoduleid ||'_base_types'; EXECUTE 'SELECT setval(''bn_base_types_id_seq'', COALESCE((SELECT MAX(id) + 1 FROM bn_base_types), 1), false) FROM bn_base_types'; -- -- import types. -- EXECUTE 'INSERT INTO bn_types SELECT '|| moduleid ||', raw_types.id, raw_types.name, raw_types.base_type, raw_types.parent_id, raw_types.offset, raw_types.argument, raw_types.number_of_elements FROM ex_'|| rawmoduleid ||'_types AS raw_types'; EXECUTE 'SELECT setval(''bn_types_id_seq'', COALESCE((SELECT MAX(id) + 1 FROM bn_types), 1), false) FROM bn_types'; -- -- import expression types. -- EXECUTE 'INSERT INTO bn_expression_types SELECT '|| moduleid ||', et.address, et.position, et.expression_id, et.type, et.path, et.offset FROM ex_'|| rawmoduleid ||'_expression_types AS et'; -- -- import sections -- EXECUTE 'INSERT INTO bn_sections (module_id, id, name, comment_id, start_address, end_address, permission, data) SELECT '|| moduleid ||', id, name, NULL, start_address, end_address, permission::text::permission_type, data FROM ex_'|| rawmoduleid ||'_sections'; EXECUTE 'SELECT setval(''bn_sections_id_seq'', COALESCE((SELECT MAX(id) + 1 FROM bn_sections), 1), false) FROM bn_sections'; -- -- import type instances -- EXECUTE 'INSERT INTO bn_type_instances (module_id, id, name, type_id, section_id, section_offset) SELECT '|| moduleid ||', id, name, type_id, section_id, section_offset FROM ex_'|| rawmoduleid ||'_type_instances'; EXECUTE 'SELECT setval(''bn_type_instances_id_seq'', COALESCE((SELECT MAX(id) + 1 FROM bn_type_instances), 1), false) FROM bn_type_instances'; -- -- import expression type instances -- EXECUTE 'INSERT INTO bn_expression_type_instances SELECT '|| moduleid ||', address, position, expression_node_id, type_instance_id FROM ex_'|| rawmoduleid ||'_expression_type_instances'; PERFORM create_native_flowgraph_views(moduleid); PERFORM create_native_code_nodes(rawmoduleid, moduleid); PERFORM connect_instructions_to_code_nodes(rawmoduleid, moduleid); PERFORM create_native_flowgraph_edges(rawmoduleid,moduleid); PERFORM colorize_module_nodes(moduleid); SELECT * INTO viewid FROM create_native_call_graph_view(moduleid); PERFORM create_native_callgraph_nodes(viewid, moduleid); PERFORM create_native_callgraph_edges(rawmoduleid, moduleid); UPDATE bn_modules SET initialization_state = 2147483647 WHERE id = moduleid; -- -- Enable all trigger procedures after the import. -- SET session_replication_role = DEFAULT; ANALYZE bn_nodes; ANALYZE bn_code_nodes; ANALYZE bn_function_nodes; ANALYZE bn_edges; ANALYZE bn_functions; ANALYZE bn_function_views; ANALYZE bn_views; ANALYZE bn_address_references; ANALYZE bn_expression_substitutions; ANALYZE bn_instructions; ANALYZE bn_codenode_instructions; END; $$ LANGUAGE plpgsql VOLATILE COST 100; COMMENT ON FUNCTION import(IN rawmoduleid integer, IN moduleid integer, IN userid integer) IS 'This function performs all necessary conversions to transform a raw module from the exporter tables into a BinNavi type module.'; -- -- load_code_nodes(IN viewid integer) -- CREATE OR REPLACE FUNCTION load_code_nodes( IN viewid integer) RETURNS TABLE ( module_id integer, instruction_address bigint, operand_position integer, view_id integer, node_id integer, parent_function bigint, local_code_node_comment integer, global_code_node_comment integer, local_instruction_comment integer, global_instruction_comment integer, instruction_data bytea, x double precision, y double precision, width double precision, height double precision, color integer, bordercolor integer, selected boolean, visible boolean, mnemonic text, architecture architecture_type, expression_tree_id integer, expression_tree_type integer, symbol text, immediate bigint, expression_tree_parent_id integer, replacement text, target bigint, expression_types_type integer, expression_types_offset integer, expression_types_position integer, expression_types_path integer[], address_references_type address_reference_type, function_address bigint, type_instance_id integer) LANGUAGE SQL AS $$ SELECT bi.module_id AS module_id, bi.address AS instruction_address, bo.position AS operand_position, bv.id AS view_id, bn.id AS node_id, parent_function, bcn.comment_id AS local_code_node_comment, bgnc.comment_id AS global_code_node_comment, bci.comment_id AS local_instruction_comment, bi.comment_id AS global_instruction_comment, bi.data AS instruction_data, x, y, width, height, color, bordercolor, selected, visible, mnemonic, architecture, bet.id AS expression_tree_id, bet.type AS expression_tree_type, symbol, immediate, bet.parent_id AS expression_tree_parent_id, replacement, target, bety.base_type_id AS expression_types_type, bety.offset AS expression_types_offset, bety.position AS expression_types_position, bety.path AS expression_types_path, bar.type AS address_references_type, bf.address AS function_address, beti.type_instance_id AS type_instance_id FROM bn_views as bv JOIN bn_nodes as bn ON bn.view_id = bv.id AND bn.type = 'code'::node_type LEFT JOIN bn_code_nodes AS bcn ON bcn.node_id = bn.id LEFT JOIN bn_codenode_instructions AS bci ON bci.module_id = bcn.module_id AND bci.node_id = bcn.node_id LEFT JOIN bn_global_node_comments AS bgnc ON bgnc.module_id = bci.module_id AND bgnc.address = bci.address LEFT JOIN bn_instructions AS bi ON bi.module_id = bci.module_id AND bi.address = bci.address LEFT JOIN bn_operands AS bo ON bo.module_id = bi.module_id AND bo.address = bi.address LEFT JOIN bn_expression_tree_mapping AS betm ON betm.module_id = bo.module_id AND betm.tree_id = bo.expression_tree_id LEFT JOIN bn_expression_tree AS bet ON bet.module_id = betm.module_id and bet.id = betm.tree_node_id LEFT JOIN bn_address_references AS bar ON bar.module_id = betm.module_id AND bar.address = bi.address AND bar.position = bo.position AND bar.expression_id = bet.id LEFT JOIN bn_expression_substitutions AS bes ON bes.module_id = bet.module_id AND bes.address = bi.address AND bes.position = bo.position AND bes.expression_id = bet.id LEFT JOIN bn_expression_types AS bety ON bety.module_id = bet.module_id AND bety.address = bi.address AND bety.expression_id = bet.id LEFT JOIN bn_functions AS bf ON bf.module_id = bet.module_id AND bf.address = bet.immediate LEFT JOIN bn_expression_type_instances AS beti ON beti.module_id = bet.module_id AND beti.address = bi.address AND beti.position = bo.position AND beti.expression_id = bet.id WHERE bv.id = $1 ORDER BY bn.id, bci.position, bo.position, bet.position, bet.id; $$; COMMENT ON FUNCTION load_code_nodes( IN viewid integer) IS 'Loads the code nodes for a view.'; -- -- load_function_information(IN moduleid integer, IN address bigint) -- CREATE OR REPLACE FUNCTION load_function_information(IN moduleid integer, IN address bigint) RETURNS TABLE( view_id integer, address bigint, name text, original_name text, description text, bbcount bigint, edgecount bigint, incount bigint, outcount bigint, global_comment integer, type function_type, parent_module_name text, parent_module_id integer, parent_module_function integer, stack_frame integer, prototype integer) LANGUAGE SQL AS $$ WITH function_block_count AS ( SELECT function, count(nt.id) AS bbcount FROM bn_views AS vt LEFT JOIN bn_function_views AS fvt ON vt.id = fvt.view_id LEFT JOIN bn_nodes AS nt ON nt.view_id = vt.id WHERE fvt.module_id = $1 AND function = $2 GROUP BY fvt.function ), function_edge_count AS ( SELECT function, count(et.id) AS edgecount FROM bn_views AS vt LEFT JOIN bn_function_views AS fvt ON vt.id = fvt.view_id LEFT JOIN bn_nodes AS nt ON nt.view_id = vt.id LEFT JOIN bn_edges AS et ON source_node_id = nt.id WHERE fvt.module_id = $1 AND function = $2 GROUP BY function ), function_in_count AS ( SELECT function, COUNT(source_node_id) AS incount FROM bn_views AS vt JOIN bn_nodes AS nt ON nt.view_id = vt.id JOIN bn_function_nodes AS fnt ON nt.id = fnt.node_id LEFT JOIN bn_edges ON target_node_id = fnt.node_id WHERE vt.type = 'native' AND module_id = $1 AND function = $2 GROUP BY function ), function_out_count AS ( SELECT function, COUNT(target_node_id) AS outcount FROM bn_views AS vt JOIN bn_nodes AS nt ON nt.view_id = vt.id JOIN bn_function_nodes AS fnt ON nt.id = fnt.node_id LEFT JOIN bn_edges ON source_node_id = fnt.node_id WHERE vt.type = 'native' AND module_id = $1 AND function = $2 GROUP BY function ) SELECT view_id, ft.address, name, original_name, description, bc.bbcount, ec.edgecount, ic.incount, oc.outcount, comment_id AS global_comment, type, parent_module_name, parent_module_id, parent_module_function, stack_frame FROM bn_functions AS ft JOIN bn_function_views AS fviews ON fviews.module_id = ft.module_id AND function = ft.address JOIN function_block_count AS bc ON bc.function = ft.address JOIN function_edge_count AS ec ON ec.function = ft.address JOIN function_in_count AS ic ON ic.function = ft.address JOIN function_out_count AS oc ON oc.function = ft.address WHERE ft.module_id = $1 AND ft.address = $2 $$; COMMENT ON FUNCTION load_function_information(IN moduleid integer, IN address bigint) IS 'This function provides the information about a single view / function information stored in the database.'; -- -- load_function_information(IN moduleid integer) -- CREATE OR REPLACE FUNCTION load_function_information(IN moduleid integer) RETURNS TABLE( view_id integer, address bigint, name text, original_name text, description text, bbcount bigint, edgecount bigint, incount bigint, outcount bigint, global_comment integer, type function_type, parent_module_name text, parent_module_id integer, parent_module_function integer, stack_frame integer, prototype integer) AS $$ WITH function_block_count AS ( SELECT function, count(nt.id) AS bbcount FROM bn_views AS vt LEFT JOIN bn_function_views AS fvt ON vt.id = fvt.view_id LEFT JOIN bn_nodes AS nt ON nt.view_id = vt.id WHERE fvt.module_id = $1 GROUP BY fvt.function ), function_edge_count AS ( SELECT function, count(et.id) AS edgecount FROM bn_views AS vt LEFT JOIN bn_function_views AS fvt ON vt.id = fvt.view_id LEFT JOIN bn_nodes AS nt ON nt.view_id = vt.id LEFT JOIN bn_edges AS et ON source_node_id = nt.id WHERE fvt.module_id = $1 GROUP BY function ), function_in_count AS ( SELECT function, COUNT(source_node_id) AS incount FROM bn_views AS vt JOIN bn_nodes AS nt ON nt.view_id = vt.id JOIN bn_function_nodes AS fnt ON nt.id = fnt.node_id LEFT JOIN bn_edges ON target_node_id = fnt.node_id WHERE vt.type = 'native' AND module_id = $1 GROUP BY function ), function_out_count AS ( SELECT function, COUNT(target_node_id) AS outcount FROM bn_views AS vt JOIN bn_nodes AS nt ON nt.view_id = vt.id JOIN bn_function_nodes AS fnt ON nt.id = fnt.node_id LEFT JOIN bn_edges ON source_node_id = fnt.node_id WHERE vt.type = 'native' and module_id = $1 GROUP BY function ) SELECT view_id, ft.address, name, original_name, description, bc.bbcount, ec.edgecount, ic.incount, oc.outcount, comment_id AS global_comment, type, parent_module_name, parent_module_id, parent_module_function, stack_frame, prototype FROM bn_functions AS ft JOIN bn_function_views AS fviews ON fviews.module_id = ft.module_id AND function = ft.address JOIN function_block_count AS bc ON bc.function = ft.address JOIN function_edge_count AS ec ON ec.function = ft.address JOIN function_in_count AS ic ON ic.function = ft.address JOIN function_out_count AS oc ON oc.function = ft.address WHERE ft.module_id = $1 ORDER BY ft.address $$ LANGUAGE SQL; COMMENT ON FUNCTION load_function_information(IN moduleid integer) IS 'This function provides the information about all view / function information stored in the database under a specific module id.'; -- -- load_project_flowgraph(IN projectid integer, IN viewid integer) -- CREATE OR REPLACE FUNCTION load_project_flowgraph(IN projectid integer, IN viewid integer) RETURNS TABLE( view_id integer, name text, description text, type view_type, creation_date timestamp without time zone, modification_date timestamp without time zone, stared boolean, bbcount bigint, edgecount bigint, type_count bigint, node_type node_type) AS $$ SELECT vt.id AS view_id, name, description, vt.type AS type, creation_date, modification_date, stared, COUNT(DISTINCT(nt.id)) AS bbcount, COUNT(et.id) AS edgecount, COUNT(DISTINCT(nt.type)) AS type_count, nt.type AS node_type FROM bn_views AS vt JOIN bn_project_views AS pvt ON vt.id = pvt.view_id LEFT JOIN bn_nodes AS nt ON vt.id = nt.view_id LEFT JOIN bn_edges AS et ON nt.id = et.source_node_id WHERE vt.type = 'non-native' AND vt.id = $2 AND pvt.project_id = $1 AND nt.type in ('code', 'function') GROUP BY vt.id, nt.type HAVING COUNT(DISTINCT(nt.type)) = 1 AND nt.type = 'code' ORDER BY vt.id $$ LANGUAGE SQL; COMMENT ON FUNCTION load_project_flowgraph(IN projectid integer, IN viewid integer) IS 'This function loads project view specific configuration information from the database.'; -- -- load_module_call_graph(IN moduleid integer, IN viewtype view_type) -- CREATE OR REPLACE FUNCTION load_module_call_graph(IN moduleid integer, IN viewtype view_type) RETURNS TABLE( view_id integer, name text, description text, type view_type, creation_date timestamp without time zone, modification_date timestamp without time zone, stared boolean, bbcount bigint, edgecount bigint, type_count bigint, node_type node_type) AS $$ SELECT vt.id AS view_id, name, description, vt.type AS type, creation_date, modification_date, stared, COUNT(DISTINCT(nt.id)) AS bbcount, COUNT(et.id) AS edgecount, COUNT(DISTINCT(nt.type)) AS type_count, nt.type AS node_type FROM bn_views AS vt JOIN bn_module_views AS mvt ON vt.id = mvt.view_id LEFT JOIN bn_nodes AS nt ON vt.id = nt.view_id LEFT JOIN bn_edges AS et ON nt.id = et.source_node_id WHERE vt.type = $2 AND mvt.module_id = $1 GROUP BY vt.id, nt.type HAVING COUNT(DISTINCT(nt.type)) = 1 AND nt.type = 'function' ORDER BY vt.id; $$ LANGUAGE SQL; COMMENT ON FUNCTION load_module_call_graph(IN moduleid integer, IN viewtype view_type) IS 'This function loads module call graph information. But not the call graph itself.'; -- -- load_project_call_graph(IN projectid int) -- CREATE OR REPLACE FUNCTION load_project_call_graph(IN projectid int) RETURNS TABLE( view_id int, name text, description text, type view_type, creation_date timestamp, modification_date timestamp, stared boolean, bbcount bigint, edgecount bigint, type_count bigint, node_type node_type) AS $$ SELECT vt.id AS view_id, name, description, vt.type AS type, creation_date, modification_date, stared, count(DISTINCT(nt.id)) AS bbcount, count(et.id) AS edgecount, count(DISTINCT(nt.type)) AS type_count, nt.type AS node_type FROM bn_views AS vt JOIN bn_project_views AS pvt ON vt.id = pvt.view_id LEFT JOIN bn_nodes AS nt ON vt.id = nt.view_id LEFT JOIN bn_edges AS et ON nt.id = et.source_node_id WHERE pvt.project_id = $1 GROUP BY vt.id, nt.type HAVING COUNT(DISTINCT(nt.type)) = 1 AND nt.type = 'function' ORDER BY vt.id; $$ LANGUAGE SQL; COMMENT ON FUNCTION load_project_call_graph(IN projectid int) IS 'This function loads project call graph information. But not the call graph itself.'; -- -- get_derived_views(IN viewid integer) -- CREATE OR REPLACE FUNCTION get_derived_views(IN viewid integer) RETURNS integer AS $$ SELECT vt.id FROM bn_codenode_instructions AS cit JOIN ( SELECT cit.address FROM bn_views AS vt JOIN bn_nodes AS nt ON vt.id = nt.view_id JOIN bn_codenode_instructions AS cit ON nt.id = cit.node_id WHERE vt.id = $1 ) AS a ON cit.address = a.address JOIN bn_nodes AS nt ON cit.node_id = nt.id JOIN bn_views AS vt ON vt.id = nt.view_id WHERE vt.type = 'non-native' GROUP by vt.id; $$ LANGUAGE SQL; COMMENT ON FUNCTION get_derived_views(IN viewid integer) IS 'This function retrieves the views from the database which have been derived from the given view.'; -- -- create_native_call_graph_view(IN moduleid int) -- CREATE OR REPLACE FUNCTION create_native_call_graph_view(IN moduleid integer) RETURNS int AS $$ WITH callgraphid AS ( INSERT INTO bn_views (type, name, description, creation_date, modification_date) VALUES('native', 'Native Callgraph', null, NOW(), NOW()) RETURNING id ) INSERT INTO bn_module_views (view_id, module_id) SELECT id, $1 FROM callgraphid RETURNING view_id; $$ LANGUAGE SQL; COMMENT ON FUNCTION create_native_call_graph_view(IN moduleid integer) IS 'This function creates the native call graph information and updates the tables accordingly.'; -- -- create_native_flowgraph_views(IN moduleid integer) -- CREATE OR REPLACE FUNCTION create_native_flowgraph_views(IN moduleid integer) RETURNS void AS $$ WITH allinfo AS ( SELECT nextval('bn_views_id_seq') AS id, address, COALESCE(name, original_name) AS name FROM bn_functions WHERE module_id = $1 ), views AS ( INSERT INTO bn_views(id, type, name, description) SELECT id, 'native', name, null FROM allinfo ), function_views AS ( INSERT INTO bn_function_views SELECT $1, id, address FROM allinfo ) INSERT INTO bn_module_views (view_id, module_id) SELECT id, $1 FROM allinfo $$ LANGUAGE SQL; COMMENT ON FUNCTION create_native_flowgraph_views(IN moduleid integer) IS 'This function creates the native flowgraph information in the database during a conversion and updates the related tables accordingly.'; -- -- create_native_flowgraph_edges(IN rawmoduleid integer, IN moduleid integer) -- CREATE OR REPLACE FUNCTION create_native_flowgraph_edges(IN rawmoduleid integer, IN moduleid integer) RETURNS void AS $$ DECLARE minnodeid int; BEGIN SELECT MIN(node_id) INTO minnodeid FROM bn_code_nodes WHERE module_id = moduleid; EXECUTE 'INSERT INTO bn_edges (source_node_id, target_node_id, x1, y1, x2, y2, type, color, visible, selected, comment_id) SELECT fg.source + '|| minnodeid ||' - 1 AS source, fg.destination + '|| minnodeid ||' - 1 AS target, 0, 0, 0, 0, (ENUM_RANGE(NULL::edge_type))[fg.type + 1], 0, true, false, null FROM ex_'|| rawmoduleid ||'_control_flow_graphs AS fg'; END; $$ LANGUAGE plpgsql; COMMENT ON FUNCTION create_native_flowgraph_edges(IN rawmoduleid integer, IN moduleid integer) IS 'This function creates the edges in the native flowgraphs during a rawmodule to module converstion.'; -- -- colorize_module_nodes(IN moduleid integer) -- CREATE OR REPLACE FUNCTION colorize_module_nodes(IN moduleid integer) RETURNS void LANGUAGE sql AS $$ WITH entry_nodes AS ( SELECT bn_nodes.id AS nodes_id FROM bn_nodes JOIN bn_module_views ON bn_nodes.view_id = bn_module_views.view_id AND bn_module_views.module_id = $1 LEFT JOIN bn_edges ON bn_nodes.id = bn_edges.target_node_id WHERE target_node_id IS NULL AND bn_nodes.type = 'code' ), exit_nodes AS ( SELECT bn_nodes.id AS nodes_id FROM bn_nodes JOIN bn_module_views ON bn_nodes.view_id = bn_module_views.view_id AND bn_module_views.module_id = $1 LEFT JOIN bn_edges ON bn_nodes.id = bn_edges.source_node_id WHERE source_node_id IS NULL AND bn_nodes.type = 'code' ), single_nodes AS ( SELECT nodes_id FROM entry_nodes INTERSECT SELECT nodes_id from exit_nodes ), update_entry_nodes AS ( UPDATE bn_nodes SET bordercolor = -16736256 WHERE bn_nodes.id IN (SELECT * FROM entry_nodes) ), update_exit_nodes AS ( UPDATE bn_nodes SET bordercolor = -6291456 WHERE bn_nodes.id IN (SELECT * FROM exit_nodes) ) UPDATE bn_nodes SET bordercolor = -6250496 WHERE bn_nodes.id IN (SELECT * FROM single_nodes); $$; COMMENT ON FUNCTION colorize_module_nodes(IN moduleid integer) IS 'This function creates the initial colors for nodes of a module that is getting converted.'; -- -- load_module_flowgraph_information(IN moduleid integer, IN viewid integer) -- CREATE OR REPLACE FUNCTION load_module_flowgraph_information(IN moduleid integer, IN viewid integer) RETURNS TABLE(view_id integer, name text, description text, type view_type, creation_date timestamp without time zone, modification_date timestamp without time zone, stared boolean, bbcount bigint, edgecount bigint, type_count bigint, node_type node_type) AS $$ SELECT vt.id AS view_id, name, description, vt.type AS type, creation_date, modification_date, stared, COUNT(DISTINCT(nt.id)) AS bbcount, COUNT(et.id) AS edgecount, COUNT(DISTINCT(nt.type)) AS type_count, nt.type AS node_type FROM bn_views AS vt JOIN bn_module_views AS mvt ON vt.id = mvt.view_id LEFT JOIN bn_nodes AS nt ON vt.id = nt.view_id LEFT JOIN bn_edges AS et ON nt.id = et.source_node_id WHERE vt.id = $2 AND mvt.module_id = $1 AND (nt.type IN ('code', 'function') OR nt.type IS NULL) GROUP BY vt.id, nt.type $$ LANGUAGE SQL; COMMENT ON FUNCTION load_module_flowgraph_information(IN moduleid integer, IN viewid integer) IS 'This function loads aggregated information about a specific view / function from the database.'; -- -- load_module_node_tags(IN moduleid integer) -- CREATE OR REPLACE FUNCTION load_module_node_tags(IN moduleid integer) RETURNS TABLE (view_id int, tag_id int) AS $$ SELECT nt.view_id, tnt.tag_id FROM bn_tagged_nodes AS tnt JOIN bn_nodes AS nt ON node_id = nt.id JOIN bn_module_views AS mvt ON mvt.view_id = nt.view_id WHERE mvt.module_id = $1 GROUP BY nt.view_id, tnt.tag_id ORDER BY nt.view_id; $$ LANGUAGE SQL; COMMENT ON FUNCTION load_module_node_tags(IN moduleid integer) IS 'Loads the node tags for the module given as argument.'; -- -- load_project_node_tags(IN projectid integer) -- CREATE OR REPLACE FUNCTION load_project_node_tags(IN projectid integer) RETURNS TABLE (view_id int, tag_id int) AS $$ SELECT nt.view_id, tnt.tag_id FROM bn_tagged_nodes AS tnt JOIN bn_nodes AS nt ON node_id = nt.id JOIN bn_project_views AS pvt ON pvt.view_id = nt.view_id WHERE pvt.project_id = $1 GROUP BY nt.view_id, tnt.tag_id ORDER BY nt.view_id; $$ LANGUAGE SQL; COMMENT ON FUNCTION load_project_node_tags(IN moduleid integer) IS 'Loads the node tags for the project given as argument.'; -- -- load_module_mixed_graph(IN moduleid integer) -- CREATE OR REPLACE FUNCTION load_module_mixed_graph(IN moduleid integer) RETURNS TABLE(view_id int, name text, description text, type view_type, creation_date timestamp, modification_date timestamp, stared boolean, bbcount bigint, edgecount bigint, type_count bigint) AS $$ SELECT vt.id AS view_id, name, description, vt.type AS type, creation_date, modification_date, stared, COUNT(DISTINCT(nt.id)) AS bbcount, COUNT(et.id) AS edgecount, COUNT(DISTINCT(nt.type)) AS type_count FROM bn_views AS vt JOIN bn_module_views AS mvt ON vt.id = mvt.view_id LEFT JOIN bn_nodes AS nt ON vt.id = nt.view_id LEFT JOIN bn_edges AS et ON nt.id = et.source_node_id WHERE vt.type = 'non-native' AND mvt.module_id = $1 GROUP BY vt.id HAVING COUNT(DISTINCT(nt.type)) = 2 $$ LANGUAGE SQL; COMMENT ON FUNCTION load_module_mixed_graph(IN moduleid integer) IS 'This function loads all mixed graph information for the specified module from the database.'; -- -- load_project_mixed_graph(IN projectid integer) -- CREATE OR REPLACE FUNCTION load_project_mixed_graph(IN projectid integer) RETURNS TABLE(view_id int, name text, description text, type view_type, creation_date timestamp, modification_date timestamp, stared boolean, bbcount bigint, edgecount bigint, type_count bigint) AS $$ SELECT vt.id AS view_id, name, description, vt.type AS type, creation_date, modification_date, stared, COUNT(DISTINCT(nt.id)) AS bbcount, COUNT(et.id) AS edgecount, COUNT(DISTINCT(nt.type)) AS type_count FROM bn_views AS vt JOIN bn_project_views AS mvt ON vt.id = pvt.view_id LEFT JOIN bn_nodes AS nt ON vt.id = nt.view_id LEFT JOIN bn_edges AS et ON nt.id = et.source_node_id WHERE vt.type = 'non-native' AND pvt.project_id = $1 GROUP BY vt.id HAVING COUNT(DISTINCT(nt.type)) in (0,2) $$ LANGUAGE SQL; COMMENT ON FUNCTION load_project_mixed_graph(IN projectid integer) IS 'This function loads all mixed graph information for the specified project from the database.'; -- -- load_module_flow_graphs(IN moduleid integer, IN viewtype view_type) -- CREATE OR REPLACE FUNCTION load_module_flow_graphs(IN moduleid integer, IN viewtype view_type) RETURNS TABLE(view_id integer, name text, description text, type view_type, creation_date timestamp without time zone, modification_date timestamp without time zone, stared boolean, bbcount bigint, edgecount bigint, type_count bigint, node_type node_type) AS $$ SELECT vt.id AS view_id, name, description, vt.type AS type, creation_date, modification_date, stared, COUNT(DISTINCT(nt.id)) AS bbcount, COUNT(et.id) AS edgecount, COUNT(DISTINCT(nt.type)) AS type_count, MAX(nt.type) AS node_type FROM bn_views AS vt JOIN bn_module_views AS mvt ON vt.id = mvt.view_id LEFT JOIN bn_nodes AS nt ON vt.id = nt.view_id LEFT JOIN bn_edges AS et ON nt.id = et.source_node_id WHERE vt.type = $2 AND mvt.module_id = $1 GROUP BY vt.id HAVING COUNT(DISTINCT(nt.type)) <= 1 AND MAX(nt.type) = 'code' OR MAX(nt.type) is null $$ LANGUAGE SQL; COMMENT ON FUNCTION load_module_flow_graphs(IN moduleid integer, IN viewtype view_type) IS 'This function loads flow graph type graphs for a module.'; -- -- load_module_call_graphs(IN moduleid integer, IN viewtype view_type) -- CREATE OR REPLACE FUNCTION load_module_call_graphs(IN moduleid integer, IN viewtype view_type) RETURNS TABLE(view_id integer, name text, description text, type view_type, creation_date timestamp without time zone, modification_date timestamp without time zone, stared boolean, bbcount bigint, edgecount bigint, type_count bigint, node_type node_type) AS $$ SELECT vt.id AS view_id, name, description, vt.type AS type, creation_date, modification_date, stared, COUNT(DISTINCT(nt.id)) AS bbcount, COUNT(et.id) AS edgecount, COUNT(DISTINCT(nt.type)) AS type_count, MAX(nt.type) AS node_type FROM bn_views AS vt JOIN bn_module_views AS mvt ON vt.id = mvt.view_id LEFT JOIN bn_nodes AS nt ON vt.id = nt.view_id LEFT JOIN bn_edges AS et ON nt.id = et.source_node_id WHERE vt.type = $2 AND mvt.module_id = $1 GROUP BY vt.id HAVING COUNT(DISTINCT(nt.type)) = 1 AND MAX(nt.type) = 'function' $$ LANGUAGE sql; COMMENT ON FUNCTION load_module_call_graphs(IN moduleid integer, IN viewtype view_type) IS 'This function loads call graph type graphs for a module.'; -- -- load_project_flow_graphs(IN moduleid integer, IN viewtype view_type) -- CREATE OR REPLACE FUNCTION load_project_flow_graphs(IN projectid integer, IN viewtype view_type) RETURNS TABLE(view_id integer, name text, description text, type view_type, creation_date timestamp without time zone, modification_date timestamp without time zone, stared boolean, bbcount bigint, edgecount bigint, type_count bigint, node_type node_type) AS $$ SELECT vt.id AS view_id, name, description, vt.type AS type, creation_date, modification_date, stared, COUNT(DISTINCT(nt.id)) AS bbcount, COUNT(et.id) AS edgecount, COUNT(DISTINCT(nt.type)) AS type_count, MAX(nt.type) AS node_type FROM bn_views AS vt JOIN bn_project_views AS pvt ON vt.id = pvt.view_id LEFT JOIN bn_nodes AS nt ON vt.id = nt.view_id LEFT JOIN bn_edges AS et ON nt.id = et.source_node_id WHERE vt.type = $2 AND pvt.project_id = $1 GROUP BY vt.id HAVING COUNT(DISTINCT(nt.type)) <= 1 AND MAX(nt.type) = 'code' OR MAX(nt.type) is null $$ LANGUAGE SQL; COMMENT ON FUNCTION load_project_flow_graphs(IN projectid integer, IN viewtype view_type) IS 'This function loads flow graph type graphs for a project.'; -- -- load_project_call_graphs(IN moduleid integer, IN viewtype view_type) -- CREATE OR REPLACE FUNCTION load_project_call_graphs(IN projectid integer, IN viewtype view_type) RETURNS TABLE(view_id integer, name text, description text, type view_type, creation_date timestamp without time zone, modification_date timestamp without time zone, stared boolean, bbcount bigint, edgecount bigint, type_count bigint, node_type node_type) AS $$ SELECT vt.id AS view_id, name, description, vt.type AS type, creation_date, modification_date, stared, COUNT(DISTINCT(nt.id)) AS bbcount, COUNT(et.id) AS edgecount, COUNT(DISTINCT(nt.type)) AS type_count, MAX(nt.type) AS node_type FROM bn_views AS vt JOIN bn_project_views AS pvt ON vt.id = pvt.view_id LEFT JOIN bn_nodes AS nt ON vt.id = nt.view_id LEFT JOIN bn_edges AS et ON nt.id = et.source_node_id WHERE vt.type = $2 AND pvt.project_id = $1 GROUP BY vt.id HAVING COUNT(DISTINCT(nt.type)) = 1 AND MAX(nt.type) = 'function' $$ LANGUAGE sql; COMMENT ON FUNCTION load_project_call_graphs(IN projectid integer, IN viewtype view_type) IS 'This function loads call graph type graphs for a project.'; -- -- connect_instructions_to_code_nodes(IN rawmoduleid integer, IN moduleid integer) -- CREATE OR REPLACE FUNCTION connect_instructions_to_code_nodes(IN rawmoduleid integer, IN moduleid integer) RETURNS void AS $$ DECLARE minnodeid int; BEGIN SELECT MIN(node_id) INTO minnodeid FROM bn_code_nodes WHERE module_id = moduleid; EXECUTE 'INSERT INTO bn_codenode_instructions (module_id, node_id, position, address, comment_id) SELECT '|| moduleid ||', basic_block_id + '|| minnodeid ||' - 1 AS nodeId, bbi.sequence, bbi.instruction, null FROM ex_'|| rawmoduleid ||'_basic_block_instructions AS bbi'; END; $$ LANGUAGE plpgsql; COMMENT ON FUNCTION connect_instructions_to_code_nodes(IN rawmoduleid integer, IN moduleid integer) IS 'This function connects the instruction to code nodes in the conversion from a raw module to a BinNavi module.'; -- -- create_native_callgraph_edges(IN rawmoduleid integer, IN moduleid integer) -- CREATE OR REPLACE FUNCTION create_native_callgraph_edges(IN rawmoduleid integer, IN moduleid integer) RETURNS void AS $$ BEGIN EXECUTE 'DROP INDEX IF EXISTS ex_'|| rawmoduleid ||'_callgraph_source_idx'; EXECUTE 'DROP INDEX IF EXISTS ex_'|| rawmoduleid ||'_callgraph_destination_idx'; EXECUTE 'CREATE INDEX ex_'|| rawmoduleid ||'_callgraph_source_idx ON ex_'|| rawmoduleid ||'_callgraph USING btree(source)'; EXECUTE 'CREATE INDEX ex_'|| rawmoduleid ||'_callgraph_destination_idx ON ex_'|| rawmoduleid ||'_callgraph USING btree(destination)'; EXECUTE 'INSERT INTO bn_edges (source_node_id, target_node_id, x1, y1, x2, y2, type, color, selected, visible, comment_id) SELECT source_function.node_id, destination_function.node_id, 0, 0, 0, 0, ''jump_unconditional'', 0, false, true, null FROM ex_'|| rawmoduleid ||'_callgraph AS callgraph INNER JOIN bn_function_nodes AS source_function ON source_function.module_id = '|| moduleid ||' AND source_function.function = callgraph.source INNER JOIN bn_function_nodes as destination_function ON destination_function.module_id = '|| moduleid ||' AND destination_function.function = callgraph.destination'; END; $$ LANGUAGE plpgsql; COMMENT ON FUNCTION create_native_callgraph_edges(IN rawmoduleid integer, IN moduleid integer) IS 'This function creates the edges for the native call graph of a module.'; -- -- create_native_code_nodes(IN rawmoduleid integer, IN moduleid integer) -- CREATE OR REPLACE FUNCTION create_native_code_nodes(IN rawmoduleid integer, IN moduleid integer) RETURNS void AS $$ DECLARE minnodeid int; BEGIN EXECUTE 'DROP INDEX IF EXISTS ex_'|| rawmoduleid ||'_basic_blocks_parent_function_idx'; EXECUTE 'CREATE INDEX ex_'|| rawmoduleid ||'_basic_blocks_parent_function_idx ON ex_'|| rawmoduleid ||'_basic_blocks USING btree(parent_function)'; EXECUTE 'INSERT INTO bn_nodes (view_id, parent_id, type, x, y, width, height, color, selected, visible) SELECT view_id, null, ''code'', 0, 0, 0, 0, 0, false, true FROM ex_'|| rawmoduleid ||'_basic_blocks as basic_blocks INNER JOIN bn_functions AS functions ON functions.module_id = '|| moduleid ||' AND functions.address = basic_blocks.parent_function AND functions.type != ''import'' INNER JOIN bn_function_views AS fvt ON fvt.module_id = '|| moduleid ||' AND fvt.function = basic_blocks.parent_function ORDER BY id RETURNING id' INTO minnodeid; INSERT INTO bn_code_nodes SELECT moduleid, nt.id, function, null FROM bn_function_views AS fvt INNER JOIN bn_nodes AS nt ON nt.view_id = fvt.view_id AND nt.type = 'code' AND nt.id >= minnodeid WHERE fvt.module_id = moduleid; END; $$ LANGUAGE plpgsql; COMMENT ON FUNCTION create_native_code_nodes(IN rawmoduleid integer, IN moduleid integer) IS 'This function creates the code nodes for all native flow graphs in a raw module to BinNavi module conversion.'; -- -- create_native_callgraph_nodes(IN viewid integer, IN moduleid integer) -- CREATE OR REPLACE FUNCTION create_native_callgraph_nodes(IN viewid integer, IN moduleid integer) RETURNS void AS $$ WITH allinfo AS ( SELECT nextval('bn_nodes_id_seq'::regclass) as id ,$1 as view_id, address, $2 as module_id FROM bn_functions WHERE module_id = $2 ), ni AS ( INSERT INTO bn_nodes (id, view_id, parent_id, type, x, y, width, height, color, selected, visible) SELECT id, view_id, null, 'function', 0, 0, 0, 0, 0, false, true FROM allinfo ) INSERT INTO bn_function_nodes (node_id, module_id, function, comment_id) SELECT id, module_id, address, null FROM allinfo $$ LANGUAGE SQL; COMMENT ON FUNCTION create_native_callgraph_nodes(IN viewid integer, IN moduleid integer) IS 'This function creates the function nodes for the native call graph in a raw module to BinNavi module conversion.'; -- -- create_module(IN rawmoduleid integer) -- CREATE OR REPLACE FUNCTION create_module(IN rawmoduleid integer) RETURNS int AS $$ INSERT INTO bn_modules (name, raw_module_id, md5, sha1, description, file_base, image_base, import_time) (SELECT name, id, md5, sha1, comment, base_address, base_address, NOW() FROM modules WHERE id = $1) RETURNING id $$ LANGUAGE SQL; COMMENT ON FUNCTION create_module(IN rawmoduleid integer) IS 'This function creates the entry in the BinNavi modules table in a raw module to BinNavi module conversion.'; -- -- set_section_name(IN moduleid integer, IN sectionid integer, IN newname text) -- CREATE OR REPLACE FUNCTION set_section_name(IN moduleid integer, IN sectionid integer, IN newname text) RETURNS void AS $$ UPDATE bn_sections SET name = $3 WHERE module_id = $1 AND id = $2 $$ LANGUAGE SQL; COMMENT ON FUNCTION set_section_name(IN moduleid integer, IN sectionid integer, IN newname text) IS 'This function creates a new entry in the section table of BinNavi and returns the id of the entry.'; -- -- get_sections(IN moduleid integer) -- CREATE OR REPLACE FUNCTION get_sections(IN moduleid integer) RETURNS TABLE (module_id integer, id integer, name text, comment_id integer, start_address bigint, end_address bigint, permission permission_type, data bytea) AS $$ SELECT * FROM bn_sections WHERE module_id = $1; $$ LANGUAGE SQL; COMMENT ON FUNCTION get_sections(IN moduleid integer) IS 'This function returns all sections associated with the given module id.'; -- -- create_section(IN moduleid integer, name text, comment_id integer, start_address bigint, end_address bigint, permission permission_type, data bytea) -- CREATE OR REPLACE FUNCTION create_section(IN moduleid integer, name text, comment_id integer, start_address bigint, end_address bigint, permission permission_type, data bytea) RETURNS integer AS $$ INSERT INTO bn_sections (module_id, name, comment_id, start_address, end_address, permission, data) VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING id; $$ LANGUAGE SQL; COMMENT ON FUNCTION create_section(IN moduleid integer, name text, comment_id integer, start_address bigint, end_address bigint, permission permission_type, data bytea) IS 'This function creates a new section and returns its id'; -- -- delete_section(IN moduleid integer, IN sectionid integer) -- CREATE OR REPLACE FUNCTION delete_section(IN moduleid integer, IN sectionid integer) RETURNS void AS $$ DELETE FROM bn_sections WHERE module_id = $1 AND id = $2; $$ LANGUAGE SQL; COMMENT ON FUNCTION delete_section(IN moduleid integer, IN sectionid integer) IS 'This function deletes a section.'; -- -- delete_expression_type_instance(IN moduleid integer, IN address bigint, IN "position" integer, IN expressionid integer) -- CREATE OR REPLACE FUNCTION delete_expression_type_instance(IN moduleid integer, IN address bigint, IN "position" integer, IN expressionid integer) RETURNS void AS $$ DELETE FROM bn_expression_type_instances WHERE module_id = $1 AND address = $2 AND "position" = $3 AND expression_id = $4; $$ LANGUAGE SQL; COMMENT ON FUNCTION delete_expression_type_instance(IN moduleid integer, IN address bigint, IN "position" integer, IN expressionid integer) IS 'This function deletes a expression type instance (cross reference).'; -- -- delete_type_instance(IN moduleid integer, IN typeinstanceid integer) -- CREATE OR REPLACE FUNCTION delete_type_instance(IN moduleid integer, IN typeinstanceid integer) RETURNS void AS $$ DELETE FROM bn_type_instances WHERE module_id = $1 AND id = $2; $$ LANGUAGE SQL; COMMENT ON FUNCTION delete_type_instance(IN moduleid integer, IN typeinstanceid integer) IS 'This function delete a type instance.'; -- -- load_expression_type_instances(IN moduleid integer) -- CREATE OR REPLACE FUNCTION load_expression_type_instances( IN moduleid integer) RETURNS TABLE( view_id integer, module_id integer, address bigint, "position" integer, expression_id integer, type_instance_id integer) LANGUAGE SQL AS $$ SELECT bv.id AS view_id, beti.module_id, beti.address, beti.position, beti.expression_id, beti.type_instance_id FROM bn_views AS bv JOIN bn_nodes AS bn ON bn.view_id = bv.id AND bn.type = 'code'::node_type LEFT JOIN bn_code_nodes AS bcn ON bcn.node_id = bn.id LEFT JOIN bn_codenode_instructions AS bcni ON bcni.module_id = bcn.module_id AND bcni.node_id = bcn.node_id LEFT JOIN bn_instructions AS bi ON bi.module_id = bcni.module_id AND bi.address = bcni.address JOIN bn_expression_type_instances AS beti ON beti.module_id = bi.module_id AND beti.address = bi.address WHERE bcn.module_id = $1 $$; COMMENT ON FUNCTION load_expression_type_instances( IN moduleid integer) IS 'The function retrieves all expression type instances for a given module.'; -- -- load_expression_type_instance(IN moduleid integer, IN typeinstanceid integer, IN address bigint, IN "position" integer, IN expressionid integer) -- CREATE OR REPLACE FUNCTION load_expression_type_instance( IN moduleid integer, IN typeinstanceid integer, IN address bigint, IN "position" integer, IN expressionid integer) RETURNS TABLE ( view_id integer, module_id integer, address bigint, "position" integer, expression_id integer, type_instance_id integer) LANGUAGE SQL AS $$ SELECT bv.id AS view_id, beti.module_id, beti.address, beti.position, beti.expression_id, beti.type_instance_id FROM bn_views AS bv JOIN bn_nodes AS bn ON bn.view_id = bv.id AND bn.type = 'code'::node_type LEFT JOIN bn_code_nodes AS bcn ON bcn.node_id = bn.id LEFT JOIN bn_codenode_instructions AS bcni ON bcni.module_id = bcn.module_id AND bcni.node_id = bcn.node_id LEFT JOIN bn_instructions AS bi ON bi.module_id = bcni.module_id AND bi.address = bcni.address JOIN bn_expression_type_instances AS beti ON beti.module_id = bi.module_id AND beti.address = bi.address WHERE bcn.module_id = $1 AND beti.type_instance_id = $2 AND beti.address = $3 AND beti.position = $4 AND beti.expression_id = $5 $$; COMMENT ON FUNCTION load_expression_type_instance( IN moduleid integer, IN typeinstanceid integer, IN address bigint, IN "position" integer, IN expressionid integer) IS 'Loads a single cross reference from the database.'; -- -- create_type_instance(moduleid integer, instancename text, commentid integer, typeid integer, sectionid integer, instanceaddress bigint) -- CREATE OR REPLACE FUNCTION create_type_instance( moduleid integer, instancename text, commentid integer, typeid integer, sectionid integer, instanceaddress bigint) RETURNS integer LANGUAGE SQL AS $$ INSERT INTO bn_type_instances (module_id, name, comment_id, type_id, section_id, section_offset) VALUES ($1, $2, $3, $4, $5, $6) RETURNING id; $$; COMMENT ON FUNCTION create_type_instance(integer, text, integer, integer, integer, bigint) IS 'This function creates a new type instance and returns the generated id of it.'; -- -- load_type_instances(IN moduleid integer) -- CREATE OR REPLACE FUNCTION load_type_instances( IN moduleid integer) RETURNS TABLE ( module_id integer, id integer, name text, comment_id integer, type_id integer, section_id integer, section_offset bigint) LANGUAGE SQL AS $$ SELECT * FROM bn_type_instances WHERE module_id = $1; $$; COMMENT ON FUNCTION load_type_instances( IN moduleid integer) IS 'This function retrives all type instaces for a given module id.'; -- -- load_type_instance(IN moduleid integer, IN typeinstanceid integer) -- CREATE OR REPLACE FUNCTION load_type_instance( IN moduleid integer, IN typeinstanceid integer) RETURNS TABLE ( module_id integer, id integer, name text, comment_id integer, type_id integer, section_id integer, section_offset bigint) LANGUAGE SQL AS $$ SELECT * FROM bn_type_instances WHERE module_id = $1 AND id = $2; $$; COMMENT ON FUNCTION load_type_instance( IN moduleid integer, IN typeinstanceid integer) IS 'This function loads a single type instaces.'; -- -- create_expression_type_instance(moduleid integer, operandaddress bigint, operandposition integer, expressionid integer, typeinstanceid integer) -- CREATE OR REPLACE FUNCTION create_expression_type_instance( moduleid integer, operandaddress bigint, operandposition integer, expressionid integer, typeinstanceid integer) RETURNS void AS $$ INSERT INTO bn_expression_type_instances (module_id, address, position, expression_id, type_instance_id) VALUES ($1, $2, $3, $4, $5); $$ LANGUAGE SQL; COMMENT ON FUNCTION create_expression_type_instance(integer, bigint, integer, integer, integer) IS 'This function creates a new expression type instance which connects a type instance in a section to an operand in the graph view.'; -- -- set_type_instance_name(moduleid integer, typeinstanceid integer, newname text) -- CREATE OR REPLACE FUNCTION set_type_instance_name(moduleid integer, typeinstanceid integer, newname text) RETURNS void AS $$ UPDATE bn_type_instances SET name = $3 WHERE module_id = $1 AND id = $2; $$ LANGUAGE SQL; COMMENT ON FUNCTION set_type_instance_name(integer, integer, text) IS 'This functions sets the name of a type instance.'; -- -- append_comment(IN parent_id integer, IN user_id integer, IN comment_text text) -- CREATE OR REPLACE FUNCTION append_comment(IN parent_id integer, IN user_id integer, IN comment_text text) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE comment_id integer; child integer; BEGIN -- -- Find out if the node in question has a child -- node. -- SELECT two.id INTO child FROM bn_comments AS one JOIN bn_comments AS two ON (one.id = two.parent_id) WHERE one.id = $1; -- -- If we find a child node we must exit as append -- only works on a node which has no child. -- IF FOUND THEN RAISE EXCEPTION 'can not append comment to node % as it has a child comment', $1; END IF; -- -- If we did not find a child node we perform the append -- operation and return the newly generated -- INSERT INTO bn_comments(id, parent_id, user_id, comment_text) VALUES (nextval('bn_comments_id_seq'::regclass), $1, $2, $3) RETURNING id INTO STRICT comment_id; RETURN comment_id; END; $$; COMMENT ON FUNCTION append_comment(IN parent_id integer, IN user_id integer, IN comment_text text) IS 'This function appends a comment to a comment owned by the user given as argument. It returns the generated id of the comment. This function is used by all other append comment functions.'; -- -- append_group_node_comment(IN nodeId integer, IN userId integer, IN comment text) -- CREATE OR REPLACE FUNCTION append_group_node_comment(IN nodeId integer, IN userId integer, IN comment text) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Check if the group node already has a comment -- associated with it. -- SELECT comment_id INTO parentid FROM bn_group_nodes WHERE node_id = nodeId; -- -- Create a comment using the append comment function. -- SELECT append_comment(parentid, userId, comment) INTO commentid; -- -- Update the group nodes with the newly generated comment. -- UPDATE bn_group_nodes SET comment_id = commentid WHERE node_id = nodeId; RETURN commentid; END; $$; COMMENT ON FUNCTION append_group_node_comment(IN nodeId integer, IN userId integer, IN comment text) IS 'This function appends a comment to a group node. It returns the generated id of the comment.'; -- -- append_text_node_comment(IN nodeId integer, IN userId integer, IN comment text) -- CREATE OR REPLACE FUNCTION append_text_node_comment(IN nodeId integer, IN userId integer, IN comment text) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Check if the text node already has a comment -- associated with it. -- SELECT comment_id INTO parentid FROM bn_text_nodes WHERE node_id = nodeId; -- -- Create a comment using the append comment function. -- SELECT append_comment(parentid, userId, comment) INTO commentid; -- -- Update the group nodes with the newly generated comment. -- UPDATE bn_text_nodes SET comment_id = commentid WHERE node_id = nodeId; RETURN commentid; END; $$; COMMENT ON FUNCTION append_text_node_comment(IN nodeId integer, IN userId integer, IN comment text) IS 'This function appends a comment to a text node. It returns the generated id of the comment.'; -- -- append_function_comment(IN moduleid integer, IN functionaddress bigint, IN user_id integer, IN comment_text text) -- CREATE OR REPLACE FUNCTION append_function_comment(IN moduleid integer, IN functionaddress bigint, IN user_id integer, IN comment_text text) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Check if the function already has a comment -- associated with it. -- SELECT comment_id INTO parentid FROM bn_functions WHERE module_id = moduleid AND address = functionaddress; -- -- Create a comment using the append comment function. -- SELECT append_comment(parentid, user_id, comment_text) INTO commentid; -- -- Update the function nodes table with the newly generated comment. -- UPDATE bn_functions SET comment_id = commentid WHERE module_id = moduleid AND address = functionaddress; RETURN commentid; END; $$; COMMENT ON FUNCTION append_function_comment(IN moduleid integer, IN functionaddress bigint, IN user_id integer, IN comment_text text) IS 'This function appends a comment to a function. It returns the generated id of the comment.'; -- -- append_function_node_comment(IN moduleid integer, IN nodeid integer, IN user_id integer, IN comment_text text) -- CREATE OR REPLACE FUNCTION append_function_node_comment(IN moduleid integer, IN nodeid integer, IN user_id integer, IN comment_text text) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Check if the function already has a comment -- associated with it. -- SELECT comment_id INTO parentid FROM bn_function_nodes WHERE node_id = nodeid AND module_id = moduleid; -- -- Create a comment using the append comment function. -- SELECT append_comment(parentid, user_id, comment_text) INTO commentid; -- -- Update the function nodes table with the newly generated comment. -- UPDATE bn_function_nodes SET comment_id = commentid WHERE node_id = nodeid AND module_id = moduleid; RETURN commentid; END; $$; COMMENT ON FUNCTION append_function_node_comment(IN moduleid integer, IN nodeid integer, IN user_id integer, IN comment_text text) IS 'This function appends a comment to a function node. It returns the generated id of the comment.'; -- -- append_global_code_node_comment(IN moduleid integer, IN node_id integer, IN node_address bigint, IN user_id integer, IN comment_text text) -- CREATE OR REPLACE FUNCTION append_global_code_node_comment(IN moduleid integer, IN node_id integer, IN node_address bigint, IN user_id integer, IN comment_text text) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Check if the code node already has a global comment -- associated with it. -- SELECT comment_id INTO parentid FROM bn_global_node_comments WHERE module_id = moduleid AND address = node_address; -- -- Create a comment using the append comment function. -- SELECT append_comment(parentid, user_id, comment_text) INTO commentid; -- -- We use the information from the parent id to decide -- if we need to update or if we need to insert. -- IF (parentid IS NOT NULL) THEN UPDATE bn_global_node_comments SET comment_id = commentid WHERE module_id = moduleid AND address = node_address AND comment_id = parentid; ELSE INSERT INTO bn_global_node_comments VALUES(moduleid, node_address, commentid); END IF; RETURN commentid; END; $$; COMMENT ON FUNCTION append_global_code_node_comment(IN moduleid integer, IN node_id integer, IN node_address bigint, IN user_id integer, IN comment_text text) IS 'This function appends a global code node comment. It returns the generated id of the comment.'; -- -- append_global_edge_comment(IN srcmoduleid integer, IN dstmoduleid integer, IN srcnodeaddress bigint, IN dstnodeaddress bigint, IN user_id integer, IN comment_text text) -- CREATE OR REPLACE FUNCTION append_global_edge_comment(IN srcmoduleid integer, IN dstmoduleid integer, IN srcnodeaddress bigint, IN dstnodeaddress bigint, IN user_id integer, IN comment_text text) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Check if the edge already has a global comment -- associated with it. -- SELECT comment_id INTO parentid FROM bn_global_edge_comments WHERE src_module_id = srcmoduleid AND dst_module_id = dstmoduleid AND src_address = srcnodeaddress AND dst_address = dstnodeaddress; -- -- Create a comment using the append comment function. -- SELECT append_comment(parentid, user_id, comment_text) INTO commentid; -- -- We use the information from the parent id to decide -- if we need to update or if we need to insert. -- IF (parentid IS NOT NULL) THEN UPDATE bn_global_edge_comments SET comment_id = commentid WHERE src_module_id = srcmoduleid AND dst_module_id = dstmoduleid AND src_address = srcnodeaddress AND dst_address = dstnodeaddress AND comment_id = parentid; ELSE INSERT INTO bn_global_edge_comments VALUES(srcmoduleid, dstmoduleid, srcnodeaddress, dstnodeaddress, commentid); END IF; RETURN commentid; END; $$; COMMENT ON FUNCTION append_global_edge_comment(IN srcmoduleid integer, IN dstmoduleid integer, IN srcnodeaddress bigint, IN dstnodeaddress bigint, IN user_id integer, IN comment_text text) IS 'This function appends a global edge comment. It returns the generated id of the comment.'; -- -- append_global_instruction_comment(IN moduleid integer, IN instruction_address bigint, IN user_id integer, IN comment_text text) -- CREATE OR REPLACE FUNCTION append_global_instruction_comment(IN moduleid integer, IN instruction_address bigint, IN user_id integer, IN comment_text text) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Check if the instruction already has a global comment -- associated with it. -- SELECT comment_id INTO parentid FROM bn_instructions WHERE module_id = moduleid AND address = instruction_address; -- -- Create a comment using the append comment function. -- SELECT append_comment(parentid, user_id, comment_text) INTO commentid; -- -- Update the record of the instruction to point to the -- new comment. -- UPDATE bn_instructions SET comment_id = commentid WHERE module_id = moduleid AND address = instruction_address; RETURN commentid; END; $$; COMMENT ON FUNCTION append_global_instruction_comment(IN moduleid integer, IN instruction_address bigint, IN user_id integer, IN comment_text text) IS 'This function appends a global instruction comment. It returns the generated id of the comment.'; -- -- append_local_code_node_comment(IN moduleid integer, IN nodeid integer, IN user_id integer, IN comment_text text) -- CREATE OR REPLACE FUNCTION append_local_code_node_comment(IN moduleid integer, IN nodeid integer, IN user_id integer, IN comment_text text) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Find out if our current code node already -- had a local comment and save its comment_id. -- SELECT comment_id INTO parentid FROM bn_code_nodes WHERE module_id = moduleid AND node_id = nodeid; -- -- Create a comment using the append comment function -- with the optional current_node_comment_id as the new paremt. -- SELECT append_comment(parentid, user_id, comment_text) INTO commentid; -- -- Update the code node with the newly generated comment. -- UPDATE bn_code_nodes SET comment_id = commentid WHERE module_id = moduleid AND node_id = nodeid; RETURN commentid; END; $$; COMMENT ON FUNCTION append_local_code_node_comment(IN moduleid integer, IN nodeid integer, IN user_id integer, IN comment_text text) IS 'This function appends a local comment to a code node. It returns the generated id of the comment.'; -- -- append_local_edge_comment(IN edge_id integer, IN user_id integer, IN comment_text text) -- CREATE OR REPLACE FUNCTION append_local_edge_comment(IN edge_id integer, IN user_id integer, IN comment_text text) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Find out if our current code node already -- had a local comment and save its comment_id. -- SELECT comment_id INTO parentid FROM bn_edges WHERE id = edge_id; -- -- Create a comment using the append comment function. -- SELECT append_comment(parentid, user_id, comment_text) INTO commentid; -- -- Update the edge with the newly generated comment. -- UPDATE bn_edges SET comment_id = commentid WHERE id = edge_id; RETURN commentid; END; $$; COMMENT ON FUNCTION append_local_edge_comment(IN edge_id integer, IN user_id integer, IN comment_text text) IS 'This function appends a local edge comment to an edge. It returns the generated id of the comment.'; -- -- append_local_instruction_comment(IN moduleid integer, IN nodeid integer, IN instruction_address bigint, IN user_id integer, IN comment_text text) -- CREATE OR REPLACE FUNCTION append_local_instruction_comment(IN moduleid integer, IN nodeid integer, IN instruction_address bigint, IN user_id integer, IN comment_text text) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Find out if our current code node already -- had a local comment and save its comment_id. -- SELECT comment_id INTO parentid FROM bn_codenode_instructions WHERE module_id = moduleid AND node_id = nodeid AND address = instruction_address; -- -- Create a comment using the append comment function. -- SELECT append_comment(parentid, user_id, comment_text) INTO commentid; -- -- Update the record of the instruction to point to the -- new comment. -- UPDATE bn_codenode_instructions SET comment_id = commentid WHERE module_id = moduleid AND node_id = nodeid AND address = instruction_address; RETURN commentid; END; $$; COMMENT ON FUNCTION append_local_instruction_comment(IN moduleid integer, IN nodeid integer, IN instruction_address bigint, IN user_id integer, IN comment_text text) IS 'This function appends a local instruction comment to an instruction in a code node. It returns the generated id of the comment.'; -- -- append_section_comment(moduleid integer, sectionid integer, user_id integer, comment_text text) -- CREATE OR REPLACE FUNCTION append_section_comment(moduleid integer, sectionid integer, user_id integer, comment_text text) RETURNS integer AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Check if the section already has a comment -- associated with it. -- SELECT comment_id INTO parentid FROM bn_sections WHERE module_id = moduleid AND id = sectionid; -- -- Create a comment using the append comment function. -- SELECT append_comment(parentid, user_id, comment_text) INTO commentid; -- -- Update the sections table with the newly generated comment. -- UPDATE bn_sections SET comment_id = commentid WHERE module_id = moduleid AND id = sectionid; RETURN commentid; END; $$ LANGUAGE plpgsql; COMMENT ON FUNCTION append_section_comment(integer, integer, integer, text) IS 'This function appends a comment to a section. It returns the generated id of the comment.'; -- -- append_type_instance_comment(moduleid integer, typeinstanceid integer, user_id integer, comment_text text) -- CREATE OR REPLACE FUNCTION append_type_instance_comment(moduleid integer, typeinstanceid integer, user_id integer, comment_text text) RETURNS integer AS $$ DECLARE commentid integer; parentid integer; BEGIN -- -- Check if the type instance already has a comment -- associated with it. -- SELECT comment_id INTO parentid FROM bn_type_instances WHERE module_id = moduleid AND id = typeinstanceid; -- -- Create a comment using the append comment function. -- SELECT append_comment(parentid, user_id, comment_text) INTO commentid; -- -- Update the type instances table with the newly generated comment. -- UPDATE bn_type_instances SET comment_id = commentid WHERE module_id = moduleid AND id = typeinstanceid; RETURN commentid; END; $$ LANGUAGE plpgsql; COMMENT ON FUNCTION append_type_instance_comment(integer, integer, integer, text) IS 'This function appends a comment to a type instance. It returns the generated id of the comment.'; -- -- delete_group_node_comment(IN nodeId integer, IN commentid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION delete_group_node_comment(IN nodeId integer, IN commentid integer, IN userid integer) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the group nodes table with the newly generated comment. -- UPDATE bn_group_nodes SET comment_id = parentid WHERE node_id = nodeId AND comment_id = commentid; RETURN commentid; END; $$; COMMENT ON FUNCTION delete_group_node_comment(IN nodeId integer, IN commentid integer, IN userid integer) IS 'This function deletes a comment from a group node. It returns the id of the deleted comment.'; -- -- delete_text_node_comment(IN nodeId integer, IN commentid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION delete_text_node_comment(IN nodeId integer, IN commentid integer, IN userid integer) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the text nodes table with the newly generated comment. -- UPDATE bn_text_nodes SET comment_id = parentid WHERE node_id = nodeId AND comment_id = commentid; RETURN commentid; END; $$; COMMENT ON FUNCTION delete_text_node_comment(IN nodeId integer, IN commentid integer, IN userid integer) IS 'This function deletes a comment from a text node. It returns the id of the deleted comment.'; -- -- delete_comment_by_id(IN commentid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION delete_comment_by_id(IN commentid integer, IN userid integer) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE parentid integer; BEGIN WITH parent_comment AS ( SELECT one.id AS id, one.parent_id AS parent FROM bn_comments AS one JOIN bn_comments AS two ON one.parent_id = two.id WHERE one.id = commentid ), child_comment AS ( SELECT one.id AS id, two.id AS child FROM bn_comments AS one JOIN bn_comments AS two ON one.id = two.parent_id WHERE one.id = commentid ), update AS (UPDATE bn_comments SET parent_id = ( SELECT parent FROM parent_comment LEFT JOIN child_comment ON child_comment.id = parent_comment.id ) WHERE id = ( SELECT child FROM parent_comment LEFT JOIN child_comment ON child_comment.id = parent_comment.id ) AND user_id = userid ) DELETE FROM bn_comments WHERE bn_comments.id = commentid AND bn_comments.user_id = userid RETURNING bn_comments.parent_id INTO STRICT parentid; RETURN parentid; EXCEPTION WHEN NO_DATA_FOUND THEN RAISE EXCEPTION 'the comment with id % does not exist or is not owned by the user with id %', commentId, userId; END; $$; COMMENT ON FUNCTION delete_comment_by_id(IN commentid integer, IN userid integer) IS 'This function deletes a comment by id. It is used by all other comment delete functions as core functionality. It does verify if the user id given as argument is the actual owner of the comment which is requested to be deleted and will fail otherwise.'; -- -- delete_function_comment(IN moduleid integer, IN functionaddress bigint, IN commentid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION delete_function_comment(IN moduleid integer, IN functionaddress bigint, IN commentid integer, IN userid integer) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the function nodes table with the newly generated comment. -- UPDATE bn_functions SET comment_id = parentid WHERE module_id = moduleid AND address = functionaddress AND comment_id = commentId; RETURN commentId; END; $$; COMMENT ON FUNCTION delete_function_comment(IN moduleid integer, IN functionaddress bigint, IN commentid integer, IN userid integer) IS 'This function deletes a comment associated to a function. It does return the id of the deleted comment.'; -- -- delete_function_node_comment(IN moduleid integer, IN nodeid integer, IN commentid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION delete_function_node_comment(IN moduleid integer, IN nodeid integer, IN commentid integer, IN userid integer) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the function nodes table with the newly generated comment. -- UPDATE bn_function_nodes SET comment_id = parentid WHERE node_id = nodeid AND module_id = moduleid AND comment_id = commentId; RETURN commentId; END; $$; COMMENT ON FUNCTION delete_function_node_comment(IN moduleid integer, IN nodeid integer, IN commentid integer, IN userid integer) IS 'This function deletes a comment associated to a function node. It returns the id of the deleted comment.'; -- -- delete_global_code_node_comment(IN moduleid integer, IN node_id integer, IN node_address bigint, IN commentid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION delete_global_code_node_comment(IN moduleid integer, IN node_id integer, IN node_address bigint, IN commentid integer, IN userid integer) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the global comments according to the changes. -- IF parentid IS NULL THEN DELETE FROM bn_global_node_comments WHERE module_id = moduleid AND address = node_address AND comment_id = commentId; ELSE UPDATE bn_global_node_comments SET comment_id = parentid WHERE module_id = moduleId AND address = node_address AND comment_id = commentId; END IF; RETURN commentId; END; $$; COMMENT ON FUNCTION delete_global_code_node_comment(IN moduleid integer, IN node_id integer, IN node_address bigint, IN commentid integer, IN userid integer) IS 'This function deletes a global comment assocatiated with a code node. It returns the id of the deleted comment.'; -- -- delete_global_edge_comment(IN srcmoduleid integer, IN dstmoduleid integer, IN srcnodeaddress bigint, IN dstnodeaddress bigint, IN commentid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION delete_global_edge_comment(IN srcmoduleid integer, IN dstmoduleid integer, IN srcnodeaddress bigint, IN dstnodeaddress bigint, IN commentid integer, IN userid integer) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the global comments according to the changes. -- IF parentid IS NULL THEN DELETE FROM bn_global_edge_comments WHERE src_module_id = srcmoduleid AND dst_module_id = dstmoduleid AND src_address = srcnodeaddress AND dst_address = dstnodeaddress AND comment_id = commentId; ELSE UPDATE bn_global_edge_comments SET comment_id = parentid WHERE dst_module_id = dstmoduleid AND src_address = srcnodeaddress AND dst_address = dstnodeaddress AND comment_id = commentId; END IF; RETURN commentId; END; $$; COMMENT ON FUNCTION delete_global_edge_comment(IN srcmoduleid integer, IN dstmoduleid integer, IN srcnodeaddress bigint, IN dstnodeaddress bigint, IN commentid integer, IN userid integer) IS 'This function deletes a global comment associated with an edge. It does return the id of the deleted comment.'; -- -- delete_global_instruction_comment(IN moduleid integer, IN instruction_address bigint, IN commentid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION delete_global_instruction_comment(IN moduleid integer, IN instruction_address bigint, IN commentid integer, IN userid integer) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the record of the instruction to point to the -- new comment. -- UPDATE bn_instructions SET comment_id = parentid WHERE module_id = moduleid AND address = instruction_address AND comment_id = commentId; RETURN commentId; END; $$; COMMENT ON FUNCTION delete_global_instruction_comment(IN moduleid integer, IN instruction_address bigint, IN commentid integer, IN userid integer) IS 'This function deletes a global comment associated with an instruction. It returns the id of the deleted comment.'; -- -- delete_local_code_node_comment(IN moduleid integer, IN nodeid integer, IN commentid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION delete_local_code_node_comment(IN moduleid integer, IN nodeid integer, IN commentid integer, IN userid integer) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the code node with the newly generated comment. -- UPDATE bn_code_nodes SET comment_id = parentid WHERE module_id = moduleid AND node_id = nodeid AND comment_id = commentId; RETURN commentId; END; $$; COMMENT ON FUNCTION delete_local_code_node_comment(IN moduleid integer, IN nodeid integer, IN commentid integer, IN userid integer) IS 'This funciton deletes a local comment associated with a code node. It returns the id of the deleted comment.'; -- -- delete_local_edge_comment(IN edge_id integer, IN commentid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION delete_local_edge_comment(IN edge_id integer, IN commentid integer, IN userid integer) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the edge with the newly generated comment. -- UPDATE bn_edges SET comment_id = parentid WHERE id = edge_id AND comment_id = commentId; RETURN commentId; END; $$; COMMENT ON FUNCTION delete_local_edge_comment(IN edge_id integer, IN commentid integer, IN userid integer) IS 'This function deletes a local comment associated with an edge. It returns the id of the deleted comment.'; -- -- delete_local_instruction_comment(IN moduleid integer, IN nodeid integer, IN instruction_address bigint, IN commentid integer, IN userid integer) -- CREATE OR REPLACE FUNCTION delete_local_instruction_comment(IN moduleid integer, IN nodeid integer, IN instruction_address bigint, IN commentid integer, IN userid integer) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the record of the instruction to point to the -- new comment. -- UPDATE bn_codenode_instructions SET comment_id = parentid WHERE module_id = moduleid AND node_id = nodeid AND address = instruction_address AND comment_id = commentId; RETURN commentId; END; $$; COMMENT ON FUNCTION delete_local_instruction_comment(IN moduleid integer, IN nodeid integer, IN instruction_address bigint, IN commentid integer, IN userid integer) IS 'This function deletes a local comment associated with an instruction in a code node. It returns the id of the deleted comment.'; -- -- delete_section_comment(moduleid integer, sectionid integer, commentid integer, userid integer) -- CREATE OR REPLACE FUNCTION delete_section_comment(moduleid integer, sectionid integer, commentid integer, userid integer) RETURNS integer AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the function nodes table with the newly generated comment. -- UPDATE bn_sections SET comment_id = parentid WHERE module_id = moduleid AND id = sectionid AND comment_id = commentId; RETURN commentId; END; $$ LANGUAGE plpgsql; COMMENT ON FUNCTION delete_section_comment(integer, integer, integer, integer) IS 'This function deletes a comment associated to a section. It does return the id of the deleted comment.'; -- -- delete_type_instance_comment(moduleid integer, typeinstanceid integer, commentid integer, userid integer) -- CREATE OR REPLACE FUNCTION delete_type_instance_comment(moduleid integer, typeinstanceid integer, commentid integer, userid integer) RETURNS integer AS $$ DECLARE parentid integer; BEGIN -- -- Delete the comment according to the specified user and -- comment ids. -- SELECT delete_comment_by_id(commentId, userId) INTO parentid; -- -- Update the function nodes table with the newly generated comment. -- UPDATE bn_type_instances SET comment_id = parentid WHERE module_id = moduleid AND id = typeinstanceid AND comment_id = commentId; RETURN commentId; END; $$ LANGUAGE plpgsql; COMMENT ON FUNCTION delete_type_instance_comment(integer, integer, integer, integer) IS 'This function deletes a comment associated to a type instance. It does return the id of the deleted comment.'; -- -- edit_comment(IN comment_id integer, IN userid integer, IN commenttext text) -- CREATE OR REPLACE FUNCTION edit_comment(IN comment_id integer, IN userid integer, IN commenttext text) RETURNS void LANGUAGE plpgsql AS $$ DECLARE result integer; BEGIN -- -- Find out if there is a comment record which is owned -- by the user id given as argument. -- SELECT c.id INTO STRICT result FROM bn_comments AS c WHERE c.id = comment_id AND c.user_id = userid; -- -- If the record exists proceed with the update. -- IF FOUND THEN UPDATE bn_comments SET comment_text = commenttext WHERE id = comment_id AND user_id = userid; END IF; -- -- If either the comment is not owned by the supplied user id -- or if there are actually more comments which come up for the same -- key we bail out and inform the caller. -- EXCEPTION WHEN NO_DATA_FOUND THEN RAISE EXCEPTION 'Error: there is no comment record in the database which satisfies id = % user = %.', comment_id, userid; WHEN TOO_MANY_ROWS THEN RAISE EXCEPTION 'Error: there is more then one comment which satisfies id = % user = %.', comment_id, userid; END; $$; COMMENT ON FUNCTION edit_comment(IN comment_id integer, IN userid integer, IN commenttext text) IS 'This function edits a comment based on the id and the comment text provided. It checks if the user given is the owner of the comment and will fail if this is not the case. This function is used for all edit functions.'; -- -- get_all_comment_ancestors(IN comment_id integer) -- CREATE OR REPLACE FUNCTION get_all_comment_ancestors(IN comment_id integer) RETURNS TABLE(level integer, id integer, parent_id integer, user_id integer, comment text) LANGUAGE sql AS $$ WITH RECURSIVE q AS ( SELECT h.*, 1 AS level FROM bn_comments h WHERE id = $1 UNION ALL SELECT hp.*, level + 1 FROM q JOIN bn_comments hp ON hp.id = q.parent_id ) SELECT level, id, parent_id, user_id, comment_text FROM q ORDER BY level DESC $$; COMMENT ON FUNCTION get_all_comment_ancestors(IN comment_id integer) IS 'This function gets all ancestors of a comment for the provided comment id.'; -- -- get_all_comment_ancestors_multiple(IN commentids integer[]) -- CREATE OR REPLACE FUNCTION get_all_comment_ancestors_multiple(IN commentids integer[]) RETURNS TABLE(commentid integer, level integer, id integer, parent_id integer, user_id integer, comment text) LANGUAGE plpgsql AS $$ DECLARE commentId integer; BEGIN FOREACH commentId IN ARRAY $1 LOOP RETURN QUERY( SELECT commentId, * FROM get_all_comment_ancestors(commentId) ); END LOOP; END; $$; COMMENT ON FUNCTION get_all_comment_ancestors_multiple(IN commentids integer[]) IS 'This function gets all ancestors of all comment ids provided as argument. It can be used as to batch load comments and reduce the number of querries needed to do so.'; -- -- load_view_edges(IN viewid integer) -- CREATE OR REPLACE FUNCTION load_view_edges(IN viewid integer) RETURNS TABLE(id integer, source_node_id integer, target_node_id integer, comment_id integer, x1 double precision, y1 double precision, x2 double precision, y2 double precision, type edge_type, color integer, visible boolean, selected boolean, x double precision, y double precision) LANGUAGE sql AS $$ SELECT edges.id, source_node_id, target_node_id, comment_id, x1, y1, x2, y2, edges.type, edges.color, edges.visible, edges.selected, ep.x, ep.y FROM bn_edges AS edges JOIN bn_nodes AS bt ON edges.target_node_id = bt.id JOIN bn_nodes AS bs ON edges.source_node_id = bs.id LEFT JOIN bn_edge_paths AS ep ON ep.edge_id = edges.id WHERE bt.view_id = $1 AND bs.view_id = $1; $$; COMMENT ON FUNCTION load_view_edges(IN viewid integer) IS 'This function loads the edges of a view.'; -- -- create_type_substitution(IN moduleid integer, IN address bigint, IN position integer, IN expressionid integer, IN basetypeid integer, IN path integer[], IN offset integer) -- CREATE OR REPLACE FUNCTION create_type_substitution( IN moduleid integer, IN address bigint, IN "position" integer, IN expressionid integer, IN basetypeid integer, IN path integer[], IN "offset" integer) RETURNS void LANGUAGE sql AS $$ INSERT INTO bn_expression_types (module_id, address, position, expression_id, base_type_id, path, offset) VALUES($1, $2, $3, $4, $5, $6, $7); $$; COMMENT ON FUNCTION create_type_substitution( IN moduleid integer, IN address bigint, IN "position" integer, IN expressionid integer, IN basetypeid integer, IN path integer[], IN "offset" integer) IS 'This function creates a single type substitution'; -- -- delete_type_substitution(IN moduleid integer, IN address bigint, IN position integer, IN expressionid) -- CREATE OR REPLACE FUNCTION delete_type_substitution( IN moduleid integer, IN address bigint, IN "position" integer, IN expressionid integer) RETURNS void LANGUAGE sql AS $$ DELETE FROM bn_expression_types AS et WHERE et.module_id = $1 AND et.address = $2 AND et.position = $3 AND et.expression_id = $4; $$; COMMENT ON FUNCTION delete_type_substitution( IN moduleid integer, IN address bigint, IN "position" integer, IN expressionid integer) IS 'This function deletes a single type substitution'; -- -- load_types(IN moduleid integer) -- CREATE OR REPLACE FUNCTION load_types( IN moduleid integer) RETURNS TABLE( id integer, name text, size integer, pointer integer, signed boolean, category type_category) LANGUAGE SQL AS $$ SELECT id, name, size, pointer, signed, category FROM bn_base_types WHERE module_id = $1; $$; COMMENT ON FUNCTION load_types( IN moduleid integer) IS 'Loads all base types for a given module id.'; -- -- load_type(IN moduleid integer, IN typeid integer) -- CREATE OR REPLACE FUNCTION load_type( IN moduleid integer, IN typeid integer) RETURNS TABLE( id integer, name text, size integer, pointer integer, signed boolean, category type_category) LANGUAGE SQL AS $$ SELECT id, name, size, pointer, signed, category FROM bn_base_types WHERE module_id = $1 AND id = $2; $$; COMMENT ON FUNCTION load_type( IN moduleid integer, IN typeid integer) IS 'Loads a single base type.'; -- -- load_type_member(IN moduleid integer, IN typeid integer) -- CREATE OR REPLACE FUNCTION load_type_member( IN moduleid integer, IN typeid integer) RETURNS TABLE ( id integer, name text, base_type integer, parent_id integer, "offset" integer, argument integer, number_of_elements integer) LANGUAGE SQL AS $$ SELECT id, name, base_type, parent_id, "offset", argument, number_of_elements FROM bn_types WHERE module_id = $1 AND id = $2; $$; COMMENT ON FUNCTION load_type_member( IN moduleid integer, IN typeid integer) IS 'Loads a single type member from the database.'; -- -- load_type_members(IN moduleid integer) -- CREATE OR REPLACE FUNCTION load_type_members( IN moduleid integer) RETURNS TABLE ( id integer, name text, base_type integer, parent_id integer, "offset" integer, argument integer, number_of_elements integer) LANGUAGE SQL AS $$ SELECT id, name, base_type, parent_id, "offset", argument, number_of_elements FROM bn_types WHERE module_id = $1; $$; COMMENT ON FUNCTION load_type_members( IN moduleid integer) IS 'Loads all type members for the given module.'; -- -- load_type_substitutions(IN moduleid integer) -- CREATE OR REPLACE FUNCTION load_type_substitutions( IN moduleid integer) RETURNS TABLE ( address bigint, "position" integer, expression_id integer, base_type_id integer, path integer[], "offset" integer) LANGUAGE SQL AS $$ SELECT address, "position", expression_id, base_type_id, path, "offset" FROM bn_expression_types WHERE module_id = $1; $$; COMMENT ON FUNCTION load_type_substitutions( IN moduleid integer) IS 'Loads all type susbtitutions for a single module from the database.'; -- -- load_type_substitution(IN moduleid integer, IN address bigint, IN "position" integer, IN expression_id integer) -- CREATE OR REPLACE FUNCTION load_type_substitution( IN moduleid integer, IN address bigint, IN "position" integer, IN expression_id integer) RETURNS TABLE ( address bigint, "position" integer, expression_id integer, base_type_id integer, path integer[], "offset" integer) LANGUAGE SQL AS $$ SELECT address, "position", expression_id, base_type_id, path, "offset" FROM bn_expression_types WHERE module_id = $1 AND address = $2 AND "position" = $3 AND expression_id = $4; $$; COMMENT ON FUNCTION load_type_substitution( IN moduleid integer, IN address bigint, IN "position" integer, IN expression_id integer) IS 'Loads a aingle type susbtitutions.'; -- -- delete_type -- CREATE OR REPLACE FUNCTION delete_type( IN module_id integer, IN type_id integer) RETURNS void LANGUAGE SQL AS $$ DELETE FROM bn_types AS t WHERE t.module_id = $1 AND t.id = $2; $$; COMMENT ON FUNCTION delete_type(IN moduleid integer, IN typeid integer) IS 'This function deletes a single type from bn_types also known as a member type if leaves a hole in the compound type at the member offset as large as the members size.'; -- -- update_member_offsets(IN module_id integer, IN moved_members integer[], IN delta integer, IN implicitly_moved_members integer[], IN implicit_delta integer) -- CREATE OR REPLACE FUNCTION update_member_offsets(IN module_id integer, IN updated_members integer[], IN delta integer, IN implicitly_updated_members integer[], IN implicit_delta integer) RETURNS void LANGUAGE sql AS $$ WITH moved AS ( UPDATE bn_types SET "offset" = "offset" + $3 WHERE module_id = $1 AND id = any($2) ) UPDATE bn_types SET "offset" = "offset" + $5 WHERE module_id = $1 AND id = any($4); $$; COMMENT ON FUNCTION update_member_offsets(IN module_id integer, IN updated_members integer[], IN delta integer, IN implicitly_updated_members integer[], IN implicit_delta integer) IS 'This function adjusts the offsets of the updated_members by delta and the offsets of implicitly_updated_members by implicit_dela, respectively.'; -- -- locate_type -- CREATE OR REPLACE FUNCTION locate_type(IN moduleid integer, IN parentid integer, IN currentoffset integer) RETURNS integer LANGUAGE plpgsql AS $$ SELECT bt.id FROM bn_types AS bt JOIN bn_base_types AS bbt ON bt.base_type = bbt.id AND bt.module_id = bbt.module_id WHERE bt.module_id = moduleid AND bt.parent_id = parentid AND bt.offset <= currentoffset AND bt.offset + bbt.size >= currentoffset $$; COMMENT ON FUNCTION locate_type(IN moduleid integer, IN parentid integer, IN currentoffset integer) IS 'Locates the bn_type id of a type at a given offset.'; -- -- move_type -- CREATE OR REPLACE FUNCTION move_type(IN moduleid integer, IN old_parent_id integer, IN new_parent_id integer, IN type_id integer, IN newoffset integer) RETURNS void LANGUAGE plpgsql AS $$ DECLARE oldoffset integer; BEGIN -- -- Determine if the parent ids are the same -- IF old_parent_id = new_parent_id THEN -- -- same struct move -- SELECT offset FROM bn_types WHERE module_id = moduleid AND id = type_id INTO oldoffset; IF newoffset > oldoffset THEN -- -- we have moved the member up. -- ELSE -- -- we have moved the member down. -- END IF; ELSE -- -- different struct move -- END IF; END; $$; -- -- delete_type_member_compact_struct -- CREATE OR REPLACE FUNCTION delete_type_compact(IN module_id integer, IN type_id integer) --RETURNS bn_types LANGUAGE plpgsql AS RETURNS integer LANGUAGE plpgsql AS $$ DECLARE deleted bn_types; deletedsize integer; BEGIN -- -- Delete the type first. -- SELECT delete_type(module_id, type_id) INTO deleted; -- -- Find the size of the type. -- SELECT size FROM bn_base_types bt WHERE bt.module_id = module_id AND bt.id = deleted.base_type INTO deletedsize; -- -- Then update the offsets. -- PERFORM update_type_offsets(module_id, deleted.parent_id, deletedsize, deleted.offset); END; $$; COMMENT ON FUNCTION delete_type_compact(IN module_id integer, IN type_id integer) IS 'This function deletes a single type from bn_types and compacts the other elements in the compound type to leave no hole where the element has been.';
the_stack
drop schema if exists distribute_count_distinct_part4 cascade; create schema distribute_count_distinct_part4; set current_schema = distribute_count_distinct_part4; -- multi count distinct with AP function create table t (a int not null, b int, c int); insert into t values (1,1,1); select a, count(distinct b), max(distinct c) from t group by cube(a) order by 1,2,3; drop table t; create table llvm_call_center (cc_call_center_sk integer not null) /*distribute by replication*/; create table llvm_web_site (web_site_sk integer not null,web_site_id char(17) not null,web_rec_end_date date) /*distribute by hash(web_site_sk)*/; create table date_dim_less (d_date_sk varchar(19) not null,d_year bigint,d_current_month integer(39,38) default null,d_current_quarter numeric(29,10)) /*distribute by hash (d_current_month,d_year)*/; create table llvm_customer (c_customer_id char(17) not null,c_birth_day smallint,c_birth_month integer) /*distribute by hash(c_birth_day,c_birth_month)*/; --inner join explain (costs off) SELECT dt.web_site_sk * d_current_quarter , min(web_rec_end_date) , avg(DISTINCT dt.web_site_sk * d_current_quarter) FROM llvm_call_center AS cc CROSS JOIN ( SELECT web_site_sk , min(web_rec_end_date + 5) web_rec_end_date FROM llvm_web_site WHERE web_site_id IN ( SELECT c_customer_id FROM llvm_customer GROUP BY 1 , substr(c_customer_id, - 1) ) GROUP BY web_site_sk , substr(web_site_id, - 2) ) dt INNER JOIN date_dim_less ON substr(d_date_sk, - 1) = web_site_sk WHERE d_current_quarter <> 0.0 GROUP BY 1 , web_site_sk HAVING dt.web_site_sk > 1 AND dt.web_site_sk * d_current_quarter IS NOT NULL AND min(DISTINCT web_rec_end_date) IS NOT NULL ORDER BY 1 , 2 , 3; --full join explain (costs off) SELECT dt.web_site_sk * d_current_quarter , min(web_rec_end_date) , avg(DISTINCT dt.web_site_sk * d_current_quarter) FROM llvm_call_center AS cc CROSS JOIN ( SELECT web_site_sk , min(web_rec_end_date + 5) web_rec_end_date FROM llvm_web_site WHERE web_site_id IN ( SELECT c_customer_id FROM llvm_customer GROUP BY 1 , substr(c_customer_id, - 1) ) GROUP BY web_site_sk , substr(web_site_id, - 2) ) dt FULL JOIN date_dim_less ON substr(d_date_sk, - 1) = web_site_sk WHERE d_current_quarter <> 0.0 GROUP BY 1 , web_site_sk HAVING dt.web_site_sk > 1 AND dt.web_site_sk * d_current_quarter IS NOT NULL AND min(DISTINCT web_rec_end_date) IS NOT NULL ORDER BY 1 , 2 , 3; --inner join explain (costs off) select dt.web_site_sk * d_current_quarter, avg(distinct dt.web_site_sk) from (select web_site_sk, web_rec_end_date from llvm_web_site) dt inner join date_dim_less on substr(d_date_sk, -1) = web_site_sk group by 1, web_site_sk having dt.web_site_sk > 1 and min(distinct web_rec_end_date) is not null order by 1, 2; --left join explain (costs off) select dt.web_site_sk * d_current_quarter, avg(distinct dt.web_site_sk) from (select web_site_sk, web_rec_end_date from llvm_web_site) dt left join date_dim_less on substr(d_date_sk, -1) = web_site_sk group by 1, web_site_sk having dt.web_site_sk > 1 and min(distinct web_rec_end_date) is not null order by 1, 2; --right join explain (costs off) select dt.web_site_sk * d_current_quarter, avg(distinct dt.web_site_sk) from (select web_site_sk, web_rec_end_date from llvm_web_site) dt right join date_dim_less on substr(d_date_sk, -1) = web_site_sk group by 1, web_site_sk having dt.web_site_sk > 1 and min(distinct web_rec_end_date) is not null order by 1, 2; explain (costs off) select dt.web_site_sk * d_current_quarter, avg(distinct dt.web_site_sk) from (select web_site_sk, web_rec_end_date from llvm_web_site) dt right join date_dim_less on substr(d_date_sk, -1) = web_site_sk group by 1, web_site_sk+1 having coalesce(dt.web_site_sk+1,2)>1 and min(distinct web_rec_end_date) is not null order by 1, 2; explain (costs off) select dt.web_site_sk * d_current_quarter, avg(distinct dt.web_site_sk) from (select web_site_sk, web_rec_end_date from llvm_web_site) dt right join date_dim_less on substr(d_date_sk, -1) = web_site_sk group by 1, web_site_sk+web_site_sk having coalesce(dt.web_site_sk+web_site_sk,2)>1 and min(distinct web_rec_end_date) is not null order by 1, 2; set explain_perf_mode=pretty; CREATE TABLE m_inte_counter_detail ( rpt_dt character varying(36), rpt_time character varying(32), org_id character varying(128), sec_bank character varying(128), thd_bank character varying(128), resp_code character varying(800), term_code character varying(128), seqno character varying(256), trace_no character varying(48), yw_account character varying(128), counter_code character varying(256), menu_code character varying(128), retriveref_no character varying(56), txn_amount numeric, fee_income numeric, fund_type character varying(40), card_type character varying(40), settdate character varying(36), ywbh character varying(40), ywlx character varying(40), is_type character varying(4), sb_type character varying(20), on_flag character varying(4), sys_flag character varying(4) ) WITH (orientation=column) /*DISTRIBUTE BY HASH (rpt_dt, org_id)*/; CREATE TABLE m_pub_org_stat_stt ( net_bank character varying(10) NOT NULL, sec_bank character varying(10) NOT NULL, thd_bank character varying(10) NOT NULL, main_bank character varying(10) NOT NULL, net_bank_name character varying(50), sec_bank_name character varying(50), thd_bank_name character varying(50), main_bank_name character varying(50), org_flag character varying(1), district_flag character varying(10), ods_data_dt character varying(10), township_flag character varying(10) ) WITH (orientation=column) /*DISTRIBUTE BY HASH (net_bank)*/; -- original test explain (verbose, costs off) select '20180831' rpt_Dt, org_id org_id, count(case when a.rpt_dt = '20180831' and a.ywbh in ('223', '478', '819', '886') then 1 end) kk, count(distinct case when a.is_type in ('TTS', 'GXH') then a.term_code end) tts, count(distinct case when a.rpt_dt = '20180831' and a.is_type in ('TTS', 'GXH') then a.term_code end) tts2, count(distinct case when a.is_type = 'BXS' then a.term_code end) bxs from m_inte_counter_detail a left join m_pub_org_stat_stt b on a.org_id = b.net_bank group by a.org_id; -- targetlist & grouplist with different varno explain (verbose, costs off) select '20180831' rpt_Dt, a.org_id, count(case when a.rpt_dt = '20180831' and a.ywbh in ('223', '478', '819', '886') then 1 end) kk, count(distinct case when a.is_type in ('TTS', 'GXH') then a.term_code end) tts, sum(distinct case when a.rpt_dt = '20180831' and a.is_type in ('TTS', 'GXH') then a.term_code end) tts2, sum(distinct case when a.is_type = 'BXS' then a.term_code end) bxs from m_inte_counter_detail a left join m_pub_org_stat_stt b on a.org_id = b.net_bank group by org_id; -- explore count-distinct in having clause explain (verbose, costs off) select '20180831' rpt_Dt, a.org_id, count(case when a.rpt_dt = '20180831' and a.ywbh in ('223', '478', '819', '886') then 1 end) kk, sum(distinct case when a.is_type = 'BXS' then a.term_code end) bxs from m_inte_counter_detail a left join m_pub_org_stat_stt b on a.org_id = b.net_bank group by org_id having count(distinct a.is_type) > 100; -- explore count-distinct in having clause with expressions explain (verbose, costs off) select '20180831' rpt_Dt, org_id, count(case when a.rpt_dt = '20180831' and a.ywbh in ('223', '478', '819', '886') then 1 end) kk, sum(distinct case when a.is_type = 'BXS' then a.term_code end) bxs from m_inte_counter_detail a left join m_pub_org_stat_stt b on a.org_id = b.net_bank group by a.org_id having sum(distinct a.is_type) + avg(distinct org_id)> 100; -- explore count-distinct in order by clause explain (verbose, costs off) select '20180831' rpt_Dt, org_id, count(case when a.rpt_dt = '20180831' and a.ywbh in ('223', '478', '819', '886') then 1 end) kk, count(distinct case when a.is_type = 'BXS' then a.term_code end) bxs from m_inte_counter_detail a left join m_pub_org_stat_stt b on a.org_id = b.net_bank group by a.org_id having sum(distinct a.is_type) + avg(distinct org_id)> 100 order by 2; -- explore count-distinct in having clause of order by clause explain (verbose, costs off) select '20180831' rpt_Dt, org_id, count(case when a.rpt_dt = '20180831' and a.ywbh in ('223', '478', '819', '886') then 1 end) kk, count(distinct case when is_type = 'BXS' then a.term_code end) bxs from m_inte_counter_detail a left join m_pub_org_stat_stt b on a.org_id = b.net_bank group by a.org_id having sum(distinct a.is_type) + avg(distinct (a.org_id + org_id))> 100 order by 2; -- explore count-distinct in AP function and window function explain (verbose, costs off) select '20180831' rpt_Dt, org_id, count(case when a.rpt_dt = '20180831' and a.ywbh in ('223', '478', '819', '886') then 1 end) kk, count(distinct case when is_type = 'BXS' then a.term_code end) bxs, grouping(org_id), rank() over (partition by org_id, a.org_id order by org_id, a.org_id) from m_inte_counter_detail a left join m_pub_org_stat_stt b on a.org_id = b.net_bank group by cube(a.org_id) having sum(distinct a.is_type) + avg(distinct (a.org_id + org_id))> 100 order by 2; reset explain_perf_mode; reset current_schema; drop schema if exists distribute_count_distinct_part4 cascade;
the_stack
-- Archive events. UPDATE events SET tags = array_append(tags, 'archived') WHERE (NOT tags && ARRAY ['archived,asdf']); -- Escalate events. --update events set tags = array_prepend('escalated', tags) where (not tags @> array['escalated']); UPDATE events SET tags = array_append(tags, 'escalated') WHERE (NOT tags && ARRAY ['escalated']); -- Unstar events. --update events set tags = array_remove(tags, 'escalated') where tags @> array['escalated']; UPDATE events SET tags = array_remove(tags, 'escalated') WHERE (tags && ARRAY ['escalated']); SELECT DISTINCT ON (maxts, sigid, grouped.src_ip, grouped.dest_ip) grouped.count, grouped.escalated_count, events_source.uuid, grouped.maxts, grouped.mints, events_source.source, events.tags FROM (SELECT count(events_source.source -> 'alert' ->> 'signature_id') AS count, count(CASE WHEN tags && ARRAY ['escalated'] THEN 1 END) AS escalated_count, max(events_source.timestamp) AS maxts, min(events_source.timestamp) AS mints, (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT AS sigid, (events_source.source ->> 'src_ip') :: INET AS src_ip, (events_source.source ->> 'dest_ip') :: INET AS dest_ip FROM events_source, events WHERE events_source.source ->> 'event_type' = 'alert' AND events.uuid = events_source.uuid GROUP BY (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT, (events_source.source ->> 'src_ip') :: INET, (events_source.source ->> 'dest_ip') :: INET) AS grouped JOIN events_source ON events_source.timestamp = grouped.maxts AND (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT = grouped.sigid AND (events_source.source ->> 'src_ip') :: INET = grouped.src_ip AND (events_source.source ->> 'dest_ip') :: INET = grouped.dest_ip , events WHERE events.uuid = events_source.uuid ORDER BY maxts DESC; EXPLAIN SELECT grouped.count, grouped.escalated_count, events.uuid, grouped.maxts AS maxts, grouped.mints, events_source.source, events.tags FROM ( SELECT count(s.source -> 'alert' ->> 'signature_id') :: BIGINT AS count, count(CASE WHEN events.tags && ARRAY ['escalated'] THEN 1 END) AS escalated_count, max(events.timestamp) AS maxts, min(events.timestamp) AS mints, (s.source -> 'alert' ->> 'signature_id') :: BIGINT AS sig_id, (s.source ->> 'src_ip') :: INET AS src_ip, (s.source ->> 'dest_ip') :: INET AS dest_ip FROM events, events_source AS s WHERE events.uuid = s.uuid AND s.source ->> 'event_type' = 'alert' AND (archived = FALSE OR archived IS NULL) -- AND (NOT events.tags && ARRAY ['archived']) GROUP BY (S.source -> 'alert' ->> 'signature_id') :: BIGINT, (S.source ->> 'src_ip') :: INET, (S.source ->> 'dest_ip') :: INET ) AS grouped JOIN events_source ON events_source.timestamp = grouped.maxts AND events_source.source ->> 'event_type' = 'alert' AND (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT = grouped.sig_id AND (events_source.source ->> 'src_ip') :: INET = grouped.src_ip AND (events_source.source ->> 'dest_ip') :: INET = grouped.dest_ip , events WHERE events.uuid = events_source.uuid AND (archived = FALSE OR archived IS NULL) ORDER BY maxts DESC; UPDATE events SET tags = array_append(tags, 'archived') FROM events_source WHERE (NOT tags && ARRAY ['archived']) AND events_source.source ->> 'event_type' = 'alert' AND (events_source.source ->> 'src_ip') :: INET = '10.16.1.1' AND (events_source.source ->> 'dest_ip') :: INET = '10.16.1.2' AND (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT = 10000 AND events_source.timestamp <= now() AND events_source.timestamp >= now() - INTERVAL '1 day' AND events.uuid = events_source.uuid; EXPLAIN SELECT grouped.count, grouped.escalated_count, events.uuid, grouped.maxts AS maxts, grouped.mints, events_source.source, events.tags FROM (SELECT count(events_source.source -> 'alert' ->> 'signature_id') AS count, count(CASE WHEN events.tags && ARRAY ['escalated'] THEN 1 END) AS escalated_count, max(events.timestamp) AS maxts, min(events.timestamp) AS mints, (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT AS sig_id, (events_source.source ->> 'src_ip') :: INET AS src_ip, (events_source.source ->> 'dest_ip') :: INET AS dest_ip FROM events, events_source WHERE events.uuid = events_source.uuid AND events_source.source ->> 'event_type' = 'alert' AND (NOT events.tags && ARRAY ['archived']) AND events_source.timestamp > '2017-06-04T14:44:34.919809-0600' AND events.timestamp > '2017-06-04T14:44:34.919809-0600' GROUP BY (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT, (events_source.source ->> 'src_ip') :: INET, (events_source.source ->> 'dest_ip') :: INET) AS grouped JOIN events_source ON events_source.timestamp = grouped.maxts AND events_source.source ->> 'event_type' = 'alert' AND (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT = grouped.sig_id AND (events_source.source ->> 'src_ip') :: INET = grouped.src_ip AND (events_source.source ->> 'dest_ip') :: INET = grouped.dest_ip AND events_source.timestamp > '2017-06-04T14:44:34.919809-0600' , events WHERE events.uuid = events_source.uuid AND (NOT events.tags && ARRAY ['archived']) AND events.timestamp > '2017-06-04T14:44:34.919809-0600' ORDER BY maxts DESC; SELECT DISTINCT ON (maxts, grouped.sig_id, grouped.src_ip, grouped.dest_ip) grouped.count, grouped.escalated_count, events.uuid, grouped.maxts AS maxts, grouped.mints, events_source.source FROM (SELECT count(events_source.source -> 'alert' ->> 'signature_id') AS count, count(CASE WHEN events.escalated = TRUE THEN 1 END) AS escalated_count, max(events.timestamp) AS maxts, min(events.timestamp) AS mints, (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT AS sig_id, (events_source.source ->> 'src_ip') :: INET AS src_ip, (events_source.source ->> 'dest_ip') :: INET AS dest_ip FROM events, events_source WHERE events.uuid = events_source.uuid AND events_source.source ->> 'event_type' = 'alert' AND events.escalated = TRUE GROUP BY (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT, (events_source.source ->> 'src_ip') :: INET, (events_source.source ->> 'dest_ip') :: INET) AS grouped JOIN events_source ON events_source.timestamp = grouped.maxts AND events_source.source ->> 'event_type' = 'alert' AND (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT = grouped.sig_id AND (events_source.source ->> 'src_ip') :: INET = grouped.src_ip AND (events_source.source ->> 'dest_ip') :: INET = grouped.dest_ip , events WHERE events.uuid = events_source.uuid AND events.escalated = TRUE ORDER BY maxts DESC; SELECT DISTINCT ON (maxts, grouped.sig_id, grouped.src_ip, grouped.dest_ip) grouped.count AS count, events.archived AS archived, grouped.archived_count AS archived_count_count, grouped.escalated_count AS escalated_count, events.uuid AS uuid, grouped.maxts AS maxts, grouped.mints AS mints, events_source.source FROM (SELECT count(events_source.source -> 'alert' ->> 'signature_id') AS count, count(CASE WHEN events.escalated = TRUE THEN 1 END) AS escalated_count, count(CASE WHEN events.archived = TRUE THEN 1 END) AS archived_count, max(events.timestamp) AS maxts, min(events.timestamp) AS mints, (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT AS sig_id, (events_source.source ->> 'src_ip') :: INET AS src_ip, (events_source.source ->> 'dest_ip') :: INET AS dest_ip FROM events, events_source WHERE events.uuid = events_source.uuid AND events_source.source ->> 'event_type' = 'alert' GROUP BY (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT, (events_source.source ->> 'src_ip') :: INET, (events_source.source ->> 'dest_ip') :: INET) AS grouped JOIN events_source ON events_source.timestamp = grouped.maxts AND events_source.source ->> 'event_type' = 'alert' AND (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT = grouped.sig_id AND (events_source.source ->> 'src_ip') :: INET = grouped.src_ip AND (events_source.source ->> 'dest_ip') :: INET = grouped.dest_ip JOIN events ON events.uuid = events_source.uuid AND events.timestamp = grouped.maxts ORDER BY maxts DESC; DROP VIEW xevents_source; CREATE OR REPLACE VIEW xevents_source AS SELECT uuid, timestamp, (source -> 'alert' ->> 'signature_id') :: BIGINT AS signature_id, (source ->> 'src_ip') :: INET AS src_ip, (source ->> 'dest_ip') :: INET AS dest_ip FROM events_source WHERE source ->> 'event_type' = 'alert'; SELECT * FROM (SELECT count(signature_id), signature_id, max(timestamp) AS maxts, min(timestamp) AS mints FROM xevents_source GROUP BY signature_id, src_ip, dest_ip) AS a JOIN xevents_source b ON a.maxts = b.timestamp AND a.signature_id = b.signature_id JOIN events c ON b.uuid = c.uuid; SELECT DISTINCT ON (maxts, grouped.sig_id, grouped.src_ip, grouped.dest_ip) grouped.count AS count, grouped.escalated_count AS escalated_count, events.uuid AS uuid, grouped.maxts AS maxts, grouped.mints AS mints, events_source.source, grouped.archived_count AS archived_count, events.archived AS archived, metadata ->> 'history' AS history FROM (SELECT count(events_source.source -> 'alert' ->> 'signature_id') AS count, count(CASE WHEN events.escalated = TRUE THEN 1 END) AS escalated_count, count(CASE WHEN events.archived = TRUE THEN 1 END) AS archived_count, max(events.timestamp) AS maxts, min(events.timestamp) AS mints, (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT AS sig_id, (events_source.source ->> 'src_ip') :: INET AS src_ip, (events_source.source ->> 'dest_ip') :: INET AS dest_ip FROM events, events_source WHERE events.uuid = events_source.uuid AND events_source.source ->> 'event_type' = 'alert' AND events.archived = FALSE AND events_source.timestamp >= '2017-06-12T07:50:59.779264-0600' :: TIMESTAMPTZ AND events.timestamp >= '2017-06-12T07:50:59.779264-0600' :: TIMESTAMPTZ GROUP BY (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT, (events_source.source ->> 'src_ip') :: INET, (events_source.source ->> 'dest_ip') :: INET) AS grouped JOIN events_source ON events_source.timestamp = grouped.maxts AND events_source.source ->> 'event_type' = 'alert' AND (events_source.source -> 'alert' ->> 'signature_id') :: BIGINT = grouped.sig_id AND (events_source.source ->> 'src_ip') :: INET = grouped.src_ip AND (events_source.source ->> 'dest_ip') :: INET = grouped.dest_ip AND events_source.timestamp >= '2017-06-12T07:50:59.779264-0600' :: TIMESTAMPTZ , events WHERE events.uuid = events_source.uuid AND events.archived = FALSE AND events.timestamp >= '2017-06-12T07:50:59.779264-0600' :: TIMESTAMPTZ ORDER BY maxts DESC;
the_stack
CREATE OR REPLACE FUNCTION InsertQuota ( v_id UUID, v_storage_pool_id UUID, v_quota_name VARCHAR(50), v_description VARCHAR(500), v_threshold_cluster_percentage INT, v_threshold_storage_percentage INT, v_grace_cluster_percentage INT, v_grace_storage_percentage INT, v_is_default BOOLEAN ) RETURNS VOID AS $PROCEDURE$ BEGIN INSERT INTO quota ( id, storage_pool_id, quota_name, description, threshold_cluster_percentage, threshold_storage_percentage, grace_cluster_percentage, grace_storage_percentage, is_default ) VALUES ( v_id, v_storage_pool_id, v_quota_name, v_description, v_threshold_cluster_percentage, v_threshold_storage_percentage, v_grace_cluster_percentage, v_grace_storage_percentage, v_is_default ); END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION InsertQuotaLimitation ( v_id UUID, v_quota_id UUID, v_storage_id UUID, v_cluster_id UUID, v_virtual_cpu INT, v_mem_size_mb BIGINT, v_storage_size_gb BIGINT ) RETURNS VOID AS $PROCEDURE$ BEGIN INSERT INTO quota_limitation ( id, quota_id, storage_id, cluster_id, virtual_cpu, mem_size_mb, storage_size_gb ) VALUES ( v_id, v_quota_id, v_storage_id, v_cluster_id, v_virtual_cpu, v_mem_size_mb, v_storage_size_gb ); END;$PROCEDURE$ LANGUAGE plpgsql; -- Returns all the Quota storages in the storage pool if v_storage_id is null, if v_storage_id is not null then a specific quota storage will be returned. -- Empty quotas are returned only if v_allow_empty is set to TRUE CREATE OR REPLACE FUNCTION GetQuotaStorageByStorageGuid ( v_storage_id UUID, v_id UUID, v_allow_empty BOOLEAN ) RETURNS SETOF quota_storage_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM ( SELECT COALESCE(q_storage_view.quota_storage_id, q_g_view.quota_id) AS quota_storage_id, q_g_view.quota_id AS quota_id, q_storage_view.storage_id, q_storage_view.storage_name, COALESCE(q_storage_view.storage_size_gb, q_g_view.storage_size_gb) AS storage_size_gb, COALESCE(q_storage_view.storage_size_gb_usage, q_g_view.storage_size_gb_usage) AS storage_size_gb_usage FROM quota_global_view q_g_view LEFT JOIN quota_storage_view q_storage_view ON q_g_view.quota_id = q_storage_view.quota_id AND ( v_storage_id = q_storage_view.storage_id OR v_storage_id IS NULL ) WHERE q_g_view.quota_id = v_id ) sub WHERE ( v_allow_empty OR storage_size_gb IS NOT NULL ); END;$PROCEDURE$ LANGUAGE plpgsql; -- Returns all the global quotas in the storage pool if v_storage_pool_id is null, if v_storage_id is not null then a specific quota storage will be returned. CREATE OR REPLACE FUNCTION GetQuotaByAdElementId ( v_ad_element_id UUID, v_storage_pool_id UUID, v_recursive BOOLEAN ) RETURNS SETOF quota_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM quota_view WHERE quota_view.quota_id IN ( SELECT object_id FROM PERMISSIONS WHERE object_type_id = 17 AND role_id IN ( SELECT role_id FROM ROLES_groups WHERE action_group_id = 901 ) AND ad_element_id = v_ad_element_id OR ( v_recursive AND ad_element_id IN ( SELECT * FROM getUserAndGroupsById(v_ad_element_id) ) ) ) AND ( v_storage_pool_id = quota_view.storage_pool_id OR v_storage_pool_id IS NULL ); END;$PROCEDURE$ LANGUAGE plpgsql; -- Returns all the quotas in a thin view (only basic quota meta data. no limits or consumption) CREATE OR REPLACE FUNCTION getAllThinQuota () RETURNS SETOF quota_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM quota_view; END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION getQuotaCount () RETURNS SETOF BIGINT STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT count(*) AS num_quota FROM quota; END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION GetQuotaStorageByQuotaGuid (v_id UUID) RETURNS SETOF quota_storage_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM quota_storage_view WHERE quota_id = v_id; END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION GetQuotaClusterByClusterGuid ( v_cluster_id UUID, v_id UUID, v_allow_empty BOOLEAN ) RETURNS SETOF quota_cluster_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM ( SELECT COALESCE(q_vds_view.quota_cluster_id, q_g_view.quota_id) AS quota_cluster_id, q_g_view.quota_id AS quota_id, q_vds_view.cluster_id AS cluster_id, q_vds_view.cluster_name AS cluster_name, COALESCE(q_vds_view.virtual_cpu, q_g_view.virtual_cpu) AS virtual_cpu, COALESCE(q_vds_view.virtual_cpu_usage, q_g_view.virtual_cpu_usage) AS virtual_cpu_usage, COALESCE(q_vds_view.mem_size_mb, q_g_view.mem_size_mb) AS mem_size_mb, COALESCE(q_vds_view.mem_size_mb_usage, q_g_view.mem_size_mb_usage) AS mem_size_mb_usage FROM quota_global_view q_g_view LEFT JOIN quota_cluster_view q_vds_view ON q_g_view.quota_id = q_vds_view.quota_id AND ( v_cluster_id = q_vds_view.cluster_id OR v_cluster_id IS NULL ) WHERE q_g_view.quota_id = v_id ) sub WHERE v_allow_empty OR virtual_cpu IS NOT NULL OR mem_size_mb IS NOT NULL; END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION GetQuotaClusterByQuotaGuid (v_id UUID) RETURNS SETOF quota_cluster_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT quota_cluster_view.* FROM quota_cluster_view WHERE quota_id = v_id; END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION DeleteQuotaByQuotaGuid (v_id UUID) RETURNS VOID AS $PROCEDURE$ BEGIN DELETE FROM quota WHERE id = v_id; END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION DeleteQuotaLimitationByQuotaGuid (v_id UUID) RETURNS VOID AS $PROCEDURE$ BEGIN DELETE FROM quota_limitation WHERE quota_id = v_id; END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION UpdateQuotaMetaData ( v_id UUID, v_storage_pool_id UUID, v_quota_name VARCHAR(50), v_description VARCHAR(500), v_threshold_cluster_percentage INT, v_threshold_storage_percentage INT, v_grace_cluster_percentage INT, v_grace_storage_percentage INT, v_is_default BOOLEAN ) RETURNS VOID AS $PROCEDURE$ BEGIN UPDATE quota SET storage_pool_id = v_storage_pool_id, quota_name = v_quota_name, description = v_description, _update_date = LOCALTIMESTAMP, threshold_cluster_percentage = v_threshold_cluster_percentage, threshold_storage_percentage = v_threshold_storage_percentage, grace_cluster_percentage = v_grace_cluster_percentage, grace_storage_percentage = v_grace_storage_percentage, is_default = v_is_default WHERE id = v_id; END;$PROCEDURE$ LANGUAGE plpgsql; -- Returns all the Quota storages in the storage pool if v_storage_id is null, if v_storage_id is not null then a specific quota storage will be returned. CREATE OR REPLACE FUNCTION GetQuotaByStoragePoolGuid (v_storage_pool_id UUID) RETURNS SETOF quota_global_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM quota_global_view WHERE ( storage_pool_id = v_storage_pool_id OR v_storage_pool_id IS NULL ); END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION GetDefaultQuotaForStoragePool (v_storage_pool_id UUID) RETURNS SETOF quota_global_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM quota_global_view WHERE is_default = TRUE AND storage_pool_id = v_storage_pool_id; END; $PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION GetQuotaByQuotaGuid (v_id UUID) RETURNS SETOF quota_global_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM quota_global_view WHERE quota_id = v_id; END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION GetQuotaByQuotaName (v_quota_name VARCHAR, v_storage_pool_id UUID) RETURNS SETOF quota_global_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM quota_global_view WHERE quota_name = v_quota_name AND storage_pool_id = v_storage_pool_id; END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION GetAllThinQuotasByStorageId ( v_storage_id UUID, v_engine_session_seq_id INT, v_is_filtered boolean ) RETURNS SETOF quota_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT DISTINCT quota_id, storage_pool_id, storage_pool_name, quota_name, description, threshold_cluster_percentage, threshold_storage_percentage, grace_cluster_percentage, grace_storage_percentage, quota_enforcement_type, is_default FROM quota_limitations_view WHERE ( storage_id = v_storage_id OR ( is_global AND NOT is_empty AND storage_size_gb IS NOT NULL AND storage_pool_id IN ( SELECT storage_pool_id FROM storage_pool_iso_map WHERE storage_id = v_storage_id ) ) ) AND ( NOT v_is_filtered OR EXISTS ( SELECT 1 FROM permissions p INNER JOIN engine_session_user_flat_groups u ON u.granted_id = p.ad_element_id WHERE u.engine_session_seq_id = v_engine_session_seq_id AND p.object_type_id = 17 AND -- quota object p.role_id = 'def0000a-0000-0000-0000-def00000000a' AND -- consume quota quota_id = p.object_id ) ); END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION GetAllThinQuotasByClusterId ( v_cluster_id UUID, v_engine_session_seq_id INT, v_is_filtered boolean ) RETURNS SETOF quota_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT DISTINCT quota_id, storage_pool_id, storage_pool_name, quota_name, description, threshold_cluster_percentage, threshold_storage_percentage, grace_cluster_percentage, grace_storage_percentage, quota_enforcement_type, is_default FROM quota_limitations_view WHERE ( cluster_id = v_cluster_id OR ( is_global AND NOT is_empty AND virtual_cpu IS NOT NULL AND storage_pool_id IN ( SELECT storage_pool_id FROM cluster WHERE cluster_id = v_cluster_id ) ) ) AND ( NOT v_is_filtered OR EXISTS ( SELECT 1 FROM permissions p INNER JOIN engine_session_user_flat_groups u ON u.granted_id = p.ad_element_id WHERE u.engine_session_seq_id = v_engine_session_seq_id AND p.object_type_id = 17 AND -- quota object p.role_id = 'def0000a-0000-0000-0000-def00000000a' AND -- consume quota quota_id = p.object_id ) ); END;$PROCEDURE$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION IsQuotaInUse (v_quota_id UUID) RETURNS boolean STABLE AS $BODY$ DECLARE result boolean := FALSE; BEGIN IF EXISTS ( SELECT quota_id FROM image_storage_domain_map WHERE quota_id = v_quota_id UNION SELECT quota_id FROM vm_static WHERE quota_id = v_quota_id ) THEN result := TRUE; END IF; RETURN result; END;$BODY$ LANGUAGE plpgsql;
the_stack
DROP FUNCTION IF EXISTS de_metas_endcustomer_fresh_reports.Direct_Costing_Raw_Data_Include_LastYear (Year Date) ; DROP FUNCTION IF EXISTS de_metas_endcustomer_fresh_reports.Direct_Costing_Raw_Data_Include_LastYear (Year Date, ad_org_id numeric(10,0)) ; CREATE OR REPLACE FUNCTION de_metas_endcustomer_fresh_reports.Direct_Costing_Raw_Data_Include_LastYear (Year Date, ad_org_id numeric(10,0)) RETURNS TABLE ( Margin text, l1_Value Character Varying, L1_Name Character Varying, L2_Value Character Varying, L2_Name Character Varying, L3_Value Character Varying, L3_Name Character Varying, Balance_1000 numeric, Balance_2000 numeric, Balance_100 numeric, Balance_150 numeric, Balance_Other numeric, Balance numeric, Budget_1000 numeric, Budget_2000 numeric, Budget_100 numeric, Budget_150 numeric, Budget numeric, BalanceLY_1000 numeric, BalanceLY_2000 numeric, BalanceLY_100 numeric, BalanceLY_150 numeric, BalanceLY_Other numeric, BalanceLY numeric, L1_Multiplicator numeric, L2_Multiplicator numeric, L3_Multiplicator numeric, Seq text, ad_org_id numeric ) AS $BODY$ SELECT margin, l1_value, l1_name, l2_value, l2_name, l3_value, l3_name, Balance_1000 * Multi_1000 AS Balance_1000, Balance_2000 * Multi_2000 AS Balance_2000, Balance_100 * Multi_100 AS Balance_100, Balance_150 * Multi_150 AS Balance_150, Balance_Other * Multi_150 AS Balance_Other, Balance_1000 * Multi_1000 + Balance_2000 * Multi_2000 + Balance_100 * Multi_100 + Balance_150 * Multi_150 + Balance_Other * Multi_150 AS Balance, Budget_1000 * Multi_1000 AS Budget_1000, Budget_2000 * Multi_2000 AS Budget_2000, Budget_100 * Multi_100 AS Budget_100, Budget_150 * Multi_150 AS Budget_150, Budget_1000 * Multi_1000 + Budget_2000 * Multi_2000 + Budget_100 * Multi_100 + Budget_150 * Multi_150 AS Budget, COALESCE(BalanceLY_1000 * Multi_1000, 0) AS BalanceLY_1000, COALESCE(BalanceLY_2000 * Multi_2000,0) AS BalanceLY_2000, COALESCE(BalanceLY_100 * Multi_100,0) AS BalanceLY_100, COALESCE(BalanceLY_150 * Multi_150,0) AS BalanceLY_150, COALESCE(BalanceLY_Other * Multi_150,0) AS BalanceLY_Other, COALESCE(BalanceLY_1000 * Multi_1000 + BalanceLY_2000 * Multi_2000 + BalanceLY_100 * Multi_100 + BalanceLY_150 * Multi_150 + BalanceLY_Other * Multi_150,0) AS BalanceLY, acctBalance(l1_ElementValue_ID, 0, 1) AS l1_Multiplicator, acctBalance(l2_ElementValue_ID, 0, 1) AS l2_Multiplicator, acctBalance(l3_ElementValue_ID, 0, 1) AS l3_Multiplicator, SeqNo AS Seq, fa.ad_org_id FROM de_metas_endcustomer_fresh_reports.Direct_Costing_selection s LEFT OUTER JOIN ( SELECT Account_ID, SUM( CASE WHEN a.Value = '1000' THEN Balance ELSE 0 END ) AS Balance_1000, SUM( CASE WHEN a.Value = '2000' THEN Balance ELSE 0 END ) AS Balance_2000, SUM( CASE WHEN a.Value = '100' THEN Balance ELSE 0 END ) AS Balance_100, SUM( CASE WHEN a.Value = '150' THEN Balance ELSE 0 END ) AS Balance_150, SUM( CASE WHEN a.Value IS NULL OR (a.Value != '1000' AND a.Value != '2000' AND a.Value != '100' AND a.Value != '150') THEN Balance ELSE 0 END ) AS Balance_Other, SUM( CASE WHEN a.Value = '1000' THEN Budget ELSE 0 END ) AS Budget_1000, SUM( CASE WHEN a.Value = '2000' THEN Budget ELSE 0 END ) AS Budget_2000, SUM( CASE WHEN a.Value = '100' THEN Budget ELSE 0 END ) AS Budget_100, SUM( CASE WHEN a.Value = '150' THEN Budget ELSE 0 END ) AS Budget_150, fa.ad_org_id FROM ( SELECT fa.Account_ID , COALESCE(ap.C_Activity_ID, a.C_Activity_ID) as C_Activity_ID , CASE WHEN postingtype = 'A' THEN AmtAcctCr - AmtAcctDr ELSE 0 END AS Balance , CASE WHEN postingtype = 'B' THEN AmtAcctCr - AmtAcctDr ELSE 0 END AS Budget, fa.ad_org_id FROM Fact_Acct fa left outer join C_Activity a on (a.C_Activity_ID=fa.C_Activity_ID) left outer join C_Activity ap on (ap.C_Activity_ID=a.Parent_Activity_ID) WHERE CASE WHEN postingtype = 'B' THEN dateacct::date <= (select enddate from c_period where c_period_id=report.Get_Period( 1000000, $1 )) ELSE (dateacct::date <= $1) END AND dateacct::Date >= ( SELECT MIN( StartDate )::Date FROM C_Period WHERE C_Year_ID = (SELECT C_Year_ID FROM C_Period WHERE C_Period_ID = report.Get_Period( 1000000, $1 )) ) ) fa LEFT OUTER JOIN C_Activity a ON fa.C_Activity_ID = a.C_Activity_ID WHERE fa.ad_org_id = $2 GROUP BY Account_ID, fa.ad_org_id ) fa ON fa.Account_ID = s.L3_ElementValue_ID LEFT OUTER JOIN ( SELECT Account_ID, SUM( CASE WHEN a.Value = '1000' THEN BalanceLY ELSE 0 END ) AS BalanceLY_1000, SUM( CASE WHEN a.Value = '2000' THEN BalanceLY ELSE 0 END ) AS BalanceLY_2000, SUM( CASE WHEN a.Value = '100' THEN BalanceLY ELSE 0 END ) AS BalanceLY_100, SUM( CASE WHEN a.Value = '150' THEN BalanceLY ELSE 0 END ) AS BalanceLY_150, SUM( CASE WHEN a.Value IS NULL OR (a.Value != '1000' AND a.Value != '2000' AND a.Value != '100' AND a.Value != '150') THEN BalanceLY ELSE 0 END ) AS BalanceLY_Other, fa.ad_org_id FROM ( SELECT fa.Account_ID , COALESCE(ap.C_Activity_ID, a.C_Activity_ID) as C_Activity_ID , CASE WHEN postingtype = 'A' THEN AmtAcctCr - AmtAcctDr ELSE 0 END AS BalanceLY, fa.ad_org_id FROM Fact_Acct fa left outer join C_Activity a on (a.C_Activity_ID=fa.C_Activity_ID) left outer join C_Activity ap on (ap.C_Activity_ID=a.Parent_Activity_ID) WHERE dateacct::date <= (SELECT MAX( enddate )::Date FROM C_Period WHERE C_Year_ID = (SELECT C_Year_ID FROM C_Period WHERE C_Period_ID = report.Get_Period( 1000000, ($1 - interval '1 year')::date ))) AND dateacct::Date >= (SELECT MIN( startdate )::Date FROM C_Period WHERE C_Year_ID = (SELECT C_Year_ID FROM C_Period WHERE C_Period_ID = report.Get_Period( 1000000, ($1 - interval '1 year')::date ))) ) fa LEFT OUTER JOIN C_Activity a ON fa.C_Activity_ID = a.C_Activity_ID WHERE fa.ad_org_id = $2 GROUP BY Account_ID, fa.ad_org_id )faly ON faly.Account_ID = s.L3_ElementValue_ID ORDER BY SeqNo $BODY$ LANGUAGE sql STABLE ; DROP FUNCTION IF EXISTS de_metas_endcustomer_fresh_reports.Direct_Costing_Short_Version(Date Date); DROP FUNCTION IF EXISTS de_metas_endcustomer_fresh_reports.Direct_Costing_Short_Version(Date Date, ad_org_id numeric(10,0)); CREATE OR REPLACE FUNCTION de_metas_endcustomer_fresh_reports.Direct_Costing_Short_Version(Date Date, ad_org_id numeric(10,0)) RETURNS TABLE ( seq text, margin text, Margin_Incr_1000 numeric, Margin_Incr_2000 numeric, Margin_Incr_100 numeric, Margin_Incr_150 numeric, Margin_Incr_other numeric, Margin_Incr_All numeric, L1_Value character varying, L1_Name character varying, isDisplayL1Sum boolean, L1_1000 numeric, L1_2000 numeric, L1_100 numeric, L1_150 numeric, L1_other numeric, L1_All numeric, L1_Multiplicator numeric, L2_Value character varying, L2_Name character varying, L2_1000 numeric, L2_2000 numeric, L2_100 numeric, L2_150 numeric, L2_other numeric, L2_All numeric, L2_Multiplicator numeric, L3_Value character varying, L3_Name character varying, Balance_1000 numeric, Balance_2000 numeric, Balance_100 numeric, Balance_150 numeric, Balance_other numeric, Balance numeric, L3_Multiplicator numeric, Margin_Budget_Incr_1000 numeric, Margin_Budget_Incr_2000 numeric, Margin_Budget_Incr_100 numeric, Margin_Budget_Incr_150 numeric, Margin_Budget_Incr_All numeric, L1_Budget_1000 numeric, L1_Budget_2000 numeric, L1_Budget_100 numeric, L1_Budget_150 numeric, L1_Budget_All numeric, L2_Budget_1000 numeric, L2_Budget_2000 numeric, L2_Budget_100 numeric, L2_Budget_150 numeric, L2_Budget_All numeric, Budget_1000 numeric, Budget_2000 numeric, Budget_100 numeric, Budget_150 numeric, Budget numeric, Margin_IncrLY_1000 numeric, Margin_IncrLY_2000 numeric, Margin_IncrLY_100 numeric, Margin_IncrLY_150 numeric, Margin_IncrLY_All numeric, L1_BalanceLY_1000 numeric, L1_BalanceLY_2000 numeric, L1_BalanceLY_100 numeric, L1_BalanceLY_150 numeric, L1_BalanceLY_All numeric, L2_BalanceLY_1000 numeric, L2_BalanceLY_2000 numeric, L2_BalanceLY_100 numeric, L2_BalanceLY_150 numeric, L2_BalanceLY_All numeric, BalanceLY_1000 numeric, BalanceLY_2000 numeric, BalanceLY_100 numeric, BalanceLY_150 numeric, BalanceLY numeric, ad_org_id numeric, Gross_1000 numeric, Gross_2000 numeric, Gross_100 numeric, Gross_150 numeric, Gross_All numeric, startdate date, enddate date, Margin_Percentage_all numeric, Margin_Budget_Percentage_all numeric, Margin_BalanceLY_Percentage_all numeric, L1_Percentage_All numeric, L1_Budget_Percentage_All numeric, L1_BalanceLY_Percentage_All numeric, L2_Percentage_All numeric, L2_Budget_Percentage_All numeric, L2_BalanceLY_Percentage_All numeric, L3_percentage_All numeric, L3_Budget_Percentage_All numeric, L3_BalanceLY_Percentage_All numeric, isDisplayMarginSum boolean, isDisplayOther boolean ) AS $BODY$ SELECT *, ROUND( Margin_Incr_all / Gross_all * 100, 2 ) AS Margin_Percentage_all, ROUND( Margin_Incr_all / NULLIF( Margin_Budget_Incr_All, 0 ) * 100, 2 ) AS Margin_Budget_Percentage_all, ROUND( Margin_IncrLY_all / NULLIF( Margin_IncrLY_All, 0 ) * 100, 2 ) AS Margin_BalanceLY_Percentage_all, ABS( ROUND( L1_All / Gross_All * 100, 2 ) ) AS L1_Percentage_All, ABS( ROUND( L1_All / NULLIF( L1_Budget_All, 0 ) * 100, 2 ) ) AS L1_Budget_Percentage_All, ABS( ROUND( L1_All / NULLIF( L1_BalanceLY_All, 0 ) * 100, 2 ) ) AS L1_BalanceLY_Percentage_All, ABS( ROUND( L2_All / Gross_All * 100, 2 ) ) AS L2_Percentage_All, ABS( ROUND( L2_All / NULLIF( L2_Budget_All, 0 ) * 100, 2 ) ) AS L2_Budget_Percentage_All, ABS( ROUND( L2_All / NULLIF( L2_BalanceLY_All, 0 ) * 100, 2 ) ) AS L2_BalanceLY_Percentage_All, ABS( ROUND( Balance / Gross_all * 100, 2 ) ) AS L3_percentage_All, ABS( ROUND( Balance / NULLIF( Budget, 0 ) * 100, 2 ) ) AS L3_Budget_Percentage_All, ABS( ROUND( Balance / NULLIF( BalanceLY, 0 ) * 100, 2 ) ) AS L3_BalanceLY_Percentage_All, -- If current Margin is the Last Margin, display the final sum group footer First_Agg( Margin ) OVER ( ORDER BY Seq Desc ) != Margin AS isDisplayMarginSum, -- If there are no Sums in the 'Other'-Column, don't display it SUM( Balance_Other ) OVER () != 0 AS isDisplayOther FROM ( SELECT *, -- Get initial profit to create the percentage of each line and/or sum NULLIF( First_agg ( L2_1000 ) OVER (ORDER BY Seq ), 0 ) AS Gross_1000, NULLIF( First_agg ( L2_2000 ) OVER (ORDER BY Seq ), 0 ) AS Gross_2000, NULLIF( First_agg ( L2_100 ) OVER (ORDER BY Seq ), 0 ) AS Gross_100, NULLIF( First_agg ( L2_150 ) OVER (ORDER BY Seq ), 0 ) AS Gross_150, NULLIF( First_agg ( L2_all ) OVER (ORDER BY Seq ), 0 ) AS Gross_All FROM ( SELECT seq, -- Margin margin, -- -- Balances -- Create an Incremental sum for the Margins. This sum will be Displayed in the report -- It is a requirement of the report that the sums are incremental over the margins -- Note: The window function Last_Value does not get the Last Value, but the maximum First_Agg( Incr_1000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_1000, First_Agg( Incr_2000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_2000, First_Agg( Incr_100 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_100, First_Agg( Incr_150 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_150, First_Agg( Incr_other ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_other, First_Agg( Incr ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Incr_All, -- Level 1 L1_Value, L1_Name, isDisplayL1Sum, Sum ( Balance_1000 ) OVER ( PARTITION BY Margin, L1_Value) AS L1_1000, Sum ( Balance_2000 ) OVER ( PARTITION BY Margin, L1_Value) AS L1_2000, Sum ( Balance_100 ) OVER ( PARTITION BY Margin, L1_Value) AS L1_100, Sum ( Balance_150 ) OVER ( PARTITION BY Margin, L1_Value) AS L1_150, Sum ( Balance_other ) OVER ( PARTITION BY Margin, L1_Value) AS L1_other, Sum ( Balance ) OVER ( PARTITION BY Margin, L1_Value) AS L1_All, L1_Multiplicator, -- Level 2 L2_Value, L2_Name, Sum ( Balance_1000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_1000, Sum ( Balance_2000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_2000, Sum ( Balance_100 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_100, Sum ( Balance_150 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_150, Sum ( Balance_other ) OVER ( PARTITION BY Margin, L2_Value) AS L2_other, Sum ( Balance ) OVER ( PARTITION BY Margin, L2_Value) AS L2_All, L2_Multiplicator, -- Level 3 L3_Value, L3_Name, Balance_1000, Balance_2000, Balance_100, Balance_150, Balance_other, Balance, L3_Multiplicator, -- -- Budgets -- Margin First_Agg( Budget_Incr_1000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Budget_Incr_1000, First_Agg( Budget_Incr_2000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Budget_Incr_2000, First_Agg( Budget_Incr_100 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Budget_Incr_100, First_Agg( Budget_Incr_150 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Budget_Incr_150, First_Agg( Budget_Incr ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_Budget_Incr_All, -- Level 1 Sum ( Budget_1000 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_Budget_1000, Sum ( Budget_2000 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_Budget_2000, Sum ( Budget_100 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_Budget_100, Sum ( Budget_150 ) OVER ( PARTITION BY Margin, L1_Value) AS L1_Budget_150, Sum ( Budget ) OVER ( PARTITION BY Margin, L1_Value) AS L1_Budget_All, -- Level 2 Sum ( Budget_1000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_Budget_1000, Sum ( Budget_2000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_Budget_2000, Sum ( Budget_100 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_Budget_100, Sum ( Budget_150 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_Budget_150, Sum ( Budget ) OVER ( PARTITION BY Margin, L2_Value) AS L2_Budget_All, -- Level 3 Budget_1000, Budget_2000, Budget_100, Budget_150, Budget, -- balance last year -- Margin First_Agg( IncrLY_1000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_IncrLY_1000, First_Agg( IncrLY_2000 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_IncrLY_2000, First_Agg( IncrLY_100 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_IncrLY_100, First_Agg( IncrLY_150 ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_IncrLY_150, First_Agg( IncrLY ) OVER ( PARTITION BY Margin ORDER BY Seq DESC ) AS Margin_IncrLY_All, -- Level 1 Sum ( BalanceLY_1000 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_BalanceLY_1000, Sum ( BalanceLY_2000 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_BalanceLY_2000, Sum ( BalanceLY_100 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_BalanceLY_100, Sum ( BalanceLY_150 ) OVER ( PARTITION BY Margin, L1_Value ) AS L1_BalanceLY_150, Sum ( BalanceLY ) OVER ( PARTITION BY Margin, L1_Value) AS L1_BalanceLY_All, -- Level 2 Sum ( BalanceLY_1000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_BalanceLY_1000, Sum ( BalanceLY_2000 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_BalanceLY_2000, Sum ( BalanceLY_100 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_BalanceLY_100, Sum ( BalanceLY_150 ) OVER ( PARTITION BY Margin, L2_Value) AS L2_BalanceLY_150, Sum ( BalanceLY ) OVER ( PARTITION BY Margin, L2_Value) AS L2_BalanceLY_All, -- Level 3 BalanceLY_1000, BalanceLY_2000, BalanceLY_100, BalanceLY_150, BalanceLY, x.ad_org_id FROM ( SELECT seq, margin, L1_Name IS NOT NULL AND L1_Name != '' AS isDisplayL1Sum, L1_Value, L1_Name, L2_Value, L2_Name, L3_Value, L3_Name, -- Preparing an incremantal Sum over all lines, to later extract an incremental sum for margin level Balance_1000, SUM( Balance_1000 ) OVER ( ORDER BY Seq ) AS Incr_1000, Balance_2000, SUM( Balance_2000 ) OVER ( ORDER BY Seq ) AS Incr_2000, Balance_100, SUM( Balance_100 ) OVER (ORDER BY Seq ) AS Incr_100, Balance_150, SUM( Balance_150 ) OVER ( ORDER BY Seq ) AS Incr_150, Balance_other, SUM( Balance_other ) OVER (ORDER BY Seq ) AS Incr_other, Balance, SUM( Balance ) OVER ( ORDER BY Seq ) AS Incr, Budget_1000, SUM( Budget_1000 ) OVER ( ORDER BY Seq ) AS Budget_Incr_1000, Budget_2000, SUM( Budget_2000 ) OVER ( ORDER BY Seq ) AS Budget_Incr_2000, Budget_100, SUM( Budget_100 ) OVER ( ORDER BY Seq ) AS Budget_Incr_100, Budget_150, SUM( Budget_150 ) OVER (ORDER BY Seq ) AS Budget_Incr_150, Budget, SUM( Budget ) OVER ( ORDER BY Seq ) AS Budget_Incr, BalanceLY_1000, SUM( BalanceLY_1000 ) OVER (ORDER BY Seq ) AS IncrLY_1000, BalanceLY_2000, SUM( BalanceLY_2000 ) OVER (ORDER BY Seq ) AS IncrLY_2000, BalanceLY_100, SUM( BalanceLY_100 ) OVER ( ORDER BY Seq ) AS IncrLY_100, BalanceLY_150, SUM( BalanceLY_150 ) OVER (ORDER BY Seq ) AS IncrLY_150, BalanceLY_other, SUM( BalanceLY_other ) OVER (ORDER BY Seq ) AS IncrLY_other, BalanceLY, SUM( BalanceLY ) OVER ( ORDER BY Seq ) AS IncrLY, L3_Multiplicator, L2_Multiplicator, L1_Multiplicator, ad_org_id FROM de_metas_endcustomer_fresh_reports.Direct_Costing_Raw_Data_Include_LastYear($1, $2) ) x ) y ) z LEFT OUTER JOIN ( SELECT First_Agg ( StartDate::text ORDER BY PeriodNo )::Date AS StartDate, $1::date AS EndDate FROM C_Period WHERE C_Year_ID = (SELECT C_Year_ID FROM C_Period WHERE C_Period_ID = report.Get_Period( 1000000, $1::Date )) ) date ON true WHERE ad_org_id = $2 ORDER BY seq ; $BODY$ LANGUAGE sql STABLE ;
the_stack
; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; # Dump of table announcements # ------------------------------------------------------------ CREATE TABLE `announcements` ( `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` int(11) NOT NULL, `body` text COLLATE utf8mb4_unicode_ci NOT NULL, `action_text` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `action_url` text COLLATE utf8mb4_unicode_ci, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table api_tokens # ------------------------------------------------------------ CREATE TABLE `api_tokens` ( `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `metadata` text COLLATE utf8mb4_unicode_ci NOT NULL, `transient` tinyint(4) NOT NULL DEFAULT '0', `last_used_at` timestamp NULL DEFAULT NULL, `expires_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `api_tokens_token_unique` (`token`), KEY `api_tokens_user_id_expires_at_index` (`user_id`,`expires_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table customer_profile_research_collection # ------------------------------------------------------------ CREATE TABLE `customer_profile_research_collection` ( `research_collection_id` int(10) unsigned DEFAULT NULL, `customer_profile_id` int(10) unsigned DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table invitations # ------------------------------------------------------------ CREATE TABLE `invitations` ( `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `team_id` int(11) NOT NULL, `user_id` int(11) DEFAULT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `invitations_token_unique` (`token`), KEY `invitations_team_id_index` (`team_id`), KEY `invitations_user_id_index` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; LOCK TABLES `invitations` WRITE; /*!40000 ALTER TABLE `invitations` DISABLE KEYS */; INSERT INTO `invitations` (`id`, `team_id`, `user_id`, `email`, `token`, `created_at`, `updated_at`) VALUES ('8a49e914-d393-45e8-98e6-14f10e2e19c6',4,NULL,'support@psychoanalytics.io','QSgdkclZqvCbPm3qjxqY6dsk5zxARIYqVMtJR6Mn','2017-08-17 01:57:25','2017-08-17 01:57:25'), ('e5fe524d-68aa-4adc-aba2-e1ebb86d8413',4,1,'huntercarter@gmail.com','85j4pMquxl84rCFFUOQRoh68hRcrVJcq0nVp02ga','2017-08-17 01:53:55','2017-08-17 01:53:55'); /*!40000 ALTER TABLE `invitations` ENABLE KEYS */; UNLOCK TABLES; # Dump of table invoices # ------------------------------------------------------------ CREATE TABLE `invoices` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(11) DEFAULT NULL, `team_id` int(11) DEFAULT NULL, `provider_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `total` decimal(8,2) DEFAULT NULL, `tax` decimal(8,2) DEFAULT NULL, `card_country` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_state` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_zip` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_country` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `vat_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `invoices_created_at_index` (`created_at`), KEY `invoices_user_id_index` (`user_id`), KEY `invoices_team_id_index` (`team_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table jobs # ------------------------------------------------------------ CREATE TABLE `jobs` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `queue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `attempts` tinyint(3) unsigned NOT NULL, `reserved_at` int(10) unsigned DEFAULT NULL, `available_at` int(10) unsigned NOT NULL, `created_at` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `jobs_queue_reserved_at_index` (`queue`,`reserved_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table meta # ------------------------------------------------------------ CREATE TABLE `meta` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `metable_id` int(10) unsigned NOT NULL, `metable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `value` text COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), KEY `meta_metable_id_index` (`metable_id`), KEY `meta_key_index` (`key`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; LOCK TABLES `meta` WRITE; /*!40000 ALTER TABLE `meta` DISABLE KEYS */; INSERT INTO `meta` (`id`, `metable_id`, `metable_type`, `key`, `value`) VALUES (2,2,'App\\Site','onboarding-stage','\"initial\"'), (6,4,'App\\Site','onboarding-stage','\"initial\"'), (9,1,'App\\Site','mixpanel-api-secret','\"x\"'), (10,1,'App\\Site','_token','\"j2aOVAHJkLK0Ubmk6ImQM1W4xWxPLsmViM3C3v93\"'), (35,1,'App\\Site','onboarding-stage','\"onboarded\"'), (36,1,'App\\Site','onboarding-percent','\"100\"'); /*!40000 ALTER TABLE `meta` ENABLE KEYS */; UNLOCK TABLES; # Dump of table migrations # ------------------------------------------------------------ CREATE TABLE `migrations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; LOCK TABLES `migrations` WRITE; /*!40000 ALTER TABLE `migrations` DISABLE KEYS */; INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1,'2017_05_04_100000_create_meta_table',1), (2,'2017_06_15_045735_create_performance_indicators_table',1), (3,'2017_06_15_045736_create_announcements_table',1), (4,'2017_06_15_045738_create_users_table',1), (5,'2017_06_15_045741_create_password_resets_table',1), (6,'2017_06_15_045745_create_api_tokens_table',1), (7,'2017_06_15_045750_create_subscriptions_table',1), (8,'2017_06_15_045756_create_invoices_table',1), (9,'2017_06_15_045803_create_notifications_table',1), (10,'2017_06_15_045811_create_teams_table',1), (11,'2017_06_15_045820_create_team_users_table',1), (12,'2017_06_15_045830_create_invitations_table',1), (13,'2017_06_17_082120_create_jobs_table',1), (14,'2017_06_22_040004_create_tag_tables',1), (15,'2017_06_25_033813_create_urls',1), (16,'2017_06_25_035227_add_tags_columns',1), (17,'2017_06_25_042703_add_proccessed_text_column',1), (18,'2017_06_26_072924_add_concepts',1), (19,'2017_07_26_053129_create_research_collections_table',1), (20,'2017_07_26_190150_add_site_id_to_research_documents',1), (21,'2017_07_27_051133_rename_urls_table',1), (22,'2017_07_27_051223_create_researchcollection_researchitem_table',1), (23,'2017_07_29_051223_create_customer_profiles_research_collections_table',1), (24,'2017_07_29_203240_add_uid_to_research_items',1), (25,'2017_07_31_070848_add_watson_column_to_research_items',1), (26,'2017_08_10_205909_add_uclassy_column_to_research_items',1), (27,'2017_08_11_232955_add_auth0_fields_to_users_table',1); /*!40000 ALTER TABLE `migrations` ENABLE KEYS */; UNLOCK TABLES; # Dump of table notifications # ------------------------------------------------------------ CREATE TABLE `notifications` ( `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` int(11) NOT NULL, `created_by` int(11) DEFAULT NULL, `icon` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `body` text COLLATE utf8mb4_unicode_ci NOT NULL, `action_text` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `action_url` text COLLATE utf8mb4_unicode_ci, `read` tinyint(4) NOT NULL DEFAULT '0', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `notifications_user_id_created_at_index` (`user_id`,`created_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; LOCK TABLES `notifications` WRITE; /*!40000 ALTER TABLE `notifications` DISABLE KEYS */; INSERT INTO `notifications` (`id`, `user_id`, `created_by`, `icon`, `body`, `action_text`, `action_url`, `read`, `created_at`, `updated_at`) VALUES ('07fd5f62-9bc3-4b95-bc5f-5da25f94c43e',1,NULL,'fa-users','You have been invited to join the Test project!','View Invitations','/settings#/projects',1,'2017-08-17 01:43:44','2017-08-18 01:12:19'), ('3e098f68-2517-4489-b3d6-398b2bfeea65',3,NULL,'fa-clock-o','The Test project\'s trial period will expire on August 24th.','Subscribe','/settings/projects/4#/subscription',1,'2017-08-17 01:39:23','2017-08-17 23:13:27'), ('41c99224-813c-4c1c-8089-4a0e46d00421',1,NULL,'fa-users','You have been invited to join the Test project!','View Invitations','/settings#/projects',1,'2017-08-17 01:51:59','2017-08-18 01:12:19'), ('4ecf6468-57ed-4fbf-b021-bebbed0d5766',1,NULL,'fa-users','You have been invited to join the Test project!','View Invitations','/settings#/projects',1,'2017-08-17 01:53:57','2017-08-18 01:12:19'), ('713b787f-1503-467f-a80d-cde454a7e45a',3,NULL,'fa-clock-o','The test project\'s trial period will expire on August 23rd.','Subscribe','/settings/projects/3#/subscription',1,'2017-08-16 21:30:46','2017-08-17 23:13:27'), ('9044e9b6-12cb-4630-b33e-321e7b8cb607',1,NULL,'fa-users','You have been invited to join the Test project!','View Invitations','/settings#/projects',1,'2017-08-17 01:52:28','2017-08-18 01:12:19'), ('a7ac10e1-80b9-4d51-87da-9a9c040e9539',1,NULL,'fa-users','You have been invited to join the Test project!','View Invitations','/settings#/projects',1,'2017-08-17 01:52:53','2017-08-18 01:12:19'), ('aee64c4c-590a-4c19-a2a4-0ab1c259546e',1,NULL,'fa-users','You have been invited to join the Test project!','View Invitations','/settings#/projects',1,'2017-08-17 01:42:34','2017-08-18 01:12:19'), ('b211bbe7-79c2-4265-8097-5a4984bb4c6f',2,NULL,'fa-clock-o','The Test project\'s trial period will expire on August 23rd.','Subscribe','/settings/projects/2#/subscription',1,'2017-08-16 04:35:46','2017-08-16 04:35:54'), ('d9b647e5-db5d-49b0-a84a-e22dc44db426',1,NULL,'fa-users','You have been invited to join the Test project!','View Invitations','/settings#/projects',1,'2017-08-17 01:50:40','2017-08-18 01:12:19'), ('e4d698ca-2989-457e-9cf4-43c1bec6a8e8',1,NULL,'fa-users','You have been invited to join the Test project!','View Invitations','/settings#/projects',1,'2017-08-17 01:51:33','2017-08-18 01:12:19'); /*!40000 ALTER TABLE `notifications` ENABLE KEYS */; UNLOCK TABLES; # Dump of table password_resets # ------------------------------------------------------------ CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, KEY `password_resets_email_index` (`email`), KEY `password_resets_token_index` (`token`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table performance_indicators # ------------------------------------------------------------ CREATE TABLE `performance_indicators` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `monthly_recurring_revenue` decimal(8,2) NOT NULL, `yearly_recurring_revenue` decimal(8,2) NOT NULL, `daily_volume` decimal(8,2) NOT NULL, `new_users` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `performance_indicators_created_at_index` (`created_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table research_collection_research_item # ------------------------------------------------------------ CREATE TABLE `research_collection_research_item` ( `research_collection_id` int(10) unsigned DEFAULT NULL, `research_item_id` int(10) unsigned DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table research_collections # ------------------------------------------------------------ CREATE TABLE `research_collections` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` text COLLATE utf8mb4_unicode_ci NOT NULL, `description` text COLLATE utf8mb4_unicode_ci, `site_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table research_items # ------------------------------------------------------------ CREATE TABLE `research_items` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `slug` text COLLATE utf8mb4_unicode_ci, `rawtext` text COLLATE utf8mb4_unicode_ci, `description` text COLLATE utf8mb4_unicode_ci, `summary` text COLLATE utf8mb4_unicode_ci, `summary_raw` text COLLATE utf8mb4_unicode_ci, `keywords` text COLLATE utf8mb4_unicode_ci, `keywords_raw` text COLLATE utf8mb4_unicode_ci, `topics` text COLLATE utf8mb4_unicode_ci, `topics_raw` text COLLATE utf8mb4_unicode_ci, `mood` decimal(8,2) DEFAULT NULL, `positive` decimal(8,2) DEFAULT NULL, `negative` decimal(8,2) DEFAULT NULL, `anger` decimal(8,2) DEFAULT NULL, `fear` decimal(8,2) DEFAULT NULL, `jealousy` decimal(8,2) DEFAULT NULL, `joy` decimal(8,2) DEFAULT NULL, `love` decimal(8,2) DEFAULT NULL, `sadness` decimal(8,2) DEFAULT NULL, `absolutistic` decimal(8,2) DEFAULT NULL, `achievist` decimal(8,2) DEFAULT NULL, `exploitive` decimal(8,2) DEFAULT NULL, `instinctive` decimal(8,2) DEFAULT NULL, `relativistic` decimal(8,2) DEFAULT NULL, `systemic` decimal(8,2) DEFAULT NULL, `tribalistic` decimal(8,2) DEFAULT NULL, `lowerleft` decimal(8,2) DEFAULT NULL, `lowerright` decimal(8,2) DEFAULT NULL, `upperleft` decimal(8,2) DEFAULT NULL, `upperright` decimal(8,2) DEFAULT NULL, `abstract` decimal(8,2) DEFAULT NULL, `concrete` decimal(8,2) DEFAULT NULL, `user_id` int(11) DEFAULT NULL, `parent_id` int(11) DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `tags_raw` text COLLATE utf8mb4_unicode_ci, `processedtext` text COLLATE utf8mb4_unicode_ci, `concepts_raw` text COLLATE utf8mb4_unicode_ci, `site_id` text COLLATE utf8mb4_unicode_ci NOT NULL, `uid` text COLLATE utf8mb4_unicode_ci, `version` text COLLATE utf8mb4_unicode_ci, `watson_analysis` longtext COLLATE utf8mb4_unicode_ci, `uclassify_analysis` longtext COLLATE utf8mb4_unicode_ci, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table subscriptions # ------------------------------------------------------------ CREATE TABLE `subscriptions` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `stripe_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `stripe_plan` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `quantity` int(11) NOT NULL, `trial_ends_at` timestamp NULL DEFAULT NULL, `ends_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table taggables # ------------------------------------------------------------ CREATE TABLE `taggables` ( `tag_id` int(10) unsigned NOT NULL, `taggable_id` int(10) unsigned NOT NULL, `taggable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, KEY `taggables_tag_id_foreign` (`tag_id`), CONSTRAINT `taggables_tag_id_foreign` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table tags # ------------------------------------------------------------ CREATE TABLE `tags` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` text COLLATE utf8mb4_unicode_ci NOT NULL, `slug` text COLLATE utf8mb4_unicode_ci, `type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `order_column` int(11) DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table team_subscriptions # ------------------------------------------------------------ CREATE TABLE `team_subscriptions` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `team_id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `stripe_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `stripe_plan` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `quantity` int(11) NOT NULL, `trial_ends_at` timestamp NULL DEFAULT NULL, `ends_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; # Dump of table team_users # ------------------------------------------------------------ CREATE TABLE `team_users` ( `team_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `role` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL, UNIQUE KEY `team_users_team_id_user_id_unique` (`team_id`,`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; LOCK TABLES `team_users` WRITE; /*!40000 ALTER TABLE `team_users` DISABLE KEYS */; INSERT INTO `team_users` (`team_id`, `user_id`, `role`) VALUES (1,1,'owner'), (2,2,'owner'), (4,3,'owner'); /*!40000 ALTER TABLE `team_users` ENABLE KEYS */; UNLOCK TABLES; # Dump of table teams # ------------------------------------------------------------ CREATE TABLE `teams` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `owner_id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `slug` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `photo_url` text COLLATE utf8mb4_unicode_ci, `stripe_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `current_billing_plan` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `card_brand` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `card_last_four` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `card_country` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_address_line_2` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_city` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_state` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_zip` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_country` varchar(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `vat_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `extra_billing_information` text COLLATE utf8mb4_unicode_ci, `trial_ends_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `teams_slug_unique` (`slug`), KEY `teams_owner_id_index` (`owner_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; LOCK TABLES `teams` WRITE; /*!40000 ALTER TABLE `teams` DISABLE KEYS */; INSERT INTO `teams` (`id`, `owner_id`, `name`, `slug`, `photo_url`, `stripe_id`, `current_billing_plan`, `card_brand`, `card_last_four`, `card_country`, `billing_address`, `billing_address_line_2`, `billing_city`, `billing_state`, `billing_zip`, `billing_country`, `vat_id`, `extra_billing_information`, `trial_ends_at`, `created_at`, `updated_at`) VALUES (1,1,'Mythic',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2017-08-23 04:33:56','2017-08-16 04:33:56','2017-08-16 04:33:56'), (2,2,'Test',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2017-08-23 04:35:46','2017-08-16 04:35:46','2017-08-16 04:35:46'), (4,3,'Test',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2017-08-24 01:39:23','2017-08-17 01:39:23','2017-08-17 01:39:23'); /*!40000 ALTER TABLE `teams` ENABLE KEYS */; UNLOCK TABLES; # Dump of table users # ------------------------------------------------------------ CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `password` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `photo_url` text COLLATE utf8mb4_unicode_ci, `uses_two_factor_auth` tinyint(4) NOT NULL DEFAULT '0', `authy_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `country_code` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `phone` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `two_factor_reset_code` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `current_team_id` int(11) DEFAULT NULL, `stripe_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `current_billing_plan` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `card_brand` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `card_last_four` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `card_country` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_address_line_2` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_city` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_state` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_zip` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `billing_country` varchar(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `vat_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `extra_billing_information` text COLLATE utf8mb4_unicode_ci, `trial_ends_at` timestamp NULL DEFAULT NULL, `last_read_announcements_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `auth0id` varchar(244) COLLATE utf8mb4_unicode_ci NOT NULL, `picture` varchar(244) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `picture_large` varchar(244) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `gender` varchar(244) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `given_name` varchar(244) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `family_name` varchar(244) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `locale` varchar(244) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; LOCK TABLES `users` WRITE; /*!40000 ALTER TABLE `users` DISABLE KEYS */; INSERT INTO `users` (`id`, `name`, `email`, `password`, `remember_token`, `photo_url`, `uses_two_factor_auth`, `authy_id`, `country_code`, `phone`, `two_factor_reset_code`, `current_team_id`, `stripe_id`, `current_billing_plan`, `card_brand`, `card_last_four`, `card_country`, `billing_address`, `billing_address_line_2`, `billing_city`, `billing_state`, `billing_zip`, `billing_country`, `vat_id`, `extra_billing_information`, `trial_ends_at`, `last_read_announcements_at`, `created_at`, `updated_at`, `auth0id`, `picture`, `picture_large`, `gender`, `given_name`, `family_name`, `locale`) VALUES (1,'Hunter Carter','huntercarter@gmail.com',NULL,'Ch0E3QhlZgyEdyPZrHnCPY7yiObwMSiQkg2xmZmBnFJXFwqVjJ9xBGtTca5y',NULL,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2017-08-16 04:33:47','2017-08-16 04:33:57','google-oauth2|114807777070269090907',NULL,NULL,NULL,NULL,NULL,NULL), (3,'Hunter Carter','jameshuntercarter@gmail.com',NULL,'IVN1bPPsF6o6FNvGbHSR8YJyIMAkFV9GBO1vd7q6gxjZLNZOaGnezsicDJEv',NULL,0,NULL,NULL,NULL,NULL,4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2017-08-16 21:13:48','2017-08-17 01:39:23','google-oauth2|101883998741738711728',NULL,NULL,NULL,NULL,NULL,NULL), (4,'abcdefg@example.com','abcdefg@example.com',NULL,'NGO8eqxFy1ifFFpy444g0OUNfSMm6dRAV0QlHLOrppy2IQg1D5hCSENRG37p',NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2017-08-17 00:34:04','2017-08-17 00:34:04','auth0|5994e47711a5631c8ff782b0',NULL,NULL,NULL,NULL,NULL,NULL); /*!40000 ALTER TABLE `users` ENABLE KEYS */; UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
the_stack
DROP TABLE IF EXISTS `blocker`; CREATE TABLE `blocker` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `blocker_type` VARCHAR(255) NOT NULL, `capacity` int(11) NOT NULL, `load` int(11) NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `IDX_blocker_IDX_LOAD` (`load`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `blocker` (`id`, `blocker_type`, `capacity`, `load`, `created`, `updated`) VALUES (1,'Arista-ACL', 100, 0, '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (2,'GoBGP-RTBH', 100, 0, '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (3,'GoBGP-FlowSpec', 100, 0, '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (100,'GoBGP-RTBH', 5, 0, '2017-04-13 13:44:34', '2017-04-13 13:44:34'); # blocker_parameters # ------------------------------------------------------------ DROP TABLE IF EXISTS `blocker_parameter`; CREATE TABLE `blocker_parameter` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `blocker_id` bigint(20) NOT NULL, `key` VARCHAR(255) NOT NULL, `value` VARCHAR(255) NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY(`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `blocker_parameter` (`id`, `blocker_id`, `key`, `value`, `created`, `updated`) VALUES (1, 1, 'nextHop', '0.0.0.1', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (2, 1, 'host', '127.0.0.1', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (3, 1, 'port', '50051', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (4, 2, 'nextHop', '0.0.0.1', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (5, 2, 'host', '127.0.0.1', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (6, 2, 'port', '50051', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (7, 3, 'nextHop', '0.0.0.1', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (8, 3, 'host', '127.0.0.1', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (9, 3, 'port', '50051', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (10, 100, 'nextHop', '1.0.0.2', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (11, 100, 'host', '127.1.1.1', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (12, 100, 'port', '50051', '2017-04-13 13:44:34', '2017-04-13 13:44:34'); # customer # ------------------------------------------------------------ DROP TABLE IF EXISTS `customer`; CREATE TABLE `customer` ( `id` int(11) NOT NULL AUTO_INCREMENT, `common_name` varchar(255) NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `customer` (`id`, `common_name`, `created`, `updated`) VALUES (123,'name','2017-04-13 13:44:34','2017-04-13 13:44:34'), (127,'localhost','2017-04-13 13:44:34','2017-04-13 13:44:34'), (128,'client.sample.example.com','2017-04-13 13:44:34','2017-04-13 13:44:34'); # parameter_value # ------------------------------------------------------------ DROP TABLE IF EXISTS `parameter_value`; CREATE TABLE `parameter_value` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `customer_id` int(11) DEFAULT NULL, `mitigation_scope_id` bigint(20) DEFAULT NULL, `type` enum('TARGET_PROTOCOL','FQDN','URI','TRAFFIC_PROTOCOL','ALIAS_NAME') NOT NULL, `string_value` varchar(255) DEFAULT NULL, `int_value` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `parameter_value` (`id`, `customer_id`, `mitigation_scope_id`, `type`, `string_value`, `int_value`, `created`, `updated`) VALUES (1,123,0,'FQDN','golang.org',0,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (2,127,0,'FQDN','localhost.local',0,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (3,128,0,'FQDN','client.sample.example.com',0,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (4,0,1,'FQDN','client.sample.example.com',0,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (5,0,2,'FQDN','client.sample.example.com',0,'2017-04-13 13:44:34','2017-04-13 13:44:34'); # port_range # ------------------------------------------------------------ DROP TABLE IF EXISTS `port_range`; CREATE TABLE `port_range` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `mitigation_scope_id` bigint(20) DEFAULT NULL, `type` enum('TARGET_PORT','SOURCE_PORT') NOT NULL, `lower_port` int(11) DEFAULT NULL, `upper_port` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `port_range` (`id`, `mitigation_scope_id`, `type`, `lower_port`, `upper_port`, `created`, `updated`) VALUES (1,1,'TARGET_PORT',10000,40000,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (2,2,'SOURCE_PORT',10000,65535,'2017-04-13 13:44:34','2017-04-13 13:44:34'); # icmp_type_range # ------------------------------------------------------------ DROP TABLE IF EXISTS `icmp_type_range`; CREATE TABLE `icmp_type_range` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `mitigation_scope_id` bigint(20) DEFAULT NULL, `lower_type` int(11) DEFAULT NULL, `upper_type` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `icmp_type_range` (`id`, `mitigation_scope_id`, `lower_type`, `upper_type`, `created`, `updated`) VALUES (1,1,10,11,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (2,2,12,13,'2017-04-13 13:44:34','2017-04-13 13:44:34'); # prefix # ------------------------------------------------------------ DROP TABLE IF EXISTS `prefix`; CREATE TABLE `prefix` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `customer_id` int(11) DEFAULT NULL, `mitigation_scope_id` bigint(20) DEFAULT NULL, `type` enum('TARGET_PREFIX','SOURCE_PREFIX','SOURCE_IPV4_NETWORK','DESTINATION_IPV4_NETWORK','IP','PREFIX','ADDRESS_RANGE','IP_ADDRESS','TARGET_IP') NOT NULL, `addr` varchar(255) DEFAULT NULL, `prefix_len` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; INSERT INTO `prefix` (`id`, `customer_id`, `mitigation_scope_id`, `type`, `addr`, `prefix_len`, `created`, `updated`) VALUES (1,123,0,'ADDRESS_RANGE','192.168.1.0',24,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (2,127,0,'ADDRESS_RANGE','129.0.0.1',32,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (3,127,0,'ADDRESS_RANGE','2003:db8:6401::',64,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (4,127,0,'ADDRESS_RANGE','2003:db8:6402::',64,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (5,128,0,'ADDRESS_RANGE','127.0.0.1',32,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (6,128,0,'ADDRESS_RANGE','10.100.0.0',24,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (7,128,0,'ADDRESS_RANGE','10.101.0.0',24,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (8,128,0,'ADDRESS_RANGE','2002:db8:6401::',64,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (9,128,0,'ADDRESS_RANGE','2002:db8:6402::',64,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (10,0,1,'TARGET_IP','2002:db8:6401::',64,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (11,0,1,'TARGET_PREFIX','2002:db8:6401::',64,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (12,0,2,'TARGET_IP','2002:db8:6402::',64,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (13,0,2,'TARGET_PREFIX','2002:db8:6402::',64,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (14,128,0,'ADDRESS_RANGE','1.1.1.69',32,'2017-11-11 20:09:00','2017-11-11 20:09:00'), (15,128,0,'ADDRESS_RANGE','1.1.2.0',24,'2017-11-11 20:09:00','2017-11-11 20:09:00'); # prefix trigger when ip address range change # ------------------------------------------------------------ DROP FUNCTION IF EXISTS MySQLNotification; CREATE FUNCTION MySQLNotification RETURNS INTEGER SONAME 'mysql-notification.so'; DELIMITER @@ CREATE TRIGGER address_range_trigger AFTER UPDATE ON prefix FOR EACH ROW BEGIN IF (NEW.type = 'ADDRESS_RANGE') AND (NEW.addr <> OLD.addr OR NEW.prefix_len <> OLD.prefix_len) THEN SELECT MySQLNotification('prefix', NEW.customer_id) INTO @x; END IF; END@@ DELIMITER ; # mitigation_scope # ------------------------------------------------------------ DROP TABLE IF EXISTS `mitigation_scope`; CREATE TABLE `mitigation_scope` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `customer_id` int(11) DEFAULT NULL, `client_identifier` varchar(255) DEFAULT NULL, `client_domain_identifier` varchar(255) DEFAULT NULL, `mitigation_id` int(11) DEFAULT NULL, `status` int(1) DEFAULT NULL, `lifetime` int(11) DEFAULT NULL, `trigger-mitigation` tinyint(1) DEFAULT NULL, `attack-status` int(1) DEFAULT NULL, `acl_name` varchar(255) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `mitigation_scope` (`id`, `customer_id`, `client_identifier`, `client_domain_identifier`, `mitigation_id`, `status`, `lifetime`, `trigger-mitigation`,`created`, `updated`) VALUES (1,128,'','',12332,7,1000, 1,'2017-04-13 13:44:34','2017-04-13 13:44:34'), (2,128,'','',12333,7,1000, 1,'2017-04-13 13:44:34','2017-04-13 13:44:34'); # mitigation_scope trigger when status change # ------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER status_changed_trigger AFTER UPDATE ON mitigation_scope FOR EACH ROW BEGIN IF NEW.status <> OLD.status THEN SELECT MySQLNotification('mitigation_scope', NEW.id, NEW.customer_id, NEW.client_identifier, NEW.mitigation_id, NEW.client_domain_identifier, NEW.status) INTO @x; END IF; END@@ DELIMITER ; # signal_session_configuration # ------------------------------------------------------------ DROP TABLE IF EXISTS `signal_session_configuration`; CREATE TABLE `signal_session_configuration` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `session_id` int(11) NOT NULL, `heartbeat_interval` int(11) DEFAULT NULL, `missing_hb_allowed` int(11) DEFAULT NULL, `max_retransmit` int(11) DEFAULT NULL, `ack_timeout` double DEFAULT NULL, `ack_random_factor` double DEFAULT NULL, `heartbeat_interval_idle` int(11) DEFAULT NULL, `missing_hb_allowed_idle` int(11) DEFAULT NULL, `max_retransmit_idle` int(11) DEFAULT NULL, `ack_timeout_idle` double DEFAULT NULL, `ack_random_factor_idle` double DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `IDX_signal_session_configuration_idx_customer_id` (`customer_id`), KEY `IDX_signal_session_configuration_idx_session_id` (`session_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # signal_session_configuration trigger when any configuration change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER session_configuration_changed_trigger AFTER UPDATE ON signal_session_configuration FOR EACH ROW BEGIN IF (NEW.heartbeat_interval <> OLD.heartbeat_interval) OR (NEW.missing_hb_allowed <> OLD.missing_hb_allowed) OR (NEW.max_retransmit <> OLD.max_retransmit) OR (NEW.ack_timeout <> OLD.ack_timeout) OR (NEW.ack_random_factor <> OLD.ack_random_factor) OR (NEW.heartbeat_interval_idle <> OLD.heartbeat_interval_idle) OR (NEW.missing_hb_allowed_idle <> OLD.missing_hb_allowed_idle) OR (NEW.max_retransmit_idle <> OLD.max_retransmit_idle) OR (NEW.ack_timeout_idle <> OLD.ack_timeout_idle) OR (NEW.ack_random_factor_idle <> OLD.ack_random_factor_idle) THEN SELECT MySQLNotification('signal_session_configuration', NEW.customer_id, NEW.session_id) INTO @x; END IF; END@@ DELIMITER ; # protection # ------------------------------------------------------------ DROP TABLE IF EXISTS `protection`; CREATE TABLE `protection` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `customer_id` INT(11) NOT NULL, `target_id` BIGINT(20) NOT NULL, `target_type` VARCHAR(255) NOT NULL, `acl_name` VARCHAR(255) DEFAULT NULL, `is_enabled` TINYINT(1) NOT NULL, `protection_type` VARCHAR(255) NOT NULL, `target_blocker_id` BIGINT(20) DEFAULT NULL, `started_at` DATETIME DEFAULT NULL, `finished_at` DATETIME DEFAULT NULL, `record_time` DATETIME DEFAULT NULL, `dropped_data_info_id` BIGINT(20) DEFAULT NULL, `created` DATETIME DEFAULT NULL, `updated` DATETIME DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; insert into `protection` (id, customer_id, target_id, target_type, is_enabled, protection_type, target_blocker_id, started_at, finished_at, record_time, dropped_data_info_id, `created`, `updated`) VALUES (100, 128, 1, 'mitigation_request', false, 'RTBH', 1, null, null, null, 1, '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (101, 128, 2, 'datachannel_acl', false, 'RTBH', 1, null, null, null, 2, '2017-04-13 13:44:34', '2017-04-13 13:44:34'); # gobgp_parameter # ------------------------------------------------------------ DROP TABLE IF EXISTS `go_bgp_parameter`; CREATE TABLE `go_bgp_parameter` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `protection_id` BIGINT(20) NOT NULL, `target_address` varchar(255) NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; insert into `go_bgp_parameter` (id, protection_id, target_address, `created`, `updated`) VALUES (1, 100, '192.168.240.0', '2017-04-13 13:44:34', '2017-04-13 13:44:34'); # protection_status # ------------------------------------------------------------ DROP TABLE IF EXISTS `protection_status`; CREATE TABLE `protection_status` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `bytes_dropped` int(11) DEFAULT NULL, `pkts_dropped` int(11) DEFAULT NULL, `bps_dropped` int(11) DEFAULT NULL, `pps_dropped` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; insert into protection_status (id, bytes_dropped, pkts_dropped, bps_dropped, pps_dropped, created, updated) VALUES (1, 0, 0, 0, 0, '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (2, 16, 1, 4, 1, '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (3, 40, 2, 5, 1, '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (4, 100, 3, 10, 1, '2017-04-13 13:44:34', '2017-04-13 13:44:34'); # data_clients # ------------------------------------------------------------ DROP TABLE IF EXISTS `data_clients`; CREATE TABLE `data_clients` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `customer_id` INT(11) NOT NULL, `cuid` VARCHAR(255) NOT NULL, `cdid` VARCHAR(255), PRIMARY KEY (`id`), KEY `IDX_data_clients_idx_customer_id_cuid` (`customer_id`, `cuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `data_clients` ADD CONSTRAINT UC_dots_clients UNIQUE (`customer_id`, `cuid`); # data_aliases # ------------------------------------------------------------ DROP TABLE IF EXISTS `data_aliases`; CREATE TABLE `data_aliases` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `data_client_id` BIGINT(20) NOT NULL, `name` VARCHAR(255) NOT NULL, `content` TEXT NOT NULL, `valid_through` DATETIME NOT NULL, PRIMARY KEY (`id`), KEY `IDX_data_aliases_idx_data_client_id_name` (`data_client_id`, `name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `data_aliases` ADD CONSTRAINT UC_dots_aliases UNIQUE (`data_client_id`, `name`); # data_acls # ------------------------------------------------------------ DROP TABLE IF EXISTS `data_acls`; CREATE TABLE `data_acls` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `data_client_id` BIGINT(20) NOT NULL, `name` VARCHAR(255) NOT NULL, `content` TEXT NOT NULL, `valid_through` DATETIME NOT NULL, PRIMARY KEY (`id`), KEY `IDX_data_acls_idx_data_client_id_name` (`data_client_id`, `name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `data_acls` ADD CONSTRAINT UC_dots_acls UNIQUE (`data_client_id`, `name`); # data_acls trigger when activaton_type change # ------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER activaton_type_changed_trigger AFTER UPDATE ON data_acls FOR EACH ROW BEGIN DECLARE newContent VARCHAR(255) DEFAULT NULL; DECLARE currentContent VARCHAR(255) DEFAULT NULL; SELECT SUBSTRING_INDEX(NEW.content,",", 3) INTO newContent FROM data_acls limit 1; SELECT SUBSTRING_INDEX(OLD.content,",", 3) INTO currentContent FROM data_acls limit 1; IF SUBSTRING_INDEX(newContent,"activation-type", -1) <> SUBSTRING_INDEX(currentContent,"activation-type", -1) THEN SELECT MySQLNotification('data_acls', NEW.id) INTO @x; END IF; END@@ DELIMITER ; # arista_parameter # ------------------------------------------------------------ DROP TABLE IF EXISTS `arista_parameter`; CREATE TABLE `arista_parameter` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `protection_id` bigint(20) NOT NULL, `acl_type` varchar(255) NOT NULL, `acl_filtering_rule` text NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # blocker_configuration # ------------------------------------------------------------ DROP TABLE IF EXISTS `blocker_configuration`; CREATE TABLE `blocker_configuration` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `target_type` VARCHAR(255) NOT NULL, `blocker_type` VARCHAR(255) NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `blocker_configuration` (`id`, `customer_id`, `target_type`, `blocker_type`, `created`, `updated`) VALUES (1, 128, "mitigation_request", "GoBGP-RTBH", '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (2, 128, "datachannel_acl", "Arista-ACL", '2017-04-13 13:44:34', '2017-04-13 13:44:34'); # blocker_configuration_parameter # ------------------------------------------------------------ DROP TABLE IF EXISTS `blocker_configuration_parameter`; CREATE TABLE `blocker_configuration_parameter` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `blocker_configuration_id` int(11) NOT NULL, `key` VARCHAR(255) NOT NULL, `value` VARCHAR(255) NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `blocker_configuration_parameter` (`id`, `blocker_configuration_id`, `key`, `value`, `created`, `updated`) VALUES (1, 1, 'vrf', '1.1.1.1:100', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (2, 1, 'aristaConnection', 'arista', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (3, 1, 'aristaInterface', 'Ethernet 1', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (4, 2, 'aristaConnection', 'arista', '2017-04-13 13:44:34', '2017-04-13 13:44:34'), (5, 2, 'aristaInterface', 'Ethernet 1', '2017-04-13 13:44:34', '2017-04-13 13:44:34'); # flow_spec_parameter # ------------------------------------------------------------ DROP TABLE IF EXISTS `flow_spec_parameter`; CREATE TABLE `flow_spec_parameter` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `protection_id` bigint(20) NOT NULL, `flow_type` varchar(255) NOT NULL, `flow_specification` text NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # control_filtering # ------------------------------------------------------------ DROP TABLE IF EXISTS `control_filtering`; CREATE TABLE `control_filtering` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `mitigation_scope_id` bigint(20) DEFAULT NULL, `acl_name` varchar(255) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_setup # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_setup`; CREATE TABLE `telemetry_setup` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `cuid` varchar(255) NOT NULL, `cdid` varchar(255) DEFAULT NULL, `tsid` int(11) NOT NULL, `setup_type` enum('TELEMETRY_CONFIGURATION','PIPE','BASELINE') NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_configuration # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_configuration`; CREATE TABLE `telemetry_configuration` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_setup_id` bigint(20) NOT NULL, `measurement_interval` enum('HOUR','DAY','WEEK','MONTH') NOT NULL, `measurement_sample` enum('SECOND','5_SECONDS','30_SECONDS','ONE_MINUTE','5_MINUTES','10_MINUTES','30_MINUTES','ONE_HOUR') NOT NULL, `low_percentile` double DEFAULT NULL, `mid_percentile` double DEFAULT NULL, `high_percentile` double DEFAULT NULL, `server_originated_telemetry` tinyint(1) NOT NULL, `telemetry_notify_interval` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # unit_configuration # ------------------------------------------------------------ DROP TABLE IF EXISTS `unit_configuration`; CREATE TABLE `unit_configuration` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_config_id` bigint(20) NOT NULL, `unit` enum('PACKETS_PS','BITS_PS','BYTES_PS') NOT NULL, `unit_status` tinyint(1) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # total_pipe_capability # ------------------------------------------------------------ DROP TABLE IF EXISTS `total_pipe_capacity`; CREATE TABLE `total_pipe_capacity` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_setup_id` bigint(20) NOT NULL, `link_id` varchar(255) DEFAULT NULL, `capacity` int(11) DEFAULT NULL, `unit` enum('PACKETS_PS','BITS_PS','BYTES_PS','KILOPACKETS_PS','KILOBITS_PS','KILOBYTES_PS','MEGAPACKETS_PS','MEGABITS_PS','MEGABYTES_PS','GIGAPACKETS_PS','GIGABITS_PS','GIGABYTES_PS','TERAPACKETS_PS','TERABITS_PS','TERABYTES_PS') NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # baseline # ------------------------------------------------------------ DROP TABLE IF EXISTS `baseline`; CREATE TABLE `baseline` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_setup_id` bigint(20) NOT NULL, `baseline_id` int(11) NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_prefix # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_prefix`; CREATE TABLE `telemetry_prefix` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `type` enum('TELEMETRY','TELEMETRY_SETUP') NOT NULL, `type_id` bigint(20) NOT NULL, `prefix_type` enum('TARGET_PREFIX','SOURCE_PREFIX') NOT NULL, `addr` varchar(255) DEFAULT NULL, `prefix_len` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; # telemetry_port_range # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_port_range`; CREATE TABLE `telemetry_port_range` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `type` enum('TELEMETRY','TELEMETRY_SETUP') NOT NULL, `type_id` bigint(20) NOT NULL, `prefix_type` enum('TARGET_PREFIX','SOURCE_PREFIX') NOT NULL, `lower_port` int(11) NOT NULL, `upper_port` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_parameter_value # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_parameter_value`; CREATE TABLE `telemetry_parameter_value` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `type` enum('TELEMETRY','TELEMETRY_SETUP') NOT NULL, `type_id` bigint(20) NOT NULL, `parameter_type` enum('TARGET_PROTOCOL','FQDN','URI','ALIAS_NAME') NOT NULL, `string_value` varchar(255) DEFAULT NULL, `int_value` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # traffic # ------------------------------------------------------------ DROP TABLE IF EXISTS `traffic`; CREATE TABLE `traffic` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `type` enum('TELEMETRY','TELEMETRY_SETUP') NOT NULL, `prefix_type` enum('TARGET_PREFIX','SOURCE_PREFIX') NOT NULL, `type_id` bigint(20) NOT NULL, `traffic_type` enum('TOTAL_TRAFFIC_NORMAL','TOTAL_ATTACK_TRAFFIC','TOTAL_TRAFFIC') NOT NULL, `unit` enum('PACKETS_PS','BITS_PS','BYTES_PS','KILOPACKETS_PS','KILOBITS_PS','KILOBYTES_PS','MEGAPACKETS_PS','MEGABITS_PS','MEGABYTES_PS','GIGAPACKETS_PS','GIGABITS_PS','GIGABYTES_PS','TERAPACKETS_PS','TERABITS_PS','TERABYTES_PS') NOT NULL, `low_percentile_g` int(11) DEFAULT NULL, `mid_percentile_g` int(11) DEFAULT NULL, `high_percentile_g` int(11) DEFAULT NULL, `peak_g` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # traffic_per_protocol # ------------------------------------------------------------ DROP TABLE IF EXISTS `traffic_per_protocol`; CREATE TABLE `traffic_per_protocol` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `type` enum('TELEMETRY','TELEMETRY_SETUP') NOT NULL, `type_id` bigint(20) NOT NULL, `traffic_type` enum('TOTAL_TRAFFIC_NORMAL','TOTAL_ATTACK_TRAFFIC','TOTAL_TRAFFIC') NOT NULL, `unit` enum('PACKETS_PS','BITS_PS','BYTES_PS','KILOPACKETS_PS','KILOBITS_PS','KILOBYTES_PS','MEGAPACKETS_PS','MEGABITS_PS','MEGABYTES_PS','GIGAPACKETS_PS','GIGABITS_PS','GIGABYTES_PS','TERAPACKETS_PS','TERABITS_PS','TERABYTES_PS') NOT NULL, `protocol` int(11) NOT NULL, `low_percentile_g` int(11) DEFAULT NULL, `mid_percentile_g` int(11) DEFAULT NULL, `high_percentile_g` int(11) DEFAULT NULL, `peak_g` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # traffic_per_port # ------------------------------------------------------------ DROP TABLE IF EXISTS `traffic_per_port`; CREATE TABLE `traffic_per_port` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `type` enum('TELEMETRY','TELEMETRY_SETUP') NOT NULL, `type_id` bigint(20) NOT NULL, `traffic_type` enum('TOTAL_TRAFFIC_NORMAL','TOTAL_ATTACK_TRAFFIC','TOTAL_TRAFFIC') NOT NULL, `unit` enum('PACKETS_PS','BITS_PS','BYTES_PS','KILOPACKETS_PS','KILOBITS_PS','KILOBYTES_PS','MEGAPACKETS_PS','MEGABITS_PS','MEGABYTES_PS','GIGAPACKETS_PS','GIGABITS_PS','GIGABYTES_PS','TERAPACKETS_PS','TERABITS_PS','TERABYTES_PS') NOT NULL, `port` int(11) NOT NULL, `low_percentile_g` int(11) DEFAULT NULL, `mid_percentile_g` int(11) DEFAULT NULL, `high_percentile_g` int(11) DEFAULT NULL, `peak_g` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # total_connection_capacity # ------------------------------------------------------------ DROP TABLE IF EXISTS `total_connection_capacity`; CREATE TABLE `total_connection_capacity` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_baseline_id` bigint(20) NOT NULL, `protocol` int(11) NOT NULL, `connection` int(11) DEFAULT NULL, `connection_client` int(11) DEFAULT NULL, `embryonic` int(11) DEFAULT NULL, `embryonic_client` int(11) DEFAULT NULL, `connection_ps` int(11) DEFAULT NULL, `connection_client_ps` int(11) DEFAULT NULL, `request_ps` int(11) DEFAULT NULL, `request_client_ps` int(11) DEFAULT NULL, `partial_request_ps` int(11) DEFAULT NULL, `partial_request_client_ps` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # total_connection_capacity_per_port # ------------------------------------------------------------ DROP TABLE IF EXISTS `total_connection_capacity_per_port`; CREATE TABLE `total_connection_capacity_per_port` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_baseline_id` bigint(20) NOT NULL, `protocol` int(11) NOT NULL, `port` int(11) NOT NULL, `connection` int(11) DEFAULT NULL, `connection_client` int(11) DEFAULT NULL, `embryonic` int(11) DEFAULT NULL, `embryonic_client` int(11) DEFAULT NULL, `connection_ps` int(11) DEFAULT NULL, `connection_client_ps` int(11) DEFAULT NULL, `request_ps` int(11) DEFAULT NULL, `request_client_ps` int(11) DEFAULT NULL, `partial_request_ps` int(11) DEFAULT NULL, `partial_request_client_ps` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_pre_mitigation # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_pre_mitigation`; CREATE TABLE `telemetry_pre_mitigation` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `cuid` varchar(255) NOT NULL, `cdid` varchar(255) DEFAULT NULL, `tmid` int(11) NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_pre_mitigation trigger when any attribute of telemetry_pre_mitigation change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER telemetry_pre_mitigation_trigger AFTER UPDATE ON telemetry_pre_mitigation FOR EACH ROW BEGIN IF NEW.updated <> OLD.updated THEN SELECT MySQLNotification('telemetry_pre_mitigation', NEW.id) INTO @x; END IF; END@@ DELIMITER ; # total_attack_connection # ------------------------------------------------------------ DROP TABLE IF EXISTS `total_attack_connection`; CREATE TABLE `total_attack_connection` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `prefix_type` enum('TARGET_PREFIX','SOURCE_PREFIX') NOT NULL, `prefix_type_id` bigint(20) NOT NULL, `percentile_type` enum('LOW_PERCENTILE_L','MID_PERCENTILE_L','HIGH_PERCENTILE_L','PEAK_L') NOT NULL, `protocol` int(11) NOT NULL, `connection` int(11) DEFAULT NULL, `embryonic` int(11) DEFAULT NULL, `connection_ps` int(11) DEFAULT NULL, `request_ps` int(11) DEFAULT NULL, `partial_request_ps`int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # total_attack_connection_port # ------------------------------------------------------------ DROP TABLE IF EXISTS `total_attack_connection_port`; CREATE TABLE `total_attack_connection_port` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_pre_mitigation_id` bigint(20) NOT NULL, `percentile_type` enum('LOW_PERCENTILE_L','MID_PERCENTILE_L','HIGH_PERCENTILE_L','PEAK_L') NOT NULL, `protocol` int(11) NOT NULL, `port` int(11) NOT NULL, `connection` int(11) DEFAULT NULL, `embryonic` int(11) DEFAULT NULL, `connection_ps` int(11) DEFAULT NULL, `request_ps` int(11) DEFAULT NULL, `partial_request_ps` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # attack_detail # ------------------------------------------------------------ DROP TABLE IF EXISTS `attack_detail`; CREATE TABLE `attack_detail` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_pre_mitigation_id` bigint(20), `vendor_id` int(11) NOT NULL, `attack_id` int(11) NOT NULL, `attack_name` varchar(255), `attack_severity` enum('NONE','LOW','MEDIUM','HIGH','UNKNOWN') NOT NULL, `start_time` int(11), `end_time` int(11), `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # source_count # ------------------------------------------------------------ DROP TABLE IF EXISTS `source_count`; CREATE TABLE `source_count` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_attack_detail_id` bigint(20) NOT NULL, `low_percentile_g` int(11), `mid_percentile_g` int(11), `high_percentile_g` int(11), `peak_g` int(11), `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # top_talker # ------------------------------------------------------------ DROP TABLE IF EXISTS `top_talker`; CREATE TABLE `top_talker` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_attack_detail_id` bigint(20) NOT NULL, `spoofed_status` tinyint(1), `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_icmp_type_range # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_icmp_type_range`; CREATE TABLE `telemetry_icmp_type_range` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_top_talker_id` bigint(20) NOT NULL, `lower_type` int(11) NOT NULL, `upper_type` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_traffic # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_traffic`; CREATE TABLE `telemetry_traffic` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `prefix_type` enum('TARGET_PREFIX','SOURCE_PREFIX') NOT NULL, `prefix_type_id` bigint(20) NOT NULL, `traffic_type` enum('TOTAL_ATTACK_TRAFFIC','TOTAL_TRAFFIC') NOT NULL, `unit` enum('PACKETS_PS','BITS_PS','BYTES_PS','KILOPACKETS_PS','KILOBITS_PS','KILOBYTES_PS','MEGAPACKETS_PS','MEGABITS_PS','MEGABYTES_PS','GIGAPACKETS_PS','GIGABITS_PS','GIGABYTES_PS','TERAPACKETS_PS','TERABITS_PS','TERABYTES_PS') NOT NULL, `protocol` int(11) NOT NULL, `low_percentile_g` int(11) DEFAULT NULL, `mid_percentile_g` int(11) DEFAULT NULL, `high_percentile_g` int(11) DEFAULT NULL, `peak_g` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `telemetry_traffic` (`id`, `prefix_type`, `prefix_type_id`, `traffic_type`, `unit`, `protocol`, `low_percentile_g`, `mid_percentile_g`, `high_percentile_g`, `peak_g`, `created`, `updated`) VALUES (1, 'TARGET_PREFIX', 1, 'TOTAL_TRAFFIC', 'PACKETS_PS', 6, 0, 100, 0, 0, '2017-04-13 13:44:34', '2017-04-13 13:44:34'); # telemetry_total_attack_connection # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_total_attack_connection`; CREATE TABLE `telemetry_total_attack_connection` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `prefix_type` enum('TARGET_PREFIX','SOURCE_PREFIX') NOT NULL, `prefix_type_id` bigint(20) NOT NULL, `percentile_type` enum('LOW_PERCENTILE_C','MID_PERCENTILE_C','HIGH_PERCENTILE_C','PEAK_C') NOT NULL, `connection` int(11) DEFAULT NULL, `embryonic` int(11) DEFAULT NULL, `connection_ps` int(11) DEFAULT NULL, `request_ps` int(11) DEFAULT NULL, `partial_request_ps`int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `telemetry_total_attack_connection` (`id`, `prefix_type`, `prefix_type_id`, `percentile_type`, `connection`, `embryonic`, `connection_ps`, `request_ps`, `partial_request_ps`, `created`, `updated`) VALUES (1, 'TARGET_PREFIX', 1, 'LOW_PERCENTILE_C', 200, 201, 202, 203, 204, '2017-04-13 13:44:34', '2017-04-13 13:44:34'); # telemetry_attack_detail # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_attack_detail`; CREATE TABLE `telemetry_attack_detail` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `mitigation_scope_id` bigint(20) NOT NULL, `vendor_id` int(11) NOT NULL, `attack_id` int(11) NOT NULL, `attack_name` varchar(255), `attack_severity` enum('NONE','LOW','MEDIUM','HIGH','UNKNOWN') NOT NULL, `start_time` int(11), `end_time` int(11), `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_attack_detail trigger when any attribute of telemetry_attack_detail change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER telemetry_attack_detail_trigger AFTER UPDATE ON telemetry_attack_detail FOR EACH ROW BEGIN IF NEW.updated <> OLD.updated THEN SELECT MySQLNotification('telemetry_attack_detail', NEW.mitigation_scope_id) INTO @x; END IF; END@@ DELIMITER ; # telemetry_source_count # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_source_count`; CREATE TABLE `telemetry_source_count` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_attack_detail_id` bigint(20) NOT NULL, `low_percentile_g` int(11), `mid_percentile_g` int(11), `high_percentile_g` int(11), `peak_g` int(11), `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_top_talker # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_top_talker`; CREATE TABLE `telemetry_top_talker` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_attack_detail_id` bigint(20) NOT NULL, `spoofed_status` tinyint(1), `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_source_prefix # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_source_prefix`; CREATE TABLE `telemetry_source_prefix` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_top_talker_id` bigint(20) NOT NULL, `addr` varchar(255) DEFAULT NULL, `prefix_len` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; # telemetry_source_port_range # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_source_port_range`; CREATE TABLE `telemetry_source_port_range` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_top_talker_id` bigint(20) NOT NULL, `lower_port` int(11) NOT NULL, `upper_port` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # telemetry_source_icmp_type_range # ------------------------------------------------------------ DROP TABLE IF EXISTS `telemetry_source_icmp_type_range`; CREATE TABLE `telemetry_source_icmp_type_range` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_top_talker_id` bigint(20) NOT NULL, `lower_type` int(11) NOT NULL, `upper_type` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_telemetry_pre_mitigation # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_telemetry_pre_mitigation`; CREATE TABLE `uri_filtering_telemetry_pre_mitigation` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `cuid` varchar(255) NOT NULL, `cdid` varchar(255) DEFAULT NULL, `tmid` int(11) NOT NULL, `target_prefix` varchar(255) NOT NULL, `lower_port` int(11) NOT NULL, `upper_port` int(11) NOT NULL, `target_protocol` int(11) NOT NULL, `target_fqdn` varchar(255) NOT NULL, `alias_name` varchar(255) NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_traffic # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_traffic`; CREATE TABLE `uri_filtering_traffic` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `prefix_type` enum('TARGET_PREFIX','SOURCE_PREFIX') NOT NULL, `prefix_type_id` bigint(20) NOT NULL, `traffic_type` enum('TOTAL_TRAFFIC_NORMAL','TOTAL_ATTACK_TRAFFIC','TOTAL_TRAFFIC') NOT NULL, `unit` enum('PACKETS_PS','BITS_PS','BYTES_PS','KILOPACKETS_PS','KILOBITS_PS','KILOBYTES_PS','MEGAPACKETS_PS','MEGABITS_PS','MEGABYTES_PS','GIGAPACKETS_PS','GIGABITS_PS','GIGABYTES_PS','TERAPACKETS_PS','TERABITS_PS','TERABYTES_PS') NOT NULL, `low_percentile_g` int(11) DEFAULT NULL, `mid_percentile_g` int(11) DEFAULT NULL, `high_percentile_g` int(11) DEFAULT NULL, `peak_g` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_traffic trigger when any attribute of uri_filtering_traffic change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER uri_filtering_traffic_trigger AFTER UPDATE ON uri_filtering_traffic FOR EACH ROW BEGIN IF NEW.unit <> OLD.unit OR NEW.low_percentile_g <> OLD.low_percentile_g OR NEW.mid_percentile_g <> OLD.mid_percentile_g OR NEW.high_percentile_g <> OLD.high_percentile_g OR NEW.peak_g <> OLD.peak_g THEN SELECT MySQLNotification('uri_filtering_traffic', NEW.prefix_type, NEW.prefix_type_id) INTO @x; END IF; END@@ DELIMITER ; # uri_filtering_traffic_per_protocol # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_traffic_per_protocol`; CREATE TABLE `uri_filtering_traffic_per_protocol` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_pre_mitigation_id` bigint(20) NOT NULL, `traffic_type` enum('TOTAL_TRAFFIC_NORMAL','TOTAL_ATTACK_TRAFFIC','TOTAL_TRAFFIC') NOT NULL, `unit` enum('PACKETS_PS','BITS_PS','BYTES_PS','KILOPACKETS_PS','KILOBITS_PS','KILOBYTES_PS','MEGAPACKETS_PS','MEGABITS_PS','MEGABYTES_PS','GIGAPACKETS_PS','GIGABITS_PS','GIGABYTES_PS','TERAPACKETS_PS','TERABITS_PS','TERABYTES_PS') NOT NULL, `protocol` int(11) NOT NULL, `low_percentile_g` int(11) DEFAULT NULL, `mid_percentile_g` int(11) DEFAULT NULL, `high_percentile_g` int(11) DEFAULT NULL, `peak_g` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_traffic_per_protocol trigger when any attribute of uri_filtering_traffic_per_protocol change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER uri_filtering_traffic_per_protocol_trigger AFTER UPDATE ON uri_filtering_traffic_per_protocol FOR EACH ROW BEGIN IF NEW.unit <> OLD.unit OR NEW.protocol <> OLD.protocol OR NEW.low_percentile_g <> OLD.low_percentile_g OR NEW.mid_percentile_g <> OLD.mid_percentile_g OR NEW.high_percentile_g <> OLD.high_percentile_g OR NEW.peak_g <> OLD.peak_g THEN SELECT MySQLNotification('uri_filtering_traffic_per_protocol', NEW.tele_pre_mitigation_id) INTO @x; END IF; END@@ DELIMITER ; # uri_filtering_traffic_per_port # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_traffic_per_port`; CREATE TABLE `uri_filtering_traffic_per_port` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_pre_mitigation_id` bigint(20) NOT NULL, `traffic_type` enum('TOTAL_TRAFFIC_NORMAL','TOTAL_ATTACK_TRAFFIC','TOTAL_TRAFFIC') NOT NULL, `unit` enum('PACKETS_PS','BITS_PS','BYTES_PS','KILOPACKETS_PS','KILOBITS_PS','KILOBYTES_PS','MEGAPACKETS_PS','MEGABITS_PS','MEGABYTES_PS','GIGAPACKETS_PS','GIGABITS_PS','GIGABYTES_PS','TERAPACKETS_PS','TERABITS_PS','TERABYTES_PS') NOT NULL, `port` int(11) NOT NULL, `low_percentile_g` int(11) DEFAULT NULL, `mid_percentile_g` int(11) DEFAULT NULL, `high_percentile_g` int(11) DEFAULT NULL, `peak_g` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_traffic_per_port trigger when any attribute of uri_filtering_traffic_per_port change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER uri_filtering_traffic_per_port_trigger AFTER UPDATE ON uri_filtering_traffic_per_port FOR EACH ROW BEGIN IF NEW.unit <> OLD.unit OR NEW.port <> OLD.port OR NEW.low_percentile_g <> OLD.low_percentile_g OR NEW.mid_percentile_g <> OLD.mid_percentile_g OR NEW.high_percentile_g <> OLD.high_percentile_g OR NEW.peak_g <> OLD.peak_g THEN SELECT MySQLNotification('uri_filtering_traffic_per_port', NEW.tele_pre_mitigation_id) INTO @x; END IF; END@@ DELIMITER ; # uri_filtering_total_attack_connection # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_total_attack_connection`; CREATE TABLE `uri_filtering_total_attack_connection` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `prefix_type` enum('TARGET_PREFIX','SOURCE_PREFIX') NOT NULL, `prefix_type_id` bigint(20) NOT NULL, `percentile_type` enum('LOW_PERCENTILE_L','MID_PERCENTILE_L','HIGH_PERCENTILE_L','PEAK_L') NOT NULL, `protocol` int(11) NOT NULL, `connection` int(11) DEFAULT NULL, `embryonic` int(11) DEFAULT NULL, `connection_ps` int(11) DEFAULT NULL, `request_ps` int(11) DEFAULT NULL, `partial_request_ps`int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_total_attack_connection trigger when any attribute of uri_filtering_total_attack_connection change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER uri_filtering_total_attack_connection_trigger AFTER UPDATE ON uri_filtering_total_attack_connection FOR EACH ROW BEGIN IF NEW.protocol <> OLD.protocol OR NEW.connection <> OLD.connection OR NEW.embryonic <> OLD.embryonic OR NEW.connection_ps <> OLD.connection_ps OR NEW.request_ps <> OLD.request_ps OR NEW.partial_request_ps <> OLD.partial_request_ps THEN SELECT MySQLNotification('uri_filtering_total_attack_connection', NEW.prefix_type, NEW.prefix_type_id) INTO @x; END IF; END@@ DELIMITER ; # uri_filtering_total_attack_connection_port # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_total_attack_connection_port`; CREATE TABLE `uri_filtering_total_attack_connection_port` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_pre_mitigation_id` bigint(20) NOT NULL, `percentile_type` enum('LOW_PERCENTILE_L','MID_PERCENTILE_L','HIGH_PERCENTILE_L','PEAK_L') NOT NULL, `protocol` int(11) NOT NULL, `port` int(11) NOT NULL, `connection` int(11) DEFAULT NULL, `embryonic` int(11) DEFAULT NULL, `connection_ps` int(11) DEFAULT NULL, `request_ps` int(11) DEFAULT NULL, `partial_request_ps` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_total_attack_connection_port trigger when any attribute of uri_filtering_total_attack_connection_port change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER uri_filtering_total_attack_connection_port_trigger AFTER UPDATE ON uri_filtering_total_attack_connection_port FOR EACH ROW BEGIN IF NEW.protocol <> OLD.protocol OR NEW.port <> OLD.port OR NEW.connection <> OLD.connection OR NEW.embryonic <> OLD.embryonic OR NEW.connection_ps <> OLD.connection_ps OR NEW.request_ps <> OLD.request_ps OR NEW.partial_request_ps <> OLD.partial_request_ps THEN SELECT MySQLNotification('uri_filtering_total_attack_connection_port', NEW.tele_pre_mitigation_id) INTO @x; END IF; END@@ DELIMITER ; # uri_filtering_attack_detail # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_attack_detail`; CREATE TABLE `uri_filtering_attack_detail` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_pre_mitigation_id` bigint(20), `vendor_id` int(11) NOT NULL, `attack_id` int(11) NOT NULL, `attack_name` varchar(255), `attack_severity` enum('NONE','LOW','MEDIUM','HIGH','UNKNOWN') NOT NULL, `start_time` int(11), `end_time` int(11), `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_attack_detail trigger when any attribute of uri_filtering_attack_detail change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER uri_filtering_attack_detail_trigger AFTER UPDATE ON uri_filtering_attack_detail FOR EACH ROW BEGIN IF NEW.vendor_id <> OLD.vendor_id OR NEW.attack_id <> OLD.attack_id OR NEW.attack_name <> OLD.attack_name OR NEW.attack_severity <> OLD.attack_severity OR NEW.start_time <> OLD.start_time OR NEW.end_time <> OLD.end_time THEN SELECT MySQLNotification('uri_filtering_attack_detail', NEW.tele_pre_mitigation_id) INTO @x; END IF; END@@ DELIMITER ; # uri_filtering_source_count # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_source_count`; CREATE TABLE `uri_filtering_source_count` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_attack_detail_id` bigint(20) NOT NULL, `low_percentile_g` int(11), `mid_percentile_g` int(11), `high_percentile_g` int(11), `peak_g` int(11), `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_source_count trigger when any attribute of uri_filtering_source_count change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER uri_filtering_source_count_trigger AFTER UPDATE ON uri_filtering_source_count FOR EACH ROW BEGIN IF NEW.low_percentile_g <> OLD.low_percentile_g OR NEW.mid_percentile_g <> OLD.mid_percentile_g OR NEW.high_percentile_g <> OLD.high_percentile_g OR NEW.peak_g <> OLD.peak_g THEN SELECT MySQLNotification('uri_filtering_source_count', NEW.tele_attack_detail_id) INTO @x; END IF; END@@ DELIMITER ; # uri_filtering_top_talker # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_top_talker`; CREATE TABLE `uri_filtering_top_talker` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_attack_detail_id` bigint(20) NOT NULL, `spoofed_status` tinyint(1), `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_top_talker trigger when any attribute of uri_filtering_top_talker change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER uri_filtering_top_talker_trigger AFTER UPDATE ON uri_filtering_top_talker FOR EACH ROW BEGIN IF NEW.spoofed_status <> OLD.spoofed_status THEN SELECT MySQLNotification('uri_filtering_top_talker', NEW.tele_attack_detail_id) INTO @x; END IF; END@@ DELIMITER ; # uri_filtering_source_prefix # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_source_prefix`; CREATE TABLE `uri_filtering_source_prefix` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_top_talker_id` bigint(20) NOT NULL, `addr` varchar(255) DEFAULT NULL, `prefix_len` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; # uri_filtering_source_prefix trigger when any attribute of uri_filtering_source_prefix change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER uri_filtering_source_prefix_trigger AFTER UPDATE ON uri_filtering_source_prefix FOR EACH ROW BEGIN IF NEW.addr <> OLD.addr OR NEW.prefix_len <> OLD.prefix_len THEN SELECT MySQLNotification('uri_filtering_source_prefix', NEW.tele_top_talker_id) INTO @x; END IF; END@@ DELIMITER ; # uri_filtering_source_port_range # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_source_port_range`; CREATE TABLE `uri_filtering_source_port_range` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_top_talker_id` bigint(20) NOT NULL, `lower_port` int(11) NOT NULL, `upper_port` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_source_port_range trigger when any attribute of uri_filtering_source_port_range change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER uri_filtering_source_port_range_trigger AFTER UPDATE ON uri_filtering_source_port_range FOR EACH ROW BEGIN IF NEW.lower_port <> OLD.lower_port OR NEW.upper_port <> OLD.upper_port THEN SELECT MySQLNotification('uri_filtering_source_port_range', NEW.tele_top_talker_id) INTO @x; END IF; END@@ DELIMITER ; # uri_filtering_icmp_type_range # ------------------------------------------------------------ DROP TABLE IF EXISTS `uri_filtering_icmp_type_range`; CREATE TABLE `uri_filtering_icmp_type_range` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `tele_top_talker_id` bigint(20) NOT NULL, `lower_type` int(11) NOT NULL, `upper_type` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # uri_filtering_icmp_type_range trigger when any attribute of uri_filtering_icmp_type_range change # ------------------------------------------------------------------------------ DELIMITER @@ CREATE TRIGGER uri_filtering_icmp_type_range_trigger AFTER UPDATE ON uri_filtering_icmp_type_range FOR EACH ROW BEGIN IF NEW.lower_type <> OLD.lower_type OR NEW.upper_type <> OLD.upper_type THEN SELECT MySQLNotification('uri_filtering_icmp_type_range', NEW.tele_top_talker_id) INTO @x; END IF; END@@ DELIMITER ; # vendor_mapping # ------------------------------------------------------------ DROP TABLE IF EXISTS `vendor_mapping`; CREATE TABLE `vendor_mapping` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `data_client_id` bigint(20) NOT NULL, `vendor_id` int(11) NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # attack_mapping # ------------------------------------------------------------ DROP TABLE IF EXISTS `attack_mapping`; CREATE TABLE `attack_mapping` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `vendor_mapping_id` bigint(20) NOT NULL, `attack_id` int(11) NOT NULL, `attack_name` varchar(255) NOT NULL, `created` datetime DEFAULT NULL, `updated` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
the_stack
-- 2020-02-10T08:13:26.150Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,AllowProcessReRun,Classname,CopyFromProcess,Created,CreatedBy,EntityType,IsActive,IsApplySecuritySettings,IsBetaFunctionality,IsDirectPrint,IsOneInstanceOnly,IsReport,IsServerProcess,IsTranslateExcelHeaders,IsUseBPartnerLanguage,LockWaitTimeout,Name,RefreshAllAfterExecution,ShowHelp,SQLStatement,Type,Updated,UpdatedBy,Value) VALUES ('7',0,0,584650,'Y','de.metas.impexp.excel.process.ExportToExcelProcess','N',TO_TIMESTAMP('2020-02-10 10:13:26','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','N','N','N','N','N','Y','Y',0,'ProfitAndLossReport','N','N','SELECT * FROM ProfitAndLossReport(''1993-01-01''::Timestamp, ''2992-01-01''::Timestamp);','Excel',TO_TIMESTAMP('2020-02-10 10:13:26','YYYY-MM-DD HH24:MI:SS'),100,'ProfitAndLossReport') ; -- 2020-02-10T08:13:26.153Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_ID=584650 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) ; -- 2020-02-10T08:14:16.854Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Table_Process (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Table_ID,AD_Table_Process_ID,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,WEBUI_DocumentAction,WEBUI_IncludedTabTopAction,WEBUI_ViewAction,WEBUI_ViewQuickAction,WEBUI_ViewQuickAction_Default) VALUES (0,0,584650,188,540788,TO_TIMESTAMP('2020-02-10 10:14:16','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2020-02-10 10:14:16','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N') ; -- 2020-02-10T08:17:28.806Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577520,0,'Three_Years_Ago',TO_TIMESTAMP('2020-02-10 10:17:28','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Three Years Ago','Three Years Ago',TO_TIMESTAMP('2020-02-10 10:17:28','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-10T08:17:28.808Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577520 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2020-02-10T08:22:58.779Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Vor-Vor-Vorjah', PrintName='Vor-Vor-Vorjah',Updated=TO_TIMESTAMP('2020-02-10 10:22:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577520 AND AD_Language='de_CH' ; -- 2020-02-10T08:22:58.813Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577520,'de_CH') ; -- 2020-02-10T08:23:10.091Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Vor-Vor-Vorjah', PrintName='Vor-Vor-Vorjah',Updated=TO_TIMESTAMP('2020-02-10 10:23:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577520 AND AD_Language='de_DE' ; -- 2020-02-10T08:23:10.092Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577520,'de_DE') ; -- 2020-02-10T08:23:10.098Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577520,'de_DE') ; -- 2020-02-10T08:23:10.100Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='Three_Years_Ago', Name='Vor-Vor-Vorjah', Description=NULL, Help=NULL WHERE AD_Element_ID=577520 ; -- 2020-02-10T08:23:10.103Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Three_Years_Ago', Name='Vor-Vor-Vorjah', Description=NULL, Help=NULL, AD_Element_ID=577520 WHERE UPPER(ColumnName)='THREE_YEARS_AGO' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-10T08:23:10.104Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Three_Years_Ago', Name='Vor-Vor-Vorjah', Description=NULL, Help=NULL WHERE AD_Element_ID=577520 AND IsCentrallyMaintained='Y' ; -- 2020-02-10T08:23:10.105Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Vor-Vor-Vorjah', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577520) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577520) ; -- 2020-02-10T08:23:10.115Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Vor-Vor-Vorjah', Name='Vor-Vor-Vorjah' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577520) ; -- 2020-02-10T08:23:10.117Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Vor-Vor-Vorjah', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577520 ; -- 2020-02-10T08:23:10.118Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Vor-Vor-Vorjah', Description=NULL, Help=NULL WHERE AD_Element_ID = 577520 ; -- 2020-02-10T08:23:10.119Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Vor-Vor-Vorjah', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577520 ; -- 2020-02-10T08:23:13.295Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-10 10:23:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577520 AND AD_Language='en_US' ; -- 2020-02-10T08:23:13.297Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577520,'en_US') ; -- 2020-02-10T08:30:16.825Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577521,0,'Two_Years_Ago',TO_TIMESTAMP('2020-02-10 10:30:16','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Two Years Ago','Two Years Ago',TO_TIMESTAMP('2020-02-10 10:30:16','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-10T08:30:16.827Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577521 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2020-02-10T08:30:34.957Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Vor-Vorjah', PrintName='Vor-Vorjah',Updated=TO_TIMESTAMP('2020-02-10 10:30:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577521 AND AD_Language='de_CH' ; -- 2020-02-10T08:30:34.959Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577521,'de_CH') ; -- 2020-02-10T08:30:40.103Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Vor-Vorjah', PrintName='Vor-Vorjah',Updated=TO_TIMESTAMP('2020-02-10 10:30:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577521 AND AD_Language='de_DE' ; -- 2020-02-10T08:30:40.104Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577521,'de_DE') ; -- 2020-02-10T08:30:40.114Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577521,'de_DE') ; -- 2020-02-10T08:30:40.117Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='Two_Years_Ago', Name='Vor-Vorjah', Description=NULL, Help=NULL WHERE AD_Element_ID=577521 ; -- 2020-02-10T08:30:40.118Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Two_Years_Ago', Name='Vor-Vorjah', Description=NULL, Help=NULL, AD_Element_ID=577521 WHERE UPPER(ColumnName)='TWO_YEARS_AGO' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-10T08:30:40.119Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Two_Years_Ago', Name='Vor-Vorjah', Description=NULL, Help=NULL WHERE AD_Element_ID=577521 AND IsCentrallyMaintained='Y' ; -- 2020-02-10T08:30:40.120Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Vor-Vorjah', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577521) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577521) ; -- 2020-02-10T08:30:40.130Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Vor-Vorjah', Name='Vor-Vorjah' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577521) ; -- 2020-02-10T08:30:40.132Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Vor-Vorjah', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577521 ; -- 2020-02-10T08:30:40.133Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Vor-Vorjah', Description=NULL, Help=NULL WHERE AD_Element_ID = 577521 ; -- 2020-02-10T08:30:40.135Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Vor-Vorjah', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577521 ; -- 2020-02-10T08:30:46.305Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-10 10:30:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577521 AND AD_Language='en_US' ; -- 2020-02-10T08:30:46.307Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577521,'en_US') ; -- 2020-02-10T08:31:17.963Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577522,0,'One_Year_Ago',TO_TIMESTAMP('2020-02-10 10:31:17','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','One Year Ago','One Year Ago',TO_TIMESTAMP('2020-02-10 10:31:17','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-10T08:31:17.965Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577522 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2020-02-10T08:32:56.176Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Vorjahr', PrintName='Vorjahr',Updated=TO_TIMESTAMP('2020-02-10 10:32:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577522 AND AD_Language='de_CH' ; -- 2020-02-10T08:32:56.178Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577522,'de_CH') ; -- 2020-02-10T08:33:00.221Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Vorjahr', PrintName='Vorjahr',Updated=TO_TIMESTAMP('2020-02-10 10:33:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577522 AND AD_Language='de_DE' ; -- 2020-02-10T08:33:00.223Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577522,'de_DE') ; -- 2020-02-10T08:33:00.231Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577522,'de_DE') ; -- 2020-02-10T08:33:00.232Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='One_Year_Ago', Name='Vorjahr', Description=NULL, Help=NULL WHERE AD_Element_ID=577522 ; -- 2020-02-10T08:33:00.233Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='One_Year_Ago', Name='Vorjahr', Description=NULL, Help=NULL, AD_Element_ID=577522 WHERE UPPER(ColumnName)='ONE_YEAR_AGO' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-10T08:33:00.235Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='One_Year_Ago', Name='Vorjahr', Description=NULL, Help=NULL WHERE AD_Element_ID=577522 AND IsCentrallyMaintained='Y' ; -- 2020-02-10T08:33:00.236Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Vorjahr', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577522) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577522) ; -- 2020-02-10T08:33:00.246Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Vorjahr', Name='Vorjahr' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577522) ; -- 2020-02-10T08:33:00.247Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Vorjahr', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577522 ; -- 2020-02-10T08:33:00.249Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Vorjahr', Description=NULL, Help=NULL WHERE AD_Element_ID = 577522 ; -- 2020-02-10T08:33:00.250Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Vorjahr', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577522 ; -- 2020-02-10T08:33:01.975Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-10 10:33:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577522 AND AD_Language='en_US' ; -- 2020-02-10T08:33:01.976Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577522,'en_US') ; -- 2020-02-10T08:33:28.489Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Vor-Vor-Vorjahr', PrintName='Vor-Vor-Vorjahr',Updated=TO_TIMESTAMP('2020-02-10 10:33:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577520 AND AD_Language='de_CH' ; -- 2020-02-10T08:33:28.491Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577520,'de_CH') ; -- 2020-02-10T08:33:32.215Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Vor-Vor-Vorjahr', PrintName='Vor-Vor-Vorjahr',Updated=TO_TIMESTAMP('2020-02-10 10:33:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577520 AND AD_Language='de_DE' ; -- 2020-02-10T08:33:32.217Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577520,'de_DE') ; -- 2020-02-10T08:33:32.223Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577520,'de_DE') ; -- 2020-02-10T08:33:32.225Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='Three_Years_Ago', Name='Vor-Vor-Vorjahr', Description=NULL, Help=NULL WHERE AD_Element_ID=577520 ; -- 2020-02-10T08:33:32.226Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Three_Years_Ago', Name='Vor-Vor-Vorjahr', Description=NULL, Help=NULL, AD_Element_ID=577520 WHERE UPPER(ColumnName)='THREE_YEARS_AGO' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-10T08:33:32.227Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Three_Years_Ago', Name='Vor-Vor-Vorjahr', Description=NULL, Help=NULL WHERE AD_Element_ID=577520 AND IsCentrallyMaintained='Y' ; -- 2020-02-10T08:33:32.228Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Vor-Vor-Vorjahr', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577520) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577520) ; -- 2020-02-10T08:33:32.238Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Vor-Vor-Vorjahr', Name='Vor-Vor-Vorjahr' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577520) ; -- 2020-02-10T08:33:32.240Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Vor-Vor-Vorjahr', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577520 ; -- 2020-02-10T08:33:32.242Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Vor-Vor-Vorjahr', Description=NULL, Help=NULL WHERE AD_Element_ID = 577520 ; -- 2020-02-10T08:33:32.243Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Vor-Vor-Vorjahr', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577520 ; -- 2020-02-10T08:33:49.977Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Vor-Vorjahr', PrintName='Vor-Vorjahr',Updated=TO_TIMESTAMP('2020-02-10 10:33:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577521 AND AD_Language='de_CH' ; -- 2020-02-10T08:33:49.978Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577521,'de_CH') ; -- 2020-02-10T08:33:53.101Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Vor-Vorjahr', PrintName='Vor-Vorjahr',Updated=TO_TIMESTAMP('2020-02-10 10:33:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577521 AND AD_Language='de_DE' ; -- 2020-02-10T08:33:53.102Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577521,'de_DE') ; -- 2020-02-10T08:33:53.110Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577521,'de_DE') ; -- 2020-02-10T08:33:53.111Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='Two_Years_Ago', Name='Vor-Vorjahr', Description=NULL, Help=NULL WHERE AD_Element_ID=577521 ; -- 2020-02-10T08:33:53.112Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Two_Years_Ago', Name='Vor-Vorjahr', Description=NULL, Help=NULL, AD_Element_ID=577521 WHERE UPPER(ColumnName)='TWO_YEARS_AGO' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-10T08:33:53.114Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Two_Years_Ago', Name='Vor-Vorjahr', Description=NULL, Help=NULL WHERE AD_Element_ID=577521 AND IsCentrallyMaintained='Y' ; -- 2020-02-10T08:33:53.115Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Vor-Vorjahr', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577521) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577521) ; -- 2020-02-10T08:33:53.124Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Vor-Vorjahr', Name='Vor-Vorjahr' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577521) ; -- 2020-02-10T08:33:53.126Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Vor-Vorjahr', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577521 ; -- 2020-02-10T08:33:53.127Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Vor-Vorjahr', Description=NULL, Help=NULL WHERE AD_Element_ID = 577521 ; -- 2020-02-10T08:33:53.129Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Vor-Vorjahr', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577521 ; -- 2020-02-10T08:34:20.135Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577523,0,'Current_Period',TO_TIMESTAMP('2020-02-10 10:34:20','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Current Period','Current Period',TO_TIMESTAMP('2020-02-10 10:34:20','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-10T08:34:20.138Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577523 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2020-02-10T08:35:05.282Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Aktueller Zeitraum', PrintName='Aktueller Zeitraum',Updated=TO_TIMESTAMP('2020-02-10 10:35:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577523 AND AD_Language='de_CH' ; -- 2020-02-10T08:35:05.284Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577523,'de_CH') ; -- 2020-02-10T08:35:08.893Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Aktueller Zeitraum', PrintName='Aktueller Zeitraum',Updated=TO_TIMESTAMP('2020-02-10 10:35:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577523 AND AD_Language='de_DE' ; -- 2020-02-10T08:35:08.894Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577523,'de_DE') ; -- 2020-02-10T08:35:08.899Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577523,'de_DE') ; -- 2020-02-10T08:35:08.902Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='Current_Period', Name='Aktueller Zeitraum', Description=NULL, Help=NULL WHERE AD_Element_ID=577523 ; -- 2020-02-10T08:35:08.903Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Current_Period', Name='Aktueller Zeitraum', Description=NULL, Help=NULL, AD_Element_ID=577523 WHERE UPPER(ColumnName)='CURRENT_PERIOD' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-10T08:35:08.904Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Current_Period', Name='Aktueller Zeitraum', Description=NULL, Help=NULL WHERE AD_Element_ID=577523 AND IsCentrallyMaintained='Y' ; -- 2020-02-10T08:35:08.905Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Aktueller Zeitraum', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577523) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577523) ; -- 2020-02-10T08:35:08.915Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Aktueller Zeitraum', Name='Aktueller Zeitraum' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577523) ; -- 2020-02-10T08:35:08.916Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Aktueller Zeitraum', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577523 ; -- 2020-02-10T08:35:08.918Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Aktueller Zeitraum', Description=NULL, Help=NULL WHERE AD_Element_ID = 577523 ; -- 2020-02-10T08:35:08.919Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Aktueller Zeitraum', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577523 ; -- 2020-02-10T08:35:10.652Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-10 10:35:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577523 AND AD_Language='en_US' ; -- 2020-02-10T08:35:10.654Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577523,'en_US') ; -- 2020-02-10T09:25:53.632Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,1581,0,584650,541703,15,'DateFrom',TO_TIMESTAMP('2020-02-10 11:25:53','YYYY-MM-DD HH24:MI:SS'),100,'Startdatum eines Abschnittes','D',0,'Datum von bezeichnet das Startdatum eines Abschnittes','Y','N','Y','N','N','N','Datum von',10,TO_TIMESTAMP('2020-02-10 11:25:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-10T09:25:53.639Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541703 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2020-02-10T09:26:09.294Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,1582,0,584650,541704,15,'DateTo',TO_TIMESTAMP('2020-02-10 11:26:09','YYYY-MM-DD HH24:MI:SS'),100,'Enddatum eines Abschnittes','D',0,'Datum bis bezeichnet das Enddatum eines Abschnittes (inklusiv)','Y','N','Y','N','N','N','Datum bis',20,TO_TIMESTAMP('2020-02-10 11:26:09','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-10T09:26:09.296Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541704 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2020-02-10T09:27:46.946Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM ProfitAndLossReport(''@DateFrom/1993-01-01@''::Timestamp, ''@DateTo/2992-01-01@''::Timestamp);',Updated=TO_TIMESTAMP('2020-02-10 11:27:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584650 ; -- 2020-02-10T09:43:39.321Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Profit And Loss Report',Updated=TO_TIMESTAMP('2020-02-10 11:43:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584650 ; -- 2020-02-10T10:11:20.975Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Gewinn- und Verlustbericht',Updated=TO_TIMESTAMP('2020-02-10 12:11:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=584650 ; -- 2020-02-10T10:11:24.402Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Gewinn- und Verlustbericht',Updated=TO_TIMESTAMP('2020-02-10 12:11:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Process_ID=584650 ;
the_stack
-- 2019-11-11T11:04:36.685Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET MandatoryLogic='',Updated=TO_TIMESTAMP('2019-11-11 12:04:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=544966 ; -- 2019-11-11T13:00:53.506Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsActive='N',Updated=TO_TIMESTAMP('2019-11-11 14:00:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541010 ; -- 2019-11-11T13:01:46.608Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,569216,591336,0,540279,0,TO_TIMESTAMP('2019-11-11 14:01:46','YYYY-MM-DD HH24:MI:SS'),100,0,'de.metas.invoicecandidate',0,'Y','Y','Y','N','N','N','N','N','Externe Datensatz-Kopf-ID',1140,500,0,1,1,TO_TIMESTAMP('2019-11-11 14:01:46','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-11-11T13:01:46.610Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=591336 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2019-11-11T13:01:46.643Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(575915) ; -- 2019-11-11T13:01:46.653Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=591336 ; -- 2019-11-11T13:01:46.655Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(591336) ; -- 2019-11-11T13:02:03.634Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,569217,591337,0,540279,0,TO_TIMESTAMP('2019-11-11 14:02:03','YYYY-MM-DD HH24:MI:SS'),100,0,'de.metas.invoicecandidate',0,'Y','Y','Y','N','N','N','N','N','Externe Datensatz-Zeilen-ID',1150,510,0,1,1,TO_TIMESTAMP('2019-11-11 14:02:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-11-11T13:02:03.635Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=591337 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2019-11-11T13:02:03.637Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(575914) ; -- 2019-11-11T13:02:03.640Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=591337 ; -- 2019-11-11T13:02:03.641Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(591337) ; -- 2019-11-11T13:02:25.772Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET EntityType='de.metas.invoicecandidate',Updated=TO_TIMESTAMP('2019-11-11 14:02:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555715 ; -- 2019-11-11T13:03:02.289Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,591336,0,540279,540056,563853,'F',TO_TIMESTAMP('2019-11-11 14:03:02','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','N',0,'Externe Datensatz-Kopf-ID',22,0,0,TO_TIMESTAMP('2019-11-11 14:03:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-11-11T13:03:18.314Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,591337,0,540279,540056,563854,'F',TO_TIMESTAMP('2019-11-11 14:03:18','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','N',0,'ExternalLineId',241030,0,0,TO_TIMESTAMP('2019-11-11 14:03:18','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-11-11T13:03:23.853Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='ExternalHeaderId',Updated=TO_TIMESTAMP('2019-11-11 14:03:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=563853 ; -- 2019-11-11T13:03:37.565Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2019-11-11 14:03:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=591336 ; -- 2019-11-11T13:03:38.917Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2019-11-11 14:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=591337 ; -- 2019-11-11T13:05:25.485Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:05:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555481 ; -- 2019-11-11T13:05:43.161Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:05:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548114 ; -- 2019-11-11T13:06:05.741Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:06:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563184 ; -- 2019-11-11T13:06:13.950Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:06:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=582480 ; -- 2019-11-11T13:07:28.778Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:07:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=546904 ; -- 2019-11-11T13:07:33.750Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:07:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=546898 ; -- 2019-11-11T13:07:44.375Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:07:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560421 ; -- 2019-11-11T13:08:09.911Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:08:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555715 ; -- 2019-11-11T13:08:36.735Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:08:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555409 ; -- 2019-11-11T13:09:00.286Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/Y@=N & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:09:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=553212 ; -- 2019-11-11T13:09:21.672Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N'' & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:09:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=554061 ; -- 2019-11-11T13:09:28.293Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N'' & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:09:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=554060 ; -- 2019-11-11T13:09:38.219Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N'' & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:09:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=553211 ; -- 2019-11-11T13:09:58.258Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/Y@=N & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:09:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=553926 ; -- 2019-11-11T13:10:11.502Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:10:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=554865 ; -- 2019-11-11T13:10:20.898Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:10:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555407 ; -- 2019-11-11T13:10:55.937Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:10:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=554131 ; -- 2019-11-11T13:13:05.783Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,591337,0,540279,540056,563855,'F',TO_TIMESTAMP('2019-11-11 14:13:05','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','N',0,'ExternalLineId',24,0,0,TO_TIMESTAMP('2019-11-11 14:13:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-11-11T13:13:42.782Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2019-11-11 14:13:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=551089 ; -- 2019-11-11T13:14:25.749Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/Y@=N & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:14:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=554062 ; -- 2019-11-11T13:14:35.294Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N'' & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:14:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=554062 ; -- 2019-11-11T13:15:11.970Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=563854 ; -- 2019-11-11T13:15:39.324Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/Y@=''N'' & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:15:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=554132 ; -- 2019-11-11T13:15:43.593Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N'' & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:15:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=553926 ; -- 2019-11-11T13:16:11.885Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:16:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=553212 ; -- 2019-11-11T13:16:14.913Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N'' & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:16:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=553212 ; -- 2019-11-11T13:16:19.422Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:16:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555542 ; -- 2019-11-11T13:16:25.899Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:16:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555544 ; -- 2019-11-11T13:16:29.670Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N'' & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:16:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=554132 ; -- 2019-11-11T13:16:35.654Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''N''@=''Y''',Updated=TO_TIMESTAMP('2019-11-11 14:16:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=582483 ; -- 2019-11-11T13:16:41.132Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:16:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548720 ; -- 2019-11-11T13:16:42.217Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:16:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548719 ; -- 2019-11-11T13:16:55.313Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsManual/''N''@=''Y''|@Description/@!''''',Updated=TO_TIMESTAMP('2019-11-11 14:16:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=551170 ; -- 2019-11-11T13:17:04.304Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N'' & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:17:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555544 ; -- 2019-11-11T13:17:07.734Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsSOTrx/''Y''@=''N'' & @IsManual/''N''@=''N''',Updated=TO_TIMESTAMP('2019-11-11 14:17:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555542 ; -- 2019-11-11T13:18:27.531Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2019-11-11 14:18:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=563853 ; -- 2019-11-11T13:18:30.197Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2019-11-11 14:18:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=563855 ;
the_stack
-- The 32 version of various system and information_schema views -- -- PG_CATALOG views -- set search_path='pg_catalog'; -- pg_catalog.pg_partitions create view public.pg_partitions as SELECT p1.schemaname, p1.tablename, p1.partitionschemaname, p1.partitiontablename, p1.partitionname, p1.parentpartitiontablename, p1.parentpartitionname, p1.partitiontype, p1.partitionlevel, CASE WHEN p1.partitiontype <> 'range'::text THEN NULL::bigint WHEN p1.partitionnodefault > 0 THEN p1.partitionrank WHEN p1.partitionrank = 1 THEN NULL::bigint ELSE p1.partitionrank - 1 END AS partitionrank, p1.partitionposition, p1.partitionlistvalues, p1.partitionrangestart, CASE WHEN p1.partitiontype = 'range'::text THEN p1.partitionstartinclusive ELSE NULL::boolean END AS partitionstartinclusive, p1.partitionrangeend, CASE WHEN p1.partitiontype = 'range'::text THEN p1.partitionendinclusive ELSE NULL::boolean END AS partitionendinclusive, p1.partitioneveryclause, p1.parisdefault AS partitionisdefault, p1.partitionboundary FROM ( SELECT n.nspname AS schemaname, cl.relname AS tablename, n2.nspname AS partitionschemaname, cl2.relname AS partitiontablename, pr1.parname AS partitionname, cl3.relname AS parentpartitiontablename, pr2.parname AS parentpartitionname, CASE WHEN pp.parkind = 'h'::"char" THEN 'hash'::text WHEN pp.parkind = 'r'::"char" THEN 'range'::text WHEN pp.parkind = 'l'::"char" THEN 'list'::text ELSE NULL::text END AS partitiontype, pp.parlevel AS partitionlevel, pr1.parruleord AS partitionposition, rank() OVER( PARTITION BY pp.oid, cl.relname, pp.parlevel, cl3.relname ORDER BY pr1.parruleord) AS partitionrank, pg_get_expr(pr1.parlistvalues, pr1.parchildrelid) AS partitionlistvalues, pg_get_expr(pr1.parrangestart, pr1.parchildrelid) AS partitionrangestart, pr1.parrangestartincl AS partitionstartinclusive, pg_get_expr(pr1.parrangeend, pr1.parchildrelid) AS partitionrangeend, pr1.parrangeendincl AS partitionendinclusive, pg_get_expr(pr1.parrangeevery, pr1.parchildrelid) AS partitioneveryclause, min(pr1.parruleord) OVER( PARTITION BY pp.oid, cl.relname, pp.parlevel, cl3.relname ORDER BY pr1.parruleord) AS partitionnodefault, pr1.parisdefault, pg_get_partition_rule_def(pr1.oid, true) AS partitionboundary FROM pg_namespace n, pg_namespace n2, pg_class cl, pg_class cl2, pg_partition pp, pg_partition_rule pr1 LEFT JOIN pg_partition_rule pr2 ON pr1.parparentrule = pr2.oid LEFT JOIN pg_class cl3 ON pr2.parchildrelid = cl3.oid WHERE pp.paristemplate = false AND pp.parrelid = cl.oid AND pr1.paroid = pp.oid AND cl2.oid = pr1.parchildrelid AND cl.relnamespace = n.oid AND cl2.relnamespace = n2.oid) p1; create view public.pg_partition_templates as select schemaname, tablename, partitionname, partitiontype, partitionlevel, case when (partitiontype != 'range') then NULL when (partitionnodefault > 0) then partitionrank when (partitionrank = 1) then NULL else partitionrank - 1 end as partitionrank, partitionposition, partitionlistvalues, partitionrangestart, case when (partitiontype = 'range') then partitionstartinclusive else NULL end as partitionstartinclusive, partitionrangeend, case when (partitiontype = 'range') then partitionendinclusive else NULL end as partitionendinclusive, partitioneveryclause, parisdefault as partitionisdefault, partitionboundary from ( select n.nspname as schemaname, cl.relname as tablename, pr1.parname as partitionname, p.parlevel as partitionlevel, pr1.parruleord as partitionposition, rank() over (partition by p.oid, cl.relname, p.parlevel order by pr1.parruleord) as partitionrank, pg_get_expr(pr1.parlistvalues, p.parrelid) as partitionlistvalues, pg_get_expr(pr1.parrangestart, p.parrelid) as partitionrangestart, pr1.parrangestartincl as partitionstartinclusive, pg_get_expr(pr1.parrangeend, p.parrelid) as partitionrangeend, pr1.parrangeendincl as partitionendinclusive, pg_get_expr(pr1.parrangeevery, p.parrelid) as partitioneveryclause, min(pr1.parruleord) over (partition by p.oid, cl.relname, p.parlevel order by pr1.parruleord) as partitionnodefault, pr1.parisdefault, case when p.parkind = 'h' then 'hash' when p.parkind = 'r' then 'range' when p.parkind = 'l' then 'list' else null end as partitiontype, pg_get_partition_rule_def(pr1.oid, true) as partitionboundary from pg_namespace n, pg_class cl, pg_partition p, pg_partition_rule pr1 where p.parrelid = cl.oid and pr1.paroid = p.oid and cl.relnamespace = n.oid and p.paristemplate = 't' ) p1; -- pg_catalog.pg_roles create view public.pg_roles as select rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcatupdate, rolcanlogin, rolconnlimit, '********'::text as rolpassword, rolvaliduntil, rolconfig, rolresqueue, oid from pg_authid; -- -- INFORMATION_SCHEMA views -- set search_path='information_schema'; -- information_schema.parameters CREATE VIEW public.parameters AS SELECT CAST(current_database() AS sql_identifier) AS specific_catalog, CAST(n_nspname AS sql_identifier) AS specific_schema, CAST(proname || '_' || CAST(p_oid AS text) AS sql_identifier) AS specific_name, CAST((ss.x).n AS cardinal_number) AS ordinal_position, CAST( CASE WHEN proargmodes IS NULL THEN 'IN' WHEN proargmodes[(ss.x).n] = 'i' THEN 'IN' WHEN proargmodes[(ss.x).n] = 'o' THEN 'OUT' WHEN proargmodes[(ss.x).n] = 'b' THEN 'INOUT' END AS character_data) AS parameter_mode, CAST('NO' AS character_data) AS is_result, CAST('NO' AS character_data) AS as_locator, CAST(NULLIF(proargnames[(ss.x).n], '') AS sql_identifier) AS parameter_name, CAST( CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'ARRAY' WHEN nt.nspname = 'pg_catalog' THEN format_type(t.oid, null) ELSE 'USER-DEFINED' END AS character_data) AS data_type, CAST(null AS cardinal_number) AS character_maximum_length, CAST(null AS cardinal_number) AS character_octet_length, CAST(null AS sql_identifier) AS character_set_catalog, CAST(null AS sql_identifier) AS character_set_schema, CAST(null AS sql_identifier) AS character_set_name, CAST(null AS sql_identifier) AS collation_catalog, CAST(null AS sql_identifier) AS collation_schema, CAST(null AS sql_identifier) AS collation_name, CAST(null AS cardinal_number) AS numeric_precision, CAST(null AS cardinal_number) AS numeric_precision_radix, CAST(null AS cardinal_number) AS numeric_scale, CAST(null AS cardinal_number) AS datetime_precision, CAST(null AS character_data) AS interval_type, CAST(null AS character_data) AS interval_precision, CAST(current_database() AS sql_identifier) AS udt_catalog, CAST(nt.nspname AS sql_identifier) AS udt_schema, CAST(t.typname AS sql_identifier) AS udt_name, CAST(null AS sql_identifier) AS scope_catalog, CAST(null AS sql_identifier) AS scope_schema, CAST(null AS sql_identifier) AS scope_name, CAST(null AS cardinal_number) AS maximum_cardinality, CAST((ss.x).n AS sql_identifier) AS dtd_identifier FROM pg_type t, pg_namespace nt, (SELECT n.nspname AS n_nspname, p.proname, p.oid AS p_oid, p.proargnames, p.proargmodes, _pg_expandarray(coalesce(p.proallargtypes, p.proargtypes::oid[])) AS x FROM pg_namespace n, pg_proc p WHERE n.oid = p.pronamespace AND (pg_has_role(p.proowner, 'USAGE') OR has_function_privilege(p.oid, 'EXECUTE'))) AS ss WHERE t.oid = (ss.x).x AND t.typnamespace = nt.oid; -- information_schema.role_usage_grants CREATE VIEW public.role_usage_grants AS SELECT CAST(null AS sql_identifier) AS grantor, CAST(null AS sql_identifier) AS grantee, CAST(current_database() AS sql_identifier) AS object_catalog, CAST(null AS sql_identifier) AS object_schema, CAST(null AS sql_identifier) AS object_name, CAST(null AS character_data) AS object_type, CAST('USAGE' AS character_data) AS privilege_type, CAST(null AS character_data) AS is_grantable WHERE false; -- information_schema.usage_privileges CREATE VIEW public.usage_privileges AS SELECT CAST(u.rolname AS sql_identifier) AS grantor, CAST('PUBLIC' AS sql_identifier) AS grantee, CAST(current_database() AS sql_identifier) AS object_catalog, CAST(n.nspname AS sql_identifier) AS object_schema, CAST(t.typname AS sql_identifier) AS object_name, CAST('DOMAIN' AS character_data) AS object_type, CAST('USAGE' AS character_data) AS privilege_type, CAST('NO' AS character_data) AS is_grantable FROM pg_authid u, pg_namespace n, pg_type t WHERE u.oid = t.typowner AND t.typnamespace = n.oid AND t.typtype = 'd'; -- information_schema.check_constraints CREATE VIEW public.check_constraints AS SELECT CAST(current_database() AS sql_identifier) AS constraint_catalog, CAST(rs.nspname AS sql_identifier) AS constraint_schema, CAST(con.conname AS sql_identifier) AS constraint_name, CAST(substring(pg_get_constraintdef(con.oid) from 7) AS character_data) AS check_clause FROM pg_constraint con LEFT OUTER JOIN pg_namespace rs ON (rs.oid = con.connamespace) LEFT OUTER JOIN pg_class c ON (c.oid = con.conrelid) LEFT OUTER JOIN pg_type t ON (t.oid = con.contypid) WHERE pg_has_role(coalesce(c.relowner, t.typowner), 'USAGE') AND con.contype = 'c' UNION -- not-null constraints SELECT CAST(current_database() AS sql_identifier) AS constraint_catalog, CAST(n.nspname AS sql_identifier) AS constraint_schema, CAST(n.oid || '_' || r.oid || '_' || a.attnum || '_not_null' AS sql_identifier) AS constraint_name, -- XXX CAST(a.attname || ' IS NOT NULL' AS character_data) AS check_clause FROM pg_namespace n, pg_class r, pg_attribute a WHERE n.oid = r.relnamespace AND r.oid = a.attrelid AND a.attnum > 0 AND NOT a.attisdropped AND a.attnotnull AND r.relkind = 'r' AND pg_has_role(r.relowner, 'USAGE'); -- information_schema.table_constraints CREATE VIEW public.table_constraints AS SELECT CAST(current_database() AS sql_identifier) AS constraint_catalog, CAST(nc.nspname AS sql_identifier) AS constraint_schema, CAST(c.conname AS sql_identifier) AS constraint_name, CAST(current_database() AS sql_identifier) AS table_catalog, CAST(nr.nspname AS sql_identifier) AS table_schema, CAST(r.relname AS sql_identifier) AS table_name, CAST( CASE c.contype WHEN 'c' THEN 'CHECK' WHEN 'f' THEN 'FOREIGN KEY' WHEN 'p' THEN 'PRIMARY KEY' WHEN 'u' THEN 'UNIQUE' END AS character_data) AS constraint_type, CAST(CASE WHEN c.condeferrable THEN 'YES' ELSE 'NO' END AS character_data) AS is_deferrable, CAST(CASE WHEN c.condeferred THEN 'YES' ELSE 'NO' END AS character_data) AS initially_deferred FROM pg_namespace nc, pg_namespace nr, pg_constraint c, pg_class r WHERE nc.oid = c.connamespace AND nr.oid = r.relnamespace AND c.conrelid = r.oid AND r.relkind = 'r' AND (NOT pg_is_other_temp_schema(nr.oid)) AND (pg_has_role(r.relowner, 'USAGE') -- SELECT privilege omitted, per SQL standard OR has_table_privilege(r.oid, 'INSERT') OR has_table_privilege(r.oid, 'UPDATE') OR has_table_privilege(r.oid, 'DELETE') OR has_table_privilege(r.oid, 'REFERENCES') OR has_table_privilege(r.oid, 'TRIGGER') ) UNION -- not-null constraints SELECT CAST(current_database() AS sql_identifier) AS constraint_catalog, CAST(nr.nspname AS sql_identifier) AS constraint_schema, CAST(nr.oid || '_' || r.oid || '_' || a.attnum || '_not_null' AS sql_identifier) AS constraint_name, -- XXX CAST(current_database() AS sql_identifier) AS table_catalog, CAST(nr.nspname AS sql_identifier) AS table_schema, CAST(r.relname AS sql_identifier) AS table_name, CAST('CHECK' AS character_data) AS constraint_type, CAST('NO' AS character_data) AS is_deferrable, CAST('NO' AS character_data) AS initially_deferred FROM pg_namespace nr, pg_class r, pg_attribute a WHERE nr.oid = r.relnamespace AND r.oid = a.attrelid AND a.attnotnull AND a.attnum > 0 AND NOT a.attisdropped AND r.relkind = 'r' AND (NOT pg_is_other_temp_schema(nr.oid)) AND (pg_has_role(r.relowner, 'USAGE') OR has_table_privilege(r.oid, 'SELECT') OR has_table_privilege(r.oid, 'INSERT') OR has_table_privilege(r.oid, 'UPDATE') OR has_table_privilege(r.oid, 'DELETE') OR has_table_privilege(r.oid, 'REFERENCES') OR has_table_privilege(r.oid, 'TRIGGER') ); -- information_schema.views CREATE VIEW public.views AS SELECT CAST(current_database() AS sql_identifier) AS table_catalog, CAST(nc.nspname AS sql_identifier) AS table_schema, CAST(c.relname AS sql_identifier) AS table_name, CAST( CASE WHEN pg_has_role(c.relowner, 'USAGE') THEN pg_get_viewdef(c.oid) ELSE null END AS character_data) AS view_definition, CAST('NONE' AS character_data) AS check_option, CAST( CASE WHEN EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = 2 AND is_instead) AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = 4 AND is_instead) THEN 'YES' ELSE 'NO' END AS character_data) AS is_updatable, CAST( CASE WHEN EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = 3 AND is_instead) THEN 'YES' ELSE 'NO' END AS character_data) AS is_insertable_into FROM pg_namespace nc, pg_class c WHERE c.relnamespace = nc.oid AND c.relkind = 'v' AND (NOT pg_is_other_temp_schema(nc.oid)) AND (pg_has_role(c.relowner, 'USAGE') OR has_table_privilege(c.oid, 'SELECT') OR has_table_privilege(c.oid, 'INSERT') OR has_table_privilege(c.oid, 'UPDATE') OR has_table_privilege(c.oid, 'DELETE') OR has_table_privilege(c.oid, 'REFERENCES') OR has_table_privilege(c.oid, 'TRIGGER') ); -- information_schema.element_types CREATE VIEW public.element_types AS SELECT CAST(current_database() AS sql_identifier) AS object_catalog, CAST(n.nspname AS sql_identifier) AS object_schema, CAST(x.objname AS sql_identifier) AS object_name, CAST(x.objtype AS character_data) AS object_type, CAST(x.objdtdid AS sql_identifier) AS collection_type_identifier, CAST( CASE WHEN nbt.nspname = 'pg_catalog' THEN format_type(bt.oid, null) ELSE 'USER-DEFINED' END AS character_data) AS data_type, CAST(null AS cardinal_number) AS character_maximum_length, CAST(null AS cardinal_number) AS character_octet_length, CAST(null AS sql_identifier) AS character_set_catalog, CAST(null AS sql_identifier) AS character_set_schema, CAST(null AS sql_identifier) AS character_set_name, CAST(null AS sql_identifier) AS collation_catalog, CAST(null AS sql_identifier) AS collation_schema, CAST(null AS sql_identifier) AS collation_name, CAST(null AS cardinal_number) AS numeric_precision, CAST(null AS cardinal_number) AS numeric_precision_radix, CAST(null AS cardinal_number) AS numeric_scale, CAST(null AS cardinal_number) AS datetime_precision, CAST(null AS character_data) AS interval_type, CAST(null AS character_data) AS interval_precision, CAST(null AS character_data) AS domain_default, -- XXX maybe a bug in the standard CAST(current_database() AS sql_identifier) AS udt_catalog, CAST(nbt.nspname AS sql_identifier) AS udt_schema, CAST(bt.typname AS sql_identifier) AS udt_name, CAST(null AS sql_identifier) AS scope_catalog, CAST(null AS sql_identifier) AS scope_schema, CAST(null AS sql_identifier) AS scope_name, CAST(null AS cardinal_number) AS maximum_cardinality, CAST('a' || x.objdtdid AS sql_identifier) AS dtd_identifier FROM pg_namespace n, pg_type at, pg_namespace nbt, pg_type bt, ( /* columns */ SELECT c.relnamespace, CAST(c.relname AS sql_identifier), 'TABLE'::text, a.attnum, a.atttypid FROM pg_class c, pg_attribute a WHERE c.oid = a.attrelid AND c.relkind IN ('r', 'v') AND attnum > 0 AND NOT attisdropped UNION ALL /* domains */ SELECT t.typnamespace, CAST(t.typname AS sql_identifier), 'DOMAIN'::text, 1, t.typbasetype FROM pg_type t WHERE t.typtype = 'd' UNION ALL /* parameters */ SELECT pronamespace, CAST(proname || '_' || CAST(oid AS text) AS sql_identifier), 'ROUTINE'::text, (ss.x).n, (ss.x).x FROM (SELECT p.pronamespace, p.proname, p.oid, _pg_expandarray(coalesce(p.proallargtypes, p.proargtypes::oid[])) AS x FROM pg_proc p) AS ss UNION ALL /* result types */ SELECT p.pronamespace, CAST(p.proname || '_' || CAST(p.oid AS text) AS sql_identifier), 'ROUTINE'::text, 0, p.prorettype FROM pg_proc p ) AS x (objschema, objname, objtype, objdtdid, objtypeid) WHERE n.oid = x.objschema AND at.oid = x.objtypeid AND (at.typelem <> 0 AND at.typlen = -1) AND at.typelem = bt.oid AND nbt.oid = bt.typnamespace AND (n.nspname, x.objname, x.objtype, x.objdtdid) IN ( SELECT object_schema, object_name, object_type, dtd_identifier FROM data_type_privileges ); -- information_schema.tables CREATE VIEW public.tables AS SELECT CAST(current_database() AS sql_identifier) AS table_catalog, CAST(nc.nspname AS sql_identifier) AS table_schema, CAST(c.relname AS sql_identifier) AS table_name, CAST( CASE WHEN nc.oid = pg_my_temp_schema() THEN 'LOCAL TEMPORARY' WHEN c.relkind = 'r' THEN 'BASE TABLE' WHEN c.relkind = 'v' THEN 'VIEW' ELSE null END AS character_data) AS table_type, CAST(null AS sql_identifier) AS self_referencing_column_name, CAST(null AS character_data) AS reference_generation, CAST(null AS sql_identifier) AS user_defined_type_catalog, CAST(null AS sql_identifier) AS user_defined_type_schema, CAST(null AS sql_identifier) AS user_defined_type_name, CAST(CASE WHEN c.relkind = 'r' THEN 'YES' ELSE 'NO' END AS character_data) AS is_insertable_into, CAST('NO' AS character_data) AS is_typed, CAST( CASE WHEN nc.oid = pg_my_temp_schema() THEN 'PRESERVE' -- FIXME ELSE null END AS character_data) AS commit_action FROM pg_namespace nc, pg_class c WHERE c.relnamespace = nc.oid AND c.relkind IN ('r', 'v') AND (NOT pg_is_other_temp_schema(nc.oid)) AND (pg_has_role(c.relowner, 'USAGE') OR has_table_privilege(c.oid, 'SELECT') OR has_table_privilege(c.oid, 'INSERT') OR has_table_privilege(c.oid, 'UPDATE') OR has_table_privilege(c.oid, 'DELETE') OR has_table_privilege(c.oid, 'REFERENCES') OR has_table_privilege(c.oid, 'TRIGGER') ); -- Done creating views, restore search path to public set search_path='public';
the_stack
-- -- MERGE -- --\set VERBOSITY verbose --set debug_print_rewritten = true; --set debug_print_parse = true; --set debug_print_pretty = true; CREATE USER regress_merge_privs; CREATE USER regress_merge_no_privs; DROP TABLE IF EXISTS target; DROP TABLE IF EXISTS source; CREATE TABLE target (tid integer, balance integer); CREATE TABLE source (sid integer, delta integer); --no index INSERT INTO target VALUES (1, 10); INSERT INTO target VALUES (2, 20); INSERT INTO target VALUES (3, 30); SELECT t.ctid is not null as matched, t.*, s.* FROM source s FULL OUTER JOIN target t ON s.sid = t.tid ORDER BY t.tid, s.sid; ALTER TABLE target OWNER TO regress_merge_privs; ALTER TABLE source OWNER TO regress_merge_privs; CREATE TABLE target2 (tid integer, balance integer); CREATE TABLE source2 (sid integer, delta integer); ALTER TABLE target2 OWNER TO regress_merge_no_privs; ALTER TABLE source2 OWNER TO regress_merge_no_privs; GRANT INSERT ON target TO regress_merge_no_privs; SET SESSION AUTHORIZATION regress_merge_privs; EXPLAIN (COSTS OFF) MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN DELETE; -- -- Errors -- MERGE INTO target t RANDOMWORD USING source AS s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = 0; -- MATCHED/INSERT error MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN INSERT DEFAULT VALUES; -- incorrectly specifying INTO target MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT INTO target DEFAULT VALUES; -- Multiple VALUES clause MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT VALUES (1,1), (2,2); -- SELECT query for INSERT MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT SELECT (1, 1); -- NOT MATCHED/UPDATE MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN UPDATE SET balance = 0; -- UPDATE tablename MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN UPDATE target SET balance = 0; -- source and target names the same MERGE INTO target USING target ON tid = tid WHEN MATCHED THEN DO NOTHING; -- unsupported relation types -- view CREATE VIEW tv AS SELECT * FROM target; MERGE INTO tv t USING source s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT DEFAULT VALUES; DROP VIEW tv; -- materialized view CREATE MATERIALIZED VIEW mv AS SELECT * FROM target; MERGE INTO mv t USING source s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT DEFAULT VALUES; DROP MATERIALIZED VIEW mv; -- permissions MERGE INTO target USING source2 ON target.tid = source2.sid WHEN MATCHED THEN UPDATE SET balance = 0; GRANT INSERT ON target TO regress_merge_no_privs; SET SESSION AUTHORIZATION regress_merge_no_privs; MERGE INTO target USING source2 ON target.tid = source2.sid WHEN MATCHED THEN UPDATE SET balance = 0; GRANT UPDATE ON target2 TO regress_merge_privs; SET SESSION AUTHORIZATION regress_merge_privs; MERGE INTO target2 USING source ON target2.tid = source.sid WHEN MATCHED THEN DELETE; MERGE INTO target2 USING source ON target2.tid = source.sid WHEN NOT MATCHED THEN INSERT DEFAULT VALUES; -- check if the target can be accessed from source relation subquery; we should -- not be able to do so MERGE INTO target t USING (SELECT * FROM source WHERE t.tid > sid) s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT DEFAULT VALUES; -- -- initial tests -- -- zero rows in source has no effect MERGE INTO target USING source ON target.tid = source.sid WHEN MATCHED THEN UPDATE SET balance = 0; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = 0; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN DELETE; BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT DEFAULT VALUES; ROLLBACK; -- insert some non-matching source rows to work from INSERT INTO source VALUES (4, 40); SELECT * FROM source ORDER BY sid; SELECT * FROM target ORDER BY tid; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN DO NOTHING; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = 0; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN DELETE; BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT DEFAULT VALUES; SELECT * FROM target ORDER BY tid; ROLLBACK; -- index plans INSERT INTO target SELECT generate_series(1000,2500), 0; ALTER TABLE target ADD PRIMARY KEY (tid); ANALYZE target; EXPLAIN (COSTS OFF) MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = 0; EXPLAIN (COSTS OFF) MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN DELETE; EXPLAIN (COSTS OFF) MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT VALUES (4, NULL); DELETE FROM target WHERE tid > 100; ANALYZE target; -- insert some matching source rows to work from INSERT INTO source VALUES (2, 5); INSERT INTO source VALUES (3, 20); SELECT * FROM source ORDER BY sid; SELECT * FROM target ORDER BY tid; -- equivalent of an UPDATE join BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = 0; SELECT * FROM target ORDER BY tid; ROLLBACK; -- equivalent of a DELETE join BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN DELETE; SELECT * FROM target ORDER BY tid; ROLLBACK; BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN DO NOTHING; SELECT * FROM target ORDER BY tid; ROLLBACK; BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT VALUES (4, NULL); SELECT * FROM target ORDER BY tid; ROLLBACK; -- duplicate source row causes multiple target row update ERROR INSERT INTO source VALUES (2, 5); SELECT * FROM source ORDER BY sid; SELECT * FROM target ORDER BY tid; BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = 0; ROLLBACK; BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN DELETE; ROLLBACK; -- remove duplicate MATCHED data from source data DELETE FROM source WHERE sid = 2; INSERT INTO source VALUES (2, 5); SELECT * FROM source ORDER BY sid; SELECT * FROM target ORDER BY tid; -- duplicate source row on INSERT should fail because of target_pkey INSERT INTO source VALUES (4, 40); BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT VALUES (4, NULL); SELECT * FROM target ORDER BY tid; ROLLBACK; -- remove duplicate NOT MATCHED data from source data DELETE FROM source WHERE sid = 4; INSERT INTO source VALUES (4, 40); SELECT * FROM source ORDER BY sid; SELECT * FROM target ORDER BY tid; -- remove constraints alter table target drop CONSTRAINT target_pkey; alter table target alter column tid drop not null; -- multiple actions BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT VALUES (4, 4) WHEN MATCHED THEN UPDATE SET balance = 0; SELECT * FROM target ORDER BY tid; ROLLBACK; -- should be equivalent BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = 0 WHEN NOT MATCHED THEN INSERT VALUES (4, 4); SELECT * FROM target ORDER BY tid; ROLLBACK; -- column references -- do a simple equivalent of an UPDATE join BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = t.balance + s.delta; SELECT * FROM target ORDER BY tid; ROLLBACK; -- do a simple equivalent of an INSERT SELECT BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT VALUES (s.sid, s.delta); SELECT * FROM target ORDER BY tid; ROLLBACK; -- and again with duplicate source rows INSERT INTO source VALUES (5, 50); INSERT INTO source VALUES (5, 50); -- do a simple equivalent of an INSERT SELECT BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT VALUES (s.sid, s.delta); SELECT * FROM target ORDER BY tid; ROLLBACK; -- removing duplicate source rows DELETE FROM source WHERE sid = 5; -- and again with explicitly identified column list BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT (tid, balance) VALUES (s.sid, s.delta); SELECT * FROM target ORDER BY tid; ROLLBACK; -- and again with a subtle error: referring to non-existent target row for NOT MATCHED MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT (tid, balance) VALUES (t.tid, s.delta); -- and again with a constant ON clause BEGIN; MERGE INTO target t USING source AS s ON (SELECT true) WHEN NOT MATCHED THEN INSERT (tid, balance) VALUES (t.tid, s.delta); SELECT * FROM target ORDER BY tid; ROLLBACK; -- now the classic UPSERT BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = t.balance + s.delta WHEN NOT MATCHED THEN INSERT VALUES (s.sid, s.delta); SELECT * FROM target ORDER BY tid; ROLLBACK; -- unreachable WHEN clause should ERROR BEGIN; MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED THEN /* Terminal WHEN clause for MATCHED */ DELETE WHEN MATCHED AND s.delta > 0 THEN UPDATE SET balance = t.balance - s.delta; ROLLBACK; -- conditional WHEN clause CREATE TABLE wq_target (tid integer not null, balance integer DEFAULT -1); CREATE TABLE wq_source (balance integer, sid integer); INSERT INTO wq_source (sid, balance) VALUES (1, 100); BEGIN; -- try a simple INSERT with default values first MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT (tid) VALUES (s.sid); SELECT * FROM wq_target; ROLLBACK; -- this time with a FALSE condition MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN NOT MATCHED AND FALSE THEN INSERT (tid) VALUES (s.sid); SELECT * FROM wq_target; -- this time with an actual condition which returns false MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN NOT MATCHED AND s.balance <> 100 THEN INSERT (tid) VALUES (s.sid); SELECT * FROM wq_target; BEGIN; -- and now with a condition which returns true MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN NOT MATCHED AND s.balance = 100 THEN INSERT (tid) VALUES (s.sid); SELECT * FROM wq_target; ROLLBACK; -- conditions in the NOT MATCHED clause can only refer to source columns BEGIN; MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN NOT MATCHED AND t.balance = 100 THEN INSERT (tid) VALUES (s.sid); SELECT * FROM wq_target; ROLLBACK; MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN NOT MATCHED AND s.balance = 100 THEN INSERT (tid) VALUES (s.sid); SELECT * FROM wq_target; -- conditions in MATCHED clause can refer to both source and target SELECT * FROM wq_source; MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN MATCHED AND s.balance = 100 THEN UPDATE SET balance = t.balance + s.balance; SELECT * FROM wq_target; MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN MATCHED AND t.balance = 100 THEN UPDATE SET balance = t.balance + s.balance; SELECT * FROM wq_target; -- check if AND works MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN MATCHED AND t.balance = 99 AND s.balance > 100 THEN UPDATE SET balance = t.balance + s.balance; SELECT * FROM wq_target; MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN MATCHED AND t.balance = 99 AND s.balance = 100 THEN UPDATE SET balance = t.balance + s.balance; SELECT * FROM wq_target; -- check if OR works MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN MATCHED AND t.balance = 99 OR s.balance > 100 THEN UPDATE SET balance = t.balance + s.balance; SELECT * FROM wq_target; MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN MATCHED AND t.balance = 199 OR s.balance > 100 THEN UPDATE SET balance = t.balance + s.balance; SELECT * FROM wq_target; -- check source-side whole-row references BEGIN; MERGE INTO wq_target t USING wq_source s ON (t.tid = s.sid) WHEN matched and t = s or t.tid = s.sid THEN UPDATE SET balance = t.balance + s.balance; SELECT * FROM wq_target; ROLLBACK; -- check if subqueries work in the conditions? MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN MATCHED AND t.balance > (SELECT max(balance) FROM target) THEN UPDATE SET balance = t.balance + s.balance; -- check if we can access system columns in the conditions MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN MATCHED AND t.xmin = t.xmax THEN UPDATE SET balance = t.balance + s.balance; MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN MATCHED AND t.tableoid >= 0 THEN UPDATE SET balance = t.balance + s.balance; SELECT * FROM wq_target; -- test preventing WHEN conditions from writing to the database create or replace function merge_when_and_write() returns boolean language plpgsql as $$ BEGIN INSERT INTO target VALUES (100, 100); RETURN TRUE; END; $$; BEGIN; MERGE INTO wq_target t USING wq_source s ON t.tid = s.sid WHEN MATCHED AND (merge_when_and_write()) THEN UPDATE SET balance = t.balance + s.balance; ROLLBACK; drop function merge_when_and_write(); DROP TABLE wq_target, wq_source; -- test triggers create or replace function merge_trigfunc () returns trigger language plpgsql as $$ DECLARE line text; BEGIN SELECT INTO line format('%s %s %s trigger%s', TG_WHEN, TG_OP, TG_LEVEL, CASE WHEN TG_OP = 'INSERT' AND TG_LEVEL = 'ROW' THEN format(' row: %s', NEW) WHEN TG_OP = 'UPDATE' AND TG_LEVEL = 'ROW' THEN format(' row: %s -> %s', OLD, NEW) WHEN TG_OP = 'DELETE' AND TG_LEVEL = 'ROW' THEN format(' row: %s', OLD) END); RAISE NOTICE '%', line; IF (TG_WHEN = 'BEFORE' AND TG_LEVEL = 'ROW') THEN IF (TG_OP = 'DELETE') THEN RETURN OLD; ELSE RETURN NEW; END IF; ELSE RETURN NULL; END IF; END; $$; CREATE TRIGGER merge_bsi BEFORE INSERT ON target FOR EACH STATEMENT EXECUTE PROCEDURE merge_trigfunc (); CREATE TRIGGER merge_bsu BEFORE UPDATE ON target FOR EACH STATEMENT EXECUTE PROCEDURE merge_trigfunc (); CREATE TRIGGER merge_bsd BEFORE DELETE ON target FOR EACH STATEMENT EXECUTE PROCEDURE merge_trigfunc (); CREATE TRIGGER merge_asi AFTER INSERT ON target FOR EACH STATEMENT EXECUTE PROCEDURE merge_trigfunc (); CREATE TRIGGER merge_asu AFTER UPDATE ON target FOR EACH STATEMENT EXECUTE PROCEDURE merge_trigfunc (); CREATE TRIGGER merge_asd AFTER DELETE ON target FOR EACH STATEMENT EXECUTE PROCEDURE merge_trigfunc (); CREATE TRIGGER merge_bri BEFORE INSERT ON target FOR EACH ROW EXECUTE PROCEDURE merge_trigfunc (); CREATE TRIGGER merge_bru BEFORE UPDATE ON target FOR EACH ROW EXECUTE PROCEDURE merge_trigfunc (); CREATE TRIGGER merge_brd BEFORE DELETE ON target FOR EACH ROW EXECUTE PROCEDURE merge_trigfunc (); CREATE TRIGGER merge_ari AFTER INSERT ON target FOR EACH ROW EXECUTE PROCEDURE merge_trigfunc (); CREATE TRIGGER merge_aru AFTER UPDATE ON target FOR EACH ROW EXECUTE PROCEDURE merge_trigfunc (); CREATE TRIGGER merge_ard AFTER DELETE ON target FOR EACH ROW EXECUTE PROCEDURE merge_trigfunc (); -- now the classic UPSERT, with a DELETE BEGIN; UPDATE target SET balance = 0 WHERE tid = 3; --EXPLAIN (ANALYZE ON, COSTS OFF, SUMMARY OFF, TIMING OFF) MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED AND t.balance > s.delta THEN UPDATE SET balance = t.balance - s.delta WHEN MATCHED THEN DELETE WHEN NOT MATCHED THEN INSERT VALUES (s.sid, s.delta); SELECT * FROM target ORDER BY tid; ROLLBACK; -- Test behavior of triggers that turn UPDATE/DELETE into no-ops create or replace function skip_merge_op() returns trigger language plpgsql as $$ BEGIN RETURN NULL; END; $$; SELECT * FROM target full outer join source on (sid = tid); create trigger merge_skip BEFORE INSERT OR UPDATE or DELETE ON target FOR EACH ROW EXECUTE FUNCTION skip_merge_op(); MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED AND s.sid = 3 THEN UPDATE SET balance = t.balance + s.delta WHEN MATCHED THEN DELETE WHEN NOT MATCHED THEN INSERT VALUES (sid, delta); SELECT * FROM target FULL OUTER JOIN source ON (sid = tid); DROP TRIGGER merge_skip ON target; DROP FUNCTION skip_merge_op(); -- test from PL/pgSQL -- make sure MERGE INTO isn't interpreted to mean returning variables like SELECT INTO BEGIN; DO LANGUAGE plpgsql $$ BEGIN MERGE INTO target t USING source AS s ON t.tid = s.sid WHEN MATCHED AND t.balance > s.delta THEN UPDATE SET balance = t.balance - s.delta; END; $$; ROLLBACK; --source constants BEGIN; MERGE INTO target t USING (SELECT 9 AS sid, 57 AS delta) AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT (tid, balance) VALUES (s.sid, s.delta); SELECT * FROM target ORDER BY tid; ROLLBACK; --source query BEGIN; MERGE INTO target t USING (SELECT sid, delta FROM source WHERE delta > 0) AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT (tid, balance) VALUES (s.sid, s.delta); SELECT * FROM target ORDER BY tid; ROLLBACK; BEGIN; MERGE INTO target t USING (SELECT sid, delta as newname FROM source WHERE delta > 0) AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT (tid, balance) VALUES (s.sid, s.newname); SELECT * FROM target ORDER BY tid; ROLLBACK; --self-merge BEGIN; MERGE INTO target t1 USING target t2 ON t1.tid = t2.tid WHEN MATCHED THEN UPDATE SET balance = t1.balance + t2.balance WHEN NOT MATCHED THEN INSERT VALUES (t2.tid, t2.balance); SELECT * FROM target ORDER BY tid; ROLLBACK; BEGIN; MERGE INTO target t USING (SELECT tid as sid, balance as delta FROM target WHERE balance > 0) AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT (tid, balance) VALUES (s.sid, s.delta); SELECT * FROM target ORDER BY tid; ROLLBACK; BEGIN; MERGE INTO target t USING (SELECT sid, max(delta) AS delta FROM source GROUP BY sid HAVING count(*) = 1 ORDER BY sid ASC) AS s ON t.tid = s.sid WHEN NOT MATCHED THEN INSERT (tid, balance) VALUES (s.sid, s.delta); SELECT * FROM target ORDER BY tid; ROLLBACK; -- plpgsql parameters and results BEGIN; CREATE FUNCTION merge_func (p_id integer, p_bal integer) RETURNS INTEGER LANGUAGE plpgsql AS $$ DECLARE result integer; BEGIN MERGE INTO target t USING (SELECT p_id AS sid) AS s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = t.balance - p_bal; IF FOUND THEN GET DIAGNOSTICS result := ROW_COUNT; END IF; RETURN result; END; $$; SELECT merge_func(3, 4); SELECT * FROM target ORDER BY tid; ROLLBACK; -- PREPARE BEGIN; prepare foom as merge into target t using (select 1 as sid) s on (t.tid = s.sid) when matched then update set balance = 1; execute foom; SELECT * FROM target ORDER BY tid; ROLLBACK; BEGIN; PREPARE foom2 (integer, integer) AS MERGE INTO target t USING (SELECT 1) s ON t.tid = $1 WHEN MATCHED THEN UPDATE SET balance = $2; --EXPLAIN (ANALYZE ON, COSTS OFF, SUMMARY OFF, TIMING OFF) execute foom2 (1, 1); SELECT * FROM target ORDER BY tid; ROLLBACK; -- subqueries in source relation CREATE TABLE sq_target (tid integer NOT NULL, balance integer); CREATE TABLE sq_source (delta integer, sid integer, balance integer DEFAULT 0); INSERT INTO sq_target(tid, balance) VALUES (1,100), (2,200), (3,300); INSERT INTO sq_source(sid, delta) VALUES (1,10), (2,20), (4,40); BEGIN; MERGE INTO sq_target t USING (SELECT * FROM sq_source) s ON tid = sid WHEN MATCHED AND t.balance > delta THEN UPDATE SET balance = t.balance + delta; SELECT * FROM sq_target; ROLLBACK; -- try a view CREATE VIEW v AS SELECT * FROM sq_source WHERE sid < 2; BEGIN; MERGE INTO sq_target USING v ON tid = sid WHEN MATCHED THEN UPDATE SET balance = v.balance + delta; SELECT * FROM sq_target; ROLLBACK; -- ambiguous reference to a column BEGIN; MERGE INTO sq_target USING v ON tid = sid WHEN MATCHED AND tid > 2 THEN UPDATE SET balance = balance + delta WHEN NOT MATCHED THEN INSERT (balance, tid) VALUES (balance + delta, sid) WHEN MATCHED AND tid < 2 THEN DELETE; ROLLBACK; BEGIN; INSERT INTO sq_source (sid, balance, delta) VALUES (-1, -1, -10); MERGE INTO sq_target t USING v ON tid = sid WHEN MATCHED AND tid > 2 THEN UPDATE SET balance = t.balance + delta WHEN NOT MATCHED THEN INSERT (balance, tid) VALUES (balance + delta, sid) WHEN MATCHED AND tid < 2 THEN DELETE; SELECT * FROM sq_target; ROLLBACK; -- CTEs BEGIN; INSERT INTO sq_source (sid, balance, delta) VALUES (-1, -1, -10); WITH targq AS ( SELECT * FROM v ) MERGE INTO sq_target t USING v ON tid = sid WHEN MATCHED AND tid > 2 THEN UPDATE SET balance = t.balance + delta WHEN NOT MATCHED THEN INSERT (balance, tid) VALUES (balance + delta, sid) WHEN MATCHED AND tid < 2 THEN DELETE; ROLLBACK; -- RETURNING BEGIN; INSERT INTO sq_source (sid, balance, delta) VALUES (-1, -1, -10); MERGE INTO sq_target t USING v ON tid = sid WHEN MATCHED AND tid > 2 THEN UPDATE SET balance = t.balance + delta WHEN NOT MATCHED THEN INSERT (balance, tid) VALUES (balance + delta, sid) WHEN MATCHED AND tid < 2 THEN DELETE RETURNING *; ROLLBACK; -- EXPLAIN CREATE TABLE ex_mtarget (a int, b int); CREATE TABLE ex_msource (a int, b int); INSERT INTO ex_mtarget SELECT i, i*10 FROM generate_series(1,100,2) i; INSERT INTO ex_msource SELECT i, i*10 FROM generate_series(1,100,1) i; CREATE FUNCTION explain_merge(query text) RETURNS SETOF text LANGUAGE plpgsql AS $$ DECLARE ln text; BEGIN FOR ln IN EXECUTE 'explain (analyze, timing off, summary off, costs off) ' || query LOOP ln := regexp_replace(ln, '(Memory( Usage)?|Buckets|Batches): \S*', '\1: xxx', 'g'); RETURN NEXT ln; END LOOP; END; $$; -- only updates SELECT explain_merge(' MERGE INTO ex_mtarget t USING ex_msource s ON t.a = s.a WHEN MATCHED THEN UPDATE SET b = t.b + 1'); -- only updates to selected tuples SELECT explain_merge(' MERGE INTO ex_mtarget t USING ex_msource s ON t.a = s.a WHEN MATCHED AND t.a < 10 THEN UPDATE SET b = t.b + 1'); -- updates + deletes SELECT explain_merge(' MERGE INTO ex_mtarget t USING ex_msource s ON t.a = s.a WHEN MATCHED AND t.a < 10 THEN UPDATE SET b = t.b + 1 WHEN MATCHED AND t.a >= 10 AND t.a <= 20 THEN DELETE'); -- only inserts SELECT explain_merge(' MERGE INTO ex_mtarget t USING ex_msource s ON t.a = s.a WHEN NOT MATCHED AND s.a < 10 THEN INSERT VALUES (a, b)'); -- all three SELECT explain_merge(' MERGE INTO ex_mtarget t USING ex_msource s ON t.a = s.a WHEN MATCHED AND t.a < 10 THEN UPDATE SET b = t.b + 1 WHEN MATCHED AND t.a >= 30 AND t.a <= 40 THEN DELETE WHEN NOT MATCHED AND s.a < 20 THEN INSERT VALUES (a, b)'); -- nothing SELECT explain_merge(' MERGE INTO ex_mtarget t USING ex_msource s ON t.a = s.a AND t.a < -1000 WHEN MATCHED AND t.a < 10 THEN DO NOTHING'); DROP TABLE ex_msource, ex_mtarget; DROP FUNCTION explain_merge(text); -- Subqueries BEGIN; MERGE INTO sq_target t USING v ON tid = sid WHEN MATCHED THEN UPDATE SET balance = (SELECT count(*) FROM sq_target); SELECT * FROM sq_target WHERE tid = 1; ROLLBACK; BEGIN; MERGE INTO sq_target t USING v ON tid = sid WHEN MATCHED AND (SELECT count(*) > 0 FROM sq_target) THEN UPDATE SET balance = 42; SELECT * FROM sq_target WHERE tid = 1; ROLLBACK; BEGIN; MERGE INTO sq_target t USING v ON tid = sid AND (SELECT count(*) > 0 FROM sq_target) WHEN MATCHED THEN UPDATE SET balance = 42; SELECT * FROM sq_target WHERE tid = 1; ROLLBACK; DROP TABLE sq_target, sq_source CASCADE; CREATE TABLE pa_target (tid integer, balance float, val text) PARTITION BY LIST (tid); CREATE TABLE part1 PARTITION OF pa_target FOR VALUES IN (1,4); CREATE TABLE part2 PARTITION OF pa_target FOR VALUES IN (2,5,6); CREATE TABLE part3 PARTITION OF pa_target FOR VALUES IN (3,8,9); CREATE TABLE part4 PARTITION OF pa_target DEFAULT; CREATE TABLE pa_source (sid integer, delta float); -- insert many rows to the source table INSERT INTO pa_source SELECT id, id * 10 FROM generate_series(1,14) AS id; -- insert a few rows in the target table (odd numbered tid) INSERT INTO pa_target SELECT id, id * 100, 'initial' FROM generate_series(1,14,2) AS id; -- try simple MERGE BEGIN; MERGE INTO pa_target t USING pa_source s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = balance + delta, val = val || ' updated by merge' WHEN NOT MATCHED THEN INSERT VALUES (sid, delta, 'inserted by merge'); SELECT * FROM pa_target ORDER BY tid; ROLLBACK; -- same with a constant qual BEGIN; MERGE INTO pa_target t USING pa_source s ON t.tid = s.sid AND tid = 1 WHEN MATCHED THEN UPDATE SET balance = balance + delta, val = val || ' updated by merge' WHEN NOT MATCHED THEN INSERT VALUES (sid, delta, 'inserted by merge'); SELECT * FROM pa_target ORDER BY tid; ROLLBACK; -- try updating the partition key column BEGIN; MERGE INTO pa_target t USING pa_source s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET tid = tid + 1, balance = balance + delta, val = val || ' updated by merge' WHEN NOT MATCHED THEN INSERT VALUES (sid, delta, 'inserted by merge'); SELECT * FROM pa_target ORDER BY tid; ROLLBACK; DROP TABLE pa_target CASCADE; -- The target table is partitioned in the same way, but this time by attaching -- partitions which have columns in different order, dropped columns etc. CREATE TABLE pa_target (tid integer, balance float, val text) PARTITION BY LIST (tid); CREATE TABLE part1 (tid integer, balance float, val text); CREATE TABLE part2 (balance float, tid integer, val text); CREATE TABLE part3 (tid integer, balance float, val text); CREATE TABLE part4 (extraid text, tid integer, balance float, val text); ALTER TABLE part4 DROP COLUMN extraid; ALTER TABLE pa_target ATTACH PARTITION part1 FOR VALUES IN (1,4); ALTER TABLE pa_target ATTACH PARTITION part2 FOR VALUES IN (2,5,6); ALTER TABLE pa_target ATTACH PARTITION part3 FOR VALUES IN (3,8,9); ALTER TABLE pa_target ATTACH PARTITION part4 DEFAULT; -- insert a few rows in the target table (odd numbered tid) INSERT INTO pa_target SELECT id, id * 100, 'initial' FROM generate_series(1,14,2) AS id; -- try simple MERGE BEGIN; MERGE INTO pa_target t USING pa_source s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = balance + delta, val = val || ' updated by merge' WHEN NOT MATCHED THEN INSERT VALUES (sid, delta, 'inserted by merge'); SELECT * FROM pa_target ORDER BY tid; ROLLBACK; -- same with a constant qual BEGIN; MERGE INTO pa_target t USING pa_source s ON t.tid = s.sid AND tid IN (1, 5) WHEN MATCHED AND tid % 5 = 0 THEN DELETE WHEN MATCHED THEN UPDATE SET balance = balance + delta, val = val || ' updated by merge' WHEN NOT MATCHED THEN INSERT VALUES (sid, delta, 'inserted by merge'); SELECT * FROM pa_target ORDER BY tid; ROLLBACK; -- try updating the partition key column BEGIN; MERGE INTO pa_target t USING pa_source s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET tid = tid + 1, balance = balance + delta, val = val || ' updated by merge' WHEN NOT MATCHED THEN INSERT VALUES (sid, delta, 'inserted by merge'); SELECT * FROM pa_target ORDER BY tid; ROLLBACK; DROP TABLE pa_source; DROP TABLE pa_target CASCADE; -- Sub-partitioning CREATE TABLE pa_target (logts timestamp, tid integer, balance float, val text) PARTITION BY RANGE (logts); CREATE TABLE part_m01 PARTITION OF pa_target FOR VALUES FROM ('2017-01-01') TO ('2017-02-01') PARTITION BY LIST (tid); CREATE TABLE part_m01_odd PARTITION OF part_m01 FOR VALUES IN (1,3,5,7,9); CREATE TABLE part_m01_even PARTITION OF part_m01 FOR VALUES IN (2,4,6,8); CREATE TABLE part_m02 PARTITION OF pa_target FOR VALUES FROM ('2017-02-01') TO ('2017-03-01') PARTITION BY LIST (tid); CREATE TABLE part_m02_odd PARTITION OF part_m02 FOR VALUES IN (1,3,5,7,9); CREATE TABLE part_m02_even PARTITION OF part_m02 FOR VALUES IN (2,4,6,8); CREATE TABLE pa_source (sid integer, delta float); -- insert many rows to the source table INSERT INTO pa_source SELECT id, id * 10 FROM generate_series(1,14) AS id; -- insert a few rows in the target table (odd numbered tid) INSERT INTO pa_target SELECT '2017-01-31', id, id * 100, 'initial' FROM generate_series(1,9,3) AS id; INSERT INTO pa_target SELECT '2017-02-28', id, id * 100, 'initial' FROM generate_series(2,9,3) AS id; -- try simple MERGE BEGIN; MERGE INTO pa_target t USING (SELECT '2017-01-15' AS slogts, * FROM pa_source WHERE sid < 10) s ON t.tid = s.sid WHEN MATCHED THEN UPDATE SET balance = balance + delta, val = val || ' updated by merge' WHEN NOT MATCHED THEN INSERT VALUES (slogts::timestamp, sid, delta, 'inserted by merge'); SELECT * FROM pa_target ORDER BY tid; ROLLBACK; DROP TABLE pa_source; DROP TABLE pa_target CASCADE; -- some complex joins on the source side CREATE TABLE cj_target (tid integer, balance float, val text); CREATE TABLE cj_source1 (sid1 integer, scat integer, delta integer); CREATE TABLE cj_source2 (sid2 integer, sval text); INSERT INTO cj_source1 VALUES (1, 10, 100); INSERT INTO cj_source1 VALUES (1, 20, 200); INSERT INTO cj_source1 VALUES (2, 20, 300); INSERT INTO cj_source1 VALUES (3, 10, 400); INSERT INTO cj_source2 VALUES (1, 'initial source2'); INSERT INTO cj_source2 VALUES (2, 'initial source2'); INSERT INTO cj_source2 VALUES (3, 'initial source2'); -- source relation is an unaliased join MERGE INTO cj_target t USING cj_source1 s1 INNER JOIN cj_source2 s2 ON sid1 = sid2 ON t.tid = sid1 WHEN NOT MATCHED THEN INSERT VALUES (sid1, delta, sval); -- try accessing columns from either side of the source join MERGE INTO cj_target t USING cj_source2 s2 INNER JOIN cj_source1 s1 ON sid1 = sid2 AND scat = 20 ON t.tid = sid1 WHEN NOT MATCHED THEN INSERT VALUES (sid2, delta, sval) WHEN MATCHED THEN DELETE; -- some simple expressions in INSERT targetlist MERGE INTO cj_target t USING cj_source2 s2 INNER JOIN cj_source1 s1 ON sid1 = sid2 ON t.tid = sid1 WHEN NOT MATCHED THEN INSERT VALUES (sid2, delta + scat, sval) WHEN MATCHED THEN UPDATE SET val = val || ' updated by merge'; MERGE INTO cj_target t USING cj_source2 s2 INNER JOIN cj_source1 s1 ON sid1 = sid2 AND scat = 20 ON t.tid = sid1 WHEN MATCHED THEN UPDATE SET val = val || ' ' || delta::text; SELECT * FROM cj_target; ALTER TABLE cj_source1 RENAME COLUMN sid1 TO sid; ALTER TABLE cj_source2 RENAME COLUMN sid2 TO sid; TRUNCATE cj_target; MERGE INTO cj_target t USING cj_source1 s1 INNER JOIN cj_source2 s2 ON s1.sid = s2.sid ON t.tid = s1.sid WHEN NOT MATCHED THEN INSERT VALUES (s2.sid, delta, sval); DROP TABLE cj_source2, cj_source1, cj_target; -- Function scans CREATE TABLE fs_target (a int, b int, c text); MERGE INTO fs_target t USING generate_series(1,100,1) AS id ON t.a = id WHEN MATCHED THEN UPDATE SET b = b + id WHEN NOT MATCHED THEN INSERT VALUES (id, -1); MERGE INTO fs_target t USING generate_series(1,100,2) AS id ON t.a = id WHEN MATCHED THEN UPDATE SET b = b + id, c = 'updated '|| id.*::text WHEN NOT MATCHED THEN INSERT VALUES (id, -1, 'inserted ' || id.*::text); SELECT count(*) FROM fs_target; DROP TABLE fs_target; -- SERIALIZABLE test -- handled in isolation tests -- Inheritance-based partitioning CREATE TABLE measurement ( city_id int not null, logdate date not null, peaktemp int, unitsales int ); CREATE TABLE measurement_y2006m02 ( CHECK ( logdate >= DATE '2006-02-01' AND logdate < DATE '2006-03-01' ) ) INHERITS (measurement); CREATE TABLE measurement_y2006m03 ( CHECK ( logdate >= DATE '2006-03-01' AND logdate < DATE '2006-04-01' ) ) INHERITS (measurement); CREATE TABLE measurement_y2007m01 ( filler text, peaktemp int, logdate date not null, city_id int not null, unitsales int CHECK ( logdate >= DATE '2007-01-01' AND logdate < DATE '2007-02-01') ); ALTER TABLE measurement_y2007m01 DROP COLUMN filler; ALTER TABLE measurement_y2007m01 INHERIT measurement; CREATE OR REPLACE FUNCTION measurement_insert_trigger() RETURNS TRIGGER AS $$ BEGIN IF ( NEW.logdate >= DATE '2006-02-01' AND NEW.logdate < DATE '2006-03-01' ) THEN INSERT INTO measurement_y2006m02 VALUES (NEW.*); ELSIF ( NEW.logdate >= DATE '2006-03-01' AND NEW.logdate < DATE '2006-04-01' ) THEN INSERT INTO measurement_y2006m03 VALUES (NEW.*); ELSIF ( NEW.logdate >= DATE '2007-01-01' AND NEW.logdate < DATE '2007-02-01' ) THEN INSERT INTO measurement_y2007m01 (city_id, logdate, peaktemp, unitsales) VALUES (NEW.*); ELSE RAISE EXCEPTION 'Date out of range. Fix the measurement_insert_trigger() function!'; END IF; RETURN NULL; END; $$ LANGUAGE plpgsql ; CREATE TRIGGER insert_measurement_trigger BEFORE INSERT ON measurement FOR EACH ROW EXECUTE PROCEDURE measurement_insert_trigger(); INSERT INTO measurement VALUES (1, '2006-02-10', 35, 10); INSERT INTO measurement VALUES (1, '2006-02-16', 45, 20); INSERT INTO measurement VALUES (1, '2006-03-17', 25, 10); INSERT INTO measurement VALUES (1, '2006-03-27', 15, 40); INSERT INTO measurement VALUES (1, '2007-01-15', 10, 10); INSERT INTO measurement VALUES (1, '2007-01-17', 10, 10); SELECT tableoid::regclass, * FROM measurement ORDER BY city_id, logdate; CREATE TABLE new_measurement (LIKE measurement); INSERT INTO new_measurement VALUES (1, '2006-03-01', 20, 10); INSERT INTO new_measurement VALUES (1, '2006-02-16', 50, 10); INSERT INTO new_measurement VALUES (2, '2006-02-10', 20, 20); INSERT INTO new_measurement VALUES (1, '2006-03-27', NULL, NULL); INSERT INTO new_measurement VALUES (1, '2007-01-17', NULL, NULL); INSERT INTO new_measurement VALUES (1, '2007-01-15', 5, NULL); INSERT INTO new_measurement VALUES (1, '2007-01-16', 10, 10); MERGE into measurement m USING new_measurement nm ON (m.city_id = nm.city_id and m.logdate=nm.logdate) WHEN MATCHED AND nm.peaktemp IS NULL THEN DELETE WHEN MATCHED THEN UPDATE SET peaktemp = greatest(m.peaktemp, nm.peaktemp), unitsales = m.unitsales + coalesce(nm.unitsales, 0) WHEN NOT MATCHED THEN INSERT (city_id, logdate, peaktemp, unitsales) VALUES (city_id, logdate, peaktemp, unitsales); SELECT tableoid::regclass, * FROM measurement ORDER BY city_id, logdate; DROP TABLE measurement, new_measurement CASCADE; DROP FUNCTION measurement_insert_trigger(); -- prepare RESET SESSION AUTHORIZATION; DROP TABLE target, target2; DROP TABLE source, source2; DROP FUNCTION merge_trigfunc(); DROP USER regress_merge_privs; DROP USER regress_merge_no_privs;
the_stack
-- Amavis 2.11.0 MySQL schema -- Provided by Modoboa -- Warning: foreign key creations are enabled -- local users CREATE TABLE users ( id int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, -- unique id priority integer NOT NULL DEFAULT '7', -- sort field, 0 is low prior. policy_id integer unsigned NOT NULL DEFAULT '1', -- JOINs with policy.id email varbinary(255) NOT NULL UNIQUE, fullname varchar(255) DEFAULT NULL -- not used by amavisd-new -- local char(1) -- Y/N (optional field, see note further down) ); -- any e-mail address (non- rfc2822-quoted), external or local, -- used as senders in wblist CREATE TABLE mailaddr ( id int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, priority integer NOT NULL DEFAULT '7', -- 0 is low priority email varbinary(255) NOT NULL UNIQUE ); -- per-recipient whitelist and/or blacklist, -- puts sender and recipient in relation wb (white or blacklisted sender) CREATE TABLE wblist ( rid integer unsigned NOT NULL, -- recipient: users.id sid integer unsigned NOT NULL, -- sender: mailaddr.id wb varchar(10) NOT NULL, -- W or Y / B or N / space=neutral / score PRIMARY KEY (rid,sid) ); CREATE TABLE policy ( id int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, -- 'id' this is the _only_ required field policy_name varchar(32), -- not used by amavisd-new, a comment virus_lover char(1) default NULL, -- Y/N spam_lover char(1) default NULL, -- Y/N unchecked_lover char(1) default NULL, -- Y/N banned_files_lover char(1) default NULL, -- Y/N bad_header_lover char(1) default NULL, -- Y/N bypass_virus_checks char(1) default NULL, -- Y/N bypass_spam_checks char(1) default NULL, -- Y/N bypass_banned_checks char(1) default NULL, -- Y/N bypass_header_checks char(1) default NULL, -- Y/N virus_quarantine_to varchar(64) default NULL, spam_quarantine_to varchar(64) default NULL, banned_quarantine_to varchar(64) default NULL, unchecked_quarantine_to varchar(64) default NULL, bad_header_quarantine_to varchar(64) default NULL, clean_quarantine_to varchar(64) default NULL, archive_quarantine_to varchar(64) default NULL, spam_tag_level float default NULL, -- higher score inserts spam info headers spam_tag2_level float default NULL, -- inserts 'declared spam' header fields spam_tag3_level float default NULL, -- inserts 'blatant spam' header fields spam_kill_level float default NULL, -- higher score triggers evasive actions -- e.g. reject/drop, quarantine, ... -- (subject to final_spam_destiny setting) spam_dsn_cutoff_level float default NULL, spam_quarantine_cutoff_level float default NULL, addr_extension_virus varchar(64) default NULL, addr_extension_spam varchar(64) default NULL, addr_extension_banned varchar(64) default NULL, addr_extension_bad_header varchar(64) default NULL, warnvirusrecip char(1) default NULL, -- Y/N warnbannedrecip char(1) default NULL, -- Y/N warnbadhrecip char(1) default NULL, -- Y/N newvirus_admin varchar(64) default NULL, virus_admin varchar(64) default NULL, banned_admin varchar(64) default NULL, bad_header_admin varchar(64) default NULL, spam_admin varchar(64) default NULL, spam_subject_tag varchar(64) default NULL, spam_subject_tag2 varchar(64) default NULL, spam_subject_tag3 varchar(64) default NULL, message_size_limit integer default NULL, -- max size in bytes, 0 disable banned_rulenames varchar(64) default NULL, -- comma-separated list of ... -- names mapped through %banned_rules to actual banned_filename tables disclaimer_options varchar(64) default NULL, forward_method varchar(64) default NULL, sa_userconf varchar(64) default NULL, sa_username varchar(64) default NULL ); -- R/W part of the dataset (optional) -- May reside in the same or in a separate database as lookups database; -- REQUIRES SUPPORT FOR TRANSACTIONS; specified in @storage_sql_dsn -- -- MySQL note ( http://dev.mysql.com/doc/mysql/en/storage-engines.html ): -- ENGINE is the preferred term, but cannot be used before MySQL 4.0.18. -- TYPE is available beginning with MySQL 3.23.0, the first version of -- MySQL for which multiple storage engines were available. If you omit -- the ENGINE or TYPE option, the default storage engine is used. -- By default this is MyISAM. -- -- Please create additional indexes on keys when needed, or drop suggested -- ones as appropriate to optimize queries needed by a management application. -- See your database documentation for further optimization hints. With MySQL -- see Chapter 15 of the reference manual. For example the chapter 15.17 says: -- InnoDB does not keep an internal count of rows in a table. To process a -- SELECT COUNT(*) FROM T statement, InnoDB must scan an index of the table, -- which takes some time if the index is not entirely in the buffer pool. -- -- Wayne Smith adds: When using MySQL with InnoDB one might want to -- increase buffer size for both pool and log, and might also want -- to change flush settings for a little better performance. Example: -- innodb_buffer_pool_size = 384M -- innodb_log_buffer_size = 8M -- innodb_flush_log_at_trx_commit = 0 -- The big performance increase is the first two, the third just helps with -- lowering disk activity. Consider also adjusting the key_buffer_size. -- provide unique id for each e-mail address, avoids storing copies CREATE TABLE maddr ( partition_tag integer DEFAULT 0, -- see $partition_tag id bigint unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, email varbinary(255) NOT NULL, -- full mail address domain varchar(255) NOT NULL, -- only domain part of the email address -- with subdomain fields in reverse CONSTRAINT part_email UNIQUE (partition_tag,email) ) ENGINE=InnoDB; -- information pertaining to each processed message as a whole; -- NOTE: records with NULL msgs.content should be ignored by utilities, -- as such records correspond to messages just being processes, or were lost -- NOTE: instead of a character field time_iso, one might prefer: -- time_iso TIMESTAMP NOT NULL DEFAULT 0, -- but the following MUST then be set in amavisd.conf: $timestamp_fmt_mysql=1 CREATE TABLE msgs ( partition_tag integer DEFAULT 0, -- see $partition_tag mail_id varbinary(16) NOT NULL, -- long-term unique mail id, dflt 12 ch secret_id varbinary(16) DEFAULT '', -- authorizes release of mail_id, 12 ch am_id varchar(20) NOT NULL, -- id used in the log time_num integer unsigned NOT NULL, -- rx_time: seconds since Unix epoch time_iso char(16) NOT NULL, -- rx_time: ISO8601 UTC ascii time sid bigint unsigned NOT NULL, -- sender: maddr.id policy varchar(255) DEFAULT '', -- policy bank path (like macro %p) client_addr varchar(255) DEFAULT '', -- SMTP client IP address (IPv4 or v6) size integer unsigned NOT NULL, -- message size in bytes originating char(1) DEFAULT ' ' NOT NULL, -- sender from inside or auth'd content char(1), -- content type: V/B/U/S/Y/M/H/O/T/C -- virus/banned/unchecked/spam(kill)/spammy(tag2)/ -- /bad-mime/bad-header/oversized/mta-err/clean -- is NULL on partially processed mail -- (prior to 2.7.0 the CC_SPAMMY was logged as 's', now 'Y' is used; -- to avoid a need for case-insenstivity in queries) quar_type char(1), -- quarantined as: ' '/F/Z/B/Q/M/L -- none/file/zipfile/bsmtp/sql/ -- /mailbox(smtp)/mailbox(lmtp) quar_loc varbinary(255) DEFAULT '', -- quarantine location (e.g. file) dsn_sent char(1), -- was DSN sent? Y/N/q (q=quenched) spam_level float, -- SA spam level (no boosts) message_id varchar(255) DEFAULT '', -- mail Message-ID header field from_addr varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '', -- mail From header field, UTF8 subject varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '', -- mail Subject header field, UTF8 host varchar(255) NOT NULL, -- hostname where amavisd is running PRIMARY KEY (partition_tag,mail_id), FOREIGN KEY (sid) REFERENCES maddr(id) ON DELETE RESTRICT ) ENGINE=InnoDB; CREATE INDEX msgs_idx_sid ON msgs (sid); CREATE INDEX msgs_idx_mess_id ON msgs (message_id); -- useful with pen pals CREATE INDEX msgs_idx_time_num ON msgs (time_num); -- alternatively when purging based on time_iso (instead of msgs_idx_time_num): CREATE INDEX msgs_idx_time_iso ON msgs (time_iso); -- When using FOREIGN KEY contraints, InnoDB requires index on a field -- (an the field must be the first field in the index). Hence create it: CREATE INDEX msgs_idx_mail_id ON msgs (mail_id); -- per-recipient information related to each processed message; -- NOTE: records in msgrcpt without corresponding msgs.mail_id record are -- orphaned and should be ignored and eventually deleted by external utilities CREATE TABLE msgrcpt ( partition_tag integer DEFAULT 0, -- see $partition_tag mail_id varbinary(16) NOT NULL, -- (must allow duplicates) rseqnum integer DEFAULT 0 NOT NULL, -- recip's enumeration within msg rid bigint unsigned NOT NULL, -- recipient: maddr.id (dupl. allowed) is_local char(1) DEFAULT ' ' NOT NULL, -- recip is: Y=local, N=foreign content char(1) DEFAULT ' ' NOT NULL, -- content type V/B/U/S/Y/M/H/O/T/C ds char(1) NOT NULL, -- delivery status: P/R/B/D/T -- pass/reject/bounce/discard/tempfail rs char(1) NOT NULL, -- release status: initialized to ' ' bl char(1) DEFAULT ' ', -- sender blacklisted by this recip wl char(1) DEFAULT ' ', -- sender whitelisted by this recip bspam_level float, -- per-recipient (total) spam level smtp_resp varchar(255) DEFAULT '', -- SMTP response given to MTA PRIMARY KEY (partition_tag,mail_id,rseqnum), FOREIGN KEY (rid) REFERENCES maddr(id) ON DELETE RESTRICT, FOREIGN KEY (mail_id) REFERENCES msgs(mail_id) ON DELETE CASCADE ) ENGINE=InnoDB; CREATE INDEX msgrcpt_idx_mail_id ON msgrcpt (mail_id); CREATE INDEX msgrcpt_idx_rid ON msgrcpt (rid); -- Additional index on rs since Modoboa uses it to filter its quarantine CREATE INDEX msgrcpt_idx_rs ON msgrcpt (rs); -- mail quarantine in SQL, enabled by $*_quarantine_method='sql:' -- NOTE: records in quarantine without corresponding msgs.mail_id record are -- orphaned and should be ignored and eventually deleted by external utilities CREATE TABLE quarantine ( partition_tag integer DEFAULT 0, -- see $partition_tag mail_id varbinary(16) NOT NULL, -- long-term unique mail id chunk_ind integer unsigned NOT NULL, -- chunk number, starting with 1 mail_text blob NOT NULL, -- store mail as chunks of octets PRIMARY KEY (partition_tag,mail_id,chunk_ind), FOREIGN KEY (mail_id) REFERENCES msgs(mail_id) ON DELETE CASCADE ) ENGINE=InnoDB;
the_stack
SET FOREIGN_KEY_CHECKS=0; DROP DATABASE IF EXISTS hrms; CREATE DATABASE hrms; USE hrms; -- ---------------------------- -- Table structure for `news` -- ---------------------------- DROP TABLE IF EXISTS `news`; CREATE TABLE `news` ( `newsId` int(11) NOT NULL AUTO_INCREMENT, `newsTitle` varchar(50) NOT NULL, `newsContent` text NOT NULL, `publishDate` datetime NOT NULL, `publisher` varchar(250) NOT NULL, `remark` varchar(250) DEFAULT NULL, PRIMARY KEY (`newsId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `dept` -- ---------------------------- DROP TABLE IF EXISTS `dept`; CREATE TABLE `dept` ( `deptId` int(11) NOT NULL AUTO_INCREMENT, `deptName` varchar(50) NOT NULL, `deptResponsibility` varchar(250) DEFAULT NULL, `parentDeptId` int(11) DEFAULT NULL, `deptMan` varchar(45) DEFAULT NULL, `deptTel` varchar(45) DEFAULT NULL, `remark` varchar(250) DEFAULT NULL, PRIMARY KEY (`deptId`), KEY `fk_dept_parentDeptId` (`parentDeptId`), CONSTRAINT `fk_dept_parentDeptId` FOREIGN KEY (`parentDeptId`) REFERENCES `dept` (`deptId`) ) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `employee_state` -- ---------------------------- DROP TABLE IF EXISTS `employee_state`; CREATE TABLE `employee_state` ( `employeeStateId` int(11) NOT NULL AUTO_INCREMENT, `employeeState` varchar(45) DEFAULT NULL, `remark` text, PRIMARY KEY (`employeeStateId`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `post` -- ---------------------------- DROP TABLE IF EXISTS `post`; CREATE TABLE `post` ( `postId` int(11) NOT NULL AUTO_INCREMENT, `postName` varchar(50) NOT NULL, `postResponsibility` varchar(250) NOT NULL, `postSalary` float NOT NULL, `parentPostId` int(11) DEFAULT NULL, `remark` varchar(250) DEFAULT NULL, PRIMARY KEY (`postId`), KEY `fk_post_parentPostId` (`parentPostId`), CONSTRAINT `fk_post_parentPostId` FOREIGN KEY (`parentPostId`) REFERENCES `post` (`postId`) ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `employee` -- ---------------------------- DROP TABLE IF EXISTS `employee`; CREATE TABLE `employee` ( `empId` int(11) NOT NULL AUTO_INCREMENT, `empName` varchar(45) NOT NULL, `empSex` varchar(45) DEFAULT NULL, `empBirthday` date DEFAULT NULL, `empIdNumber` varchar(50) DEFAULT NULL, `empAddress` varchar(100) DEFAULT NULL, `empTel` varchar(30) DEFAULT NULL, `empEmail` varchar(50) DEFAULT NULL, `empQQ` varchar(30) DEFAULT NULL, `empNational` varchar(50) DEFAULT NULL, `empNativePlace` varchar(45) DEFAULT NULL, `empMarriage` varchar(50) DEFAULT NULL, `empPoliticalVisage` varchar(50) DEFAULT NULL, `empPhoto` varchar(200) DEFAULT NULL, `empEducation` varchar(100) DEFAULT NULL, `empDegree` varchar(45) DEFAULT NULL, `empGraduationSchool` varchar(100) DEFAULT NULL, `empGraduationDate` date DEFAULT NULL, `empSpeciality` varchar(50) DEFAULT NULL, `empBankName` varchar(50) DEFAULT NULL, `empBankNumber` varchar(50) DEFAULT NULL, `empAccessionDate` datetime DEFAULT NULL, `empDimissionDate` date DEFAULT NULL, `empWorkStateId` int(11) DEFAULT NULL, `empTitle` varchar(100) DEFAULT NULL, `empWage` float DEFAULT NULL, `deptId` int(11) DEFAULT NULL, `postId` int(11) DEFAULT NULL, `remark` varchar(250) DEFAULT NULL, PRIMARY KEY (`empId`), KEY `fk_employee_deptId` (`deptId`), KEY `fk_employee_postId` (`postId`), KEY `fk_employee_workStateId` (`empWorkStateId`), CONSTRAINT `fk_employee_deptId` FOREIGN KEY (`deptId`) REFERENCES `dept` (`deptId`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_employee_postId` FOREIGN KEY (`postId`) REFERENCES `post` (`postId`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_employee_workStateId` FOREIGN KEY (`empWorkStateId`) REFERENCES `employee_state` (`employeeStateId`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `leavetype` -- ---------------------------- DROP TABLE IF EXISTS `leavetype`; CREATE TABLE `leavetype` ( `leaveTypeId` int(11) NOT NULL AUTO_INCREMENT, `leaveType` varchar(255) DEFAULT NULL, PRIMARY KEY (`leaveTypeId`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `leave` -- ---------------------------- DROP TABLE IF EXISTS `leave`; CREATE TABLE `leave` ( `leaveId` int(11) NOT NULL AUTO_INCREMENT, `applyPerson` varchar(20) NOT NULL, `applyDept` varchar(20) NOT NULL, `applyDate` date NOT NULL, `applyReason` varchar(250) DEFAULT NULL, `leaveTypeId` int(11) NOT NULL, `startTime` datetime NOT NULL, `endTime` datetime NOT NULL, `leaveTime` varchar(20) DEFAULT NULL, `approveDate` date DEFAULT NULL, `approver` varchar(20) DEFAULT NULL, `approveResult` varchar(10) DEFAULT NULL, `approveOption` varchar(250) DEFAULT NULL, `state` varchar(20) DEFAULT NULL, PRIMARY KEY (`leaveId`), KEY `fk_leave_leaveTypeId` (`leaveTypeId`), CONSTRAINT `fk_leave_leaveTypeId` FOREIGN KEY (`leaveTypeId`) REFERENCES `leavetype` (`leaveTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `redeploy_type` -- ---------------------------- DROP TABLE IF EXISTS `redeploy_type`; CREATE TABLE `redeploy_type` ( `redeployTypeId` int(11) NOT NULL AUTO_INCREMENT, `redeployType` varchar(45) NOT NULL, `remark` varchar(200) DEFAULT NULL, PRIMARY KEY (`redeployTypeId`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `employee_redeploy` -- ---------------------------- DROP TABLE IF EXISTS `employee_redeploy`; CREATE TABLE `employee_redeploy` ( `redeployId` int(11) NOT NULL AUTO_INCREMENT, `empId` int(11) NOT NULL, `applyDate` date DEFAULT NULL, `applyPerson` varchar(45) DEFAULT NULL, `redeployDate` date DEFAULT NULL, `deployDept` varchar(45) DEFAULT NULL, `deployPost` varchar(45) DEFAULT NULL, `remark` varchar(300) DEFAULT NULL, `redeployDeptId` int(11) DEFAULT NULL, `redeployPostId` int(11) DEFAULT NULL, `redeployTypeId` int(11) NOT NULL, `transactor` varchar(45) DEFAULT NULL, `transactorOption` text, `state` varchar(45) DEFAULT NULL, PRIMARY KEY (`redeployId`), KEY `fk_employeeRedeploy_empId` (`empId`), KEY `fk_employeeRedeploy_redeployDeptId` (`redeployDeptId`), KEY `fk_employeeRedeploy_redeployPostId` (`redeployPostId`), KEY `fk_employeeRedeploy_redeployTypeId` (`redeployTypeId`), CONSTRAINT `fk_employeeRedeploy_empId` FOREIGN KEY (`empId`) REFERENCES `employee` (`empId`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_employeeRedeploy_redeployDeptId` FOREIGN KEY (`redeployDeptId`) REFERENCES `dept` (`deptId`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_employeeRedeploy_redeployPostId` FOREIGN KEY (`redeployPostId`) REFERENCES `post` (`postId`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_employeeRedeploy_redeployTypeId` FOREIGN KEY (`redeployTypeId`) REFERENCES `redeploy_type` (`redeployTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `recruit` -- ---------------------------- DROP TABLE IF EXISTS `recruit`; CREATE TABLE `recruit` ( `recruitId` int(11) NOT NULL AUTO_INCREMENT, `recruitTitle` varchar(50) DEFAULT NULL, `applyDept` varchar(10) NOT NULL, `applyPerson` varchar(10) NOT NULL, `applyPersonEmail` varchar(50) DEFAULT NULL, `applyDate` date DEFAULT NULL, `applyReason` text NOT NULL, `recruitPost` varchar(20) NOT NULL, `postRequire` text, `recruitCount` int(5) DEFAULT NULL, `personRequire` text, `workingAge` varchar(20) DEFAULT NULL, `wage` varchar(20) DEFAULT NULL, `recruitType` varchar(20) DEFAULT NULL, `recruitWay` varchar(20) DEFAULT NULL, `approveDate` date DEFAULT NULL, `state` varchar(10) DEFAULT NULL, `approver` varchar(10) DEFAULT NULL, `approveResult` varchar(20) DEFAULT NULL, `approverOption` text, `publishDate` date DEFAULT NULL, `deadline` date DEFAULT NULL, PRIMARY KEY (`recruitId`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `jobseeker` -- ---------------------------- DROP TABLE IF EXISTS `jobseeker`; CREATE TABLE `jobseeker` ( `jobSeekerId` int(11) NOT NULL AUTO_INCREMENT, `recruitId` int(11) NOT NULL, `jobSeekerName` varchar(10) NOT NULL, `jobSeekerSex` varchar(5) NOT NULL, `jobSeekerGraduationSchool` varchar(30) DEFAULT NULL, `jobSeekerEducation` varchar(10) DEFAULT NULL, `jobSeekerTel` varchar(20) NOT NULL, `jobSeekerEmail` varchar(30) DEFAULT NULL, `jobSeekerRegistrationForm` varchar(500) DEFAULT NULL, `jobSeekerResume` varchar(500) DEFAULT NULL, PRIMARY KEY (`jobSeekerId`), KEY `fk_joobSeeker_recruitId` (`recruitId`), CONSTRAINT `fk_joobSeeker_recruitId` FOREIGN KEY (`recruitId`) REFERENCES `recruit` (`recruitId`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `traintype` -- ---------------------------- DROP TABLE IF EXISTS `traintype`; CREATE TABLE `traintype` ( `trainTypeId` int(11) NOT NULL AUTO_INCREMENT, `trainType` varchar(45) NOT NULL, `remark` text, PRIMARY KEY (`trainTypeId`) ) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `train` -- ---------------------------- DROP TABLE IF EXISTS `train`; CREATE TABLE `train` ( `trainId` int(11) NOT NULL AUTO_INCREMENT, `trainCourse` varchar(250) NOT NULL, `trainContent` text, `trainUnit` varchar(250) DEFAULT NULL, `trainEmployee` varchar(500) DEFAULT NULL, `trainTutor` varchar(250) DEFAULT NULL, `trainTarget` varchar(500) DEFAULT NULL, `trainStartDate` datetime DEFAULT NULL, `trainEndDate` datetime DEFAULT NULL, `trainTypeId` int(11) DEFAULT NULL, `trainResult` varchar(250) DEFAULT NULL, `remark` varchar(250) DEFAULT NULL, PRIMARY KEY (`trainId`), KEY `fk_train_trainTypeId` (`trainTypeId`), CONSTRAINT `fk_train_trainTypeId` FOREIGN KEY (`trainTypeId`) REFERENCES `traintype` (`trainTypeId`) ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `user` -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `userId` int(11) NOT NULL AUTO_INCREMENT, `userName` varchar(255) NOT NULL, `userTrueName` varchar(45) NOT NULL, `userPassword` varchar(100) NOT NULL, `createDate` datetime DEFAULT NULL, `empId` int(11) NOT NULL, PRIMARY KEY (`userId`), UNIQUE KEY `userName_UNIQUE` (`userName`), UNIQUE KEY `fk_user_empId` (`empId`), CONSTRAINT `fk_user_empId` FOREIGN KEY (`empId`) REFERENCES `employee` (`empId`) ON DELETE CASCADE ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `role` -- ---------------------------- DROP TABLE IF EXISTS `role`; CREATE TABLE `role` ( `roleId` int(11) NOT NULL AUTO_INCREMENT, `roleName` varchar(50) NOT NULL, `roleDescription` varchar(250) DEFAULT NULL, PRIMARY KEY (`roleId`) ) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `user_role` -- ---------------------------- DROP TABLE IF EXISTS `user_role`; CREATE TABLE `user_role` ( `userId` int(11) NOT NULL, `roleId` int(11) NOT NULL, PRIMARY KEY (`userId`,`roleId`), KEY `roleId` (`roleId`), KEY `userId` (`userId`), CONSTRAINT `fk_userRole_roleId` FOREIGN KEY (`roleId`) REFERENCES `role` (`roleId`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_userRole_userId` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE NO ACTION ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `action` -- ---------------------------- DROP TABLE IF EXISTS `action`; CREATE TABLE `action` ( `actionId` int(11) NOT NULL AUTO_INCREMENT, `action` varchar(45) NOT NULL, PRIMARY KEY (`actionId`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `module` -- ---------------------------- DROP TABLE IF EXISTS `module`; CREATE TABLE `module` ( `moduleId` int(11) NOT NULL AUTO_INCREMENT, `moduleName` varchar(45) NOT NULL, `moduleOrderNum` varchar(45) NOT NULL, `linkUrl` varchar(250) DEFAULT NULL, `parentModuleId` int(11) NOT NULL, `moduleDescription` varchar(250) DEFAULT NULL, PRIMARY KEY (`moduleId`) ) ENGINE=InnoDB AUTO_INCREMENT=78 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `user_module` -- ---------------------------- DROP TABLE IF EXISTS `user_module`; CREATE TABLE `user_module` ( `userModuleId` int(11) NOT NULL AUTO_INCREMENT, `userId` int(11) NOT NULL, `moduleSum` varchar(250) NOT NULL, PRIMARY KEY (`userModuleId`), KEY `fk_userId` (`userId`), CONSTRAINT `fk_userId` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `role_module` -- ---------------------------- DROP TABLE IF EXISTS `role_module`; CREATE TABLE `role_module` ( `roleModuleId` int(11) NOT NULL AUTO_INCREMENT, `roleId` int(11) NOT NULL, `moduleSum` varchar(250) NOT NULL, PRIMARY KEY (`roleModuleId`), KEY `fk_roleID` (`roleId`), CONSTRAINT `fk_roleID` FOREIGN KEY (`roleId`) REFERENCES `role` (`roleId`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `user_permission` -- ---------------------------- DROP TABLE IF EXISTS `user_permission`; CREATE TABLE `user_permission` ( `userPermissionId` int(11) NOT NULL AUTO_INCREMENT, `userId` int(11) NOT NULL, `moduleId` int(11) NOT NULL, `actionIds` varchar(45) DEFAULT NULL, `permission` varchar(45) DEFAULT NULL, PRIMARY KEY (`userPermissionId`), KEY `fk_userPermission_moduleId` (`moduleId`), KEY `fk_userPermission_userId` (`userId`), KEY `fk_userPermission_actionId` (`actionIds`), CONSTRAINT `fk_userPermission_moduleId` FOREIGN KEY (`moduleId`) REFERENCES `module` (`moduleId`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_userPermission_userId` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=236 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `role_permission` -- ---------------------------- DROP TABLE IF EXISTS `role_permission`; CREATE TABLE `role_permission` ( `rolePermissionId` int(11) NOT NULL AUTO_INCREMENT, `roleId` int(11) NOT NULL, `moduleId` int(11) NOT NULL, `actionIds` varchar(45) DEFAULT NULL, `permission` varchar(45) DEFAULT NULL, PRIMARY KEY (`rolePermissionId`), KEY `fk_rolePermission_moduleId` (`moduleId`), KEY `fk_rolePermission_roleId` (`roleId`), KEY `fk_rolePermission_actionId` (`actionIds`), CONSTRAINT `fk_rolePermission_moduleId` FOREIGN KEY (`moduleId`) REFERENCES `module` (`moduleId`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_rolePermission_roleId` FOREIGN KEY (`roleId`) REFERENCES `role` (`roleId`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `syslog` -- ---------------------------- DROP TABLE IF EXISTS `syslog`; CREATE TABLE `syslog` ( `logId` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(45) DEFAULT NULL, `date` datetime NOT NULL, `userId` int(11) NOT NULL, `moduleId` int(11) DEFAULT NULL, `action` varchar(45) NOT NULL, `accessIp` varchar(45) NOT NULL, PRIMARY KEY (`logId`), KEY `fk_syslog_moduleId` (`moduleId`), KEY `fk_syslog_userId` (`userId`), CONSTRAINT `fk_syslog_moduleId` FOREIGN KEY (`moduleId`) REFERENCES `module` (`moduleId`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_syslog_userId` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `userId` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=709 DEFAULT CHARSET=utf8; -- init data -- ---------------------------- -- Records of redeploy_type -- ---------------------------- INSERT INTO redeploy_type VALUES ('1', '部门调动', null); INSERT INTO redeploy_type VALUES ('2', '岗位调整', null); INSERT INTO redeploy_type VALUES ('3', '晋升', null); INSERT INTO redeploy_type VALUES ('4', '降级', null); INSERT INTO redeploy_type VALUES ('5', '轮岗', null); INSERT INTO redeploy_type VALUES ('6', '休假', null); INSERT INTO redeploy_type VALUES ('7', '待岗', null); INSERT INTO redeploy_type VALUES ('8', '工伤', null); INSERT INTO redeploy_type VALUES ('9', '其他', null); -- ---------------------------- -- Records of traintype -- ---------------------------- INSERT INTO traintype VALUES ('1', '公司内部培训', '公司内部培训'); INSERT INTO traintype VALUES ('2', '公司外部培训', '公司外部培训'); INSERT INTO traintype VALUES ('3', '其他公司培训', '其他公司培训'); -- ---------------------------- -- Records of leavetype -- ---------------------------- INSERT INTO leavetype VALUES ('1', '事假'); INSERT INTO leavetype VALUES ('2', '病假'); INSERT INTO leavetype VALUES ('3', '婚假'); INSERT INTO leavetype VALUES ('4', '产假'); INSERT INTO leavetype VALUES ('5', '丧假'); INSERT INTO leavetype VALUES ('6', '年假'); INSERT INTO leavetype VALUES ('7', '看护假'); INSERT INTO leavetype VALUES ('8', '调休假'); INSERT INTO leavetype VALUES ('9', '奖励假'); INSERT INTO leavetype VALUES ('10', '其他'); -- ---------------------------- -- Records of action -- ---------------------------- INSERT INTO action VALUES ('1', '浏览'); INSERT INTO action VALUES ('2', '创建'); INSERT INTO action VALUES ('3', '更新'); INSERT INTO action VALUES ('4', '删除'); INSERT INTO action VALUES ('5', '审批'); INSERT INTO action VALUES ('6', '其他'); -- ---------------------------- -- Records of employee_state -- ---------------------------- INSERT INTO employee_state VALUES ('1', '在职', null); INSERT INTO employee_state VALUES ('2', '离职', null); INSERT INTO employee_state VALUES ('3', '返聘', null); INSERT INTO employee_state VALUES ('4', '退休', null); INSERT INTO employee_state VALUES ('5', '留职查看', null); INSERT INTO employee_state VALUES ('6', '停薪留职', null); INSERT INTO employee_state VALUES ('7', '试用期', null); INSERT INTO employee_state VALUES ('8', '试用延长期', null); -- ---------------------------- -- Records of dept -- ---------------------------- INSERT INTO dept VALUES ('1', '懂事会', '公司最高机构', null, '杰哥', '123456', ''); INSERT INTO dept VALUES ('2', '总裁', '总裁', '1', '杰哥', '123456', ''); INSERT INTO dept VALUES ('3', '总裁办', '公司总裁办', '2', '杰哥', '123456', ''); INSERT INTO dept VALUES ('4', '公司总部', '公司行政总部管理', '3', '杰哥', '123456', ''); INSERT INTO dept VALUES ('5', '人力资源部', '人力资源管理', '4', '杰哥', '123456', ''); INSERT INTO dept VALUES ('6', '财务部', '财务管理机构', '4', '杰哥', '123456', ''); INSERT INTO dept VALUES ('7', '生产部', '管理生产', '4', '杰哥', '123456', '管理生产'); INSERT INTO dept VALUES ('8', '资财部', '财务管理', '4', '杰哥', '123456', ''); INSERT INTO dept VALUES ('9', '行政部', '行政管理', '4', '杰哥', '123456', ''); INSERT INTO dept VALUES ('10', '研发部', '产品研发', '4', '杰哥', '123456', ''); INSERT INTO dept VALUES ('11', '财务部', '管理财务', '4', '杰哥', '123456', ''); INSERT INTO dept VALUES ('12', '采购部', '物品采购', '4', '杰哥', '123456', ''); INSERT INTO dept VALUES ('13', '采购组', '采购物品', '4', '杰哥', '123456', ''); INSERT INTO dept VALUES ('14', '市场部', '市场开发', '4', '杰哥', '123456', ''); INSERT INTO dept VALUES ('15', '销售部', '市场销售', '4', '杰哥', '123456', ''); INSERT INTO dept VALUES ('16', '营销事业部', '市场营销', '1', '杰哥', '123456', ''); INSERT INTO dept VALUES ('17', '生产一部', '管理生产一部', '7', '杰哥', '123456', ''); INSERT INTO dept VALUES ('18', '生产二部', '管理生产二部', '7', '杰哥', '123456', ''); INSERT INTO dept VALUES ('19', '生产三部', '管理生产三部', '7', '杰哥', '123456', ''); INSERT INTO dept VALUES ('20', '物流部', '物流运载', '4', '杰哥', '123456', ''); INSERT INTO dept VALUES ('21', '开发部', '开发', '4', 'djj', '123456', '开发'); -- ---------------------------- -- Records of post -- ---------------------------- INSERT INTO post VALUES ('1', '总经理', '负责公司运作', '10000', null, ''); INSERT INTO post VALUES ('2', '副经理', '协助总经理管理公司', '8000', '1', ''); INSERT INTO post VALUES ('3', '市场部经理', '管理市场', '8000', '1', ''); INSERT INTO post VALUES ('4', '营销部经理', '市场营销', '7000', '3', ''); INSERT INTO post VALUES ('5', '销售部经理', '市场销售', '7000', '3', ''); INSERT INTO post VALUES ('6', '生产副总', '市场管理', '7000', '1', ''); -- ---------------------------- -- Records of module -- ---------------------------- INSERT INTO module VALUES ('1', '人力资源', '1000000', '', '0', '系统菜单'); INSERT INTO module VALUES ('2', '人事管理', '1010000', '', '1', '人事管理'); INSERT INTO module VALUES ('3', '招聘管理', '1020000', '', '1', '招聘管理'); INSERT INTO module VALUES ('4', '考勤管理', '1030000', '', '1', '考勤管理'); INSERT INTO module VALUES ('5', '薪资管理', '1040000', '', '1', '薪资管理'); INSERT INTO module VALUES ('6', '培训管理', '1050000', '', '1', '培训管理'); INSERT INTO module VALUES ('7', '机构管理', '1060000', '', '1', '机构管理'); INSERT INTO module VALUES ('8', '系统管理', '1070000', '', '1', '系统管理'); INSERT INTO module VALUES ('9', '个人办公', '1080000', '', '1', '个人办公'); INSERT INTO module VALUES ('10', '用户管理', '1071505', 'user', '8', '用户管理'); INSERT INTO module VALUES ('11', '培训列表', '1050300', 'train', '6', '培训列表'); INSERT INTO module VALUES ('12', '员工管理', '1010100', 'employee', '2', '员工管理'); INSERT INTO module VALUES ('13', '员工异动', '1010200', 'employeeRedeploy', '2', '员工异动'); INSERT INTO module VALUES ('14', '角色管理', '1070405', 'role', '8', '角色管理'); INSERT INTO module VALUES ('19', '异动申请', '1010400', 'employeeRedeploy_add', '2', '异动申请'); INSERT INTO module VALUES ('20', '异动审批', '1010300', 'employeeRedeploy_transactorList', '2', '异动审批'); INSERT INTO module VALUES ('21', '我的异动', '1010500', 'employeeRedeploy_my', '2', '我的异动'); INSERT INTO module VALUES ('22', '模块管理', '1070505', 'module', '8', '模块管理'); INSERT INTO module VALUES ('23', '我的招聘', '1080100', 'recruit_my', '9', '我的招聘'); INSERT INTO module VALUES ('24', '招聘审批', '1080200', 'recruit_approverList', '9', '招聘审批'); INSERT INTO module VALUES ('25', '请假审批', '1080300', 'leave_approverList', '9', '请假审批'); INSERT INTO module VALUES ('26', '角色模块', '1070510', 'roleModule', '8', '角色模块列表'); INSERT INTO module VALUES ('27', '异动审批', '1080400', 'employeeRedeploy_transactorList', '9', '异动审批'); INSERT INTO module VALUES ('28', '操作日志', '1080500', 'syslog_my', '9', '操作日志'); INSERT INTO module VALUES ('29', '删除角色模块', '1070513', 'roleModule_delete', '8', '删除角色模块'); INSERT INTO module VALUES ('30', '用户模块', '1070509', 'userModule', '8', '用户模块列表'); INSERT INTO module VALUES ('32', '添加用户模块', '1070514', 'userModule_add ', '8', '添加用户模块'); INSERT INTO module VALUES ('33', '更新用户模块', '1070515', 'userModule_update ', '8', '更新用户模块'); INSERT INTO module VALUES ('34', '删除用户模块', '1070516', 'userModule_delete ', '8', '删除用户模块'); INSERT INTO module VALUES ('36', '系统日志', '1071205', 'syslog', '8', '系统日志'); INSERT INTO module VALUES ('37', '用户登入', '1071305', 'user_login.action', '8', '用户登入'); INSERT INTO module VALUES ('38', '用户退出', '1071405', 'user_loginOut', '8', '用户退出'); INSERT INTO module VALUES ('39', '部门管理', '1060100', 'dept', '7', '部门管理'); INSERT INTO module VALUES ('40', '职位管理', '1060200', 'post', '7', '职位管理'); INSERT INTO module VALUES ('41', '培训类型', '1050200', 'traintype', '6', '培训类型管理'); INSERT INTO module VALUES ('42', '全部招聘', '1020100', 'recruit', '3', '全部招聘'); INSERT INTO module VALUES ('43', '招聘申请', '1020200', 'recruit_add', '3', '招聘申请'); INSERT INTO module VALUES ('44', '我的招聘', '1020300', 'recruit_my', '3', '我的招聘'); INSERT INTO module VALUES ('45', '招聘审批', '1020400', 'recruit_approverList', '3', '招聘审批'); INSERT INTO module VALUES ('46', '请假管理', '1030100', 'leave', '4', '请假管理'); INSERT INTO module VALUES ('47', '我的请假', '1030200', 'leave_my', '4', '我的请假'); INSERT INTO module VALUES ('48', '请假申请', '1030300', 'leave_add', '4', '请假申请'); INSERT INTO module VALUES ('49', '请假审批', '1030400', 'leave_approverList', '4', '请假审批'); INSERT INTO module VALUES ('50', '我的信息', '1080600', 'user_detail', '9', ''); -- ---------------------------- -- Records of user -- ---------------------------- INSERT INTO user VALUES ('1', 'admin', '杰哥', 'A2GTdNkfWkw=', '2010-11-26 13:19:06', '1'); -- ---------------------------- -- Records of role -- ---------------------------- INSERT INTO role VALUES ('1', '管理员', '系统管理员'); -- ---------------------------- -- Records of user_role -- ---------------------------- INSERT INTO user_role VALUES ('1', '1'); -- ---------------------------- -- Records of employee -- ---------------------------- INSERT INTO employee VALUES ('1', '马云', '男', '1965-10-18', '123456', '赣州', '123456', 'dai_junjie@163.com', '329258829', '汉', '福建', '未婚', '清白', null, '本科', '学士', '赣南师范学院', '2011-06-01', '网络工程', null, null, null, null, '1', '工程师', '0', '3', '1', '没有'); INSERT INTO employee VALUES ('2', '马化腾', '男', '1970-01-11', '23542134545', '是短发是', '1223434', '是短发是', null, '是短发是', '', '是短发是', '是短发是', null, '是短发是', '是短发是', '是短发是', '2011-01-24', '是短发是', null, null, null, null, '7', '是短发是', '0', '25', '6', '是短发是'); INSERT INTO employee VALUES ('3', '李彦宏', '男', '1969-01-04', '1232332', '赣州', '123322332', 'dai_junjie@163.com', '329258829', '汉', '福建', '未婚', '团员', null, '本科', '学士', '赣南师范学院', '2011-01-04', '网络工程', null, null, null, null, '1', '软件设计师', '0', '3', '6', '啊啊'); -- ---------------------------- -- Records of employee_redeploy -- ---------------------------- INSERT INTO employee_redeploy VALUES ('1', '1', '2011-01-01', '', '2010-01-05', '开发部', '软件设计师', null, '3', '6', '1', null, null, '已提交'); INSERT INTO employee_redeploy VALUES ('2', '2', '2011-01-29', '', null, '生产一部', '生产副总', null, '1', '2', '3', '', null, '已提交'); INSERT INTO employee_redeploy VALUES ('3', '9', '2011-01-29', '戴总', null, '物流部', '副经理', '更改', '6', '4', '4', null, null, '已提交'); INSERT INTO employee_redeploy VALUES ('4', '9', '2011-01-29', '戴总', null, '物流部', '副经理', '更改', '6', '4', '4', null, null, '已提交'); INSERT INTO employee_redeploy VALUES ('11', '3', '2011-11-08', 'adsfads', null, '开发部', '生产副总', 'saerfa', '5', '5', '5', null, null, '已提交'); INSERT INTO employee_redeploy VALUES ('12', '3', '2011-11-08', 'adsfads', null, '开发部', '生产副总', 'saerfa', '5', '5', '5', null, null, '已提交'); INSERT INTO employee_redeploy VALUES ('13', '3', '2011-11-08', 'aaa', null, '开发部', '生产副总', 'fff', '1', '5', '9', null, null, '未提交'); INSERT INTO employee_redeploy VALUES ('14', '3', '2011-11-17', 'lll', null, '开发部', '生产副总', 'kkk', '3', '1', '3', 'admin', '阿斯顿发生的', '审批中'); INSERT INTO employee_redeploy VALUES ('15', '3', '2011-11-08', 'adsfads', null, '开发部', '生产副总', 'll', '5', '5', '5', 'admin', '刚刚', '审批中'); INSERT INTO employee_redeploy VALUES ('16', '3', '2011-11-08', 'hhh', null, '开发部', '生产副总', 'hhh', '5', '5', '2', null, null, '未提交'); INSERT INTO employee_redeploy VALUES ('18', '3', '2011-11-08', 'hhh', null, '开发部', '生产副总', 'hhh', '5', '5', '2', null, null, '未提交'); INSERT INTO employee_redeploy VALUES ('19', '3', '2011-11-08', 'hhh', null, '开发部', '生产副总', 'hhh', '5', '5', '2', '戴竣杰', null, '未提交'); INSERT INTO employee_redeploy VALUES ('21', '3', '2011-11-08', 'hhh', null, '开发部', '生产副总', 'jjj', '5', '5', '2', 'asdfdasf', null, '未提交'); INSERT INTO employee_redeploy VALUES ('22', '3', '2011-11-08', 'hhh', null, '开发部', '生产副总', 'jjj', '5', '5', '4', '尹', null, '未提交'); INSERT INTO employee_redeploy VALUES ('23', '3', '2011-11-08', 'hhh', null, '开发部', '生产副总', 'dddd', '12', '5', '7', 'rq', '可以', '未提交'); INSERT INTO employee_redeploy VALUES ('25', '10', '2011-11-10', '尹', '2011-04-15', '办公室', '副经理', 'dfasdf', '5', '1', '1', 'admin', '同意', '同意'); INSERT INTO employee_redeploy VALUES ('32', '8', '2011-11-10', 'assasa', null, '人事部', '营销部经理', 'sca', '4', '4', '3', null, null, '未提交'); -- ---------------------------- -- Records of leave -- ---------------------------- -- INSERT INTO leave VALUES ('1', '杰哥', '人力资源部', '2011-04-28', '回校论文答辩', '1', '2011-05-16 18:24:53', '2011-06-24 18:25:07', '2011-04-27 18:26:33', '2011-04-28', '杰哥', '同意', 'asd发', '审批完毕'); -- INSERT INTO leave VALUES ('2', '杰哥', '人力资源部', '2011-04-28', '宿舍撒', '3', '2011-04-28 00:00:00', '2011-04-29 00:00:00', null, '2011-04-28', null, null, '', '待审批'); -- ---------------------------- -- Records of recruit -- ---------------------------- INSERT INTO recruit VALUES ('1', 'java软件工程师', '开发部', '杰哥', null, '2011-04-01', '公司需求', '公司副总', '熟练开发流程和开发业务', '3', '大专以上', '3年以上工作经验', '7000', '全职', '网络招聘', '2011-04-17', '审批完毕', '杰哥', '不同意', '不同意', '2011-04-05', '2011-06-01'); INSERT INTO recruit VALUES ('2', '招聘c软件工程师', '办公室', '杰哥', 'idreamjay@gmail.com', '2011-04-15', '公司业务需要', 'c实习工程师', '软件开发', '5', '熟练c语言', '0', '2000-3000', '实习生', '校园招聘', '2011-04-17', '已发布', '杰哥', '同意', '同意', '2011-04-20', '2011-10-28'); -- ---------------------------- -- Records of jobseeker -- ---------------------------- INSERT INTO jobseeker VALUES ('1', '1', '李伟', '男', '赣南师范学院', '本科', '123456', 'liwei@163.com', '20114211624843-29958655886912501261李伟registrationForm.doc', '2011421162484344623396012917783091李伟resume.doc'); INSERT INTO jobseeker VALUES ('2', '1', '陆毅', '男', '清华大学', '本科', '123456', 'ly@163.com', '20114211630281-61035574307658767942陆毅registrationForm.doc', '20114211630281-68685887650014779562陆毅resume.doc'); -- ---------------------------- -- Records of train -- ---------------------------- INSERT INTO train VALUES ('1', 'java', 'java', '公司', '杰哥,djj', 'teachers', '达到公司用人要求', '2010-10-08 00:00:00', '2010-10-30 00:00:00', '1', null, 'good study'); INSERT INTO train VALUES ('2', 'struts2', 'study, java', 'aa', 'djj', 'teacher', '熟悉公司业务框架', '2010-10-08 00:00:00', '2010-10-30 00:00:00', '2', null, 'good'); INSERT INTO train VALUES ('8', '再续复杂的算法', '上大放大声的, 撒的发生大幅', '撒的发生的', '杰哥', '士大夫撒旦', '熟悉语言算法', '2010-12-02 00:00:00', '2011-01-12 00:00:00', '3', null, '撒的发生'); -- ---------------------------- -- Records of role_module -- ---------------------------- INSERT INTO role_module VALUES ('1', '1', '6,3,1,2,7,8,39,40,11,41,12,13,19,20,21,42,43,44,45,9,23,24,25,27,28,10,14,22,36,4,46,47,48,49'); INSERT INTO role_module VALUES ('2', '2', '1,9,37'); -- ---------------------------- -- Records of user_module -- ---------------------------- INSERT INTO user_module VALUES ('1', '1', '9,23,24,25,27,28,50,8,10,1,2,12,13,19,20,21,3,4,46,47,48,49,6,11,41,7,39,40,14,22,26,30,36,37,38,42,43,44,45'); INSERT INTO user_module VALUES ('2', '2', '1,2,19,20,21,3,43,44,45,8,36,9,23,24,25,27,6,11,41,7,39,40,10,14,28'); -- ---------------------------- -- Records of role_permission -- ---------------------------- INSERT INTO role_permission VALUES ('1', '1', '1', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('2', '1', '2', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('3', '1', '3', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('4', '1', '4', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('5', '1', '5', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('6', '1', '6', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('7', '1', '7', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('8', '1', '8', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('9', '1', '9', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('10', '1', '10', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('11', '1', '11', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('12', '1', '12', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('13', '1', '13', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('14', '1', '14', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('20', '1', '20', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('21', '1', '21', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('22', '1', '22', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('23', '1', '23', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('24', '1', '24', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('25', '1', '25', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('26', '1', '26', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('28', '1', '28', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('29', '1', '29', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('30', '1', '30', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('31', '1', '31', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('32', '1', '32', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('33', '1', '33', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('34', '1', '34', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('35', '1', '35', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('36', '1', '36', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('37', '1', '37', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('38', '1', '38', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('39', '1', '39', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('40', '1', '40', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('41', '1', '41', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('42', '1', '42', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('43', '1', '43', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('44', '1', '44', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('45', '1', '45', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO role_permission VALUES ('46', '1', '46', '1,2,3,4,5,6', '1,1,1,1,1,1,'); -- ---------------------------- -- Records of user_permission -- ---------------------------- INSERT INTO user_permission VALUES ('1', '1', '1', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('2', '1', '2', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('3', '1', '3', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('4', '1', '4', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('5', '1', '5', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('6', '1', '6', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('7', '1', '7', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('8', '1', '8', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('9', '1', '9', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('10', '1', '10', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('11', '1', '11', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('12', '1', '12', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('13', '1', '13', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('14', '1', '14', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('15', '1', '15', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('16', '1', '16', '1,2,3,4,5,6', '1,1,1,1,-1,1,'); INSERT INTO user_permission VALUES ('17', '1', '17', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('18', '1', '18', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('19', '1', '19', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('20', '1', '20', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('21', '1', '21', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('22', '1', '22', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('23', '1', '23', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('24', '1', '24', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('25', '1', '25', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('26', '1', '26', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('28', '1', '28', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('29', '1', '29', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('30', '1', '30', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('31', '1', '31', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('32', '1', '32', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('33', '1', '33', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('34', '1', '34', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('35', '1', '35', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('36', '1', '36', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('37', '1', '37', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('38', '1', '38', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('39', '1', '39', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('40', '1', '40', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('41', '1', '41', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('42', '1', '42', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('43', '1', '43', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('44', '1', '44', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('45', '1', '45', '1,2,3,4,5,6', '1,1,1,1,1,1,'); INSERT INTO user_permission VALUES ('46', '1', '46', '1,2,3,4,5,6', '1,1,1,1,1,1,');
the_stack
-- -- MERGE INTO -- -- initial CREATE SCHEMA mergeinto_col_2; SET current_schema = mergeinto_col_2; CREATE TABLE products_base ( product_id INTEGER DEFAULT 0, product_name VARCHAR(60) DEFAULT 'null', category VARCHAR(60) DEFAULT 'unknown', total INTEGER DEFAULT '0' ); INSERT INTO products_base VALUES (1501, 'vivitar 35mm', 'electrncs', 100); INSERT INTO products_base VALUES (1502, 'olympus is50', 'electrncs', 100); INSERT INTO products_base VALUES (1600, 'play gym', 'toys', 100); INSERT INTO products_base VALUES (1601, 'lamaze', 'toys', 100); INSERT INTO products_base VALUES (1666, 'harry potter', 'dvd', 100); CREATE TABLE newproducts_base ( product_id INTEGER DEFAULT 0, product_name VARCHAR(60) DEFAULT 'null', category VARCHAR(60) DEFAULT 'unknown', total INTEGER DEFAULT '0' ); INSERT INTO newproducts_base VALUES (1502, 'olympus camera', 'electrncs', 200); INSERT INTO newproducts_base VALUES (1601, 'lamaze', 'toys', 200); INSERT INTO newproducts_base VALUES (1666, 'harry potter', 'toys', 200); INSERT INTO newproducts_base VALUES (1700, 'wait interface', 'books', 200); ANALYZE products_base; ANALYZE newproducts_base; -- -- stream mode(MERGE can be pushed down), column table -- CREATE TABLE products_col ( product_id INTEGER DEFAULT 0, product_name VARCHAR(60) DEFAULT 'null', category VARCHAR(60) DEFAULT 'unknown', total INTEGER DEFAULT '0' ) WITH (ORIENTATION=column); CREATE TABLE newproducts_col ( product_id INTEGER DEFAULT 0, product_name VARCHAR(60) DEFAULT 'null', category VARCHAR(60) DEFAULT 'unknown', total INTEGER DEFAULT '0' ) WITH (ORIENTATION=column); INSERT INTO products_col SELECT * FROM products_base; INSERT INTO newproducts_col SELECT * FROM newproducts_base; ANALYZE products_col; ANALYZE newproducts_col; -- Function scans CREATE TABLE fs_target (a int, b int, c text); MERGE INTO fs_target t USING generate_series(1,100,1) AS id ON t.a = id WHEN MATCHED THEN UPDATE SET b = b + id WHEN NOT MATCHED THEN INSERT VALUES (id, -1); MERGE INTO fs_target t USING generate_series(1,100,2) AS id ON t.a = id WHEN MATCHED THEN UPDATE SET b = b + id, c = 'updated '|| id.*::text WHEN NOT MATCHED THEN INSERT VALUES (id, -1, 'inserted ' || id.*::text); SELECT count(*) FROM fs_target; DROP TABLE fs_target; --default values for insert values BEGIN; MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN NOT MATCHED THEN INSERT VALUES (DEFAULT); MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN NOT MATCHED THEN INSERT VALUES (DEFAULT, np.product_name, np.category, DEFAULT); MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN NOT MATCHED THEN INSERT DEFAULT VALUES; select * from products_col order by 1,2,3,4; ROLLBACK; --default values for update values BEGIN; MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET product_name = DEFAULT, category = DEFAULT, total = DEFAULT WHEN NOT MATCHED THEN INSERT VALUES (DEFAULT); select * from products_col order by 1; ROLLBACK; --plpgsql BEGIN; DO LANGUAGE plpgsql $$ BEGIN MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET product_name = np.product_name, category = np.category , total = np.total WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.product_name, np.category, np.total); END; $$; SELECT * FROM products_col order by 1; ROLLBACK; --NON ANOYBLOCK BEGIN; BEGIN MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET product_name = np.product_name, category = np.category , total = np.total WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.product_name, np.category, np.total); END; / SELECT * FROM products_col order by 1; ROLLBACK; --stored procedure create or replace procedure p1() AS BEGIN MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET product_name = np.product_name, category = np.category , total = np.total WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.product_name, np.category, np.total); END; / BEGIN; select p1(); SELECT * FROM products_col order by 1; ROLLBACK; --stored procedure with params create or replace procedure p2( param1 IN text) AS BEGIN MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET product_name = np.product_name, category = np.category , total = np.total WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, 'inserted by proc', param1, np.total); END; / BEGIN; select p2('param1'); SELECT * FROM products_col order by 1; ROLLBACK; BEGIN; select p2('param2'); SELECT * FROM products_col order by 1; ROLLBACK; --stored procedure with params in update targetlist create or replace procedure p3( param1 IN text) AS BEGIN MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET product_name = np.product_name, category = param1 , total = np.total WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, 'inserted by proc', np.category, np.total); END; / BEGIN; select p3('param1'); SELECT * FROM products_col order by 1; ROLLBACK; BEGIN; select p3('param2'); SELECT * FROM products_col order by 1; ROLLBACK; --stored procedure with params in where conditions create or replace procedure p4( param1 IN text) AS BEGIN MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET product_name = np.product_name, category = np.category || 'DEF' , total = np.total WHERE category = param1 WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, 'inserted by proc', np.category, np.total); END; / BEGIN; select p4('toys'); --only update toys SELECT * FROM products_col order by 1; ROLLBACK; BEGIN; select p4('dvd'); --only update dvd SELECT * FROM products_col order by 1; ROLLBACK; BEGIN; select p4('electrncs'); --only update electrncs SELECT * FROM products_col order by 1; ROLLBACK; --update index create table src(a bigint, b bigint, c varchar(1000)) WITH (ORIENTATION=column); create table des(a bigint, b bigint, c varchar(1000)) WITH (ORIENTATION=column); create index src_i on src(b); create index des_i on des(b); insert into des values(generate_series(1,10), generate_series(1,10), 'des'); insert into src values(generate_series(1,10), generate_series(1,10), 'src'); insert into src (select a+100, b+100, c from src); insert into src (select a+1000, b+1000, c from src); insert into src (select a+10000, b+10000, c from src); insert into src (select a+100000, b+100000, c from src); insert into src (select a+1000000, b+1000000, c from src); insert into src (select a+10000000, b+10000000, c from src); insert into src (select a+100000000, b+100000000, c from src); insert into src (select a+1000000000, b+100000000, c from src); insert into src (select a+10000000000, b+100000000, c from src); insert into des (select a+100, b+100, c from des); insert into des (select a+1000, b+1000, c from des); insert into des (select a+10000, b+10000, c from des); insert into des (select a+100000, b+100000, c from des); insert into des (select a+1000000, b+1000000, c from des); insert into des (select a+10000000, b+10000000, c from des); insert into des (select a+100000000, b+100000000, c from des); insert into des (select a+1000000000, b+1000000000, c from des); insert into des (select a+10000000000, b+1000000000, c from des); MERGE INTO des d USING src s ON d.a = s.a WHEN MATCHED THEN UPDATE SET b = s.b + 10, c = s.c WHEN NOT MATCHED THEN INSERT VALUES (s.a, s.b); --rows shall be the same select count(*) from src; select count(*) from des; --column b of des is 10 bigger than src select * from src where a = 105; select * from des where b = 115; drop table des; drop table src; --dropped column and add column BEGIN; ALTER TABLE products_col DROP COLUMN category; MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.product_name, np.total) WHEN MATCHED THEN UPDATE SET product_name = p.product_name ||' + '|| np.product_name, total = p.total + np.total; SELECT * FROM products_col ORDER BY 1; TRUNCATE products_col; ALTER TABLE products_col ADD COLUMN category VARCHAR; INSERT INTO products_col SELECT product_id,product_name,total,category FROM products_base; MERGE INTO products_col p USING newproducts_col np ON p.product_id = np.product_id WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.product_name, np.total) WHEN MATCHED THEN UPDATE SET product_name = p.product_name ||' + '|| np.product_name, total = p.total + np.total; SELECT * FROM products_col ORDER BY 1; ROLLBACK; --join key diffs from distribute key BEGIN; MERGE INTO products_col p USING newproducts_col np ON p.total = np.product_id WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.product_name, np.category, np.total); SELECT * FROM products_col ORDER BY 1,2,3,4; ROLLBACK; BEGIN; MERGE INTO products_col p USING newproducts_col np ON p.total = np.product_id WHEN MATCHED THEN UPDATE SET product_name = p.product_name ||' + '|| np.product_name; SELECT * FROM products_col ORDER BY 1; ROLLBACK; BEGIN; MERGE INTO products_col p USING newproducts_col np ON p.total = np.product_id WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.product_name, np.category, np.total) WHEN MATCHED THEN UPDATE SET product_name = p.product_name ||' + '|| np.product_name; SELECT * FROM products_col ORDER BY 1,2,3,4; ROLLBACK; BEGIN; MERGE INTO products_col p USING newproducts_col np ON p.total = np.total WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.product_name, np.category, np.total); SELECT * FROM products_col ORDER BY 1,2,3,4; ROLLBACK; BEGIN; MERGE INTO products_col p USING newproducts_col np ON p.total = np.total WHEN MATCHED THEN UPDATE SET product_name = p.product_name ||' + '|| np.product_name; SELECT * FROM products_col ORDER BY 1; ROLLBACK; BEGIN; MERGE INTO products_col p USING newproducts_col np ON p.total = np.total WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.product_name, np.category, np.total) WHEN MATCHED THEN UPDATE SET product_name = p.product_name ||' + '|| np.product_name; SELECT * FROM products_col ORDER BY 1,2,3,4; ROLLBACK; --target table distributed by multiple columns, and then test dropped column and added column CREATE TABLE products_col_multi ( product_id INTEGER, product_name VARCHAR(60), category VARCHAR(60), total INTEGER ) WITH (ORIENTATION=column) DISTRIBUTE BY HASH(product_id, category); INSERT INTO products_col_multi SELECT * FROM products_base; ANALYZE products_col_multi; BEGIN; MERGE INTO products_col_multi p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET product_name = p.product_name || 'ABC', total = p.total + 100 WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.product_name, np.category || 'ABC', np.total + 100); SELECT * FROM products_col_multi ORDER BY 1; ROLLBACK; BEGIN; UPDATE products_col_multi SET total = 100; --generate some dead rows MERGE INTO products_col_multi p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET product_name = p.product_name || 'ABC', total = p.total + 100 WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.product_name, np.category || 'ABC', np.total + 100); SELECT * FROM products_col_multi ORDER BY 1; ROLLBACK; ALTER TABLE products_col_multi DROP COLUMN product_name; --dropped column BEGIN; MERGE INTO products_col_multi p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET total = p.total + 100 WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.category || 'ABC', np.total + 100); SELECT * FROM products_col_multi ORDER BY 1; ROLLBACK; ALTER TABLE products_col_multi ADD COLUMN product_name VARCHAR; --added column TRUNCATE products_col_multi; INSERT INTO products_col_multi SELECT product_id,category,total,product_name FROM products_base; BEGIN; MERGE INTO products_col_multi p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET product_name = p.product_name || 'ABC', total = p.total + 100; SELECT * FROM products_col_multi ORDER BY 1; ROLLBACK; BEGIN; MERGE INTO products_col_multi p USING newproducts_col np ON p.product_id = np.product_id WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.category || 'ABC', np.total + 100, np.product_name); SELECT * FROM products_col_multi ORDER BY 1; ROLLBACK; BEGIN; MERGE INTO products_col_multi p USING newproducts_col np ON p.product_id = np.product_id WHEN MATCHED THEN UPDATE SET product_name = p.product_name || 'ABC', total = p.total + 100 WHEN NOT MATCHED THEN INSERT VALUES (np.product_id, np.category || 'ABC', np.total + 100, np.product_name); SELECT * FROM products_col_multi ORDER BY 1; ROLLBACK; -- clean up DROP SCHEMA mergeinto_col_2 CASCADE;
the_stack
create schema package_schema; set current_schema= package_schema; --test package function defination create or replace function get_sal(NAME VARCHAR2) RETURN NUMBER package IS BEGIN RETURN 1; END; / create or replace function get_sal(NAME int) RETURN NUMBER package IS BEGIN RETURN 1; END; / select proname, propackage from pg_proc where proname='get_sal'; create or replace function test_package_function(col int, col2 out int) returns integer package as $$ declare col_type text; begin col := 122; return 0; end; $$ language plpgsql; select proname, propackage from pg_proc where proname='test_package_function'; --test function overload create or replace function package_func_overload(col int, col2 int) return integer package as declare col_type text; begin col := 122; return 0; end; / create or replace function package_func_overload(col int, col2 smallint) return integer package as declare col_type text; begin col := 122; return 0; end; / create or replace function package_func_overload(col int, col2 bigint) return integer package as declare col_type text; begin col := 122; return 0; end; / --exception case create or replace function package_func_overload(col int, col2 out int) return integer package as declare col_type text; begin col := 122; return 0; end; / create or replace procedure package_func_overload(col int, col2 out varchar) package as declare col_type text; begin col2 := '122'; end; / select proname, propackage from pg_proc where proname='package_func_overload'; DECLARE resut int; para1 int = 1; para2 smallint = 0; para3 bigint = 2; para4 varchar; BEGIN package_func_overload(1, 1); package_func_overload(1, para1); package_func_overload(1, para2); package_func_overload(1, para3); package_func_overload(1, para4); END; / DECLARE resut int; para1 int = 1; para2 smallint = 0; BEGIN resut = package_func_overload(1, 1); package_func_overload(1, para1); package_func_overload(1, para2); END; / --test named args DECLARE resut int; para1 int = 1; para2 smallint = 0; BEGIN package_func_overload(col => 1, col2 => para1); package_func_overload(col2 => 1, col => para2); package_func_overload(col2 => para2, col => para1); END; / call package_func_overload(1, 1); call package_func_overload(1, '1'); select package_func_overload(1, 1); --package function and none package function can not overload create or replace procedure package_func_overload_1(col int, col2 varchar) package as declare col_type text; begin col2 := '122'; end; / create or replace function package_func_overload_1(col int, col2 int) returns integer as $$ declare col_type text; begin col := 122; return 0; end; $$ language plpgsql; --test function replace create or replace function package_func_overload_2(col int, col2 bigint, col3 out int) returns integer as $$ declare col_type text; begin col := 122; return 0; end; $$ language plpgsql; create or replace function package_func_overload_2(col int, col2 bigint) returns integer package as $$ declare col_type text; begin col := 122; return 0; end; $$ language plpgsql; --test case for none overload function create or replace function package_func_overload_3(col int, col2 out int) return integer package as declare col_type text; begin col := 122; return 0; end; / create or replace function package_func_overload_3(col int, col2 int) return integer package as declare col_type text; begin col := 122; return 0; end; / --none package function overload create or replace function package_func_overload_4(col int, col2 out int) returns integer as $$ declare col_type text; begin col := 122; return 0; end; $$ language plpgsql; create or replace function package_func_overload_4(col int, col2 int) returns integer as $$ declare col_type text; begin col := 122; return 0; end; $$ language plpgsql; --test not enough parameter create or replace function test_para1(col int) returns integer package as $$ declare begin col := 122; return 0; end; $$ language plpgsql; create or replace function test_para1(col smallint) returns integer package as $$ declare begin col := 122; return 0; end; $$ language plpgsql; DECLARE resut int; para1 int = 1; para2 smallint = 0; BEGIN test_para1(); END; / --do not support VARIADIC parameter for package function CREATE OR REPLACE FUNCTION test_select(i IN INTEGER, VARIADIC arr INTEGER[]) RETURN INTEGER package AS temp INTEGER :=0; BEGIN temp:= arr[i]; RETURN temp; END; / CREATE OR REPLACE FUNCTION read_file(arg1 integer, arg3 integer default 1 , out arg2 text) RETURNS text package AS $$ DECLARE t1 text; BEGIN t1 := 'abc1'; return t1; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION read_file(arg1 integer, arg4 integer, arg3 integer default 1 , out arg2 text) RETURNS text package AS $$ DECLARE t1 text; BEGIN t1 := 'abc2'; return t1; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION read_file1(arg1 integer ) RETURNS void AS $$ declare t2 text; t3 text; begin t2 := read_file(10); raise notice 'this value: %',t2; return; end; $$ LANGUAGE plpgsql; call read_file1(1); --test inout parameter create or replace function test_proc_define ( in_1 IN VARCHAR2, in_2 VARCHAR2, out_1 OUT VARCHAR2, inout_1 IN OUT VARCHAR ) returns integer package as $$ declare col_type text; BEGIN out_1 := in_1; inout_1 := inout_1 || in_2; return 0; END; $$ language plpgsql; create or replace function test_proc_define ( in_1 IN VARCHAR2, in_2 VARCHAR2, out_1 OUT VARCHAR2 ) returns integer package as $$ declare col_type text; BEGIN out_1 := in_1; return 1; END; $$ language plpgsql; select test_proc_define('hello', 'world', 'NO BIND'); --test alter function alter function package_func_overload(int, smallint) package; --test diffent namspace create schema package_nps; set current_schema = package_nps; CREATE OR REPLACE FUNCTION read_file(arg1 integer, arg3 integer default 1 , out arg2 text) RETURNS text package AS $$ DECLARE t1 text; BEGIN t1 := 'abc1'; return t1; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION read_file(arg1 integer, arg4 integer, arg3 integer default 1 , out arg2 text) RETURNS text package AS $$ DECLARE t1 text; BEGIN t1 := 'abc2'; return t1; END; $$ LANGUAGE plpgsql; --get function defination select pg_get_functiondef(f.oid) from (select oid , pronargs from pg_proc where proname='read_file' and pronargs = 2) f; --test call call read_file(1,2,3,'ee'); select read_file(1,2,3,'ee'); select read_file(1,2,3); call read_file(1,2,3); select read_file(1,2,'eer'); call read_file(1,2,'eer'); call read_file(1,2); call read_file(arg1=>1, arg3=>3, arg4=>2, arg2=>'dd'); DECLARE resut text; ds text; BEGIN resut = read_file(arg1=>1, arg3=>3, arg4=>2, arg2=>ds); END; / drop function read_file(arg1 integer, arg3 integer , out arg2 text) ; DECLARE resut text; ds text; BEGIN resut = read_file(arg1=>1, arg3=>3, arg4=>2, arg2=>ds); END; / DECLARE resut text; ds text; BEGIN read_file(arg1=>1, arg3=>3, arg4=>2, arg2=>ds); END; / create or replace function test_inout_para1(col inout int, col2 int) returns integer package as $$ declare begin col := 122; end; $$ language plpgsql; create or replace function test_inout_para1(col inout text, col2 int) returns text package as $$ declare begin col := 123; end; $$ language plpgsql; DECLARE resut int; resut1 text; para1 int = 1; para2 smallint = 0; BEGIN test_inout_para1(resut,2); test_inout_para1(resut1,2); END; / CREATE OR REPLACE PROCEDURE func_inner() package as begin end; / CREATE OR REPLACE PROCEDURE func_inner(id OUT NUMERIC, sex IN CHAR default 'f', name OUT varchar2, age IN INTEGER default 20) package AS temp_age INTEGER := 0; temp_sex INTEGER := 2; temp_num INTEGER := 0; name_dafault1 varchar2(100) := 'chao'; name_dafault2 varchar2(100) := 'dfm'; id_dafault1 NUMERIC := 1; id_dafault2 NUMERIC := 2; BEGIN temp_age := age; id := id_dafault1; IF temp_age > 40 THEN id := id_dafault2; END IF; IF sex <> 'f' THEN temp_sex := 1; END IF; temp_num := temp_sex; IF temp_num > 0 THEN name := name_dafault1; END IF; IF temp_num > 1 THEN name := name_dafault2; END IF; END; / CALL func_inner(id, age=>80,name=>'dfm'); CALL func_inner(id, sex=>'f',age=>40); CREATE OR REPLACE PROCEDURE func_outter1(sex IN CHAR default 'f',age IN INTEGER default 20) AS temp_id NUMERIC; temp_name varchar2(100); temp_sex char; temp_age NUMERIC; BEGIN temp_sex := sex; temp_age := age; func_inner(temp_id,temp_sex,name=>temp_name,age=>temp_age); END; / CALL func_outter1(); CREATE OR REPLACE PROCEDURE func_outter3(sex IN CHAR default 'f',age IN INTEGER default 20) AS temp_id NUMERIC; temp_name varchar2(100); temp_sex char; temp_age NUMERIC; BEGIN temp_sex := sex; temp_age := age; func_inner(temp_id,name=>temp_name); END; / CALL func_outter3(); CREATE OR REPLACE PROCEDURE func_outter4(sex IN CHAR default 'f',age IN INTEGER default 20) AS temp_id NUMERIC; temp_name varchar2(100); temp_sex char; temp_age NUMERIC; BEGIN temp_sex := sex; temp_age := age; func_inner(temp_id,temp_sex,name=>temp_name); END; / CALL func_outter4(); CALL func_outter4(age=>20); CREATE OR REPLACE PROCEDURE func_outter5(sex IN CHAR default 'f',age IN INTEGER default 20) AS temp_id NUMERIC; temp_name varchar2(100); temp_sex char; temp_age NUMERIC; BEGIN temp_sex := sex; temp_age := age; func_inner(temp_id,age=>temp_age,name=>temp_name); END; / CALL func_outter5(); CREATE OR REPLACE PROCEDURE func_outter6(sex IN CHAR default 'f',age IN INTEGER default 20) AS temp_id NUMERIC; temp_name varchar2(100); temp_sex char; temp_age NUMERIC; BEGIN temp_sex := sex; temp_age := age; func_inner(sex=>temp_sex,id=>temp_id,age=>temp_age,name=>temp_name); END; / CALL func_outter6(); CREATE OR REPLACE PROCEDURE func_outter7(sex IN CHAR default 'f',age IN INTEGER default 20) AS temp_id NUMERIC; temp_name varchar2(100); temp_sex char; temp_age NUMERIC; BEGIN temp_sex := sex; temp_age := age; func_inner(temp_id,temp_sex,temp_name,temp_age); END; / CALL func_outter7(); CREATE OR REPLACE PROCEDURE test_default_out() package as begin end; / CREATE OR REPLACE PROCEDURE test_default_out( i in integer, j out integer, k out integer, m in integer default 1, n in integer default 1, o out integer) package AS BEGIN j:=i; k := j + i; o := i + j + k + m + n; RETURN; END; / declare a int := 1; b int := 1; c int := 1; begin test_default_out(1, k=>a, n=>1, j=>b, o=>c); end; / --error test declare a int := 1; b int := 1; c int := 1; begin test_default_out(1, k=>a, n=>1, j=>b, j=>c); end; / declare a int := 1; b int := 1; c int := 1; begin test_default_out(1, k=>a, n=>1, j=>1, o=>c); end; / create or replace function test_para2(col in text, col2 out int) returns text package as $$ declare begin col2 := 123; end; $$ language plpgsql; create or replace function test_para2(col in text, col2 varchar) returns text package as $$ declare begin col2 := 123; end; $$ language plpgsql; declare varcl clob; buffer int; tr text; begin test_para2(1, buffer); raise info 'buffer: %', buffer; end; / drop schema package_schema cascade; drop schema package_nps cascade;
the_stack
-- delete fields -- 15.04.2016 17:47 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=2128 ; -- 15.04.2016 17:47 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=2128 ; -- 15.04.2016 17:48 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=3277 ; -- 15.04.2016 17:48 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=3277 ; -- 15.04.2016 17:48 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=8238 ; -- 15.04.2016 17:48 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=8238 ; -- 15.04.2016 17:48 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10592 ; -- 15.04.2016 17:48 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10592 ; -- delete export formats -- 15.04.2016 17:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=547213 ; -- 15.04.2016 17:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=547310 ; -- 15.04.2016 17:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=547314 ; -- 15.04.2016 17:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=547316 ; -- 15.04.2016 17:51 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=548881 ; -- 15.04.2016 17:51 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=548965 ; -- 15.04.2016 17:51 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=548969 ; -- 15.04.2016 17:51 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=548980 ; -- 15.04.2016 17:51 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=549300 ; -- 15.04.2016 17:51 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=549387 ; -- 15.04.2016 17:51 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=549391 ; -- 15.04.2016 17:51 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=549404 ; -- 15.04.2016 17:51 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=549724 ; -- 15.04.2016 17:52 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=549811 ; -- 15.04.2016 17:52 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=549815 ; -- 15.04.2016 17:52 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=549828 ; -- deleting other fields -- 15.04.2016 17:55 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9652 ; -- 15.04.2016 17:55 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9652 ; -- 15.04.2016 17:55 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=2428 ; -- 15.04.2016 17:55 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=2428 ; -- 15.04.2016 17:55 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9640 ; -- 15.04.2016 17:55 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9640 ; -- 15.04.2016 17:56 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10593 ; -- 15.04.2016 17:56 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10593 ; -- 15.04.2016 17:56 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9697 ; -- 15.04.2016 17:56 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9697 ; -- 15.04.2016 17:57 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9689 ; -- 15.04.2016 17:57 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9689 ; -- 15.04.2016 17:57 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9684 ; -- 15.04.2016 17:57 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9684 ; -- 15.04.2016 17:57 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10594 ; -- 15.04.2016 17:57 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10594 ; -- 15.04.2016 17:58 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9972 ; -- 15.04.2016 17:58 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9972 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9960 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9960 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9955 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9955 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10601 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10601 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9917 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9917 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9906 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9906 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9901 ; -- 15.04.2016 17:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9901 ; -- 15.04.2016 18:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10598 ; -- 15.04.2016 18:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10598 ; -- 15.04.2016 18:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9867 ; -- 15.04.2016 18:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9867 ; -- 15.04.2016 18:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9857 ; -- 15.04.2016 18:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9857 ; -- 15.04.2016 18:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9852 ; -- 15.04.2016 18:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9852 ; -- 15.04.2016 18:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10597 ; -- 15.04.2016 18:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10597 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9589 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9589 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9579 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9579 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9574 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9574 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10591 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10591 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9797 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9797 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9788 ; -- 15.04.2016 18:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9788 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9783 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9783 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10596 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10596 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10694 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10694 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10682 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10682 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10675 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10675 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10707 ; -- 15.04.2016 18:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10707 ; -- 15.04.2016 18:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=12737 ; -- 15.04.2016 18:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=12737 ; -- 15.04.2016 18:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=12685 ; -- 15.04.2016 18:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=12685 ; -- 15.04.2016 18:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=12723 ; -- 15.04.2016 18:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=12723 ; -- 15.04.2016 18:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=12724 ; -- 15.04.2016 18:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=12724 ; -- 15.04.2016 18:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=54849 ; -- 15.04.2016 18:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=54849 ; -- 15.04.2016 18:04 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=54845 ; -- 15.04.2016 18:04 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=54845 ; -- 15.04.2016 18:04 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=54827 ; -- 15.04.2016 18:04 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=54827 ; -- 15.04.2016 18:04 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=54817 ; -- 15.04.2016 18:04 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=54817 ; -- 15.04.2016 18:04 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=541762 ; -- 15.04.2016 18:04 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=541762 ; -- 15.04.2016 18:05 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=541812 ; -- 15.04.2016 18:05 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=541812 ; -- 15.04.2016 18:05 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=543242 ; -- 15.04.2016 18:05 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=543242 ; -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET IsActive='Y',Updated=TO_TIMESTAMP('2016-04-15 18:06:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=225 ; -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9749 ; -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9749 ; -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9739 ; -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9739 ; -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=9734 ; -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=9734 ; -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10595 ; -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10595 ; -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET IsActive='N',Updated=TO_TIMESTAMP('2016-04-15 18:06:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=225 ; -- Deleting AD_Columns -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column_Trl WHERE AD_Column_ID=2925 ; -- 15.04.2016 18:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column WHERE AD_Column_ID=2925 ; -- 15.04.2016 18:07 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column_Trl WHERE AD_Column_ID=2921 ; -- 15.04.2016 18:07 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column WHERE AD_Column_ID=2921 ; -- 15.04.2016 18:07 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column_Trl WHERE AD_Column_ID=9862 ; -- 15.04.2016 18:07 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column WHERE AD_Column_ID=9862 ; -- 15.04.2016 18:07 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column_Trl WHERE AD_Column_ID=12533 ; -- 15.04.2016 18:07 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column WHERE AD_Column_ID=12533 ; -- Dropping column ActualLifeTimeValue ALTER TABLE C_BPartner DROP COLUMN ActualLifeTimeValue; -- Dropping column SOCreditStatus ALTER TABLE C_BPartner DROP COLUMN SOCreditStatus; -- Dropping column SO_CreditUsed ALTER TABLE C_BPartner DROP COLUMN SO_CreditUsed; -- Dropping column TotalOpenBalance ALTER TABLE C_BPartner DROP COLUMN TotalOpenBalance;
the_stack
-- SQL Server 2019 --! Data types -- https://docs.microsoft.com/en-us/sql/t-sql/data-types/data-types-transact-sql?view=sqlallproducts-allversions -- Exact numerics bigint bit decimal int money numeric smallint smallmoney tinyint -- Approximate numerics float real -- Date and time date datetime datetime2 datetimeoffset smalldatetime time -- Character strings char text varchar -- Unicode character strings nchar ntext nvarchar -- Binary strings binary image varbinary -- Other data types cursor hierarchyid rowversion sql_variant table uniqueidentifier xml geometry geography -- https://docs.microsoft.com/en-us/sql/t-sql/language-elements/reserved-keywords-transact-sql?view=sqlallproducts-allversions --! keywords -- SQL Server and Azure SQL Data Warehouse ADD ALL ALTER AND ANY AS ASC AUTHORIZATION BACKUP BEGIN BETWEEN BREAK BROWSE BULK BY CASCADE CASE CHECK CHECKPOINT CLOSE CLUSTERED COALESCE COLLATE COLUMN COMMIT COMPUTE CONSTRAINT CONTAINS CONTAINSTABLE CONTINUE CONVERT CREATE CROSS CURRENT CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR DATABASE DBCC DEALLOCATE DECLARE DEFAULT DELETE DENY DESC DISK DISTINCT DISTRIBUTED DOUBLE DROP DUMP ELSE END ERRLVL ESCAPE EXCEPT EXEC EXECUTE EXISTS EXIT EXTERNAL FETCH FILE FILLFACTOR FOR FOREIGN FREETEXT FREETEXTTABLE FROM FULL FUNCTION GOTO GRANT GROUP HAVING HOLDLOCK IDENTITY IDENTITY_INSERT IDENTITYCOL IF IN INDEX INNER INSERT INTERSECT INTO IS JOIN KEY KILL LEFT LIKE LINENO LOAD MERGE NATIONAL NOCHECK NONCLUSTERED NOT NULL NULLIF OF OFF OFFSETS ON OPEN OPENDATASOURCE OPENQUERY OPENROWSET OPENXML OPTION OR ORDER OUTER OVER PERCENT PIVOT PLAN PRECISION PRIMARY PRINT PROC PROCEDURE PUBLIC RAISERROR READ READTEXT RECONFIGURE REFERENCES REPLICATION RESTORE RESTRICT RETURN REVERT REVOKE RIGHT ROLLBACK ROWCOUNT ROWGUIDCOL RULE SAVE SCHEMA SECURITYAUDIT SELECT SEMANTICKEYPHRASETABLE SEMANTICSIMILARITYDETAILSTABLE SEMANTICSIMILARITYTABLE SESSION_USER SET SETUSER SHUTDOWN SOME STATISTICS SYSTEM_USER TABLE TABLESAMPLE TEXTSIZE THEN TO TOP TRAN TRANSACTION TRIGGER TRUNCATE TRY_CONVERT TSEQUAL UNION UNIQUE UNPIVOT UPDATE UPDATETEXT USE USER VALUES VARYING VIEW WAITFOR WHEN WHERE WHILE WITH WITHIN GROUP WRITETEXT -- keywords that are exclusive to Azure SQL Data Warehouse LABEL -- ODBC Reserved Keywords ABSOLUTE ACTION ADA ADD ALL ALLOCATE ALTER AND ANY ARE AS ASC ASSERTION AT AUTHORIZATION AVG BEGIN BETWEEN BIT BIT_LENGTH BOTH BY CASCADE CASCADED CASE CAST CATALOG CHAR CHAR_LENGTH CHARACTER CHARACTER_LENGTH CHECK CLOSE COALESCE COLLATE COLLATION COLUMN COMMIT CONNECT CONNECTION CONSTRAINT CONSTRAINTS CONTINUE CONVERT CORRESPONDING COUNT CREATE CROSS CURRENT CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR DATE DAY DEALLOCATE DEC DECIMAL DECLARE DEFAULT DEFERRABLE DEFERRED DELETE DESC DESCRIBE DESCRIPTOR DIAGNOSTICS DISCONNECT DISTINCT DOMAIN DOUBLE DROP ELSE END END-EXEC ESCAPE EXCEPT EXCEPTION EXEC EXECUTE EXISTS EXTERNAL EXTRACT FALSE FETCH FIRST FLOAT FOR FOREIGN FORTRAN FOUND FROM FULL GET GLOBAL GO GOTO GRANT GROUP HAVING HOUR IDENTITY IMMEDIATE IN INCLUDE INDEX INDICATOR INITIALLY INNER INPUT INSENSITIVE INSERT INT INTEGER INTERSECT INTERVAL INTO IS ISOLATION JOIN KEY LANGUAGE LAST LEADING LEFT LEVEL LIKE LOCAL LOWER MATCH MAX MIN MINUTE MODULE MONTH NAMES NATIONAL NATURAL NCHAR NEXT NO NONE NOT NULL NULLIF NUMERIC OCTET_LENGTH OF ON ONLY OPEN OPTION OR ORDER OUTER OUTPUT OVERLAPS PAD PARTIAL PASCAL POSITION PRECISION PREPARE PRESERVE PRIMARY PRIOR PRIVILEGES PROCEDURE PUBLIC READ REAL REFERENCES RELATIVE RESTRICT REVOKE RIGHT ROLLBACK ROWS SCHEMA SCROLL SECOND SECTION SELECT SESSION SESSION_USER SET SIZE SMALLINT SOME SPACE SQL SQLCA SQLCODE SQLERROR SQLSTATE SQLWARNING SUBSTRING SUM SYSTEM_USER TABLE TEMPORARY THEN TIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TO TRAILING TRANSACTION TRANSLATE TRANSLATION TRIM TRUE UNION UNIQUE UNKNOWN UPDATE UPPER USAGE USER USING VALUE VALUES VARCHAR VARYING VIEW WHEN WHENEVER WHERE WITH WORK WRITE YEAR ZONE -- Future Keywords ABSOLUTE ACTION ADMIN AFTER AGGREGATE ALIAS ALLOCATE ARE ARRAY ASENSITIVE ASSERTION ASYMMETRIC AT ATOMIC BEFORE BINARY BIT BLOB BOOLEAN BOTH BREADTH CALL CALLED CARDINALITY CASCADED CAST CATALOG CHAR CHARACTER CLASS CLOB COLLATION COLLECT COMPLETION CONDITION CONNECT CONNECTION CONSTRAINTS CONSTRUCTOR CORR CORRESPONDING COVAR_POP COVAR_SAMP CUBE CUME_DIST CURRENT_CATALOG CURRENT_DEFAULT_TRANSFORM_GROUP CURRENT_PATH CURRENT_ROLE CURRENT_SCHEMA CURRENT_TRANSFORM_GROUP_FOR_TYPE CYCLE DATA DATE DAY DEC DECIMAL DEFERRABLE DEFERRED DEPTH DEREF DESCRIBE DESCRIPTOR DESTROY DESTRUCTOR DETERMINISTIC DIAGNOSTICS DICTIONARY DISCONNECT DOMAIN DYNAMIC EACH ELEMENT END-EXEC EQUALS EVERY EXCEPTION FALSE FILTER FIRST FLOAT FOUND FREE FULLTEXTTABLE FUSION GENERAL GET GLOBAL GO GROUPING HOLD HOST HOUR IGNORE IMMEDIATE INDICATOR INITIALIZE INITIALLY INOUT INPUT INT INTEGER INTERSECTION INTERVAL ISOLATION ITERATE LANGUAGE LARGE LAST LATERAL LEADING LESS LEVEL LIKE_REGEX LIMIT LN LOCAL LOCALTIME LOCALTIMESTAMP LOCATOR MAP MATCH MEMBER METHOD MINUTE MOD MODIFIES MODIFY MODULE MONTH MULTISET NAMES NATURAL NCHAR NCLOB NEW NEXT NO NONE NORMALIZE NUMERIC OBJECT OCCURRENCES_REGEX OLD ONLY OPERATION ORDINALITY OUT OUTPUT OVERLAY PAD PARAMETER PARAMETERS PARTIAL PARTITION PATH PERCENT_RANK PERCENTILE_CONT PERCENTILE_DISC POSITION_REGEX POSTFIX PREFIX PREORDER PREPARE PRESERVE PRIOR PRIVILEGES RANGE READS REAL RECURSIVE REF REFERENCING REGR_AVGX REGR_AVGY REGR_COUNT REGR_INTERCEPT REGR_R2 REGR_SLOPE REGR_SXX REGR_SXY REGR_SYY RELATIVE RELEASE RESULT RETURNS ROLE ROLLUP ROUTINE ROW ROWS SAVEPOINT SCOPE SCROLL SEARCH SECOND SECTION SENSITIVE SEQUENCE SESSION SETS SIMILAR SIZE SMALLINT SPACE SPECIFIC SPECIFICTYPE SQL SQLEXCEPTION SQLSTATE SQLWARNING START STATE STATEMENT STATIC STDDEV_POP STDDEV_SAMP STRUCTURE SUBMULTISET SUBSTRING_REGEX SYMMETRIC SYSTEM TEMPORARY TERMINATE THAN TIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TRAILING TRANSLATE_REGEX TRANSLATION TREAT TRUE UESCAPE UNDER UNKNOWN UNNEST USAGE USING VALUE VAR_POP VAR_SAMP VARCHAR VARIABLE WHENEVER WIDTH_BUCKET WINDOW WITHIN WITHOUT WORK WRITE XMLAGG XMLATTRIBUTES XMLBINARY XMLCAST XMLCOMMENT XMLCONCAT XMLDOCUMENT XMLELEMENT XMLEXISTS XMLFOREST XMLITERATE XMLNAMESPACES XMLPARSE XMLPI XMLQUERY XMLSERIALIZE XMLTABLE XMLTEXT XMLVALIDATE YEAR ZONE -- Statements -- General ADD SENSITIVITY CLASSIFICATION BULK INSERT DELETE DISABLE TRIGGER ENABLE TRIGGER INSERT UPDATE MERGE RENAME TRUNCATE TABLE UPDATE STATISTICS ALTER APPLICATION ROLE ASSEMBLY ASYMMETRIC KEY AUTHORIZATION AVAILABILITY GROUP BROKER PRIORITY CERTIFICATE COLUMN ENCRYPTION KEY CREDENTIAL CRYPTOGRAPHIC PROVIDER DATABASE DATABASE AUDIT SPECIFICATION DATABASE ENCRYPTION KEY DATABASE HADR DATABASE SCOPED CREDENTIAL DATABASE SCOPED CONFIGURATION DATABASE SET Options ENDPOINT EVENT SESSION EXTERNAL DATA SOURCE EXTERNAL LANGUAGE EXTERNAL LIBRARY EXTERNAL RESOURCE POOL FULLTEXT CATALOG FULLTEXT INDEX FULLTEXT STOPLIST FUNCTION INDEX LOGIN MASTER KEY MATERIALIZED VIEW MESSAGE TYPE PARTITION FUNCTION PARTITION SCHEME PROCEDURE QUEUE REMOTE SERVICE BINDING RESOURCE GOVERNOR RESOURCE POOL ROLE ROUTE SCHEMA SEARCH PROPERTY LIST SECURITY POLICY SEQUENCE SERVER AUDIT SERVER AUDIT SPECIFICATION SERVER CONFIGURATION SERVER ROLE SERVICE SERVICE MASTER KEY SYMMETRIC KEY TABLE TRIGGER USER VIEW WORKLOAD GROUP XML SCHEMA COLLECTION -- Backup & restore BACKUP BACKUP CERTIFICATE BACKUP MASTER KEY BACKUP SERVICE MASTER KEY RESTORE RESTORE FILELISTONLY RESTORE HEADERONLY RESTORE LABELONLY RESTORE MASTER KEY RESTORE SERVICE MASTER KEY RESTORE REWINDONLY RESTORE VERIFYONLY CREATE AGGREGATE APPLICATION ROLE ASSEMBLY ASYMMETRIC KEY AVAILABILITY GROUP BROKER PRIORITY CERTIFICATE COLUMNSTORE INDEX COLUMN ENCRYPTION KEY COLUMN MASTER KEY CONTRACT CREDENTIAL CRYPTOGRAPHIC PROVIDER DATABASE DATABASE AUDIT SPECIFICATION DATABASE ENCRYPTION KEY DATABASE SCOPED CREDENTIAL DEFAULT ENDPOINT EVENT NOTIFICATION EVENT SESSION EXTERNAL DATA SOURCE EXTERNAL LANGUAGE EXTERNAL LIBRARY EXTERNAL FILE FORMAT EXTERNAL RESOURCE POOL EXTERNAL TABLE FULLTEXT CATALOG FULLTEXT INDEX FULLTEXT STOPLIST FUNCTION INDEX LOGIN MASTER KEY MESSAGE TYPE PARTITION FUNCTION PARTITION SCHEME PROCEDURE QUEUE REMOTE SERVICE BINDING RESOURCE POOL ROLE ROUTE RULE SCHEMA SEARCH PROPERTY LIST SECURITY POLICY SELECTIVE XML INDEX SEQUENCE SERVER AUDIT SERVER AUDIT SPECIFICATION SERVER ROLE SERVICE SPATIAL INDEX STATISTICS SYMMETRIC KEY SYNONYM TABLE TABLE IDENTITY TRIGGER TYPE USER VIEW WORKLOAD GROUP XML INDEX XML INDEX XML SCHEMA COLLECTION DROP AGGREGATE APPLICATION ROLE ASSEMBLY ASYMMETRIC KEY AVAILABILITY GROUP BROKER PRIORITY CERTIFICATE COLUMN ENCRYPTION KEY COLUMN MASTER KEY CONTRACT CREDENTIAL CRYPTOGRAPHIC PROVIDER DATABASE DATABASE AUDIT SPECIFICATION DATABASE ENCRYPTION KEY DATABASE SCOPED CREDENTIAL DEFAULT ENDPOINT EXTERNAL DATA SOURCE EXTERNAL FILE FORMAT EXTERNAL LANGUAGE EXTERNAL LIBRARY EXTERNAL RESOURCE POOL EXTERNAL TABLE EVENT NOTIFICATION EVENT SESSION FULLTEXT CATALOG FULLTEXT INDEX FULLTEXT STOPLIST FUNCTION INDEX LOGIN MASTER KEY MESSAGE TYPE PARTITION FUNCTION PARTITION SCHEME PROCEDURE QUEUE REMOTE SERVICE BINDING RESOURCE POOL ROLE ROUTE RULE SCHEMA SEARCH PROPERTY LIST SECURITY POLICY SENSITIVITY CLASSIFICATION SEQUENCE SERVER AUDIT SERVER AUDIT SPECIFICATION SERVER ROLE SERVICE SIGNATURE STATISTICS SYMMETRIC KEY SYNONYM TABLE TRIGGER TYPE USER VIEW WORKLOAD CLASSIFIER WORKLOAD GROUP XML SCHEMA COLLECTION -- Permissions ADD SIGNATURE CLOSE MASTER KEY CLOSE SYMMETRIC KEY DENY EXECUTE AS GRANT OPEN MASTER KEY OPEN SYMMETRIC KEY REVERT REVOKE SETUSER -- Service Broker BEGIN CONVERSATION TIMER BEGIN DIALOG CONVERSATION END CONVERSATION GET CONVERSATION GROUP GET_TRANSMISSION_STATUS MOVE CONVERSATION RECEIVE SEND SET ANSI_DEFAULTS ANSI_NULL_DFLT_OFF ANSI_NULL_DFLT_ON ANSI_NULLS ANSI_PADDING ANSI_WARNINGS ARITHABORT ARITHIGNORE CONCAT_NULL_YIELDS_NULL CONTEXT_INFO CURSOR_CLOSE_ON_COMMIT DATEFIRST DATEFORMAT DEADLOCK_PRIORITY FIPS_FLAGGER FMTONLY FORCEPLAN IDENTITY_INSERT IMPLICIT_TRANSACTIONS LANGUAGE LOCK_TIMEOUT NOCOUNT NOEXEC NUMERIC_ROUNDABORT OFFSETS PARSEONLY QUERY_GOVERNOR_COST_LIMIT QUOTED_IDENTIFIER REMOTE_PROC_TRANSACTIONS RESULT SET CACHING ROWCOUNT SHOWPLAN_ALL SHOWPLAN_TEXT SHOWPLAN_XML STATISTICS IO STATISTICS PROFILE STATISTICS TIME STATISTICS XML TEXTSIZE TRANSACTION ISOLATION LEVEL XACT_ABORT
the_stack
-- ------------------------------- -- -- Transactions/operations section -- -- ------------------------------- -- -- Table containing all the ZKSync block execution operations. -- Operations are associated with some block and every block can -- have multiple related operations with different action types -- (e.g. `commit` / `verify`). CREATE TABLE operations ( id bigserial PRIMARY KEY, block_number BIGINT NOT NULL, action_type TEXT NOT NULL, created_at TIMESTAMP with time zone NOT NULL DEFAULT now(), confirmed bool NOT NULL DEFAULT false ); -- Block header entry. CREATE TABLE blocks ( number BIGINT PRIMARY KEY, root_hash BYTEA NOT NULL, fee_account_id BIGINT NOT NULL, unprocessed_prior_op_before BIGINT NOT NULL, unprocessed_prior_op_after BIGINT NOT NULL, block_size BIGINT NOT NULL ); -- Pending block header entry. CREATE TABLE pending_block ( -- Pending block ID number BIGINT PRIMARY KEY NOT NULL, chunks_left BIGINT NOT NULL, unprocessed_priority_op_before BIGINT NOT NULL, pending_block_iteration BIGINT NOT NULL ); -- Table for the executed priority operations (e.g. deposit). CREATE TABLE executed_priority_operations ( -- sidechain block info block_number BIGINT NOT NULL, block_index INT NOT NULL, -- operation data operation jsonb NOT NULL, -- operation metadata from_account bytea NOT NULL, to_account bytea NOT NULL, priority_op_serialid BIGINT NOT NULL, deadline_block BIGINT NOT NULL, eth_hash bytea NOT NULL, eth_block BIGINT NOT NULL, created_at timestamp with time zone not null, PRIMARY KEY (eth_hash) ); -- Table for the executed common operations (e.g. transfer). CREATE TABLE executed_transactions ( -- sidechain block info block_number BIGINT NOT NULL, block_index INT, -- operation data tx jsonb NOT NULL, operation jsonb NOT NULL, -- operation metadata tx_hash bytea NOT NULL, from_account bytea NOT NULL, to_account bytea, success bool NOT NULL, fail_reason TEXT, primary_account_address bytea NOT NULL, nonce BIGINT NOT NULL, created_at TIMESTAMP with time zone NOT NULL, PRIMARY KEY (tx_hash) ); -- -------------- -- -- Tokens section -- -- -------------- -- -- Token types known to the ZKSync node. -- By default has the ETH token only (see the `INSERT` statement in the end of the file). CREATE TABLE tokens ( id INTEGER NOT NULL PRIMARY KEY, address TEXT NOT NULL, symbol TEXT NOT NULL, decimals SMALLINT NOT NULL ); -- ---------------- -- -- Accounts section -- -- ---------------- -- -- Table for the ZKSync accounts. CREATE TABLE accounts ( id BIGINT NOT NULL PRIMARY KEY, last_block BIGINT NOT NULL, nonce BIGINT NOT NULL, address bytea NOT NULL, pubkey_hash bytea NOT NULL ); -- Table for the account balance change operations. CREATE TABLE account_balance_updates ( balance_update_id serial NOT NULL, account_id BIGINT NOT NULL, block_number BIGINT NOT NULL, coin_id INTEGER NOT NULL REFERENCES tokens(id) ON UPDATE CASCADE, old_balance NUMERIC NOT NULL, new_balance NUMERIC NOT NULL, old_nonce BIGINT NOT NULL, new_nonce BIGINT NOT NULL, update_order_id INTEGER NOT NULL, PRIMARY KEY (balance_update_id) ); -- Table for the account creation operations. CREATE TABLE account_creates ( account_id BIGINT NOT NULL, is_create bool NOT NULL, block_number BIGINT NOT NULL, address bytea NOT NULL, nonce BIGINT NOT NULL, update_order_id INTEGER NOT NULL, PRIMARY KEY (account_id, block_number) ); -- Table for the account public key change operations. CREATE TABLE account_pubkey_updates ( pubkey_update_id serial NOT NULL, update_order_id INTEGER NOT NULL, account_id BIGINT NOT NULL, block_number BIGINT NOT NULL, old_pubkey_hash bytea NOT NULL, new_pubkey_hash bytea NOT NULL, old_nonce BIGINT NOT NULL, new_nonce BIGINT NOT NULL, PRIMARY KEY (pubkey_update_id) ); -- Table for the account balances. One account can have several balances, -- but every balance account has must have an unique token (meaning that -- there may be user with `ETH` and `ERC-20` balances, but not with `ETH` -- and `ETH` balances). CREATE TABLE balances ( account_id BIGINT REFERENCES accounts(id) ON UPDATE CASCADE ON DELETE CASCADE, coin_id INTEGER REFERENCES tokens(id) ON UPDATE CASCADE, balance NUMERIC NOT NULL DEFAULT 0, PRIMARY KEY (account_id, coin_id) ); -- -------------------- -- -- Data restore section -- -- -------------------- -- CREATE TABLE data_restore_events_state ( id SERIAL PRIMARY KEY, block_type TEXT NOT NULL, transaction_hash BYTEA NOT NULL, block_num BIGINT NOT NULL ); CREATE TABLE data_restore_storage_state_update ( id SERIAL PRIMARY KEY, storage_state TEXT NOT NULL ); CREATE TABLE data_restore_last_watched_eth_block ( id SERIAL PRIMARY KEY, block_number TEXT NOT NULL ); -- Table for the executed franklin operations, used by CREATE TABLE data_restore_rollup_ops ( id SERIAL PRIMARY KEY, block_num BIGINT NOT NULL, operation JSONB NOT NULL, fee_account BIGINT NOT NULL ); -- -------------- -- -- Prover section -- -- -------------- -- -- Stored proofs for the blocks. CREATE TABLE proofs ( block_number bigserial PRIMARY KEY, proof jsonb NOT NULL, created_at TIMESTAMP with time zone NOT NULL DEFAULT now() ); -- Ongoing block proving jobs. CREATE TABLE prover_runs ( id serial PRIMARY KEY, block_number BIGINT NOT NULL, worker TEXT, created_at TIMESTAMP with time zone NOT NULL DEFAULT now(), updated_at TIMESTAMP with time zone NOT NULL DEFAULT now() ); -- List of currently available provers. CREATE TABLE active_provers ( id serial PRIMARY KEY, worker TEXT NOT NULL, created_at TIMESTAMP with time zone NOT NULL DEFAULT now(), stopped_at TIMESTAMP with time zone, block_size BIGINT NOT NULL ); -- --------------------- -- -- Server config section -- -- --------------------- -- -- Unique server configuration entry. -- Expected to be initialized separately, e.g. by `zksync db-reset` or `zksync init` command. CREATE TABLE server_config ( -- enforce single record id bool PRIMARY KEY NOT NULL DEFAULT true, CONSTRAINT single_server_config CHECK (id), contract_addr TEXT, gov_contract_addr TEXT ); -- ----------- -- -- ETH section -- -- ----------- -- -- Stored Ethereum anchoring operations. CREATE TABLE eth_operations ( id bigserial PRIMARY KEY, nonce BIGINT NOT NULL, confirmed bool NOT NULL DEFAULT false, raw_tx bytea NOT NULL, op_type TEXT NOT NULL, final_hash bytea DEFAULT NULL, last_deadline_block BIGINT NOT NULL, last_used_gas_price NUMERIC NOT NULL ); -- Data related to the interaction with the Ethereum network. CREATE TABLE eth_parameters ( -- enforce single record id bool PRIMARY KEY NOT NULL DEFAULT true, -- Locally stored Ethereum nonce nonce BIGINT NOT NULL, -- Last gas price limit used by GasAdjuster gas_price_limit BIGINT NOT NULL, -- Gathered operations statistics commit_ops BIGINT NOT NULL, verify_ops BIGINT NOT NULL, withdraw_ops BIGINT NOT NULL ); -- Table connection `eth_operations` and `operations` table. -- Each entry provides a mapping between the Ethereum transaction and the ZK Sync operation. CREATE TABLE eth_ops_binding ( id bigserial PRIMARY KEY, op_id bigserial NOT NULL REFERENCES operations(id), eth_op_id bigserial NOT NULL REFERENCES eth_operations(id) ); -- Table storing all the sent Ethereum transaction hashes. CREATE TABLE eth_tx_hashes ( id bigserial PRIMARY KEY, eth_op_id bigserial NOT NULL REFERENCES eth_operations(id), tx_hash bytea NOT NULL ); -- --------------- -- -- Mempool section -- -- --------------- -- CREATE TABLE mempool_txs ( id bigserial PRIMARY KEY, -- Hash of the transaction tx_hash TEXT NOT NULL, -- Transaction contents tx jsonb NOT NULL ); -- --------------- -- -- Indexes section -- -- --------------- -- -- Indexes are built for tables on the columns which are used intensively in queries. CREATE INDEX operations_block_index ON operations (block_number); CREATE INDEX blocks_root_hash_index ON blocks (root_hash); CREATE INDEX tokens_symbol_index ON tokens (symbol); CREATE INDEX eth_ops_binding_op_id_index ON eth_ops_binding (op_id); CREATE INDEX eth_tx_hashes_eth_op_id_index ON eth_tx_hashes (eth_op_id); CREATE INDEX mempool_txs_hash_index ON mempool_txs (tx_hash); CREATE INDEX accounts_block_index ON accounts (last_block); CREATE INDEX accounts_address_index ON accounts (address); CREATE INDEX account_balance_updates_block_index ON account_balance_updates (block_number); CREATE INDEX account_creates_block_index ON account_creates (block_number); CREATE INDEX account_pubkey_updates_block_index ON account_pubkey_updates (block_number); CREATE INDEX executed_transactions_block_number_index ON executed_transactions (block_number); CREATE INDEX executed_transactions_hash_index ON executed_transactions (tx_hash); CREATE INDEX executed_transactions_from_account_index ON executed_transactions (from_account); CREATE INDEX executed_transactions_to_account_index ON executed_transactions (to_account); CREATE INDEX executed_priority_operations_block_index ON executed_priority_operations (block_number); CREATE INDEX executed_priority_operations_serialid_index ON executed_priority_operations (priority_op_serialid); CREATE INDEX executed_priority_operations_eth_hash_index ON executed_priority_operations (eth_hash); CREATE INDEX executed_priority_operations_from_account_index ON executed_priority_operations (from_account); CREATE INDEX executed_priority_operations_to_account_index ON executed_priority_operations (to_account); -- ------------------ -- -- Extensions section -- -- ------------------ -- -- `tablefunc` enables `crosstab` (pivot) CREATE EXTENSION IF NOT EXISTS tablefunc; -- ---------------------- -- -- Data insertion section -- -- ---------------------- -- -- Add ETH token INSERT INTO tokens VALUES (0, '0x0000000000000000000000000000000000000000', 'ETH', 18);
the_stack
-- -- Licensed to the Apache Software Foundation (ASF) under one -- or more contributor license agreements. See the NOTICE file -- distributed with this work for additional information -- regarding copyright ownership. The ASF licenses this file -- to you under the Apache License, Version 2.0 (the -- "License"); you may not use this file except in compliance -- with the License. You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, -- software distributed under the License is distributed on an -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -- KIND, either express or implied. See the License for the -- specific language governing permissions and limitations -- under the License. -- -- -- Add new system-level permission -- EXEC sp_unbindrule 'guacamole_system_permission'; DROP RULE [guacamole_system_permission_list]; GO CREATE RULE [guacamole_system_permission_list] AS @list IN ( 'CREATE_CONNECTION', 'CREATE_CONNECTION_GROUP', 'CREATE_SHARING_PROFILE', 'CREATE_USER', 'CREATE_USER_GROUP', 'ADMINISTER' ); GO EXEC sp_bindrule 'guacamole_system_permission_list', 'guacamole_system_permission'; GO -- -- Entity types -- CREATE RULE [guacamole_entity_type_list] AS @list IN ( 'USER', 'USER_GROUP' ); GO CREATE TYPE [guacamole_entity_type] FROM [nvarchar](16); EXEC sp_bindrule 'guacamole_entity_type_list', 'guacamole_entity_type'; GO -- -- Table of base entities which may each be either a user or user group. Other -- tables which represent qualities shared by both users and groups will point -- to guacamole_entity, while tables which represent qualities specific to -- users or groups will point to guacamole_user or guacamole_user_group. -- CREATE TABLE [guacamole_entity] ( [entity_id] [int] IDENTITY(1,1) NOT NULL, [name] [nvarchar](128) NOT NULL, [type] [guacamole_entity_type] NOT NULL, CONSTRAINT [PK_guacamole_entity] PRIMARY KEY CLUSTERED ([entity_id]), CONSTRAINT [AK_guacamole_entity_name_scope] UNIQUE ([type], [name]) ); GO -- -- Table of user groups. Each user group may have an arbitrary set of member -- users and member groups, with those members inheriting the permissions -- granted to that group. -- CREATE TABLE [guacamole_user_group] ( [user_group_id] [int] IDENTITY(1,1) NOT NULL, [entity_id] [int] NOT NULL, -- Group disabled status [disabled] [bit] NOT NULL DEFAULT 0, CONSTRAINT [PK_guacamole_user_group] PRIMARY KEY CLUSTERED ([user_group_id]), CONSTRAINT [guacamole_user_group_single_entity] UNIQUE ([entity_id]), CONSTRAINT [guacamole_user_group_entity] FOREIGN KEY ([entity_id]) REFERENCES [guacamole_entity] ([entity_id]) ON DELETE CASCADE ); GO -- -- Table of users which are members of given user groups. -- CREATE TABLE [guacamole_user_group_member] ( [user_group_id] [int] NOT NULL, [member_entity_id] [int] NOT NULL, CONSTRAINT [PK_guacamole_user_group_member] PRIMARY KEY CLUSTERED ([user_group_id], [member_entity_id]), -- Parent must be a user group CONSTRAINT [guacamole_user_group_member_parent_id] FOREIGN KEY ([user_group_id]) REFERENCES [guacamole_user_group] ([user_group_id]) ON DELETE CASCADE, -- Member may be either a user or a user group (any entity) CONSTRAINT [guacamole_user_group_member_entity_id] FOREIGN KEY ([member_entity_id]) REFERENCES [guacamole_entity] ([entity_id]) -- ON DELETE CASCADE handled by guacamole_delete_entity trigger ); GO -- -- Table of user group permissions. Each user group permission grants a user -- or user group access to a another user group (the "affected" user group) for -- a specific type of operation. -- CREATE TABLE [guacamole_user_group_permission] ( [entity_id] [int] NOT NULL, [affected_user_group_id] [int] NOT NULL, [permission] [guacamole_object_permission] NOT NULL, CONSTRAINT [PK_guacamole_user_group_permission] PRIMARY KEY CLUSTERED ([entity_id], [affected_user_group_id], [permission]), CONSTRAINT [FK_guacamole_user_group_permission_affected_user_group_id] FOREIGN KEY ([affected_user_group_id]) REFERENCES [guacamole_user_group] ([user_group_id]) ON DELETE CASCADE, CONSTRAINT [FK_guacamole_user_group_permission_entity_id] FOREIGN KEY ([entity_id]) REFERENCES [guacamole_entity] ([entity_id]) -- ON DELETE CASCADE handled by guacamole_delete_entity trigger ); CREATE NONCLUSTERED INDEX [IX_guacamole_user_group_permission_entity_id] ON [guacamole_user_group_permission] ([entity_id]); CREATE NONCLUSTERED INDEX [IX_guacamole_user_group_permission_affected_user_group_id] ON [guacamole_user_group_permission] ([affected_user_group_id]); GO -- -- The guacamole_delete_entity trigger effectively replaces the -- guacamole_delete_user trigger, which is no longer necessary and will cease -- being correct after the columns of existing tables are updated. -- DROP TRIGGER [guacamole_delete_user]; GO -- -- Modify guacamole_user table to use guacamole_entity as a base -- -- Add new entity_id column ALTER TABLE [guacamole_user] ADD [entity_id] [int]; GO -- Create user entities for each guacamole_user entry INSERT INTO [guacamole_entity] ([name], [type]) SELECT [username], 'USER' FROM [guacamole_user]; GO -- Update guacamole_user to point to corresponding guacamole_entity UPDATE [guacamole_user] SET [entity_id] = ( SELECT [entity_id] FROM [guacamole_entity] WHERE [username] = [guacamole_entity].[name] AND type = 'USER' ); GO -- The entity_id column should now be safely non-NULL ALTER TABLE [guacamole_user] ALTER COLUMN [entity_id] [int] NOT NULL; -- The entity_id column should now be unique for each user ALTER TABLE [guacamole_user] ADD CONSTRAINT [AK_guacamole_user_single_entity] UNIQUE ([entity_id]); -- The entity_id column should now safely point to guacamole_entity entries ALTER TABLE [guacamole_user] ADD CONSTRAINT [FK_guacamole_user_entity] FOREIGN KEY ([entity_id]) REFERENCES [guacamole_entity] ([entity_id]) ON DELETE CASCADE; -- The username column can now safely be removed ALTER TABLE [guacamole_user] DROP [AK_guacamole_user_username]; ALTER TABLE [guacamole_user] DROP COLUMN [username]; GO -- -- Modify guacamole_connection_permission to use guacamole_entity instead of -- guacamole_user -- -- Add new entity_id column ALTER TABLE [guacamole_connection_permission] ADD [entity_id] [int]; GO -- Update guacamole_connection_permission to point to the guacamole_entity -- that has been granted the permission UPDATE [guacamole_connection_permission] SET [entity_id] = ( SELECT [entity_id] FROM [guacamole_user] WHERE [guacamole_user].[user_id] = [guacamole_connection_permission].[user_id] ); GO -- The entity_id column should now be safely non-NULL ALTER TABLE [guacamole_connection_permission] ALTER COLUMN [entity_id] [int] NOT NULL; -- Remove user_id column DROP INDEX [IX_guacamole_connection_permission_user_id] ON [guacamole_connection_permission]; ALTER TABLE [guacamole_connection_permission] DROP [PK_guacamole_connection_permission]; ALTER TABLE [guacamole_connection_permission] DROP [FK_guacamole_connection_permission_user_id]; ALTER TABLE [guacamole_connection_permission] DROP COLUMN [user_id]; -- The entity_id column should now safely point to guacamole_entity entries ALTER TABLE [guacamole_connection_permission] ADD CONSTRAINT [FK_guacamole_connection_permission_entity_id] FOREIGN KEY ([entity_id]) REFERENCES [guacamole_entity] ([entity_id]) ON DELETE CASCADE; CREATE NONCLUSTERED INDEX [IX_guacamole_connection_permission_entity_id] ON [guacamole_connection_permission] ([entity_id]); -- Add new primary key which uses entity_id ALTER TABLE [guacamole_connection_permission] ADD CONSTRAINT [PK_guacamole_connection_permission] PRIMARY KEY CLUSTERED ([entity_id], [connection_id], [permission]); GO -- -- Modify guacamole_connection_group_permission to use guacamole_entity instead -- of guacamole_user -- -- Add new entity_id column ALTER TABLE [guacamole_connection_group_permission] ADD [entity_id] [int]; GO -- Update guacamole_connection_group_permission to point to the guacamole_entity -- that has been granted the permission UPDATE guacamole_connection_group_permission SET entity_id = ( SELECT entity_id FROM guacamole_user WHERE guacamole_user.user_id = guacamole_connection_group_permission.user_id ); GO -- The entity_id column should now be safely non-NULL ALTER TABLE [guacamole_connection_group_permission] ALTER COLUMN [entity_id] [int] NOT NULL; -- Remove user_id column DROP INDEX [IX_guacamole_connection_group_permission_user_id] ON [guacamole_connection_group_permission]; ALTER TABLE [guacamole_connection_group_permission] DROP [PK_guacamole_connection_group_permission]; ALTER TABLE [guacamole_connection_group_permission] DROP [FK_guacamole_connection_group_permission_user_id]; ALTER TABLE [guacamole_connection_group_permission] DROP COLUMN user_id; -- The entity_id column should now safely point to guacamole_entity entries ALTER TABLE [guacamole_connection_group_permission] ADD CONSTRAINT [FK_guacamole_connection_group_permission_entity_id] FOREIGN KEY ([entity_id]) REFERENCES [guacamole_entity] ([entity_id]) ON DELETE CASCADE; CREATE NONCLUSTERED INDEX [IX_guacamole_connection_group_permission_entity_id] ON [guacamole_connection_group_permission] ([entity_id]); -- Add new primary key which uses entity_id ALTER TABLE [guacamole_connection_group_permission] ADD CONSTRAINT [PK_guacamole_connection_group_permission] PRIMARY KEY CLUSTERED ([entity_id], [connection_group_id], [permission]); GO -- -- Modify guacamole_sharing_profile_permission to use guacamole_entity instead -- of guacamole_user -- -- Add new entity_id column ALTER TABLE [guacamole_sharing_profile_permission] ADD [entity_id] [int]; GO -- Update guacamole_sharing_profile_permission to point to the guacamole_entity -- that has been granted the permission UPDATE guacamole_sharing_profile_permission SET entity_id = ( SELECT entity_id FROM guacamole_user WHERE guacamole_user.user_id = guacamole_sharing_profile_permission.user_id ); GO -- The entity_id column should now be safely non-NULL ALTER TABLE [guacamole_sharing_profile_permission] ALTER COLUMN [entity_id] [int] NOT NULL; -- Remove user_id column DROP INDEX [IX_guacamole_sharing_profile_permission_user_id] ON [guacamole_sharing_profile_permission]; ALTER TABLE [guacamole_sharing_profile_permission] DROP [PK_guacamole_sharing_profile_permission]; ALTER TABLE [guacamole_sharing_profile_permission] DROP [FK_guacamole_sharing_profile_permission_user_id]; ALTER TABLE [guacamole_sharing_profile_permission] DROP COLUMN user_id; -- The entity_id column should now safely point to guacamole_entity entries ALTER TABLE [guacamole_sharing_profile_permission] ADD CONSTRAINT [FK_guacamole_sharing_profile_permission_entity_id] FOREIGN KEY ([entity_id]) REFERENCES [guacamole_entity] ([entity_id]) ON DELETE CASCADE; CREATE NONCLUSTERED INDEX [IX_guacamole_sharing_profile_permission_entity_id] ON [guacamole_sharing_profile_permission] ([entity_id]); -- Add new primary key which uses entity_id ALTER TABLE [guacamole_sharing_profile_permission] ADD CONSTRAINT [PK_guacamole_sharing_profile_permission] PRIMARY KEY CLUSTERED ([entity_id], [sharing_profile_id], [permission]); GO -- -- Modify guacamole_user_permission to use guacamole_entity instead of -- guacamole_user -- -- Add new entity_id column ALTER TABLE [guacamole_user_permission] ADD [entity_id] [int]; GO -- Update guacamole_user_permission to point to the guacamole_entity -- that has been granted the permission UPDATE guacamole_user_permission SET entity_id = ( SELECT entity_id FROM guacamole_user WHERE guacamole_user.user_id = guacamole_user_permission.user_id ); GO -- The entity_id column should now be safely non-NULL ALTER TABLE [guacamole_user_permission] ALTER COLUMN [entity_id] [int] NOT NULL; -- The entity_id column should now safely point to guacamole_entity entries ALTER TABLE [guacamole_user_permission] ADD CONSTRAINT [FK_guacamole_user_permission_entity_id] FOREIGN KEY ([entity_id]) REFERENCES [guacamole_entity] ([entity_id]); -- ON DELETE CASCADE handled by guacamole_delete_entity trigger -- The affected_user_id column now has ON DELETE CASCADE ALTER TABLE [guacamole_user_permission] DROP [FK_guacamole_user_permission_affected_user_id]; ALTER TABLE [guacamole_user_permission] ADD CONSTRAINT [FK_guacamole_user_permission_affected_user_id] FOREIGN KEY ([affected_user_id]) REFERENCES [guacamole_user] ([user_id]) ON DELETE CASCADE; CREATE NONCLUSTERED INDEX [IX_guacamole_user_permission_entity_id] ON [guacamole_user_permission] ([entity_id]); -- Remove user_id column DROP INDEX [IX_guacamole_user_permission_user_id] ON [guacamole_user_permission]; ALTER TABLE [guacamole_user_permission] DROP [PK_guacamole_user_permission]; ALTER TABLE [guacamole_user_permission] DROP [FK_guacamole_user_permission_user_id]; ALTER TABLE [guacamole_user_permission] DROP COLUMN user_id; -- Add new primary key which uses entity_id ALTER TABLE [guacamole_user_permission] ADD CONSTRAINT [PK_guacamole_user_permission] PRIMARY KEY CLUSTERED ([entity_id], [affected_user_id], [permission]); GO -- -- Modify guacamole_system_permission to use guacamole_entity instead of -- guacamole_user -- -- Add new entity_id column ALTER TABLE [guacamole_system_permission] ADD [entity_id] [int]; GO -- Update guacamole_system_permission to point to the guacamole_entity -- that has been granted the permission UPDATE [guacamole_system_permission] SET [entity_id] = ( SELECT [entity_id] FROM [guacamole_user] WHERE [guacamole_user].[user_id] = [guacamole_system_permission].[user_id] ); GO -- The entity_id column should now be safely non-NULL ALTER TABLE [guacamole_system_permission] ALTER COLUMN [entity_id] [int] NOT NULL; -- Remove user_id column DROP INDEX [IX_guacamole_system_permission_user_id] ON [guacamole_system_permission]; ALTER TABLE [guacamole_system_permission] DROP [PK_guacamole_system_permission]; ALTER TABLE [guacamole_system_permission] DROP [FK_guacamole_system_permission_user_id]; ALTER TABLE [guacamole_system_permission] DROP COLUMN [user_id]; -- The entity_id column should now safely point to guacamole_entity entries ALTER TABLE [guacamole_system_permission] ADD CONSTRAINT [FK_guacamole_system_permission_entity_id] FOREIGN KEY ([entity_id]) REFERENCES [guacamole_entity] ([entity_id]) ON DELETE CASCADE; CREATE NONCLUSTERED INDEX [IX_guacamole_system_permission_entity_id] ON [guacamole_system_permission] ([entity_id]); -- Add new primary key which uses entity_id ALTER TABLE [guacamole_system_permission] ADD CONSTRAINT [PK_guacamole_system_permission] PRIMARY KEY CLUSTERED ([entity_id], [permission]); GO -- -- Handle cascading deletion/updates of records in response to deletion of -- guacamole_entity records, where such deletion is not already covered by -- ON DELETE CASCADE or ON DELETE SET NULL. -- CREATE TRIGGER [guacamole_delete_entity] ON [guacamole_entity] INSTEAD OF DELETE AS BEGIN -- Do not take trigger into account when producing row counts for the DELETE SET NOCOUNT ON; -- Delete all associated permissions not covered by ON DELETE CASCADE DELETE FROM [guacamole_user_permission] WHERE [entity_id] IN (SELECT [entity_id] FROM DELETED); DELETE FROM [guacamole_user_group_permission] WHERE [entity_id] IN (SELECT [entity_id] FROM DELETED); -- Delete all associated group memberships not covered by ON DELETE CASCADE DELETE FROM [guacamole_user_group_member] WHERE [member_entity_id] IN (SELECT [entity_id] FROM DELETED); -- Perform original deletion DELETE FROM [guacamole_entity] WHERE [entity_id] IN (SELECT [entity_id] FROM DELETED); END GO -- -- Update guacamole_delete_connection_group trigger to remove descendant -- connections first. -- DROP TRIGGER [guacamole_delete_connection_group]; GO CREATE TRIGGER [guacamole_delete_connection_group] ON [guacamole_connection_group] INSTEAD OF DELETE AS BEGIN -- Do not take trigger into account when producing row counts for the DELETE SET NOCOUNT ON; -- Delete all descendant connections WITH [connection_groups] ([connection_group_id]) AS ( SELECT [connection_group_id] FROM DELETED UNION ALL SELECT [guacamole_connection_group].[connection_group_id] FROM [guacamole_connection_group] JOIN [connection_groups] ON [connection_groups].[connection_group_id] = [guacamole_connection_group].[parent_id] ) DELETE FROM [guacamole_connection] WHERE [parent_id] IN ( SELECT [connection_group_id] FROM [connection_groups] ); -- Delete all requested connection groups, including descendants WITH [connection_groups] ([connection_group_id]) AS ( SELECT [connection_group_id] FROM DELETED UNION ALL SELECT [guacamole_connection_group].[connection_group_id] FROM [guacamole_connection_group] JOIN [connection_groups] ON [connection_groups].[connection_group_id] = [guacamole_connection_group].[parent_id] ) DELETE FROM [guacamole_connection_group] WHERE [connection_group_id] IN ( SELECT [connection_group_id] FROM [connection_groups] ); END GO -- -- Table of arbitrary user attributes. Each attribute is simply a name/value -- pair associated with a user. Arbitrary attributes are defined by other -- extensions. Attributes defined by this extension will be mapped to -- properly-typed columns of a specific table. -- CREATE TABLE [guacamole_user_attribute] ( [user_id] [int] NOT NULL, [attribute_name] [nvarchar](128) NOT NULL, [attribute_value] [nvarchar](4000) NOT NULL, CONSTRAINT [PK_guacamole_user_attribute] PRIMARY KEY CLUSTERED ([user_id], [attribute_name]), CONSTRAINT [FK_guacamole_user_attribute_user_id] FOREIGN KEY ([user_id]) REFERENCES [guacamole_user] ([user_id]) ON DELETE CASCADE ); CREATE NONCLUSTERED INDEX [IX_guacamole_user_attribute_user_id] ON [guacamole_user_attribute] ([user_id]) INCLUDE ([attribute_name], [attribute_value]); GO -- -- Table of arbitrary user group attributes. Each attribute is simply a -- name/value pair associated with a user group. Arbitrary attributes are -- defined by other extensions. Attributes defined by this extension will be -- mapped to properly-typed columns of a specific table. -- CREATE TABLE [guacamole_user_group_attribute] ( [user_group_id] [int] NOT NULL, [attribute_name] [nvarchar](128) NOT NULL, [attribute_value] [nvarchar](4000) NOT NULL, CONSTRAINT [PK_guacamole_user_group_attribute] PRIMARY KEY CLUSTERED ([user_group_id], [attribute_name]), CONSTRAINT [FK_guacamole_user_attribute_user_group_id] FOREIGN KEY ([user_group_id]) REFERENCES [guacamole_user_group] ([user_group_id]) ON DELETE CASCADE ); CREATE NONCLUSTERED INDEX [IX_guacamole_user_group_attribute_user_id] ON [guacamole_user_group_attribute] ([user_group_id]) INCLUDE ([attribute_name], [attribute_value]); GO -- -- Table of arbitrary connection attributes. Each attribute is simply a -- name/value pair associated with a connection. Arbitrary attributes are -- defined by other extensions. Attributes defined by this extension will be -- mapped to properly-typed columns of a specific table. -- CREATE TABLE [guacamole_connection_attribute] ( [connection_id] [int] NOT NULL, [attribute_name] [nvarchar](128) NOT NULL, [attribute_value] [nvarchar](4000) NOT NULL, PRIMARY KEY (connection_id, attribute_name), CONSTRAINT [FK_guacamole_connection_attribute_connection_id] FOREIGN KEY ([connection_id]) REFERENCES [guacamole_connection] ([connection_id]) ON DELETE CASCADE ); CREATE NONCLUSTERED INDEX [IX_guacamole_connection_attribute_connection_id] ON [guacamole_connection_attribute] ([connection_id]) INCLUDE ([attribute_name], [attribute_value]); GO -- -- Table of arbitrary connection group attributes. Each attribute is simply a -- name/value pair associated with a connection group. Arbitrary attributes are -- defined by other extensions. Attributes defined by this extension will be -- mapped to properly-typed columns of a specific table. -- CREATE TABLE [guacamole_connection_group_attribute] ( [connection_group_id] [int] NOT NULL, [attribute_name] [nvarchar](128) NOT NULL, [attribute_value] [nvarchar](4000) NOT NULL, PRIMARY KEY (connection_group_id, attribute_name), CONSTRAINT [FK_guacamole_connection_group_attribute_connection_group_id] FOREIGN KEY ([connection_group_id]) REFERENCES [guacamole_connection_group] ([connection_group_id]) ON DELETE CASCADE ); CREATE NONCLUSTERED INDEX [IX_guacamole_connection_group_attribute_connection_group_id] ON [guacamole_connection_group_attribute] ([connection_group_id]) INCLUDE ([attribute_name], [attribute_value]); GO -- -- Table of arbitrary sharing profile attributes. Each attribute is simply a -- name/value pair associated with a sharing profile. Arbitrary attributes are -- defined by other extensions. Attributes defined by this extension will be -- mapped to properly-typed columns of a specific table. -- CREATE TABLE [guacamole_sharing_profile_attribute] ( [sharing_profile_id] [int] NOT NULL, [attribute_name] [nvarchar](128) NOT NULL, [attribute_value] [nvarchar](4000) NOT NULL, PRIMARY KEY (sharing_profile_id, attribute_name), CONSTRAINT [FK_guacamole_sharing_profile_attribute_sharing_profile_id] FOREIGN KEY ([sharing_profile_id]) REFERENCES [guacamole_sharing_profile] ([sharing_profile_id]) ON DELETE CASCADE ); CREATE NONCLUSTERED INDEX [IX_guacamole_sharing_profile_attribute_sharing_profile_id] ON [guacamole_sharing_profile_attribute] ([sharing_profile_id]) INCLUDE ([attribute_name], [attribute_value]); GO
the_stack
-- search_packages searchs packages in the database that match the criteria in -- the query provided. create or replace function search_packages(p_input jsonb) returns table(data json, total_count bigint) as $$ declare v_repository_kinds int[]; v_users text[]; v_orgs text[]; v_repositories text[]; v_licenses text[]; v_capabilities text[]; v_facets boolean := (p_input->>'facets')::boolean; v_tsquery_web tsquery := websearch_to_tsquery(p_input->>'ts_query_web'); v_tsquery_web_with_prefix_matching tsquery; v_tsquery tsquery := to_tsquery(p_input->>'ts_query'); v_sort text := coalesce(p_input->>'sort', 'relevance'); begin -- Prepare filters for later use select array_agg(e::int) into v_repository_kinds from jsonb_array_elements_text(p_input->'repository_kinds') e; select array_agg(e::text) into v_users from jsonb_array_elements_text(p_input->'users') e; select array_agg(e::text) into v_orgs from jsonb_array_elements_text(p_input->'orgs') e; select array_agg(e::text) into v_repositories from jsonb_array_elements_text(p_input->'repositories') e; select array_agg(e::text) into v_licenses from jsonb_array_elements_text(p_input->'licenses') e; select array_agg(e::text) into v_capabilities from jsonb_array_elements_text(p_input->'capabilities') e; -- Prepare v_tsquery_web_with_prefix_matching if v_tsquery_web is not null then select ts_rewrite( v_tsquery_web, format(' select to_tsquery(lexeme), to_tsquery(lexeme || '':*'') from unnest(tsvector_to_array(to_tsvector(%L))) as lexeme ', p_input->>'ts_query_web' ) ) into v_tsquery_web_with_prefix_matching; end if; return query with filtered_packages_excluding_facets_filters as ( select p.package_id, p.name, p.normalized_name, p.stars, p.tsdoc, p.official as package_official, s.display_name, s.description, s.logo_image_id, s.version, s.app_version, s.license, s.capabilities, s.deprecated, s.signed, s.signatures, s.security_report_summary, s.containers_images, s.ts, r.repository_id, r.repository_kind_id, rk.name as repository_kind_name, r.name as repository_name, r.url as repository_url, r.display_name as repository_display_name, r.verified_publisher, r.official as repository_official, r.scanner_disabled as repository_scanner_disabled, u.alias as user_alias, o.name as organization_name, o.display_name as organization_display_name from package p join snapshot s using (package_id) join repository r using (repository_id) join repository_kind rk using (repository_kind_id) left join "user" u using (user_id) left join organization o using (organization_id) where s.version = p.latest_version and case when v_tsquery_web is not null then v_tsquery_web_with_prefix_matching @@ p.tsdoc else true end and case when v_tsquery is not null then v_tsquery @@ p.tsdoc else true end and case when p_input ? 'verified_publisher' and (p_input->>'verified_publisher')::boolean = true then r.verified_publisher = true else true end and case when p_input ? 'official' and (p_input->>'official')::boolean = true then (r.official = true or p.official = true) else true end and case when p_input ? 'operators' and (p_input->>'operators')::boolean = true then p.is_operator = true else true end and case when p_input ? 'deprecated' and (p_input->>'deprecated')::boolean = true then true else (s.deprecated is null or s.deprecated = false) end ), filtered_packages as ( select * from filtered_packages_excluding_facets_filters where case when cardinality(v_repository_kinds) > 0 then repository_kind_id = any(v_repository_kinds) else true end and case when cardinality(v_orgs) > 0 and cardinality(v_users) > 0 then (organization_name = any(v_orgs) or user_alias = any(v_users)) when cardinality(v_orgs) > 0 then organization_name = any(v_orgs) when cardinality(v_users) > 0 then user_alias = any(v_users) else true end and case when cardinality(v_repositories) > 0 then repository_name = any(v_repositories) else true end and case when cardinality(v_licenses) > 0 then license = any(v_licenses) else true end and case when cardinality(v_capabilities) > 0 then capabilities = any(v_capabilities) else true end ) select json_strip_nulls(json_build_object( 'packages', ( select coalesce(json_agg(json_build_object( 'package_id', package_id, 'name', name, 'normalized_name', normalized_name, 'logo_image_id', logo_image_id, 'stars', stars, 'official', package_official, 'display_name', display_name, 'description', description, 'version', version, 'app_version', app_version, 'license', license, 'deprecated', deprecated, 'signed', signed, 'signatures', signatures, 'security_report_summary', security_report_summary, 'all_containers_images_whitelisted', are_all_containers_images_whitelisted(containers_images), 'production_organizations_count', ( select count(*) from production_usage where package_id = filtered_packages_paginated.package_id ), 'ts', floor(extract(epoch from ts)), 'repository', jsonb_build_object( 'repository_id', repository_id, 'kind', repository_kind_id, 'name', repository_name, 'display_name', repository_display_name, 'url', repository_url, 'verified_publisher', verified_publisher, 'official', repository_official, 'scanner_disabled', repository_scanner_disabled, 'user_alias', user_alias, 'organization_name', organization_name, 'organization_display_name', organization_display_name ) )), '[]') from ( select * from ( select fp.*, (case when v_tsquery_web is not null then trunc(ts_rank(ts_filter(tsdoc, '{a}'), v_tsquery_web, 1)::numeric, 2) + trunc(ts_rank('{0.1, 0.2, 0.2, 1.0}', ts_filter(tsdoc, '{b,c}'), v_tsquery_web)::numeric, 2) else 1 end) as relevance, (case when repository_official = true or package_official = true then true else false end) as official from filtered_packages fp ) as fpe order by case when v_sort = 'relevance' then (relevance, stars) end desc, case when v_sort = 'stars' then (stars, relevance) end desc, official desc, verified_publisher desc, name asc limit (p_input->>'limit')::int offset (p_input->>'offset')::int ) filtered_packages_paginated ), 'facets', case when v_facets then ( select json_build_array( ( select json_build_object( 'title', 'Kind', 'filter_key', 'kind', 'options', ( select coalesce(json_agg(json_build_object( 'id', repository_kind_id, 'name', repository_kind_name, 'total', total )), '[]') from ( select repository_kind_id, repository_kind_name, count(*) as total from filtered_packages_excluding_facets_filters group by repository_kind_id, repository_kind_name order by total desc, repository_kind_name asc ) as kinds_breakdown ) ) ), ( select json_build_object( 'title', 'Publisher', 'filter_key', 'publisher', 'options', ( select coalesce(json_agg(json_build_object( 'filter_key', filter_key, 'id', id, 'name', name, 'total', total )), '[]') from ( select filter_key, id, name, total from ( -- Organizations select 1 as pri, 'org' as filter_key, organization_name as id, coalesce(organization_display_name, organization_name) as name, count(*) as total from filtered_packages_excluding_facets_filters where organization_name = any(v_orgs) group by organization_name, organization_display_name union select 2 as pri, 'org' as filter_key, organization_name as id, coalesce(organization_display_name, organization_name) as name, count(*) as total from filtered_packages_excluding_facets_filters where organization_name is not null and case when cardinality(v_orgs) > 0 then organization_name <> all(v_orgs) else true end group by organization_name, organization_display_name union -- Users select 1 as pri, 'user' as filter_key, user_alias as id, user_alias as name, count(*) as total from filtered_packages_excluding_facets_filters where user_alias = any(v_users) group by user_alias union select 2 as pri, 'user' as filter_key, user_alias as id, user_alias as name, count(*) as total from filtered_packages_excluding_facets_filters where user_alias is not null and case when cardinality(v_users) > 0 then user_alias <> all(v_users) else true end group by user_alias ) as publishers order by pri asc, total desc, id asc limit 10 ) as publishers_breakdown ) ) ), ( select json_build_object( 'title', 'Repository', 'filter_key', 'repo', 'options', ( select coalesce(json_agg(json_build_object( 'id', repository_name, 'name', coalesce(repository_display_name, initcap(repository_name)), 'total', total )), '[]') from ( select repository_name, repository_display_name, total from ( select 1 as pri, repository_name, repository_display_name, count(*) as total from filtered_packages_excluding_facets_filters where repository_name = any(v_repositories) group by repository_name, repository_display_name union select 2 as pri, repository_name, repository_display_name, count(*) as total from filtered_packages_excluding_facets_filters where repository_name is not null and case when cardinality(v_repositories) > 0 then repository_name <> all(v_repositories) else true end group by repository_name, repository_display_name ) as repos order by pri asc, total desc, repository_name asc limit 10 ) as repositories_breakdown ) ) ), ( select json_build_object( 'title', 'License', 'filter_key', 'license', 'options', ( select coalesce(json_agg(json_build_object( 'id', license, 'name', license, 'total', total )), '[]') from ( select license, total from ( select 1 as pri, license, count(*) as total from filtered_packages_excluding_facets_filters where license = any(v_licenses) group by license union select 2 as pri, license, count(*) as total from filtered_packages_excluding_facets_filters where license is not null and case when cardinality(v_licenses) > 0 then license <> all(v_licenses) else true end group by license ) as orgs order by pri asc, total desc, license asc limit 10 ) as licenses_breakdown ) ) ), ( select json_build_object( 'title', 'Operator capabilities', 'filter_key', 'capabilities', 'options', ( select coalesce(json_agg(json_build_object( 'id', capabilities, 'name', capabilities, 'total', total )), '[]') from ( select capabilities, count(*) as total from filtered_packages_excluding_facets_filters where capabilities is not null group by capabilities order by total desc, capabilities asc ) as capabilities_breakdown ) ) ) ) ) else null end )), (select count(*) from filtered_packages); end $$ language plpgsql;
the_stack
-- 2019-02-19T17:48:51.844 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Name='Produkte hinzufügen',Updated=TO_TIMESTAMP('2019-02-19 17:48:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541047 ; -- 2019-02-19T17:49:06.060 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:49:06','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Produkte hinzufügen' WHERE AD_Process_ID=541047 AND AD_Language='de_CH' ; -- 2019-02-19T17:49:10.313 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:49:10','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Produkte hinzufügen' WHERE AD_Process_ID=541047 AND AD_Language='de_DE' ; -- 2019-02-19T17:49:12.690 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:49:12','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541047 AND AD_Language='en_US' ; -- 2019-02-19T17:50:22.066 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Name='Weitere Produkte',Updated=TO_TIMESTAMP('2019-02-19 17:50:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541047 ; -- 2019-02-19T17:50:27.412 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:50:27','YYYY-MM-DD HH24:MI:SS'),Name='Weitere Produkte' WHERE AD_Process_ID=541047 AND AD_Language='de_CH' ; -- 2019-02-19T17:50:29.942 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:50:29','YYYY-MM-DD HH24:MI:SS'),Name='Weitere Produkte' WHERE AD_Process_ID=541047 AND AD_Language='de_DE' ; -- 2019-02-19T17:50:42.874 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Name='Produkte hinzufügen',Updated=TO_TIMESTAMP('2019-02-19 17:50:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541046 ; -- 2019-02-19T17:50:47.330 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:50:47','YYYY-MM-DD HH24:MI:SS'),Name='Produkte hinzufügen' WHERE AD_Process_ID=541046 AND AD_Language='de_CH' ; -- 2019-02-19T17:50:50.433 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:50:50','YYYY-MM-DD HH24:MI:SS'),Name='Produkte hinzufügen' WHERE AD_Process_ID=541046 AND AD_Language='de_DE' ; -- 2019-02-19T17:50:51.321 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:50:51','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541046 AND AD_Language='en_US' ; -- 2019-02-19T17:50:52.207 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:50:52','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541046 AND AD_Language='de_DE' ; -- 2019-02-19T17:50:53.990 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:50:53','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541046 AND AD_Language='de_CH' ; -- 2019-02-19T17:51:18.527 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Name='Zurück',Updated=TO_TIMESTAMP('2019-02-19 17:51:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541048 ; -- 2019-02-19T17:51:22.487 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:51:22','YYYY-MM-DD HH24:MI:SS'),Name='Zurück' WHERE AD_Process_ID=541048 AND AD_Language='de_CH' ; -- 2019-02-19T17:51:25.618 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:51:25','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Zurück' WHERE AD_Process_ID=541048 AND AD_Language='de_DE' ; -- 2019-02-19T17:51:26.967 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:51:26','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541048 AND AD_Language='en_US' ; -- 2019-02-19T17:51:27.734 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:51:27','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541048 AND AD_Language='de_CH' ; -- 2019-02-19T17:52:11.190 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Name='Speichern',Updated=TO_TIMESTAMP('2019-02-19 17:52:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541049 ; -- 2019-02-19T17:52:15.990 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:52:15','YYYY-MM-DD HH24:MI:SS'),Name='Speichern' WHERE AD_Process_ID=541049 AND AD_Language='de_CH' ; -- 2019-02-19T17:52:18.568 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:52:18','YYYY-MM-DD HH24:MI:SS'),Name='Speichern' WHERE AD_Process_ID=541049 AND AD_Language='de_DE' ; -- 2019-02-19T17:52:19.566 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:52:19','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541049 AND AD_Language='en_US' ; -- 2019-02-19T17:52:20.492 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:52:20','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541049 AND AD_Language='de_DE' ; -- 2019-02-19T17:52:21.528 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:52:21','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541049 AND AD_Language='de_CH' ; -- 2019-02-19T17:53:08.879 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Name='Vergleichspreise',Updated=TO_TIMESTAMP('2019-02-19 17:53:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541053 ; -- 2019-02-19T17:53:14.451 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:53:14','YYYY-MM-DD HH24:MI:SS'),Name='Vergleichspreise' WHERE AD_Process_ID=541053 AND AD_Language='de_CH' ; -- 2019-02-19T17:53:17.107 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:53:17','YYYY-MM-DD HH24:MI:SS'),Name='Vergleichspreise' WHERE AD_Process_ID=541053 AND AD_Language='de_DE' ; -- 2019-02-19T17:53:18.141 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:53:18','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541053 AND AD_Language='en_US' ; -- 2019-02-19T17:53:19.169 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:53:19','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541053 AND AD_Language='de_DE' ; -- 2019-02-19T17:53:20.353 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:53:20','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Process_ID=541053 AND AD_Language='de_CH' ; -- 2019-02-19T17:54:43.544 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Name='Andere Produkte',Updated=TO_TIMESTAMP('2019-02-19 17:54:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541047 ; -- 2019-02-19T17:54:48.611 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:54:48','YYYY-MM-DD HH24:MI:SS'),Name='Andere Produkte' WHERE AD_Process_ID=541047 AND AD_Language='de_CH' ; -- 2019-02-19T17:54:50.336 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 17:54:50','YYYY-MM-DD HH24:MI:SS'),Name='Andere Produkte' WHERE AD_Process_ID=541047 AND AD_Language='de_DE' ; -- 2019-02-19T18:07:25.379 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 18:07:25','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Datum letzter Preis' WHERE AD_Element_ID=576115 AND AD_Language='de_CH' ; -- 2019-02-19T18:07:25.410 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576115,'de_CH') ; -- 2019-02-19T18:07:29.535 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 18:07:29','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Datum letzter Preis' WHERE AD_Element_ID=576115 AND AD_Language='de_DE' ; -- 2019-02-19T18:07:29.547 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576115,'de_DE') ; -- 2019-02-19T18:07:29.606 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(576115,'de_DE') ; -- 2019-02-19T18:07:29.628 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='LastSalesInvoiceDate', Name='Datum letzter Preis', Description=NULL, Help=NULL WHERE AD_Element_ID=576115 ; -- 2019-02-19T18:07:29.658 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='LastSalesInvoiceDate', Name='Datum letzter Preis', Description=NULL, Help=NULL, AD_Element_ID=576115 WHERE UPPER(ColumnName)='LASTSALESINVOICEDATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2019-02-19T18:07:29.693 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='LastSalesInvoiceDate', Name='Datum letzter Preis', Description=NULL, Help=NULL WHERE AD_Element_ID=576115 AND IsCentrallyMaintained='Y' ; -- 2019-02-19T18:07:29.726 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Datum letzter Preis', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=576115) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 576115) ; -- 2019-02-19T18:07:29.848 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Last Sales Invoice Date', Name='Datum letzter Preis' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=576115) ; -- 2019-02-19T18:07:29.913 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Datum letzter Preis', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 576115 ; -- 2019-02-19T18:07:29.991 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Datum letzter Preis', Description=NULL, Help=NULL WHERE AD_Element_ID = 576115 ; -- 2019-02-19T18:07:30.007 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name='Datum letzter Preis', Description=NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 576115 ; -- 2019-02-19T18:07:31.992 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-19 18:07:31','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Element_ID=576115 AND AD_Language='en_US' ; -- 2019-02-19T18:07:32.048 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576115,'en_US') ;
the_stack
-- OWNER TO CREATE TABLE hw_cstore_alter_t1(a int, b text) WITH(orientation=column); CREATE INDEX ON hw_cstore_alter_t1(a); CREATE ROLE cstore_role PASSWORD 'gauss@123'; ALTER TABLE hw_cstore_alter_t1 OWNER TO cstore_role; DROP TABLE hw_cstore_alter_t1; -- unsupported feature CREATE TABLE hw_cstore_alter_t3 ( a int , b int ) with ( orientation = column ) ; CREATE TABLE hw_cstore_alter_t4 ( c int, d int ) inherits ( hw_cstore_alter_t3 ) with ( orientation = column ) ; -- failed, not supported DROP TABLE IF EXISTS hw_cstore_alter_t3; DROP TABLE IF EXISTS hw_cstore_alter_t4; -- rename column -- 5. column ordinary table CREATE TABLE hw_cstore_alter_t2(a int , b bigint, c char(10), d decimal(20,2) ) with (orientation = column); INSERT INTO hw_cstore_alter_t2 VALUES(1, 2, 'text', 3); ALTER TABLE hw_cstore_alter_t2 RENAME a TO a1; -- ok SELECT a1 FROM hw_cstore_alter_t2; ALTER TABLE hw_cstore_alter_t2 RENAME COLUMN b TO b1; -- ok SELECT b1 FROM hw_cstore_alter_t2; ALTER TABLE IF EXISTS hw_cstore_alter_t2 RENAME c TO c1; -- ok SELECT c1 FROM hw_cstore_alter_t2; ALTER TABLE hw_cstore_alter_t2 RENAME d TO a1; -- failed, name conflicts SELECT d FROM hw_cstore_alter_t2; ALTER TABLE hw_cstore_alter_t3 RENAME a TO a1; -- failed, table doesn't exist ALTER TABLE hw_cstore_alter_t2 RENAME d TO xmin; -- failed, conflict with system column name ALTER TABLE hw_cstore_alter_t2 RENAME d TO abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij1234; -- ok , but truncate SELECT abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij1234 FROM hw_cstore_alter_t2; -- ok, attribute name will be truncated SELECT abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij123 FROM hw_cstore_alter_t2; -- ok ALTER TABLE hw_cstore_alter_t2 RENAME abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij1234 TO abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij123; -- failed, truncate but name conflicts -- 5.1 column ordinary index CREATE INDEX idx_hw_cstore_alter_t2 ON hw_cstore_alter_t2(c1); ALTER INDEX idx_hw_cstore_alter_t2 RENAME TO idx1_hw_cstore_alter_t2; -- ok select count(1) from pg_class where relname = 'idx1_hw_cstore_alter_t2'; ALTER INDEX IF EXISTS idx1_hw_cstore_alter_t2 RENAME TO idx2_hw_cstore_alter_t2; -- ok select count(1) from pg_class where relname = 'idx2_hw_cstore_alter_t2'; ALTER INDEX idx2_hw_cstore_alter_t2 RENAME TO hw_cstore_alter_t2; -- failed, name conflicts ALTER INDEX idx2_hw_cstore_alter_t2 RENAME TO idx3_abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij1234; -- ok, but truncate ALTER INDEX idx3_abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij1234 RENAME TO idx2_hw_cstore_alter_t2; -- ok select count(1) from pg_class where relname = 'idx2_hw_cstore_alter_t2'; DROP TABLE hw_cstore_alter_t2; -- 6 temp table -- 6.1 rename column CREATE TEMP TABLE hw_cstore_alter_t10 (a int , b int , c int ) with (orientation = column); ALTER TABLE hw_cstore_alter_t10 RENAME a to b; -- failed, name conflict ALTER TABLE hw_cstore_alter_t10 RENAME a to xmin; -- failed, system column name ALTER TABLE hw_cstore_alter_t10 RENAME a to a1; -- ok SELECT a1 FROM hw_cstore_alter_t10; -- ok ALTER TABLE hw_cstore_alter_t10 RENAME a1 TO abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij1234; SELECT abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij1234 FROM hw_cstore_alter_t10; SELECT abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij123 FROM hw_cstore_alter_t10; ALTER TABLE hw_cstore_alter_t10 RENAME abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij1234 TO abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij123; -- failed, truncate but name conflicts CREATE INDEX idx1_hw_cstore_alter_t10 ON hw_cstore_alter_t10(b); \d+ idx1_hw_cstore_alter_t10 ALTER INDEX idx1_hw_cstore_alter_t10 RENAME TO idx2_hw_cstore_alter_t10; -- ok DROP TABLE hw_cstore_alter_t10; -- 6.2 rename partition CREATE TEMP TABLE hw_cstore_alter_t11 (a int, b int, c decimal(20, 0) ) with (orientation = column) PARTITION BY RANGE(a)( PARTITION p1 values less than (10), PARTITION p2 values less than (20), PARTITION p3 values less than (30) ); -- failed, unsupported feature -- 6.3 temp row table options CREATE TEMP TABLE hw_cstore_alter_t12(a int , b int , c int ) with (compression = 'high'); -- failed CREATE TEMP TABLE hw_cstore_alter_t12(a int , b int , c int ) with (max_batchrow = 60000); -- failed CREATE TEMP TABLE hw_cstore_alter_t12(a int , b int , c int ) with (deltarow_threshold = 9999); -- failed CREATE TEMP TABLE hw_cstore_alter_t12(a int , b int , c int ) with (partial_cluster_rows = 600000); -- failed CREATE TEMP TABLE hw_cstore_alter_t12(a int , b int , c int ) with (internal_mask = 1024); -- failed CREATE TEMP TABLE hw_cstore_alter_t12(a int , b int , c int ) with (compression = 'yes', fillfactor=70); -- ok ALTER TABLE hw_cstore_alter_t12 SET (compression = 'yes'); -- ok ALTER TABLE hw_cstore_alter_t12 SET (compression = 'no'); -- ok ALTER TABLE hw_cstore_alter_t12 SET (compression = 'low'); -- failed ALTER TABLE hw_cstore_alter_t12 SET (compression = 'middle'); -- failed ALTER TABLE hw_cstore_alter_t12 SET (compression = 'high'); -- failed -- \d+ hw_cstore_alter_t12 ALTER TABLE hw_cstore_alter_t12 RESET (compression); -- ok -- \d+ hw_cstore_alter_t12 ALTER TABLE hw_cstore_alter_t12 SET (max_batchrow = 10000); -- failed ALTER TABLE hw_cstore_alter_t12 RESET (max_batchrow); -- failed ALTER TABLE hw_cstore_alter_t12 SET (deltarow_threshold = 9999); -- failed ALTER TABLE hw_cstore_alter_t12 RESET (deltarow_threshold); -- failed ALTER TABLE hw_cstore_alter_t12 SET (partial_cluster_rows = 600000); -- failed ALTER TABLE hw_cstore_alter_t12 RESET (partial_cluster_rows); -- failed ALTER TABLE hw_cstore_alter_t12 SET (ORIENTATION = COLUMN); -- failed ALTER TABLE hw_cstore_alter_t12 SET (ORIENTATION = ROW); -- failed ALTER TABLE hw_cstore_alter_t12 RESET (ORIENTATION); -- failed ALTER TABLE hw_cstore_alter_t12 SET (internal_mask = 0); -- failed ALTER TABLE hw_cstore_alter_t12 RESET (internal_mask); -- failed DROP TABLE hw_cstore_alter_t12; CREATE TEMP TABLE hw_cstore_alter_t13(a int , b int , c int ); -- ok DROP TABLE hw_cstore_alter_t13; CREATE TEMP TABLE hw_cstore_alter_t14(a int , b int , c int ) with ( orientation = row ); -- ok -- 5.3.3.1 bree index CREATE INDEX idx1_hw_cstore_alter_t14 ON hw_cstore_alter_t14(b); -- ok ALTER INDEX idx1_hw_cstore_alter_t14 SET (fillfactor = 70); -- ok ALTER INDEX idx1_hw_cstore_alter_t14 RESET (fillfactor); -- ok ALTER INDEX idx1_hw_cstore_alter_t14 SET (compression = 'yes'); -- failed, unsupported ALTER INDEX idx1_hw_cstore_alter_t14 RESET (compression); -- ok, ignore it ALTER INDEX idx1_hw_cstore_alter_t14 SET (autovacuum_enabled = true); -- failed, unsupported ALTER INDEX idx1_hw_cstore_alter_t14 RESET (autovacuum_enabled); -- ok, ignore it ALTER INDEX idx1_hw_cstore_alter_t14 SET (security_barrier = true); -- failed, unsupported ALTER INDEX idx1_hw_cstore_alter_t14 RESET (security_barrier); -- ok, ignore it ALTER INDEX idx1_hw_cstore_alter_t14 SET (max_batchrow=10000); -- failed ALTER INDEX idx1_hw_cstore_alter_t14 RESET (max_batchrow); -- ok, ignore it ALTER INDEX idx1_hw_cstore_alter_t14 SET (orientation = column); -- failed ALTER INDEX idx1_hw_cstore_alter_t14 RESET (orientation); -- ok, ignore it ALTER INDEX idx1_hw_cstore_alter_t14 SET (internal_mask = 0); -- failed ALTER INDEX idx1_hw_cstore_alter_t14 RESET (internal_mask); -- failed ALTER INDEX idx1_hw_cstore_alter_t14 SET (partial_cluster_rows = 600000); -- failed ALTER INDEX idx1_hw_cstore_alter_t14 RESET (partial_cluster_rows); -- ok, ignore it ALTER INDEX idx1_hw_cstore_alter_t14 SET (deltarow_threshold = 5000); -- failed ALTER INDEX idx1_hw_cstore_alter_t14 RESET (deltarow_threshold); -- ok, ignore it -- \d+ idx1_hw_cstore_alter_t14 DROP INDEX idx1_hw_cstore_alter_t14; drop TABLE hw_cstore_alter_t14; -- 6.4 temp column table options -- 6.4.1 alter table column set/reset attribute_option CREATE TEMP TABLE hw_cstore_alter_t15 (a int, b int, c int); ALTER TABLE hw_cstore_alter_t15 ALTER COLUMN a SET (n_distinct_inherited = 7); -- failed ALTER TABLE hw_cstore_alter_t15 ALTER COLUMN a RESET (n_distinct_inherited); -- failed ALTER TABLE hw_cstore_alter_t15 ALTER COLUMN a SET (n_distinct = 7); -- ok ALTER TABLE hw_cstore_alter_t15 ALTER COLUMN a RESET (n_distinct); -- ok ALTER TABLE hw_cstore_alter_t15 ALTER COLUMN a RESET (n_distinct, n_distinct_inherited); -- failed DROP TABLE hw_cstore_alter_t15; CREATE TEMP TABLE hw_cstore_alter_t16 (a int, b int, c int) with (internal_mask = 1024); -- failed CREATE TEMP TABLE hw_cstore_alter_t16 (a int, b int, c int) WITH (orientation = column); ALTER TABLE hw_cstore_alter_t16 ALTER COLUMN a SET (n_distinct_inherited = 7); -- failed ALTER TABLE hw_cstore_alter_t16 ALTER COLUMN a RESET (n_distinct_inherited); -- failed ALTER TABLE hw_cstore_alter_t16 ALTER COLUMN a SET (n_distinct = 7); ALTER TABLE hw_cstore_alter_t16 ALTER COLUMN a RESET (n_distinct); ALTER TABLE hw_cstore_alter_t16 ALTER COLUMN a RESET (n_distinct, n_distinct_inherited); -- failed -- \d+ hw_cstore_alter_t16 -- 6.4.2 change storage type ALTER TABLE hw_cstore_alter_t16 ALTER COLUMN a SET STORAGE PLAIN; -- failed ALTER TABLE hw_cstore_alter_t16 ALTER COLUMN a SET STORAGE EXTERNAL; -- failed ALTER TABLE hw_cstore_alter_t16 ALTER COLUMN a SET STORAGE EXTENDED; -- failed ALTER TABLE hw_cstore_alter_t16 ALTER COLUMN a SET STORAGE MAIN; -- failed -- 6.4.3 set with/without oids ALTER TABLE hw_cstore_alter_t16 SET WITH OIDS; -- failed ALTER TABLE hw_cstore_alter_t16 SET WITHOUT OIDS; -- failed -- 6.4.4 SET/RESET relation options -- 6.4.4.1 column table ALTER TABLE hw_cstore_alter_t16 SET (ORIENTATION = ROW); -- failed ALTER TABLE hw_cstore_alter_t16 RESET (ORIENTATION); -- failed ALTER TABLE hw_cstore_alter_t16 SET (internal_mask = 0); -- failed ALTER TABLE hw_cstore_alter_t16 RESET (internal_mask); -- failed ALTER TABLE hw_cstore_alter_t16 SET (FILLFACTOR = 70); -- failed ALTER TABLE hw_cstore_alter_t16 RESET (FILLFACTOR); -- failed ALTER TABLE hw_cstore_alter_t16 SET (autovacuum_enabled = true); -- ok ALTER TABLE hw_cstore_alter_t16 RESET (autovacuum_enabled); -- ok ALTER TABLE hw_cstore_alter_t16 SET (security_barrier); -- failed ALTER TABLE hw_cstore_alter_t16 RESET (security_barrier); -- failed \d+ hw_cstore_alter_t16 -- 6.4.4.1.2 psort table CREATE INDEX idx1_hw_cstore_alter_t16 ON hw_cstore_alter_t16(b) with (compression = 'low'); -- failed CREATE INDEX idx1_hw_cstore_alter_t16 ON hw_cstore_alter_t16(b) with (fillfactor = 100); -- failed CREATE INDEX idx1_hw_cstore_alter_t16 ON hw_cstore_alter_t16(b) with (autovacuum_enabled = true); -- failed CREATE INDEX idx1_hw_cstore_alter_t16 ON hw_cstore_alter_t16(b) with (security_barrier = on); -- failed CREATE INDEX idx1_hw_cstore_alter_t16 ON hw_cstore_alter_t16(b) with (internal_mask = 0); -- failed CREATE INDEX idx1_hw_cstore_alter_t16 ON hw_cstore_alter_t16(b) with (orientation = column); -- failed CREATE INDEX idx1_hw_cstore_alter_t16 ON hw_cstore_alter_t16(b) with (max_batchrow = 60000, deltarow_threshold = 9999, partial_cluster_rows = 600000); -- ok ALTER INDEX idx1_hw_cstore_alter_t16 SET (ORIENTATION = ROW); -- failed ALTER INDEX idx1_hw_cstore_alter_t16 RESET (ORIENTATION); -- failed ALTER INDEX idx1_hw_cstore_alter_t16 SET (compression = 'yes'); -- failed ALTER INDEX idx1_hw_cstore_alter_t16 RESET (compression); -- failed ALTER INDEX idx1_hw_cstore_alter_t16 SET (internal_mask = 0); -- failed ALTER INDEX idx1_hw_cstore_alter_t16 RESET (internal_mask); -- failed ALTER INDEX idx1_hw_cstore_alter_t16 SET (max_batchrow = 60000); -- ok ALTER INDEX idx1_hw_cstore_alter_t16 RESET (max_batchrow); -- ok ALTER INDEX idx1_hw_cstore_alter_t16 SET (deltarow_threshold = 5000); -- ok ALTER INDEX idx1_hw_cstore_alter_t16 RESET (deltarow_threshold); -- ok ALTER INDEX idx1_hw_cstore_alter_t16 SET (partial_cluster_rows = 700000); -- ok ALTER INDEX idx1_hw_cstore_alter_t16 RESET (partial_cluster_rows); -- ok ALTER INDEX idx1_hw_cstore_alter_t16 SET (security_barrier = false); -- failed ALTER INDEX idx1_hw_cstore_alter_t16 RESET (security_barrier); -- failed ALTER INDEX idx1_hw_cstore_alter_t16 SET (FILLFACTOR = 70); -- failed ALTER INDEX idx1_hw_cstore_alter_t16 RESET (FILLFACTOR); -- failed ALTER TABLE idx1_hw_cstore_alter_t16 SET (autovacuum_enabled = true); -- failed ALTER INDEX idx1_hw_cstore_alter_t16 RESET (autovacuum_enabled); -- failed DROP INDEX idx1_hw_cstore_alter_t16; DROP TABLE hw_cstore_alter_t16; -- 6.5 alter cstore partition table owner CREATE USER hw_user_u1 password 'GAUSS@123'; CREATE TABLE hw_cstore_alter_t17 (a int, b int, c int) with (orientation = column) distribute by hash(a) partition by range (a) ( partition p1 values less than (1000), partition p2 values less than (2000), partition p3 values less than (maxvalue) ); CREATE INDEX idx1_hw_cstore_alter_t17 on hw_cstore_alter_t17 using PSORT (a) local; ALTER TABLE hw_cstore_alter_t17 owner to hw_user_u1; DROP TABLE hw_cstore_alter_t17; DROP USER hw_user_u1; CREATE USER hw_user_u2 password 'GAUSS@123'; CREATE TABLE hw_cstore_alter_t18 (a int, b int, c int) with (orientation = column) distribute by hash(a) partition by range (a) ( partition p1 values less than (1000), partition p2 values less than (2000), partition p3 values less than (maxvalue) ); CREATE INDEX idx1_hw_cstore_alter_t18 on hw_cstore_alter_t18 using PSORT (a) local; ALTER TABLE hw_cstore_alter_t18 owner to hw_user_u2; DROP USER hw_user_u2 cascade;
the_stack
\set ECHO none -- disable the notices for the create script (shell types etc.) SET client_min_messages = 'WARNING'; \i tdigest--1.0.0.sql \i tdigest--1.0.0--1.0.1.sql \i tdigest--1.0.1--1.2.0.sql \i tdigest--1.2.0--1.3.0.sql \i tdigest--1.3.0--1.4.0-dev.sql SET client_min_messages = 'NOTICE'; SET extra_float_digits = 0; \set ECHO all -- SRF function implementing a simple deterministict PRNG CREATE OR REPLACE FUNCTION prng(nrows int, seed int = 23982, p1 bigint = 16807, p2 bigint = 0, n bigint = 2147483647) RETURNS SETOF double precision AS $$ DECLARE val INT := seed; BEGIN FOR i IN 1..nrows LOOP val := (val * p1 + p2) % n; RETURN NEXT (val::double precision / n); END LOOP; RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION random_normal(nrows int, mean double precision = 0.5, stddev double precision = 0.1, minval double precision = 0.0, maxval double precision = 1.0, seed int = 23982, p1 bigint = 16807, p2 bigint = 0, n bigint = 2147483647) RETURNS SETOF double precision AS $$ DECLARE v BIGINT := seed; x DOUBLE PRECISION; y DOUBLE PRECISION; s DOUBLE PRECISION; r INT := nrows; BEGIN WHILE true LOOP -- random x v := (v * p1 + p2) % n; x := 2 * v / n::double precision - 1.0; -- random y v := (v * p1 + p2) % n; y := 2 * v / n::double precision - 1.0; s := x^2 + y^2; IF s != 0.0 AND s < 1.0 THEN s = sqrt(-2 * ln(s) / s); x := mean + stddev * s * x; IF x >= minval AND x <= maxval THEN RETURN NEXT x; r := r - 1; END IF; EXIT WHEN r = 0; y := mean + stddev * s * y; IF y >= minval AND y <= maxval THEN RETURN NEXT y; r := r - 1; END IF; EXIT WHEN r = 0; END IF; END LOOP; END; $$ LANGUAGE plpgsql; ----------------------------------------------------------- -- nice data set with ordered (asc) / evenly-spaced data -- ----------------------------------------------------------- -- 10 centroids (tiny) WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(1,100000) s(i)) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 10, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(1,100000) s(i)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 10, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 100 centroids (okay-ish) WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(1,100000) s(i)) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 100, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(1,100000) s(i)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 100, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 1000 centroids (very accurate) WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(1,100000) s(i)) SELECT p, abs(a - b) < 0.001, -- arbitrary threshold of 0.1% (CASE WHEN abs(a - b) < 0.001 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 1000, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(1,100000) s(i)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 1000, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; ------------------------------------------------------------ -- nice data set with ordered (desc) / evenly-spaced data -- ------------------------------------------------------------ -- 10 centroids (tiny) WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(100000,1,-1) s(i)) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 10, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(100000,1,-1) s(i)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 10, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 100 centroids (okay-ish) WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(100000,1,-1) s(i)) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 100, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(100000,1,-1) s(i)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 100, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 1000 centroids (very accurate) WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(100000,1,-1) s(i)) SELECT p, abs(a - b) < 0.001, -- arbitrary threshold of 0.1% (CASE WHEN abs(a - b) < 0.001 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 1000, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(100000,1,-1) s(i)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 1000, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; ---------------------------------------------------- -- nice data set with random / evenly-spaced data -- ---------------------------------------------------- -- 10 centroids (tiny) WITH data AS (SELECT i / 100000.0 AS x FROM (SELECT generate_series(1,100000) AS i, prng(100000, 49979693) AS x ORDER BY x) foo) SELECT p, abs(a - b) < 0.1, -- arbitrary threshold of 10% (CASE WHEN abs(a - b) < 0.1 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 10, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT i / 100000.0 AS x FROM (SELECT generate_series(1,100000) AS i, prng(100000, 49979693) AS x ORDER BY x) foo), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 10, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 100 centroids (okay-ish) WITH data AS (SELECT i / 100000.0 AS x FROM (SELECT generate_series(1,100000) AS i, prng(100000, 49979693) AS x ORDER BY x) foo) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 100, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT i / 100000.0 AS x FROM (SELECT generate_series(1,100000) AS i, prng(100000, 49979693) AS x ORDER BY x) foo), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 100, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 1000 centroids (very accurate) WITH data AS (SELECT i / 100000.0 AS x FROM (SELECT generate_series(1,100000) AS i, prng(100000, 49979693) AS x ORDER BY x) foo) SELECT p, abs(a - b) < 0.001, -- arbitrary threshold of 0.1% (CASE WHEN abs(a - b) < 0.001 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 1000, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT i / 100000.0 AS x FROM (SELECT generate_series(1,100000) AS i, prng(100000, 49979693) AS x ORDER BY x) foo), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 1000, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; ---------------------------------------------- -- nice data set with random data (uniform) -- ---------------------------------------------- -- 10 centroids (tiny) WITH data AS (SELECT x FROM prng(100000) s(x)) SELECT p, abs(a - b) < 0.1, -- arbitrary threshold of 10% (CASE WHEN abs(a - b) < 0.1 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 10, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT x FROM prng(100000) s(x)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 10, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 100 centroids (okay-ish) WITH data AS (SELECT x FROM prng(100000) s(x)) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 100, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT x FROM prng(100000) s(x)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 100, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 1000 centroids (very accurate) WITH data AS (SELECT x FROM prng(100000) s(x)) SELECT p, abs(a - b) < 0.001, -- arbitrary threshold of 0.1% (CASE WHEN abs(a - b) < 0.001 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 1000, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT x FROM prng(100000) s(x)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 1000, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -------------------------------------------------- -- nice data set with random data (skewed sqrt) -- -------------------------------------------------- -- 10 centroids (tiny) WITH data AS (SELECT sqrt(z) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.1, -- arbitrary threshold of 10% (CASE WHEN abs(a - b) < 0.1 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 10, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT sqrt(z) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 10, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 100 centroids (okay-ish) WITH data AS (SELECT sqrt(z) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 100, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT sqrt(z) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 100, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 1000 centroids (very accurate) WITH data AS (SELECT sqrt(z) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.001, -- arbitrary threshold of 0.1% (CASE WHEN abs(a - b) < 0.001 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 1000, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT sqrt(z) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 1000, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; ------------------------------------------------------- -- nice data set with random data (skewed sqrt+sqrt) -- ------------------------------------------------------- -- 10 centroids (tiny) WITH data AS (SELECT sqrt(sqrt(z)) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.1, -- arbitrary threshold of 10% (CASE WHEN abs(a - b) < 0.1 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 10, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT sqrt(sqrt(z)) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 10, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 100 centroids (okay-ish) WITH data AS (SELECT sqrt(sqrt(z)) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 100, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT sqrt(sqrt(z)) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 100, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 1000 centroids (very accurate) WITH data AS (SELECT sqrt(sqrt(z)) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.001, -- arbitrary threshold of 0.1% (CASE WHEN abs(a - b) < 0.001 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 1000, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT sqrt(sqrt(z)) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 1000, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; ------------------------------------------------- -- nice data set with random data (skewed pow) -- ------------------------------------------------- -- 10 centroids (tiny) WITH data AS (SELECT pow(z, 2) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.1, -- arbitrary threshold of 10% (CASE WHEN abs(a - b) < 0.1 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 10, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT pow(z, 2) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 10, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 100 centroids (okay-ish) WITH data AS (SELECT pow(z, 2) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.005, -- arbitrary threshold of 0.5% (CASE WHEN abs(a - b) < 0.005 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 100, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT pow(z, 2) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 100, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 1000 centroids (very accurate) WITH data AS (SELECT pow(z, 2) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.001, -- arbitrary threshold of 0.1% (CASE WHEN abs(a - b) < 0.001 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 1000, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT pow(z, 2) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 1000, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; ----------------------------------------------------- -- nice data set with random data (skewed pow+pow) -- ----------------------------------------------------- -- 10 centroids (tiny) WITH data AS (SELECT pow(z, 4) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.1, -- arbitrary threshold of 10% (CASE WHEN abs(a - b) < 0.1 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 10, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT pow(z, 4) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 10, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 100 centroids (okay-ish) WITH data AS (SELECT pow(z, 4) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 100, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT pow(z, 4) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 100, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 1000 centroids (very accurate) WITH data AS (SELECT pow(z, 4) AS x FROM prng(100000) s(z)) SELECT p, abs(a - b) < 0.001, -- arbitrary threshold of 0.1% (CASE WHEN abs(a - b) < 0.001 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 1000, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT pow(z, 4) AS x FROM prng(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 1000, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; ---------------------------------------------------------- -- nice data set with random data (normal distribution) -- ---------------------------------------------------------- -- 10 centroids (tiny) WITH data AS (SELECT pow(z, 4) AS x FROM random_normal(100000) s(z)) SELECT p, abs(a - b) < 0.025, -- arbitrary threshold of 2.5% (CASE WHEN abs(a - b) < 0.025 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 10, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT pow(z, 4) AS x FROM random_normal(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 10, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 100 centroids (okay-ish) WITH data AS (SELECT pow(z, 4) AS x FROM random_normal(100000) s(z)) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 100, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT pow(z, 4) AS x FROM random_normal(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 100, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- 1000 centroids (very accurate) WITH data AS (SELECT pow(z, 4) AS x FROM random_normal(100000) s(z)) SELECT p, abs(a - b) < 0.001, -- arbitrary threshold of 0.1% (CASE WHEN abs(a - b) < 0.001 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(tdigest_percentile(x, 1000, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- make sure the resulting percentiles are in the right order WITH data AS (SELECT pow(z, 4) AS x FROM random_normal(100000) s(z)), perc AS (SELECT array_agg((i/100.0)::double precision) AS p FROM generate_series(1,99) s(i)) SELECT * FROM ( SELECT p, a, LAG(a) OVER (ORDER BY p) AS b FROM ( SELECT unnest((SELECT p FROM perc)) AS p, unnest(tdigest_percentile(x, 1000, (SELECT p FROM perc))) AS a FROM data ) foo ) bar WHERE a <= b; -- some basic tests to verify transforming from and to text work -- 10 centroids (tiny) WITH data AS (SELECT i / 100000.0 AS x FROM generate_series(1,100000) s(i)), intermediate AS (SELECT tdigest(x, 10)::text AS intermediate_x FROM data), tdigest_parsed AS (SELECT tdigest_percentile(intermediate_x::tdigest, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS a FROM intermediate), pg_percentile AS (SELECT percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x) AS b FROM data) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(a) AS a, unnest(b) AS b FROM tdigest_parsed, pg_percentile ) foo; -- verify we can store tdigest in a summary table CREATE TABLE intermediate_tdigest (grouping int, summary tdigest); WITH data AS (SELECT row_number() OVER () AS i, pow(z, 4) AS x FROM random_normal(100000) s(z)) INSERT INTO intermediate_tdigest SELECT i % 10 AS grouping, tdigest(x, 100) AS summary FROM data GROUP BY i % 10; WITH data AS (SELECT pow(z, 4) AS x FROM random_normal(100000) s(z)), intermediate AS (SELECT tdigest_percentile(summary, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS a FROM intermediate_tdigest), pg_percentile AS (SELECT percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x) AS b FROM data) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.01 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(a) AS a, unnest(b) AS b FROM intermediate, pg_percentile ) foo; -- verify 'extreme' percentiles for the dataset would not read out of bounds on the centroids WITH data AS (SELECT x FROM generate_series(1,10) AS x) SELECT p, abs(a - b) < 0.1, -- arbitrary threshold of 10% given the small dataset and extreme percentiles it is not very accurate (CASE WHEN abs(a - b) < 0.1 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.99]) AS p, unnest(tdigest_percentile(x, 10, ARRAY[0.01, 0.99])) AS a, unnest(percentile_cont(ARRAY[0.01, 0.99]) WITHIN GROUP (ORDER BY x)) AS b FROM data ) foo; -- check that the computed percentiles are perfectly correlated (don't decrease for higher p values) -- first test on a tiny t-digest with all centroids having count = 1 WITH -- percentiles to compute perc AS (SELECT array_agg((i / 100.0)::double precision) AS percentiles FROM generate_series(1,99) s(i)), -- input data (just 15 points) input_data AS (select i::double precision AS val FROM generate_series(1,15) s(i)) SELECT * FROM ( SELECT p, v AS v1, lag(v, 1) OVER (ORDER BY p) v2 FROM ( SELECT unnest(perc.percentiles) p, unnest(tdigest_percentile(input_data.val, 100, perc.percentiles)) v FROM perc, input_data GROUP BY perc.percentiles ) foo ) bar where v2 > v1; -- test casting to json SELECT cast(tdigest(i / 1000.0, 10) as json) from generate_series(1,1000) s(i); SELECT cast(tdigest(i / 1000.0, 25) as json) from generate_series(1,1000) s(i); SELECT cast(tdigest(i / 1000.0, 100) as json) from generate_series(1,1000) s(i); -- test casting to double precision array SELECT array_agg(round(v::numeric,3)) FROM ( SELECT unnest(cast(tdigest(i / 1000.0, 10) as double precision[])) AS v from generate_series(1,1000) s(i) ) foo; SELECT array_agg(round(v::numeric,3)) FROM ( SELECT unnest(cast(tdigest(i / 1000.0, 25) as double precision[])) AS v from generate_series(1,1000) s(i) ) foo; SELECT array_agg(round(v::numeric,3)) FROM ( SELECT unnest(cast(tdigest(i / 1000.0, 100) as double precision[])) AS v from generate_series(1,1000) s(i) ) foo; -- <value,count> API select tdigest_percentile(value, count, 100, 0.95) from (values (47325940488,1), (15457695432,2), (6889790700,3), (4188763788,4), (2882932224,5), (2114815860,6), (1615194324,7), (2342114568,9), (1626471924,11), (1660755408,14), (1143728292,17), (1082582424,21), (911488284,26), (728863908,32), (654898692,40), (530198076,50), (417883440,62), (341452344,77), (274579584,95), (231921120,118), (184091820,146), (152469828,181), (125634972,224), (107059704,278), (88746120,345), (73135668,428), (61035756,531), (50683320,658), (42331824,816), (35234400,1012), (29341356,1255), (24290928,1556), (20284668,1929), (17215908,2391), (14737488,2964), (12692772,3674), (11220732,4555), (9787584,5647), (8148420,7000), (6918612,8678), (6015000,10758), (5480316,13336), (5443356,16532), (4535616,20494), (3962316,25406), (3914484,31495), (3828108,39043), (3583536,48400), (4104120,60000), (166024740,2147483647)) foo (count, value); ---------------------------------------------- -- nice data set with random data (uniform) -- ---------------------------------------------- -- 10 centroids (tiny) WITH data AS (SELECT prng(1000) x, prng(1000, 29823218) cnt), data_expanded AS (SELECT x FROM (SELECT x, generate_series(1, (10 + 100 * cnt)::int) FROM data) foo ORDER BY random()) SELECT p, abs(a - b) < 0.1, -- arbitrary threshold of 10% (CASE WHEN abs(a - b) < 0.1 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(a) AS a, unnest(b) AS b FROM (SELECT percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x) a FROM data_expanded) foo, (SELECT tdigest_percentile(x, (10 + 100 * cnt)::int, 10, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) b FROM data) bar ) baz; -- 100 centroids (okay-ish) WITH data AS (SELECT prng(1000) x, prng(1000, 29823218) cnt), data_expanded AS (SELECT x FROM (SELECT x, generate_series(1, (10 + 100 * cnt)::int) FROM data) foo ORDER BY random()) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.1 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(a) AS a, unnest(b) AS b FROM (SELECT percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x) a FROM data_expanded) foo, (SELECT tdigest_percentile(x, (10 + 100 * cnt)::int, 100, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) b FROM data) bar ) baz; -- 1000 centroids (very accurate) WITH data AS (SELECT prng(1000) x, prng(1000, 29823218) cnt), data_expanded AS (SELECT x FROM (SELECT x, generate_series(1, (10 + 100 * cnt)::int) FROM data) foo ORDER BY random()) SELECT p, abs(a - b) < 0.01, -- arbitrary threshold of 1% (CASE WHEN abs(a - b) < 0.1 THEN NULL ELSE (a - b) END) AS err FROM ( SELECT unnest(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) AS p, unnest(a) AS a, unnest(b) AS b FROM (SELECT percentile_cont(ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) WITHIN GROUP (ORDER BY x) a FROM data_expanded) foo, (SELECT tdigest_percentile(x, (10 + 100 * cnt)::int, 1000, ARRAY[0.01, 0.05, 0.1, 0.9, 0.95, 0.99]) b FROM data) bar ) baz; -- test incremental API (adding values one by one) CREATE TABLE t (d tdigest); INSERT INTO t VALUES (NULL); -- check this produces the same result building the tdigest at once, but we -- need to be careful about feeding the data in the same order, and we must -- not compactify the t-digest after each increment DO LANGUAGE plpgsql $$ DECLARE r RECORD; BEGIN FOR r IN (SELECT i FROM generate_series(1,1000) s(i) ORDER BY md5(i::text)) LOOP UPDATE t SET d = tdigest_add(d, r.i, 100, false); END LOOP; END$$; -- compare the results, but do force a compaction of the incremental result WITH x AS (SELECT i FROM generate_series(1,1000) s(i) ORDER BY md5(i::text)) SELECT (SELECT tdigest(d)::text FROM t) = (SELECT tdigest(x.i, 100)::text FROM x) AS match; -- now try the same thing with bulk incremental update (using arrays) TRUNCATE t; INSERT INTO t VALUES (NULL); DO LANGUAGE plpgsql $$ DECLARE r RECORD; BEGIN FOR r IN (SELECT a, array_agg(i::double precision) AS v FROM (SELECT mod(i,5) AS a, i FROM generate_series(1,1000) s(i) ORDER BY mod(i,5), md5(i::text)) foo GROUP BY a ORDER BY a) LOOP UPDATE t SET d = tdigest_add(d, r.v, 100, false); END LOOP; END$$; -- compare the results, but do force a compaction of the incremental result WITH x AS (SELECT mod(i,5) AS a, i::double precision AS d FROM generate_series(1,1000) s(i) ORDER BY mod(i,5), i) SELECT (SELECT tdigest(d)::text FROM t) = (SELECT tdigest(x.d, 100)::text FROM x); -- now try the same thing with bulk incremental update (using t-digests) TRUNCATE t; INSERT INTO t VALUES (NULL); DO LANGUAGE plpgsql $$ DECLARE r RECORD; BEGIN FOR r IN (SELECT a, tdigest(i,100) AS d FROM (SELECT mod(i,5) AS a, i FROM generate_series(1,1000) s(i) ORDER BY mod(i,5), md5(i::text)) foo GROUP BY a ORDER BY a) LOOP UPDATE t SET d = tdigest_union(d, r.d, false); END LOOP; END$$; -- compare the results, but do force a compaction of the incremental result WITH x AS (SELECT a, tdigest(i,100) AS d FROM (SELECT mod(i,5) AS a, i FROM generate_series(1,1000) s(i) ORDER BY mod(i,5), md5(i::text)) foo GROUP BY a ORDER BY a) SELECT (SELECT tdigest(d)::text FROM t) = (SELECT tdigest(x.d)::text FROM x); -- test parallel query DROP TABLE t; CREATE TABLE t (v double precision, c int, d int); INSERT INTO t SELECT 1000 * random(), 1 + mod(i,7), mod(i,113) FROM generate_series(1,100000) s(i); ANALYZE t; CREATE TABLE t2 (d tdigest); INSERT INTO t2 SELECT tdigest(v, 100) FROM t GROUP BY d; ANALYZE t2; SET parallel_setup_cost = 0; SET parallel_tuple_cost = 0; SET min_parallel_table_scan_size = '1kB'; -- individual values EXPLAIN (COSTS OFF) WITH x AS (SELECT percentile_disc(0.95) WITHIN GROUP (ORDER BY v) AS p FROM t) SELECT 0.95, abs(a - b) / 1000 < 0.01 FROM ( SELECT (SELECT p FROM x) AS a, tdigest_percentile(v, 100, 0.95) AS b FROM t) foo; WITH x AS (SELECT percentile_disc(0.95) WITHIN GROUP (ORDER BY v) AS p FROM t) SELECT 0.95, abs(a - b) / 1000 < 0.01 FROM ( SELECT (SELECT p FROM x) AS a, tdigest_percentile(v, 100, 0.95) AS b FROM t) foo; EXPLAIN (COSTS OFF) SELECT 950, abs(a - b) < 0.01 FROM ( SELECT 0.95 AS a, tdigest_percentile_of(v, 100, 950) AS b FROM t) foo; SELECT 950, abs(a - b) < 0.01 FROM ( SELECT 0.95 AS a, tdigest_percentile_of(v, 100, 950) AS b FROM t) foo; EXPLAIN (COSTS OFF) WITH x AS (SELECT percentile_disc(0.95) WITHIN GROUP (ORDER BY v) AS p FROM t) SELECT 0.95, abs(a - b) / 1000 < 0.01 FROM ( SELECT (SELECT p FROM x) AS a, tdigest_percentile(d, 0.95) AS b FROM t2) foo; WITH x AS (SELECT percentile_disc(0.95) WITHIN GROUP (ORDER BY v) AS p FROM t) SELECT 0.95, abs(a - b) / 1000 < 0.01 FROM ( SELECT (SELECT p FROM x) AS a, tdigest_percentile(d, 0.95) AS b FROM t2) foo; EXPLAIN (COSTS OFF) SELECT 950, abs(a - b) < 0.01 FROM ( SELECT 0.95 AS a, tdigest_percentile_of(d, 950) AS b FROM t2) foo; SELECT 950, abs(a - b) < 0.01 FROM ( SELECT 0.95 AS a, tdigest_percentile_of(d, 950) AS b FROM t2) foo; -- array of percentiles / values EXPLAIN (COSTS OFF) WITH x AS (SELECT percentile_disc(ARRAY[0.0, 0.95, 0.99, 1.0]) WITHIN GROUP (ORDER BY v) AS p FROM t) SELECT p, abs(a - b) / 1000 < 0.01 FROM ( SELECT unnest(ARRAY[0.0, 0.95, 0.99, 1.0]) p, unnest((SELECT p FROM x)) AS a, unnest(tdigest_percentile(v, 100, ARRAY[0.0, 0.95, 0.99, 1.0])) AS b FROM t) foo; WITH x AS (SELECT percentile_disc(ARRAY[0.0, 0.95, 0.99, 1.0]) WITHIN GROUP (ORDER BY v) AS p FROM t) SELECT p, abs(a - b) / 1000 < 0.01 FROM ( SELECT unnest(ARRAY[0.0, 0.95, 0.99, 1.0]) p, unnest((SELECT p FROM x)) AS a, unnest(tdigest_percentile(v, 100, ARRAY[0.0, 0.95, 0.99, 1.0])) AS b FROM t) foo; EXPLAIN (COSTS OFF) WITH x AS (SELECT array_agg((SELECT percent_rank(f) WITHIN GROUP (ORDER BY v) FROM t)) AS p FROM unnest(ARRAY[950, 990]) f) SELECT p, abs(a - b) < 0.01 FROM ( SELECT unnest(ARRAY[950, 990]) AS p, unnest((SELECT p FROM x)) AS a, unnest(tdigest_percentile_of(v, 100, ARRAY[950, 990])) AS b FROM t) foo; WITH x AS (SELECT array_agg((SELECT percent_rank(f) WITHIN GROUP (ORDER BY v) FROM t)) AS p FROM unnest(ARRAY[950, 990]) f) SELECT p, abs(a - b) < 0.01 FROM ( SELECT unnest(ARRAY[950, 990]) AS p, unnest((SELECT p FROM x)) AS a, unnest(tdigest_percentile_of(v, 100, ARRAY[950, 990])) AS b FROM t) foo; EXPLAIN (COSTS OFF) WITH x AS (SELECT percentile_disc(ARRAY[0.0, 0.95, 0.99, 1.0]) WITHIN GROUP (ORDER BY v) AS p FROM t) SELECT p, abs(a - b) / 1000 < 0.01 FROM ( SELECT unnest(ARRAY[0.0, 0.95, 0.99, 1.0]) p, unnest((SELECT p FROM x)) AS a, unnest(tdigest_percentile(d, ARRAY[0.0, 0.95, 0.99, 1.0])) AS b FROM t2) foo; WITH x AS (SELECT percentile_disc(ARRAY[0.0, 0.95, 0.99, 1.0]) WITHIN GROUP (ORDER BY v) AS p FROM t) SELECT p, abs(a - b) / 1000 < 0.01 FROM ( SELECT unnest(ARRAY[0.0, 0.95, 0.99, 1.0]) p, unnest((SELECT p FROM x)) AS a, unnest(tdigest_percentile(d, ARRAY[0.0, 0.95, 0.99, 1.0])) AS b FROM t2) foo; EXPLAIN (COSTS OFF) WITH x AS (SELECT array_agg((SELECT percent_rank(f) WITHIN GROUP (ORDER BY v) FROM t)) AS p FROM unnest(ARRAY[950, 990]) f) SELECT p, abs(a - b) < 0.01 FROM ( SELECT unnest(ARRAY[950, 990]) AS p, unnest((SELECT p FROM x)) AS a, unnest(tdigest_percentile_of(d, ARRAY[950, 990])) AS b FROM t2) foo; WITH x AS (SELECT array_agg((SELECT percent_rank(f) WITHIN GROUP (ORDER BY v) FROM t)) AS p FROM unnest(ARRAY[950, 990]) f) SELECT p, abs(a - b) < 0.01 FROM ( SELECT unnest(ARRAY[950, 990]) AS p, unnest((SELECT p FROM x)) AS a, unnest(tdigest_percentile_of(d, ARRAY[950, 990])) AS b FROM t2) foo; -- <value,count> API EXPLAIN (COSTS OFF) WITH d AS (SELECT t.* FROM t, LATERAL generate_series(1,t.c)), x AS (SELECT percentile_disc(0.95) WITHIN GROUP (ORDER BY v) AS p FROM d) SELECT 0.95, abs(a - b) / 1000 < 0.01 FROM ( SELECT (SELECT p FROM x) AS a, tdigest_percentile(v, c, 100, 0.95) AS b FROM t) foo; WITH d AS (SELECT t.* FROM t, LATERAL generate_series(1,t.c)), x AS (SELECT percentile_disc(0.95) WITHIN GROUP (ORDER BY v) AS p FROM d) SELECT 0.95, abs(a - b) / 1000 < 0.01 FROM ( SELECT (SELECT p FROM x) AS a, tdigest_percentile(v, c, 100, 0.95) AS b FROM t) foo; EXPLAIN (COSTS OFF) WITH d AS (SELECT t.* FROM t, LATERAL generate_series(1,t.c)), x AS (SELECT percent_rank(950) WITHIN GROUP (ORDER BY v) AS p FROM d) SELECT 950, abs(a - b) < 0.01 FROM ( SELECT (SELECT p FROM x) AS a, tdigest_percentile_of(v, c, 100, 950) AS b FROM t) foo; WITH d AS (SELECT t.* FROM t, LATERAL generate_series(1,t.c)), x AS (SELECT percent_rank(950) WITHIN GROUP (ORDER BY v) AS p FROM d) SELECT 950, abs(a - b) < 0.01 FROM ( SELECT (SELECT p FROM x) AS a, tdigest_percentile_of(v, c, 100, 950) AS b FROM t) foo; -- array of percentiles / values EXPLAIN (COSTS OFF) WITH d AS (SELECT t.* FROM t, LATERAL generate_series(1,t.c)), x AS (SELECT percentile_disc(ARRAY[0.0, 0.95, 0.99, 1.0]) WITHIN GROUP (ORDER BY v) AS p FROM d) SELECT p, abs(a - b) / 1000 < 0.01 FROM ( SELECT unnest(ARRAY[0.0, 0.95, 0.99, 1.0]) p, unnest((SELECT p FROM x)) AS a, unnest(tdigest_percentile(v, c, 100, ARRAY[0.0, 0.95, 0.99, 1.0])) AS b FROM t) foo; WITH d AS (SELECT t.* FROM t, LATERAL generate_series(1,t.c)), x AS (SELECT percentile_disc(ARRAY[0.0, 0.95, 0.99, 1.0]) WITHIN GROUP (ORDER BY v) AS p FROM d) SELECT p, abs(a - b) / 1000 < 0.01 FROM ( SELECT unnest(ARRAY[0.0, 0.95, 0.99, 1.0]) p, unnest((SELECT p FROM x)) AS a, unnest(tdigest_percentile(v, c, 100, ARRAY[0.0, 0.95, 0.99, 1.0])) AS b FROM t) foo; EXPLAIN (COSTS OFF) WITH d AS (SELECT t.* FROM t, LATERAL generate_series(1,t.c)), x AS (SELECT array_agg((SELECT percent_rank(f) WITHIN GROUP (ORDER BY v) AS p FROM d)) p FROM unnest(ARRAY[950, 990]) f) SELECT p, abs(a - b) < 0.01 FROM ( SELECT unnest(ARRAY[950, 990]) AS p, unnest((select x.p from x)) AS a, unnest(tdigest_percentile_of(v, c, 100, ARRAY[950, 990])) AS b FROM t) foo; WITH d AS (SELECT t.* FROM t, LATERAL generate_series(1,t.c)), x AS (SELECT array_agg((SELECT percent_rank(f) WITHIN GROUP (ORDER BY v) AS p FROM d)) p FROM unnest(ARRAY[950, 990]) f) SELECT p, abs(a - b) < 0.01 FROM ( SELECT unnest(ARRAY[950, 990]) AS p, unnest((select x.p from x)) AS a, unnest(tdigest_percentile_of(v, c, 100, ARRAY[950, 990])) AS b FROM t) foo; -- test input function, and conversion from old to new format SELECT 'flags 0 count 20 compression 10 centroids 8 (1000.000000, 1) (2000.000000, 1) (7000.000000, 2) (26000.000000, 4) (84000.000000, 7) (51000.000000, 3) (19000.000000, 1) (20000.000000, 1)'::tdigest; -- test input of invalid data -- negative count SELECT 'flags 0 count -20 compression 10 centroids 8 (1000.000000, 1) (2000.000000, 1) (7000.000000, 2) (26000.000000, 4) (84000.000000, 7) (51000.000000, 3) (19000.000000, 1) (20000.000000, 1)'::tdigest; -- mismatching count SELECT 'flags 0 count 21 compression 10 centroids 8 (1000.000000, 1) (2000.000000, 1) (7000.000000, 2) (26000.000000, 4) (84000.000000, 7) (51000.000000, 3) (19000.000000, 1) (20000.000000, 1)'::tdigest; -- incorrectly sorted centroids SELECT 'flags 0 count 20 compression 10 centroids 8 (1000.000000, 1) (2000.000000, 1) (1000.000000, 2) (26000.000000, 4) (84000.000000, 7) (51000.000000, 3) (19000.000000, 1) (20000.000000, 1)'::tdigest; -- check trimmed mean (from raw data) -- we compare the result to a range, to deal with the randomness WITH data AS (SELECT random() AS r FROM generate_series(1,10000) AS x) SELECT tdigest_avg(data.r, 50, 0.1, 0.9) between 0.45 and 0.55 AS mean_10_90, tdigest_avg(data.r, 50, 0.25, 0.75) between 0.45 and 0.55 AS mean_25_75, tdigest_avg(data.r, 50, 0.0, 0.5) between 0.2 and 0.3 AS mean_0_50, tdigest_avg(data.r, 50, 0.5, 1.0) between 0.7 and 0.8 AS mean_50_100 FROM data; WITH data AS (SELECT random() AS r, (1 + (3 * random())::int) AS c FROM generate_series(1,10000) AS x) SELECT tdigest_avg(data.r, data.c, 100, 0.1, 0.9) between 0.45 and 0.55 AS mean_10_90, tdigest_avg(data.r, data.c, 100, 0.25, 0.75) between 0.45 and 0.55 AS mean_25_75, tdigest_avg(data.r, data.c, 100, 0.0, 0.5) between 0.2 and 0.3 AS mean_0_50, tdigest_avg(data.r, data.c, 100, 0.5, 1.0) between 0.7 and 0.8 AS mean_50_100 FROM data; -- check trimmed mean (from pracalculated tdigest) -- we compare the result to a range, to deal with the randomness WITH data AS (SELECT tdigest(random(), 50) AS d FROM generate_series(1,10000) AS x) SELECT tdigest_avg(data.d, 0.1, 0.9) between 0.45 and 0.55 AS mean_10_90, tdigest_avg(data.d, 0.25, 0.75) between 0.45 and 0.55 AS mean_25_75, tdigest_avg(data.d, 0.0, 0.5) between 0.2 and 0.3 AS mean_0_50, tdigest_avg(data.d, 0.5, 1.0) between 0.7 and 0.8 AS mean_50_100 FROM data; -- check trimmed sum (from raw data) -- we compare the result to a range, to deal with the randomness WITH data AS (SELECT random() AS r FROM generate_series(1,10000) AS x) SELECT tdigest_sum(data.r, 50, 0.1, 0.9) between 8000 * 0.45 and 8000 * 0.55 AS sum_10_90, tdigest_sum(data.r, 50, 0.25, 0.75) between 5000 * 0.45 and 5000 * 0.55 AS sum_25_75, tdigest_sum(data.r, 50, 0.0, 0.5) between 5000 * 0.2 and 5000 * 0.3 AS sum_0_50, tdigest_sum(data.r, 50, 0.5, 1.0) between 5000 * 0.7 and 5000 * 0.8 AS sum_50_100 FROM data; WITH data AS (SELECT random() AS r, (1 + (3 * random())::int) AS c FROM generate_series(1,10000) AS x) SELECT tdigest_sum(data.r, data.c, 100, 0.1, 0.9) between 20000 * 0.45 and 20000 * 0.55 AS sum_10_90, tdigest_sum(data.r, data.c, 100, 0.25, 0.75) between 12500 * 0.45 and 12500 * 0.55 AS sum_25_75, tdigest_sum(data.r, data.c, 100, 0.0, 0.5) between 12500 * 0.2 and 12500 * 0.3 AS sum_0_50, tdigest_sum(data.r, data.c, 100, 0.5, 1.0) between 12500 * 0.7 and 12500 * 0.8 AS sum_50_100 FROM data; -- check trimmed sum (from pracalculated tdigest) -- we compare the result to a range, to deal with the randomness WITH data AS (SELECT tdigest(random(), 50) AS d FROM generate_series(1,10000) AS x) SELECT tdigest_sum(data.d, 0.1, 0.9) between 8000 * 0.45 and 8000 * 0.55 AS sum_10_90, tdigest_sum(data.d, 0.25, 0.75) between 5000 * 0.45 and 5000 * 0.55 AS sum_25_75, tdigest_sum(data.d, 0.0, 0.5) between 5000 * 0.2 and 5000 * 0.3 AS sum_0_50, tdigest_sum(data.d, 0.5, 1.0) between 5000 * 0.7 and 5000 * 0.8 AS sum_50_100 FROM data; WITH data AS (SELECT tdigest(random(), 50) AS d FROM generate_series(1,10000) AS x) SELECT tdigest_digest_sum(data.d, 0.05, 0.95) between 9000 * 0.45 and 9000 * 0.55 AS sum_05_95, tdigest_digest_avg(data.d, 0.05, 0.95) between 0.45 and 0.55 AS mean_05_95 FROM data; RESET extra_float_digits;
the_stack
CREATE SCHEMA IF NOT EXISTS Grocery; USE Grocery; -- phpMyAdmin SQL Dump -- version 4.7.7 -- https://www.phpmyadmin.net/ -- -- Host: localhost:8889 -- Generation Time: Mar 17, 2019 at 09:48 AM -- Server version: 5.6.38 -- PHP Version: 7.2.1 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; -- -- Database: `grocery` -- -- -------------------------------------------------------- -- -- Table structure for table `Expenses` -- DROP TABLE IF EXISTS `Expenses`; CREATE TABLE `Expenses` ( `category` varchar(14) CHARACTER SET utf8 NOT NULL DEFAULT '', `cost` decimal(12,2) DEFAULT NULL, `time` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `Expenses` -- INSERT INTO `Expenses` (`category`, `cost`, `time`) VALUES ('Social', '19.84', '2018-01-02 13:30:27'), ('Book', '83.97', '2018-01-03 13:30:27'), ('Food', '11.31', '2018-01-03 13:30:27'), ('Stationary', '1.20', '2018-01-03 13:30:27'), ('Food', '5.05', '2018-01-03 13:30:27'), ('Food', '3.03', '2018-01-03 13:30:27'), ('Food', '5.05', '2018-01-03 13:30:27'), ('Food', '3.03', '2018-01-03 13:30:27'), ('Food', '1.41', '2018-01-03 13:30:27'), ('Food', '1.00', '2018-01-03 13:30:27'), ('Food', '3.03', '2018-01-03 13:30:27'), ('Food', '3.84', '2018-01-03 13:30:27'), ('Transportation', '4.18', '2018-01-02 13:30:27'), ('Transportation', '11.77', '2018-01-04 13:30:27'), ('Transportation', '11.53', '2018-01-04 13:30:27'), ('Stationary', '10.12', '2018-01-04 13:30:27'), ('Book', '13.49', '2018-01-04 13:30:27'), ('Food', '13.15', '2018-01-05 13:30:27'), ('Food', '13.15', '2018-01-05 13:30:27'), ('Food', '3.04', '2018-01-05 13:30:27'), ('Food', '4.34', '2018-01-05 13:30:27'), ('Food', '4.05', '2018-01-05 13:30:27'), ('Food', '7.07', '2018-01-05 13:30:27'), ('Food', '4.04', '2018-01-05 13:30:27'), ('Food', '1.27', '2018-01-05 13:30:27'), ('Food', '2.04', '2018-01-05 13:30:27'), ('Food', '4.04', '2018-01-05 13:30:27'), ('Food', '6.57', '2018-01-05 13:30:27'), ('Home', '4.97', '2018-01-06 13:30:27'), ('Food', '1.81', '2018-01-06 13:30:27'), ('Miscellany', '1.81', '2018-01-06 13:30:27'), ('Food', '5.05', '2018-01-06 13:30:27'), ('Miscellany', '6.76', '2018-01-06 13:30:27'), ('Food', '6.06', '2018-01-06 13:30:27'), ('Education', '3815.70', '2018-01-16 13:30:27'), ('Housing', '1233.07', '2018-01-16 13:30:27'), ('Housing', '114.37', '2018-01-16 13:30:27'), ('Housing', '25.30', '2018-01-16 13:30:27'), ('Software', '69.84', '2018-01-16 13:30:27'), ('Insurance', '558.69', '2018-01-16 13:30:27'), ('Miscellany', '34.41', '2018-01-16 13:30:27'), ('Insurance', '212.55', '2018-01-16 13:30:27'), ('Home', '13.15', '2018-01-09 13:30:27'), ('Clothes', '26.93', '2018-01-09 13:30:27'), ('Shoes', '12.79', '2018-01-09 13:30:27'), ('Miscellany', '4.53', '2018-01-09 13:30:27'), ('Food', '0.89', '2018-01-10 13:30:27'), ('Food', '4.24', '2018-01-10 13:30:27'), ('Food', '13.15', '2018-01-10 13:30:27'), ('Food', '20.23', '2018-01-10 13:30:27'), ('Food', '9.77', '2018-01-10 13:30:27'), ('Food', '9.34', '2018-01-10 13:30:27'), ('Food', '18.20', '2018-01-10 13:30:27'), ('Food', '6.06', '2018-01-10 13:30:27'), ('Food', '2.02', '2018-01-10 13:30:27'), ('Food', '6.05', '2018-01-10 13:30:27'), ('Food', '1.01', '2018-01-10 13:30:27'), ('Food', '2.52', '2018-01-10 13:30:27'), ('Transportation', '25.30', '2018-01-13 13:30:27'), ('Transportation', '26.69', '2018-01-13 13:30:27'), ('Social', '126.52', '2018-01-13 13:30:27'), ('Book', '13.15', '2018-01-14 13:30:27'), ('Tax', '6.07', '2018-01-14 13:30:27'), ('Clothes', '40.23', '2018-01-15 13:30:27'), ('Food', '4.04', '2018-01-15 13:30:27'), ('Food', '2.01', '2018-01-15 13:30:27'), ('Food', '5.05', '2018-01-15 13:30:27'), ('Health', '121.43', '2018-01-16 13:30:27'), ('Stationary', '2.20', '2018-01-17 13:30:27'), ('Transportation', '5.07', '2018-01-19 13:30:27'), ('Food', '3.03', '2018-01-21 13:30:27'), ('Food', '4.04', '2018-01-21 13:30:27'), ('Food', '3.03', '2018-01-21 13:30:27'), ('Food', '3.54', '2018-01-21 13:30:27'), ('Food', '13.15', '2018-01-21 13:30:27'), ('Food', '1.01', '2018-01-21 13:30:27'), ('Food', '4.04', '2018-01-21 13:30:27'), ('Food', '5.05', '2018-01-21 13:30:27'), ('Food', '14.16', '2018-01-21 13:30:27'), ('Food', '16.17', '2018-01-21 13:30:27'), ('Food', '1.66', '2018-01-21 13:30:27'), ('Food', '1.01', '2018-01-21 13:30:27'), ('Food', '4.04', '2018-01-21 13:30:27'), ('Miscellany', '0.10', '2018-01-22 13:30:27'), ('Food', '3.53', '2018-01-22 13:30:27'), ('Food', '1.31', '2018-01-22 13:30:27'), ('Food', '2.62', '2018-01-22 13:30:27'), ('Food', '4.85', '2018-01-22 13:30:27'), ('Food', '3.26', '2018-01-22 13:30:27'), ('Food', '3.03', '2018-01-22 13:30:27'), ('Food', '1.00', '2018-01-22 13:30:27'), ('Food', '1.28', '2018-01-22 13:30:27'), ('Food', '2.62', '2018-01-22 13:30:27'), ('Food', '1.42', '2018-01-22 13:30:27'), ('Food', '0.84', '2018-01-22 13:30:27'), ('Food', '5.98', '2018-01-22 13:30:27'), ('Food', '9.60', '2018-01-22 13:30:27'), ('Food', '3.53', '2018-01-22 13:30:27'), ('Social', '97.44', '2018-01-22 13:30:27'), ('Social', '14.62', '2018-01-22 13:30:27'), ('Food', '13.14', '2018-01-26 13:30:27'), ('Automobile', '7.08', '2018-01-27 13:30:27'), ('Automobile', '121.45', '2018-01-27 13:30:27'), ('Transportation', '13.22', '2018-01-27 13:30:27'), ('Transportation', '11.59', '2018-01-27 13:30:27'), ('Transportation', '6.49', '2018-01-23 13:30:27'), ('Transportation', '12.45', '2018-01-23 13:30:27'), ('Automobile', '80.97', '2018-01-23 13:30:27'), ('Education', '3815.70', '2018-02-16 13:30:27'), ('Education', '3815.70', '2018-03-16 12:30:27'), ('Housing', '1233.07', '2018-02-16 13:30:27'), ('Insurance', '558.69', '2018-02-16 13:30:27'), ('Insurance', '558.69', '2018-03-16 12:30:27'), ('Software', '20.24', '2018-01-17 13:30:27'), ('Software', '20.24', '2018-02-17 13:30:27'), ('Software', '20.24', '2018-03-17 12:30:27'), ('Software', '20.24', '2018-04-17 12:30:27'), ('Software', '20.24', '2018-05-17 12:30:27'), ('Software', '20.24', '2018-06-17 12:30:27'), ('Software', '20.24', '2018-07-17 12:30:27'), ('Family', '63.98', '2018-01-27 13:30:27'), ('Food', '5.05', '2018-01-27 13:30:27'), ('Food', '2.13', '2018-01-27 13:30:27'), ('Food', '3.03', '2018-01-27 13:30:27'), ('Food', '5.05', '2018-01-27 13:30:27'), ('Food', '3.03', '2018-01-27 13:30:27'), ('Food', '4.16', '2018-01-27 13:30:27'), ('Food', '6.06', '2018-01-27 13:30:27'), ('Food', '0.80', '2018-01-27 13:30:27'), ('Food', '1.14', '2018-01-27 13:30:27'), ('Food', '3.00', '2018-01-27 13:30:27'), ('Food', '4.54', '2018-01-27 13:30:27'), ('Food', '3.96', '2018-01-27 13:30:27'), ('Food', '3.96', '2018-01-27 13:30:27'), ('Food', '1.42', '2018-01-27 13:30:27'), ('Food', '3.73', '2018-01-27 13:30:27'), ('Health', '18.22', '2018-01-28 13:30:27'), ('Entertainment', '10.12', '2018-02-28 13:30:27'), ('Entertainment', '10.12', '2018-02-26 13:30:27'), ('Entertainment', '10.12', '2018-03-05 13:30:27'), ('Communication', '1.01', '2018-01-30 13:30:27'), ('Communication', '2.76', '2018-01-30 13:30:27'), ('Social', '20.96', '2018-01-29 13:30:27'), ('Food', '8.65', '2018-01-30 13:30:27'), ('Transportation', '20.24', '2018-01-31 13:30:27'), ('Food', '5.52', '2018-01-31 13:30:27'), ('Housing', '1233.07', '2018-03-16 12:30:27'), ('Book', '8.91', '2018-02-01 13:30:27'), ('Food', '8.65', '2018-02-16 13:30:27'), ('Food', '11.03', '2018-02-16 13:30:27'), ('Book', '39.16', '2018-02-01 13:30:27'), ('Book', '14.66', '2018-02-01 13:30:27'), ('Book', '8.06', '2018-02-01 13:30:27'), ('Book', '9.05', '2018-02-01 13:30:27'), ('Food', '8.83', '2018-02-01 13:30:27'), ('Book', '21.50', '2018-02-03 13:30:27'), ('Book', '16.17', '2018-02-03 13:30:27'), ('Entertainment', '5.05', '2018-01-11 13:30:27'), ('Health', '2.98', '2018-02-04 13:30:27'), ('Health', '2.98', '2018-05-02 12:30:27'), ('Health', '2.98', '2018-07-02 12:30:27'), ('Health', '2.98', '2018-12-02 13:30:27'), ('Health', '6.04', '2018-02-06 13:30:27'), ('Health', '6.04', '2018-05-20 12:30:27'), ('Health', '5.30', '2018-02-06 13:30:27'), ('Health', '5.30', '2018-03-21 12:30:27'), ('Health', '5.30', '2018-04-22 12:30:27'), ('Health', '5.30', '2018-07-02 12:30:27'), ('Social', '19.76', '2018-02-23 13:30:27'), ('Health', '18.22', '2018-02-23 13:30:27'), ('Social', '18.22', '2018-02-04 13:30:27'), ('Book', '6.04', '2018-02-06 13:30:27'), ('Book', '5.05', '2018-02-06 13:30:27'), ('Book', '5.05', '2018-02-06 13:30:27'), ('Book', '11.39', '2018-02-06 13:30:27'), ('Book', '5.84', '2018-02-06 13:30:27'), ('Book', '9.04', '2018-02-06 13:30:27'), ('Book', '5.04', '2018-02-06 13:30:27'), ('Book', '6.00', '2018-02-06 13:30:27'), ('Book', '8.59', '2018-02-10 13:30:27'), ('Family', '4.00', '2018-02-12 13:30:27'), ('Stationary', '3.33', '2018-02-12 13:30:27'), ('Tax', '0.67', '2018-02-12 13:30:27'), ('Clothes', '43.58', '2018-02-12 13:30:27'), ('Health', '5.56', '2018-02-12 13:30:27'), ('Health', '4.54', '2018-02-12 13:30:27'), ('Tax', '0.91', '2018-02-12 13:30:27'), ('Accessory', '328.35', '2018-02-12 13:30:27'), ('Food', '2.53', '2018-02-12 13:30:27'), ('Food', '6.06', '2018-02-12 13:30:27'), ('Food', '5.05', '2018-02-12 13:30:27'), ('Food', '0.89', '2018-02-12 13:30:27'), ('Health', '10.11', '2018-02-12 13:30:27'), ('Tax', '0.88', '2018-02-12 13:30:27'), ('Book', '19.87', '2018-02-12 13:30:27'), ('Book', '11.28', '2018-02-12 13:30:27'), ('Health', '15.86', '2018-02-12 13:30:27'), ('Health', '9.63', '2018-02-12 13:30:27'), ('Book', '3.38', '2018-02-12 13:30:27'), ('Book', '7.07', '2018-02-12 13:30:27'), ('Book', '19.75', '2018-02-12 13:30:27'), ('Book', '5.31', '2018-02-12 13:30:27'), ('Book', '9.08', '2018-02-12 13:30:27'), ('Book', '14.87', '2018-02-12 13:30:27'), ('Book', '7.80', '2018-02-12 13:30:27'), ('Book', '8.81', '2018-02-12 13:30:27'), ('Book', '6.03', '2018-02-12 13:30:27'), ('Home', '20.22', '2018-02-14 13:30:27'), ('Family', '0.51', '2018-02-14 13:30:27'), ('Family', '4.14', '2018-02-14 13:30:27'), ('Book', '8.75', '2018-02-16 13:30:27'), ('Book', '6.04', '2018-02-16 13:30:27'), ('Book', '14.83', '2018-02-16 13:30:27'), ('Book', '8.38', '2018-02-16 13:30:27'), ('Book', '33.96', '2018-02-16 13:30:27'), ('Book', '4.50', '2018-02-16 13:30:27'), ('Book', '14.14', '2018-02-16 13:30:27'), ('Health', '18.20', '2018-02-16 13:30:27'), ('Tax', '2.04', '2018-02-16 13:30:27'), ('Social', '33.40', '2018-02-17 13:30:27'), ('Entertainment', '58.08', '2018-02-17 13:30:27'), ('Entertainment', '5.01', '2018-02-17 13:30:27'), ('Entertainment', '24.22', '2018-02-17 13:30:27'), ('Book', '6.45', '2018-02-17 13:30:27'), ('Book', '6.11', '2018-02-17 13:30:27'), ('Health', '10.12', '2018-02-17 13:30:27'), ('Family', '12.13', '2018-02-19 13:30:27'), ('Entertainment', '31.86', '2018-02-19 13:30:27'), ('Sartorial', '15.17', '2018-02-20 13:30:27'), ('Book', '5.10', '2018-02-22 13:30:27'), ('Book', '10.99', '2018-02-22 13:30:27'), ('Book', '4.55', '2018-02-22 13:30:27'), ('Book', '16.88', '2018-02-22 13:30:27'), ('Book', '25.37', '2018-02-22 13:30:27'), ('Book', '10.59', '2018-02-22 13:30:27'), ('Book', '8.09', '2018-02-22 13:30:27'), ('Home', '15.17', '2018-02-22 13:30:27'), ('Tax', '3.65', '2018-02-22 13:30:27'), ('Food', '7.59', '2018-02-24 13:30:27'), ('Clothes', '15.18', '2018-02-22 13:30:27'), ('Food', '2.52', '2018-02-25 11:52:29'), ('Food', '5.05', '2018-02-25 11:52:29'), ('Food', '3.03', '2018-02-25 11:52:29'), ('Food', '3.03', '2018-02-25 11:52:29'), ('Food', '10.11', '2018-02-25 11:52:29'), ('Food', '5.05', '2018-02-25 11:52:29'), ('Food', '0.89', '2018-02-25 11:52:29'), ('Food', '1.01', '2018-02-25 11:52:29'), ('Food', '10.11', '2018-02-25 11:52:29'), ('Food', '2.01', '2018-02-25 11:52:29'), ('Transportation', '4.05', '2018-02-25 11:52:29'), ('Transportation', '10.27', '2018-02-25 11:52:29'), ('Book', '7.07', '2018-02-27 11:52:29'), ('Book', '8.06', '2018-02-27 11:52:29'), ('Sartorial', '6.36', '2018-02-27 11:52:29'), ('Book', '5.61', '2018-02-27 11:52:29'), ('Book', '13.29', '2018-02-27 11:52:29'), ('Health', '27.25', '2018-05-02 10:52:29'), ('Communication', '15.18', '2018-01-09 13:30:27'), ('Communication', '15.18', '2018-02-09 13:30:27'), ('Communication', '15.18', '2018-03-09 13:30:27'), ('Communication', '15.18', '2018-04-09 12:30:27'), ('Communication', '15.18', '2018-05-09 12:30:27'), ('Communication', '15.18', '2018-06-09 12:30:27'), ('Communication', '15.18', '2018-07-09 12:30:27'), ('Communication', '15.18', '2018-08-09 12:30:27'), ('Communication', '15.18', '2018-09-09 12:30:27'), ('Clothes', '30.36', '2018-03-03 13:30:27'), ('Miscellany', '10.12', '2018-03-03 13:30:27'), ('Entertainment', '12.64', '2018-03-04 13:30:27'), ('Transportation', '19.08', '2018-03-04 13:30:27'), ('Health', '26.47', '2018-03-05 13:30:27'), ('Stationary', '3.95', '2018-03-03 13:30:27'), ('Stationary', '1.39', '2018-03-06 13:30:27'), ('Stationary', '1.16', '2018-03-06 13:30:27'), ('Transportation', '5.11', '2018-03-09 13:30:27'), ('Social', '24.29', '2018-03-09 13:30:27'), ('Social', '20.24', '2018-03-09 13:30:27'), ('Transportation', '10.12', '2018-03-09 13:30:27'), ('Transportation', '142.30', '2018-03-10 13:30:27'), ('Sartorial', '4.29', '2018-03-11 13:30:27'), ('Home', '6.73', '2018-03-11 13:30:27'), ('Home', '78.93', '2018-03-11 13:30:27'), ('Sartorial', '48.72', '2018-03-11 13:30:27'), ('Sartorial', '7.07', '2018-03-11 13:30:27'), ('Tax', '12.10', '2018-03-11 13:30:27'), ('Legal', '1.81', '2018-03-11 13:30:27'), ('Sartorial', '15.17', '2018-03-11 13:30:27'), ('Sartorial', '6.06', '2018-03-11 13:30:27'), ('Health', '14.13', '2018-03-11 13:30:27'), ('Food', '216.34', '2018-03-12 12:30:27'), ('Food', '8.65', '2018-03-11 13:30:27'), ('Family', '14.55', '2018-03-11 13:30:27'), ('Social', '23.28', '2018-03-12 12:30:27'), ('Food', '10.20', '2018-03-15 12:30:27'), ('Family', '23.74', '2018-03-15 12:30:27'), ('Stationary', '23.14', '2018-03-17 12:30:27'), ('Accessory', '5.52', '2018-03-20 12:30:27'), ('Food', '1.36', '2018-03-20 12:30:27'), ('Food', '0.50', '2018-03-20 12:30:27'), ('Food', '5.05', '2018-03-20 12:30:27'), ('Transportation', '34.74', '2018-03-20 12:30:27'), ('Family', '26.48', '2018-03-20 12:30:27'), ('Software', '4.29', '2018-03-10 13:30:27'), ('Software', '14.71', '2018-03-10 13:30:27'), ('Clothes', '17.21', '2018-03-22 12:30:27'), ('Clothes', '36.16', '2018-03-22 12:30:27'), ('Education', '13.16', '2018-03-21 12:30:27'), ('Transportation', '34.74', '2018-03-21 12:30:27'), ('Education', '39.67', '2018-03-22 12:30:27'), ('Transportation', '9.53', '2018-03-22 12:30:27'), ('Transportation', '5.92', '2018-03-22 12:30:27'), ('Social', '73.92', '2018-03-22 12:30:27'), ('Education', '13.16', '2018-03-22 12:30:27'), ('Social', '43.52', '2018-03-22 12:30:27'), ('Transportation', '3.67', '2018-03-24 12:30:27'), ('Transportation', '14.04', '2018-03-25 12:30:27'), ('Transportation', '11.30', '2018-03-25 12:30:27'), ('Accessory', '13.24', '2018-03-25 12:30:27'), ('Entertainment', '22.21', '2018-03-25 12:30:27'), ('Food', '14.34', '2018-03-25 12:30:27'), ('Sartorial', '13.15', '2018-03-26 12:30:27'), ('Transportation', '3.33', '2018-03-26 12:30:27'), ('Transportation', '3.91', '2018-03-26 12:30:27'), ('Transportation', '5.70', '2018-03-26 12:30:27'), ('Home', '30.35', '2018-03-26 12:30:27'), ('Home', '8.09', '2018-03-26 12:30:27'), ('Home', '30.35', '2018-03-26 12:30:27'), ('Electronics', '7.58', '2018-03-26 12:30:27'), ('Food', '4.04', '2018-03-26 12:30:27'), ('Food', '17.65', '2018-03-26 12:30:27'), ('Tax', '7.07', '2018-03-26 12:30:27'), ('Accessory', '101.21', '2018-03-27 12:30:27'), ('Accessory', '101.21', '2018-03-27 12:30:27'), ('Accessory', '101.21', '2018-03-27 12:30:27'), ('Accessory', '40.48', '2018-03-27 12:30:27'), ('Accessory', '30.36', '2018-03-27 12:30:27'), ('Accessory', '30.36', '2018-03-27 12:30:27'), ('Accessory', '30.36', '2018-03-27 12:30:27'), ('Accessory', '5.47', '2018-03-28 12:30:27'), ('Entertainment', '2.84', '2018-03-28 12:30:27'), ('Health', '18.22', '2018-03-31 12:30:27'), ('Sartorial', '41.40', '2018-03-31 12:30:27'), ('Software', '4.29', '2018-04-10 12:30:27'), ('Software', '4.29', '2018-05-10 12:30:27'), ('Software', '4.29', '2018-06-10 12:30:27'), ('Software', '4.29', '2018-07-10 12:30:27'), ('Software', '4.29', '2018-08-10 12:30:27'), ('Software', '4.29', '2018-09-10 12:30:27'), ('Software', '4.29', '2018-10-10 12:30:27'), ('Software', '4.29', '2018-12-10 13:30:27'), ('Software', '4.29', '2018-11-10 13:30:27'), ('Accessory', '68.82', '2018-04-03 10:52:29'), ('Accessory', '5.21', '2018-04-03 10:52:29'), ('Tax', '7.12', '2018-04-03 10:52:29'), ('Clothes', '177.12', '2018-04-03 10:52:29'), ('Clothes', '177.12', '2018-04-03 10:52:29'), ('Tax', '31.90', '2018-04-03 10:52:29'), ('Communication', '30.30', '2018-03-03 11:52:29'), ('Shoes', '546.55', '2018-06-20 10:52:29'), ('Food', '7.59', '2018-04-04 10:52:29'), ('Book', '28.22', '2018-04-04 10:52:29'), ('Education', '134.85', '2018-04-04 10:52:29'), ('Book', '3.72', '2018-04-04 10:52:29'), ('Book', '7.07', '2018-04-04 10:52:29'), ('Book', '7.47', '2018-04-04 10:52:29'), ('Food', '5.56', '2018-04-08 12:30:27'), ('Food', '7.07', '2018-04-08 12:30:27'), ('Food', '2.22', '2018-04-08 12:30:27'), ('Social', '48.58', '2018-04-08 12:30:27'), ('Social', '14.68', '2018-04-08 12:30:27'), ('Social', '15.69', '2018-04-08 12:30:27'), ('Transportation', '16.90', '2018-04-08 12:30:27'), ('Food', '14.34', '2018-04-09 12:30:27'), ('Clothes', '86.06', '2018-04-09 12:30:27'), ('Clothes', '46.35', '2018-04-09 12:30:27'), ('Education', '190.91', '2018-04-16 12:30:27'), ('Housing', '1037.91', '2018-04-16 12:30:27'), ('Housing', '1037.91', '2018-05-16 12:30:27'), ('Housing', '1037.91', '2018-06-16 12:30:27'), ('Housing', '23.86', '2018-04-16 12:30:27'), ('Software', '21.95', '2018-04-16 12:30:27'), ('Software', '21.95', '2018-05-16 12:30:27'), ('Software', '21.95', '2018-06-16 12:30:27'), ('Insurance', '526.91', '2018-06-16 12:30:27'), ('Insurance', '526.91', '2018-05-16 12:30:27'), ('Insurance', '526.91', '2018-04-16 12:30:27'), ('Health', '200.45', '2018-02-12 13:30:27'), ('Entertainment', '32.45', '2018-04-16 12:30:27'), ('Education', '3598.64', '2018-04-16 12:30:27'), ('Education', '3598.64', '2018-05-16 12:30:27'), ('Education', '3598.64', '2018-06-16 12:30:27'), ('Shoes', '81.09', '2018-04-11 12:30:27'), ('Tax', '7.30', '2018-04-11 12:30:27'), ('Tax', '3.77', '2018-04-12 12:30:27'), ('Clothes', '81.61', '2018-04-13 12:30:27'), ('Food', '8.90', '2018-04-16 12:30:27'), ('Food', '37.45', '2018-04-15 12:30:27'), ('Food', '7.03', '2018-04-14 12:30:27'), ('Clothes', '103.08', '2018-04-17 12:30:27'), ('Tax', '7.48', '2018-04-17 12:30:27'), ('Stationary', '20.77', '2018-04-18 12:30:27'), ('Legal', '0.52', '2018-04-18 12:30:27'), ('Health', '7.75', '2018-04-20 12:30:27'), ('Health', '8.09', '2018-04-20 12:30:27'), ('Book', '6.24', '2018-04-20 12:30:27'), ('Tax', '0.73', '2018-04-20 12:30:27'), ('Health', '60.38', '2018-04-20 12:30:27'), ('Tax', '5.43', '2018-04-20 12:30:27'), ('Entertainment', '10.93', '2018-05-13 12:30:27'), ('Sartorial', '18.74', '2018-04-21 10:52:29'), ('Sartorial', '14.57', '2018-04-21 10:52:29'), ('Sartorial', '17.69', '2018-04-21 10:52:29'), ('Sartorial', '18.74', '2018-05-02 12:30:27'), ('Accessory', '4.43', '2018-04-21 12:30:27'), ('Accessory', '86.73', '2018-04-21 12:30:27'), ('Tax', '8.20', '2018-04-21 12:30:27'), ('Clothes', '726.79', '2018-06-09 12:30:27'), ('Tax', '65.41', '2018-06-09 12:30:27'), ('Food', '3.47', '2018-04-22 12:30:27'), ('Food', '22.40', '2018-04-22 12:30:27'), ('Social', '77.75', '2018-04-22 12:30:27'), ('Food', '4.17', '2018-04-22 12:30:27'), ('Social', '33.32', '2018-04-22 12:30:27'), ('Social', '38.63', '2018-04-23 12:30:27'), ('Legal', '254.85', '2018-04-24 12:30:27'), ('Legal', '0.18', '2018-04-24 12:30:27'), ('Legal', '249.90', '2018-04-24 12:30:27'), ('Education', '10.41', '2018-04-25 12:30:27'), ('Food', '10.50', '2018-04-26 12:30:27'), ('Sartorial', '34.24', '2018-04-26 12:30:27'), ('Sartorial', '3.12', '2018-04-27 12:30:27'), ('Automobile', '3.11', '2018-05-01 12:30:27'), ('Shoes', '383.36', '2018-12-02 13:30:27'), ('Accessory', '36.44', '2018-05-12 12:30:27'), ('Accessory', '9.37', '2018-05-12 12:30:27'), ('Accessory', '130.15', '2018-05-12 12:30:27'), ('Accessory', '130.15', '2018-05-12 12:30:27'), ('Accessory', '130.15', '2018-05-12 12:30:27'), ('Accessory', '41.65', '2018-05-12 12:30:27'), ('Miscellany', '138.07', '2018-05-12 12:30:27'), ('Sartorial', '26.03', '2018-06-09 12:30:27'), ('Clothes', '71.85', '2018-05-15 12:30:27'), ('Clothes', '70.80', '2018-05-15 12:30:27'), ('Clothes', '70.80', '2018-05-15 12:30:27'), ('Tax', '19.25', '2018-05-15 12:30:27'), ('Food', '2.60', '2018-05-07 12:30:27'), ('Food', '3.63', '2018-05-07 12:30:27'), ('Food', '2.07', '2018-05-07 12:30:27'), ('Food', '5.20', '2018-05-07 12:30:27'), ('Sartorial', '26.36', '2018-05-08 12:30:27'), ('Transportation', '9.17', '2018-05-09 12:30:27'), ('Transportation', '20.03', '2018-05-09 12:30:27'), ('Transportation', '9.03', '2018-04-06 12:30:27'), ('Transportation', '5.49', '2018-04-22 12:30:27'), ('Transportation', '13.89', '2018-04-22 12:30:27'), ('Food', '9.25', '2018-05-09 12:30:27'), ('Book', '17.67', '2018-05-10 12:30:27'), ('Book', '11.42', '2018-05-10 12:30:27'), ('Sartorial', '29.14', '2018-05-10 12:30:27'), ('Communication', '4.55', '2018-05-10 12:30:27'), ('Health', '9.07', '2018-05-11 10:52:29'), ('Food', '5.42', '2018-05-12 10:52:29'), ('Food', '3.95', '2018-05-12 10:52:29'), ('Food', '2.07', '2018-05-12 10:52:29'), ('Food', '1.76', '2018-05-12 10:52:29'), ('Food', '3.11', '2018-05-12 10:52:29'), ('Food', '2.38', '2018-05-12 10:52:29'), ('Home', '2.07', '2018-05-12 10:52:29'), ('Home', '4.15', '2018-05-12 10:52:29'), ('Food', '4.15', '2018-05-12 10:52:29'), ('Tax', '0.94', '2018-05-12 10:52:29'), ('Social', '83.30', '2018-05-12 10:52:29'), ('Transportation', '23.91', '2018-05-12 10:52:29'), ('Transportation', '19.66', '2018-05-12 10:52:29'), ('Food', '4.17', '2018-05-12 10:52:29'), ('Social', '26.03', '2018-05-14 10:52:29'), ('Home', '17.69', '2018-05-18 10:52:29'), ('Food', '8.90', '2018-05-20 10:52:29'), ('Food', '6.24', '2018-05-21 12:30:27'), ('Food', '7.28', '2018-05-21 12:30:27'), ('Food', '12.48', '2018-05-21 12:30:27'), ('Sartorial', '51.13', '2018-05-21 12:30:27'), ('Home', '36.39', '2018-05-22 12:30:27'), ('Home', '20.82', '2018-05-22 12:30:27'), ('Home', '7.59', '2018-05-22 12:30:27'), ('Stationary', '2.26', '2018-05-22 12:30:27'), ('Stationary', '9.88', '2018-05-22 12:30:27'), ('Pen', '105.11', '2018-05-24 12:30:27'), ('Stationary', '5.42', '2018-05-25 12:30:27'), ('Transportation', '3.80', '2018-05-26 12:30:27'), ('Transportation', '6.51', '2018-05-26 12:30:27'), ('Transportation', '6.53', '2018-05-26 12:30:27'), ('Health', '18.74', '2018-05-25 12:30:27'), ('Electronics', '64.64', '2018-05-28 12:30:27'), ('Shoes', '114.53', '2018-12-02 13:30:27'), ('Food', '13.62', '2018-06-01 12:30:27'), ('Stationary', '11.44', '2018-06-03 12:30:27'), ('Stationary', '47.83', '2018-06-07 12:30:27'), ('Stationary', '7.59', '2018-06-07 12:30:27'), ('Health', '56.74', '2018-06-08 12:30:27'), ('Shoes', '34.36', '2018-06-08 12:30:27'), ('Home', '13.68', '2018-06-09 10:52:29'), ('Home', '363.39', '2018-06-09 10:52:29'), ('Pen', '19.46', '2018-06-09 10:52:29'), ('Tax', '35.73', '2018-06-09 10:52:29'), ('Miscellany', '5.21', '2018-06-09 10:52:29'), ('Accessory', '41.65', '2018-06-09 10:52:29'), ('Accessory', '41.65', '2018-06-09 10:52:29'), ('Accessory', '41.65', '2018-06-09 10:52:29'), ('Accessory', '34.36', '2018-06-09 10:52:29'), ('Stationary', '7.84', '2018-06-11 12:30:27'), ('Stationary', '8.61', '2018-06-11 12:30:27'), ('Pen', '28.63', '2018-06-11 12:30:27'), ('Pen', '27.38', '2018-06-11 12:30:27'), ('Health', '9.89', '2018-06-13 12:30:27'), ('Social', '17.70', '2018-06-14 12:30:27'), ('Food', '35.18', '2018-06-15 12:30:27'), ('Food', '5.72', '2018-06-15 12:30:27'), ('Food', '12.48', '2018-06-15 12:30:27'), ('Food', '20.82', '2018-06-19 12:30:27'), ('Book', '20.42', '2018-07-03 12:30:27'), ('Tax', '1.78', '2018-06-16 12:30:27'), ('Stationary', '1.30', '2018-06-17 12:30:27'), ('Electronics', '6.24', '2018-06-17 12:30:27'), ('Tax', '0.92', '2018-06-17 12:30:27'), ('Tax', '0.75', '2018-06-17 12:30:27'), ('Food', '8.33', '2018-06-17 12:30:27'), ('Miscellany', '378.47', '2018-06-16 12:30:27'), ('Home', '17.69', '2018-06-17 12:30:27'), ('Food', '40.61', '2018-06-17 12:30:27'), ('Electronics', '15.61', '2018-06-17 12:30:27'), ('Legal', '26.92', '2018-06-17 12:30:27'), ('Electronics', '28.10', '2018-06-19 12:30:27'), ('Social', '145.77', '2018-06-19 12:30:27'), ('Social', '36.44', '2018-06-19 12:30:27'), ('Miscellany', '15.47', '2018-06-20 12:30:27'), ('Miscellany', '154.75', '2018-06-20 12:30:27'), ('Miscellany', '208.25', '2018-06-20 12:30:27'), ('Software', '5.20', '2018-06-20 12:30:27'), ('Transportation', '3.90', '2018-06-20 12:30:27'), ('Transportation', '10.13', '2018-06-19 12:30:27'), ('Transportation', '12.70', '2018-06-19 12:30:27'), ('Electronics', '175.97', '2018-06-20 12:30:27'), ('Sartorial', '25.98', '2018-06-20 12:30:27'), ('Tax', '18.18', '2018-06-20 12:30:27'), ('Food', '26.10', '2018-06-21 12:30:27'), ('Transportation', '34.36', '2018-06-21 12:30:27'), ('Transportation', '7.81', '2018-06-21 12:30:27'), ('Home', '7.24', '2018-06-23 12:30:27'), ('Home', '60.80', '2018-06-24 12:30:27'), ('Social', '83.30', '2018-06-26 12:30:27'), ('Food', '62.46', '2018-06-30 12:30:27'), ('Home', '350.57', '2018-06-25 12:30:27'), ('Social', '3.11', '2018-06-24 12:30:27'), ('Housing', '1247.93', '2018-07-16 12:30:27'), ('Housing', '1247.93', '2018-08-16 12:30:27'), ('Housing', '5.21', '2018-08-16 12:30:27'), ('Housing', '5.21', '2018-07-16 12:30:27'), ('Housing', '35.92', '2018-07-16 12:30:27'), ('Housing', '35.92', '2018-08-16 12:30:27'), ('Health', '109.33', '2018-08-16 12:30:27'), ('Health', '109.33', '2018-07-16 12:30:27'), ('Education', '588.82', '2018-07-16 12:30:27'), ('Education', '588.82', '2018-08-16 12:30:27'), ('Sartorial', '29.14', '2018-06-26 12:30:27'), ('Electronics', '13.68', '2018-06-27 12:30:27'), ('Transportation', '17.70', '2018-06-27 12:30:27'), ('Health', '20.82', '2018-06-28 12:30:27'), ('Food', '2.07', '2018-06-28 12:30:27'), ('Software', '216.83', '2018-07-02 12:30:27'), ('Transportation', '99.96', '2018-07-02 12:30:27'), ('Food', '15.62', '2018-07-05 12:30:27'), ('Food', '62.46', '2018-07-03 12:30:27'), ('Food', '9.08', '2018-07-06 12:30:27'), ('Software', '1.03', '2018-07-08 12:30:27'), ('Clothes', '10.36', '2018-07-09 12:30:27'), ('Health', '12.98', '2018-07-09 12:30:27'), ('Automobile', '10.79', '2018-07-09 12:30:27'), ('Home', '123.69', '2018-07-17 12:30:27'), ('Health', '10.40', '2018-07-17 12:30:27'), ('Book', '4.15', '2018-07-17 12:30:27'), ('Tax', '11.51', '2018-07-17 12:30:27'), ('Tax', '10.93', '2018-07-17 12:30:27'), ('Automobile', '10.79', '2018-07-16 12:30:27'), ('Legal', '3.12', '2018-07-18 12:30:27'), ('Legal', '3.12', '2018-07-18 12:30:27'), ('Food', '10.41', '2018-07-18 12:30:27'), ('Transportation', '18.58', '2018-07-14 12:30:27'), ('Transportation', '13.36', '2018-07-14 12:30:27'), ('Transportation', '7.14', '2018-07-14 12:30:27'), ('Transportation', '3.54', '2018-07-20 12:30:27'), ('Transportation', '5.40', '2018-07-19 12:30:27'), ('Transportation', '10.41', '2018-07-21 12:30:27'), ('Food', '18.73', '2018-07-19 12:30:27'), ('Social', '1.51', '2018-07-30 12:30:27'), ('Health', '18.74', '2018-07-22 12:30:27'), ('Food', '7.81', '2018-07-22 12:30:27'), ('Home', '16.65', '2018-07-22 12:30:27'), ('Home', '31.23', '2018-07-22 12:30:27'), ('Home', '1.34', '2018-07-22 12:30:27'), ('Home', '20.82', '2018-07-22 12:30:27'), ('Home', '41.64', '2018-07-22 12:30:27'), ('Tax', '11.87', '2018-07-22 12:30:27'), ('Transportation', '4.93', '2018-07-22 12:30:27'), ('Transportation', '6.37', '2018-07-22 12:30:27'), ('Food', '10.79', '2018-07-22 12:30:27'), ('Food', '11.35', '2018-07-23 12:30:27'), ('Home', '22.74', '2018-07-23 12:30:27'), ('Home', '14.78', '2018-07-23 12:30:27'), ('Automobile', '26.51', '2018-07-23 12:30:27'), ('Home', '12.50', '2018-07-28 12:30:27'), ('Home', '11.40', '2018-07-28 12:30:27'), ('Tax', '2.16', '2018-07-28 12:30:27'), ('Housing', '1284.20', '2018-07-28 12:30:27'), ('Family', '1.50', '2018-07-28 12:30:27'), ('Electronics', '67.67', '2018-07-28 12:30:27'), ('Electronics', '103.94', '2018-07-28 12:30:27'), ('Tax', '15.44', '2018-07-28 12:30:27'), ('Housing', '1282.47', '2018-08-16 12:30:27'), ('Automobile', '10.79', '2018-07-29 12:30:27'), ('Entertainment', '17.95', '2018-07-29 12:30:27'), ('Social', '38.53', '2018-07-29 12:30:27'), ('Social', '9.37', '2018-07-29 12:30:27'), ('Food', '5.72', '2018-07-29 12:30:27'), ('Food', '1.04', '2018-07-29 12:30:27'), ('Food', '4.17', '2018-07-29 12:30:27'), ('Transportation', '7.86', '2018-07-25 12:30:27'), ('Transportation', '5.91', '2018-07-25 12:30:27'), ('Transportation', '7.94', '2018-07-29 12:30:27'), ('Transportation', '5.03', '2018-07-25 12:30:27'), ('Automobile', '5206.21', '2018-08-04 12:30:27'), ('Stationary', '10.38', '2018-08-01 12:30:27'), ('Software', '75.68', '2018-07-31 12:30:27'), ('Transportation', '52.06', '2018-07-31 12:30:27'), ('Entertainment', '4.15', '2018-07-30 12:30:27'), ('Transportation', '9.42', '2018-08-01 12:30:27'), ('Transportation', '55.83', '2018-08-01 12:30:27'), ('Transportation', '7.48', '2018-08-02 12:30:27'), ('Transportation', '9.24', '2018-08-03 12:30:27'), ('Automobile', '220.74', '2018-08-04 12:30:27'), ('Automobile', '52.06', '2018-08-04 12:30:27'), ('Insurance', '83.99', '2018-08-04 12:30:27'), ('Insurance', '83.99', '2018-09-04 12:30:27'), ('Insurance', '83.99', '2018-10-04 12:30:27'), ('Insurance', '83.99', '2018-11-04 12:30:27'), ('Automobile', '1041.24', '2018-08-04 12:30:27'), ('Automobile', '3123.73', '2018-08-04 12:30:27'), ('Automobile', '8.19', '2018-08-04 12:30:27'), ('Stationary', '5.20', '2018-08-01 12:30:27'), ('Book', '20.04', '2018-08-01 12:30:27'), ('Food', '5.20', '2018-08-05 12:30:27'), ('Food', '7.28', '2018-08-05 12:30:27'), ('Clothes', '60.39', '2018-08-05 12:30:27'), ('Clothes', '70.80', '2018-08-05 12:30:27'), ('Tax', '11.81', '2018-08-05 12:30:27'), ('Insurance', '66.82', '2018-09-02 12:30:27'), ('Insurance', '66.82', '2018-10-02 12:30:27'), ('Insurance', '66.82', '2018-11-02 12:30:27'), ('Insurance', '66.82', '2018-12-02 13:30:27'), ('Insurance', '83.99', '2018-12-04 13:30:27'), ('Food', '1.04', '2018-08-06 12:30:27'), ('Home', '2.07', '2018-08-06 12:30:27'), ('Tax', '0.18', '2018-08-06 12:30:27'), ('Automobile', '58.70', '2018-08-06 12:30:27'), ('Health', '52.05', '2018-08-07 12:30:27'), ('Health', '26.02', '2018-08-07 12:30:27'), ('Tax', '7.03', '2018-08-07 12:30:27'), ('Health', '27.97', '2018-08-07 12:30:27'), ('Home', '78.04', '2018-08-06 12:30:27'), ('Tax', '6.83', '2018-08-06 12:30:27'), ('Health', '38.53', '2018-08-09 12:30:27'), ('Health', '89.55', '2018-08-09 12:30:27'), ('Health', '84.34', '2018-08-09 12:30:27'), ('Insurance', '167.02', '2018-08-09 12:30:27'), ('Communication', '0.52', '2018-08-09 12:30:27'), ('Home', '3.63', '2018-08-09 12:30:27'), ('Automobile', '2.19', '2018-08-07 12:30:27'), ('Automobile', '3.23', '2018-08-08 12:30:27'), ('Automobile', '5.21', '2018-08-10 12:30:27'), ('Automobile', '5.21', '2018-08-10 12:30:27'), ('Home', '49.97', '2018-08-12 12:30:27'), ('Tax', '4.62', '2018-08-12 12:30:27'), ('Food', '5.20', '2018-08-12 12:30:27'), ('Food', '4.15', '2018-08-12 12:30:27'), ('Home', '3.11', '2018-08-12 12:30:27'), ('Home', '4.15', '2018-08-12 12:30:27'), ('Food', '4.26', '2018-08-12 12:30:27'), ('Food', '3.11', '2018-08-12 12:30:27'), ('Food', '20.82', '2018-08-12 12:30:27'), ('Home', '3.53', '2018-08-12 12:30:27'), ('Home', '10.92', '2018-08-12 12:30:27'), ('Tax', '1.96', '2018-08-12 12:30:27'), ('Home', '93.70', '2018-08-12 12:30:27'), ('Home', '14.57', '2018-08-12 12:30:27'), ('Home', '13.53', '2018-08-12 12:30:27'), ('Home', '28.30', '2018-08-12 12:30:27'), ('Home', '193.99', '2018-08-12 12:30:27'), ('Tax', '16.97', '2018-08-12 12:30:27'), ('Home', '225.94', '2018-08-12 12:30:27'), ('Tax', '19.77', '2018-08-12 12:30:27'), ('Health', '25.38', '2018-08-12 12:30:27'), ('Home', '31.23', '2018-08-12 12:30:27'), ('Home', '27.06', '2018-08-12 12:30:27'), ('Home', '156.18', '2018-08-12 12:30:27'), ('Tax', '2.36', '2018-08-12 12:30:27'), ('Health', '27.97', '2018-08-07 12:30:27'), ('Health', '23.54', '2018-08-12 12:30:27'), ('Home', '41.64', '2018-08-12 12:30:27'), ('Home', '103.08', '2018-08-12 12:30:27'), ('Home', '30.20', '2018-08-12 12:30:27'), ('Home', '16.31', '2018-08-12 12:30:27'), ('Home', '156.18', '2018-08-12 12:30:27'), ('Home', '114.53', '2018-08-12 12:30:27'), ('Home', '13.02', '2018-08-16 12:30:27'), ('Tax', '2.27', '2018-08-16 12:30:27'), ('Home', '25.93', '2018-08-16 12:30:27'), ('Food', '4.95', '2018-08-16 12:30:27'), ('Food', '4.68', '2018-08-16 12:30:27'), ('Food', '4.68', '2018-08-16 12:30:27'), ('Tax', '0.86', '2018-08-16 12:30:27'), ('Automobile', '59.85', '2018-08-16 12:30:27'), ('Electronics', '6.24', '2018-08-17 12:30:27'), ('Health', '24.01', '2018-08-17 12:30:27'), ('Tax', '2.19', '2018-08-17 12:30:27'), ('Tax', '10.84', '2018-08-17 12:30:27'), ('Tax', '6.25', '2018-08-17 12:30:27'), ('Health', '6.12', '2018-08-19 12:30:27'), ('Sartorial', '4.54', '2018-08-19 12:30:27'), ('Health', '24.97', '2018-08-19 12:30:27'), ('Home', '10.41', '2018-08-19 12:30:27'), ('Food', '6.24', '2018-08-19 12:30:27'), ('Food', '1.66', '2018-08-19 12:30:27'), ('Food', '2.07', '2018-08-19 12:30:27'), ('Miscellany', '0.26', '2018-08-19 12:30:27'), ('Home', '5.21', '2018-08-20 12:30:27'), ('Home', '1.55', '2018-08-20 12:30:27'), ('Home', '10.40', '2018-08-20 12:30:27'), ('Home', '9.36', '2018-08-20 12:30:27'), ('Home', '9.36', '2018-08-20 12:30:27'), ('Tax', '2.69', '2018-08-20 12:30:27'), ('Tax', '2.69', '2018-08-20 12:30:27'), ('Tax', '2.69', '2018-08-20 12:30:27'), ('Communication', '1.04', '2018-08-18 12:30:27'), ('Home', '3.11', '2018-08-23 12:30:27'), ('Food', '5.72', '2018-08-23 12:30:27'), ('Food', '5.20', '2018-08-23 12:30:27'), ('Home', '3.11', '2018-08-23 12:30:27'), ('Home', '3.11', '2018-08-23 12:30:27'), ('Home', '9.36', '2018-08-23 12:30:27'), ('Home', '1.36', '2018-08-23 12:30:27'), ('Home', '24.16', '2018-08-25 12:30:27'), ('Food', '14.19', '2018-08-23 12:30:27'), ('Home', '84.86', '2018-08-23 12:30:27'), ('Home', '20.65', '2018-08-23 12:30:27'), ('Communication', '189.69', '2018-08-22 12:30:27'), ('Communication', '185.91', '2018-08-22 12:30:27'), ('Communication', '74.08', '2018-08-22 12:30:27'), ('Food', '25.41', '2018-08-21 12:30:27'), ('Communication', '207.48', '2018-08-20 12:30:27'), ('Health', '27.17', '2018-08-17 12:30:27'), ('Communication', '1977.67', '2018-08-23 12:30:27'), ('Stationary', '10.41', '2018-08-22 12:30:27'), ('Communication', '382.80', '2018-08-18 12:30:27'), ('Social', '104.12', '2018-08-17 12:30:27'), ('Communication', '382.80', '2018-08-18 12:30:27'), ('Communication', '207.48', '2018-08-22 12:30:27'), ('Communication', '189.69', '2018-08-22 12:30:27'), ('Communication', '185.91', '2018-08-22 12:30:27'), ('Communication', '1956.06', '2018-08-21 12:30:27'), ('Social', '46.86', '2018-08-25 12:30:27'), ('Home', '1.03', '2018-08-25 12:30:27'), ('Food', '4.68', '2018-08-25 12:30:27'), ('Tax', '0.28', '2018-08-25 12:30:27'), ('Home', '18.73', '2018-08-29 12:30:27'), ('Automobile', '61.67', '2018-08-29 12:30:27'), ('Food', '8.90', '2018-08-27 12:30:27'), ('Education', '1040.20', '2018-08-21 12:30:27'), ('Education', '416.29', '2018-08-28 12:30:27'), ('Education', '177.01', '2018-08-28 12:30:27'), ('Automobile', '14.57', '2018-08-15 12:30:27'), ('Automobile', '14.57', '2018-08-25 12:30:27'), ('Entertainment', '29.03', '2018-08-27 12:30:27'), ('Electronics', '108.14', '2018-08-29 12:30:27'), ('Software', '37.54', '2018-08-31 12:30:27'), ('Social', '14.52', '2018-08-30 12:30:27'), ('Food', '1.66', '2018-08-31 12:30:27'), ('Food', '7.28', '2018-08-31 12:30:27'), ('Food', '4.68', '2018-08-31 12:30:27'), ('Health', '18.74', '2018-09-02 12:30:27'), ('Food', '1.04', '2018-09-02 12:30:27'), ('Food', '15.45', '2018-09-02 12:30:27'), ('Automobile', '10.41', '2018-09-06 12:30:27'), ('Health', '23.54', '2018-09-07 12:30:27'), ('Food', '5.72', '2018-09-09 12:30:27'), ('Health', '5.20', '2018-09-09 12:30:27'), ('Tax', '0.46', '2018-09-09 12:30:27'), ('Food', '17.02', '2018-09-09 12:30:27'), ('Social', '28.11', '2018-09-10 12:30:27'), ('Social', '18.74', '2018-09-10 12:30:27'), ('Stationary', '4.05', '2018-09-10 12:30:27'), ('Food', '11.45', '2018-09-08 12:30:27'), ('Food', '11.35', '2018-09-11 12:30:27'), ('Automobile', '37.44', '2018-09-12 12:30:27'), ('Software', '36.44', '2018-09-15 12:30:27'), ('Food', '11.45', '2018-09-15 12:30:27'), ('Automobile', '10.41', '2018-09-15 12:30:27'), ('Automobile', '42.40', '2018-09-15 12:30:27'), ('Social', '9.36', '2018-09-16 12:30:27'), ('Social', '15.77', '2018-09-16 12:30:27'), ('Food', '13.62', '2018-09-17 12:30:27'), ('Accessory', '11.30', '2018-09-16 12:30:27'), ('Accessory', '10.08', '2018-09-17 12:30:27'), ('Social', '16.66', '2018-09-17 12:30:27'), ('Food', '15.23', '2018-09-18 12:30:27'), ('Social', '6.25', '2018-09-18 12:30:27'), ('Social', '35.18', '2018-09-18 12:30:27'), ('Social', '16.14', '2018-09-18 12:30:27'), ('Food', '9.83', '2018-09-19 12:30:27'), ('Food', '11.86', '2018-09-20 12:30:27'), ('Food', '13.02', '2018-09-21 12:30:27'), ('Automobile', '898.68', '2018-09-21 12:30:27'), ('Housing', '1247.27', '2018-09-11 12:30:27'), ('Food', '29.97', '2018-09-22 12:30:27'), ('Food', '5.72', '2018-09-22 12:30:27'), ('Social', '20.82', '2018-09-23 12:30:27'), ('Food', '18.73', '2018-09-23 12:30:27'), ('Food', '10.35', '2018-09-24 12:30:27'), ('Food', '10.35', '2018-09-25 12:30:27'), ('Health', '10.41', '2018-09-26 12:30:27'), ('Health', '13.22', '2018-09-27 12:30:27'), ('Transportation', '1526.03', '2018-12-19 13:30:27'), ('Food', '8.49', '2018-09-29 12:30:27'), ('Automobile', '63.98', '2018-09-30 12:30:27'), ('Home', '11.31', '2018-09-30 12:30:27'), ('Home', '89.27', '2018-09-30 12:30:27'), ('Home', '9.16', '2018-09-30 12:30:27'), ('Transportation', '14.55', '2018-10-01 12:30:27'), ('Food', '20.30', '2018-10-01 12:30:27'), ('Food', '3.84', '2018-10-03 12:30:27'), ('Food', '5.72', '2018-10-03 12:30:27'), ('Food', '1.66', '2018-10-03 12:30:27'), ('Food', '5.72', '2018-10-03 12:30:27'), ('Food', '6.24', '2018-10-03 12:30:27'), ('Food', '4.15', '2018-10-03 12:30:27'), ('Food', '3.64', '2018-10-03 12:30:27'), ('Food', '5.20', '2018-10-03 12:30:27'), ('Food', '3.32', '2018-10-03 12:30:27'), ('Food', '0.37', '2018-10-03 12:30:27'), ('Automobile', '307.17', '2018-10-05 12:30:27'), ('Food', '11.76', '2018-10-05 12:30:27'), ('Social', '17.70', '2018-10-06 12:30:27'), ('Health', '6.24', '2018-10-06 12:30:27'), ('Food', '5.72', '2018-10-06 12:30:27'), ('Social', '52.06', '2018-10-07 12:30:27'), ('Family', '4.54', '2018-10-07 12:30:27'), ('Communication', '16.64', '2018-10-10 12:30:27'), ('Communication', '16.64', '2018-11-10 13:30:27'), ('Communication', '16.64', '2018-12-10 13:30:27'), ('Software', '25.87', '2018-10-11 12:30:27'), ('Stationary', '5.21', '2018-10-11 12:30:27'), ('Food', '8.78', '2018-10-11 12:30:27'), ('Food', '19.97', '2018-10-11 12:30:27'), ('Social', '5.21', '2018-10-21 12:30:27'), ('Food', '8.17', '2018-10-12 12:30:27'), ('Food', '13.63', '2018-10-12 12:30:27'), ('Electronics', '14.78', '2018-10-12 12:30:27'), ('Accessory', '90.80', '2018-10-13 12:30:27'), ('Software', '36.44', '2018-10-14 12:30:27'), ('Food', '9.95', '2018-10-15 12:30:27'), ('Food', '32.62', '2018-10-15 12:30:27'), ('Electronics', '36.44', '2018-10-16 12:30:27'), ('Electronics', '44.07', '2018-10-16 12:30:27'), ('Home', '10.40', '2018-10-17 12:30:27'), ('Home', '8.32', '2018-10-17 12:30:27'), ('Tax', '1.63', '2018-10-17 12:30:27'), ('Miscellany', '20.82', '2018-10-17 12:30:27'), ('Stationary', '9.36', '2018-10-07 12:30:27'), ('Family', '10.40', '2018-10-17 12:30:27'), ('Family', '19.02', '2018-10-17 12:30:27'), ('Family', '16.80', '2018-10-17 12:30:27'), ('Housing', '1295.14', '2018-10-11 12:30:27'), ('Health', '24.99', '2018-10-19 12:30:27'), ('Health', '9.37', '2018-10-19 12:30:27'), ('Tax', '3.09', '2018-10-19 12:30:27'), ('Food', '17.02', '2018-10-19 12:30:27'), ('Food', '9.95', '2018-10-22 12:30:27'), ('Electronics', '103.07', '2018-10-21 12:30:27'), ('Automobile', '40.82', '2018-10-21 12:30:27'), ('Family', '17.02', '2018-10-21 12:30:27'), ('Family', '24.99', '2018-10-21 12:30:27'), ('Food', '6.24', '2018-10-24 12:30:27'), ('Food', '5.72', '2018-10-24 12:30:27'), ('Social', '45.61', '2018-10-27 12:30:27'), ('Food', '20.82', '2018-10-29 12:30:27'), ('Food', '17.02', '2018-10-28 12:30:27'), ('Electronics', '225.86', '2018-10-28 12:30:27'), ('Food', '17.02', '2018-10-27 12:30:27'), ('Food', '4.68', '2018-10-25 12:30:27'), ('Food', '9.16', '2018-10-30 12:30:27'), ('Education', '45.82', '2018-10-16 12:30:27'), ('Education', '4060.85', '2018-10-16 12:30:27'), ('Education', '4060.85', '2018-11-16 13:30:27'), ('Education', '4060.85', '2018-12-16 13:30:27'), ('Family', '22.91', '2018-10-30 12:30:27'), ('Family', '10.36', '2018-10-30 12:30:27'), ('Miscellany', '5.79', '2018-10-30 12:30:27'), ('Food', '20.82', '2018-10-31 12:30:27'), ('Education', '52.06', '2018-10-31 12:30:27'), ('Automobile', '45.71', '2018-11-02 12:30:27'), ('Food', '20.08', '2018-11-04 12:30:27'), ('Food', '9.95', '2018-11-03 12:30:27'), ('Food', '9.37', '2018-11-03 12:30:27'), ('Food', '8.07', '2018-11-03 12:30:27'), ('Food', '14.05', '2018-11-03 12:30:27'), ('Clothes', '202.03', '2018-11-04 12:30:27'), ('Food', '12.88', '2018-11-09 13:30:27'), ('Food', '15.77', '2018-11-08 13:30:27'), ('Food', '11.17', '2018-11-10 13:30:27'), ('Housing', '1264.03', '2018-11-10 13:30:27'), ('Education', '104.11', '2018-11-10 13:30:27'), ('Food', '4.15', '2018-11-10 13:30:27'), ('Food', '7.28', '2018-11-10 13:30:27'), ('Food', '1.66', '2018-11-10 13:30:27'), ('Food', '6.66', '2018-11-10 13:30:27'), ('Food', '0.26', '2018-11-10 13:30:27'), ('Invest', '14224.24', '2018-10-31 12:30:27'), ('Food', '18.74', '2018-11-16 13:30:27'), ('Food', '11.96', '2018-11-15 13:30:27'), ('Food', '9.08', '2018-11-14 13:30:27'), ('Software', '36.44', '2018-11-14 13:30:27'), ('Social', '15.62', '2018-11-14 13:30:27'), ('Food', '2.84', '2018-11-14 13:30:27'), ('Food', '10.79', '2018-11-14 13:30:27'), ('Miscellany', '7.55', '2018-11-14 13:30:27'), ('Food', '17.02', '2018-11-13 13:30:27'), ('Food', '15.77', '2018-11-10 13:30:27'), ('Electronics', '34.00', '2018-11-17 13:30:27'), ('Food', '15.09', '2018-11-16 13:30:27'), ('Automobile', '23.48', '2018-11-16 13:30:27'), ('Automobile', '25.01', '2018-11-16 13:30:27'), ('Home', '40.60', '2018-11-17 13:30:27'), ('Health', '20.82', '2018-11-17 13:30:27'), ('Food', '23.49', '2018-11-17 13:30:27'), ('Food', '8.07', '2018-11-16 13:30:27'), ('Miscellany', '34.35', '2018-11-17 13:30:27'), ('Miscellany', '34.35', '2018-11-17 13:30:27'), ('Food', '9.16', '2018-11-16 13:30:27'), ('Entertainment', '26.03', '2018-11-17 13:30:27'), ('Food', '8.07', '2018-11-19 13:30:27'), ('Food', '29.51', '2018-11-19 13:30:27'), ('Food', '9.16', '2018-11-19 13:30:27'), ('Food', '14.98', '2018-11-19 13:30:27'), ('Entertainment', '16.35', '2018-11-20 13:30:27'), ('Book', '10.40', '2018-11-20 13:30:27'), ('Social', '93.71', '2018-11-21 13:30:27'), ('Social', '155.94', '2018-11-21 13:30:27'), ('Family', '22.85', '2018-11-20 13:30:27'), ('Food', '11.45', '2018-11-21 13:30:27'), ('Electronics', '99.64', '2018-11-19 13:30:27'), ('Home', '25.60', '2018-11-19 13:30:27'), ('Health', '15.09', '2018-11-16 13:30:27'), ('Home', '40.60', '2018-11-17 13:30:27'), ('Sartorial', '56.50', '2018-11-19 13:30:27'), ('Sartorial', '15.59', '2018-11-19 13:30:27'), ('Food', '22.26', '2018-11-23 13:30:27'), ('Food', '35.87', '2018-11-22 13:30:27'), ('Food', '22.72', '2018-11-23 13:30:27'), ('Food', '6.46', '2018-11-24 13:30:27'), ('Food', '4.15', '2018-11-24 13:30:27'), ('Food', '6.24', '2018-11-24 13:30:27'), ('Food', '4.68', '2018-11-24 13:30:27'), ('Food', '10.40', '2018-11-24 13:30:27'), ('Food', '7.28', '2018-11-24 13:30:27'), ('Food', '4.15', '2018-11-24 13:30:27'), ('Food', '5.72', '2018-11-25 13:30:27'), ('Food', '6.24', '2018-11-25 13:30:27'), ('Food', '8.32', '2018-11-25 13:30:27'), ('Food', '7.28', '2018-11-25 13:30:27'), ('Food', '8.32', '2018-11-25 13:30:27'), ('Book', '10.18', '2018-11-25 13:30:27'), ('Electronics', '89.66', '2018-11-27 13:30:27'), ('Food', '14.98', '2018-11-26 13:30:27'), ('Food', '17.34', '2018-11-27 13:30:27'), ('Food', '21.87', '2018-11-28 13:30:27'), ('Food', '22.14', '2018-11-28 13:30:27'), ('Food', '18.16', '2018-12-01 13:30:27'), ('Communication', '6.98', '2018-12-01 13:30:27'), ('Food', '1.66', '2018-12-01 13:30:27'), ('Food', '5.92', '2018-12-01 13:30:27'), ('Food', '6.24', '2018-12-01 13:30:27'), ('Miscellany', '0.26', '2018-12-01 13:30:27'), ('Invest', '2555.41', '2018-11-30 13:30:27'), ('Automobile', '41.65', '2018-12-02 13:30:27'), ('Food', '7.28', '2018-12-06 13:30:27'), ('Food', '7.28', '2018-12-06 13:30:27'), ('Food', '10.18', '2018-12-06 13:30:27'), ('Family', '3.61', '2018-12-06 13:30:27'), ('Transportation', '41.65', '2018-12-02 13:30:27'), ('Food', '11.45', '2018-12-06 13:30:27'), ('Family', '20.77', '2018-12-04 13:30:27'), ('Health', '27.97', '2018-12-03 13:30:27'), ('Food', '11.45', '2018-12-04 13:30:27'), ('Food', '13.54', '2018-12-05 13:30:27'), ('Food', '8.07', '2018-12-05 13:30:27'), ('Education', '104.11', '2018-12-10 13:30:27'), ('Food', '20.82', '2018-12-10 13:30:27'), ('Food', '3.64', '2018-12-10 13:30:27'), ('Food', '4.68', '2018-12-10 13:30:27'), ('Food', '21.87', '2018-12-09 13:30:27'), ('Food', '9.16', '2018-12-10 13:30:27'), ('Health', '4.29', '2018-12-14 13:30:27'), ('Food', '8.80', '2018-12-13 13:30:27'), ('Food', '13.18', '2018-12-14 13:30:27'), ('Food', '11.45', '2018-12-13 13:30:27'), ('Food', '11.45', '2018-12-11 13:30:27'), ('Food', '12.39', '2018-12-14 13:30:27'), ('Food', '9.08', '2018-12-14 13:30:27'), ('Food', '9.01', '2018-12-12 13:30:27'), ('Family', '20.77', '2018-12-16 13:30:27'), ('Family', '26.03', '2018-12-16 13:30:27'), ('Tax', '4.22', '2018-12-16 13:30:27'), ('Electronics', '14.58', '2018-12-15 13:30:27'), ('Tax', '3.19', '2018-12-15 13:30:27'), ('Electronics', '3.03', '2018-12-15 13:30:27'), ('Health', '4.29', '2018-12-15 13:30:27'), ('Food', '12.39', '2018-12-15 13:30:27'), ('Food', '13.62', '2018-12-16 13:30:27'), ('Food', '11.45', '2018-12-16 13:30:27'), ('Electronics', '342.57', '2018-12-16 13:30:27'), ('Electronics', '5.21', '2018-12-16 13:30:27'), ('Electronics', '124.90', '2018-12-16 13:30:27'), ('Tax', '42.08', '2018-12-16 13:30:27'), ('Social', '58.31', '2018-12-15 13:30:27'), ('Entertainment', '15.62', '2018-12-16 13:30:27'), ('Transportation', '22.07', '2018-12-15 13:30:27'), ('Transportation', '21.73', '2018-12-15 13:30:27'), ('Transportation', '1.04', '2018-12-17 13:30:27'), ('Social', '5.21', '2018-12-17 13:30:27'), ('Social', '22.62', '2018-12-17 13:30:27'), ('Food', '11.45', '2018-12-17 13:30:27'), ('Software', '0.15', '2018-12-17 13:41:06'), ('Book', '1.13', '2018-12-17 13:41:06'), ('Automobile', '17.92', '2018-12-16 21:30:27'), ('Miscellany', '3.11', '2018-12-16 21:30:27'), ('Food', '12.75', '2018-12-19 13:30:27'), ('Transportation', '35.04', '2018-12-19 13:30:27'), ('Electronics', '112.88', '2018-12-19 13:30:27'), ('Food', '10.69', '2018-12-19 13:30:27'), ('Software', '1.03', '2018-12-18 13:30:27'), ('Software', '101.50', '2018-12-19 13:30:27'), ('Software', '10.40', '2018-12-20 13:30:27'), ('Transportation', '33.33', '2018-12-19 13:30:27'), ('Electronics', '27.27', '2018-12-20 13:30:27'), ('Health', '0.58', '2018-12-20 13:30:27'), ('Health', '0.68', '2018-12-20 13:30:27'), ('Food', '0.76', '2018-12-20 13:30:27'), ('Food', '4.24', '2018-12-20 13:30:27'), ('Transportation', '4.55', '2018-12-23 13:30:27'), ('Transportation', '1.21', '2018-12-23 13:30:27'), ('Food', '4.39', '2018-12-23 13:30:27'), ('Family', '30.30', '2018-12-23 13:30:27'), ('Entertainment', '10.30', '2018-12-23 13:30:27'), ('Health', '4.08', '2018-12-22 13:30:27'), ('Family', '1.35', '2018-12-22 13:30:27'), ('Family', '1.67', '2018-12-22 13:30:27'), ('Food', '5.30', '2018-12-23 13:30:27'), ('Transportation', '0.30', '2018-12-23 13:30:27'), ('Transportation', '2.73', '2018-12-23 13:30:27'), ('Food', '1.82', '2018-12-23 13:30:27'), ('Transportation', '1.82', '2018-12-23 13:30:27'), ('Food', '1.80', '2018-12-24 13:30:27'), ('Food', '2.73', '2018-12-24 13:30:27'), ('Book', '7.80', '2018-12-17 13:30:27'), ('Miscellany', '3.11', '2018-12-17 13:30:27'), ('Home', '101.50', '2018-12-19 13:30:27'), ('Transportation', '3.33', '2018-12-26 13:30:27'), ('Accessory', '4.24', '2018-12-26 13:30:27'), ('Accessory', '1.95', '2018-12-28 13:30:27'), ('Accessory', '3.64', '2018-12-30 13:30:27'), ('Invest', '587.29', '2018-12-31 13:30:27'), ('Invest', '731.55', '2018-09-30 13:30:27'), ('Invest', '768.84', '2018-08-31 13:30:27'); -- -- Indexes for dumped tables -- -- -- Indexes for table `Expenses` -- ALTER TABLE `Expenses` ADD KEY `time` (`time`); -- phpMyAdmin SQL Dump -- version 4.7.7 -- https://www.phpmyadmin.net/ -- -- Host: localhost:8889 -- Generation Time: Mar 17, 2019 at 10:24 AM -- Server version: 5.6.38 -- PHP Version: 7.2.1 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00";
the_stack
-- 2018-03-08T18:07:19.058 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Menu_ID,AD_Org_ID,AD_Window_ID,Created,CreatedBy,Description,EntityType,InternalName,IsActive,IsCreateNew,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy,WEBUI_NameBrowse) VALUES ('W',0,541056,0,168,TO_TIMESTAMP('2018-03-08 18:07:18','YYYY-MM-DD HH24:MI:SS'),100,'Inventurdaten eingeben','D','_Inventur','Y','N','N','N','N','Inventur',TO_TIMESTAMP('2018-03-08 18:07:18','YYYY-MM-DD HH24:MI:SS'),100,'Inventur') ; -- 2018-03-08T18:07:19.076 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Menu_ID, t.Description,t.Name,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=541056 AND NOT EXISTS (SELECT 1 FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID) ; -- 2018-03-08T18:07:19.078 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 541056, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=541056) ; -- 2018-03-08T18:07:19.255 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000052 AND AD_Tree_ID=10 ; -- 2018-03-08T18:07:19.263 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540791 AND AD_Tree_ID=10 ; -- 2018-03-08T18:07:19.264 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540980 AND AD_Tree_ID=10 ; -- 2018-03-08T18:07:19.264 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540805 AND AD_Tree_ID=10 ; -- 2018-03-08T18:07:19.265 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540800 AND AD_Tree_ID=10 ; -- 2018-03-08T18:07:19.266 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540981 AND AD_Tree_ID=10 ; -- 2018-03-08T18:07:19.267 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000053 AND AD_Tree_ID=10 ; -- 2018-03-08T18:07:19.268 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000061 AND AD_Tree_ID=10 ; -- 2018-03-08T18:07:19.269 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000069 AND AD_Tree_ID=10 ; -- 2018-03-08T18:07:19.270 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=541056 AND AD_Tree_ID=10 ; -- 2018-03-08T18:07:42.158 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-03-08 18:07:42','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Physical Inventory',Description='',WEBUI_NameBrowse='Physical Inventory' WHERE AD_Menu_ID=541056 AND AD_Language='en_US' ; -- 2018-03-08T18:08:47.712 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,255,540679,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100,'main') ; -- 2018-03-08T18:08:47.718 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540679 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID) ; -- 2018-03-08T18:08:47.778 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540909,540679,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:47.811 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540910,540679,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100,'Y',20,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:47.850 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540909,541512,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:47.902 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2681,0,255,541512,551224,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100,'Mandant für diese Installation.','Ein Mandant ist eine Firma oder eine juristische Person. Sie können keine Daten über Mandanten hinweg verwenden. .','Y','N','Y','Y','N','Mandant',10,10,0,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:47.932 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2682,0,255,541512,551225,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100,'Organisatorische Einheit des Mandanten','Eine Organisation ist ein Bereich ihres Mandanten - z.B. Laden oder Abteilung. Sie können Daten über Organisationen hinweg gemeinsam verwenden.','Y','N','Y','Y','N','Sektion',20,20,0,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:47.962 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2687,0,255,541512,551226,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100,'Document sequence number of the document','The document number is usually automatically generated by the system and determined by the document type of the document. If the document is not saved, the preliminary number is displayed in "<>". If the document type of your document has no automatic document sequence defined, the field is empty if you create a new document. This is for documents which usually have an external number (like vendor invoice). If you leave the field empty, the system will generate a document number for you. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_<TableName>", where TableName is the actual name of the table (e.g. C_Order).','Y','N','Y','Y','N','Nr.',30,30,0,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:47.992 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10812,0,255,541512,551227,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100,'Belegart oder Verarbeitungsvorgaben','Die Belegart bestimmt den Nummernkreis und die Vorgaben für die Belegverarbeitung.','Y','N','Y','Y','N','Belegart',40,40,0,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.022 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2683,0,255,541512,551228,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','Y','N','Beschreibung',50,50,0,TO_TIMESTAMP('2018-03-08 18:08:47','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.057 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2924,0,255,541512,551229,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Lager oder Ort für Dienstleistung','Das Lager identifiziert ein einzelnes Lager für Artikel oder einen Standort an dem Dienstleistungen geboten werden.','Y','N','Y','Y','N','Lager',60,60,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.103 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2923,0,255,541512,551230,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Rules for generating physical inventory','The Perpetual Inventory identifies the Perpetual Inventory rule which generated this Physical Inventory.','Y','N','Y','Y','N','Permanente Stichtagsinventur ',70,70,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.136 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2686,0,255,541512,551231,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Datum, an dem eine Produkt in oder aus dem Bestand bewegt wurde','"Bewegungs-Datum" bezeichnet das Datum, zu dem das Produkt in oder aus dem Bestand bewegt wurde Dies ist das Ergebnis einer Auslieferung, eines Wareneingangs oder einer Warenbewqegung.','Y','N','Y','Y','N','Bewegungsdatum',80,80,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.167 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2922,0,255,541512,551232,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Zählliste Bestand erstellen','Die Zeilen der Zählliste werden angelegt. Sie können weitere Zeilen hinzufügen oder Zeilen manuell löschen.','Y','N','Y','Y','N','Zählliste Bestand erstellen',90,90,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.201 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2925,0,255,541512,551233,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Die Buchmenge wird mit der derzeitigen Buchmenge aktualisiert','Der Prozess "Bestand aktualisieren" aktualisiert die Buchmenge mit der derzeitigen Buchmenge ','Y','N','Y','Y','N','Bestand aktualisieren ',100,100,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.237 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,7816,0,255,541512,551234,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Finanzprojekt','Ein Projekt erlaubt, interne oder externe Vorgäng zu verfolgen und zu kontrollieren.','Y','N','Y','Y','N','Projekt',110,110,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.267 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,7813,0,255,541512,551235,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Kostenstelle','Erfassung der zugehörigen Kostenstelle','Y','N','Y','Y','N','Kostenstelle',120,120,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.301 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,7814,0,255,541512,551236,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Marketing Campaign','The Campaign defines a unique marketing program. Projects can be associated with a pre defined Marketing Campaign. You can then report based on a specific Campaign.','Y','N','Y','Y','N','Werbemassnahme',130,130,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.330 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,7815,0,255,541512,551237,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Durchführende oder auslösende Organisation','Die Organisation, die diese Transaktion durchführt oder auslöst (für eine andere Organisation). Die besitzende Organisation muss nicht die durchführende Organisation sein. Dies kann bei zentralisierten Dienstleistungen oder Vorfällen zwischen Organisationen der Fall sein.','Y','N','Y','Y','N','Buchende Organisation',140,140,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.358 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,7812,0,255,541512,551238,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Nutzerdefiniertes Element Nr. 1','Das Nutzerdefinierte Element zeigt die optionalen Elementwerte an, die für diese Kontenkombination definiert sind.','Y','N','Y','Y','N','Nutzer 1',150,150,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.392 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,7811,0,255,541512,551239,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Nutzerdefiniertes Element Nr. 2','Das Nutzerdefinierte Element zeigt die optionalen Elementwerte an, die für diese Kontenkombination definiert sind.','Y','N','Y','Y','N','Nutzer 2',160,160,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.420 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10561,0,255,541512,551240,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Zeigt an, ob dieser Beleg eine Freigabe braucht','Das Selektionsfeld "Freigabe" zeigt an, dass dieser Beleg eine Freigabe braucht, bevor er verarbeitet werden kann','Y','N','Y','Y','N','Freigegeben',170,170,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.448 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10558,0,255,541512,551241,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Belegfreigabe-Betrag','Freigabe-Betrag für den Workflow','Y','N','Y','Y','N','Freigabe-Betrag',180,180,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.476 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10560,0,255,541512,551242,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'The current status of the document','The Document Status indicates the status of a document at this time. If you want to change the document status, use the Document Action field','Y','N','Y','Y','N','Belegstatus',190,190,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.506 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10559,0,255,541512,551243,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Bestandsliste verarbeiten und Bestand aktualisieren','Y','N','Y','Y','N','Bestandsliste verarbeiten',200,200,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.534 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,5142,0,255,541512,551244,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Posting status','The Posted field indicates the status of the Generation of General Ledger Accounting Lines ','Y','N','Y','Y','N','Verbucht',210,210,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.563 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,256,540680,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'main') ; -- 2018-03-08T18:08:48.563 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540680 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID) ; -- 2018-03-08T18:08:48.590 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540911,540680,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.616 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540911,541513,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.647 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2690,0,256,541513,551245,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Mandant für diese Installation.','Ein Mandant ist eine Firma oder eine juristische Person. Sie können keine Daten über Mandanten hinweg verwenden. .','Y','N','N','Y','N','Mandant',0,10,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.674 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2691,0,256,541513,551246,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Organisatorische Einheit des Mandanten','Eine Organisation ist ein Bereich ihres Mandanten - z.B. Laden oder Abteilung. Sie können Daten über Organisationen hinweg gemeinsam verwenden.','Y','N','N','Y','N','Sektion',0,20,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.704 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2694,0,256,541513,551247,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Parameter für eine physische Inventur','Bezeichnet die eindeutigen Parameter für eine physische Inventur','Y','N','N','Y','N','Inventur',0,30,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.732 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2926,0,256,541513,551248,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Einzelne Zeile in dem Dokument','Indicates the unique line for a document. It will also control the display order of the lines within a document.','Y','N','N','Y','N','Zeile Nr.',0,40,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.760 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2696,0,256,541513,551249,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Lagerort im Lager','"Lagerort" bezeichnet, wo im Lager ein Produkt aufzufinden ist.','Y','N','N','Y','N','Lagerort',0,50,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.788 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2697,0,256,541513,551250,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Produkt, Leistung, Artikel','Bezeichnet eine Einheit, die in dieser Organisation gekauft oder verkauft wird.','Y','N','N','Y','N','Produkt',0,60,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.816 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,6555,0,256,541513,551251,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Merkmals Ausprägungen zum Produkt','The values of the actual Product Attribute Instances. The product level attributes are defined on Product level.','Y','N','N','Y','N','Merkmale',0,70,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.843 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2699,0,256,541513,551252,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Gezählte Menge','"Zählmenge" zeigt die tatsächlich ermittelte Menge für ein Produkt im Bestand an.','Y','N','N','Y','N','Zählmenge',0,80,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.871 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2698,0,256,541513,551253,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Buchmenge','"Buchmenge" zeigt die im System gespeicherte Menge für ein Produkt im Bestand an.','Y','N','N','Y','N','Buchmenge',0,90,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.905 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2692,0,256,541513,551254,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Beschreibung',0,100,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.936 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,8290,0,256,541513,551255,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Type of inventory difference','The type of inventory difference determines which account is used. The default is the Inventory Difference account defined for the warehouse. Alternatively, you could select any charge. This allows you to account for Internal Use or extraordinary inventory losses.','Y','N','N','Y','N','Inventory Type',0,110,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:08:48.966 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,8289,0,256,541513,551256,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100,'Zusätzliche Kosten','Kosten gibt die Art der zusätzlichen Kosten an (Abwicklung, Fracht, Bankgebühren, ...)','Y','N','N','Y','N','Kosten',0,120,0,TO_TIMESTAMP('2018-03-08 18:08:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:13:16.205 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540910,541514,TO_TIMESTAMP('2018-03-08 18:13:16','YYYY-MM-DD HH24:MI:SS'),100,'Y','document',10,TO_TIMESTAMP('2018-03-08 18:13:16','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:13:21.613 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540910,541515,TO_TIMESTAMP('2018-03-08 18:13:21','YYYY-MM-DD HH24:MI:SS'),100,'Y','org',20,TO_TIMESTAMP('2018-03-08 18:13:21','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:13:36.028 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541515, SeqNo=10,Updated=TO_TIMESTAMP('2018-03-08 18:13:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551225 ; -- 2018-03-08T18:13:43.668 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541515, SeqNo=20,Updated=TO_TIMESTAMP('2018-03-08 18:13:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551224 ; -- 2018-03-08T18:13:55.003 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541514, SeqNo=10,Updated=TO_TIMESTAMP('2018-03-08 18:13:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551227 ; -- 2018-03-08T18:14:02.053 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541514, SeqNo=20,Updated=TO_TIMESTAMP('2018-03-08 18:14:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551226 ; -- 2018-03-08T18:14:20.457 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541514, SeqNo=30,Updated=TO_TIMESTAMP('2018-03-08 18:14:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551231 ; -- 2018-03-08T18:14:34.574 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540909,541516,TO_TIMESTAMP('2018-03-08 18:14:34','YYYY-MM-DD HH24:MI:SS'),100,'Y','description',20,TO_TIMESTAMP('2018-03-08 18:14:34','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-03-08T18:14:48.189 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541516, SeqNo=10,Updated=TO_TIMESTAMP('2018-03-08 18:14:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551228 ; -- 2018-03-08T18:17:19.118 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541514, SeqNo=40,Updated=TO_TIMESTAMP('2018-03-08 18:17:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551240 ; -- 2018-03-08T18:17:27.462 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541514, SeqNo=50,Updated=TO_TIMESTAMP('2018-03-08 18:17:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551241 ; -- 2018-03-08T18:19:10.276 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Table_Process (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Table_ID,AD_Window_ID,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,WEBUI_QuickAction,WEBUI_QuickAction_Default) VALUES (0,0,106,321,168,TO_TIMESTAMP('2018-03-08 18:19:10','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2018-03-08 18:19:10','YYYY-MM-DD HH24:MI:SS'),100,'N','N') ; -- 2018-03-08T18:19:55.774 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Table_Process (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Table_ID,AD_Window_ID,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,WEBUI_QuickAction,WEBUI_QuickAction_Default) VALUES (0,0,105,321,168,TO_TIMESTAMP('2018-03-08 18:19:55','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2018-03-08 18:19:55','YYYY-MM-DD HH24:MI:SS'),100,'N','N') ; -- 2018-03-08T18:20:09.218 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=551233 ; -- 2018-03-08T18:20:11.969 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=551232 ; -- 2018-03-08T18:35:40.335 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541516, SeqNo=20,Updated=TO_TIMESTAMP('2018-03-08 18:35:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551240 ; -- 2018-03-08T18:35:48.968 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541516, SeqNo=30,Updated=TO_TIMESTAMP('2018-03-08 18:35:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551241 ; -- 2018-03-08T18:36:15.017 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2018-03-08 18:36:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551228 ; -- 2018-03-08T18:36:20.152 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2018-03-08 18:36:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551241 ; -- 2018-03-08T18:36:22.944 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2018-03-08 18:36:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551240 ; -- 2018-03-08T18:37:48.905 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551243 ; -- 2018-03-08T18:37:48.914 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551237 ; -- 2018-03-08T18:37:48.924 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551224 ; -- 2018-03-08T18:37:48.929 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551238 ; -- 2018-03-08T18:37:48.933 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551239 ; -- 2018-03-08T18:37:48.937 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551230 ; -- 2018-03-08T18:37:48.940 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551234 ; -- 2018-03-08T18:37:48.944 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551244 ; -- 2018-03-08T18:37:48.947 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551236 ; -- 2018-03-08T18:37:48.950 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551227 ; -- 2018-03-08T18:37:48.952 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551226 ; -- 2018-03-08T18:37:48.955 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551231 ; -- 2018-03-08T18:37:48.956 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551229 ; -- 2018-03-08T18:37:48.959 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551235 ; -- 2018-03-08T18:37:48.961 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551240 ; -- 2018-03-08T18:37:48.963 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551241 ; -- 2018-03-08T18:37:48.964 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551242 ; -- 2018-03-08T18:37:48.965 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2018-03-08 18:37:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551225 ; -- 2018-03-08T18:39:00.128 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Datum',Updated=TO_TIMESTAMP('2018-03-08 18:39:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2686 ; -- 2018-03-08T18:39:05.231 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Status',Updated=TO_TIMESTAMP('2018-03-08 18:39:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10560 ; -- 2018-03-08T18:39:14.522 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Freigabe Betrag',Updated=TO_TIMESTAMP('2018-03-08 18:39:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10558 ; -- 2018-03-08T18:41:00.296 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2018-03-08 18:41:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551225 ; -- 2018-03-08T18:41:03.112 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2018-03-08 18:41:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551224 ; -- 2018-03-08T18:41:18.746 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2018-03-08 18:41:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551226 ; -- 2018-03-08T18:41:22.952 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2018-03-08 18:41:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551231 ; -- 2018-03-08T18:41:38.437 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2018-03-08 18:41:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551231 ; -- 2018-03-08T18:46:59.990 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:46:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551247 ; -- 2018-03-08T18:46:59.996 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:46:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551256 ; -- 2018-03-08T18:47:00.004 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-03-08 18:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551245 ; -- 2018-03-08T18:47:00.006 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2018-03-08 18:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551248 ; -- 2018-03-08T18:47:00.007 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2018-03-08 18:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551250 ; -- 2018-03-08T18:47:00.008 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2018-03-08 18:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551251 ; -- 2018-03-08T18:47:00.010 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2018-03-08 18:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551249 ; -- 2018-03-08T18:47:00.011 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2018-03-08 18:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551253 ; -- 2018-03-08T18:47:00.012 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2018-03-08 18:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551252 ; -- 2018-03-08T18:47:00.013 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2018-03-08 18:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551254 ; -- 2018-03-08T18:47:00.014 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2018-03-08 18:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551255 ; -- 2018-03-08T18:47:00.015 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2018-03-08 18:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551246 ; -- 2018-03-08T18:47:26.706 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2018-03-08 18:47:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551246 ; -- 2018-03-08T18:47:29.810 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2018-03-08 18:47:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551245 ; -- 2018-03-08T18:47:36.826 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2018-03-08 18:47:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551248 ; -- 2018-03-08T18:47:42.343 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='L',Updated=TO_TIMESTAMP('2018-03-08 18:47:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551250 ; -- 2018-03-08T18:48:27.010 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2018-03-08 18:48:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551248 ; -- 2018-03-08T18:48:28.919 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2018-03-08 18:48:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551250 ; -- 2018-03-08T18:48:30.348 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2018-03-08 18:48:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551251 ; -- 2018-03-08T18:48:32.137 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2018-03-08 18:48:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551249 ; -- 2018-03-08T18:48:33.677 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2018-03-08 18:48:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551253 ; -- 2018-03-08T18:48:34.699 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2018-03-08 18:48:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551252 ; -- 2018-03-08T18:48:36.281 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2018-03-08 18:48:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551254 ; -- 2018-03-08T18:48:37.921 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2018-03-08 18:48:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551255 ; -- 2018-03-08T18:48:41.250 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2018-03-08 18:48:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551246 ; -- 2018-03-08T18:48:46.473 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y', SeqNo=100,Updated=TO_TIMESTAMP('2018-03-08 18:48:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551245 ; -- 2018-03-08T18:48:46.939 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-03-08 18:48:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551248 ; -- 2018-03-08T18:48:47.423 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-03-08 18:48:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551250 ; -- 2018-03-08T18:48:47.918 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-03-08 18:48:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551251 ; -- 2018-03-08T18:48:48.269 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-03-08 18:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551249 ; -- 2018-03-08T18:48:48.847 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-03-08 18:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551253 ; -- 2018-03-08T18:48:49.432 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-03-08 18:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551252 ; -- 2018-03-08T18:48:49.829 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-03-08 18:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551254 ; -- 2018-03-08T18:48:50.172 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-03-08 18:48:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551255 ; -- 2018-03-08T18:48:52.160 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2018-03-08 18:48:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551246 ; -- 2018-03-08T18:51:16.274 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-03-08 18:51:16','YYYY-MM-DD HH24:MI:SS'),Name='Date' WHERE AD_Field_ID=2686 AND AD_Language='en_US' ; -- 2018-03-08T18:51:50.388 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-03-08 18:51:50','YYYY-MM-DD HH24:MI:SS'),Name='Status' WHERE AD_Field_ID=10560 AND AD_Language='en_US' ; -- 2018-03-08T18:53:16.411 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Inventur Art',Updated=TO_TIMESTAMP('2018-03-08 18:53:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8290 ; -- 2018-03-08T18:53:37.591 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Description='Bestandszählung Position',Updated=TO_TIMESTAMP('2018-03-08 18:53:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=256 ; -- 2018-03-08T18:53:45.955 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Description='Bestandszählung',Updated=TO_TIMESTAMP('2018-03-08 18:53:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=255 ; -- 2018-03-08T18:55:40.429 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Bestandszählungs Position',Updated=TO_TIMESTAMP('2018-03-08 18:55:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=256 ; -- 2018-03-08T19:04:36.181 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=10,Updated=TO_TIMESTAMP('2018-03-08 19:04:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551227 ; -- 2018-03-08T19:04:36.184 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=20,Updated=TO_TIMESTAMP('2018-03-08 19:04:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551231 ; -- 2018-03-08T19:04:36.186 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=30,Updated=TO_TIMESTAMP('2018-03-08 19:04:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551235 ; -- 2018-03-08T19:04:36.189 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=40,Updated=TO_TIMESTAMP('2018-03-08 19:04:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551225 ;
the_stack