projects
/
Pman.Core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
52e4743
)
mysql/core_images_count.sql
author
edward
<edward@roojs.com>
Mon, 19 Mar 2018 03:26:40 +0000
(11:26 +0800)
committer
edward
<edward@roojs.com>
Mon, 19 Mar 2018 03:26:40 +0000
(11:26 +0800)
mysql/core_images_count.sql
patch
|
blob
|
history
diff --git
a/mysql/core_images_count.sql
b/mysql/core_images_count.sql
index
ee33a48
..
83b1cb8
100644
(file)
--- a/
mysql/core_images_count.sql
+++ b/
mysql/core_images_count.sql
@@
-1,10
+1,20
@@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-/**
- * Author: edward
- * Created: Mar 19, 2018
- */
+DROP FUNCTION IF EXISTS core_images_count;
+
+DELIMITER $$
+CREATE FUNCTION core_images_count(
+ in_ontable VARCHAR(128),
+ in_onid INT(11)
+)
+RETURNS INT(4) NOT DETERMINISTIC READS SQL DATA
+ BEGIN
+
+ DECLARE v_ret INT(4);
+
+ SELECT COUNT(id) INTO v_ret FROM Images WHERE ontable = in_ontable AND onid = in_onid;
+
+ RETURN v_ret;
+
+ END $$
+
+DELIMITER ;
\ No newline at end of file