Database library

<< Click to Display Table of Contents >>

Navigation:  Project > Scripts > ST language > Embedded functions >

Database library

Previous pageReturn to chapter overviewNext page

createdbsqlliteconnection(Input1) - used to create create connection to SQLLite database with name in Input1. Database file is created in DB folder.

 

Example:

createdbsqlliteconnection(”filename”);


 

createdbconnection(Input1, Input2, Input3) - used to create connection to database with name in Input1, with username in Input2 and password in Input3.

 

Example:

createdbconnection(“jdbc:mysql://192.168.0.76:3306/test”, “username”, “password”); in this example MySQL database is created. (“jdbc:mysql” in the beginning means that MySQL connection is created).


 

closedbconnection(Input1) - used to close database connection with name in Input1.

 

Example:

closedbconnection(”filename”);


 

createdbtable(Input1, Input2, Input3) - used to create table in database with name of database in Input1, table name in Input2 and columns in Input3 (columns should be separated by commas, every table has auto incremented column “_id”).

 

Example:

createdbtable(“databasename”, “tablename”, “title, parameter1, parameter2”);


 

insertvaluesintodb(Input1, Input2, Input3) - used to insert row into database with name of database in Input1, table name in Input2 and values in Input3 (values should be separated by commas).

 

Example:

insertvaluesintodb(“databasename”, “tablename”, “Title, 10, 20”);


 

readvaluefromdb(Input1, Input2, Input3, Input4) - used to read value from database with name of database in Input1, table name in Input2,  name of the read column in Input3 and condition of read row in Input4 (if several rows fit to condition first row is read).

 

Example:

string parameter = readvaluefromdb(“databasename”, “tablename”, “parameter1”,”_id=1”);


 

readvaluefromdbinpos(Input1, Input2, Input3, Input4, Input5) - used to read value from database with name of database in Input1, table name in Input2,  name of the read column in Input3, condition of read row in Input4 and position of the row in Input5.

 

Example:

string parameter = readvaluefromdbinpos(“databasename”, “tablename”, “parameter1”,”title = Title”, 1);


 

updatevalueindb(Input1, Input2, Input3, Input4, Input5) - used to update value in database with name of database in Input1, table name in Input2,  name of the updated column in Input3, condition of the updated row in Input4 and updated value in Input5 (if several rows fit to condition all rows values are changed)

 

Example:

updatevalueindb(“databasename”, “tablename”, “parameter1”,”title = Title”, “10”);


 

deleterowindb(Input1, Input2, Input3) - used to delete row(s) in database with name of database in Input1, table name in Input2 and condition that should fit the row(s) in Input3.

 

Example:

deleterowindb(“databasename”, “tablename”, “_id=1”);