Lines Matching refs:S

35 static int pdo_odbc_sqltype_is_unicode(pdo_odbc_stmt *S, SQLSMALLINT sqltype)  in pdo_odbc_sqltype_is_unicode()  argument
37 if (!S->assume_utf8) return 0; in pdo_odbc_sqltype_is_unicode()
61 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in pdo_odbc_utf82ucs2() local
72 if (S->convbufsize <= ret) { in pdo_odbc_utf82ucs2()
73 S->convbufsize = ret + sizeof(WCHAR); in pdo_odbc_utf82ucs2()
74 S->convbuf = erealloc(S->convbuf, S->convbufsize); in pdo_odbc_utf82ucs2()
77 …ret = MultiByteToWideChar(CP_UTF8, 0, buf, buflen, (LPWSTR)S->convbuf, S->convbufsize / sizeof(WCH… in pdo_odbc_utf82ucs2()
96 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in pdo_odbc_ucs22utf8() local
119 static void free_cols(pdo_stmt_t *stmt, pdo_odbc_stmt *S) in free_cols() argument
121 if (S->cols) { in free_cols()
124 for (i = 0; i < S->col_count; i++) { in free_cols()
125 if (S->cols[i].data) { in free_cols()
126 efree(S->cols[i].data); in free_cols()
129 efree(S->cols); in free_cols()
130 S->cols = NULL; in free_cols()
131 S->col_count = 0; in free_cols()
137 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_dtor() local
139 if (S->stmt != SQL_NULL_HANDLE) { in odbc_stmt_dtor()
141 SQLCloseCursor(S->stmt); in odbc_stmt_dtor()
143 SQLFreeHandle(SQL_HANDLE_STMT, S->stmt); in odbc_stmt_dtor()
144 S->stmt = SQL_NULL_HANDLE; in odbc_stmt_dtor()
147 free_cols(stmt, S); in odbc_stmt_dtor()
148 if (S->convbuf) { in odbc_stmt_dtor()
149 efree(S->convbuf); in odbc_stmt_dtor()
151 efree(S); in odbc_stmt_dtor()
159 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_execute() local
164 SQLCloseCursor(S->stmt); in odbc_stmt_execute()
167 rc = SQLExecute(S->stmt); in odbc_stmt_execute()
172 rc = SQLParamData(S->stmt, (SQLPOINTER*)&param); in odbc_stmt_execute()
195 rc1 = SQLPutData(S->stmt, Z_STRVAL_P(parameter), in odbc_stmt_execute()
202 rc1 = SQLPutData(S->stmt, S->convbuf, ulen); in odbc_stmt_execute()
209 SQLCloseCursor(S->stmt); in odbc_stmt_execute()
225 SQLCloseCursor(S->stmt); in odbc_stmt_execute()
242 rc1 = SQLPutData(S->stmt, buf, len); in odbc_stmt_execute()
267 SQLRowCount(S->stmt, &row_count); in odbc_stmt_execute()
270 if (S->cols == NULL) { in odbc_stmt_execute()
275 SQLNumResultCols(S->stmt, &colcount); in odbc_stmt_execute()
277 stmt->column_count = S->col_count = (int)colcount; in odbc_stmt_execute()
278 S->cols = ecalloc(colcount, sizeof(pdo_odbc_column)); in odbc_stmt_execute()
279 S->going_long = 0; in odbc_stmt_execute()
288 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_param_hook() local
326 …rc = SQLDescribeParam(S->stmt, (SQLUSMALLINT) param->paramno+1, &sqltype, &precision, &scale, &nul… in odbc_stmt_param_hook()
360 P->is_unicode = pdo_odbc_sqltype_is_unicode(S, sqltype); in odbc_stmt_param_hook()
390 rc = SQLBindParameter(S->stmt, (SQLUSMALLINT) param->paramno+1, in odbc_stmt_param_hook()
483 memcpy(P->outbuf, S->convbuf, P->len); in odbc_stmt_param_hook()
528 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_fetch() local
541 rc = SQLFetchScroll(S->stmt, odbcori, offset); in odbc_stmt_fetch()
563 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_describe() local
570 rc = SQLDescribeCol(S->stmt, colno+1, (SQLCHAR *) S->cols[colno].colname, in odbc_stmt_describe()
571 sizeof(S->cols[colno].colname)-1, &colnamelen, in odbc_stmt_describe()
572 &S->cols[colno].coltype, &colsize, NULL, NULL); in odbc_stmt_describe()
579 (S->cols[colno].coltype == SQL_VARCHAR || in odbc_stmt_describe()
580 S->cols[colno].coltype == SQL_LONGVARCHAR || in odbc_stmt_describe()
582 S->cols[colno].coltype == SQL_WVARCHAR || in odbc_stmt_describe()
585 S->cols[colno].coltype == SQL_WLONGVARCHAR || in odbc_stmt_describe()
587 S->cols[colno].coltype == SQL_VARBINARY || in odbc_stmt_describe()
588 S->cols[colno].coltype == SQL_LONGVARBINARY)) { in odbc_stmt_describe()
589 S->going_long = 1; in odbc_stmt_describe()
599 rc = SQLColAttribute(S->stmt, colno+1, in odbc_stmt_describe()
611 col->maxlen = S->cols[colno].datalen = colsize; in odbc_stmt_describe()
612 col->name = zend_string_init(S->cols[colno].colname, colnamelen, 0); in odbc_stmt_describe()
613 S->cols[colno].is_unicode = pdo_odbc_sqltype_is_unicode(S, S->cols[colno].coltype); in odbc_stmt_describe()
618 if (colsize < 256 && !S->going_long) { in odbc_stmt_describe()
619 S->cols[colno].data = emalloc(colsize+1); in odbc_stmt_describe()
620 S->cols[colno].is_long = 0; in odbc_stmt_describe()
622 rc = SQLBindCol(S->stmt, colno+1, in odbc_stmt_describe()
623 S->cols[colno].is_unicode ? SQL_C_BINARY : SQL_C_CHAR, in odbc_stmt_describe()
624 S->cols[colno].data, in odbc_stmt_describe()
625 S->cols[colno].datalen+1, &S->cols[colno].fetched_len); in odbc_stmt_describe()
634 S->cols[colno].data = emalloc(256); in odbc_stmt_describe()
635 S->going_long = 1; in odbc_stmt_describe()
636 S->cols[colno].is_long = 1; in odbc_stmt_describe()
651 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_get_col() local
652 pdo_odbc_column *C = &S->cols[colno]; in odbc_stmt_get_col()
663 rc = SQLGetData(S->stmt, colno+1, C->is_unicode ? SQL_C_BINARY : SQL_C_CHAR, C->data, in odbc_stmt_get_col()
690 …rc = SQLGetData(S->stmt, colno+1, C->is_unicode ? SQL_C_BINARY : SQL_C_CHAR, buf2, 256, &C->fetche… in odbc_stmt_get_col()
769 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_set_param() local
774 rc = SQLSetCursorName(S->stmt, (SQLCHAR *) Z_STRVAL_P(val), Z_STRLEN_P(val)); in odbc_stmt_set_param()
783 S->assume_utf8 = zval_is_true(val); in odbc_stmt_set_param()
786 strcpy(S->einfo.last_err_msg, "Unknown Attribute"); in odbc_stmt_set_param()
787 S->einfo.what = "setAttribute"; in odbc_stmt_set_param()
788 strcpy(S->einfo.last_state, "IM001"); in odbc_stmt_set_param()
796 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_get_attr() local
803 rc = SQLGetCursorName(S->stmt, (SQLCHAR *) buf, sizeof(buf), &len); in odbc_stmt_get_attr()
814 ZVAL_BOOL(val, S->assume_utf8 ? 1 : 0); in odbc_stmt_get_attr()
818 strcpy(S->einfo.last_err_msg, "Unknown Attribute"); in odbc_stmt_get_attr()
819 S->einfo.what = "getAttribute"; in odbc_stmt_get_attr()
820 strcpy(S->einfo.last_state, "IM001"); in odbc_stmt_get_attr()
829 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_next_rowset() local
834 rc = SQLMoreResults(S->stmt); in odbc_stmt_next_rowset()
840 free_cols(stmt, S); in odbc_stmt_next_rowset()
842 SQLNumResultCols(S->stmt, &colcount); in odbc_stmt_next_rowset()
843 stmt->column_count = S->col_count = (int)colcount; in odbc_stmt_next_rowset()
844 S->cols = ecalloc(colcount, sizeof(pdo_odbc_column)); in odbc_stmt_next_rowset()
845 S->going_long = 0; in odbc_stmt_next_rowset()
853 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_close_cursor() local
855 rc = SQLCloseCursor(S->stmt); in odbc_stmt_close_cursor()