Technology uncover: Dedecms stored procedures

Source: Internet
Author: User
Tags rar

First, related introduction

What is "stored procedure".
A stored procedure is a process that is written by flow control and SQL statements, which are compiled and optimized and stored in the database server, as long as it is invoked when used. By invoking the stored procedures, the CMS (Content Management System), forum, and so on to collect the results of the storage.



Second, add the article stored procedures

DROP PROCEDURE IF EXISTS addarchives;
CREATE PROCEDURE addarchives ($typeid int, $adminID int, $writer varchar (), $soruce varchar, $title varchar (), $bod Y Mediumtext)
BEGIN
IF $adminID is NULL THEN
SELECT MIN (ID) into $adminID from Dede_admin;
End IF;
IF $writer is NULL THEN
SET $writer = ';
End IF;
IF $soruce is NULL THEN
SET $soruce = ';
End IF;

INSERT into Dede_archives (typeID, Adminid, writer, source, title, pubdate, Senddate) VALUES ($typeid, $adminID, $writer, $soruce, $title, Unix_timestamp (), Unix_timestamp ());
INSERT into Dede_addonarticle (typeid, aid, body) VALUES ($typeid, last_insert_id (), $body);
End;

The code above creates a stored procedure called Addarchives to add the article. Parameter list:

1, $typeid
Column ID that represents the column that will be added to. You need to manually specify a column ID (see "Stored procedure call" below).

2, $adminID
Administrator ID, the administrator ID to use when adding. You need to manually specify an administrator ID (see "Stored procedure calls" below). If not specified, a minimal administrator ID is used by default.

3, $writer
The author of the article is the author of the article collected. If not collected, the default is null.

4, $soruce
The source of the article, if unspecified, defaults to null.

5, $title
Article title, refers to the collection of the title of the article. The caption is required, and the record will not be available for storage when it is empty.

6, $body
Article content, refers to the content of the article collected. Content is required, and empty-time records will not be available for storage.

Third, add the software stored procedures

DROP PROCEDURE IF EXISTS addsoft;
CREATE PROCEDURE addsoft ($channel int, $typeid int, $adminID int, $writer varchar (m), $soruce varchar (), $title varchar (varchar), $language (a), $softtype varchar (a), $os varchar (a), $accredit varchar (a), $softsize varchar (a), $offic Ialurl varchar, $officialDemo varchar, $softlinks text, $introduce text)
BEGIN
IF $adminID is NULL THEN
SELECT MIN (ID) into $adminID from Dede_admin;
End IF;
IF $writer is NULL THEN
SET $writer = ';
End IF;
IF $soruce is NULL THEN
SET $soruce = ';
End IF;
IF $officialUrl is NULL THEN
SET $officialUrl = ';
End IF;
IF $officialDemo is NULL THEN
SET $officialDemo = ';
End IF;
IF $introduce is NULL THEN
SET $introduce = ';
End IF;

INSERT into Dede_archives (channel, typeID, Adminid, writer, source, title, pubdate, Senddate) VALUES ($channel, $typeid, $adminID, $writer, $soruce, $title, Unix_timestamp (), Unix_timestamp ());
INSERT into Dede_addonsoft (typeid, aid, language, Softtype, OS, accredit, Softsize, Officialurl, Officialdemo, softlinks , introduce) VALUES ($typeid, last_insert_id (), $language, $softtype, $os, $accredit, $softsize, $OFFICIALURL, $officialD Emo, $softlinks, $introduce);
End;

The code above creates a stored procedure called Addsoft to add a reply. Parameter list:

1, $channel
Channel ID that represents the channel that will be added to. You need to manually specify a channel ID (see "Stored procedure call" below).

2, $typeid
Column ID that represents the column that will be added to. You need to manually specify a column ID (see "Stored procedure call" below).

3, $adminID
Administrator ID, the administrator ID to use when adding. You need to manually specify an administrator ID (see "Stored procedure calls" below). If not specified, a minimal administrator ID is used by default.

4, $writer
Software author, the author of a software collection. If not collected, the default is null.

5, $soruce
The source of the software, if unspecified, defaults to null.

6, $title
Software name, refers to the acquisition of the software name. The name is required, and the record will not be available for storage when it is empty.

7, $language
Interface language, must be.

8, $softtype
Software type, must be.

9, $os
To run the environment, you must.

10, $accredit
Authorization method, must.

11, $softsize
Software size, must be.

12, $OFFICIALURL
Official web site, optional.

13, $officialDemo
Demo URL, optional.

14, $softlinks
Software Links list, must be. A linked list is a field in which you save multiple download addresses, and the DEDECMS link list format is:

{dede:link text= ' local download 1 '} http://www.aaa.com/down/file.rar {/dede:link}
{dede:link text= ' local download 2 '} http://www.bbb.com/down/file.rar {/dede:link}

Therefore, the collection must be replaced with the results of the link to the above format. (see "Capture result substitution" in software help)

13, $introduce
Software introduction, optional.

Original address: http://bbs.sensite.cn/viewthread.php?tid=10&page=1&extra=page=1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.