Lines Matching refs:S

37 static int pdo_odbc_sqltype_is_unicode(pdo_odbc_stmt *S, SWORD sqltype)  in pdo_odbc_sqltype_is_unicode()  argument
39 if (!S->assume_utf8) return 0; in pdo_odbc_sqltype_is_unicode()
63 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in pdo_odbc_utf82ucs2() local
74 if (S->convbufsize <= ret) { in pdo_odbc_utf82ucs2()
75 S->convbufsize = ret + sizeof(WCHAR); in pdo_odbc_utf82ucs2()
76 S->convbuf = erealloc(S->convbuf, S->convbufsize); in pdo_odbc_utf82ucs2()
79 …ret = MultiByteToWideChar(CP_UTF8, 0, buf, buflen, (LPWSTR)S->convbuf, S->convbufsize / sizeof(WCH… in pdo_odbc_utf82ucs2()
98 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in pdo_odbc_ucs22utf8() local
106 if (S->convbufsize <= ret) { in pdo_odbc_ucs22utf8()
107 S->convbufsize = ret + 1; in pdo_odbc_ucs22utf8()
108 S->convbuf = erealloc(S->convbuf, S->convbufsize); in pdo_odbc_ucs22utf8()
111 …ret = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)buf, buflen/sizeof(WCHAR), S->convbuf, S->convbufsi… in pdo_odbc_ucs22utf8()
117 S->convbuf[*outlen] = '\0'; in pdo_odbc_ucs22utf8()
124 static void free_cols(pdo_stmt_t *stmt, pdo_odbc_stmt *S) in free_cols() argument
126 if (S->cols) { in free_cols()
129 for (i = 0; i < S->col_count; i++) { in free_cols()
130 if (S->cols[i].data) { in free_cols()
131 efree(S->cols[i].data); in free_cols()
134 efree(S->cols); in free_cols()
135 S->cols = NULL; in free_cols()
136 S->col_count = 0; in free_cols()
142 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_dtor() local
144 if (S->stmt != SQL_NULL_HANDLE) { in odbc_stmt_dtor()
146 SQLCloseCursor(S->stmt); in odbc_stmt_dtor()
148 SQLFreeHandle(SQL_HANDLE_STMT, S->stmt); in odbc_stmt_dtor()
149 S->stmt = SQL_NULL_HANDLE; in odbc_stmt_dtor()
152 free_cols(stmt, S); in odbc_stmt_dtor()
153 if (S->convbuf) { in odbc_stmt_dtor()
154 efree(S->convbuf); in odbc_stmt_dtor()
156 efree(S); in odbc_stmt_dtor()
164 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_execute() local
169 SQLCloseCursor(S->stmt); in odbc_stmt_execute()
172 rc = SQLExecute(S->stmt); in odbc_stmt_execute()
177 rc = SQLParamData(S->stmt, (SQLPOINTER*)&param); in odbc_stmt_execute()
200 SQLPutData(S->stmt, Z_STRVAL_P(parameter), in odbc_stmt_execute()
204 SQLPutData(S->stmt, S->convbuf, ulen); in odbc_stmt_execute()
208 SQLCloseCursor(S->stmt); in odbc_stmt_execute()
224 SQLCloseCursor(S->stmt); in odbc_stmt_execute()
241 SQLPutData(S->stmt, buf, len); in odbc_stmt_execute()
263 SQLRowCount(S->stmt, &row_count); in odbc_stmt_execute()
266 if (S->cols == NULL) { in odbc_stmt_execute()
271 SQLNumResultCols(S->stmt, &colcount); in odbc_stmt_execute()
273 stmt->column_count = S->col_count = (int)colcount; in odbc_stmt_execute()
274 S->cols = ecalloc(colcount, sizeof(pdo_odbc_column)); in odbc_stmt_execute()
275 S->going_long = 0; in odbc_stmt_execute()
284 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_param_hook() local
322 …rc = SQLDescribeParam(S->stmt, (SQLUSMALLINT) param->paramno+1, &sqltype, &precision, &scale, &nul… in odbc_stmt_param_hook()
349 P->is_unicode = pdo_odbc_sqltype_is_unicode(S, sqltype); in odbc_stmt_param_hook()
379 rc = SQLBindParameter(S->stmt, (SQLUSMALLINT) param->paramno+1, in odbc_stmt_param_hook()
472 memcpy(P->outbuf, S->convbuf, P->len); in odbc_stmt_param_hook()
509 srcbuf = S->convbuf; in odbc_stmt_param_hook()
530 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_fetch() local
543 rc = SQLFetchScroll(S->stmt, odbcori, offset); in odbc_stmt_fetch()
565 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_describe() local
572 rc = SQLDescribeCol(S->stmt, colno+1, S->cols[colno].colname, in odbc_stmt_describe()
573 sizeof(S->cols[colno].colname)-1, &colnamelen, in odbc_stmt_describe()
574 &S->cols[colno].coltype, &colsize, NULL, NULL); in odbc_stmt_describe()
581 (S->cols[colno].coltype == SQL_VARCHAR || in odbc_stmt_describe()
582 S->cols[colno].coltype == SQL_LONGVARCHAR || in odbc_stmt_describe()
584 S->cols[colno].coltype == SQL_WVARCHAR || in odbc_stmt_describe()
587 S->cols[colno].coltype == SQL_WLONGVARCHAR || in odbc_stmt_describe()
589 S->cols[colno].coltype == SQL_VARBINARY || in odbc_stmt_describe()
590 S->cols[colno].coltype == SQL_LONGVARBINARY)) { in odbc_stmt_describe()
591 S->going_long = 1; in odbc_stmt_describe()
601 rc = SQLColAttribute(S->stmt, colno+1, in odbc_stmt_describe()
613 col->maxlen = S->cols[colno].datalen = colsize; in odbc_stmt_describe()
614 col->name = zend_string_init(S->cols[colno].colname, colnamelen, 0); in odbc_stmt_describe()
615 S->cols[colno].is_unicode = pdo_odbc_sqltype_is_unicode(S, S->cols[colno].coltype); in odbc_stmt_describe()
623 if (colsize < 256 && !S->going_long) { in odbc_stmt_describe()
624 S->cols[colno].data = emalloc(colsize+1); in odbc_stmt_describe()
625 S->cols[colno].is_long = 0; in odbc_stmt_describe()
627 rc = SQLBindCol(S->stmt, colno+1, in odbc_stmt_describe()
628 S->cols[colno].is_unicode ? SQL_C_BINARY : SQL_C_CHAR, in odbc_stmt_describe()
629 S->cols[colno].data, in odbc_stmt_describe()
630 S->cols[colno].datalen+1, &S->cols[colno].fetched_len); in odbc_stmt_describe()
639 S->cols[colno].data = emalloc(256); in odbc_stmt_describe()
640 S->going_long = 1; in odbc_stmt_describe()
641 S->cols[colno].is_long = 1; in odbc_stmt_describe()
649 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_get_col() local
650 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, SQL_C_CHAR, buf2, 256, &C->fetched_len); in odbc_stmt_get_col()
767 memcpy(*ptr, S->convbuf, ulen+1); in odbc_stmt_get_col()
777 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_set_param() local
782 rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRLEN_P(val)); in odbc_stmt_set_param()
791 S->assume_utf8 = zval_is_true(val); in odbc_stmt_set_param()
794 strcpy(S->einfo.last_err_msg, "Unknown Attribute"); in odbc_stmt_set_param()
795 S->einfo.what = "setAttribute"; in odbc_stmt_set_param()
796 strcpy(S->einfo.last_state, "IM001"); in odbc_stmt_set_param()
804 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_get_attr() local
811 rc = SQLGetCursorName(S->stmt, buf, sizeof(buf), &len); in odbc_stmt_get_attr()
822 ZVAL_BOOL(val, S->assume_utf8 ? 1 : 0); in odbc_stmt_get_attr()
826 strcpy(S->einfo.last_err_msg, "Unknown Attribute"); in odbc_stmt_get_attr()
827 S->einfo.what = "getAttribute"; in odbc_stmt_get_attr()
828 strcpy(S->einfo.last_state, "IM001"); in odbc_stmt_get_attr()
837 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_next_rowset() local
842 rc = SQLMoreResults(S->stmt); in odbc_stmt_next_rowset()
848 free_cols(stmt, S); in odbc_stmt_next_rowset()
850 SQLNumResultCols(S->stmt, &colcount); in odbc_stmt_next_rowset()
851 stmt->column_count = S->col_count = (int)colcount; in odbc_stmt_next_rowset()
852 S->cols = ecalloc(colcount, sizeof(pdo_odbc_column)); in odbc_stmt_next_rowset()
853 S->going_long = 0; in odbc_stmt_next_rowset()
861 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_close_cursor() local
863 rc = SQLCloseCursor(S->stmt); in odbc_stmt_close_cursor()