Lines Matching refs:result
110 ZEND_ARG_INFO(0, result)
115 ZEND_ARG_INFO(0, result)
915 odbc_result *result; in php_odbc_fetch_attribs() local
923 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in php_odbc_fetch_attribs()
928 result->longreadlen = flag; in php_odbc_fetch_attribs()
930 result->binmode = flag; in php_odbc_fetch_attribs()
938 int odbc_bindcols(odbc_result *result) in odbc_bindcols() argument
947 result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0); in odbc_bindcols()
949 result->longreadlen = ODBCG(defaultlrl); in odbc_bindcols()
950 result->binmode = ODBCG(defaultbinmode); in odbc_bindcols()
952 for(i = 0; i < result->numcols; i++) { in odbc_bindcols()
956 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_SQL_DESC_NAME, in odbc_bindcols()
957 result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); in odbc_bindcols()
958 result->values[i].coltype = 0; in odbc_bindcols()
959 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, in odbc_bindcols()
960 NULL, 0, NULL, &result->values[i].coltype); in odbc_bindcols()
966 switch(result->values[i].coltype) { in odbc_bindcols()
974 result->values[i].value = NULL; in odbc_bindcols()
979 result->values[i].value = (char *)emalloc(27); in odbc_bindcols()
980 SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, in odbc_bindcols()
981 27, &result->values[i].vallen); in odbc_bindcols()
994 rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), colfieldid, in odbc_bindcols()
1008 …if (SQL_SUCCESS == SQLGetDiagRec(SQL_HANDLE_STMT, result->stmt, 1, state, &err, errtxt, 128, NULL)… in odbc_bindcols()
1016 rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE, in odbc_bindcols()
1024 if (result->values[i].coltype == SQL_WVARCHAR && displaysize == 0) { in odbc_bindcols()
1025 result->values[i].coltype = SQL_WLONGVARCHAR; in odbc_bindcols()
1026 result->values[i].value = NULL; in odbc_bindcols()
1031 if (SQL_VARCHAR == result->values[i].coltype && displaysize == 0) { in odbc_bindcols()
1032 result->values[i].coltype = SQL_LONGVARCHAR; in odbc_bindcols()
1033 result->values[i].value = NULL; in odbc_bindcols()
1038 if (result->values[i].coltype == SQL_TIMESTAMP) { in odbc_bindcols()
1046 result->values[i].value = (char *)emalloc(displaysize + 1); in odbc_bindcols()
1047 rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, in odbc_bindcols()
1048 displaysize + 1, &result->values[i].vallen); in odbc_bindcols()
1095 odbc_result *result; in odbc_column_lengths() local
1114 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in odbc_column_lengths()
1118 if (result->numcols == 0) { in odbc_column_lengths()
1123 if (pv_num > result->numcols) { in odbc_column_lengths()
1133 …PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE… in odbc_column_lengths()
1197 odbc_result *result = NULL; in PHP_FUNCTION() local
1213 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
1215 result->numparams = 0; in PHP_FUNCTION()
1216 result->param_info = NULL; in PHP_FUNCTION()
1218 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
1220 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 = SQLPrepare(result->stmt, query, SQL_NTS); in PHP_FUNCTION()
1252 odbc_sql_error(conn, result->stmt, "SQLPrepare"); in PHP_FUNCTION()
1255 odbc_sql_error(conn, result->stmt, "SQLPrepare"); in PHP_FUNCTION()
1259 SQLNumParams(result->stmt, &(result->numparams)); in PHP_FUNCTION()
1260 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
1262 if (result->numcols > 0) { in PHP_FUNCTION()
1263 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
1264 efree(result); in PHP_FUNCTION()
1268 result->values = NULL; in PHP_FUNCTION()
1271 result->conn_ptr = conn; in PHP_FUNCTION()
1272 result->fetched = 0; in PHP_FUNCTION()
1274 …result->param_info = (odbc_param_info *) safe_emalloc(sizeof(odbc_param_info), result->numparams, … in PHP_FUNCTION()
1275 for (i=0;i<result->numparams;i++) { in PHP_FUNCTION()
1276 …rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)(i+1), &result->param_info[i].sqltype, &result->… in PHP_FUNCTION()
1277 &result->param_info[i].scale, &result->param_info[i].nullable); in PHP_FUNCTION()
1279 odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter"); in PHP_FUNCTION()
1280 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in PHP_FUNCTION()
1281 efree(result->param_info); in PHP_FUNCTION()
1282 efree(result); in PHP_FUNCTION()
1287 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
1308 odbc_result *result; in PHP_FUNCTION() local
1316 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1321 if (result->numparams > 0 && numArgs == 1) { in PHP_FUNCTION()
1326 if (result->numparams > 0) { in PHP_FUNCTION()
1327 if ((ne = zend_hash_num_elements(Z_ARRVAL_P(pv_param_arr))) < result->numparams) { in PHP_FUNCTION()
1328 …php_error_docref(NULL, E_WARNING,"Not enough parameters (%d should be %d) given", ne, result->nump… in PHP_FUNCTION()
1333 params = (params_t *)safe_emalloc(sizeof(params_t), result->numparams, 0); in PHP_FUNCTION()
1334 for(i = 0; i < result->numparams; i++) { in PHP_FUNCTION()
1338 for(i = 1; i <= result->numparams; i++) { in PHP_FUNCTION()
1341 SQLFreeStmt(result->stmt,SQL_RESET_PARAMS); in PHP_FUNCTION()
1342 for (i = 0; i < result->numparams; i++) { in PHP_FUNCTION()
1353 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in PHP_FUNCTION()
1354 for (i = 0; i < result->numparams; i++) { in PHP_FUNCTION()
1366 if (IS_SQL_BINARY(result->param_info[i-1].sqltype)) { in PHP_FUNCTION()
1385 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in PHP_FUNCTION()
1386 for (i = 0; i < result->numparams; i++) { in PHP_FUNCTION()
1397 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in PHP_FUNCTION()
1398 for (i = 0; i < result->numparams; i++) { in PHP_FUNCTION()
1412 rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, in PHP_FUNCTION()
1413 …ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1]… in PHP_FUNCTION()
1424 rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, in PHP_FUNCTION()
1425 …ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1]… in PHP_FUNCTION()
1430 odbc_sql_error(result->conn_ptr, result->stmt, "SQLBindParameter"); in PHP_FUNCTION()
1431 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in PHP_FUNCTION()
1432 for (i = 0; i < result->numparams; i++) { in PHP_FUNCTION()
1444 rc = SQLFreeStmt(result->stmt, SQL_CLOSE); in PHP_FUNCTION()
1447 odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt"); in PHP_FUNCTION()
1450 rc = SQLExecute(result->stmt); in PHP_FUNCTION()
1452 result->fetched = 0; in PHP_FUNCTION()
1457 rc = SQLParamData(result->stmt, (void*)&fp); in PHP_FUNCTION()
1460 SQLPutData(result->stmt, (void*)&buf, nbytes); in PHP_FUNCTION()
1470 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); in PHP_FUNCTION()
1473 odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); in PHP_FUNCTION()
1478 if (result->numparams > 0) { in PHP_FUNCTION()
1479 SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); in PHP_FUNCTION()
1480 for(i = 0; i < result->numparams; i++) { in PHP_FUNCTION()
1492 if (result->numcols == 0) { in PHP_FUNCTION()
1493 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
1495 if (result->numcols > 0) { in PHP_FUNCTION()
1496 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
1497 efree(result); in PHP_FUNCTION()
1501 result->values = NULL; in PHP_FUNCTION()
1515 odbc_result *result; in PHP_FUNCTION() local
1522 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1526 …rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN, (void *)&max_len,sizeof(max_len),&… in PHP_FUNCTION()
1533 rc = SQLGetCursorName(result->stmt,cursorname,(SQLSMALLINT)max_len,&len); in PHP_FUNCTION()
1540 SQLError( result->conn_ptr->henv, result->conn_ptr->hdbc, in PHP_FUNCTION()
1541 result->stmt, state, &error, errormsg, in PHP_FUNCTION()
1544 snprintf(cursorname, max_len+1, "php_curs_" ZEND_ULONG_FMT, (zend_ulong)result->stmt); in PHP_FUNCTION()
1545 if (SQLSetCursorName(result->stmt,cursorname,SQL_NTS) != SQL_SUCCESS) { in PHP_FUNCTION()
1546 odbc_sql_error(result->conn_ptr, result->stmt, "SQLSetCursorName"); in PHP_FUNCTION()
1635 odbc_result *result = NULL; in PHP_FUNCTION() local
1650 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
1652 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
1655 efree(result); in PHP_FUNCTION()
1661 efree(result); in PHP_FUNCTION()
1670 if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) { in PHP_FUNCTION()
1674 SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, ODBCG(default_cursortype)); in PHP_FUNCTION()
1677 result->fetch_abs = 0; in PHP_FUNCTION()
1681 rc = SQLExecDirect(result->stmt, query, SQL_NTS); in PHP_FUNCTION()
1686 odbc_sql_error(conn, result->stmt, "SQLExecDirect"); in PHP_FUNCTION()
1687 SQLFreeStmt(result->stmt, SQL_DROP); in PHP_FUNCTION()
1688 efree(result); in PHP_FUNCTION()
1692 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
1695 if (result->numcols > 0) { in PHP_FUNCTION()
1696 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
1697 efree(result); in PHP_FUNCTION()
1701 result->values = NULL; in PHP_FUNCTION()
1704 result->conn_ptr = conn; in PHP_FUNCTION()
1705 result->fetched = 0; in PHP_FUNCTION()
1706 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
1718 odbc_result *result; in php_odbc_fetch_hash() local
1742 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in php_odbc_fetch_hash()
1746 if (result->numcols == 0) { in php_odbc_fetch_hash()
1752 if (result->fetch_abs) { in php_odbc_fetch_hash()
1754 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus); in php_odbc_fetch_hash()
1756 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in php_odbc_fetch_hash()
1760 rc = SQLFetch(result->stmt); in php_odbc_fetch_hash()
1769 if (rownum > 0 && result->fetch_abs) in php_odbc_fetch_hash()
1770 result->fetched = rownum; in php_odbc_fetch_hash()
1773 result->fetched++; in php_odbc_fetch_hash()
1775 for(i = 0; i < result->numcols; i++) { in php_odbc_fetch_hash()
1778 switch(result->values[i].coltype) { in php_odbc_fetch_hash()
1782 if (result->binmode <= 0) { in php_odbc_fetch_hash()
1786 if (result->binmode == 1) { in php_odbc_fetch_hash()
1793 if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { in php_odbc_fetch_hash()
1798 buf = emalloc(result->longreadlen + 1); in php_odbc_fetch_hash()
1801 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1), sql_c_type, buf, result->longreadlen + 1, &re… in php_odbc_fetch_hash()
1804 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in php_odbc_fetch_hash()
1810 ZVAL_STRINGL(&tmp, buf, result->longreadlen); in php_odbc_fetch_hash()
1814 } else if (result->values[i].vallen == SQL_NULL_DATA) { in php_odbc_fetch_hash()
1817 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in php_odbc_fetch_hash()
1821 ZVAL_STRINGL(&tmp, buf, result->values[i].vallen); in php_odbc_fetch_hash()
1826 if (result->values[i].vallen == SQL_NULL_DATA) { in php_odbc_fetch_hash()
1829 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in php_odbc_fetch_hash()
1834 ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen); in php_odbc_fetch_hash()
1841 if (!*(result->values[i].name) && Z_TYPE(tmp) == IS_STRING) { in php_odbc_fetch_hash()
1844 …zend_hash_str_update(Z_ARRVAL_P(return_value), result->values[i].name, strlen(result->values[i].na… in php_odbc_fetch_hash()
1880 odbc_result *result; in PHP_FUNCTION() local
1904 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
1908 if (result->numcols == 0) { in PHP_FUNCTION()
1919 if (result->fetch_abs) { in PHP_FUNCTION()
1921 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus); in PHP_FUNCTION()
1923 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
1927 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
1934 if (rownum > 0 && result->fetch_abs) in PHP_FUNCTION()
1935 result->fetched = rownum; in PHP_FUNCTION()
1938 result->fetched++; in PHP_FUNCTION()
1940 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
1943 switch(result->values[i].coltype) { in PHP_FUNCTION()
1947 if (result->binmode <= 0) { in PHP_FUNCTION()
1951 if (result->binmode == 1) sql_c_type = SQL_C_BINARY; in PHP_FUNCTION()
1957 if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { in PHP_FUNCTION()
1963 buf = emalloc(result->longreadlen + 1); in PHP_FUNCTION()
1965 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen + 1, &res… in PHP_FUNCTION()
1968 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
1973 ZVAL_STRINGL(&tmp, buf, result->longreadlen); in PHP_FUNCTION()
1977 } else if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1980 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1984 ZVAL_STRINGL(&tmp, buf, result->values[i].vallen); in PHP_FUNCTION()
1989 if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
1992 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
1997 ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen); in PHP_FUNCTION()
2003 RETURN_LONG(result->numcols); in PHP_FUNCTION()
2012 odbc_result *result; in PHP_FUNCTION() local
2020 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2023 if (result->numcols == 0) { in PHP_FUNCTION()
2027 rc = SQLFetchPrev(result->stmt); in PHP_FUNCTION()
2033 if (result->fetched > 1) { in PHP_FUNCTION()
2034 result->fetched--; in PHP_FUNCTION()
2047 odbc_result *result; in PHP_FUNCTION() local
2062 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2066 if (result->numcols == 0) { in PHP_FUNCTION()
2072 if (result->fetch_abs) { in PHP_FUNCTION()
2074 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus); in PHP_FUNCTION()
2076 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
2080 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
2087 result->fetched = rownum; in PHP_FUNCTION()
2089 result->fetched++; in PHP_FUNCTION()
2104 odbc_result *result; in PHP_FUNCTION() local
2128 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2132 if ((result->numcols == 0)) { in PHP_FUNCTION()
2139 if (result->values == NULL) { in PHP_FUNCTION()
2144 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2145 if (!strcasecmp(result->values[i].name, field)) { in PHP_FUNCTION()
2157 if (field_ind >= result->numcols || field_ind < 0) { in PHP_FUNCTION()
2163 if (result->fetched == 0) { in PHP_FUNCTION()
2166 if (result->fetch_abs) in PHP_FUNCTION()
2167 rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus); in PHP_FUNCTION()
2170 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
2176 result->fetched++; in PHP_FUNCTION()
2179 switch(result->values[field_ind].coltype) { in PHP_FUNCTION()
2183 if (result->binmode <= 1) { in PHP_FUNCTION()
2186 if (result->binmode <= 0) { in PHP_FUNCTION()
2193 if (IS_SQL_LONG(result->values[field_ind].coltype)) { in PHP_FUNCTION()
2194 if (result->longreadlen <= 0) { in PHP_FUNCTION()
2197 fieldsize = result->longreadlen; in PHP_FUNCTION()
2200 PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(field_ind + 1), in PHP_FUNCTION()
2206 fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen; in PHP_FUNCTION()
2212 rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1), sql_c_type, in PHP_FUNCTION()
2213 ZSTR_VAL(field_str), fieldsize, &result->values[field_ind].vallen); in PHP_FUNCTION()
2216 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
2225 } else if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
2228 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
2235 if ((result->values[field_ind].coltype == SQL_LONGVARCHAR) in PHP_FUNCTION()
2237 || (result->values[field_ind].coltype == SQL_WLONGVARCHAR) in PHP_FUNCTION()
2246 field_str = zend_string_truncate(field_str, result->values[field_ind].vallen, 0); in PHP_FUNCTION()
2253 if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
2255 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
2259 RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen); in PHP_FUNCTION()
2272 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1),sql_c_type, field, fieldsize, &result-… in PHP_FUNCTION()
2275 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
2286 if (result->values[field_ind].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
2289 } else if (result->values[field_ind].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
2295 PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 : result->values[field_ind].vallen); in PHP_FUNCTION()
2311 odbc_result *result; in PHP_FUNCTION() local
2326 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2330 if (result->numcols == 0) { in PHP_FUNCTION()
2335 if (result->fetch_abs) in PHP_FUNCTION()
2336 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
2339 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
2353 for (i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2354 php_printf("<th>%s</th>", result->values[i].name); in PHP_FUNCTION()
2360 result->fetched++; in PHP_FUNCTION()
2362 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2364 switch(result->values[i].coltype) { in PHP_FUNCTION()
2368 if (result->binmode <= 0) { in PHP_FUNCTION()
2372 if (result->binmode <= 1) sql_c_type = SQL_C_BINARY; in PHP_FUNCTION()
2377 if (IS_SQL_LONG(result->values[i].coltype) && in PHP_FUNCTION()
2378 result->longreadlen <= 0) { in PHP_FUNCTION()
2384 buf = emalloc(result->longreadlen); in PHP_FUNCTION()
2387 …rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen, &result-… in PHP_FUNCTION()
2392 odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); in PHP_FUNCTION()
2398 if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
2404 PHPWRITE(buf, result->longreadlen); in PHP_FUNCTION()
2411 } else if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
2415 PHPWRITE(buf, result->values[i].vallen); in PHP_FUNCTION()
2420 if (result->values[i].vallen == SQL_NULL_DATA) { in PHP_FUNCTION()
2422 } else if (result->values[i].vallen == SQL_NO_TOTAL) { in PHP_FUNCTION()
2426 php_printf("<td>%s</td>", result->values[i].value); in PHP_FUNCTION()
2434 if (result->fetch_abs) in PHP_FUNCTION()
2435 rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); in PHP_FUNCTION()
2438 rc = SQLFetch(result->stmt); in PHP_FUNCTION()
2442 RETURN_LONG(result->fetched); 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 if (result->values) { in PHP_FUNCTION()
2463 for (i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2464 if (result->values[i].value) { in PHP_FUNCTION()
2465 efree(result->values[i].value); in PHP_FUNCTION()
2468 efree(result->values); in PHP_FUNCTION()
2469 result->values = NULL; in PHP_FUNCTION()
2786 odbc_result *result; in PHP_FUNCTION() local
2794 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2798 SQLRowCount(result->stmt, &rows); in PHP_FUNCTION()
2808 odbc_result *result; in PHP_FUNCTION() local
2816 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2820 if (result->values) { in PHP_FUNCTION()
2821 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2822 if (result->values[i].value) { in PHP_FUNCTION()
2823 efree(result->values[i].value); in PHP_FUNCTION()
2826 efree(result->values); in PHP_FUNCTION()
2827 result->values = NULL; in PHP_FUNCTION()
2828 result->numcols = 0; in PHP_FUNCTION()
2831 result->fetched = 0; in PHP_FUNCTION()
2832 rc = SQLMoreResults(result->stmt); in PHP_FUNCTION()
2834 rc = SQLFreeStmt(result->stmt, SQL_UNBIND); in PHP_FUNCTION()
2835 SQLNumParams(result->stmt, &(result->numparams)); 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()
2850 odbc_sql_error(result->conn_ptr, result->stmt, "SQLMoreResults"); in PHP_FUNCTION()
2861 odbc_result *result; in PHP_FUNCTION() local
2868 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2872 RETURN_LONG(result->numcols); in PHP_FUNCTION()
2880 odbc_result *result; in PHP_FUNCTION() local
2888 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2892 if (result->numcols == 0) { in PHP_FUNCTION()
2897 if (pv_num > result->numcols) { in PHP_FUNCTION()
2907 RETURN_STRING(result->values[pv_num - 1].name); in PHP_FUNCTION()
2915 odbc_result *result; in PHP_FUNCTION() local
2925 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2929 if (result->numcols == 0) { in PHP_FUNCTION()
2934 if (pv_num > result->numcols) { in PHP_FUNCTION()
2944 …PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmple… in PHP_FUNCTION()
2971 odbc_result *result; in PHP_FUNCTION() local
2978 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NU… in PHP_FUNCTION()
2982 if (result->numcols == 0) { in PHP_FUNCTION()
2988 for(i = 0; i < result->numcols; i++) { in PHP_FUNCTION()
2989 if (strcasecmp(result->values[i].name, fname) == 0) { in PHP_FUNCTION()
3114 odbc_result *result; in PHP_FUNCTION() local
3140 …if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_handle), "ODBC result", le_result)) ==… in PHP_FUNCTION()
3144 rc = SQLSetStmtOption(result->stmt, (unsigned short) pv_opt, pv_val); in PHP_FUNCTION()
3147 odbc_sql_error(result->conn_ptr, result->stmt, "SetStmtOption"); in PHP_FUNCTION()
3170 odbc_result *result = NULL; in PHP_FUNCTION() local
3185 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3187 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3189 efree(result); in PHP_FUNCTION()
3196 efree(result); in PHP_FUNCTION()
3205 rc = SQLTables(result->stmt, in PHP_FUNCTION()
3212 odbc_sql_error(conn, result->stmt, "SQLTables"); in PHP_FUNCTION()
3213 efree(result); in PHP_FUNCTION()
3217 result->numparams = 0; in PHP_FUNCTION()
3218 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3220 if (result->numcols > 0) { in PHP_FUNCTION()
3221 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3222 efree(result); in PHP_FUNCTION()
3226 result->values = NULL; in PHP_FUNCTION()
3228 result->conn_ptr = conn; in PHP_FUNCTION()
3229 result->fetched = 0; in PHP_FUNCTION()
3230 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3239 odbc_result *result = NULL; in PHP_FUNCTION() local
3254 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3256 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3258 efree(result); in PHP_FUNCTION()
3265 efree(result); in PHP_FUNCTION()
3276 rc = SQLColumns(result->stmt, in PHP_FUNCTION()
3283 odbc_sql_error(conn, result->stmt, "SQLColumns"); in PHP_FUNCTION()
3284 efree(result); in PHP_FUNCTION()
3288 result->numparams = 0; in PHP_FUNCTION()
3289 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3291 if (result->numcols > 0) { in PHP_FUNCTION()
3292 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3293 efree(result); in PHP_FUNCTION()
3297 result->values = NULL; in PHP_FUNCTION()
3299 result->conn_ptr = conn; in PHP_FUNCTION()
3300 result->fetched = 0; in PHP_FUNCTION()
3301 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3311 odbc_result *result = NULL; in PHP_FUNCTION() local
3326 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3328 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3330 efree(result); in PHP_FUNCTION()
3337 efree(result); in PHP_FUNCTION()
3341 rc = SQLColumnPrivileges(result->stmt, in PHP_FUNCTION()
3348 odbc_sql_error(conn, result->stmt, "SQLColumnPrivileges"); in PHP_FUNCTION()
3349 efree(result); in PHP_FUNCTION()
3353 result->numparams = 0; in PHP_FUNCTION()
3354 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3356 if (result->numcols > 0) { in PHP_FUNCTION()
3357 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3358 efree(result); in PHP_FUNCTION()
3362 result->values = NULL; in PHP_FUNCTION()
3364 result->conn_ptr = conn; in PHP_FUNCTION()
3365 result->fetched = 0; in PHP_FUNCTION()
3366 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3377 odbc_result *result = NULL; in PHP_FUNCTION() local
3404 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3406 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3408 efree(result); in PHP_FUNCTION()
3415 efree(result); in PHP_FUNCTION()
3419 rc = SQLForeignKeys(result->stmt, in PHP_FUNCTION()
3428 odbc_sql_error(conn, result->stmt, "SQLForeignKeys"); in PHP_FUNCTION()
3429 efree(result); in PHP_FUNCTION()
3433 result->numparams = 0; in PHP_FUNCTION()
3434 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3436 if (result->numcols > 0) { in PHP_FUNCTION()
3437 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3438 efree(result); in PHP_FUNCTION()
3442 result->values = NULL; in PHP_FUNCTION()
3444 result->conn_ptr = conn; in PHP_FUNCTION()
3445 result->fetched = 0; in PHP_FUNCTION()
3446 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3457 odbc_result *result = NULL; in PHP_FUNCTION() local
3472 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3474 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3476 efree(result); in PHP_FUNCTION()
3483 efree(result); in PHP_FUNCTION()
3487 rc = SQLGetTypeInfo(result->stmt, data_type ); in PHP_FUNCTION()
3490 odbc_sql_error(conn, result->stmt, "SQLGetTypeInfo"); in PHP_FUNCTION()
3491 efree(result); in PHP_FUNCTION()
3495 result->numparams = 0; in PHP_FUNCTION()
3496 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3498 if (result->numcols > 0) { in PHP_FUNCTION()
3499 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3500 efree(result); in PHP_FUNCTION()
3504 result->values = NULL; in PHP_FUNCTION()
3506 result->conn_ptr = conn; in PHP_FUNCTION()
3507 result->fetched = 0; in PHP_FUNCTION()
3508 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3517 odbc_result *result = NULL; in PHP_FUNCTION() local
3531 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3533 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3535 efree(result); in PHP_FUNCTION()
3542 efree(result); in PHP_FUNCTION()
3546 rc = SQLPrimaryKeys(result->stmt, in PHP_FUNCTION()
3552 odbc_sql_error(conn, result->stmt, "SQLPrimaryKeys"); in PHP_FUNCTION()
3553 efree(result); in PHP_FUNCTION()
3557 result->numparams = 0; in PHP_FUNCTION()
3558 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3560 if (result->numcols > 0) { in PHP_FUNCTION()
3561 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3562 efree(result); in PHP_FUNCTION()
3566 result->values = NULL; in PHP_FUNCTION()
3568 result->conn_ptr = conn; in PHP_FUNCTION()
3569 result->fetched = 0; in PHP_FUNCTION()
3570 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3580 odbc_result *result = NULL; in PHP_FUNCTION() local
3599 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3601 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3603 efree(result); in PHP_FUNCTION()
3610 efree(result); in PHP_FUNCTION()
3614 rc = SQLProcedureColumns(result->stmt, in PHP_FUNCTION()
3621 odbc_sql_error(conn, result->stmt, "SQLProcedureColumns"); in PHP_FUNCTION()
3622 efree(result); in PHP_FUNCTION()
3626 result->numparams = 0; in PHP_FUNCTION()
3627 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3629 if (result->numcols > 0) { in PHP_FUNCTION()
3630 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3631 efree(result); in PHP_FUNCTION()
3635 result->values = NULL; in PHP_FUNCTION()
3637 result->conn_ptr = conn; in PHP_FUNCTION()
3638 result->fetched = 0; in PHP_FUNCTION()
3639 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3650 odbc_result *result = NULL; in PHP_FUNCTION() local
3668 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3670 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3672 efree(result); in PHP_FUNCTION()
3679 efree(result); in PHP_FUNCTION()
3683 rc = SQLProcedures(result->stmt, in PHP_FUNCTION()
3689 odbc_sql_error(conn, result->stmt, "SQLProcedures"); in PHP_FUNCTION()
3690 efree(result); in PHP_FUNCTION()
3694 result->numparams = 0; in PHP_FUNCTION()
3695 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3697 if (result->numcols > 0) { in PHP_FUNCTION()
3698 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3699 efree(result); in PHP_FUNCTION()
3703 result->values = NULL; in PHP_FUNCTION()
3705 result->conn_ptr = conn; in PHP_FUNCTION()
3706 result->fetched = 0; in PHP_FUNCTION()
3707 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3718 odbc_result *result = NULL; in PHP_FUNCTION() local
3738 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3740 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3742 efree(result); in PHP_FUNCTION()
3749 efree(result); in PHP_FUNCTION()
3753 rc = SQLSpecialColumns(result->stmt, in PHP_FUNCTION()
3762 odbc_sql_error(conn, result->stmt, "SQLSpecialColumns"); in PHP_FUNCTION()
3763 efree(result); in PHP_FUNCTION()
3767 result->numparams = 0; in PHP_FUNCTION()
3768 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3770 if (result->numcols > 0) { in PHP_FUNCTION()
3771 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3772 efree(result); in PHP_FUNCTION()
3776 result->values = NULL; in PHP_FUNCTION()
3778 result->conn_ptr = conn; in PHP_FUNCTION()
3779 result->fetched = 0; in PHP_FUNCTION()
3780 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3790 odbc_result *result = NULL; in PHP_FUNCTION() local
3809 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3811 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3813 efree(result); in PHP_FUNCTION()
3820 efree(result); in PHP_FUNCTION()
3824 rc = SQLStatistics(result->stmt, in PHP_FUNCTION()
3832 odbc_sql_error(conn, result->stmt, "SQLStatistics"); in PHP_FUNCTION()
3833 efree(result); in PHP_FUNCTION()
3837 result->numparams = 0; in PHP_FUNCTION()
3838 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3840 if (result->numcols > 0) { in PHP_FUNCTION()
3841 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3842 efree(result); in PHP_FUNCTION()
3846 result->values = NULL; in PHP_FUNCTION()
3848 result->conn_ptr = conn; in PHP_FUNCTION()
3849 result->fetched = 0; in PHP_FUNCTION()
3850 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()
3860 odbc_result *result = NULL; in PHP_FUNCTION() local
3874 result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); in PHP_FUNCTION()
3876 rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); in PHP_FUNCTION()
3878 efree(result); in PHP_FUNCTION()
3885 efree(result); in PHP_FUNCTION()
3889 rc = SQLTablePrivileges(result->stmt, in PHP_FUNCTION()
3895 odbc_sql_error(conn, result->stmt, "SQLTablePrivileges"); in PHP_FUNCTION()
3896 efree(result); in PHP_FUNCTION()
3900 result->numparams = 0; in PHP_FUNCTION()
3901 SQLNumResultCols(result->stmt, &(result->numcols)); in PHP_FUNCTION()
3903 if (result->numcols > 0) { in PHP_FUNCTION()
3904 if (!odbc_bindcols(result)) { in PHP_FUNCTION()
3905 efree(result); in PHP_FUNCTION()
3909 result->values = NULL; in PHP_FUNCTION()
3911 result->conn_ptr = conn; in PHP_FUNCTION()
3912 result->fetched = 0; in PHP_FUNCTION()
3913 RETURN_RES(zend_register_resource(result, le_result)); in PHP_FUNCTION()