Using system;
Using system. runtime. interopservices;
Namespace nativedll
{/// /// Summary of SerialPort./// Public class SerialPort{# Region declares the APIS related to serial call to be referenced// Win32 API ConstantsPrivate const uint generic_read = 0x80000000;Private const uint generic_write = 0x40000000;Private const int open_existing = 3;Private const int invalid_handle_value =-1;Private const int maxblock = 4096;
Private const uint purge_txabort = 0x0001; // kill the pendin
=" 115 "/>
Important:
* The TO_NUMBER () function is not considered;
* The TO_CHAR () function is the focus;
* The TO_DATE () function is the secondary focus.
5-General functions (CORE)
There are two common functions: NVL) and DECODE (). These two functions are Oracle's own special functions;
1. NVL () function, processing null
Example 26:: Query the total annual salary of each employee.
SQL> SELECT ename, sal, comm, (sal +
Compare two files in linux, and compare two files in linux
Recently, I am writing a script to compare the configuration IP address of the/etc/dhcpd file with the IP address obtained by arp-n. This requires finding out the difference between the two output files-that is, there is no part in file 1 but in file 2, or there is a part in file 2 but not in file 1. There are four common methods on the Internet to implement this function. However, in actual tests, it is found that the results of one met
Java serial port communication API description Java serial port communication
Java serial communication API descriptionJava Serial CommunicationJava provides the communicationapi (included in the javax. Comm package) for controlling various external devices in a machine-independent manner. Communications API is an extension of standard Java, which is not included in Java API. Therefore, you must first download this extension class library fro
/html/[[email protected] html]# lsindex.htmlAt this point, according to normal situation, because there is a index.html page in the HTML directory, if we refresh the browser page, we should jump to the index.html pageBut the fact that we found that the page is still on this test page, exactly why? This is related to our selinux security strategy, we can go to /var/log/audit This directory to view audit.log This file, to find out the error message[[emailprotected] html]# tail/var/log/audit/audit.
1. General method of calling stored procedures
Let's assume that there is a stored procedure dt_users in SQL Server:
CREATE PROCEDURE [dbo]. [Dt_users]
As
SELECT * from Users
Return
Go
The first approach is to not use the command object, directly using the Recordset object
Set Rs=server.createobject ("Adodb.recordset")
Sql= "Exec dt_users"
Rs.Open sql,conn,1,1 so you can
The second approach is to take advantage of the Command object
Set Comm=server.cr
1. General method of calling stored procedures
Let's assume that there is a stored procedure dt_users in SQL Server:
CREATE PROCEDURE [dbo]. [Dt_users]
As
SELECT * from Users
Return
Go
The first approach is to not use the command object, directly using the Recordset object
Set Rs=server.createobject ("Adodb.recordset")
Sql= "Exec dt_users"
Rs.Open sql,conn,1,1 so you can
The second approach is to take advantage of the Command object
Set Comm=server.cr
execution is displayed as ename. Only double quotes are given to it to show the following significant lowercase
Null value
Overview: Null values are invalid, unspecified, unknown, or unpredictable values. Null value is not equal to 0 or space
For example: select Empno, ename, Sal, comm from emp;--the Comm properties of some records will show a blank, i.e. null value
INSERT into student (age) VALUES (24
Copy Code code as follows:
--Execution order from Where Select
SELECT * FROM
(select Sal as salary,comm as commission from EMP) x where salary--Draw Name Work as a Job
Select Ename + ' Work as a ' +job as msg from EMP where deptno=10
--If the employee pay less than 2000 returns underpaid greater than or equal to 4k return OK between overpaid
Select Ename,sal,
Case when salWhen sal>=4000 then ' overpaid '
Else
' OK '
End
From EMP
--Ran
Stored procedure 1. General method of calling stored procedures
Let's assume that there is a stored procedure dt_users in SQL Server:
CREATE PROCEDURE [dbo]. [Dt_users]
As
SELECT * from Users
Return
Go
The first approach is to not use the command object, directly using the Recordset object
Set Rs=server.createobject ("Adodb.recordset")
Sql= "Exec dt_users"
Rs.Open sql,conn,1,1 so you can
The second approach is to take advantage of the Command object
Set Comm
value itself is returned EX1 (common)Example: If an employee does not have a commission, 0 is displayed, otherwise the Commission is displayedSelect COMM,NVL (comm,0) from EMP;Nullif (EX1,EX2):value is equal to NULL, otherwise the first value is returnedExample: If wages and commissions are equal, the display is empty, otherwise the wages are displayedSelect Nullif (Sal,
the specified query which table;5, distinct optional, refers to the display of the results, whether to eliminate duplicate data;6, where condition. A simple query statement1) Query all columnsSql>select * from table name; 2) query the specified columnSql>select column 1, column 2, column 3,.. from table name; 3) How to cancel duplicate rowsSql>select distinct deptno,job from EMP; 4) Inquire about SMITH's salary, job, departmentSql>select Sal,job,deptno from emp where ename= ' SMITH '; Special a
SELECT * from EMP where deptno=30;--1 selects all employees in department 30.Select Ename,job,empno,deptno from emp where job= ' clerk ';--2 lists the name, employee number, and department number of all clerks (clerk).Select Ename, Sal,comm from EMP where comm>sal;--3 find employees with bonuses above their salaries.Select Ename, Sal,comm from EMP where
Label:numeric functions1, take the whole function (ceil up, floor down rounding)Select Ceil (66.6) N1,floor (66.6) N2 from dual;2, exponentiation (Power) and square root (sqrt)Select Power (3,2) n1,sqrt (9) N2 from dual;3, redundancySelect mod (9,5) from dual;4, returns a fixed number of decimal digits (round: Rounding, Trunc: direct truncation)Select Round (66.667,2) N1,trunc (66.667,2) N2 from dual;5, the sign of the return value (positive return is 1, negative number is-1)Select sign ( -32),
ask some students not to tangle with some code, or the topic unrelated to SQL injection. You can see the results of the execution: This is the SQL statement for SQL profile tracking. The injected code is as follows: or 1=1-' Here someone set username for "B ' or 1=1–". The actual execution of SQL becomes the following: It is clear that SQL injection was successful. Many people know that parameterized queries can avoid the injection problems that occur above, such as the following code
types in the current session (only valid for the current session) Alter session set nls_date_format= ' YYYY-MM-DD '; Valid only for the current session 4) Use the Date type function Sql> SELECT * from emp where hiredate>to_date (' 1981-12-31 ', ' yyyy-mm-dd ');OrSql> SELECT * from emp where TO_CHAR (hiredate, ' yyyy-mm-dd ') > ' 1981-12-31 ';Syntax: to_char (date, ' Format_model ')Syntax: to_date (str, ' Format_model ') 3. Sorting Syntax: ORDER BY column name ASC/DESC Note: column names here c
Basic query:
Copy Code code as follows:
--Query all employees for information
SELECT * from EMP;
--Set line width
Set Linesize 120;
--Sets the width of the column width to four digits
Col empno for 9999;
--Set column width, a indicates a string of eight-bit length
Col ename for A8
---Set pagesize display 30 records per page
Set PageSize 30;
Arithmetic expressions are supported in--sql, note: If an expression contains a null value, the entire expression is empty
code is as follows
Copy Code
Select COUNT (*) from Users where Password = ' a ' and UserName = ' B ' or 1=1-' there is someone who sets the UserName to "B" or 1=1–.
The actual execution of SQL becomes the following:
It's obvious that the SQL injection was successful.
Many people know that parameterized queries can avoid the injection problems that appear above, such as the following code:
The code is as follows
Copy Code
Class Progr
if exists (SELECT * from UserInfo where fullname= @infullname and password= @inpassword)
Select @outcheck = ' Yes '
Else
Select @outcheck = ' No '
Note: This establishes a stored procedure with three parameters, the first parameter @infullname, this is an input parameter, (username), the second parameter @inpassword, is also an input parameter, (the password), the third parameter @outcheck, this is an output parameter, (whether this user exists), the word "output" must be added after the data
string must be only numericSelect '123', To_number ('123.000') fromdual;--NVL is equivalent to the conditional operator in Java A?B:C--Check all employees ' names, positions, salaries, commissions and total wagesSelectEname,job,sal,comm,sal+Comm Income fromEMP;SelectENAME,JOB,SAL,NVL (Comm,o) comm,sal+NVL (
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.