File dblink_scan.h¶
File List > cubrid > src > query > dblink_scan.h
Go to the documentation of this file
/*
*
* Copyright 2016 CUBRID Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Public defines for value array scans
*/
#ifndef _DBLINK_SCAN_H_
#define _DBLINK_SCAN_H_
#ident "$Id$"
#if !defined (SERVER_MODE) && !defined (SA_MODE)
#error Belongs to server module
#endif /* !defined (SERVER_MODE) && !defined (SA_MODE) */
#include "dbtype_def.h"
#include "storage_common.h"
#include "thread_compat.hpp"
typedef enum
{
DBLINK_SUCCESS = 1,
DBLINK_EOF,
DBLINK_ERROR
} DBLINK_STATUS;
struct regu_variable_list_node;
struct val_list_node;
typedef struct
{
int count;
int *index;
} DBLINK_HOST_VARS;
typedef struct dblink_scan_info DBLINK_SCAN_INFO;
struct dblink_scan_info
{
int conn_handle; /* connection handle for dblink */
int stmt_handle; /* statement handle for dblink */
int col_cnt; /* column count of dblink query result */
char cursor; /* cursor position T_CCI_CURSOR_POS */
void *col_info; /* column information T_CCI_COL_INFO */
int cursor_rewind; /* set from XASL_DBLINK_CURSOR_REWIND flag:
* on each outer-row open, rewind CCI cursor to FIRST
* instead of re-issuing cci_execute;
* dblink_close_scan is skipped per iteration and
* deferred to query teardown (qexec_clear_xasl) */
};
#define MAX_LEN_CONNECTION_URL 512
/*
* This data structure is the connection information for dblink
*/
typedef struct dblink_conn_info DBLINK_CONN_INFO;
struct dblink_conn_info
{
int conn_handle;
char conn_url[MAX_LEN_CONNECTION_URL + 1];
char user_name[DB_MAX_USER_LENGTH + 1];
char password[DB_MAX_PASSWORD_LENGTH + 1];
};
/*
* This data structure is the connection interface for dblink
*/
typedef struct dblink_conn_entry DBLINK_CONN_ENTRY;
struct dblink_conn_entry
{
DBLINK_CONN_INFO conn_info;
bool is_2pc_participant;
DBLINK_CONN_ENTRY *next;
};
extern int dblink_end_tran (DBLINK_CONN_ENTRY * dblink, bool is_abort);
extern int dblink_execute_query (THREAD_ENTRY * thread_p, struct access_spec_node *spec, VAL_DESCR * vd,
DBLINK_HOST_VARS * host_vars);
extern int dblink_open_scan (THREAD_ENTRY * thread_p, DBLINK_SCAN_INFO * scan_info, struct access_spec_node *spec,
VAL_DESCR * vd, DBLINK_HOST_VARS * host_vars);
extern int dblink_close_scan (DBLINK_SCAN_INFO * scan_info, bool is_final);
extern SCAN_CODE dblink_scan_next (DBLINK_SCAN_INFO * scan_info, val_list_node * val_list);
extern SCAN_CODE dblink_scan_reset (DBLINK_SCAN_INFO * scan_info);
#endif