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()
644 odbc_result *result; in php_odbc_fetch_attribs() local
652 result = Z_ODBC_RESULT_P(pv_res); in php_odbc_fetch_attribs()
653 CHECK_ODBC_RESULT(result); in php_odbc_fetch_attribs()
656 result->longreadlen = flag; in php_odbc_fetch_attribs()
658 result->binmode = flag; in php_odbc_fetch_attribs()
666 void odbc_bindcols(odbc_result *result) in odbc_bindcols() argument
675 result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0); in odbc_bindcols()
677 result->longreadlen = ODBCG(defaultlrl); in odbc_bindcols()
678 result->binmode = ODBCG(defaultbinmode); in odbc_bindcols()
680 for(i = 0; i < result->numcols; i++) { in odbc_bindcols()
684 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_SQL_DESC_NAME, in odbc_bindcols()
685 result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); in odbc_bindcols()
686 result->values[i].coltype = 0; in odbc_bindcols()
687 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, in odbc_bindcols()
688 NULL, 0, NULL, &result->values[i].coltype); in odbc_bindcols()
694 switch(result->values[i].coltype) { in odbc_bindcols()
702 result->values[i].value = NULL; in odbc_bindcols()
707 result->values[i].value = (char *)emalloc(27); in odbc_bindcols()
708 SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, in odbc_bindcols()
709 27, &result->values[i].vallen); in odbc_bindcols()
724 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), colfieldid, in odbc_bindcols()
738 …if (SQL_SUCCESS == SQLGetDiagRec(SQL_HANDLE_STMT, result->stmt, 1, state, &err, errtxt, 128, NULL)… in odbc_bindcols()
746 rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE, in odbc_bindcols()
754 if (result->values[i].coltype == SQL_WVARCHAR && displaysize == 0) { in odbc_bindcols()
755 result->values[i].coltype = SQL_WLONGVARCHAR; in odbc_bindcols()
756 result->values[i].value = NULL; in odbc_bindcols()
761 if (SQL_VARCHAR == result->values[i].coltype && displaysize == 0) { in odbc_bindcols()
762 result->values[i].coltype = SQL_LONGVARCHAR; in odbc_bindcols()
763 result->values[i].value = NULL; in odbc_bindcols()
768 if (result->values[i].coltype == SQL_TIMESTAMP) { in odbc_bindcols()
776 result->values[i].value = (char *)emalloc(displaysize + 1); in odbc_bindcols()
777 rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, in odbc_bindcols()
778 displaysize + 1, &result->values[i].vallen); in odbc_bindcols()
811 odbc_result *result; in odbc_column_lengths() local
830 result = Z_ODBC_RESULT_P(pv_res); in odbc_column_lengths()
831 CHECK_ODBC_RESULT(result); in odbc_column_lengths()
838 if (result->numcols == 0) { in odbc_column_lengths()
843 if (pv_num > result->numcols) { in odbc_column_lengths()
848 …PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE… in odbc_column_lengths()
899 odbc_result *result = NULL; in PHP_FUNCTION() local
914 result = Z_ODBC_RESULT_P(return_value); in PHP_FUNCTION()
916 result->numparams = 0; in PHP_FUNCTION()
917 result->param_info = NULL; in PHP_FUNCTION()
919 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
937 if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) { in PHP_FUNCTION()
941 SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, ODBCG(default_cursortype)); in PHP_FUNCTION()
944 result->fetch_abs = 0; in PHP_FUNCTION()
948 rc = SQLPrepare(result->stmt, (SQLCHAR *) query, SQL_NTS); in PHP_FUNCTION()
953 odbc_sql_error(conn, result->stmt, "SQLPrepare"); in PHP_FUNCTION()
956 odbc_sql_error(conn, result->stmt, "SQLPrepare"); in PHP_FUNCTION()
961 SQLNumParams(result->stmt, &(result->numparams)); in PHP_FUNCTION()
962 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
964 if (result->numcols > 0) { in PHP_FUNCTION()
965 odbc_bindcols(result); in PHP_FUNCTION()
967 result->values = NULL; in PHP_FUNCTION()
969 result->conn_ptr = conn; in PHP_FUNCTION()
970 result->fetched = 0; in PHP_FUNCTION()
972 …result->param_info = (odbc_param_info *) safe_emalloc(sizeof(odbc_param_info), result->numparams, … in PHP_FUNCTION()
973 for (i=0;i<result->numparams;i++) { in PHP_FUNCTION()
974 …rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)(i+1), &result->param_info[i].sqltype, &result->… in PHP_FUNCTION()
975 &result->param_info[i].scale, &result->param_info[i].nullable); in PHP_FUNCTION()
977 odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter"); in PHP_FUNCTION()
978 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in PHP_FUNCTION()
979 efree(result->param_info); in PHP_FUNCTION()
999 static void odbc_release_params(odbc_result *result, odbc_params_t *params) { in odbc_release_params() argument
1000 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in odbc_release_params()
1001 for (int i = 0; i < result->numparams; i++) { in odbc_release_params()
1020 odbc_result *result; in PHP_FUNCTION() local
1028 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1029 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1031 if (result->numparams > 0) { in PHP_FUNCTION()
1032 if ((ne = zend_hash_num_elements(pv_param_ht)) < result->numparams) { in PHP_FUNCTION()
1033 …php_error_docref(NULL, E_WARNING, "Not enough parameters (%d should be %d) given", ne, result->num… in PHP_FUNCTION()
1037 params = (odbc_params_t *)safe_emalloc(sizeof(odbc_params_t), result->numparams, 0); in PHP_FUNCTION()
1038 for(i = 0; i < result->numparams; i++) { in PHP_FUNCTION()
1048 odbc_release_params(result, params); in PHP_FUNCTION()
1056 if (IS_SQL_BINARY(result->param_info[i-1].sqltype)) { in PHP_FUNCTION()
1067 odbc_release_params(result, params); in PHP_FUNCTION()
1076 odbc_release_params(result, params); in PHP_FUNCTION()
1082 odbc_release_params(result, params); in PHP_FUNCTION()
1091 rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, in PHP_FUNCTION()
1092 …ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1]… in PHP_FUNCTION()
1103 rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, in PHP_FUNCTION()
1104 …ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1]… in PHP_FUNCTION()
1109 odbc_sql_error(result->conn_ptr, result->stmt, "SQLBindParameter"); in PHP_FUNCTION()
1110 odbc_release_params(result, params); in PHP_FUNCTION()
1113 if (++i > result->numparams) break; in PHP_FUNCTION()
1117 rc = SQLFreeStmt(result->stmt, SQL_CLOSE); in PHP_FUNCTION()
1120 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt"); in PHP_FUNCTION()
1123 result->fetched = 0; in PHP_FUNCTION()
1124 rc = SQLExecute(result->stmt); in PHP_FUNCTION()
1130 rc = SQLParamData(result->stmt, (void*)&fp); in PHP_FUNCTION()
1133 SQLPutData(result->stmt, (void*)&buf, nbytes); in PHP_FUNCTION()
1143 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); in PHP_FUNCTION()
1146 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); in PHP_FUNCTION()
1150 if (result->numparams > 0) { in PHP_FUNCTION()
1151 odbc_release_params(result, params); in PHP_FUNCTION()
1158 if (result->numcols == 0) { in PHP_FUNCTION()
1159 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
1161 if (result->numcols > 0) { in PHP_FUNCTION()
1162 odbc_bindcols(result); in PHP_FUNCTION()
1164 result->values = NULL; in PHP_FUNCTION()
1177 odbc_result *result; in PHP_FUNCTION() local
1184 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1185 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1187 …rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN, (void *)&max_len,sizeof(max_len),&… in PHP_FUNCTION()
1194 rc = SQLGetCursorName(result->stmt, (SQLCHAR *) cursorname, (SQLSMALLINT)max_len, &len); in PHP_FUNCTION()
1201 SQLError( result->conn_ptr->henv, result->conn_ptr->hdbc, in PHP_FUNCTION()
1202 result->stmt, (SQLCHAR *) state, &error, (SQLCHAR *) errormsg, in PHP_FUNCTION()
1205 snprintf(cursorname, max_len+1, "php_curs_" ZEND_ULONG_FMT, (zend_ulong)result->stmt); in PHP_FUNCTION()
1206 if (SQLSetCursorName(result->stmt, (SQLCHAR *) cursorname, SQL_NTS) != SQL_SUCCESS) { in PHP_FUNCTION()
1207 odbc_sql_error(result->conn_ptr, result->stmt, "SQLSetCursorName"); in PHP_FUNCTION()
1291 odbc_result *result = NULL; in PHP_FUNCTION() local
1305 result = Z_ODBC_RESULT_P(return_value); in PHP_FUNCTION()
1307 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
1325 if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) { in PHP_FUNCTION()
1329 SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, ODBCG(default_cursortype)); in PHP_FUNCTION()
1332 result->fetch_abs = 0; in PHP_FUNCTION()
1336 rc = SQLExecDirect(result->stmt, (SQLCHAR *) query, SQL_NTS); in PHP_FUNCTION()
1341 odbc_sql_error(conn, result->stmt, "SQLExecDirect"); in PHP_FUNCTION()
1342 SQLFreeStmt(result->stmt, SQL_DROP); in PHP_FUNCTION()
1347 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
1350 if (result->numcols > 0) { in PHP_FUNCTION()
1351 odbc_bindcols(result); in PHP_FUNCTION()
1353 result->values = NULL; in PHP_FUNCTION()
1355 result->conn_ptr = conn; in PHP_FUNCTION()
1356 result->fetched = 0; in PHP_FUNCTION()
1370 odbc_result *result; in php_odbc_fetch_hash() local
1386 result = Z_ODBC_RESULT_P(pv_res); in php_odbc_fetch_hash()
1387 CHECK_ODBC_RESULT(result); in php_odbc_fetch_hash()
1397 if (result->numcols == 0) { in php_odbc_fetch_hash()
1403 if (result->fetch_abs) { in php_odbc_fetch_hash()
1405 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,(SQLLEN)pv_row,&crow,RowStatus); in php_odbc_fetch_hash()
1407 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in php_odbc_fetch_hash()
1411 rc = SQLFetch(result->stmt); in php_odbc_fetch_hash()
1416 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExtendedFetch"); in php_odbc_fetch_hash()
1418 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFetch"); in php_odbc_fetch_hash()
1427 if (!pv_row_is_null && pv_row > 0 && result->fetch_abs) in php_odbc_fetch_hash()
1428 result->fetched = (SQLLEN)pv_row; in php_odbc_fetch_hash()
1431 result->fetched++; in php_odbc_fetch_hash()
1433 for(i = 0; i < result->numcols; i++) { in php_odbc_fetch_hash()
1436 switch(result->values[i].coltype) { in php_odbc_fetch_hash()
1440 if (result->binmode <= 0) { in php_odbc_fetch_hash()
1444 if (result->binmode == 1) { in php_odbc_fetch_hash()
1452 if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { in php_odbc_fetch_hash()
1457 buf = emalloc(result->longreadlen + 1); in php_odbc_fetch_hash()
1460 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1), sql_c_type, buf, result->longreadlen + 1, &re… in php_odbc_fetch_hash()
1463 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in php_odbc_fetch_hash()
1469 ZVAL_STRINGL(&tmp, buf, result->longreadlen); in php_odbc_fetch_hash()
1473 } else if (result->values[i].vallen == SQL_NULL_DATA) { in php_odbc_fetch_hash()
1476 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in php_odbc_fetch_hash()
1480 ZVAL_STRINGL(&tmp, buf, result->values[i].vallen); in php_odbc_fetch_hash()
1485 if (result->values[i].vallen == SQL_NULL_DATA) { in php_odbc_fetch_hash()
1488 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in php_odbc_fetch_hash()
1493 ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen); in php_odbc_fetch_hash()
1500 if (!*(result->values[i].name) && Z_TYPE(tmp) == IS_STRING) { in php_odbc_fetch_hash()
1503 …zend_hash_str_update(Z_ARRVAL_P(return_value), result->values[i].name, strlen(result->values[i].na… in php_odbc_fetch_hash()
1536 odbc_result *result; in PHP_FUNCTION() local
1552 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1553 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1563 if (result->numcols == 0) { in PHP_FUNCTION()
1574 if (result->fetch_abs) { in PHP_FUNCTION()
1576 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,(SQLLEN)pv_row,&crow,RowStatus); in PHP_FUNCTION()
1578 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1582 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1587 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExtendedFetch"); in PHP_FUNCTION()
1589 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFetch"); in PHP_FUNCTION()
1596 if (!pv_row_is_null && pv_row > 0 && result->fetch_abs) in PHP_FUNCTION()
1597 result->fetched = (SQLLEN)pv_row; in PHP_FUNCTION()
1600 result->fetched++; in PHP_FUNCTION()
1602 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1605 switch(result->values[i].coltype) { in PHP_FUNCTION()
1609 if (result->binmode <= 0) { in PHP_FUNCTION()
1613 if (result->binmode == 1) sql_c_type = SQL_C_BINARY; in PHP_FUNCTION()
1621 if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { in PHP_FUNCTION()
1627 buf = emalloc(result->longreadlen + 1); in PHP_FUNCTION()
1629 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen + 1, &res… in PHP_FUNCTION()
1632 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1637 ZVAL_STRINGL(&tmp, buf, result->longreadlen); in PHP_FUNCTION()
1641 } else if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1644 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1648 ZVAL_STRINGL(&tmp, buf, result->values[i].vallen); in PHP_FUNCTION()
1653 if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1656 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1661 ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen); in PHP_FUNCTION()
1667 RETURN_LONG(result->numcols); in PHP_FUNCTION()
1674 odbc_result *result; in PHP_FUNCTION() local
1688 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1689 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1702 if (result->numcols == 0) { in PHP_FUNCTION()
1708 if (result->fetch_abs) { in PHP_FUNCTION()
1710 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,(SQLLEN)pv_row,&crow,RowStatus); in PHP_FUNCTION()
1712 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1716 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1721 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExtendedFetch"); in PHP_FUNCTION()
1723 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFetch"); in PHP_FUNCTION()
1731 result->fetched = (SQLLEN)pv_row; in PHP_FUNCTION()
1734 result->fetched++; in PHP_FUNCTION()
1748 odbc_result *result; in PHP_FUNCTION() local
1771 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1772 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1774 if (result->numcols == 0) { in PHP_FUNCTION()
1781 if (result->values == NULL) { in PHP_FUNCTION()
1786 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1787 if (!strcasecmp(result->values[i].name, field)) { in PHP_FUNCTION()
1799 if (field_ind >= result->numcols || field_ind < 0) { in PHP_FUNCTION()
1805 if (result->fetched == 0) { in PHP_FUNCTION()
1808 if (result->fetch_abs) in PHP_FUNCTION()
1809 rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus); in PHP_FUNCTION()
1812 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1817 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExtendedFetch"); in PHP_FUNCTION()
1819 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFetch"); in PHP_FUNCTION()
1825 result->fetched++; in PHP_FUNCTION()
1828 switch(result->values[field_ind].coltype) { in PHP_FUNCTION()
1832 if (result->binmode <= 1) { in PHP_FUNCTION()
1835 if (result->binmode <= 0) { in PHP_FUNCTION()
1845 if (IS_SQL_LONG(result->values[field_ind].coltype)) { in PHP_FUNCTION()
1846 if (result->longreadlen <= 0) { in PHP_FUNCTION()
1849 fieldsize = result->longreadlen; in PHP_FUNCTION()
1852 PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(field_ind + 1), in PHP_FUNCTION()
1858 fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen; in PHP_FUNCTION()
1864 rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1), sql_c_type, in PHP_FUNCTION()
1865 ZSTR_VAL(field_str), fieldsize, &result->values[field_ind].vallen); in PHP_FUNCTION()
1868 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1877 } else if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1880 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1887 if ((result->values[field_ind].coltype == SQL_LONGVARCHAR) in PHP_FUNCTION()
1889 || (result->values[field_ind].coltype == SQL_WLONGVARCHAR) in PHP_FUNCTION()
1898 field_str = zend_string_truncate(field_str, result->values[field_ind].vallen, 0); in PHP_FUNCTION()
1905 if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1907 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1911 RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen); in PHP_FUNCTION()
1924 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1),sql_c_type, field, fieldsize, &result-… in PHP_FUNCTION()
1927 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1938 if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1941 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1947 PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 : result->values[field_ind].vallen); in PHP_FUNCTION()
1962 odbc_result *result; in PHP_FUNCTION() local
1977 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
1978 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
1980 if (result->numcols == 0) { in PHP_FUNCTION()
1985 if (result->fetch_abs) in PHP_FUNCTION()
1986 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1989 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
2003 for (i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2004 php_printf("<th>%s</th>", result->values[i].name); in PHP_FUNCTION()
2010 result->fetched++; in PHP_FUNCTION()
2012 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2014 switch(result->values[i].coltype) { in PHP_FUNCTION()
2018 if (result->binmode <= 0) { in PHP_FUNCTION()
2022 if (result->binmode <= 1) sql_c_type = SQL_C_BINARY; in PHP_FUNCTION()
2030 if (IS_SQL_LONG(result->values[i].coltype) && in PHP_FUNCTION()
2031 result->longreadlen <= 0) { in PHP_FUNCTION()
2037 buf = emalloc(result->longreadlen); in PHP_FUNCTION()
2040 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen, &result-… in PHP_FUNCTION()
2045 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
2051 if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
2057 PHPWRITE(buf, result->longreadlen); in PHP_FUNCTION()
2064 } else if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
2068 PHPWRITE(buf, result->values[i].vallen); in PHP_FUNCTION()
2073 if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
2075 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
2079 php_printf("<td>%s</td>", result->values[i].value); in PHP_FUNCTION()
2087 if (result->fetch_abs) in PHP_FUNCTION()
2088 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
2091 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
2095 RETURN_LONG(result->fetched); in PHP_FUNCTION()
2103 odbc_result *result; in PHP_FUNCTION() local
2109 result = Z_ODBC_RESULT_P(pv_res); in PHP_FUNCTION()
2110 CHECK_ODBC_RESULT(result); in PHP_FUNCTION()
2112 odbc_result_free(result); in PHP_FUNCTION()
2459 odbc_result *result;
2467 result = Z_ODBC_RESULT_P(pv_res);
2468 CHECK_ODBC_RESULT(result);
2470 SQLRowCount(result->stmt, &rows);
2479 odbc_result *result;
2487 result = Z_ODBC_RESULT_P(pv_res);
2488 CHECK_ODBC_RESULT(result);
2490 if (result->values) {
2491 for(i = 0; i < result->numcols; i++) {
2492 if (result->values[i].value) {
2493 efree(result->values[i].value);
2496 efree(result->values);
2497 result->values = NULL;
2498 result->numcols = 0;
2501 result->fetched = 0;
2502 rc = SQLMoreResults(result->stmt);
2504 rc = SQLFreeStmt(result->stmt, SQL_UNBIND);
2505 SQLNumParams(result->stmt, &(result->numparams));
2506 SQLNumResultCols(result->stmt, &(result->numcols));
2508 if (result->numcols > 0) {
2509 odbc_bindcols(result);
2511 result->values = NULL;
2517 odbc_sql_error(result->conn_ptr, result->stmt, "SQLMoreResults");
2527 odbc_result *result;
2534 result = Z_ODBC_RESULT_P(pv_res);
2535 CHECK_ODBC_RESULT(result);
2537 RETURN_LONG(result->numcols);
2544 odbc_result *result;
2552 result = Z_ODBC_RESULT_P(pv_res);
2553 CHECK_ODBC_RESULT(result);
2560 if (result->numcols == 0) {
2565 if (pv_num > result->numcols) {
2570 RETURN_STRING(result->values[pv_num - 1].name);
2577 odbc_result *result;
2587 result = Z_ODBC_RESULT_P(pv_res);
2588 CHECK_ODBC_RESULT(result);
2595 if (result->numcols == 0) {
2600 if (pv_num > result->numcols) {
2605 …PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmple…
2629 odbc_result *result;
2636 result = Z_ODBC_RESULT_P(pv_res);
2637 CHECK_ODBC_RESULT(result);
2639 if (result->numcols == 0) {
2645 for(i = 0; i < result->numcols; i++) {
2646 if (strcasecmp(result->values[i].name, fname) == 0) {
2764 odbc_result *result;
2797 result = Z_ODBC_RESULT_P(pv_handle);
2798 CHECK_ODBC_RESULT(result);
2800 rc = SQLSetStmtOption(result->stmt, (unsigned short) pv_opt, pv_val);
2803 odbc_sql_error(result->conn_ptr, result->stmt, "SetStmtOption");
2824 odbc_result *result = NULL;
2838 result = Z_ODBC_RESULT_P(return_value);
2840 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
2858 rc = SQLTables(result->stmt,
2865 odbc_sql_error(conn, result->stmt, "SQLTables");
2870 result->numparams = 0;
2871 SQLNumResultCols(result->stmt, &(result->numcols));
2873 if (result->numcols > 0) {
2874 odbc_bindcols(result);
2876 result->values = NULL;
2878 result->conn_ptr = conn;
2879 result->fetched = 0;
2889 odbc_result *result = NULL;
2903 result = Z_ODBC_RESULT_P(return_value);
2905 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
2925 rc = SQLColumns(result->stmt,
2932 odbc_sql_error(conn, result->stmt, "SQLColumns");
2937 result->numparams = 0;
2938 SQLNumResultCols(result->stmt, &(result->numcols));
2940 if (result->numcols > 0) {
2941 odbc_bindcols(result);
2943 result->values = NULL;
2945 result->conn_ptr = conn;
2946 result->fetched = 0;
2957 odbc_result *result = NULL;
2971 result = Z_ODBC_RESULT_P(return_value);
2973 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
2986 rc = SQLColumnPrivileges(result->stmt,
2993 odbc_sql_error(conn, result->stmt, "SQLColumnPrivileges");
2998 result->numparams = 0;
2999 SQLNumResultCols(result->stmt, &(result->numcols));
3001 if (result->numcols > 0) {
3002 odbc_bindcols(result);
3004 result->values = NULL;
3006 result->conn_ptr = conn;
3007 result->fetched = 0;
3019 odbc_result *result = NULL;
3045 result = Z_ODBC_RESULT_P(return_value);
3047 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3060 rc = SQLForeignKeys(result->stmt,
3069 odbc_sql_error(conn, result->stmt, "SQLForeignKeys");
3074 result->numparams = 0;
3075 SQLNumResultCols(result->stmt, &(result->numcols));
3077 if (result->numcols > 0) {
3078 odbc_bindcols(result);
3080 result->values = NULL;
3082 result->conn_ptr = conn;
3083 result->fetched = 0;
3095 odbc_result *result = NULL;
3109 result = Z_ODBC_RESULT_P(return_value);
3111 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3124 rc = SQLGetTypeInfo(result->stmt, data_type );
3127 odbc_sql_error(conn, result->stmt, "SQLGetTypeInfo");
3132 result->numparams = 0;
3133 SQLNumResultCols(result->stmt, &(result->numcols));
3135 if (result->numcols > 0) {
3136 odbc_bindcols(result);
3138 result->values = NULL;
3140 result->conn_ptr = conn;
3141 result->fetched = 0;
3151 odbc_result *result = NULL;
3164 result = Z_ODBC_RESULT_P(return_value);
3166 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3179 rc = SQLPrimaryKeys(result->stmt,
3185 odbc_sql_error(conn, result->stmt, "SQLPrimaryKeys");
3190 result->numparams = 0;
3191 SQLNumResultCols(result->stmt, &(result->numcols));
3193 if (result->numcols > 0) {
3194 odbc_bindcols(result);
3196 result->values = NULL;
3198 result->conn_ptr = conn;
3199 result->fetched = 0;
3210 odbc_result *result = NULL;
3224 result = Z_ODBC_RESULT_P(return_value);
3226 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3239 rc = SQLProcedureColumns(result->stmt,
3246 odbc_sql_error(conn, result->stmt, "SQLProcedureColumns");
3251 result->numparams = 0;
3252 SQLNumResultCols(result->stmt, &(result->numcols));
3254 if (result->numcols > 0) {
3255 odbc_bindcols(result);
3257 result->values = NULL;
3259 result->conn_ptr = conn;
3260 result->fetched = 0;
3272 odbc_result *result = NULL;
3285 result = Z_ODBC_RESULT_P(return_value);
3287 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3300 rc = SQLProcedures(result->stmt,
3306 odbc_sql_error(conn, result->stmt, "SQLProcedures");
3311 result->numparams = 0;
3312 SQLNumResultCols(result->stmt, &(result->numcols));
3314 if (result->numcols > 0) {
3315 odbc_bindcols(result);
3317 result->values = NULL;
3319 result->conn_ptr = conn;
3320 result->fetched = 0;
3332 odbc_result *result = NULL;
3351 result = Z_ODBC_RESULT_P(return_value);
3353 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3366 rc = SQLSpecialColumns(result->stmt, type,
3374 odbc_sql_error(conn, result->stmt, "SQLSpecialColumns");
3379 result->numparams = 0;
3380 SQLNumResultCols(result->stmt, &(result->numcols));
3382 if (result->numcols > 0) {
3383 odbc_bindcols(result);
3385 result->values = NULL;
3387 result->conn_ptr = conn;
3388 result->fetched = 0;
3399 odbc_result *result = NULL;
3417 result = Z_ODBC_RESULT_P(return_value);
3419 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3432 rc = SQLStatistics(result->stmt,
3440 odbc_sql_error(conn, result->stmt, "SQLStatistics");
3445 result->numparams = 0;
3446 SQLNumResultCols(result->stmt, &(result->numcols));
3448 if (result->numcols > 0) {
3449 odbc_bindcols(result);
3451 result->values = NULL;
3453 result->conn_ptr = conn;
3454 result->fetched = 0;
3465 odbc_result *result = NULL;
3478 result = Z_ODBC_RESULT_P(return_value);
3480 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
3493 rc = SQLTablePrivileges(result->stmt,
3499 odbc_sql_error(conn, result->stmt, "SQLTablePrivileges");
3504 result->numparams = 0;
3505 SQLNumResultCols(result->stmt, &(result->numcols));
3507 if (result->numcols > 0) {
3508 odbc_bindcols(result);
3510 result->values = NULL;
3512 result->conn_ptr = conn;
3513 result->fetched = 0;