Lines Matching refs:result

587 	odbc_result *result;  in php_odbc_fetch_attribs()  local
595 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in php_odbc_fetch_attribs()
600 result->longreadlen = flag; in php_odbc_fetch_attribs()
602 result->binmode = flag; in php_odbc_fetch_attribs()
610 int odbc_bindcols(odbc_result *result) in odbc_bindcols() argument
619 result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0); in odbc_bindcols()
621 result->longreadlen = ODBCG(defaultlrl); in odbc_bindcols()
622 result->binmode = ODBCG(defaultbinmode); in odbc_bindcols()
624 for(i = 0; i < result->numcols; i++) { in odbc_bindcols()
628 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_SQL_DESC_NAME, in odbc_bindcols()
629 result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); in odbc_bindcols()
630 result->values[i].coltype = 0; in odbc_bindcols()
631 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, in odbc_bindcols()
632 NULL, 0, NULL, &result->values[i].coltype); in odbc_bindcols()
638 switch(result->values[i].coltype) { in odbc_bindcols()
646 result->values[i].value = NULL; in odbc_bindcols()
651 result->values[i].value = (char *)emalloc(27); in odbc_bindcols()
652 SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, in odbc_bindcols()
653 27, &result->values[i].vallen); in odbc_bindcols()
668 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), colfieldid, in odbc_bindcols()
682 …if (SQL_SUCCESS == SQLGetDiagRec(SQL_HANDLE_STMT, result->stmt, 1, state, &err, errtxt, 128, NULL)… in odbc_bindcols()
690 rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE, in odbc_bindcols()
698 if (result->values[i].coltype == SQL_WVARCHAR && displaysize == 0) { in odbc_bindcols()
699 result->values[i].coltype = SQL_WLONGVARCHAR; in odbc_bindcols()
700 result->values[i].value = NULL; in odbc_bindcols()
705 if (SQL_VARCHAR == result->values[i].coltype && displaysize == 0) { in odbc_bindcols()
706 result->values[i].coltype = SQL_LONGVARCHAR; in odbc_bindcols()
707 result->values[i].value = NULL; in odbc_bindcols()
712 if (result->values[i].coltype == SQL_TIMESTAMP) { in odbc_bindcols()
720 result->values[i].value = (char *)emalloc(displaysize + 1); in odbc_bindcols()
721 rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, in odbc_bindcols()
722 displaysize + 1, &result->values[i].vallen); in odbc_bindcols()
771 odbc_result *result; in odbc_column_lengths() local
790 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in odbc_column_lengths()
799 if (result->numcols == 0) { in odbc_column_lengths()
804 if (pv_num > result->numcols) { in odbc_column_lengths()
809 …PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE… in odbc_column_lengths()
869 odbc_result *result = NULL; in PHP_FUNCTION() local
885 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
887 result->numparams = 0; in PHP_FUNCTION()
888 result->param_info = NULL; in PHP_FUNCTION()
890 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
892 efree(result); in PHP_FUNCTION()
899 efree(result); in PHP_FUNCTION()
908 if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) { in PHP_FUNCTION()
912 SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, ODBCG(default_cursortype)); in PHP_FUNCTION()
915 result->fetch_abs = 0; in PHP_FUNCTION()
919 rc = SQLPrepare(result->stmt, (SQLCHAR *) query, SQL_NTS); in PHP_FUNCTION()
924 odbc_sql_error(conn, result->stmt, "SQLPrepare"); in PHP_FUNCTION()
927 odbc_sql_error(conn, result->stmt, "SQLPrepare"); in PHP_FUNCTION()
928 efree(result); in PHP_FUNCTION()
932 SQLNumParams(result->stmt, &(result->numparams)); in PHP_FUNCTION()
933 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
935 if (result->numcols > 0) { in PHP_FUNCTION()
936 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
937 efree(result); in PHP_FUNCTION()
941 result->values = NULL; in PHP_FUNCTION()
944 result->conn_ptr = conn; in PHP_FUNCTION()
945 result->fetched = 0; in PHP_FUNCTION()
947result->param_info = (odbc_param_info *) safe_emalloc(sizeof(odbc_param_info), result->numparams, … in PHP_FUNCTION()
948 for (i=0;i<result->numparams;i++) { in PHP_FUNCTION()
949 …rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)(i+1), &result->param_info[i].sqltype, &result->… in PHP_FUNCTION()
950 &result->param_info[i].scale, &result->param_info[i].nullable); in PHP_FUNCTION()
952 odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter"); in PHP_FUNCTION()
953 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in PHP_FUNCTION()
954 efree(result->param_info); in PHP_FUNCTION()
955 efree(result); in PHP_FUNCTION()
960 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
974 static void odbc_release_params(odbc_result *result, odbc_params_t *params) { in odbc_release_params() argument
975 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in odbc_release_params()
976 for (int i = 0; i < result->numparams; i++) { in odbc_release_params()
995 odbc_result *result; in PHP_FUNCTION() local
1003 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1007 if (result->numparams > 0) { in PHP_FUNCTION()
1008 if ((ne = zend_hash_num_elements(pv_param_ht)) < result->numparams) { in PHP_FUNCTION()
1009 …php_error_docref(NULL, E_WARNING, "Not enough parameters (%d should be %d) given", ne, result->num… in PHP_FUNCTION()
1013 params = (odbc_params_t *)safe_emalloc(sizeof(odbc_params_t), result->numparams, 0); in PHP_FUNCTION()
1014 for(i = 0; i < result->numparams; i++) { in PHP_FUNCTION()
1024 odbc_release_params(result, params); in PHP_FUNCTION()
1032 if (IS_SQL_BINARY(result->param_info[i-1].sqltype)) { in PHP_FUNCTION()
1043 odbc_release_params(result, params); in PHP_FUNCTION()
1052 odbc_release_params(result, params); in PHP_FUNCTION()
1058 odbc_release_params(result, params); in PHP_FUNCTION()
1067 rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, in PHP_FUNCTION()
1068 …ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1]… in PHP_FUNCTION()
1079 rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, in PHP_FUNCTION()
1080 …ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1]… in PHP_FUNCTION()
1085 odbc_sql_error(result->conn_ptr, result->stmt, "SQLBindParameter"); in PHP_FUNCTION()
1086 odbc_release_params(result, params); in PHP_FUNCTION()
1089 if (++i > result->numparams) break; in PHP_FUNCTION()
1093 rc = SQLFreeStmt(result->stmt, SQL_CLOSE); in PHP_FUNCTION()
1096 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt"); in PHP_FUNCTION()
1099 result->fetched = 0; in PHP_FUNCTION()
1100 rc = SQLExecute(result->stmt); in PHP_FUNCTION()
1106 rc = SQLParamData(result->stmt, (void*)&fp); in PHP_FUNCTION()
1109 SQLPutData(result->stmt, (void*)&buf, nbytes); in PHP_FUNCTION()
1119 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); in PHP_FUNCTION()
1122 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); in PHP_FUNCTION()
1126 if (result->numparams > 0) { in PHP_FUNCTION()
1127 odbc_release_params(result, params); in PHP_FUNCTION()
1134 if (result->numcols == 0) { in PHP_FUNCTION()
1135 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
1137 if (result->numcols > 0) { in PHP_FUNCTION()
1138 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
1139 efree(result); in PHP_FUNCTION()
1143 result->values = NULL; in PHP_FUNCTION()
1156 odbc_result *result; in PHP_FUNCTION() local
1163 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1167 …rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN, (void *)&max_len,sizeof(max_len),&… in PHP_FUNCTION()
1174 rc = SQLGetCursorName(result->stmt, (SQLCHAR *) cursorname, (SQLSMALLINT)max_len, &len); in PHP_FUNCTION()
1181 SQLError( result->conn_ptr->henv, result->conn_ptr->hdbc, in PHP_FUNCTION()
1182 result->stmt, (SQLCHAR *) state, &error, (SQLCHAR *) errormsg, in PHP_FUNCTION()
1185 snprintf(cursorname, max_len+1, "php_curs_" ZEND_ULONG_FMT, (zend_ulong)result->stmt); in PHP_FUNCTION()
1186 if (SQLSetCursorName(result->stmt, (SQLCHAR *) cursorname, SQL_NTS) != SQL_SUCCESS) { in PHP_FUNCTION()
1187 odbc_sql_error(result->conn_ptr, result->stmt, "SQLSetCursorName"); in PHP_FUNCTION()
1273 odbc_result *result = NULL; in PHP_FUNCTION() local
1288 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
1290 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
1293 efree(result); in PHP_FUNCTION()
1299 efree(result); in PHP_FUNCTION()
1308 if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) { in PHP_FUNCTION()
1312 SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, ODBCG(default_cursortype)); in PHP_FUNCTION()
1315 result->fetch_abs = 0; in PHP_FUNCTION()
1319 rc = SQLExecDirect(result->stmt, (SQLCHAR *) query, SQL_NTS); in PHP_FUNCTION()
1324 odbc_sql_error(conn, result->stmt, "SQLExecDirect"); in PHP_FUNCTION()
1325 SQLFreeStmt(result->stmt, SQL_DROP); in PHP_FUNCTION()
1326 efree(result); in PHP_FUNCTION()
1330 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
1333 if (result->numcols > 0) { in PHP_FUNCTION()
1334 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
1335 efree(result); in PHP_FUNCTION()
1339 result->values = NULL; in PHP_FUNCTION()
1342 result->conn_ptr = conn; in PHP_FUNCTION()
1343 result->fetched = 0; in PHP_FUNCTION()
1344 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
1356 odbc_result *result; in php_odbc_fetch_hash() local
1380 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in php_odbc_fetch_hash()
1384 if (result->numcols == 0) { in php_odbc_fetch_hash()
1390 if (result->fetch_abs) { in php_odbc_fetch_hash()
1392 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus); in php_odbc_fetch_hash()
1394 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in php_odbc_fetch_hash()
1398 rc = SQLFetch(result->stmt); in php_odbc_fetch_hash()
1407 if (rownum > 0 && result->fetch_abs) in php_odbc_fetch_hash()
1408 result->fetched = rownum; in php_odbc_fetch_hash()
1411 result->fetched++; in php_odbc_fetch_hash()
1413 for(i = 0; i < result->numcols; i++) { in php_odbc_fetch_hash()
1416 switch(result->values[i].coltype) { in php_odbc_fetch_hash()
1420 if (result->binmode <= 0) { in php_odbc_fetch_hash()
1424 if (result->binmode == 1) { in php_odbc_fetch_hash()
1432 if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { in php_odbc_fetch_hash()
1437 buf = emalloc(result->longreadlen + 1); in php_odbc_fetch_hash()
1440 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1), sql_c_type, buf, result->longreadlen + 1, &re… in php_odbc_fetch_hash()
1443 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in php_odbc_fetch_hash()
1449 ZVAL_STRINGL(&tmp, buf, result->longreadlen); in php_odbc_fetch_hash()
1453 } else if (result->values[i].vallen == SQL_NULL_DATA) { in php_odbc_fetch_hash()
1456 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in php_odbc_fetch_hash()
1460 ZVAL_STRINGL(&tmp, buf, result->values[i].vallen); in php_odbc_fetch_hash()
1465 if (result->values[i].vallen == SQL_NULL_DATA) { in php_odbc_fetch_hash()
1468 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in php_odbc_fetch_hash()
1473 ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen); in php_odbc_fetch_hash()
1480 if (!*(result->values[i].name) && Z_TYPE(tmp) == IS_STRING) { in php_odbc_fetch_hash()
1483 …zend_hash_str_update(Z_ARRVAL_P(return_value), result->values[i].name, strlen(result->values[i].na… in php_odbc_fetch_hash()
1516 odbc_result *result; in PHP_FUNCTION() local
1540 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1544 if (result->numcols == 0) { in PHP_FUNCTION()
1555 if (result->fetch_abs) { in PHP_FUNCTION()
1557 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus); in PHP_FUNCTION()
1559 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1563 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1570 if (rownum > 0 && result->fetch_abs) in PHP_FUNCTION()
1571 result->fetched = rownum; in PHP_FUNCTION()
1574 result->fetched++; in PHP_FUNCTION()
1576 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1579 switch(result->values[i].coltype) { in PHP_FUNCTION()
1583 if (result->binmode <= 0) { in PHP_FUNCTION()
1587 if (result->binmode == 1) sql_c_type = SQL_C_BINARY; in PHP_FUNCTION()
1595 if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { in PHP_FUNCTION()
1601 buf = emalloc(result->longreadlen + 1); in PHP_FUNCTION()
1603 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen + 1, &res… in PHP_FUNCTION()
1606 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1611 ZVAL_STRINGL(&tmp, buf, result->longreadlen); in PHP_FUNCTION()
1615 } else if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1618 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1622 ZVAL_STRINGL(&tmp, buf, result->values[i].vallen); in PHP_FUNCTION()
1627 if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1630 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1635 ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen); in PHP_FUNCTION()
1641 RETURN_LONG(result->numcols); in PHP_FUNCTION()
1649 odbc_result *result; in PHP_FUNCTION() local
1657 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1660 if (result->numcols == 0) { in PHP_FUNCTION()
1664 rc = SQLFetchPrev(result->stmt); in PHP_FUNCTION()
1670 if (result->fetched > 1) { in PHP_FUNCTION()
1671 result->fetched--; in PHP_FUNCTION()
1682 odbc_result *result; in PHP_FUNCTION() local
1696 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1700 if (result->numcols == 0) { in PHP_FUNCTION()
1706 if (result->fetch_abs) { in PHP_FUNCTION()
1708 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,(SQLLEN)pv_row,&crow,RowStatus); in PHP_FUNCTION()
1710 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1714 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1721 result->fetched = (SQLLEN)pv_row; in PHP_FUNCTION()
1723 result->fetched++; in PHP_FUNCTION()
1738 odbc_result *result; in PHP_FUNCTION() local
1761 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1765 if ((result->numcols == 0)) { in PHP_FUNCTION()
1772 if (result->values == NULL) { in PHP_FUNCTION()
1777 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1778 if (!strcasecmp(result->values[i].name, field)) { in PHP_FUNCTION()
1790 if (field_ind >= result->numcols || field_ind < 0) { in PHP_FUNCTION()
1796 if (result->fetched == 0) { in PHP_FUNCTION()
1799 if (result->fetch_abs) in PHP_FUNCTION()
1800 rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus); in PHP_FUNCTION()
1803 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1809 result->fetched++; in PHP_FUNCTION()
1812 switch(result->values[field_ind].coltype) { in PHP_FUNCTION()
1816 if (result->binmode <= 1) { in PHP_FUNCTION()
1819 if (result->binmode <= 0) { in PHP_FUNCTION()
1829 if (IS_SQL_LONG(result->values[field_ind].coltype)) { in PHP_FUNCTION()
1830 if (result->longreadlen <= 0) { in PHP_FUNCTION()
1833 fieldsize = result->longreadlen; in PHP_FUNCTION()
1836 PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(field_ind + 1), in PHP_FUNCTION()
1842 fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen; in PHP_FUNCTION()
1848 rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1), sql_c_type, in PHP_FUNCTION()
1849 ZSTR_VAL(field_str), fieldsize, &result->values[field_ind].vallen); in PHP_FUNCTION()
1852 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1861 } else if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1864 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1871 if ((result->values[field_ind].coltype == SQL_LONGVARCHAR) in PHP_FUNCTION()
1873 || (result->values[field_ind].coltype == SQL_WLONGVARCHAR) in PHP_FUNCTION()
1882 field_str = zend_string_truncate(field_str, result->values[field_ind].vallen, 0); in PHP_FUNCTION()
1889 if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1891 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1895 RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen); in PHP_FUNCTION()
1908 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1),sql_c_type, field, fieldsize, &result-… in PHP_FUNCTION()
1911 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1922 if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1925 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1931 PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 : result->values[field_ind].vallen); in PHP_FUNCTION()
1946 odbc_result *result; in PHP_FUNCTION() local
1961 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1965 if (result->numcols == 0) { in PHP_FUNCTION()
1970 if (result->fetch_abs) in PHP_FUNCTION()
1971 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1974 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1988 for (i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1989 php_printf("<th>%s</th>", result->values[i].name); in PHP_FUNCTION()
1995 result->fetched++; in PHP_FUNCTION()
1997 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1999 switch(result->values[i].coltype) { in PHP_FUNCTION()
2003 if (result->binmode <= 0) { in PHP_FUNCTION()
2007 if (result->binmode <= 1) sql_c_type = SQL_C_BINARY; in PHP_FUNCTION()
2015 if (IS_SQL_LONG(result->values[i].coltype) && in PHP_FUNCTION()
2016 result->longreadlen <= 0) { in PHP_FUNCTION()
2022 buf = emalloc(result->longreadlen); in PHP_FUNCTION()
2025 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen, &result-… in PHP_FUNCTION()
2030 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
2036 if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
2042 PHPWRITE(buf, result->longreadlen); in PHP_FUNCTION()
2049 } else if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
2053 PHPWRITE(buf, result->values[i].vallen); in PHP_FUNCTION()
2058 if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
2060 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
2064 php_printf("<td>%s</td>", result->values[i].value); in PHP_FUNCTION()
2072 if (result->fetch_abs) in PHP_FUNCTION()
2073 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
2076 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
2080 RETURN_LONG(result->fetched); in PHP_FUNCTION()
2088 odbc_result *result; in PHP_FUNCTION() local
2095 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2099 if (result->values) { in PHP_FUNCTION()
2100 for (i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2101 if (result->values[i].value) { in PHP_FUNCTION()
2102 efree(result->values[i].value); in PHP_FUNCTION()
2105 efree(result->values); in PHP_FUNCTION()
2106 result->values = NULL; in PHP_FUNCTION()
2378 odbc_result *result; in PHP_FUNCTION() local
2386 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2390 SQLRowCount(result->stmt, &rows); in PHP_FUNCTION()
2399 odbc_result *result; in PHP_FUNCTION() local
2407 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2411 if (result->values) { in PHP_FUNCTION()
2412 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2413 if (result->values[i].value) { in PHP_FUNCTION()
2414 efree(result->values[i].value); in PHP_FUNCTION()
2417 efree(result->values); in PHP_FUNCTION()
2418 result->values = NULL; in PHP_FUNCTION()
2419 result->numcols = 0; in PHP_FUNCTION()
2422 result->fetched = 0; in PHP_FUNCTION()
2423 rc = SQLMoreResults(result->stmt); in PHP_FUNCTION()
2425 rc = SQLFreeStmt(result->stmt, SQL_UNBIND); in PHP_FUNCTION()
2426 SQLNumParams(result->stmt, &(result->numparams)); in PHP_FUNCTION()
2427 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
2429 if (result->numcols > 0) { in PHP_FUNCTION()
2430 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
2431 efree(result); in PHP_FUNCTION()
2435 result->values = NULL; in PHP_FUNCTION()
2441 odbc_sql_error(result->conn_ptr, result->stmt, "SQLMoreResults"); in PHP_FUNCTION()
2451 odbc_result *result; in PHP_FUNCTION() local
2458 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2462 RETURN_LONG(result->numcols); in PHP_FUNCTION()
2469 odbc_result *result; in PHP_FUNCTION() local
2477 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2486 if (result->numcols == 0) { in PHP_FUNCTION()
2491 if (pv_num > result->numcols) { in PHP_FUNCTION()
2496 RETURN_STRING(result->values[pv_num - 1].name); in PHP_FUNCTION()
2503 odbc_result *result; in PHP_FUNCTION() local
2513 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2522 if (result->numcols == 0) { in PHP_FUNCTION()
2527 if (pv_num > result->numcols) { in PHP_FUNCTION()
2532 …PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmple… in PHP_FUNCTION()
2556 odbc_result *result; in PHP_FUNCTION() local
2563 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2567 if (result->numcols == 0) { in PHP_FUNCTION()
2573 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2574 if (strcasecmp(result->values[i].name, fname) == 0) { in PHP_FUNCTION()
2693 odbc_result *result; in PHP_FUNCTION() local
2719 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_handle), "ODBC result", le_result)) ==… in PHP_FUNCTION()
2723 rc = SQLSetStmtOption(result->stmt, (unsigned short) pv_opt, pv_val); in PHP_FUNCTION()
2726 odbc_sql_error(result->conn_ptr, result->stmt, "SetStmtOption"); in PHP_FUNCTION()
2747 odbc_result *result = NULL; in PHP_FUNCTION() local
2762 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
2764 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
2766 efree(result); in PHP_FUNCTION()
2773 efree(result); in PHP_FUNCTION()
2782 rc = SQLTables(result->stmt, in PHP_FUNCTION()
2789 odbc_sql_error(conn, result->stmt, "SQLTables"); in PHP_FUNCTION()
2790 efree(result); in PHP_FUNCTION()
2794 result->numparams = 0; in PHP_FUNCTION()
2795 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
2797 if (result->numcols > 0) { in PHP_FUNCTION()
2798 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
2799 efree(result); in PHP_FUNCTION()
2803 result->values = NULL; in PHP_FUNCTION()
2805 result->conn_ptr = conn; in PHP_FUNCTION()
2806 result->fetched = 0; in PHP_FUNCTION()
2807 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
2815 odbc_result *result = NULL; in PHP_FUNCTION() local
2830 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
2832 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
2834 efree(result); in PHP_FUNCTION()
2841 efree(result); in PHP_FUNCTION()
2852 rc = SQLColumns(result->stmt, in PHP_FUNCTION()
2859 odbc_sql_error(conn, result->stmt, "SQLColumns"); in PHP_FUNCTION()
2860 efree(result); in PHP_FUNCTION()
2864 result->numparams = 0; in PHP_FUNCTION()
2865 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
2867 if (result->numcols > 0) { in PHP_FUNCTION()
2868 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
2869 efree(result); in PHP_FUNCTION()
2873 result->values = NULL; in PHP_FUNCTION()
2875 result->conn_ptr = conn; in PHP_FUNCTION()
2876 result->fetched = 0; in PHP_FUNCTION()
2877 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
2886 odbc_result *result = NULL; in PHP_FUNCTION() local
2901 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
2903 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
2905 efree(result); in PHP_FUNCTION()
2912 efree(result); in PHP_FUNCTION()
2916 rc = SQLColumnPrivileges(result->stmt, in PHP_FUNCTION()
2923 odbc_sql_error(conn, result->stmt, "SQLColumnPrivileges"); in PHP_FUNCTION()
2924 efree(result); in PHP_FUNCTION()
2928 result->numparams = 0; in PHP_FUNCTION()
2929 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
2931 if (result->numcols > 0) { in PHP_FUNCTION()
2932 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
2933 efree(result); in PHP_FUNCTION()
2937 result->values = NULL; in PHP_FUNCTION()
2939 result->conn_ptr = conn; in PHP_FUNCTION()
2940 result->fetched = 0; in PHP_FUNCTION()
2941 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
2951 odbc_result *result = NULL; in PHP_FUNCTION() local
2978 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
2980 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
2982 efree(result); in PHP_FUNCTION()
2989 efree(result); in PHP_FUNCTION()
2993 rc = SQLForeignKeys(result->stmt, in PHP_FUNCTION()
3002 odbc_sql_error(conn, result->stmt, "SQLForeignKeys"); in PHP_FUNCTION()
3003 efree(result); in PHP_FUNCTION()
3007 result->numparams = 0; in PHP_FUNCTION()
3008 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3010 if (result->numcols > 0) { in PHP_FUNCTION()
3011 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3012 efree(result); in PHP_FUNCTION()
3016 result->values = NULL; in PHP_FUNCTION()
3018 result->conn_ptr = conn; in PHP_FUNCTION()
3019 result->fetched = 0; in PHP_FUNCTION()
3020 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3030 odbc_result *result = NULL; in PHP_FUNCTION() local
3045 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3047 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3049 efree(result); in PHP_FUNCTION()
3056 efree(result); in PHP_FUNCTION()
3060 rc = SQLGetTypeInfo(result->stmt, data_type ); in PHP_FUNCTION()
3063 odbc_sql_error(conn, result->stmt, "SQLGetTypeInfo"); in PHP_FUNCTION()
3064 efree(result); in PHP_FUNCTION()
3068 result->numparams = 0; in PHP_FUNCTION()
3069 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3071 if (result->numcols > 0) { in PHP_FUNCTION()
3072 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3073 efree(result); in PHP_FUNCTION()
3077 result->values = NULL; in PHP_FUNCTION()
3079 result->conn_ptr = conn; in PHP_FUNCTION()
3080 result->fetched = 0; in PHP_FUNCTION()
3081 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3089 odbc_result *result = NULL; in PHP_FUNCTION() local
3103 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3105 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3107 efree(result); in PHP_FUNCTION()
3114 efree(result); in PHP_FUNCTION()
3118 rc = SQLPrimaryKeys(result->stmt, in PHP_FUNCTION()
3124 odbc_sql_error(conn, result->stmt, "SQLPrimaryKeys"); in PHP_FUNCTION()
3125 efree(result); in PHP_FUNCTION()
3129 result->numparams = 0; in PHP_FUNCTION()
3130 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3132 if (result->numcols > 0) { in PHP_FUNCTION()
3133 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3134 efree(result); in PHP_FUNCTION()
3138 result->values = NULL; in PHP_FUNCTION()
3140 result->conn_ptr = conn; in PHP_FUNCTION()
3141 result->fetched = 0; in PHP_FUNCTION()
3142 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3151 odbc_result *result = NULL; in PHP_FUNCTION() local
3166 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3168 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3170 efree(result); in PHP_FUNCTION()
3177 efree(result); in PHP_FUNCTION()
3181 rc = SQLProcedureColumns(result->stmt, in PHP_FUNCTION()
3188 odbc_sql_error(conn, result->stmt, "SQLProcedureColumns"); in PHP_FUNCTION()
3189 efree(result); in PHP_FUNCTION()
3193 result->numparams = 0; in PHP_FUNCTION()
3194 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3196 if (result->numcols > 0) { in PHP_FUNCTION()
3197 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3198 efree(result); in PHP_FUNCTION()
3202 result->values = NULL; in PHP_FUNCTION()
3204 result->conn_ptr = conn; in PHP_FUNCTION()
3205 result->fetched = 0; in PHP_FUNCTION()
3206 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3216 odbc_result *result = NULL; in PHP_FUNCTION() local
3230 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3232 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3234 efree(result); in PHP_FUNCTION()
3241 efree(result); in PHP_FUNCTION()
3245 rc = SQLProcedures(result->stmt, in PHP_FUNCTION()
3251 odbc_sql_error(conn, result->stmt, "SQLProcedures"); in PHP_FUNCTION()
3252 efree(result); in PHP_FUNCTION()
3256 result->numparams = 0; in PHP_FUNCTION()
3257 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3259 if (result->numcols > 0) { in PHP_FUNCTION()
3260 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3261 efree(result); in PHP_FUNCTION()
3265 result->values = NULL; in PHP_FUNCTION()
3267 result->conn_ptr = conn; in PHP_FUNCTION()
3268 result->fetched = 0; in PHP_FUNCTION()
3269 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3279 odbc_result *result = NULL; in PHP_FUNCTION() local
3299 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3301 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3303 efree(result); in PHP_FUNCTION()
3310 efree(result); in PHP_FUNCTION()
3314 rc = SQLSpecialColumns(result->stmt, type, in PHP_FUNCTION()
3322 odbc_sql_error(conn, result->stmt, "SQLSpecialColumns"); in PHP_FUNCTION()
3323 efree(result); in PHP_FUNCTION()
3327 result->numparams = 0; in PHP_FUNCTION()
3328 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3330 if (result->numcols > 0) { in PHP_FUNCTION()
3331 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3332 efree(result); in PHP_FUNCTION()
3336 result->values = NULL; in PHP_FUNCTION()
3338 result->conn_ptr = conn; in PHP_FUNCTION()
3339 result->fetched = 0; in PHP_FUNCTION()
3340 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3349 odbc_result *result = NULL; in PHP_FUNCTION() local
3368 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3370 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3372 efree(result); in PHP_FUNCTION()
3379 efree(result); in PHP_FUNCTION()
3383 rc = SQLStatistics(result->stmt, in PHP_FUNCTION()
3391 odbc_sql_error(conn, result->stmt, "SQLStatistics"); in PHP_FUNCTION()
3392 efree(result); in PHP_FUNCTION()
3396 result->numparams = 0; in PHP_FUNCTION()
3397 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3399 if (result->numcols > 0) { in PHP_FUNCTION()
3400 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3401 efree(result); in PHP_FUNCTION()
3405 result->values = NULL; in PHP_FUNCTION()
3407 result->conn_ptr = conn; in PHP_FUNCTION()
3408 result->fetched = 0; in PHP_FUNCTION()
3409 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3418 odbc_result *result = NULL; in PHP_FUNCTION() local
3432 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3434 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3436 efree(result); in PHP_FUNCTION()
3443 efree(result); in PHP_FUNCTION()
3447 rc = SQLTablePrivileges(result->stmt, in PHP_FUNCTION()
3453 odbc_sql_error(conn, result->stmt, "SQLTablePrivileges"); in PHP_FUNCTION()
3454 efree(result); in PHP_FUNCTION()
3458 result->numparams = 0; in PHP_FUNCTION()
3459 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3461 if (result->numcols > 0) { in PHP_FUNCTION()
3462 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3463 efree(result); in PHP_FUNCTION()
3467 result->values = NULL; in PHP_FUNCTION()
3469 result->conn_ptr = conn; in PHP_FUNCTION()
3470 result->fetched = 0; in PHP_FUNCTION()
3471 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()