Lines Matching refs:result
82 ZEND_ARG_INFO(0, result)
90 ZEND_ARG_INFO(0, result)
94 ZEND_ARG_INFO(0, result)
98 ZEND_ARG_INFO(0, result)
102 ZEND_ARG_INFO(0, result)
107 ZEND_ARG_INFO(0, result)
111 ZEND_ARG_INFO(0, result)
115 ZEND_ARG_INFO(0, result)
120 ZEND_ARG_INFO(0, result)
125 ZEND_ARG_INFO(0, result)
130 ZEND_ARG_INFO(0, result)
254 #define FREE_SYBASE_RESULT(result) \ argument
255 if (result) { \
256 fprintf(stderr, "_free_sybase_result(%p) called from line #%d\n", result, __LINE__); \
258 _free_sybase_result(result); \
259 result = NULL; \
262 #define FREE_SYBASE_RESULT(result) \ argument
263 if (result) { \
264 _free_sybase_result(result); \
265 result = NULL; \
268 static void _free_sybase_result(sybase_result *result) in _free_sybase_result() argument
272 if (result->data) { in _free_sybase_result()
273 for (i = 0; i < (result->store ? result->num_rows : MIN(1, result->num_rows)); i++) { in _free_sybase_result()
274 for (j=0; j<result->num_fields; j++) { in _free_sybase_result()
275 zval_dtor(&result->data[i][j]); in _free_sybase_result()
277 efree(result->data[i]); in _free_sybase_result()
279 efree(result->data); in _free_sybase_result()
282 if (result->fields) { in _free_sybase_result()
283 for (i=0; i<result->num_fields; i++) { in _free_sybase_result()
284 STR_FREE(result->fields[i].name); in _free_sybase_result()
285 STR_FREE(result->fields[i].column_source); in _free_sybase_result()
287 efree(result->fields); in _free_sybase_result()
290 if (result->tmp_buffer) { in _free_sybase_result()
291 for (i=0; i<result->num_fields; i++) { in _free_sybase_result()
292 efree(result->tmp_buffer[i]); in _free_sybase_result()
294 efree(result->tmp_buffer); in _free_sybase_result()
297 efree_if(result->lengths); in _free_sybase_result()
298 efree_if(result->indicators); in _free_sybase_result()
299 efree_if(result->datafmt); in _free_sybase_result()
300 efree_if(result->numerics); in _free_sybase_result()
301 efree_if(result->types); in _free_sybase_result()
303 efree(result); in _free_sybase_result()
307 static int php_sybase_finish_results (sybase_result *result TSRMLS_DC);
311 sybase_result *result = (sybase_result *)rsrc->ptr; in php_free_sybase_result() local
314 if (result->sybase_ptr && result->sybase_ptr->active_result_index) { in php_free_sybase_result()
315 if (result->sybase_ptr->cmd) { in php_free_sybase_result()
316 ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); in php_free_sybase_result()
318 php_sybase_finish_results(result TSRMLS_CC); in php_free_sybase_result()
321 FREE_SYBASE_RESULT(result); in php_free_sybase_result()
1090 static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) in php_sybase_finish_results()
1096 efree_n(result->datafmt); in php_sybase_finish_results()
1097 efree_n(result->lengths); in php_sybase_finish_results()
1098 efree_n(result->indicators); in php_sybase_finish_results()
1099 efree_n(result->numerics); in php_sybase_finish_results()
1100 efree_n(result->types); in php_sybase_finish_results()
1101 for (i=0; i<result->num_fields; i++) { in php_sybase_finish_results()
1102 efree(result->tmp_buffer[i]); in php_sybase_finish_results()
1104 efree_n(result->tmp_buffer); in php_sybase_finish_results()
1107 result->sybase_ptr->active_result_index= 0; in php_sybase_finish_results()
1117 while ((retcode = ct_results(result->sybase_ptr->cmd, &restype))==CS_SUCCEED) { in php_sybase_finish_results()
1125 ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); in php_sybase_finish_results()
1135 ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_CURRENT); in php_sybase_finish_results()
1140 ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_CURRENT); in php_sybase_finish_results()
1145 ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); in php_sybase_finish_results()
1166 ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); in php_sybase_finish_results()
1170 result->sybase_ptr->dead = 1; in php_sybase_finish_results()
1181 #define RETURN_DOUBLE_VAL(result, buf, length) \ argument
1184 Z_DVAL(result) = zend_strtod(buf, NULL); \
1186 Z_TYPE(result) = IS_DOUBLE; \
1188 ZVAL_STRINGL(&result, buf, length- 1, 1); \
1191 ZVAL_STRINGL(&result, buf, length- 1, 1); \
1194 static int php_sybase_fetch_result_row(sybase_result *result, int numrows TSRMLS_DC) in php_sybase_fetch_result_row() argument
1200 if (result->last_retcode == CS_END_DATA || result->last_retcode == CS_END_RESULTS) { in php_sybase_fetch_result_row()
1201 return result->last_retcode; in php_sybase_fetch_result_row()
1204 if (numrows!=-1) numrows+= result->num_rows; in php_sybase_fetch_result_row()
1205 …while ((retcode=ct_fetch(result->sybase_ptr->cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, NULL))==CS_SUCC… in php_sybase_fetch_result_row()
1206 result->num_rows++; in php_sybase_fetch_result_row()
1207 i= result->store ? result->num_rows- 1 : 0; in php_sybase_fetch_result_row()
1208 if (i >= result->blocks_initialized*SYBASE_ROWS_BLOCK) { in php_sybase_fetch_result_row()
1209 …result->data = (zval **) safe_erealloc(result->data, SYBASE_ROWS_BLOCK*(++result->blocks_initializ… in php_sybase_fetch_result_row()
1211 if (result->store || 1 == result->num_rows) { in php_sybase_fetch_result_row()
1212 result->data[i] = (zval *) safe_emalloc(sizeof(zval), result->num_fields, 0); in php_sybase_fetch_result_row()
1215 for (j = 0; j < result->num_fields; j++) { in php_sybase_fetch_result_row()
1218 if (!result->store && result->num_rows > 1 && Z_TYPE(result->data[i][j]) == IS_STRING) { in php_sybase_fetch_result_row()
1219 efree(Z_STRVAL(result->data[i][j])); in php_sybase_fetch_result_row()
1222 if (result->indicators[j] == -1) { /* null value */ in php_sybase_fetch_result_row()
1223 ZVAL_NULL(&result->data[i][j]); in php_sybase_fetch_result_row()
1225 switch (result->numerics[j]) { in php_sybase_fetch_result_row()
1228 ZVAL_LONG(&result->data[i][j], strtol(result->tmp_buffer[j], NULL, 10)); in php_sybase_fetch_result_row()
1234 RETURN_DOUBLE_VAL(result->data[i][j], result->tmp_buffer[j], result->lengths[j]); in php_sybase_fetch_result_row()
1241 Z_LVAL(result->data[i][j]) = strtol(result->tmp_buffer[j], NULL, 10); in php_sybase_fetch_result_row()
1245 RETURN_DOUBLE_VAL(result->data[i][j], result->tmp_buffer[j], result->lengths[j]); in php_sybase_fetch_result_row()
1248 Z_TYPE(result->data[i][j]) = IS_LONG; in php_sybase_fetch_result_row()
1259 if (result->lengths[j] < 1) { in php_sybase_fetch_result_row()
1260 ZVAL_NULL(&result->data[i][j]); in php_sybase_fetch_result_row()
1262 ZVAL_STRINGL(&result->data[i][j], result->tmp_buffer[j], result->lengths[j]- 1, 1); in php_sybase_fetch_result_row()
1269 if (numrows!=-1 && result->num_rows>=numrows) break; in php_sybase_fetch_result_row()
1273 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Error reading row %d", result->num_rows); in php_sybase_fetch_result_row()
1276 result->last_retcode= retcode; in php_sybase_fetch_result_row()
1279 retcode = php_sybase_finish_results(result TSRMLS_CC); in php_sybase_fetch_result_row()
1287 FREE_SYBASE_RESULT(result); in php_sybase_fetch_result_row()
1288 result = NULL; in php_sybase_fetch_result_row()
1299 sybase_result *result; in php_sybase_fetch_result_set() local
1312 result = (sybase_result *) emalloc(sizeof(sybase_result)); in php_sybase_fetch_result_set()
1313 result->data = (zval **) safe_emalloc(sizeof(zval *), SYBASE_ROWS_BLOCK, 0); in php_sybase_fetch_result_set()
1314 result->fields = NULL; in php_sybase_fetch_result_set()
1315 result->sybase_ptr = sybase_ptr; in php_sybase_fetch_result_set()
1316 result->cur_field=result->cur_row=result->num_rows=0; in php_sybase_fetch_result_set()
1317 result->num_fields = num_fields; in php_sybase_fetch_result_set()
1318 result->last_retcode = 0; in php_sybase_fetch_result_set()
1319 result->store= store; in php_sybase_fetch_result_set()
1320 result->blocks_initialized= 1; in php_sybase_fetch_result_set()
1321 result->tmp_buffer = (char **) safe_emalloc(sizeof(char *), num_fields, 0); in php_sybase_fetch_result_set()
1322 result->lengths = (CS_INT *) safe_emalloc(sizeof(CS_INT), num_fields, 0); in php_sybase_fetch_result_set()
1323 result->indicators = (CS_SMALLINT *) safe_emalloc(sizeof(CS_INT), num_fields, 0); in php_sybase_fetch_result_set()
1324 result->datafmt = (CS_DATAFMT *) safe_emalloc(sizeof(CS_DATAFMT), num_fields, 0); in php_sybase_fetch_result_set()
1325 result->numerics = (unsigned char *) safe_emalloc(sizeof(unsigned char), num_fields, 0); in php_sybase_fetch_result_set()
1326 result->types = (CS_INT *) safe_emalloc(sizeof(CS_INT), num_fields, 0); in php_sybase_fetch_result_set()
1329 ct_describe(sybase_ptr->cmd, i+1, &result->datafmt[i]); in php_sybase_fetch_result_set()
1330 result->types[i] = result->datafmt[i].datatype; in php_sybase_fetch_result_set()
1331 switch (result->datafmt[i].datatype) { in php_sybase_fetch_result_set()
1336 result->datafmt[i].maxlength++; in php_sybase_fetch_result_set()
1337 result->numerics[i] = 0; in php_sybase_fetch_result_set()
1341 result->datafmt[i].maxlength *= 2; in php_sybase_fetch_result_set()
1342 result->datafmt[i].maxlength++; in php_sybase_fetch_result_set()
1343 result->numerics[i] = 0; in php_sybase_fetch_result_set()
1347 result->datafmt[i].maxlength = 4; in php_sybase_fetch_result_set()
1348 result->numerics[i] = 1; in php_sybase_fetch_result_set()
1351 result->datafmt[i].maxlength = 7; in php_sybase_fetch_result_set()
1352 result->numerics[i] = 1; in php_sybase_fetch_result_set()
1355 result->datafmt[i].maxlength = 12; in php_sybase_fetch_result_set()
1356 result->numerics[i] = 1; in php_sybase_fetch_result_set()
1360 result->datafmt[i].maxlength = 24; in php_sybase_fetch_result_set()
1361 result->numerics[i] = 2; in php_sybase_fetch_result_set()
1365 result->datafmt[i].maxlength = 24; in php_sybase_fetch_result_set()
1366 result->numerics[i] = 2; in php_sybase_fetch_result_set()
1370 result->datafmt[i].maxlength = 30; in php_sybase_fetch_result_set()
1371 result->numerics[i] = 0; in php_sybase_fetch_result_set()
1375 result->datafmt[i].maxlength = result->datafmt[i].precision + 3; in php_sybase_fetch_result_set()
1377 result->numerics[i] = (result->datafmt[i].scale == 0) ? 3 : 2; in php_sybase_fetch_result_set()
1380 result->datafmt[i].maxlength++; in php_sybase_fetch_result_set()
1381 result->numerics[i] = 0; in php_sybase_fetch_result_set()
1384 result->tmp_buffer[i] = (char *)emalloc(result->datafmt[i].maxlength); in php_sybase_fetch_result_set()
1385 result->datafmt[i].datatype = CS_CHAR_TYPE; in php_sybase_fetch_result_set()
1386 result->datafmt[i].format = CS_FMT_NULLTERM; in php_sybase_fetch_result_set()
1387 …ct_bind(sybase_ptr->cmd, i+1, &result->datafmt[i], result->tmp_buffer[i], &result->lengths[i], &re… in php_sybase_fetch_result_set()
1390 result->fields = (sybase_field *) safe_emalloc(sizeof(sybase_field), num_fields, 0); in php_sybase_fetch_result_set()
1395 if (result->datafmt[i].namelen>0) { in php_sybase_fetch_result_set()
1396 result->fields[i].name = estrndup(result->datafmt[i].name, result->datafmt[i].namelen); in php_sybase_fetch_result_set()
1403 result->fields[i].name = estrdup(computed_buf); in php_sybase_fetch_result_set()
1406 result->fields[i].column_source = STR_EMPTY_ALLOC(); in php_sybase_fetch_result_set()
1407 result->fields[i].max_length = result->datafmt[i].maxlength-1; in php_sybase_fetch_result_set()
1408 result->fields[i].numeric = result->numerics[i]; in php_sybase_fetch_result_set()
1409 Z_TYPE(result->fields[i]) = result->types[i]; in php_sybase_fetch_result_set()
1415 if ((retcode = php_sybase_fetch_result_row(result, -1 TSRMLS_CC)) == CS_FAIL) { in php_sybase_fetch_result_set()
1420 result->last_retcode = retcode; in php_sybase_fetch_result_set()
1421 return result; in php_sybase_fetch_result_set()
1431 sybase_result *result; in php_sybase_query() local
1475 ZEND_FETCH_RESOURCE(result, sybase_result *, &tmp, -1, "Sybase result", le_result); in php_sybase_query()
1477 if (result) { in php_sybase_query()
1478 php_sybase_finish_results(result TSRMLS_CC); in php_sybase_query()
1489 result = NULL; in php_sybase_query()
1552 result = php_sybase_fetch_result_set(sybase_ptr, buffered, store TSRMLS_CC); in php_sybase_query()
1553 if (result == NULL) { in php_sybase_query()
1578 result = php_sybase_fetch_result_set(sybase_ptr, buffered, store TSRMLS_CC); in php_sybase_query()
1579 if (result == NULL) { in php_sybase_query()
1585 retcode = result->last_retcode; in php_sybase_query()
1634 FREE_SYBASE_RESULT(result); in php_sybase_query()
1653 FREE_SYBASE_RESULT(result); in php_sybase_query()
1661 FREE_SYBASE_RESULT(result); in php_sybase_query()
1666 id= ZEND_REGISTER_RESOURCE(return_value, result, le_result); in php_sybase_query()
1690 sybase_result *result; in PHP_FUNCTION() local
1695 ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); in PHP_FUNCTION()
1698 if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) { in PHP_FUNCTION()
1700 ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); in PHP_FUNCTION()
1701 php_sybase_finish_results(result TSRMLS_CC); in PHP_FUNCTION()
1723 sybase_result *result; in PHP_FUNCTION() local
1728 ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); in PHP_FUNCTION()
1730 Z_LVAL_P(return_value) = result->num_rows; in PHP_FUNCTION()
1741 sybase_result *result; in PHP_FUNCTION() local
1746 ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); in PHP_FUNCTION()
1748 Z_LVAL_P(return_value) = result->num_fields; in PHP_FUNCTION()
1760 sybase_result *result; in PHP_FUNCTION() local
1766 ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); in PHP_FUNCTION()
1769 if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) { in PHP_FUNCTION()
1770 php_sybase_fetch_result_row(result, 1 TSRMLS_CC); in PHP_FUNCTION()
1774 if (result->cur_row >= result->num_rows) { in PHP_FUNCTION()
1779 for (i=0; i<result->num_fields; i++) { in PHP_FUNCTION()
1781 *field_content = result->data[result->store ? result->cur_row : 0][i]; in PHP_FUNCTION()
1786 result->cur_row++; in PHP_FUNCTION()
1794 sybase_result *result; in php_sybase_fetch_hash() local
1802 ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); in php_sybase_fetch_hash()
1805 if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) { in php_sybase_fetch_hash()
1806 php_sybase_fetch_result_row(result, 1 TSRMLS_CC); in php_sybase_fetch_hash()
1810 if (result->cur_row >= result->num_rows) { in php_sybase_fetch_hash()
1817 for (i=0; i<result->num_fields; i++) { in php_sybase_fetch_hash()
1819 *tmp = result->data[result->store ? result->cur_row : 0][i]; in php_sybase_fetch_hash()
1827 …if (zend_hash_exists(Z_ARRVAL_P(return_value), result->fields[i].name, strlen(result->fields[i].na… in php_sybase_fetch_hash()
1828 snprintf(name, 32, "%s%d", result->fields[i].name, j); in php_sybase_fetch_hash()
1829 result->fields[i].name= estrdup(name); in php_sybase_fetch_hash()
1832 …zend_hash_update(Z_ARRVAL_P(return_value), result->fields[i].name, strlen(result->fields[i].name)+… in php_sybase_fetch_hash()
1834 result->cur_row++; in php_sybase_fetch_hash()
1845 sybase_result *result; in PHP_FUNCTION() local
1851 ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); in PHP_FUNCTION()
1911 sybase_result *result; in PHP_FUNCTION() local
1916 ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); in PHP_FUNCTION()
1919 …if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS && offset >= res… in PHP_FUNCTION()
1920 php_sybase_fetch_result_row(result, offset+ 1 TSRMLS_CC); in PHP_FUNCTION()
1923 if (offset < 0 || offset >= result->num_rows) { in PHP_FUNCTION()
1924 … E_WARNING, "Sybase: Bad row offset %ld, must be betweem 0 and %d", offset, result->num_rows - 1); in PHP_FUNCTION()
1928 result->cur_row = offset; in PHP_FUNCTION()
1983 sybase_result *result; in PHP_FUNCTION() local
1988 ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); in PHP_FUNCTION()
1991 field_offset = result->cur_field; in PHP_FUNCTION()
1992 result->cur_field++; in PHP_FUNCTION()
1995 if (field_offset < 0 || field_offset >= result->num_fields) { in PHP_FUNCTION()
2004 add_property_string(return_value, "name", result->fields[field_offset].name, 1); in PHP_FUNCTION()
2005 add_property_long(return_value, "max_length", result->fields[field_offset].max_length); in PHP_FUNCTION()
2006 add_property_string(return_value, "column_source", result->fields[field_offset].column_source, 1); in PHP_FUNCTION()
2007 add_property_long(return_value, "numeric", result->fields[field_offset].numeric); in PHP_FUNCTION()
2008 …add_property_string(return_value, "type", php_sybase_get_field_name(Z_TYPE(result->fields[field_of… in PHP_FUNCTION()
2019 sybase_result *result; in PHP_FUNCTION() local
2024 ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); in PHP_FUNCTION()
2026 if (field_offset < 0 || field_offset >= result->num_fields) { in PHP_FUNCTION()
2031 result->cur_field = field_offset; in PHP_FUNCTION()
2045 sybase_result *result; in PHP_FUNCTION() local
2050 ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); in PHP_FUNCTION()
2053 …if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS && row >= result… in PHP_FUNCTION()
2054 php_sybase_fetch_result_row(result, row TSRMLS_CC); in PHP_FUNCTION()
2057 if (row < 0 || row >= result->num_rows) { in PHP_FUNCTION()
2066 for (i = 0; i < result->num_fields; i++) { in PHP_FUNCTION()
2067 if (strcasecmp(result->fields[i].name, Z_STRVAL_P(field)) == 0) { in PHP_FUNCTION()
2072 if (i >= result->num_fields) { /* no match found */ in PHP_FUNCTION()
2081 if (field_offset < 0 || field_offset >= result->num_fields) { in PHP_FUNCTION()
2088 *return_value = result->data[row][field_offset]; in PHP_FUNCTION()