LCOV - code coverage report
Current view: top level - sql/backends/monet5 - mal_backend.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 17 20 85.0 %
Date: 2021-10-13 02:24:04 Functions: 3 3 100.0 %

          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             : #include "monetdb_config.h"
      10             : #include "sql.h"
      11             : #include "mal_backend.h"
      12             : 
      13             : backend *
      14       13265 : backend_reset(backend *b)
      15             : {
      16       13265 :         if (b->subbackend)
      17           0 :                 b->subbackend->reset(b->subbackend);
      18       13265 :         *b = (backend) {
      19       13265 :                 .mvc = b->mvc,
      20             :                 .client = b->client,
      21       13265 :                 .out = b->client->fdout,
      22             :                 .output_format = OFMT_CSV,
      23             :                 .rowcnt = -1,
      24             :                 .last_id = -1,
      25       13265 :                 .subbackend = b->subbackend,
      26             :         };
      27       13265 :         return b;
      28             : }
      29             : 
      30             : backend *
      31       12546 : backend_create(mvc *m, Client c)
      32             : {
      33       12546 :         backend *b = MNEW(backend);
      34             : 
      35       12546 :         if (!b)
      36             :                 return NULL;
      37       12546 :         *b = (backend) {
      38             :                 .mvc = m,
      39             :                 .client = c,
      40             :         };
      41       12546 :         if (b && be_funcs.sub_backend)
      42           0 :                 b->subbackend = be_funcs.sub_backend(m, c);
      43       12546 :         return backend_reset(b);
      44             : }
      45             : 
      46             : void
      47       12546 : backend_destroy(backend *b)
      48             : {
      49       12546 :         if (b->subbackend)
      50           0 :                 b->subbackend->destroy(b->subbackend);
      51       12546 :         _DELETE(b);
      52       12546 : }

Generated by: LCOV version 1.14