LCOV - code coverage report
Current view: top level - sql/common - sql_backend.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 32 35 91.4 %
Date: 2021-10-13 02:24:04 Functions: 10 11 90.9 %

          Line data    Source code
       1             : /*
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       5             :  *
       6             :  * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
       7             :  */
       8             : 
       9             : /*
      10             :  * The back end structure collects the information needed to support
      11             :  * compilation and execution of the SQL code against a back-end engine.
      12             :  * Note that any back-end can be called upon by the front-end
      13             :  * to handle specific tasks, such as catalog management (sql_mvc)
      14             :  * and query execution (sql_qc). For this purpose, the front-end needs
      15             :  * access to operations defined in the back-end, in particular for
      16             :  * freeing the stack and code segment.
      17             :  *
      18             :  * The front-end should not rely on knowledge how the back end handles
      19             :  * the actual query processing. Using the sample back end Monet5
      20             :  * are used to find the common ground here. The structure currently is a
      21             :  * simple functional wrapper. It assumes that a single back-end is used
      22             :  * for the duration of a session.
      23             :  */
      24             : 
      25             : #include "monetdb_config.h"
      26             : #include "sql_backend.h"
      27             : 
      28             : backend_functions be_funcs;
      29             : 
      30             : void
      31         310 : backend_freecode(int clientid, const char *name)
      32             : {
      33         310 :         if (be_funcs.fcode != NULL)
      34         310 :                 be_funcs.fcode(clientid, name);
      35         310 : }
      36             : 
      37             : char *
      38         268 : backend_create_user(ptr mvc, char *user, char *passwd, char enc, char *fullname, sqlid defschemid, char *schema_path, sqlid grantor)
      39             : {
      40         268 :         if (be_funcs.fcuser != NULL)
      41         268 :                 return(be_funcs.fcuser(mvc, user, passwd, enc, fullname, defschemid, schema_path, grantor));
      42             :         return(NULL);
      43             : }
      44             : 
      45             : int
      46          75 : backend_drop_user(ptr mvc, char *user)
      47             : {
      48          75 :         if (be_funcs.fduser != NULL)
      49          75 :                 return(be_funcs.fduser(mvc,user));
      50             :         return FALSE;
      51             : }
      52             : 
      53             : int
      54         370 : backend_find_user(ptr m, char *user)
      55             : {
      56         370 :         if (be_funcs.ffuser != NULL)
      57         370 :                 return(be_funcs.ffuser(m, user));
      58             :         return(0);
      59             : }
      60             : 
      61             : void
      62         186 : backend_create_privileges(ptr mvc, sql_schema *s)
      63             : {
      64         186 :         if (be_funcs.fcrpriv != NULL)
      65         186 :                 be_funcs.fcrpriv(mvc, s);
      66         186 : }
      67             : 
      68             : int
      69         139 : backend_schema_has_user(ptr mvc, sql_schema *s)
      70             : {
      71         139 :         if (be_funcs.fshuser != NULL)
      72         139 :                 return(be_funcs.fshuser(mvc, s));
      73             :         return(FALSE);
      74             : }
      75             : 
      76             : int
      77          57 : backend_alter_user(ptr mvc, str user, str passwd, char enc,
      78             :                                    sqlid schema_id, char *schema_path, str oldpasswd)
      79             : {
      80          57 :         if (be_funcs.fauser != NULL)
      81          57 :                 return(be_funcs.fauser(mvc, user, passwd, enc, schema_id, schema_path, oldpasswd));
      82             :         return(FALSE);
      83             : }
      84             : 
      85             : int
      86           2 : backend_rename_user(ptr mvc, str olduser, str newuser)
      87             : {
      88           2 :         if (be_funcs.fruser != NULL)
      89           2 :                 return(be_funcs.fruser(mvc, olduser, newuser));
      90             :         return(FALSE);
      91             : }
      92             : 
      93             : void*
      94           0 : backend_schema_user_dependencies(ptr trans, sqlid schema_id)
      95             : {
      96           0 :         if (be_funcs.fschuserdep != NULL)
      97           0 :                 return(be_funcs.fschuserdep(trans, schema_id));
      98             :         return NULL;
      99             : }
     100             : 
     101             : int
     102      781228 : backend_resolve_function(ptr M, sql_func *f)
     103             : {
     104      781228 :         if (be_funcs.fresolve_function != NULL)
     105      781228 :                 return be_funcs.fresolve_function(M, f);
     106             :         return 0;
     107             : }
     108             : 
     109             : int
     110         265 : backend_has_module(ptr M, char *name)
     111             : {
     112         265 :         if (be_funcs.fhas_module_function != NULL)
     113         265 :                 return be_funcs.fhas_module_function(M, name);
     114             :         return 0;
     115             : }

Generated by: LCOV version 1.14