For example, sort JavaScript arrays.
Delete, select, and group array data.
So, later I was excited.
It's not enough.
Write an SQL library that can be applied in Javascript
Later I thought, why can't I use JavaScript to directly connect to the database?
Another class library for JavaScript direct connection to SQL data
Later, I thought that I could use SQL statements to operate the HTML Dom model.
Later, I saw the implementation of Web DB in HTML5.
Therefore, webdb is the SQLite encapsulation in chrome and safari.
So there is:
1. obtain data from the server and execute SQL operations:
CopyCode The Code is as follows: _ sqlproxyurl _ = 'sqlproxy. php ';
_ Sqlserverhost _ = 'localhost ';
_ Sqlusername _ = 'root ';
_ Sqlpassword _ = '';
_ Sqldatabase _ = 'managing management ';
VaR result = "select * from room" .onserver(cmd.exe cutesql ();
For (VAR I = 0; I <result. length; I ++ ){
// Do something here... using result [I];
}
2. Operate JavaScript Object array and execute SQL operations:
Copy code The Code is as follows:
VaR room = [
{
ID: 'bot ',
Name: 'test ',
Sex: True
},{
ID: 2,
Name: 'test8 ',
Sex: True
},{
ID: 3,
Name: 'test5 ',
Sex: false
},{
ID: 4,
Name: 'test2 ',
Sex: True
}];
SQL = "select max (ID) as bid, sum (ID) as total from records where name like \" test % \ "group by sex order by ID DESC, name ASC ";
VaR result = SQL .exe cutesql ();
For (VAR I = 0; I <result. length; I ++ ){
// Do something here... using result [I];
};
"Create table mytable". executesql ();
For (var j = 0; j <100; j ++ ){
"Insert into mytable (ID, name, sex) values (2, 'hangsan', true)". executesql ();
};
SQL statements are all written out. Secure?
For security issues, first of all, this is not intended for Internet applications, but for LAN. Second, the database connection has SSL encryption. In fact, HTTP also has SSL. The remote call service is only one of the four modules of jsql. You can also operate the client objects array, SQLite in the browser, and Dom in the webpage without passing through services. My SQL here only represents a language specification, which is suitable for but not limited to the back-end SQL database. There are three modules for front-end operations.