sql >> Database teknologi >  >> RDS >> Mysql

Databaseadgang med Angular

1- Er det muligt at få adgang til MySQL-databaser i vinkelramme?

Spørgsmålet er ikke vinkelspecifikt, men JA det er muligt , da MySQL 5.7 indsættelse, opdatering og sletning af poster i MySQL via HTTP er muligt. Sådan noget her

http://127.0.0.1:8080/sql/myhttp/SELECT+name_first,+name_last+FROM+names 
``` [refer here][1]

> Hence you can interact with MySQL directly with any HTTP client  with
> out any middle-ware.

 By HTTP Client I mean Curl,Wget or any Http library/API of any language (ajax,request,fetch,axios ... for JavaScript/node) 

2 - Would that be insecure like other JavaScript?

Again not JavaScript specific, But **Yes it's insecure(not recommended)** to directly interact with the database from the client.
  Why?
You need to handle database security issues like SQL Injection from the client side (angular in this case). It's is very inconvenient to do that.


  [1]: https://scriptingmysql.wordpress.com/2015/01/15/mysql-5-7-labs-and-the-http-plugin-inserting-updating-and-deleting-records-in-mysql-via-http/

> I do recommend to always have database access middle-ware
> (php,node,python ...) than interacting from client side



  1. Optimering af MySQL-forespørgsel for at undgå at scanne en masse rækker

  2. Ulovlig blanding af sorteringer til drift til sammenligning af dato/klokkeslæt

  3. er det muligt at vælge EXISTS direkte som en smule?

  4. Sådan får du året fra en date i T-SQL