Lines Matching refs:result
515 odbc_result *result; in php_odbc_fetch_attribs() local
523 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in php_odbc_fetch_attribs()
528 result->longreadlen = flag; in php_odbc_fetch_attribs()
530 result->binmode = flag; in php_odbc_fetch_attribs()
538 int odbc_bindcols(odbc_result *result) in odbc_bindcols() argument
547 result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0); in odbc_bindcols()
549 result->longreadlen = ODBCG(defaultlrl); in odbc_bindcols()
550 result->binmode = ODBCG(defaultbinmode); in odbc_bindcols()
552 for(i = 0; i < result->numcols; i++) { in odbc_bindcols()
556 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_SQL_DESC_NAME, in odbc_bindcols()
557 result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); in odbc_bindcols()
558 result->values[i].coltype = 0; in odbc_bindcols()
559 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, in odbc_bindcols()
560 NULL, 0, NULL, &result->values[i].coltype); in odbc_bindcols()
566 switch(result->values[i].coltype) { in odbc_bindcols()
574 result->values[i].value = NULL; in odbc_bindcols()
579 result->values[i].value = (char *)emalloc(27); in odbc_bindcols()
580 SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, in odbc_bindcols()
581 27, &result->values[i].vallen); in odbc_bindcols()
596 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), colfieldid, in odbc_bindcols()
610 …if (SQL_SUCCESS == SQLGetDiagRec(SQL_HANDLE_STMT, result->stmt, 1, state, &err, errtxt, 128, NULL)… in odbc_bindcols()
618 rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE, in odbc_bindcols()
626 if (result->values[i].coltype == SQL_WVARCHAR && displaysize == 0) { in odbc_bindcols()
627 result->values[i].coltype = SQL_WLONGVARCHAR; in odbc_bindcols()
628 result->values[i].value = NULL; in odbc_bindcols()
633 if (SQL_VARCHAR == result->values[i].coltype && displaysize == 0) { in odbc_bindcols()
634 result->values[i].coltype = SQL_LONGVARCHAR; in odbc_bindcols()
635 result->values[i].value = NULL; in odbc_bindcols()
640 if (result->values[i].coltype == SQL_TIMESTAMP) { in odbc_bindcols()
648 result->values[i].value = (char *)emalloc(displaysize + 1); in odbc_bindcols()
649 rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, in odbc_bindcols()
650 displaysize + 1, &result->values[i].vallen); in odbc_bindcols()
699 odbc_result *result; in odbc_column_lengths() local
718 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in odbc_column_lengths()
727 if (result->numcols == 0) { in odbc_column_lengths()
732 if (pv_num > result->numcols) { in odbc_column_lengths()
737 …PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE… in odbc_column_lengths()
797 odbc_result *result = NULL; in PHP_FUNCTION() local
813 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
815 result->numparams = 0; in PHP_FUNCTION()
816 result->param_info = NULL; in PHP_FUNCTION()
818 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
820 efree(result); in PHP_FUNCTION()
827 efree(result); in PHP_FUNCTION()
836 if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) { in PHP_FUNCTION()
840 SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, ODBCG(default_cursortype)); in PHP_FUNCTION()
843 result->fetch_abs = 0; in PHP_FUNCTION()
847 rc = SQLPrepare(result->stmt, (SQLCHAR *) query, SQL_NTS); in PHP_FUNCTION()
852 odbc_sql_error(conn, result->stmt, "SQLPrepare"); in PHP_FUNCTION()
855 odbc_sql_error(conn, result->stmt, "SQLPrepare"); in PHP_FUNCTION()
856 efree(result); in PHP_FUNCTION()
860 SQLNumParams(result->stmt, &(result->numparams)); in PHP_FUNCTION()
861 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
863 if (result->numcols > 0) { in PHP_FUNCTION()
864 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
865 efree(result); in PHP_FUNCTION()
869 result->values = NULL; in PHP_FUNCTION()
872 result->conn_ptr = conn; in PHP_FUNCTION()
873 result->fetched = 0; in PHP_FUNCTION()
875 …result->param_info = (odbc_param_info *) safe_emalloc(sizeof(odbc_param_info), result->numparams, … in PHP_FUNCTION()
876 for (i=0;i<result->numparams;i++) { in PHP_FUNCTION()
877 …rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)(i+1), &result->param_info[i].sqltype, &result->… in PHP_FUNCTION()
878 &result->param_info[i].scale, &result->param_info[i].nullable); in PHP_FUNCTION()
880 odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter"); in PHP_FUNCTION()
881 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in PHP_FUNCTION()
882 efree(result->param_info); in PHP_FUNCTION()
883 efree(result); in PHP_FUNCTION()
888 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
902 static void odbc_release_params(odbc_result *result, odbc_params_t *params) { in odbc_release_params() argument
903 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in odbc_release_params()
904 for (int i = 0; i < result->numparams; i++) { in odbc_release_params()
923 odbc_result *result; in PHP_FUNCTION() local
931 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
935 if (result->numparams > 0) { in PHP_FUNCTION()
936 if ((ne = zend_hash_num_elements(pv_param_ht)) < result->numparams) { in PHP_FUNCTION()
937 …php_error_docref(NULL, E_WARNING, "Not enough parameters (%d should be %d) given", ne, result->num… in PHP_FUNCTION()
941 params = (odbc_params_t *)safe_emalloc(sizeof(odbc_params_t), result->numparams, 0); in PHP_FUNCTION()
942 for(i = 0; i < result->numparams; i++) { in PHP_FUNCTION()
952 odbc_release_params(result, params); in PHP_FUNCTION()
960 if (IS_SQL_BINARY(result->param_info[i-1].sqltype)) { in PHP_FUNCTION()
971 odbc_release_params(result, params); in PHP_FUNCTION()
980 odbc_release_params(result, params); in PHP_FUNCTION()
986 odbc_release_params(result, params); in PHP_FUNCTION()
995 rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, in PHP_FUNCTION()
996 …ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1]… in PHP_FUNCTION()
1007 rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, in PHP_FUNCTION()
1008 …ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1]… in PHP_FUNCTION()
1013 odbc_sql_error(result->conn_ptr, result->stmt, "SQLBindParameter"); in PHP_FUNCTION()
1014 odbc_release_params(result, params); in PHP_FUNCTION()
1017 if (++i > result->numparams) break; in PHP_FUNCTION()
1021 rc = SQLFreeStmt(result->stmt, SQL_CLOSE); in PHP_FUNCTION()
1024 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt"); in PHP_FUNCTION()
1027 result->fetched = 0; in PHP_FUNCTION()
1028 rc = SQLExecute(result->stmt); in PHP_FUNCTION()
1034 rc = SQLParamData(result->stmt, (void*)&fp); in PHP_FUNCTION()
1037 SQLPutData(result->stmt, (void*)&buf, nbytes); in PHP_FUNCTION()
1047 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); in PHP_FUNCTION()
1050 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); in PHP_FUNCTION()
1054 if (result->numparams > 0) { in PHP_FUNCTION()
1055 odbc_release_params(result, params); in PHP_FUNCTION()
1062 if (result->numcols == 0) { in PHP_FUNCTION()
1063 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
1065 if (result->numcols > 0) { in PHP_FUNCTION()
1066 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
1067 efree(result); in PHP_FUNCTION()
1071 result->values = NULL; in PHP_FUNCTION()
1084 odbc_result *result; in PHP_FUNCTION() local
1091 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1095 …rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN, (void *)&max_len,sizeof(max_len),&… in PHP_FUNCTION()
1102 rc = SQLGetCursorName(result->stmt, (SQLCHAR *) cursorname, (SQLSMALLINT)max_len, &len); in PHP_FUNCTION()
1109 SQLError( result->conn_ptr->henv, result->conn_ptr->hdbc, in PHP_FUNCTION()
1110 result->stmt, (SQLCHAR *) state, &error, (SQLCHAR *) errormsg, in PHP_FUNCTION()
1113 snprintf(cursorname, max_len+1, "php_curs_" ZEND_ULONG_FMT, (zend_ulong)result->stmt); in PHP_FUNCTION()
1114 if (SQLSetCursorName(result->stmt, (SQLCHAR *) cursorname, SQL_NTS) != SQL_SUCCESS) { in PHP_FUNCTION()
1115 odbc_sql_error(result->conn_ptr, result->stmt, "SQLSetCursorName"); in PHP_FUNCTION()
1201 odbc_result *result = NULL; in PHP_FUNCTION() local
1216 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
1218 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
1221 efree(result); in PHP_FUNCTION()
1227 efree(result); in PHP_FUNCTION()
1236 if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) { in PHP_FUNCTION()
1240 SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, ODBCG(default_cursortype)); in PHP_FUNCTION()
1243 result->fetch_abs = 0; in PHP_FUNCTION()
1247 rc = SQLExecDirect(result->stmt, (SQLCHAR *) query, SQL_NTS); in PHP_FUNCTION()
1252 odbc_sql_error(conn, result->stmt, "SQLExecDirect"); in PHP_FUNCTION()
1253 SQLFreeStmt(result->stmt, SQL_DROP); in PHP_FUNCTION()
1254 efree(result); in PHP_FUNCTION()
1258 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
1261 if (result->numcols > 0) { in PHP_FUNCTION()
1262 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
1263 efree(result); in PHP_FUNCTION()
1267 result->values = NULL; in PHP_FUNCTION()
1270 result->conn_ptr = conn; in PHP_FUNCTION()
1271 result->fetched = 0; in PHP_FUNCTION()
1272 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
1284 odbc_result *result; in php_odbc_fetch_hash() local
1308 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in php_odbc_fetch_hash()
1312 if (result->numcols == 0) { in php_odbc_fetch_hash()
1318 if (result->fetch_abs) { in php_odbc_fetch_hash()
1320 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus); in php_odbc_fetch_hash()
1322 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in php_odbc_fetch_hash()
1326 rc = SQLFetch(result->stmt); in php_odbc_fetch_hash()
1335 if (rownum > 0 && result->fetch_abs) in php_odbc_fetch_hash()
1336 result->fetched = rownum; in php_odbc_fetch_hash()
1339 result->fetched++; in php_odbc_fetch_hash()
1341 for(i = 0; i < result->numcols; i++) { in php_odbc_fetch_hash()
1344 switch(result->values[i].coltype) { in php_odbc_fetch_hash()
1348 if (result->binmode <= 0) { in php_odbc_fetch_hash()
1352 if (result->binmode == 1) { in php_odbc_fetch_hash()
1360 if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { in php_odbc_fetch_hash()
1365 buf = emalloc(result->longreadlen + 1); in php_odbc_fetch_hash()
1368 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1), sql_c_type, buf, result->longreadlen + 1, &re… in php_odbc_fetch_hash()
1371 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in php_odbc_fetch_hash()
1377 ZVAL_STRINGL(&tmp, buf, result->longreadlen); in php_odbc_fetch_hash()
1381 } else if (result->values[i].vallen == SQL_NULL_DATA) { in php_odbc_fetch_hash()
1384 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in php_odbc_fetch_hash()
1388 ZVAL_STRINGL(&tmp, buf, result->values[i].vallen); in php_odbc_fetch_hash()
1393 if (result->values[i].vallen == SQL_NULL_DATA) { in php_odbc_fetch_hash()
1396 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in php_odbc_fetch_hash()
1401 ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen); in php_odbc_fetch_hash()
1408 if (!*(result->values[i].name) && Z_TYPE(tmp) == IS_STRING) { in php_odbc_fetch_hash()
1411 …zend_hash_str_update(Z_ARRVAL_P(return_value), result->values[i].name, strlen(result->values[i].na… in php_odbc_fetch_hash()
1444 odbc_result *result; in PHP_FUNCTION() local
1468 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1472 if (result->numcols == 0) { in PHP_FUNCTION()
1483 if (result->fetch_abs) { in PHP_FUNCTION()
1485 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus); in PHP_FUNCTION()
1487 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1491 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1498 if (rownum > 0 && result->fetch_abs) in PHP_FUNCTION()
1499 result->fetched = rownum; in PHP_FUNCTION()
1502 result->fetched++; in PHP_FUNCTION()
1504 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1507 switch(result->values[i].coltype) { in PHP_FUNCTION()
1511 if (result->binmode <= 0) { in PHP_FUNCTION()
1515 if (result->binmode == 1) sql_c_type = SQL_C_BINARY; in PHP_FUNCTION()
1523 if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { in PHP_FUNCTION()
1529 buf = emalloc(result->longreadlen + 1); in PHP_FUNCTION()
1531 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen + 1, &res… in PHP_FUNCTION()
1534 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1539 ZVAL_STRINGL(&tmp, buf, result->longreadlen); in PHP_FUNCTION()
1543 } else if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1546 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1550 ZVAL_STRINGL(&tmp, buf, result->values[i].vallen); in PHP_FUNCTION()
1555 if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1558 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1563 ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen); in PHP_FUNCTION()
1569 RETURN_LONG(result->numcols); in PHP_FUNCTION()
1577 odbc_result *result; in PHP_FUNCTION() local
1585 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1588 if (result->numcols == 0) { in PHP_FUNCTION()
1592 rc = SQLFetchPrev(result->stmt); in PHP_FUNCTION()
1598 if (result->fetched > 1) { in PHP_FUNCTION()
1599 result->fetched--; in PHP_FUNCTION()
1610 odbc_result *result; in PHP_FUNCTION() local
1624 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1628 if (result->numcols == 0) { in PHP_FUNCTION()
1634 if (result->fetch_abs) { in PHP_FUNCTION()
1636 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,(SQLLEN)pv_row,&crow,RowStatus); in PHP_FUNCTION()
1638 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1642 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1649 result->fetched = (SQLLEN)pv_row; in PHP_FUNCTION()
1651 result->fetched++; in PHP_FUNCTION()
1666 odbc_result *result; in PHP_FUNCTION() local
1689 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1693 if (result->numcols == 0) { in PHP_FUNCTION()
1700 if (result->values == NULL) { in PHP_FUNCTION()
1705 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1706 if (!strcasecmp(result->values[i].name, field)) { in PHP_FUNCTION()
1718 if (field_ind >= result->numcols || field_ind < 0) { in PHP_FUNCTION()
1724 if (result->fetched == 0) { in PHP_FUNCTION()
1727 if (result->fetch_abs) in PHP_FUNCTION()
1728 rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus); in PHP_FUNCTION()
1731 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1737 result->fetched++; in PHP_FUNCTION()
1740 switch(result->values[field_ind].coltype) { in PHP_FUNCTION()
1744 if (result->binmode <= 1) { in PHP_FUNCTION()
1747 if (result->binmode <= 0) { in PHP_FUNCTION()
1757 if (IS_SQL_LONG(result->values[field_ind].coltype)) { in PHP_FUNCTION()
1758 if (result->longreadlen <= 0) { in PHP_FUNCTION()
1761 fieldsize = result->longreadlen; in PHP_FUNCTION()
1764 PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(field_ind + 1), in PHP_FUNCTION()
1770 fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen; in PHP_FUNCTION()
1776 rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1), sql_c_type, in PHP_FUNCTION()
1777 ZSTR_VAL(field_str), fieldsize, &result->values[field_ind].vallen); in PHP_FUNCTION()
1780 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1789 } else if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1792 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1799 if ((result->values[field_ind].coltype == SQL_LONGVARCHAR) in PHP_FUNCTION()
1801 || (result->values[field_ind].coltype == SQL_WLONGVARCHAR) in PHP_FUNCTION()
1810 field_str = zend_string_truncate(field_str, result->values[field_ind].vallen, 0); in PHP_FUNCTION()
1817 if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1819 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1823 RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen); in PHP_FUNCTION()
1836 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1),sql_c_type, field, fieldsize, &result-… in PHP_FUNCTION()
1839 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1850 if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1853 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1859 PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 : result->values[field_ind].vallen); in PHP_FUNCTION()
1874 odbc_result *result; in PHP_FUNCTION() local
1889 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1893 if (result->numcols == 0) { in PHP_FUNCTION()
1898 if (result->fetch_abs) in PHP_FUNCTION()
1899 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1902 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1916 for (i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1917 php_printf("<th>%s</th>", result->values[i].name); in PHP_FUNCTION()
1923 result->fetched++; in PHP_FUNCTION()
1925 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1927 switch(result->values[i].coltype) { in PHP_FUNCTION()
1931 if (result->binmode <= 0) { in PHP_FUNCTION()
1935 if (result->binmode <= 1) sql_c_type = SQL_C_BINARY; in PHP_FUNCTION()
1943 if (IS_SQL_LONG(result->values[i].coltype) && in PHP_FUNCTION()
1944 result->longreadlen <= 0) { in PHP_FUNCTION()
1950 buf = emalloc(result->longreadlen); in PHP_FUNCTION()
1953 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen, &result-… in PHP_FUNCTION()
1958 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1964 if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1970 PHPWRITE(buf, result->longreadlen); in PHP_FUNCTION()
1977 } else if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1981 PHPWRITE(buf, result->values[i].vallen); in PHP_FUNCTION()
1986 if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1988 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1992 php_printf("<td>%s</td>", result->values[i].value); in PHP_FUNCTION()
2000 if (result->fetch_abs) in PHP_FUNCTION()
2001 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
2004 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
2008 RETURN_LONG(result->fetched); in PHP_FUNCTION()
2016 odbc_result *result; in PHP_FUNCTION() local
2023 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2027 if (result->values) { in PHP_FUNCTION()
2028 for (i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2029 if (result->values[i].value) { in PHP_FUNCTION()
2030 efree(result->values[i].value); in PHP_FUNCTION()
2033 efree(result->values); in PHP_FUNCTION()
2034 result->values = NULL; in PHP_FUNCTION()
2349 odbc_result *result; in PHP_FUNCTION() local
2357 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2361 SQLRowCount(result->stmt, &rows); in PHP_FUNCTION()
2370 odbc_result *result; in PHP_FUNCTION() local
2378 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2382 if (result->values) { in PHP_FUNCTION()
2383 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2384 if (result->values[i].value) { in PHP_FUNCTION()
2385 efree(result->values[i].value); in PHP_FUNCTION()
2388 efree(result->values); in PHP_FUNCTION()
2389 result->values = NULL; in PHP_FUNCTION()
2390 result->numcols = 0; in PHP_FUNCTION()
2393 result->fetched = 0; in PHP_FUNCTION()
2394 rc = SQLMoreResults(result->stmt); in PHP_FUNCTION()
2396 rc = SQLFreeStmt(result->stmt, SQL_UNBIND); in PHP_FUNCTION()
2397 SQLNumParams(result->stmt, &(result->numparams)); in PHP_FUNCTION()
2398 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
2400 if (result->numcols > 0) { in PHP_FUNCTION()
2401 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
2402 efree(result); in PHP_FUNCTION()
2406 result->values = NULL; in PHP_FUNCTION()
2412 odbc_sql_error(result->conn_ptr, result->stmt, "SQLMoreResults"); in PHP_FUNCTION()
2422 odbc_result *result; in PHP_FUNCTION() local
2429 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2433 RETURN_LONG(result->numcols); in PHP_FUNCTION()
2440 odbc_result *result; in PHP_FUNCTION() local
2448 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2457 if (result->numcols == 0) { in PHP_FUNCTION()
2462 if (pv_num > result->numcols) { in PHP_FUNCTION()
2467 RETURN_STRING(result->values[pv_num - 1].name); in PHP_FUNCTION()
2474 odbc_result *result; in PHP_FUNCTION() local
2484 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2493 if (result->numcols == 0) { in PHP_FUNCTION()
2498 if (pv_num > result->numcols) { in PHP_FUNCTION()
2503 …PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmple… in PHP_FUNCTION()
2527 odbc_result *result; in PHP_FUNCTION() local
2534 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2538 if (result->numcols == 0) { in PHP_FUNCTION()
2544 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2545 if (strcasecmp(result->values[i].name, fname) == 0) { in PHP_FUNCTION()
2664 odbc_result *result; in PHP_FUNCTION() local
2690 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_handle), "ODBC result", le_result)) ==… in PHP_FUNCTION()
2694 rc = SQLSetStmtOption(result->stmt, (unsigned short) pv_opt, pv_val); in PHP_FUNCTION()
2697 odbc_sql_error(result->conn_ptr, result->stmt, "SetStmtOption"); in PHP_FUNCTION()
2718 odbc_result *result = NULL; in PHP_FUNCTION() local
2733 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
2735 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
2737 efree(result); in PHP_FUNCTION()
2744 efree(result); in PHP_FUNCTION()
2753 rc = SQLTables(result->stmt, in PHP_FUNCTION()
2760 odbc_sql_error(conn, result->stmt, "SQLTables"); in PHP_FUNCTION()
2761 efree(result); in PHP_FUNCTION()
2765 result->numparams = 0; in PHP_FUNCTION()
2766 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
2768 if (result->numcols > 0) { in PHP_FUNCTION()
2769 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
2770 efree(result); in PHP_FUNCTION()
2774 result->values = NULL; in PHP_FUNCTION()
2776 result->conn_ptr = conn; in PHP_FUNCTION()
2777 result->fetched = 0; in PHP_FUNCTION()
2778 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
2786 odbc_result *result = NULL; in PHP_FUNCTION() local
2801 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
2803 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
2805 efree(result); in PHP_FUNCTION()
2812 efree(result); in PHP_FUNCTION()
2823 rc = SQLColumns(result->stmt, in PHP_FUNCTION()
2830 odbc_sql_error(conn, result->stmt, "SQLColumns"); in PHP_FUNCTION()
2831 efree(result); in PHP_FUNCTION()
2835 result->numparams = 0; in PHP_FUNCTION()
2836 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
2838 if (result->numcols > 0) { in PHP_FUNCTION()
2839 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
2840 efree(result); in PHP_FUNCTION()
2844 result->values = NULL; in PHP_FUNCTION()
2846 result->conn_ptr = conn; in PHP_FUNCTION()
2847 result->fetched = 0; in PHP_FUNCTION()
2848 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
2857 odbc_result *result = NULL; in PHP_FUNCTION() local
2872 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
2874 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
2876 efree(result); in PHP_FUNCTION()
2883 efree(result); in PHP_FUNCTION()
2887 rc = SQLColumnPrivileges(result->stmt, in PHP_FUNCTION()
2894 odbc_sql_error(conn, result->stmt, "SQLColumnPrivileges"); in PHP_FUNCTION()
2895 efree(result); in PHP_FUNCTION()
2899 result->numparams = 0; in PHP_FUNCTION()
2900 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
2902 if (result->numcols > 0) { in PHP_FUNCTION()
2903 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
2904 efree(result); in PHP_FUNCTION()
2908 result->values = NULL; in PHP_FUNCTION()
2910 result->conn_ptr = conn; in PHP_FUNCTION()
2911 result->fetched = 0; in PHP_FUNCTION()
2912 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
2922 odbc_result *result = NULL; in PHP_FUNCTION() local
2949 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
2951 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
2953 efree(result); in PHP_FUNCTION()
2960 efree(result); in PHP_FUNCTION()
2964 rc = SQLForeignKeys(result->stmt, in PHP_FUNCTION()
2973 odbc_sql_error(conn, result->stmt, "SQLForeignKeys"); in PHP_FUNCTION()
2974 efree(result); in PHP_FUNCTION()
2978 result->numparams = 0; in PHP_FUNCTION()
2979 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
2981 if (result->numcols > 0) { in PHP_FUNCTION()
2982 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
2983 efree(result); in PHP_FUNCTION()
2987 result->values = NULL; in PHP_FUNCTION()
2989 result->conn_ptr = conn; in PHP_FUNCTION()
2990 result->fetched = 0; in PHP_FUNCTION()
2991 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3001 odbc_result *result = NULL; in PHP_FUNCTION() local
3016 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3018 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3020 efree(result); in PHP_FUNCTION()
3027 efree(result); in PHP_FUNCTION()
3031 rc = SQLGetTypeInfo(result->stmt, data_type ); in PHP_FUNCTION()
3034 odbc_sql_error(conn, result->stmt, "SQLGetTypeInfo"); in PHP_FUNCTION()
3035 efree(result); in PHP_FUNCTION()
3039 result->numparams = 0; in PHP_FUNCTION()
3040 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3042 if (result->numcols > 0) { in PHP_FUNCTION()
3043 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3044 efree(result); in PHP_FUNCTION()
3048 result->values = NULL; in PHP_FUNCTION()
3050 result->conn_ptr = conn; in PHP_FUNCTION()
3051 result->fetched = 0; in PHP_FUNCTION()
3052 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3060 odbc_result *result = NULL; in PHP_FUNCTION() local
3074 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3076 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3078 efree(result); in PHP_FUNCTION()
3085 efree(result); in PHP_FUNCTION()
3089 rc = SQLPrimaryKeys(result->stmt, in PHP_FUNCTION()
3095 odbc_sql_error(conn, result->stmt, "SQLPrimaryKeys"); in PHP_FUNCTION()
3096 efree(result); in PHP_FUNCTION()
3100 result->numparams = 0; in PHP_FUNCTION()
3101 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3103 if (result->numcols > 0) { in PHP_FUNCTION()
3104 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3105 efree(result); in PHP_FUNCTION()
3109 result->values = NULL; in PHP_FUNCTION()
3111 result->conn_ptr = conn; in PHP_FUNCTION()
3112 result->fetched = 0; in PHP_FUNCTION()
3113 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3122 odbc_result *result = NULL; in PHP_FUNCTION() local
3137 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3139 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3141 efree(result); in PHP_FUNCTION()
3148 efree(result); in PHP_FUNCTION()
3152 rc = SQLProcedureColumns(result->stmt, in PHP_FUNCTION()
3159 odbc_sql_error(conn, result->stmt, "SQLProcedureColumns"); in PHP_FUNCTION()
3160 efree(result); in PHP_FUNCTION()
3164 result->numparams = 0; in PHP_FUNCTION()
3165 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3167 if (result->numcols > 0) { in PHP_FUNCTION()
3168 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3169 efree(result); in PHP_FUNCTION()
3173 result->values = NULL; in PHP_FUNCTION()
3175 result->conn_ptr = conn; in PHP_FUNCTION()
3176 result->fetched = 0; in PHP_FUNCTION()
3177 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3187 odbc_result *result = NULL; in PHP_FUNCTION() local
3201 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3203 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3205 efree(result); in PHP_FUNCTION()
3212 efree(result); in PHP_FUNCTION()
3216 rc = SQLProcedures(result->stmt, in PHP_FUNCTION()
3222 odbc_sql_error(conn, result->stmt, "SQLProcedures"); in PHP_FUNCTION()
3223 efree(result); in PHP_FUNCTION()
3227 result->numparams = 0; in PHP_FUNCTION()
3228 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3230 if (result->numcols > 0) { in PHP_FUNCTION()
3231 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3232 efree(result); in PHP_FUNCTION()
3236 result->values = NULL; in PHP_FUNCTION()
3238 result->conn_ptr = conn; in PHP_FUNCTION()
3239 result->fetched = 0; in PHP_FUNCTION()
3240 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3250 odbc_result *result = NULL; in PHP_FUNCTION() local
3270 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3272 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3274 efree(result); in PHP_FUNCTION()
3281 efree(result); in PHP_FUNCTION()
3285 rc = SQLSpecialColumns(result->stmt, type, in PHP_FUNCTION()
3293 odbc_sql_error(conn, result->stmt, "SQLSpecialColumns"); in PHP_FUNCTION()
3294 efree(result); in PHP_FUNCTION()
3298 result->numparams = 0; in PHP_FUNCTION()
3299 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3301 if (result->numcols > 0) { in PHP_FUNCTION()
3302 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3303 efree(result); in PHP_FUNCTION()
3307 result->values = NULL; in PHP_FUNCTION()
3309 result->conn_ptr = conn; in PHP_FUNCTION()
3310 result->fetched = 0; in PHP_FUNCTION()
3311 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3320 odbc_result *result = NULL; in PHP_FUNCTION() local
3339 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3341 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3343 efree(result); in PHP_FUNCTION()
3350 efree(result); in PHP_FUNCTION()
3354 rc = SQLStatistics(result->stmt, in PHP_FUNCTION()
3362 odbc_sql_error(conn, result->stmt, "SQLStatistics"); in PHP_FUNCTION()
3363 efree(result); in PHP_FUNCTION()
3367 result->numparams = 0; in PHP_FUNCTION()
3368 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3370 if (result->numcols > 0) { in PHP_FUNCTION()
3371 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3372 efree(result); in PHP_FUNCTION()
3376 result->values = NULL; in PHP_FUNCTION()
3378 result->conn_ptr = conn; in PHP_FUNCTION()
3379 result->fetched = 0; in PHP_FUNCTION()
3380 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3389 odbc_result *result = NULL; in PHP_FUNCTION() local
3403 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3405 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3407 efree(result); in PHP_FUNCTION()
3414 efree(result); in PHP_FUNCTION()
3418 rc = SQLTablePrivileges(result->stmt, in PHP_FUNCTION()
3424 odbc_sql_error(conn, result->stmt, "SQLTablePrivileges"); in PHP_FUNCTION()
3425 efree(result); in PHP_FUNCTION()
3429 result->numparams = 0; in PHP_FUNCTION()
3430 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3432 if (result->numcols > 0) { in PHP_FUNCTION()
3433 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3434 efree(result); in PHP_FUNCTION()
3438 result->values = NULL; in PHP_FUNCTION()
3440 result->conn_ptr = conn; in PHP_FUNCTION()
3441 result->fetched = 0; in PHP_FUNCTION()
3442 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()