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) in free_cols() argument
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); 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*)&param); in odbc_stmt_execute()
201 SQLPutData(S->stmt, Z_STRVAL_P(parameter), in odbc_stmt_execute()
205 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 SQLPutData(S->stmt, buf, len); in odbc_stmt_execute()
264 SQLRowCount(S->stmt, &row_count); in odbc_stmt_execute()
272 SQLNumResultCols(S->stmt, &colcount); in odbc_stmt_execute()
275 S->cols = ecalloc(colcount, sizeof(pdo_odbc_column)); in odbc_stmt_execute()
276 S->going_long = 0; in odbc_stmt_execute()
285 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_param_hook() local
323 …rc = SQLDescribeParam(S->stmt, (SQLUSMALLINT) param->paramno+1, &sqltype, &precision, &scale, &nul… in odbc_stmt_param_hook()
350 P->is_unicode = pdo_odbc_sqltype_is_unicode(S, sqltype); in odbc_stmt_param_hook()
380 rc = SQLBindParameter(S->stmt, (SQLUSMALLINT) param->paramno+1, in odbc_stmt_param_hook()
473 memcpy(P->outbuf, S->convbuf, P->len); in odbc_stmt_param_hook()
510 srcbuf = S->convbuf; in odbc_stmt_param_hook()
531 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_fetch() local
544 rc = SQLFetchScroll(S->stmt, odbcori, offset); in odbc_stmt_fetch()
566 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_describe() local
573 rc = SQLDescribeCol(S->stmt, colno+1, S->cols[colno].colname, in odbc_stmt_describe()
574 sizeof(S->cols[colno].colname)-1, &colnamelen, in odbc_stmt_describe()
575 &S->cols[colno].coltype, &colsize, NULL, NULL); in odbc_stmt_describe()
582 (S->cols[colno].coltype == SQL_VARCHAR || in odbc_stmt_describe()
583 S->cols[colno].coltype == SQL_LONGVARCHAR || in odbc_stmt_describe()
585 S->cols[colno].coltype == SQL_WVARCHAR || in odbc_stmt_describe()
588 S->cols[colno].coltype == SQL_WLONGVARCHAR || in odbc_stmt_describe()
590 S->cols[colno].coltype == SQL_VARBINARY || in odbc_stmt_describe()
591 S->cols[colno].coltype == SQL_LONGVARBINARY)) { in odbc_stmt_describe()
592 S->going_long = 1; in odbc_stmt_describe()
602 rc = SQLColAttribute(S->stmt, colno+1, in odbc_stmt_describe()
614 col->maxlen = S->cols[colno].datalen = colsize; in odbc_stmt_describe()
615 col->name = zend_string_init(S->cols[colno].colname, colnamelen, 0); in odbc_stmt_describe()
616 S->cols[colno].is_unicode = pdo_odbc_sqltype_is_unicode(S, S->cols[colno].coltype); in odbc_stmt_describe()
624 if (colsize < 256 && !S->going_long) { in odbc_stmt_describe()
625 S->cols[colno].data = emalloc(colsize+1); in odbc_stmt_describe()
626 S->cols[colno].is_long = 0; in odbc_stmt_describe()
628 rc = SQLBindCol(S->stmt, colno+1, in odbc_stmt_describe()
629 S->cols[colno].is_unicode ? SQL_C_BINARY : SQL_C_CHAR, in odbc_stmt_describe()
630 S->cols[colno].data, in odbc_stmt_describe()
631 S->cols[colno].datalen+1, &S->cols[colno].fetched_len); in odbc_stmt_describe()
640 S->cols[colno].data = emalloc(256); in odbc_stmt_describe()
641 S->going_long = 1; in odbc_stmt_describe()
642 S->cols[colno].is_long = 1; in odbc_stmt_describe()
650 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_get_col() local
651 pdo_odbc_column *C = &S->cols[colno]; in odbc_stmt_get_col()
664 rc = SQLGetData(S->stmt, colno+1, C->is_unicode ? SQL_C_BINARY : SQL_C_CHAR, C->data, in odbc_stmt_get_col()
691 rc = SQLGetData(S->stmt, colno+1, SQL_C_CHAR, buf2, 256, &C->fetched_len); in odbc_stmt_get_col()
768 memcpy(*ptr, S->convbuf, ulen+1); in odbc_stmt_get_col()
778 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_set_param() local
783 rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRLEN_P(val)); in odbc_stmt_set_param()
792 S->assume_utf8 = zval_is_true(val); in odbc_stmt_set_param()
795 strcpy(S->einfo.last_err_msg, "Unknown Attribute"); in odbc_stmt_set_param()
796 S->einfo.what = "setAttribute"; in odbc_stmt_set_param()
797 strcpy(S->einfo.last_state, "IM001"); in odbc_stmt_set_param()
805 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_get_attr() local
812 rc = SQLGetCursorName(S->stmt, buf, sizeof(buf), &len); in odbc_stmt_get_attr()
823 ZVAL_BOOL(val, S->assume_utf8 ? 1 : 0); in odbc_stmt_get_attr()
827 strcpy(S->einfo.last_err_msg, "Unknown Attribute"); in odbc_stmt_get_attr()
828 S->einfo.what = "getAttribute"; in odbc_stmt_get_attr()
829 strcpy(S->einfo.last_state, "IM001"); in odbc_stmt_get_attr()
838 pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; in odbc_stmt_next_rowset() local
843 rc = SQLMoreResults(S->stmt); in odbc_stmt_next_rowset()
849 free_cols(stmt, S); in odbc_stmt_next_rowset()
851 SQLNumResultCols(S->stmt, &colcount); in odbc_stmt_next_rowset()
853 S->cols = ecalloc(colcount, sizeof(pdo_odbc_column)); in odbc_stmt_next_rowset()
854 S->going_long = 0; in odbc_stmt_next_rowset()