Overview of H2 database functions and data types

Source: Internet
Author: User
Tags decrypt sha256 algorithm uuid

Overview of H2 database functions and data types

Chszs, reprint need to indicate. Blog home:Http://blog.csdn.net/chszs

First, H2 database common data types

int type: corresponding Java.lang.Integer

Real type: corresponding java.lang.Float

Double type: Corresponding java.lang.Double

Decimal type: Corresponds to Java.math.BigDecimal, such as decimal (20,2)

Char type: corresponding java.lang.String, e.g. char (10)

VARCHAR type: corresponding java.lang.String

Varchar_ignorecase type: Corresponding java.lang.String, ignoring case

Boolean type: Corresponding Java.lang.Boolean

Time type: corresponding Java.sql.Time, when converted to Java.sql.Date, the date will be set to 1970-01-01

Date type: Corresponds to Java.sql.Date, formatted as YYYY-MM-DD, whose time defaults to 00:00:00

Timestamp type: Corresponding Java.sql.Timestamp, formatted as YYYY-MM-DD hh:mm:ss[.nnnnnnnnn], also supports java.util.Date

tinyint type: corresponding java.lang.byte,-128 to 127

Smartint type: corresponding java.lang.short,-32768 to 32767

bigint type: Corresponding Java.lang.Long

Identity type: Self-increment type, corresponding Java.lang.Long, value range -9223372036854775808 to 9223372036854775807

Binary type: Binary byte storage, maximum not exceeding 2GB, and fully stored in memory, such as binary (1000)

Blob type: Corresponds to Java.sql.Blob, similar to binary, but for very large data (such as files or images), and is not fully stored in memory, using Preparedstatement.setbinarystream to save data.

CLOB type: Similar to varchar, but suitable for storing very large data, and data is not completely stored in memory. For any size of XML or HTML documents, text files, and so on. Use Preparedstatement.setcharacterstream to save data.

Other type: Corresponds to Java.lang.Object, which stores the serialized Java object, using a byte array, which the client can only serialize or deserialize, use GetObject to deserialize, and use Preparedstatement.setobject to store the data.

UUID type: The value corresponding to the java.util.uuid,128 bit, you can use Preparedstatement.setbytes or setstring or SetObject (UUID) to save the data, Retrieve data using Resultset.getobject.
Array type: corresponding java.lang.object[]

Chszs, reprint need to indicate. Blog home:Http://blog.csdn.net/chszs

Ii. Common functions of H2

Current_date: Take the current date

Current_time: Take the current time

Current_timestamp: Take the current date time

LOWER: String lowercase

UPPER: String Capitalization

CONCAT: String link

Char:ascii value to character

ASCII: Character representable ASCII value

ENCRYPT: Encryption function, support AES algorithm, block size is 16 bytes,

such as Call ENCRYPT (' AES ', ' xx ', STRINGTOUTF8 (' Test '))

DECRYPT: Decryption function, support AES algorithm, block size is 16 bytes,

such as Call TRIM (CHAR (0) from utf8tostring (

DECRYPT (' AES ', ' xx ', ' 3fabb4de8f1ee2e97d7793bab2db1116 '))

Hash: hashing function, only support SHA256 algorithm, such as call hash (' SHA256 ', STRINGTOUTF8 (' Password '), 1000)

Max: Ask for maximum

Min: Ask for minimum

Sum: Sum

Current_User: Returns the current user

H2version: Returns the version of the H2 database

Disk_space_used: Returns the size of the disk space used by the table, such as Call disk_space_used (' my_table ');

Database_path: Returns the path and database name of the database file, such as Call Database_path ();


Overview of H2 database functions and data types

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.