Lines Matching refs:result
45 static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int offset,zval *result, i…
46 static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int offset,zval *result…
74 ZEND_ARG_INFO(0, result)
85 ZEND_ARG_INFO(0, result)
90 ZEND_ARG_INFO(0, result)
99 ZEND_ARG_INFO(0, result)
109 ZEND_ARG_INFO(0, result)
308 static void _free_result(mssql_result *result, int free_fields) in _free_result() argument
312 if (result->data) { in _free_result()
313 for (i=0; i<result->num_rows; i++) { in _free_result()
314 if (result->data[i]) { in _free_result()
315 for (j=0; j<result->num_fields; j++) { in _free_result()
316 zval_dtor(&result->data[i][j]); in _free_result()
318 efree(result->data[i]); in _free_result()
321 efree(result->data); in _free_result()
322 result->data = NULL; in _free_result()
323 result->blocks_initialized = 0; in _free_result()
326 if (free_fields && result->fields) { in _free_result()
327 for (i=0; i<result->num_fields; i++) { in _free_result()
328 STR_FREE(result->fields[i].name); in _free_result()
329 STR_FREE(result->fields[i].column_source); in _free_result()
331 efree(result->fields); in _free_result()
355 mssql_result *result = (mssql_result *)rsrc->ptr; in _free_mssql_result() local
357 _free_result(result, 1); in _free_mssql_result()
358 dbcancel(result->mssql_ptr->link); in _free_mssql_result()
359 efree(result); in _free_mssql_result()
928 static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int offset,zval *result, i… argument
931 ZVAL_NULL(result);
942 ZVAL_LONG(result, (long) anyintcol(offset));
957 ZVAL_STRINGL(result, data, length, 1);
961 ZVAL_DOUBLE(result, (double) floatcol4(offset));
968 ZVAL_DOUBLE(result, res_buf);
972 ZVAL_DOUBLE(result, (double) floatcol8(offset));
982 ZVAL_STRINGL(result, data, 16, 1);
991 ZVAL_NULL(result);
993 ZVAL_STRINGL(result, (char *)dbdata(mssql_ptr->link, offset), res_length, 1);
1043 ZVAL_STRINGL(result, res_buf, res_length, 0);
1046 ZVAL_FALSE(result);
1055 static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int offset,zval *result… argument
1058 ZVAL_NULL(result);
1070 ZVAL_NULL(result);
1073 ZVAL_FALSE(result);
1081 ZVAL_STRINGL(result, res_buf, res_length, 0);
1123 ZVAL_STRINGL(result, res_buf, res_length, 0);
1126 ZVAL_FALSE(result);
1206 static int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int retvalue TSRMLS_DC) argument
1211 if (!result->have_fields) {
1212 for (i=0; i<result->num_fields; i++) {
1217 result->fields[i].name = estrdup(fname);
1224 result->fields[i].name = estrdup(computed_buf);
1227 result->fields[i].max_length = dbcollen(mssql_ptr->link,i+1);
1230 result->fields[i].column_source = estrdup(source);
1233 result->fields[i].column_source = STR_EMPTY_ALLOC();
1236 result->fields[i].type = coltype(i+1);
1238 switch (result->fields[i].type) {
1247 result->fields[i].numeric = 1;
1253 result->fields[i].numeric = 0;
1257 result->have_fields = 1;
1261 if (!result->data) {
1262 …result->data = (zval **) safe_emalloc(sizeof(zval *), MSSQL_ROWS_BLOCK*(++result->blocks_initializ…
1265 result->num_rows++;
1266 if (result->num_rows > result->blocks_initialized*MSSQL_ROWS_BLOCK) {
1267 …result->data = (zval **) erealloc(result->data,sizeof(zval *)*MSSQL_ROWS_BLOCK*(++result->blocks_i…
1269 result->data[i] = (zval *) safe_emalloc(sizeof(zval), result->num_fields, 0);
1270 for (j=0; j<result->num_fields; j++) {
1271 INIT_ZVAL(result->data[i][j]);
1272 …MS_SQL_G(get_column_content(mssql_ptr, j+1, &result->data[i][j], result->fields[j].type TSRMLS_CC)…
1274 if (i<result->batchsize || result->batchsize==0) {
1281 result->lastresult = retvalue;
1283 if (result->statement && (retvalue == NO_MORE_RESULTS || retvalue == NO_MORE_RPC_RESULTS)) {
1284 _mssql_get_sp_result(mssql_ptr, result->statement TSRMLS_CC);
1295 mssql_result *result; local
1306 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1308 mssql_ptr = result->mssql_ptr;
1309 _free_result(result, 0);
1310 result->cur_row=result->num_rows=0;
1311 result->num_rows = _mssql_fetch_batch(mssql_ptr, result, result->lastresult TSRMLS_CC);
1313 RETURN_LONG(result->num_rows);
1326 mssql_result *result; local
1373 result = (mssql_result *) emalloc(sizeof(mssql_result));
1374 result->statement = NULL;
1375 result->num_fields = num_fields;
1376 result->blocks_initialized = 1;
1378 result->batchsize = batchsize;
1379 result->data = NULL;
1380 result->blocks_initialized = 0;
1381 result->mssql_ptr = mssql_ptr;
1382 result->cur_field=result->cur_row=result->num_rows=0;
1383 result->have_fields = 0;
1385 result->fields = (mssql_field *) safe_emalloc(sizeof(mssql_field), result->num_fields, 0);
1386 result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC);
1388 ZEND_REGISTER_RESOURCE(return_value, result, le_result);
1414 mssql_result *result; local
1425 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1428 dbcanquery(result->mssql_ptr->link);
1429 retvalue = dbresults(result->mssql_ptr->link);
1458 mssql_result *result; local
1464 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1466 RETURN_LONG(result->num_rows);
1475 mssql_result *result; local
1481 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1483 RETURN_LONG(result->num_fields);
1492 mssql_result *result; local
1513 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1520 if (result->cur_row >= result->num_rows) {
1526 for (i=0; i<result->num_fields; i++) {
1527 if (Z_TYPE(result->data[result->cur_row][i]) != IS_NULL) {
1531 if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) {
1532 data = Z_STRVAL(result->data[result->cur_row][i]);
1533 data_len = Z_STRLEN(result->data[result->cur_row][i]);
1540 add_assoc_stringl(return_value, result->fields[i].name, data, data_len, 1);
1543 else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) {
1545 add_index_long(return_value, i, Z_LVAL(result->data[result->cur_row][i]));
1548 add_assoc_long(return_value, result->fields[i].name, Z_LVAL(result->data[result->cur_row][i]));
1550 else if (Z_TYPE(result->data[result->cur_row][i]) == IS_DOUBLE) {
1552 add_index_double(return_value, i, Z_DVAL(result->data[result->cur_row][i]));
1555 … add_assoc_double(return_value, result->fields[i].name, Z_DVAL(result->data[result->cur_row][i]));
1563 add_assoc_null(return_value, result->fields[i].name);
1566 result->cur_row++;
1611 mssql_result *result; local
1617 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1619 if (offset < 0 || offset >= result->num_rows) {
1624 result->cur_row = offset;
1694 mssql_result *result; local
1700 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1703 field_offset = result->cur_field;
1704 result->cur_field++;
1707 if (field_offset<0 || field_offset >= result->num_fields) {
1716 add_property_string(return_value, "name",result->fields[field_offset].name, 1);
1717 add_property_long(return_value, "max_length",result->fields[field_offset].max_length);
1718 add_property_string(return_value, "column_source",result->fields[field_offset].column_source, 1);
1719 add_property_long(return_value, "numeric", result->fields[field_offset].numeric);
1720 …add_property_string(return_value, "type", php_mssql_get_field_name(Z_TYPE(result->fields[field_off…
1730 mssql_result *result; local
1736 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1739 field_offset = result->cur_field;
1740 result->cur_field++;
1743 if (field_offset<0 || field_offset >= result->num_fields) {
1750 RETURN_LONG(result->fields[field_offset].max_length);
1760 mssql_result *result; local
1766 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1769 field_offset = result->cur_field;
1770 result->cur_field++;
1773 if (field_offset<0 || field_offset >= result->num_fields) {
1780 RETURN_STRINGL(result->fields[field_offset].name, strlen(result->fields[field_offset].name), 1);
1790 mssql_result *result; local
1796 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1799 field_offset = result->cur_field;
1800 result->cur_field++;
1803 if (field_offset<0 || field_offset >= result->num_fields) {
1810 …RINGL(php_mssql_get_field_name(Z_TYPE(result->fields[field_offset])), strlen(php_mssql_get_field_n…
1820 mssql_result *result; local
1826 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1828 if (field_offset<0 || field_offset >= result->num_fields) {
1833 result->cur_field = field_offset;
1845 mssql_result *result; local
1851 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1853 if (row < 0 || row >= result->num_rows) {
1862 for (i=0; i<result->num_fields; i++) {
1863 if (!strcasecmp(result->fields[i].name, Z_STRVAL_PP(field))) {
1868 if (i>=result->num_fields) { /* no match found */
1877 if (field_offset<0 || field_offset>=result->num_fields) {
1884 *return_value = result->data[row][field_offset];
1895 mssql_result *result; local
1902 ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
1904 mssql_ptr = result->mssql_ptr;
1915 if (result->statement) {
1916 _mssql_get_sp_result(mssql_ptr, result->statement TSRMLS_CC);
1921 _free_result(result, 1);
1922 result->cur_row=result->num_fields=result->num_rows=0;
1926 result->num_fields = dbnumcols(mssql_ptr->link);
1927 result->fields = (mssql_field *) safe_emalloc(sizeof(mssql_field), result->num_fields, 0);
1928 result->have_fields = 0;
1929 result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC);
2118 mssql_result *result; local
2155 result=NULL;
2170 result = (mssql_result *) emalloc(sizeof(mssql_result));
2171 result->batchsize = batchsize;
2172 result->blocks_initialized = 1;
2173 result->data = (zval **) safe_emalloc(sizeof(zval *), MSSQL_ROWS_BLOCK, 0);
2174 result->mssql_ptr = mssql_ptr;
2175 result->cur_field=result->cur_row=result->num_rows=0;
2176 result->num_fields = num_fields;
2177 result->have_fields = 0;
2179 result->fields = (mssql_field *) safe_emalloc(sizeof(mssql_field), num_fields, 0);
2180 result->statement = statement;
2181 result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC);
2189 if (result==NULL) {
2193 ZEND_REGISTER_RESOURCE(return_value, result, le_result);