Method: SQLAnywhere::SQLAnywhereInterface#sqlany_get_column_info
- Defined in:
- ext/sqlanywhere.c
#sqlany_get_column_info(VALUEimp_drh, VALUEsqlany_stmt, VALUEcol_num) ⇒ Array
Fetches the next row from the result set.
This function fetches the next row from the result set. When the result
object is first created, the current row pointer is set to point before
the first row (that is, row 0).
This function advances the row pointer first and then fetches the data
at the new row.
<b>Parameters</b>:
- <tt>VALUE imp_drh</tt> -- An initialized API structure to finalize.
- <tt>VALUE sqlany_stmt</tt> -- A statement object that was created by sqlany_prepare() or sqlany_execute_direct().
- <tt>VALUE col_num</tt> -- The number of the column to be retrieved. A column number is between 0 and sqlany_num_cols() - 1.
<b>Returns</b>:
- <tt>VALUE result</tt>: <tt>1</tt> on success. Returns <tt>0</tt> if the column index is out of range, or if the statement does not return a result set.
- <tt>VALUE col_num</tt>: The number of the column retrieved.
- <tt>VALUE name</tt>: The name of the column.
- <tt>VALUE type</tt>: The type of the column data.
- <tt>VALUE native_type</tt>: The SQL Anywhere native type of the column data.
- <tt>VALUE precision</tt>: The precision of the column.
- <tt>VALUE scale</tt>: The scale of the column.
- <tt>VALUE max_size</tt>: The maximum size a data value in this column can take.
- <tt>VALUE nullable</tt>: The nullability of the column.
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 |
# File 'ext/sqlanywhere.c', line 816
static VALUE
static_SQLAnywhereInterface_sqlany_get_column_info(VALUE imp_drh, VALUE sqlany_stmt, VALUE col_num)
{
imp_drh_st* s_imp_drh;
a_sqlany_stmt* s_stmt;
sacapi_u32 s_col_num;
a_sqlany_column_info info;
sacapi_bool result;
VALUE multi_result;
Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
Data_Get_Struct(sqlany_stmt, a_sqlany_stmt, s_stmt);
s_col_num = NUM2INT(col_num);
result = s_imp_drh->api.sqlany_get_column_info(s_stmt, s_col_num, &info );
multi_result = rb_ary_new();
rb_ary_push(multi_result, INT2NUM(result));
rb_ary_push(multi_result, col_num );
rb_ary_push(multi_result, rb_str_new2(info.name));
rb_ary_push(multi_result, INT2NUM(info.type));
rb_ary_push(multi_result, INT2NUM(info.native_type));
rb_ary_push(multi_result, INT2NUM(info.precision));
rb_ary_push(multi_result, INT2NUM(info.scale));
rb_ary_push(multi_result, INT2NUM(info.max_size));
rb_ary_push(multi_result, INT2NUM(info.nullable));
return( multi_result );
}
|