Lines Matching refs:S
39 static int pdo_odbc_sqltype_is_unicode(pdo_odbc_stmt *S, SWORD sqltype) in pdo_odbc_sqltype_is_unicode() argument
41 if (!S->assume_utf8) return 0; in pdo_odbc_sqltype_is_unicode()
65 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in pdo_odbc_utf82ucs2() local
76 if (S->convbufsize <= ret) { in pdo_odbc_utf82ucs2()
77 S->convbufsize = ret + sizeof(WCHAR); in pdo_odbc_utf82ucs2()
78 S->convbuf = erealloc(S->convbuf, S->convbufsize); in pdo_odbc_utf82ucs2()
81 …ret = MultiByteToWideChar(CP_UTF8, 0, buf, buflen, (LPWSTR)S->convbuf, S->convbufsize / sizeof(WCH… in pdo_odbc_utf82ucs2()
100 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in pdo_odbc_ucs22utf8() local
108 if (S->convbufsize <= ret) { in pdo_odbc_ucs22utf8()
109 S->convbufsize = ret + 1; in pdo_odbc_ucs22utf8()
110 S->convbuf = erealloc(S->convbuf, S->convbufsize); in pdo_odbc_ucs22utf8()
113 …ret = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)buf, buflen/sizeof(WCHAR), S->convbuf, S->convbufsi… in pdo_odbc_ucs22utf8()
119 S->convbuf[*outlen] = '\0'; in pdo_odbc_ucs22utf8()
126 static void free_cols(pdo_stmt_t *stmt, pdo_odbc_stmt *S TSRMLS_DC) in free_cols()
128 if (S->cols) { in free_cols()
132 if (S->cols[i].data) { in free_cols()
133 efree(S->cols[i].data); in free_cols()
136 efree(S->cols); in free_cols()
137 S->cols = NULL; in free_cols()
143 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_dtor() local
145 if (S->stmt != SQL_NULL_HANDLE) { in odbc_stmt_dtor()
147 SQLCloseCursor(S->stmt); in odbc_stmt_dtor()
149 SQLFreeHandle(SQL_HANDLE_STMT, S->stmt); in odbc_stmt_dtor()
150 S->stmt = SQL_NULL_HANDLE; in odbc_stmt_dtor()
153 free_cols(stmt, S TSRMLS_CC); in odbc_stmt_dtor()
154 if (S->convbuf) { in odbc_stmt_dtor()
155 efree(S->convbuf); in odbc_stmt_dtor()
157 efree(S); in odbc_stmt_dtor()
165 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_execute() local
170 SQLCloseCursor(S->stmt); in odbc_stmt_execute()
173 rc = SQLExecute(S->stmt); in odbc_stmt_execute()
178 rc = SQLParamData(S->stmt, (SQLPOINTER*)¶m); in odbc_stmt_execute()
195 SQLPutData(S->stmt, Z_STRVAL_P(param->parameter), in odbc_stmt_execute()
199 SQLPutData(S->stmt, S->convbuf, ulen); in odbc_stmt_execute()
203 SQLCloseCursor(S->stmt); in odbc_stmt_execute()
219 SQLCloseCursor(S->stmt); in odbc_stmt_execute()
236 SQLPutData(S->stmt, buf, len); in odbc_stmt_execute()
258 SQLRowCount(S->stmt, &row_count); in odbc_stmt_execute()
266 SQLNumResultCols(S->stmt, &colcount); in odbc_stmt_execute()
269 S->cols = ecalloc(colcount, sizeof(pdo_odbc_column)); in odbc_stmt_execute()
270 S->going_long = 0; in odbc_stmt_execute()
279 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_param_hook() local
316 …rc = SQLDescribeParam(S->stmt, (SQLUSMALLINT) param->paramno+1, &sqltype, &precision, &scale, &nul… in odbc_stmt_param_hook()
343 P->is_unicode = pdo_odbc_sqltype_is_unicode(S, sqltype); in odbc_stmt_param_hook()
373 rc = SQLBindParameter(S->stmt, (SQLUSMALLINT) param->paramno+1, in odbc_stmt_param_hook()
460 memcpy(P->outbuf, S->convbuf, P->len); in odbc_stmt_param_hook()
492 srcbuf = S->convbuf; in odbc_stmt_param_hook()
515 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_fetch() local
528 rc = SQLFetchScroll(S->stmt, odbcori, offset); in odbc_stmt_fetch()
550 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_describe() local
557 rc = SQLDescribeCol(S->stmt, colno+1, S->cols[colno].colname, in odbc_stmt_describe()
558 sizeof(S->cols[colno].colname)-1, &colnamelen, in odbc_stmt_describe()
559 &S->cols[colno].coltype, &colsize, NULL, NULL); in odbc_stmt_describe()
568 rc = SQLColAttribute(S->stmt, colno+1, in odbc_stmt_describe()
580 col->maxlen = S->cols[colno].datalen = colsize; in odbc_stmt_describe()
582 col->name = estrdup(S->cols[colno].colname); in odbc_stmt_describe()
583 S->cols[colno].is_unicode = pdo_odbc_sqltype_is_unicode(S, S->cols[colno].coltype); in odbc_stmt_describe()
591 if (colsize < 256 && !S->going_long) { in odbc_stmt_describe()
592 S->cols[colno].data = emalloc(colsize+1); in odbc_stmt_describe()
593 S->cols[colno].is_long = 0; in odbc_stmt_describe()
595 rc = SQLBindCol(S->stmt, colno+1, in odbc_stmt_describe()
596 S->cols[colno].is_unicode ? SQL_C_BINARY : SQL_C_CHAR, in odbc_stmt_describe()
597 S->cols[colno].data, in odbc_stmt_describe()
598 S->cols[colno].datalen+1, &S->cols[colno].fetched_len); in odbc_stmt_describe()
607 S->cols[colno].data = emalloc(256); in odbc_stmt_describe()
608 S->going_long = 1; in odbc_stmt_describe()
609 S->cols[colno].is_long = 1; in odbc_stmt_describe()
617 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_get_col() local
618 pdo_odbc_column *C = &S->cols[colno]; in odbc_stmt_get_col()
631 rc = SQLGetData(S->stmt, colno+1, C->is_unicode ? SQL_C_BINARY : SQL_C_CHAR, C->data, in odbc_stmt_get_col()
658 rc = SQLGetData(S->stmt, colno+1, SQL_C_CHAR, buf2, 256, &C->fetched_len); in odbc_stmt_get_col()
735 memcpy(*ptr, S->convbuf, ulen+1); in odbc_stmt_get_col()
745 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_set_param() local
750 rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRLEN_P(val)); in odbc_stmt_set_param()
759 S->assume_utf8 = zval_is_true(val); in odbc_stmt_set_param()
762 strcpy(S->einfo.last_err_msg, "Unknown Attribute"); in odbc_stmt_set_param()
763 S->einfo.what = "setAttribute"; in odbc_stmt_set_param()
764 strcpy(S->einfo.last_state, "IM001"); in odbc_stmt_set_param()
772 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_get_attr() local
779 rc = SQLGetCursorName(S->stmt, buf, sizeof(buf), &len); in odbc_stmt_get_attr()
790 ZVAL_BOOL(val, S->assume_utf8 ? 1 : 0); in odbc_stmt_get_attr()
794 strcpy(S->einfo.last_err_msg, "Unknown Attribute"); in odbc_stmt_get_attr()
795 S->einfo.what = "getAttribute"; in odbc_stmt_get_attr()
796 strcpy(S->einfo.last_state, "IM001"); in odbc_stmt_get_attr()
805 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_next_rowset() local
810 rc = SQLMoreResults(S->stmt); in odbc_stmt_next_rowset()
816 free_cols(stmt, S TSRMLS_CC); in odbc_stmt_next_rowset()
818 SQLNumResultCols(S->stmt, &colcount); in odbc_stmt_next_rowset()
820 S->cols = ecalloc(colcount, sizeof(pdo_odbc_column)); in odbc_stmt_next_rowset()
821 S->going_long = 0; in odbc_stmt_next_rowset()