멍청해서 기록한다
SQream Saved queries 본문
• Use saved queries to share queries between different users, or to eliminate the need to rewrite a query that is run frequently.
• Use saved queries to reduce the risk of SQL injection attacks
Command | Usage |
SELECT DROP_SAVED_QUERY | Drop a saved query |
SELECT EXECUTE_SAVED_QUERY | Executes a saved query |
SELECT LIST_SAVED_QUERIES | Returns a list of saved queries |
SELECT RECOMPILE_SAVED_QUERY | Recompiles a query that has been invalidated by a schema change |
SELECT SAVED_QUERY | Compil and saves a query for re-use and sharing |
SELECT SHOW_SAVED_QUERY | Show query text for a saved query |
※아래와 같이 쿼리를 저장하면 변수로 쿼리를 불러올 수 있음
SELECT SAVE_QUERY('select_by_weight_and_team',$$SELECT * FROM nba WHERE Weight > ? AND Team = ?$$);
실행은 아래처럼
SELECT EXECUTE_SAVED_QUERY('select_by_weight_and_team', 240, 'Toronto Raptors');
- SELECT SAVE_QUERY('select_all','SELECT * FROM nba');
- SELECT EXECUTE_SAVED_QUERY(saved_query_name);
- SELECT DROP_SAVED_QUERY(saved_query_name);
- SELECT LIST_SAVED_QUERIES();
※RECOMPILE_SAVED_QUERY recompiles a saved query that has been invalidated due to a schema change.
- SELECT RECOMPILE_SAVED_QUERY(saved_query_name)
- SELECT SHOW_SAVED_QUERY(saved_query_name);
하.. 이제 나도 뭔가 정리 할 시간이 생긴듯
코로나 땡큐맨
'데이터베이스 > Sqream' 카테고리의 다른 글
SQream 아키텍처 (0) | 2021.06.28 |
---|