Some principles of functional modules of knowledge tree software in database

Source: Internet
Author: User

The main functions of the knowledge tree software are to query, add, modify, and delete the following code that is used in the database for each function execution:

Inquire
String s=in.nextline ();/* user input content to query */
String s= "SELECT * from book where book_id=" +s+ "or jie_id=" +s+ "or zhang_id=" +s;

Modify
int I=in.nextint ();
/* Chapter name */if (i==1)
{
String s1=in.nextline ();//Chapter Name
int S2=in.nextint ();//zhang_id
String s= "Update book set zhang_name=" +s1+ "where zhang_id=" +S2;
}

/* Section name */if (i==2)
{
String s1=in.nextline ();//section name
int S2=in.nextint ();//zhang_id
int S3=in.nextint ();//jie_id
Update book set jie_name= "+s1/* user input */+" where zhang_id= "+s2/* user selects */+" and jie_id= "+s3/* user choice */;
}

/* Content */
Update book set book_view= "+text/* user input (the current page all data as a predetermined input, and then the user modifies the confirmation) */+" where zhang_id= "+in.nextint ()/* User select */+" and Jie_ Id= "+in.nextint ()/* User selected */+" and book_id= "+in.nextint ()/* current page; */;


Delete
int I=in.nextint ();
/* Chapter */if (i==1)
{
int S1=in.nextint ();//zhang_id
String s= "Delete from * where zhang_id=" +s1/* user input */;
}

/* Festival */if (i==2)
{
int S1=in.nextint ();//zhang_id
int S2=in.nextint ();//jie_id
String s= "Delete from * where zhang_id=" +s1/* user input */+ "and jie_id" +s2/* user input */
}

Add
int I=in.nextint ();
/* Chapter */if (i==1)
{
int S1=in.nextint ();//zhang_id
String s2=in.nextline ();//Chapter Name
String s= "INSERT INTO book values (" +s1+ ", Null,null," +s2+ ", Null,null,null)"
}

/* Festival */if (i==2)
{
int S1=in.nextint ();//zhang_id
int S2=in.nextint ();//jie_id
String s3=in.nextline ();//section name
String s= "Delete from book where zhang_id=" +s1+ "and Jie_id=null;insert to book values (" +s1+ "," +s2+ ", NULL, (select Zhang _name from book where zhang_id= "+s1+") + "," +s3+ ", Null,null)"
}

/* Segment */if (i==3)
{
int S1=in.nextint ();//zhang_id
int S2=in.nextint ();//jie_id
int S3=in.nextint ();//book_id
String s4=in.nextline ();//Segment Name
String s= "Delete from book where zhang_id=" +s1+ "and jie_id=" +s2+ "and book_id=null;
INSERT into Zhang values ("+s1+", "+s2+", "+s3+", [select Zhang_name from book where zhang_id= "+s1+") + "," (Select Jie_name From book where zhang_id= "+s1+" and Jie_id= "+s2+") + "," +s4+ ", null)"
}

/* Content */if (i==4)
Insert into book (Zhang_id,jie_id,book_id,zhang_name,jie_name,book_name,book_view)
VALUES (1,1,1, ' Software Engineering Overview ', ' Software crisis ', ' Introduction to Software crisis ', '
Software crisis: Refers to the development of computer software and maintenance process encountered a series of serious problems.
‘);

Some principles of functional modules of knowledge tree software in database

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.