<commit_before>/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0.  If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * Copyright 2008-2015 MonetDB B.V.
 */

/* multi version catalog */
#ifndef _SQL_MVC_H
#define _SQL_MVC_H

#include <sql_mem.h>
#include <gdk.h>
#include <stdarg.h>
#include <sql_scan.h>
#include <sql_list.h>
#include <sql_types.h>
#include <sql_backend.h>
#include <sql_catalog.h>
#include <sql_relation.h>
#include <sql_storage.h>
#include <sql_keyword.h>
#include <sql_atom.h>
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif

#include <mapi.h>

#define ERRSIZE 8192

/* different query execution modes (emode) */
#define m_normal 	0
#define m_inplace 	1 
#define m_execute 	2
#define m_prepare 	3
#define m_plan 		4

/* special modes for function/procedure and view instantiation and
   dependency generation */
#define m_instantiate 	5
#define m_deps 		6

#define QUERY_MODE(m) (m==m_normal || m==m_inplace || m==m_instantiate || m==m_deps)


/* different query execution modifiers (emod) */
#define mod_none 	0
#define mod_debug 	1
#define mod_trace 	2
#define mod_explain 	4 
#define mod_dot 	8 
/* locked needs unlocking */
#define mod_locked 	16 

typedef struct sql_var {
	char *name;
	ValRecord value;
	sql_subtype type;
	sql_table *t;
	sql_rel *rel;	
	char view;
	char frame;
} sql_var;

#define MAXSTATS 8

typedef struct mvc {
	char errstr[ERRSIZE];

	sql_allocator *sa;
	struct qc *qc;
	int clientid;		/* id of the owner */
	struct scanner scanner;

	list *params;
	sql_func *forward;	/* forward definitions for recursive functions */
	sql_var *vars; 		/* stack of variables, frames are simply a
				   NULL in the var stack 
					(sometimes with name (label) ) */
	int topvars;
	int sizevars;
	int frame;
	int use_views;
	atom **args;
	int argc;
	int argmax;
	struct symbol *sym;
	int point_query;	/* mark when a query is a point query */

	int user_id;
	int role_id;
	lng last_id;

	/* current session variables */
	int timezone;		/* milliseconds west of UTC */
	int cache;		/* some queries should not be cached ! */
	int caching;		/* cache current query ? */
	int history;		/* queries statistics are kept  */
	int reply_size;		/* reply size */
	int sizeheader;		/* print size header in result set */
	int debug;

	char emode;		/* execution mode */
	char emod;		/* execution modifier */

	sql_session *session;	

	int type;		/* query type */
	int pushdown;		/* AND or OR query handling */
	int label;		/* numbers for relational projection labels */
	list *cascade_action;  /* protection against recursive cascade actions */

	int opt_stats[MAXSTATS];/* keep statistics about optimizer rewrites */

	int result_id;
	res_table *results;
#ifdef HAVE_TIMES
	struct tms times;
#endif	
	lng Tparse;
} mvc;

extern int mvc_init(int debug, store_type store, int ro, int su, backend_stack stk);
extern void mvc_exit(void);
extern void mvc_logmanager(void);
extern void mvc_minmaxmanager(void);<commit_msg>times not used, ie cleanup<commit_after>/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0.  If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * Copyright 2008-2015 MonetDB B.V.
 */

/* multi version catalog */
#ifndef _SQL_MVC_H
#define _SQL_MVC_H

#include <sql_mem.h>
#include <gdk.h>
#include <stdarg.h>
#include <sql_scan.h>
#include <sql_list.h>
#include <sql_types.h>
#include <sql_backend.h>
#include <sql_catalog.h>
#include <sql_relation.h>
#include <sql_storage.h>
#include <sql_keyword.h>
#include <sql_atom.h>

#include <mapi.h>

#define ERRSIZE 8192

/* different query execution modes (emode) */
#define m_normal 	0
#define m_inplace 	1 
#define m_execute 	2
#define m_prepare 	3
#define m_plan 		4

/* special modes for function/procedure and view instantiation and
   dependency generation */
#define m_instantiate 	5
#define m_deps 		6

#define QUERY_MODE(m) (m==m_normal || m==m_inplace || m==m_instantiate || m==m_deps)


/* different query execution modifiers (emod) */
#define mod_none 	0
#define mod_debug 	1
#define mod_trace 	2
#define mod_explain 	4 
#define mod_dot 	8 
/* locked needs unlocking */
#define mod_locked 	16 

typedef struct sql_var {
	char *name;
	ValRecord value;
	sql_subtype type;
	sql_table *t;
	sql_rel *rel;	
	char view;
	char frame;
} sql_var;

#define MAXSTATS 8

typedef struct mvc {
	char errstr[ERRSIZE];

	sql_allocator *sa;
	struct qc *qc;
	int clientid;		/* id of the owner */
	struct scanner scanner;

	list *params;
	sql_func *forward;	/* forward definitions for recursive functions */
	sql_var *vars; 		/* stack of variables, frames are simply a
				   NULL in the var stack 
					(sometimes with name (label) ) */
	int topvars;
	int sizevars;
	int frame;
	int use_views;
	atom **args;
	int argc;
	int argmax;
	struct symbol *sym;
	int point_query;	/* mark when a query is a point query */

	int user_id;
	int role_id;
	lng last_id;

	/* current session variables */
	int timezone;		/* milliseconds west of UTC */
	int cache;		/* some queries should not be cached ! */
	int caching;		/* cache current query ? */
	int history;		/* queries statistics are kept  */
	int reply_size;		/* reply size */
	int sizeheader;		/* print size header in result set */
	int debug;

	char emode;		/* execution mode */
	char emod;		/* execution modifier */

	sql_session *session;	

	int type;		/* query type */
	int pushdown;		/* AND or OR query handling */
	int label;		/* numbers for relational projection labels */
	list *cascade_action;  /* protection against recursive cascade actions */

	int opt_stats[MAXSTATS];/* keep statistics about optimizer rewrites */

	int result_id;
	res_table *results;
	lng Tparse;
} mvc;

extern int mvc_init(int debug, store_type store, int ro, int su, backend_stack stk);
extern void mvc_exit(void);
extern void mvc_logmanager(void);
extern void mvc_minmaxmanager(void);
{'fraction_non_alphanumeric': 0.10383333333333333, 'fraction_numerical': 0.010333333333333333, 'mean_word_length': 3.77027027027027, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3353274', 'n_tokens_mistral': 2234, 'n_tokens_neox': 2109, 'n_words': 724}