| 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 - 2019 MonetDB B.V. |
| 7 | */ |
| 8 | |
| 9 | #include "monetdb_config.h" |
| 10 | #include "sql.h" |
| 11 | #include "mal_backend.h" |
| 12 | |
| 13 | backend * |
| 14 | backend_reset(backend *b) |
| 15 | { |
| 16 | b->out = b->client->fdout; |
| 17 | b->language = 0; |
| 18 | b->depth = 0; |
| 19 | |
| 20 | b->vtop = 0; |
| 21 | b->q = NULL; |
| 22 | b->mb = NULL; |
| 23 | b->mvc_var = 0; |
| 24 | b->cur_append = 0; |
| 25 | b->first_statement_generated = false; |
| 26 | b->output_format = OFMT_CSV; |
| 27 | return b; |
| 28 | } |
| 29 | |
| 30 | backend * |
| 31 | backend_create(mvc *m, Client c) |
| 32 | { |
| 33 | backend *b = MNEW(backend); |
| 34 | |
| 35 | if( b== NULL) |
| 36 | return NULL; |
| 37 | b->mvc = m; |
| 38 | b->client = c; |
| 39 | b->mvc_var = 0; |
| 40 | b->cur_append = 0; |
| 41 | b->first_statement_generated = false; |
| 42 | b->output_format = OFMT_CSV; |
| 43 | return backend_reset(b); |
| 44 | } |
| 45 | |
| 46 | void |
| 47 | backend_destroy(backend *b) |
| 48 | { |
| 49 | _DELETE(b); |
| 50 | } |
| 51 | |
| 52 |