Lines Matching refs:result

56 #define CHECK_ODBC_RESULT(result) \  argument
57 if (result->conn_ptr == NULL) { \
76 static void odbc_insert_new_result(odbc_connection *connection, zval *result) in odbc_insert_new_result() argument
78 ZEND_ASSERT(Z_TYPE_P(result) == IS_OBJECT); in odbc_insert_new_result()
80 ZEND_ASSERT(instanceof_function(Z_OBJCE_P(result), odbc_result_ce)); in odbc_insert_new_result()
83 odbc_result *res = Z_ODBC_RESULT_P(result); in odbc_insert_new_result()
86 zend_hash_index_add_new(&connection->results, res->index, result); in odbc_insert_new_result()
87 Z_ADDREF_P(result); in odbc_insert_new_result()
185 static zend_result odbc_connection_cast_object(zend_object *obj, zval *result, int type) in odbc_connection_cast_object() argument
188 ZVAL_LONG(result, obj->handle); in odbc_connection_cast_object()
193 return zend_std_cast_object_tostring(obj, result, type); in odbc_connection_cast_object()
228 static zend_result odbc_result_cast_object(zend_object *obj, zval *result, int type) in odbc_result_cast_object() argument
231 ZVAL_LONG(result, obj->handle); in odbc_result_cast_object()
236 return zend_std_cast_object_tostring(obj, result, type); in odbc_result_cast_object()
279 odbc_result *result = odbc_result_from_obj(obj); in odbc_result_free_obj() local
281 if (result->conn_ptr) { in odbc_result_free_obj()
282 odbc_result_free(result); in odbc_result_free_obj()
285 zend_object_std_dtor(&result->std); in odbc_result_free_obj()
325 odbc_result *result = Z_ODBC_RESULT_P(p); in ZEND_GET_MODULE() local
326 if (result->conn_ptr) { in ZEND_GET_MODULE()
327 odbc_result_free(result); in ZEND_GET_MODULE()
645 odbc_result *result; in php_odbc_fetch_attribs() local
653 result = Z_ODBC_RESULT_P(pv_res); in php_odbc_fetch_attribs()
654 CHECK_ODBC_RESULT(result); in php_odbc_fetch_attribs()
657 result->longreadlen = flag; in php_odbc_fetch_attribs()
659 result->binmode = flag; in php_odbc_fetch_attribs()
667 void odbc_bindcols(odbc_result *result) in odbc_bindcols() argument
676 result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0); in odbc_bindcols()
678 result->longreadlen = ODBCG(defaultlrl); in odbc_bindcols()
679 result->binmode = ODBCG(defaultbinmode); in odbc_bindcols()
681 for(i = 0; i < result->numcols; i++) { in odbc_bindcols()
685 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_SQL_DESC_NAME, in odbc_bindcols()
686 result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); in odbc_bindcols()
687 result->values[i].coltype = 0; in odbc_bindcols()
688 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, in odbc_bindcols()
689 NULL, 0, NULL, &result->values[i].coltype); in odbc_bindcols()
695 switch(result->values[i].coltype) { in odbc_bindcols()
703 result->values[i].value = NULL; in odbc_bindcols()
708 result->values[i].value = (char *)emalloc(27); in odbc_bindcols()
709 SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, in odbc_bindcols()
710 27, &result->values[i].vallen); in odbc_bindcols()
725 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), colfieldid, in odbc_bindcols()
739 …if (SQL_SUCCESS == SQLGetDiagRec(SQL_HANDLE_STMT, result->stmt, 1, state, &err, errtxt, 128, NULL)… in odbc_bindcols()
747 rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE, in odbc_bindcols()
755 if (result->values[i].coltype == SQL_WVARCHAR && displaysize == 0) { in odbc_bindcols()
756 result->values[i].coltype = SQL_WLONGVARCHAR; in odbc_bindcols()
757 result->values[i].value = NULL; in odbc_bindcols()
762 if (SQL_VARCHAR == result->values[i].coltype && displaysize == 0) { in odbc_bindcols()
763 result->values[i].coltype = SQL_LONGVARCHAR; in odbc_bindcols()
764 result->values[i].value = NULL; in odbc_bindcols()
769 if (result->values[i].coltype == SQL_TIMESTAMP) { in odbc_bindcols()
777 result->values[i].value = (char *)emalloc(displaysize + 1); in odbc_bindcols()
778 rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, in odbc_bindcols()
779 displaysize + 1, &result->values[i].vallen); in odbc_bindcols()
812 odbc_result *result; in odbc_column_lengths() local
831 result = Z_ODBC_RESULT_P(pv_res); in odbc_column_lengths()
832 CHECK_ODBC_RESULT(result); in odbc_column_lengths()
839 if (result->numcols == 0) { in odbc_column_lengths()
844 if (pv_num > result->numcols) { in odbc_column_lengths()
849 …PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE… in odbc_column_lengths()
900 odbc_result *result = NULL; in PHP_FUNCTION() local
915 result = Z_ODBC_RESULT_P(return_value); in PHP_FUNCTION()
917 result->numparams = 0; in PHP_FUNCTION()
918 result->param_info = NULL; in PHP_FUNCTION()
920 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
938 if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) { in PHP_FUNCTION()
942 SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, ODBCG(default_cursortype)); in PHP_FUNCTION()
945 result->fetch_abs = 0; in PHP_FUNCTION()
949 rc = SQLPrepare(result->stmt, (SQLCHAR *) query, SQL_NTS); in PHP_FUNCTION()
954 odbc_sql_error(conn, result->stmt, "SQLPrepare"); in PHP_FUNCTION()
957 odbc_sql_error(conn, result->stmt, "SQLPrepare"); in PHP_FUNCTION()
962 SQLNumParams(result->stmt, &(result->numparams)); in PHP_FUNCTION()
963 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
965 if (result->numcols > 0) { in PHP_FUNCTION()
966 odbc_bindcols(result); in PHP_FUNCTION()
968 result->values = NULL; in PHP_FUNCTION()
970 result->conn_ptr = conn; in PHP_FUNCTION()
971 result->fetched = 0; in PHP_FUNCTION()
973result->param_info = (odbc_param_info *) safe_emalloc(sizeof(odbc_param_info), result->numparams, … in PHP_FUNCTION()
974 for (i=0;i<result->numparams;i++) { in PHP_FUNCTION()
975 …rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)(i+1), &result->param_info[i].sqltype, &result->… in PHP_FUNCTION()
976 &result->param_info[i].scale, &result->param_info[i].nullable); in PHP_FUNCTION()
978 odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter"); in PHP_FUNCTION()
979 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in PHP_FUNCTION()
980 efree(result->param_info); in PHP_FUNCTION()
1000 static void odbc_release_params(odbc_result *result, odbc_params_t *params) { in odbc_release_params() argument
1001 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in odbc_release_params()
1002 for (int i = 0; i < result->numparams; i++) { in odbc_release_params()
1021 odbc_result *result; in PHP_FUNCTION() local
1029 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1030 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1032 if (result->numparams > 0) { in PHP_FUNCTION()
1033 if ((ne = zend_hash_num_elements(pv_param_ht)) < result->numparams) { in PHP_FUNCTION()
1034 …php_error_docref(NULL, E_WARNING, "Not enough parameters (%d should be %d) given", ne, result->num… in PHP_FUNCTION()
1038 params = (odbc_params_t *)safe_emalloc(sizeof(odbc_params_t), result->numparams, 0); in PHP_FUNCTION()
1039 for(i = 0; i < result->numparams; i++) { in PHP_FUNCTION()
1049 odbc_release_params(result, params); in PHP_FUNCTION()
1057 if (IS_SQL_BINARY(result->param_info[i-1].sqltype)) { in PHP_FUNCTION()
1068 odbc_release_params(result, params); in PHP_FUNCTION()
1077 odbc_release_params(result, params); in PHP_FUNCTION()
1083 odbc_release_params(result, params); in PHP_FUNCTION()
1092 rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, in PHP_FUNCTION()
1093 …ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1]… in PHP_FUNCTION()
1104 rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, in PHP_FUNCTION()
1105 …ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1]… in PHP_FUNCTION()
1110 odbc_sql_error(result->conn_ptr, result->stmt, "SQLBindParameter"); in PHP_FUNCTION()
1111 odbc_release_params(result, params); in PHP_FUNCTION()
1114 if (++i > result->numparams) break; in PHP_FUNCTION()
1118 rc = SQLFreeStmt(result->stmt, SQL_CLOSE); in PHP_FUNCTION()
1121 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt"); in PHP_FUNCTION()
1124 result->fetched = 0; in PHP_FUNCTION()
1125 rc = SQLExecute(result->stmt); in PHP_FUNCTION()
1131 rc = SQLParamData(result->stmt, (void*)&fp); in PHP_FUNCTION()
1134 SQLPutData(result->stmt, (void*)&buf, nbytes); in PHP_FUNCTION()
1144 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); in PHP_FUNCTION()
1147 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); in PHP_FUNCTION()
1151 if (result->numparams > 0) { in PHP_FUNCTION()
1152 odbc_release_params(result, params); in PHP_FUNCTION()
1159 if (result->numcols == 0) { in PHP_FUNCTION()
1160 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
1162 if (result->numcols > 0) { in PHP_FUNCTION()
1163 odbc_bindcols(result); in PHP_FUNCTION()
1165 result->values = NULL; in PHP_FUNCTION()
1178 odbc_result *result; in PHP_FUNCTION() local
1185 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1186 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1188 …rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN, (void *)&max_len,sizeof(max_len),&… in PHP_FUNCTION()
1195 rc = SQLGetCursorName(result->stmt, (SQLCHAR *) cursorname, (SQLSMALLINT)max_len, &len); in PHP_FUNCTION()
1202 SQLError( result->conn_ptr->henv, result->conn_ptr->hdbc, in PHP_FUNCTION()
1203 result->stmt, (SQLCHAR *) state, &error, (SQLCHAR *) errormsg, in PHP_FUNCTION()
1206 snprintf(cursorname, max_len+1, "php_curs_" ZEND_ULONG_FMT, (zend_ulong)result->stmt); in PHP_FUNCTION()
1207 if (SQLSetCursorName(result->stmt, (SQLCHAR *) cursorname, SQL_NTS) != SQL_SUCCESS) { in PHP_FUNCTION()
1208 odbc_sql_error(result->conn_ptr, result->stmt, "SQLSetCursorName"); in PHP_FUNCTION()
1292 odbc_result *result = NULL; in PHP_FUNCTION() local
1306 result = Z_ODBC_RESULT_P(return_value); in PHP_FUNCTION()
1308 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
1326 if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) { in PHP_FUNCTION()
1330 SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, ODBCG(default_cursortype)); in PHP_FUNCTION()
1333 result->fetch_abs = 0; in PHP_FUNCTION()
1337 rc = SQLExecDirect(result->stmt, (SQLCHAR *) query, SQL_NTS); in PHP_FUNCTION()
1342 odbc_sql_error(conn, result->stmt, "SQLExecDirect"); in PHP_FUNCTION()
1343 SQLFreeStmt(result->stmt, SQL_DROP); in PHP_FUNCTION()
1348 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
1351 if (result->numcols > 0) { in PHP_FUNCTION()
1352 odbc_bindcols(result); in PHP_FUNCTION()
1354 result->values = NULL; in PHP_FUNCTION()
1356 result->conn_ptr = conn; in PHP_FUNCTION()
1357 result->fetched = 0; in PHP_FUNCTION()
1371 odbc_result *result; in php_odbc_fetch_hash() local
1387 result = Z_ODBC_RESULT_P(pv_res); in php_odbc_fetch_hash()
1388 CHECK_ODBC_RESULT(result); in php_odbc_fetch_hash()
1398 if (result->numcols == 0) { in php_odbc_fetch_hash()
1404 if (result->fetch_abs) { in php_odbc_fetch_hash()
1406 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,(SQLLEN)pv_row,&crow,RowStatus); in php_odbc_fetch_hash()
1408 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in php_odbc_fetch_hash()
1412 rc = SQLFetch(result->stmt); in php_odbc_fetch_hash()
1417 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExtendedFetch"); in php_odbc_fetch_hash()
1419 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFetch"); in php_odbc_fetch_hash()
1428 if (!pv_row_is_null && pv_row > 0 && result->fetch_abs) in php_odbc_fetch_hash()
1429 result->fetched = (SQLLEN)pv_row; in php_odbc_fetch_hash()
1432 result->fetched++; in php_odbc_fetch_hash()
1434 for(i = 0; i < result->numcols; i++) { in php_odbc_fetch_hash()
1437 switch(result->values[i].coltype) { in php_odbc_fetch_hash()
1441 if (result->binmode <= 0) { in php_odbc_fetch_hash()
1445 if (result->binmode == 1) { in php_odbc_fetch_hash()
1453 if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { in php_odbc_fetch_hash()
1458 buf = emalloc(result->longreadlen + 1); in php_odbc_fetch_hash()
1461 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1), sql_c_type, buf, result->longreadlen + 1, &re… in php_odbc_fetch_hash()
1464 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in php_odbc_fetch_hash()
1470 ZVAL_STRINGL(&tmp, buf, result->longreadlen); in php_odbc_fetch_hash()
1474 } else if (result->values[i].vallen == SQL_NULL_DATA) { in php_odbc_fetch_hash()
1477 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in php_odbc_fetch_hash()
1481 ZVAL_STRINGL(&tmp, buf, result->values[i].vallen); in php_odbc_fetch_hash()
1486 if (result->values[i].vallen == SQL_NULL_DATA) { in php_odbc_fetch_hash()
1489 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in php_odbc_fetch_hash()
1494 ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen); in php_odbc_fetch_hash()
1501 if (!*(result->values[i].name) && Z_TYPE(tmp) == IS_STRING) { in php_odbc_fetch_hash()
1504 …zend_hash_str_update(Z_ARRVAL_P(return_value), result->values[i].name, strlen(result->values[i].na… in php_odbc_fetch_hash()
1537 odbc_result *result; in PHP_FUNCTION() local
1553 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1554 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1564 if (result->numcols == 0) { in PHP_FUNCTION()
1575 if (result->fetch_abs) { in PHP_FUNCTION()
1577 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,(SQLLEN)pv_row,&crow,RowStatus); in PHP_FUNCTION()
1579 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1583 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1588 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExtendedFetch"); in PHP_FUNCTION()
1590 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFetch"); in PHP_FUNCTION()
1597 if (!pv_row_is_null && pv_row > 0 && result->fetch_abs) in PHP_FUNCTION()
1598 result->fetched = (SQLLEN)pv_row; in PHP_FUNCTION()
1601 result->fetched++; in PHP_FUNCTION()
1603 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1606 switch(result->values[i].coltype) { in PHP_FUNCTION()
1610 if (result->binmode <= 0) { in PHP_FUNCTION()
1614 if (result->binmode == 1) sql_c_type = SQL_C_BINARY; in PHP_FUNCTION()
1622 if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { in PHP_FUNCTION()
1628 buf = emalloc(result->longreadlen + 1); in PHP_FUNCTION()
1630 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen + 1, &res… in PHP_FUNCTION()
1633 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1638 ZVAL_STRINGL(&tmp, buf, result->longreadlen); in PHP_FUNCTION()
1642 } else if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1645 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1649 ZVAL_STRINGL(&tmp, buf, result->values[i].vallen); in PHP_FUNCTION()
1654 if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1657 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1662 ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen); in PHP_FUNCTION()
1668 RETURN_LONG(result->numcols); in PHP_FUNCTION()
1675 odbc_result *result; in PHP_FUNCTION() local
1689 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1690 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1703 if (result->numcols == 0) { in PHP_FUNCTION()
1709 if (result->fetch_abs) { in PHP_FUNCTION()
1711 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,(SQLLEN)pv_row,&crow,RowStatus); in PHP_FUNCTION()
1713 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1717 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1722 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExtendedFetch"); in PHP_FUNCTION()
1724 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFetch"); in PHP_FUNCTION()
1732 result->fetched = (SQLLEN)pv_row; in PHP_FUNCTION()
1735 result->fetched++; in PHP_FUNCTION()
1749 odbc_result *result; in PHP_FUNCTION() local
1772 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1773 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1775 if (result->numcols == 0) { in PHP_FUNCTION()
1782 if (result->values == NULL) { in PHP_FUNCTION()
1787 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1788 if (!strcasecmp(result->values[i].name, field)) { in PHP_FUNCTION()
1800 if (field_ind >= result->numcols || field_ind < 0) { in PHP_FUNCTION()
1806 if (result->fetched == 0) { in PHP_FUNCTION()
1809 if (result->fetch_abs) in PHP_FUNCTION()
1810 rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus); in PHP_FUNCTION()
1813 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1818 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExtendedFetch"); in PHP_FUNCTION()
1820 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFetch"); in PHP_FUNCTION()
1826 result->fetched++; in PHP_FUNCTION()
1829 switch(result->values[field_ind].coltype) { in PHP_FUNCTION()
1833 if (result->binmode <= 1) { in PHP_FUNCTION()
1836 if (result->binmode <= 0) { in PHP_FUNCTION()
1846 if (IS_SQL_LONG(result->values[field_ind].coltype)) { in PHP_FUNCTION()
1847 if (result->longreadlen <= 0) { in PHP_FUNCTION()
1850 fieldsize = result->longreadlen; in PHP_FUNCTION()
1853 PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(field_ind + 1), in PHP_FUNCTION()
1859 fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen; in PHP_FUNCTION()
1865 rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1), sql_c_type, in PHP_FUNCTION()
1866 ZSTR_VAL(field_str), fieldsize, &result->values[field_ind].vallen); in PHP_FUNCTION()
1869 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1878 } else if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1881 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1888 if ((result->values[field_ind].coltype == SQL_LONGVARCHAR) in PHP_FUNCTION()
1890 || (result->values[field_ind].coltype == SQL_WLONGVARCHAR) in PHP_FUNCTION()
1899 field_str = zend_string_truncate(field_str, result->values[field_ind].vallen, 0); in PHP_FUNCTION()
1906 if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1908 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1912 RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen); in PHP_FUNCTION()
1925 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1),sql_c_type, field, fieldsize, &result-… in PHP_FUNCTION()
1928 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1939 if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1942 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1948 PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 : result->values[field_ind].vallen); in PHP_FUNCTION()
1963 odbc_result *result; in PHP_FUNCTION() local
1978 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1979 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1981 if (result->numcols == 0) { in PHP_FUNCTION()
1986 if (result->fetch_abs) in PHP_FUNCTION()
1987 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1990 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
2004 for (i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2005 php_printf("<th>%s</th>", result->values[i].name); in PHP_FUNCTION()
2011 result->fetched++; in PHP_FUNCTION()
2013 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2015 switch(result->values[i].coltype) { in PHP_FUNCTION()
2019 if (result->binmode <= 0) { in PHP_FUNCTION()
2023 if (result->binmode <= 1) sql_c_type = SQL_C_BINARY; in PHP_FUNCTION()
2031 if (IS_SQL_LONG(result->values[i].coltype) && in PHP_FUNCTION()
2032 result->longreadlen <= 0) { in PHP_FUNCTION()
2038 buf = emalloc(result->longreadlen); in PHP_FUNCTION()
2041 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen, &result-… in PHP_FUNCTION()
2046 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
2052 if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
2058 PHPWRITE(buf, result->longreadlen); in PHP_FUNCTION()
2065 } else if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
2069 PHPWRITE(buf, result->values[i].vallen); in PHP_FUNCTION()
2074 if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
2076 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
2080 php_printf("<td>%s</td>", result->values[i].value); in PHP_FUNCTION()
2088 if (result->fetch_abs) in PHP_FUNCTION()
2089 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
2092 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
2096 RETURN_LONG(result->fetched); in PHP_FUNCTION()
2104 odbc_result *result; in PHP_FUNCTION() local
2110 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
2111 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
2113 odbc_result_free(result); in PHP_FUNCTION()
2463 odbc_result *result;
2471 result = Z_ODBC_RESULT_P(pv_res);
2472 CHECK_ODBC_RESULT(result);
2474 SQLRowCount(result->stmt, &rows);
2483 odbc_result *result;
2491 result = Z_ODBC_RESULT_P(pv_res);
2492 CHECK_ODBC_RESULT(result);
2494 if (result->values) {
2495 for(i = 0; i < result->numcols; i++) {
2496 if (result->values[i].value) {
2497 efree(result->values[i].value);
2500 efree(result->values);
2501 result->values = NULL;
2502 result->numcols = 0;
2505 result->fetched = 0;
2506 rc = SQLMoreResults(result->stmt);
2508 rc = SQLFreeStmt(result->stmt, SQL_UNBIND);
2509 SQLNumParams(result->stmt, &(result->numparams));
2510 SQLNumResultCols(result->stmt, &(result->numcols));
2512 if (result->numcols > 0) {
2513 odbc_bindcols(result);
2515 result->values = NULL;
2521 odbc_sql_error(result->conn_ptr, result->stmt, "SQLMoreResults");
2531 odbc_result *result;
2538 result = Z_ODBC_RESULT_P(pv_res);
2539 CHECK_ODBC_RESULT(result);
2541 RETURN_LONG(result->numcols);
2548 odbc_result *result;
2556 result = Z_ODBC_RESULT_P(pv_res);
2557 CHECK_ODBC_RESULT(result);
2564 if (result->numcols == 0) {
2569 if (pv_num > result->numcols) {
2574 RETURN_STRING(result->values[pv_num - 1].name);
2581 odbc_result *result;
2591 result = Z_ODBC_RESULT_P(pv_res);
2592 CHECK_ODBC_RESULT(result);
2599 if (result->numcols == 0) {
2604 if (pv_num > result->numcols) {
2609 …PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmple…
2633 odbc_result *result;
2640 result = Z_ODBC_RESULT_P(pv_res);
2641 CHECK_ODBC_RESULT(result);
2643 if (result->numcols == 0) {
2649 for(i = 0; i < result->numcols; i++) {
2650 if (strcasecmp(result->values[i].name, fname) == 0) {
2768 odbc_result *result;
2801 result = Z_ODBC_RESULT_P(pv_handle);
2802 CHECK_ODBC_RESULT(result);
2804 rc = SQLSetStmtOption(result->stmt, (unsigned short) pv_opt, pv_val);
2807 odbc_sql_error(result->conn_ptr, result->stmt, "SetStmtOption");
2828 odbc_result *result = NULL;
2842 result = Z_ODBC_RESULT_P(return_value);
2844 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
2862 rc = SQLTables(result->stmt,
2869 odbc_sql_error(conn, result->stmt, "SQLTables");
2874 result->numparams = 0;
2875 SQLNumResultCols(result->stmt, &(result->numcols));
2877 if (result->numcols > 0) {
2878 odbc_bindcols(result);
2880 result->values = NULL;
2882 result->conn_ptr = conn;
2883 result->fetched = 0;
2893 odbc_result *result = NULL;
2907 result = Z_ODBC_RESULT_P(return_value);
2909 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
2929 rc = SQLColumns(result->stmt,
2936 odbc_sql_error(conn, result->stmt, "SQLColumns");
2941 result->numparams = 0;
2942 SQLNumResultCols(result->stmt, &(result->numcols));
2944 if (result->numcols > 0) {
2945 odbc_bindcols(result);
2947 result->values = NULL;
2949 result->conn_ptr = conn;
2950 result->fetched = 0;
2961 odbc_result *result = NULL;
2975 result = Z_ODBC_RESULT_P(return_value);
2977 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
2990 rc = SQLColumnPrivileges(result->stmt,
2997 odbc_sql_error(conn, result->stmt, "SQLColumnPrivileges");
3002 result->numparams = 0;
3003 SQLNumResultCols(result->stmt, &(result->numcols));
3005 if (result->numcols > 0) {
3006 odbc_bindcols(result);
3008 result->values = NULL;
3010 result->conn_ptr = conn;
3011 result->fetched = 0;
3023 odbc_result *result = NULL;
3049 result = Z_ODBC_RESULT_P(return_value);
3051 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3064 rc = SQLForeignKeys(result->stmt,
3073 odbc_sql_error(conn, result->stmt, "SQLForeignKeys");
3078 result->numparams = 0;
3079 SQLNumResultCols(result->stmt, &(result->numcols));
3081 if (result->numcols > 0) {
3082 odbc_bindcols(result);
3084 result->values = NULL;
3086 result->conn_ptr = conn;
3087 result->fetched = 0;
3099 odbc_result *result = NULL;
3113 result = Z_ODBC_RESULT_P(return_value);
3115 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3128 rc = SQLGetTypeInfo(result->stmt, data_type );
3131 odbc_sql_error(conn, result->stmt, "SQLGetTypeInfo");
3136 result->numparams = 0;
3137 SQLNumResultCols(result->stmt, &(result->numcols));
3139 if (result->numcols > 0) {
3140 odbc_bindcols(result);
3142 result->values = NULL;
3144 result->conn_ptr = conn;
3145 result->fetched = 0;
3155 odbc_result *result = NULL;
3168 result = Z_ODBC_RESULT_P(return_value);
3170 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3183 rc = SQLPrimaryKeys(result->stmt,
3189 odbc_sql_error(conn, result->stmt, "SQLPrimaryKeys");
3194 result->numparams = 0;
3195 SQLNumResultCols(result->stmt, &(result->numcols));
3197 if (result->numcols > 0) {
3198 odbc_bindcols(result);
3200 result->values = NULL;
3202 result->conn_ptr = conn;
3203 result->fetched = 0;
3214 odbc_result *result = NULL;
3228 result = Z_ODBC_RESULT_P(return_value);
3230 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3243 rc = SQLProcedureColumns(result->stmt,
3250 odbc_sql_error(conn, result->stmt, "SQLProcedureColumns");
3255 result->numparams = 0;
3256 SQLNumResultCols(result->stmt, &(result->numcols));
3258 if (result->numcols > 0) {
3259 odbc_bindcols(result);
3261 result->values = NULL;
3263 result->conn_ptr = conn;
3264 result->fetched = 0;
3276 odbc_result *result = NULL;
3289 result = Z_ODBC_RESULT_P(return_value);
3291 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3304 rc = SQLProcedures(result->stmt,
3310 odbc_sql_error(conn, result->stmt, "SQLProcedures");
3315 result->numparams = 0;
3316 SQLNumResultCols(result->stmt, &(result->numcols));
3318 if (result->numcols > 0) {
3319 odbc_bindcols(result);
3321 result->values = NULL;
3323 result->conn_ptr = conn;
3324 result->fetched = 0;
3336 odbc_result *result = NULL;
3355 result = Z_ODBC_RESULT_P(return_value);
3357 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3370 rc = SQLSpecialColumns(result->stmt, type,
3378 odbc_sql_error(conn, result->stmt, "SQLSpecialColumns");
3383 result->numparams = 0;
3384 SQLNumResultCols(result->stmt, &(result->numcols));
3386 if (result->numcols > 0) {
3387 odbc_bindcols(result);
3389 result->values = NULL;
3391 result->conn_ptr = conn;
3392 result->fetched = 0;
3403 odbc_result *result = NULL;
3421 result = Z_ODBC_RESULT_P(return_value);
3423 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3436 rc = SQLStatistics(result->stmt,
3444 odbc_sql_error(conn, result->stmt, "SQLStatistics");
3449 result->numparams = 0;
3450 SQLNumResultCols(result->stmt, &(result->numcols));
3452 if (result->numcols > 0) {
3453 odbc_bindcols(result);
3455 result->values = NULL;
3457 result->conn_ptr = conn;
3458 result->fetched = 0;
3469 odbc_result *result = NULL;
3482 result = Z_ODBC_RESULT_P(return_value);
3484 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3497 rc = SQLTablePrivileges(result->stmt,
3503 odbc_sql_error(conn, result->stmt, "SQLTablePrivileges");
3508 result->numparams = 0;
3509 SQLNumResultCols(result->stmt, &(result->numcols));
3511 if (result->numcols > 0) {
3512 odbc_bindcols(result);
3514 result->values = NULL;
3516 result->conn_ptr = conn;
3517 result->fetched = 0;