40 #define TDS_ISSPACE(c) isspace((unsigned char) (c))
45 int nparam =
stmt->params ?
stmt->params->num_cols : 0;
46 const char *p =
stmt->prepared_pos - 1;
65 stmt->params = temp_params;
66 curcol = temp_params->
columns[nparam];
123 if (*start !=
'\'') {
124 memcpy(dest, start, p - start);
143 if (
len >= 0 && len <= curcol->column_size)
147 *((
TDS_INT *) dest) = atoi(start);
160 if (
stmt->param_num >
stmt->apd->header.sql_desc_count
161 ||
stmt->param_num >
stmt->ipd->header.sql_desc_count) {
169 curcol, compute_row,
stmt->apd,
stmt->curr_param_row)) {
182 if (!*p || *p !=
',')
184 stmt->prepared_pos = (
char *) p + 1;
193 int nparam =
stmt->params ?
stmt->params->num_cols : 0;
195 if (
stmt->prepared_pos)
201 ++nparam, ++
stmt->param_num) {
203 if (
stmt->param_num >
stmt->apd->header.sql_desc_count ||
stmt->param_num >
stmt->ipd->header.sql_desc_count) {
205 "%d > %d || %d > %d\n",
206 stmt->param_num,
stmt->apd->header.sql_desc_count,
207 stmt->param_num,
stmt->ipd->header.sql_desc_count);
216 stmt->params = temp_params;
220 stmt->params->columns[nparam], compute_row,
stmt->apd,
stmt->curr_param_row)) {
238 stmt->param_num =
stmt->prepared_query_is_func ? 2 : 1;
256 for (;
i < srclen; ++
i) {
259 if (
'0' <= hex1 && hex1 <=
'9')
263 if (
'A' <= hex1 && hex1 <=
'F') {
267 "error_handler: attempt to convert data stopped by syntax error in source field \n");
273 if ((
i/2u) >= destlen)
277 dest[
i / 2u] = c | hex1;
288 struct _drecord *drec_apd, *drec_ipd;
304 if (
stmt->param_num >
stmt->apd->header.sql_desc_count ||
stmt->param_num >
stmt->ipd->header.sql_desc_count)
306 drec_apd = &
stmt->apd->records[
stmt->param_num - 1];
307 drec_ipd = &
stmt->ipd->records[
stmt->param_num - 1];
309 curcol =
stmt->params->columns[
stmt->param_num - (
stmt->prepared_query_is_func ? 2 : 1)];
316 if (DataPtr ==
NULL) {
317 switch(StrLen_or_Ind) {
332 switch(StrLen_or_Ind) {
337 len = strlen((
char *) DataPtr);
347 if (DataPtr && StrLen_or_Ind < 0) {
360 if (!blob &&
len > need_bytes)
366 int binary_convert = 0;
406 if (binary_convert) {
415 data[1] = (sql_src_type ==
SQL_C_CHAR) ? *(
unsigned char*)DataPtr : *(
SQLWCHAR*)DataPtr;
449 }
else if (
len > 0) {
#define TDS_CONVERT_SYNTAX
#define TDS_CONVERT_BINARY
static CS_CONNECTION * conn
unsigned int
A callback function used to compare two keys in a database.
int odbc_sql_to_c_type_default(int sql_type)
void odbc_convert_err_set(struct _sql_errors *errs, TDS_INT err)
void odbc_errs_add(struct _sql_errors *errs, const char *sqlstate, const char *msg)
add an error to list
const char * parse_const_param(const char *s, TDS_SERVER_TYPE *type)
SQLRETURN odbc_sql2tds(TDS_STMT *stmt, const struct _drecord *drec_ixd, const struct _drecord *drec_axd, TDSCOLUMN *curcol, int compute_row, const TDS_DESC *axd, SQLUSMALLINT n_row)
int continue_parse_prepared_query(struct _hstmt *stmt, SQLPOINTER DataPtr, SQLLEN StrLen_or_Ind)
static ssize_t odbc_wchar2hex(TDS_CHAR *dest, size_t destlen, const SQLWCHAR *src, size_t srclen)
int parse_prepared_query(struct _hstmt *stmt, int compute_row)
static int prepared_rpc(struct _hstmt *stmt, int compute_row)
int start_parse_prepared_query(struct _hstmt *stmt, int compute_row)
#define tds_set_param_type
#define tds_free_param_results
#define tds_alloc_param_result
#define tds_alloc_param_data
#define tds_get_conversion_type
#define tds_free_param_result
#define SQL_DEFAULT_PARAM
SQLSMALLINT sql_desc_concise_type
Information about blobs (e.g.
Metadata about columns in regular and compute rows.
TDS_INT column_size
maximun size of data.
unsigned char * column_data
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
TDS_CHAR column_text_sqlputdatainfo
struct tds_column::@124 on_server
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Hold information for any results.
tds_sysdep_int32_type TDS_INT
tds_sysdep_real64_type TDS_FLOAT
#define TDS_RESIZE(p, n_elem)
struct conv_result::cb_t cb