2022-07-14
Harmonyos Device Log To Mysql

mysql path:

jdbc:mysql://10.33.163.33:3306/HTS_DB?characterEncoding=UTF-8

root

pipeline@123

Logs Path:

/data/data/Local/DeviceTest/20220406163617_hts_project/resources/HTS/android-hts/logs

under logs:

%Y.%m.%d_%H.%M.%S_

select the latest folder

under selected folder:

device_logcat_test__.txt.gz

decompress using: (before that os.chdir to the selected folder)

gzip -d

does the decompression remove the .gz file?

it will.

log format per line:

DfxTestLog: A1__DfxTestTime = datai=4

from 1 to 13:

A1test1..4

A2test5

A3test1..2

B1test1

B2test4..6

D1test1

M1test1

Tables:

Performance_Baseline_Info

testValue date(%Y-%m-%d) hmsVersion(HMSCore660319) baselineId_id deviceId_id(1,2,4,3,5) deviceType(phone<-1|wearable<-2|car<-4|tv<-3|ecodevice<-5)

Performance_Daily_Data

id features indicators baseValue

Performance_Device_Info

id(to the deviceId_id) model type sn cpu

Read More

2022-06-03
Mysql Cheatsheet

MySQL Reference Card

Version: 0.1

Author: ProgM4c

Attribute Types

Numbers

Name

Coded on

Name

Coded on

TINYINT

1 byte

FLOAT(W, D)

4 bytes

SMALLINT

2 bytes

DOUBLE(W, D)

8 bytes

MEDIUMINT

3 bytes

W: width(number of digits with the ‘.’)

D: number of decimals

INT

4 bytes

BIGINT

8 bytes

Parameters:

• UNSIGNED

• ZEROFILL

Coded on:

• SIGNED :

• UNSIGNED:

Strings (between ‘ ‘)

Name

Size

CHAR(M)

String with fixed size, 1 <= M <= 255

VARCHAR(M)

String with variable size, 1 <= M <= 255

TINYTEXT

Max length = 255

TEXT

Max length = 65535

MEDIUMTEXT

Max length = 16777215

LONGTEXT

Max length = 4294967295

DECIMAL(M, D)

Simulate a floating point number in a string format

Date and Time

Name

Format

DATE

AAAA-MM-JJ

DATETIME

AAAA-MM-JJ HH:MM:SS

TIMESTAMP

AAAAMMJJHHMMSS

TIMESTAMP(M)

First M characters of a TIMESTAMP

TIME

HH:MM:SS

YEAR

AAAA

ENUM: take one value in the defined list (can be NULL)

syntax:

attr_name ENUM(‘value1’, ‘value2’, …) {NULL | NOT NULL}

Database queries

create a database

CREATE DATABASE [IF NOT EXISTS] ;

delete a database

DROP DATABSE [IF EXISTS] ;

rename a database

ALTER DATABASE RENAME ;

list databases

SHOW DATABASES;

select a database

USE ;

Table queries

show a table

SHOW TABLES;

rename a table

ALTER TABLE RENAME ;

describe a table

DESCRIBE

;

delete a table

DROP TABLE ;

type of constraints

• NOT NULL

• UNIQUE

• PRIMARY KEY = NOT NULL + UNIQUE

• FOREIGN KEY

• CHECK

• DEFAULT

• AUTO_INCREMENT

create a table

CREATE TABLE (

(size) ,

(size) ,

PRIMARY KEY()

);

add / delete a constraints

ALTER TABLE ADD CONSTRAINT TYPEOFCONSTRAINT (, …)

ALTER TABLE DROP [CONSTRAINT | TYPEOFCONSTRAINT ];

Modify table structure

add / delete attribute

ALTER TABLE ADD [FIRST|AFTER ];

ALTER TABLE DROP ;

add / delete default value to an column

ALTER TABLE ALTER {SET DEFAULT |DROP DEFAULT};

change definition of an attribute without/with renaming it

ALTER TABLE MODIFY ;

ALTER TABLE CHANGE ;

Inserting data

INSERT INTO (, , …) VALUES (, , …);

Modifying data

UPDATE

SET = , = , …

WHERE ;

Deleting data

DELETE FROM WHERE ;

Retrieving data

Select statement

SELECT [ DISTINCT ] attributs

[ INTO OUTFILE fichier ]

[ FROM relation ]

[ WHERE condition ]

[ GROUP BY attributs [ ASC | DESC ] ]

[ HAVING condition ]

[ ORDER BY attributs ]

[ LIMIT [a,] b ]

operators in a where clause

=

Equal

<>

Not equal. Note: In some versions of SQL this operator may be written as !=

Greater than

<

Less than

=

Greater than or equal

<=

Less than or equal

BETWEEN

Between an inclusive range

LIKE

Search for a pattern (‘%’ any sequence of characters ‘_’ any character)

[NOT] IN

To specify multiple possible values for a column

IS [NOT] NULL

To check if the value of a column is NULL or not

AND OR NOT

Filter records based on more than once condition

Sub-requests

SELECT * FROM

WHERE prix > (SELECT MIN(prix) FROM tab2)

SELECT * FROM

WHERE nom NOT IN (SELECT nom FROM tab2)

SELECT * FROM

WHERE prix > ALL (SELECT prix FROM tab2) (sup. à ttes les valeurs)

SELECT * FROM

WHERE prix > ANY (SELECT prix FROM tab2) (sup. à au moins 1)

SQL aliases on column / table

SELECT AS FROM

(alias a result)

SELECT FROM

AS (alias a table name)

SQL functions

AVG() - (moyenne)

COUNT() - (nombre d’élément)

MAX() - (maximum)

MIN() - (minimum)

SUM() - (somme)

UCASE()

LCASE()

LEN()

NOW()

FORMAT()

Read More