Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add method field_count to DBDish::Oracle
  • Loading branch information
abraxxa committed Sep 8, 2015
1 parent aafb81a commit 9f3af58
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/DBDish/Oracle.pm6
Expand Up @@ -258,6 +258,7 @@ constant OCI_LOGON2_STMTCACHE = 4;
constant OCI_NTV_SYNTAX = 1;

constant OCI_ATTR_ROW_COUNT = 9;
constant OCI_ATTR_PARAM_COUNT = 18;
constant OCI_ATTR_STMT_TYPE = 24;

constant OCI_STMT_UNKNOWN = 0;
Expand Down Expand Up @@ -357,7 +358,6 @@ class DBDish::Oracle::StatementHandle does DBDish::StatementHandle {
# has $!affected_rows;
# has @!column_names;
has Int $!row_count;
# has $!field_count;
# has $!current_row = 0;
#
# method !handle-errors {
Expand Down Expand Up @@ -568,6 +568,21 @@ class DBDish::Oracle::StatementHandle does DBDish::StatementHandle {
# return @row_array;
}

method field_count {
# cache field count
state Int $field_count;
# TODO: what should be returned before the statement has been executed?
unless $field_count.defined {
# TODO: because 2015.07.2: 'Natively typed state variables not yet implemented'
my ub4 $field_count_native;
my $errcode = OCIAttrGet_ub4($!stmthp, OCI_HTYPE_STMT, $field_count_native,
Pointer, OCI_ATTR_PARAM_COUNT, $!errhp);
$field_count = $field_count_native;
# FIXME: error handling
}
return $field_count;
}

# method column_names {
# $!field_count = PQnfields($!result);
# unless @!column_names {
Expand Down

0 comments on commit 9f3af58

Please sign in to comment.