Skip to content

Commit fd8eac3

Browse files
committed
Align with changes in dependencies.
1 parent 6d1e300 commit fd8eac3

9 files changed

+118
-117
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11

22
/.idea/
3-
/.phpunit.result.cache
3+
/.phpunit.cache/
44
/bin/
55
/composer.lock
6-
/custom.task.properties
7-
/custom.type.properties
86
/doc/
97
/test/TestDataLayer.php
108
/test/coverage.xml

composer.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@
1111
"plaisio/blob-store": "^1.3.0",
1212
"plaisio/company-resolver": "^2.1.0",
1313
"plaisio/kernel": "^3.2.1",
14-
"setbased/helper-program-execution": "^1.2.0"
14+
"setbased/helper-program-execution": "^1.2.0",
15+
"setbased/php-stratum-mysql": "^7.0.0"
1516
},
16-
"minimum-stability": "dev",
17-
"prefer-stable": true,
1817
"require-dev": {
19-
"phing/phing": "^3.0.0-RC4",
20-
"phpunit/phpunit": "^9.6.3",
18+
"phing/phing": "^3.0.0",
19+
"phpunit/phpunit": "^10.5.35",
2120
"plaisio/company-resolver-uni": "^2.1.0",
2221
"plaisio/console-kernel": "^1.0.0",
2322
"setbased/php-stratum": "^6.3.1",
24-
"setbased/php-stratum-backend": "^6.0.0",
25-
"setbased/php-stratum-mysql": "^6.6.0"
23+
"setbased/php-stratum-backend": "^6.0.0"
2624
},
2725
"autoload": {
2826
"psr-4": {

lib/psql/abc_blob_store_blob/abc_blob_store_blob_del_blob.psql

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
*
77
* @type none
88
*/
9-
create procedure abc_blob_store_blob_del_blob(in p_cmp_id @abc_blob.cmp_id%type@,
10-
in p_blb_id @abc_blob.blb_id%type@)
11-
modifies sql data
9+
create procedure abc_blob_store_blob_del_blob
10+
(
11+
in p_cmp_id smallint(5) unsigned, -- type: ABC_BLOB.cmp_id
12+
in p_blb_id int(10) unsigned -- type: ABC_BLOB.blb_id
13+
)
14+
modifies sql data
1215
begin
13-
delete from ABC_BLOB
16+
delete
17+
from ABC_BLOB
1418
where cmp_id = p_cmp_id
15-
and blb_id = p_blb_id
16-
;
19+
and blb_id = p_blb_id;
1720
end

lib/psql/abc_blob_store_blob/abc_blob_store_blob_get_blob.psql

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66
*
77
* @type row1
88
*/
9-
create procedure abc_blob_store_blob_get_blob(in p_cmp_id @abc_blob.cmp_id%type@,
10-
in p_blb_id @abc_blob.blb_id%type@)
11-
reads sql data
9+
create procedure abc_blob_store_blob_get_blob
10+
(
11+
in p_cmp_id smallint(5) unsigned, -- type: ABC_BLOB.cmp_id
12+
in p_blb_id int(10) unsigned -- type: ABC_BLOB.blb_id
13+
)
14+
reads sql data
1215
begin
1316
select blb.blb_id
14-
, hex(blb.blb_md5) blb_md5
15-
, blb.blb_size
16-
, blb.blb_filename
17-
, blb.blb_mime_type
18-
, blb.blb_timestamp
19-
, bdt.bdt_data blb_data
20-
from ABC_BLOB blb
21-
inner join ABC_BLOB_DATA bdt on blb.bdt_id = bdt.bdt_id
22-
where blb.blb_id = p_blb_id
23-
and blb.cmp_id = p_cmp_id
24-
;
17+
, hex(blb.blb_md5) as blb_md5
18+
, blb.blb_size
19+
, blb.blb_filename
20+
, blb.blb_mime_type
21+
, blb.blb_timestamp
22+
, bdt.bdt_data as blb_data
23+
from ABC_BLOB blb
24+
join ABC_BLOB_DATA bdt on blb.bdt_id = bdt.bdt_id
25+
where blb.blb_id = p_blb_id
26+
and blb.cmp_id = p_cmp_id;
2527
end

lib/psql/abc_blob_store_blob/abc_blob_store_blob_get_metadata.psql

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@
66
*
77
* @type row1
88
*/
9-
create procedure abc_blob_store_blob_get_metadata(in p_cmp_id @abc_blob.cmp_id%type@,
10-
in p_blb_id @abc_blob.blb_id%type@)
11-
reads sql data
9+
create procedure abc_blob_store_blob_get_metadata
10+
(
11+
in p_cmp_id smallint(5) unsigned, -- type: ABC_BLOB.cmp_id
12+
in p_blb_id int(10) unsigned -- type: ABC_BLOB.blb_id
13+
)
14+
reads sql data
1215
begin
1316
select blb_id
14-
, hex(blb_md5) blb_md5
15-
, blb_size
16-
, blb_filename
17-
, blb_mime_type
18-
, blb_timestamp
19-
from ABC_BLOB
20-
where blb_id = p_blb_id
21-
and cmp_id = p_cmp_id
22-
;
17+
, hex(blb_md5) as blb_md5
18+
, blb_size
19+
, blb_filename
20+
, blb_mime_type
21+
, blb_timestamp
22+
from ABC_BLOB
23+
where blb_id = p_blb_id
24+
and cmp_id = p_cmp_id;
2325
end

lib/psql/abc_blob_store_blob/abc_blob_store_blob_get_metadata_by_md5.psql

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@
66
*
77
* @type rows
88
*/
9-
create procedure abc_blob_store_blob_get_metadata_by_md5(in p_cmp_id @abc_blob.cmp_id%type@,
10-
in p_blb_md5 varchar(32))
11-
reads sql data
9+
create procedure abc_blob_store_blob_get_metadata_by_md5
10+
(
11+
in p_cmp_id smallint(5) unsigned, -- type: ABC_BLOB.cmp_id
12+
in p_blb_md5 varchar(32)
13+
)
14+
reads sql data
1215
begin
1316
select blb_id
14-
, hex(blb_md5) blb_md5
15-
, blb_size
16-
, blb_filename
17-
, blb_mime_type
18-
, blb_timestamp
19-
from ABC_BLOB
20-
where cmp_id = p_cmp_id
21-
and blb_md5 = unhex(p_blb_md5)
22-
;
17+
, hex(blb_md5) as blb_md5
18+
, blb_size
19+
, blb_filename
20+
, blb_mime_type
21+
, blb_timestamp
22+
from ABC_BLOB
23+
where cmp_id = p_cmp_id
24+
and blb_md5 = unhex(p_blb_md5);
2325
end

lib/psql/abc_blob_store_blob/abc_blob_store_blob_insert_blob.psql

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,85 +10,81 @@
1010
*
1111
* @type none
1212
*/
13-
create procedure abc_blob_store_blob_insert_blob(in p_cmp_id @abc_blob.cmp_id%type@,
14-
in p_blb_filename @abc_blob.blb_filename%type@,
15-
in p_blb_mime_type @abc_blob.blb_mime_type%type@,
16-
in p_blb_timestamp @abc_blob.blb_timestamp%type@,
17-
in p_bdt_data @abc_blob_data.bdt_data%type@)
18-
modifies sql data
13+
create procedure abc_blob_store_blob_insert_blob
14+
(
15+
in p_cmp_id smallint(5) unsigned, -- type: ABC_BLOB.cmp_id
16+
in p_blb_filename varchar(255) character set utf8mb4, -- type: ABC_BLOB.blb_filename
17+
in p_blb_mime_type varchar(100) character set utf8mb4, -- type: ABC_BLOB.blb_mime_type
18+
in p_blb_timestamp timestamp, -- type: ABC_BLOB.blb_timestamp
19+
in p_bdt_data longblob -- type: ABC_BLOB_DATA.bdt_data
20+
)
21+
modifies sql data
1922
begin
20-
declare l_done boolean;
21-
declare l_blb_id @abc_blob.blb_id%type@;
22-
declare l_bdt_id @abc_blob.bdt_id%type@;
23-
declare l_blb_md5 @abc_blob.blb_md5%type@;
24-
declare l_blb_size @abc_blob.blb_size%type@;
25-
declare l_bdt_data @abc_blob_data.bdt_data%type@;
23+
declare l_done boolean;
24+
declare l_blb_id int(10) unsigned; -- type: ABC_BLOB.blb_id
25+
declare l_bdt_id int(10) unsigned; -- type: ABC_BLOB.bdt_id
26+
declare l_blb_md5 binary(16); -- type: ABC_BLOB.blb_md5
27+
declare l_blb_size int(10) unsigned; -- type: ABC_BLOB.blb_size
28+
declare l_bdt_data longblob; -- type: ABC_BLOB_DATA.bdt_data
2629

27-
declare c_data cursor
28-
for
29-
select bdt_id
30-
, bdt_data
31-
from ABC_BLOB_DATA
32-
where cmp_id = p_cmp_id
33-
and bdt_md5 = l_blb_md5
34-
;
30+
declare c_data cursor for select bdt_id
31+
, bdt_data
32+
from ABC_BLOB_DATA
33+
where cmp_id = p_cmp_id
34+
and bdt_md5 = l_blb_md5;
3535

3636
declare continue handler for sqlstate '02000' set l_done = true;
3737

38-
set l_blb_md5 = unhex(md5(p_bdt_data));
38+
set l_blb_md5 = unhex(md5(p_bdt_data));
3939
set l_blb_size = length(p_bdt_data);
4040

41-
if (l_blb_size=0) then
42-
call abc_misc_raise_exception( 'Size of '''||p_blb_filename||''' is zero.' );
41+
if (l_blb_size = 0) then
42+
call abc_misc_raise_exception('Size of ''' || p_blb_filename || ''' is zero.');
4343
end if;
4444

4545
-- Search for BLOB data equal to p_bdt_data.
4646
open c_data;
47-
loop1: loop
47+
loop1:
48+
loop
4849
set l_done = false;
49-
fetch c_data
50-
into l_bdt_id
51-
, l_bdt_data
52-
;
50+
fetch c_data into l_bdt_id , l_bdt_data;
5351
if (l_done) then
5452
close c_data;
5553
leave loop1;
5654
end if;
5755

58-
if (p_bdt_data=l_bdt_data) then
56+
if (p_bdt_data = l_bdt_data) then
5957
close c_data;
6058
leave loop1;
6159
end if;
6260
end loop;
6361

64-
if (l_done=true) then
62+
if (l_done = true) then
6563
-- We left the loop without finding a matching BLOB.
6664
insert into ABC_BLOB_DATA( cmp_id
67-
, bdt_md5
68-
, bdt_data )
69-
values( p_cmp_id
70-
, l_blb_md5
71-
, p_bdt_data )
72-
;
65+
, bdt_md5
66+
, bdt_data )
67+
values ( p_cmp_id
68+
, l_blb_md5
69+
, p_bdt_data );
7370

7471
set l_bdt_id = last_insert_id();
7572
end if;
7673

7774
insert into ABC_BLOB( cmp_id
78-
, bdt_id
79-
, blb_md5
80-
, blb_size
81-
, blb_mime_type
82-
, blb_filename
83-
, blb_timestamp )
84-
values( p_cmp_id
85-
, l_bdt_id
86-
, l_blb_md5
87-
, l_blb_size
88-
, p_blb_mime_type
89-
, p_blb_filename
90-
, ifnull(p_blb_timestamp, now()) )
91-
;
75+
, bdt_id
76+
, blb_md5
77+
, blb_size
78+
, blb_mime_type
79+
, blb_filename
80+
, blb_timestamp )
81+
values ( p_cmp_id
82+
, l_bdt_id
83+
, l_blb_md5
84+
, l_blb_size
85+
, p_blb_mime_type
86+
, p_blb_filename
87+
, ifnull(p_blb_timestamp, now()) );
9288

9389
-- select last_insert_id() blb_id;
9490
-- Retrieve blb_id using abc_blob_store_blob_workaround.
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
/**
22
* Work-a-round for bug with loop and BLOB in PHP for retrieving blb_id.
33
*
4-
* @type singleton1
5-
*
6-
* @return int
4+
* @type singleton1 int
75
*/
8-
create procedure abc_blob_store_blob_workaround()
9-
modifies sql data
6+
create procedure abc_blob_store_blob_workaround ()
7+
modifies sql data
108
begin
119
select @blb_id;
1210
end

phpunit.xml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="test/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage processUncoveredFiles="true">
4-
<include>
5-
<directory suffix=".php">src</directory>
6-
</include>
7-
<exclude>
8-
<directory suffix=".php">vendor/setbased</directory>
9-
</exclude>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="test/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache">
3+
<coverage>
104
<report>
115
<clover outputFile="test/coverage.xml"/>
126
<html outputDirectory="test/report"/>
@@ -18,4 +12,12 @@
1812
</testsuite>
1913
</testsuites>
2014
<logging/>
15+
<source>
16+
<include>
17+
<directory suffix=".php">src</directory>
18+
</include>
19+
<exclude>
20+
<directory suffix=".php">vendor/setbased</directory>
21+
</exclude>
22+
</source>
2123
</phpunit>

0 commit comments

Comments
 (0)