Management of SyScript databases
In case of problem to display ".spg" files you should install the pluging here
test a short sample here : From a web page
here documentation
|
|
How to manage a database with SyScript ? It can be usefull to use a database to store data. SyScript allows to access directly to MYSQL database with MYSQLQUERY command (For other database use ODBC command). |
|
|
To use MYSQL, just prefix SQL syntax with MYSQLQUERY command. For SELECT, CONNECT please look at following example : MYSQLCONNECT SERVERNAME,BASEACCOUNT,BASEPASSWORD,SERVERPORT MYSQLSELECTDB BASENAME (use only if the database name is not indicated in the request) MYSQLQUERY MYSQL_COMMAND ex : MYSQLQUERY SHOW DATABASES ex : MYSQLQUERY SHOW TABLES ex : MYSQLQUERY SELECT * FROM `BASENAME`.`TABLENAME`.`FIELD` WHERE `BASENAME`.`TABLENAME`=12 ex : MYSQLQUERY SELECT * FROM TABLENAME WHERE FIELD=12 ex : MYSQLQUERY SELECT * FROM `DATABASE`.`TABLE` ex : MYSQLQUERY SELECT FIELD FROM `DATABASE`.`TABLE` Precision : you have to mention database name if MYSQLSELECTDB has not been set |
|
|
All results of MYSQLQUERY requests are stored in a table named MYSQLQUERY here documentation |
|
|
Some of specials caracters needs to be protected in order for the request to works correctly These can be done with MYSQLESCAPE command, which transforms correctly chains of caracters ;For example, here, the special caracter tobe protected is QUOTE (') MYSQLESCAPE l'esprit et le vin SET MAVARIABLE=%MYSQLESCAPE% MYSQLQUERY SELECT * FROM MaTable WHERE FIELD='%MAVARIABLE%' It is also possible to modify specials caracters easely, with the special keyword '.MY$' Please find here an example : MYSQLQUERY SELECT * FROM MaTable WHERE FIELD='%MAVARIABLE.MY$%' |
|
|
It is possible to store data in binary mode to the database, for example, we can store SyScript plugins, like ".spg" files. Some of specials caracters needs to be protected in order for the request to works correctly The BINGET command allows to read a binary file The VARPROTECT command is used to proctect caracters against any non desire conversion The command MYSQL UPDATE allows to update existing data example : BINGET PATH\file.spg VARPROTECT # MYSQLQUERY INSERT INTO `BASENAME`.`TABLENAME`(`id`,`pathname`,`filename`,`file`,`size`) VALUES ('%ID%','%PATHNAME.MY$%','%FILENAME.MY$%','#BINGET.MY$#','%NBINGET%') |
|
|
Database requests can be done through a server (see syscript http server). To ask to SyScript to execute request through an http server, you just need to input the following command : MYSQLBYHTTP ON,SERVERNAME:PORT_NUMBER ex : MYSQLBYHTTP ON,MYSERVER:80 All MYSQLQUERY commmands wouldn't be directly executed by the script, but asked to the server to be executed through internet The server will be in charge to send the request to the internet database over the network The results of the request will be automaticaly send to the client on MYSQLQUERY table The best avantage of this methods is to bypass PROXY and FIREWALLS see SyScript http server |
