File: remote.h

package info (click to toggle)
virtuoso-opensource 6.1.6+dfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 260,992 kB
  • ctags: 125,220
  • sloc: ansic: 652,748; sql: 458,419; xml: 282,834; java: 61,031; sh: 40,031; cpp: 36,890; cs: 25,240; php: 12,692; yacc: 9,523; lex: 7,018; makefile: 6,157; jsp: 4,484; awk: 1,643; perl: 1,013; ruby: 1,003; python: 326
file content (168 lines) | stat: -rw-r--r-- 4,458 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
 *  remote.h
 *
 *  $Id$
 *
 *  Virtuoso Remote Data Source Access
 *
 *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 *  project.
 *
 *  Copyright (C) 1998-2012 OpenLink Software
 *
 *  This project is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; only version 2 of the License, dated June 1991.
 *
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 *
 */

#ifndef _REMOTE_H
#define _REMOTE_H

#include "sqlfn.h"
#include "msdtc.h"

typedef struct remote_ds_s
  {
    char *		rds_dsn;
    char *		rds_uid;
    char *		rds_pwd;
    caddr_t		rds_connstr; /* vector w/ SQLGetInfo info-value pairs */
#ifdef VIRTTP
    resource_t *	rds_mts_connections;
#endif
    char *		rds_quote;
    short		rds_identifier_case;
    int			rds_correlation_name;
    char *		rds_dbms_name;
    long		rds_oj_capsbility;
    char		rds_array_params;
    char		rds_array_checked;
    id_hash_t *		rds_pass_through_funcs;
    dk_mutex_t *	rds_pass_through_funcs_mtx;
    dk_hash_t *	        rds_rexec_grants;
    id_hash_t *		rds_connections_hash;
  } remote_ds_t;


typedef struct remote_table_s
  {
    caddr_t		rt_local_name;
    caddr_t		rt_remote_name;
    remote_ds_t *	rt_rds;
  } remote_table_t;


typedef struct remote_proc_s
  {
    caddr_t		rp_local_name;
    caddr_t		rp_remote_name;
    remote_ds_t *	rp_rds;
    caddr_t *		rp_param_type;
    caddr_t *		rp_param_prec;
    caddr_t *		rp_param_mode;
    dtp_t		rp_ret_dtp;
    long		rp_ret_prec;
  } remote_proc_t;


typedef struct rds_connection_s
  {
    remote_ds_t *	rc_rds;
    SQLHDBC		rc_hdbc;
    id_hash_t *		rc_stmts;
    int			rc_n_stmts_cached;
    long		rc_last_used;
    char		rc_to_disconnect; /* remote dead, formally disconnect
					     at transact time */
    caddr_t		rc_dbms;
    caddr_t		rc_driver_name;
    dk_mutex_t *	rc_mtx;
    struct _rstmtstruct *rc_first_rst;
    struct _rstmtstruct *rc_last_rst;
    int			rc_access_mode;
    SQLSMALLINT		rc_txn_capable;
    SQLSMALLINT		rc_commit_behavior;
    SQLSMALLINT		rc_rollback_behavior;
    int			rc_autocommit;
    int			rc_vdb_actions;
    int			rc_n_active_stmts;
    struct _rstmtstruct *rc_first_active_rst;
    struct _rstmtstruct *rc_last_active_rst;
#ifdef VIRTTP
    int			rc_is_enlisted;
    int			rc_mts_used;
#endif
    lock_trx_t *       rc_lt;
    caddr_t		rc_uid;
    caddr_t		rc_pwd;
    caddr_t		rc_dsn_name;
#ifdef INPROCESS_CLIENT
    int			rc_inprocess;
#endif
    int 		rc_hdbc_access_mode;
  } rds_connection_t;



typedef struct rcc_entry_s
{
  remote_ds_t *		rce_rds;
  rds_connection_t * 	rce_rcon;
  struct rcc_entry_s *	rce_next;
} rcc_entry_t;


typedef struct rcon_cache_s
{
  rcc_entry_t *	rcc_entries;
} rcon_cache_t;


#ifndef _REMOTE_STMT_T_
#define _REMOTE_STMT_T_
typedef struct _rstmtstruct  remote_stmt_t;
#endif

extern remote_ds_t * local_rds;

#define IS_BLOB_SQL_TYPE(dt) (SQL_LONGVARCHAR == dt || SQL_LONGVARBINARY == dt || SQL_WLONGVARCHAR == dt)

#define IS_STRING_SQL_TYPE(dt) \
  (SQL_CHAR == dt || SQL_VARCHAR == dt || SQL_BINARY == dt || SQL_VARBINARY == dt || SQL_WVARCHAR == dt || SQL_WCHAR == dt)

/*
 *  Prototypes
 */
caddr_t box_timestamp_struct (TIMESTAMP_STRUCT * par_ts);

caddr_t find_pass_through_function (remote_ds_t * rds, int do_mutex, char *ref_name, char *q_def, char *o_def, caddr_t * found_remote);

remote_ds_t *find_remote_ds (const char *name, int create);

remote_proc_t *find_remote_proc (char *name, int create);

remote_table_t *find_remote_table (char *name, int create);

caddr_t rds_get_info (remote_ds_t * rds, int finfo);

int vd_dv_to_sql_type (int dv);

void sqlc_quote_dotted (char *text, size_t tlen, int *fill, char *name);

extern void dbev_dsn_login (remote_ds_t * rds, client_connection_t * cli, caddr_t * err_ret, caddr_t * puid, caddr_t * ppwd, caddr_t * pdsn);

#define RTS_ERROR_QI(rts, qi) \
  (rts->src_gen.src_query->qr_is_bunion_term ? NULL : (query_instance_t *) qi)


#endif /* _REMOTE_H */