Skip to content

Commit 5033bb7

Browse files
authored
Merge pull request suketa#832 from suketa/undocument
Undocument
2 parents a19178b + 35e8d8e commit 5033bb7

File tree

8 files changed

+35
-15
lines changed

8 files changed

+35
-15
lines changed

ext/duckdb/column.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ static size_t memsize(const void *p) {
2929
return sizeof(rubyDuckDBColumn);
3030
}
3131

32-
/*
33-
*
34-
*/
32+
/* :nodoc: */
3533
VALUE duckdb_column__type(VALUE oDuckDBColumn) {
3634
rubyDuckDBColumn *ctx;
3735
rubyDuckDBResult *ctxresult;

ext/duckdb/connection.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ static VALUE duckdb_connection_query_progress(VALUE self) {
114114
return rb_funcall(mDuckDBConverter, rb_intern("_to_query_progress"), 3, DBL2NUM(progress.percentage), ULL2NUM(progress.rows_processed), ULL2NUM(progress.total_rows_to_process));
115115
}
116116

117+
/* :nodoc: */
117118
static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase) {
118119
rubyDuckDBConnection *ctx;
119120
rubyDuckDB *ctxdb;
@@ -131,6 +132,7 @@ static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase) {
131132
return self;
132133
}
133134

135+
/* :nodoc: */
134136
static VALUE duckdb_connection_query_sql(VALUE self, VALUE str) {
135137
rubyDuckDBConnection *ctx;
136138
rubyDuckDBResult *ctxr;
@@ -161,5 +163,6 @@ void rbduckdb_init_duckdb_connection(void) {
161163
rb_define_method(cDuckDBConnection, "interrupt", duckdb_connection_interrupt, 0);
162164
rb_define_method(cDuckDBConnection, "query_progress", duckdb_connection_query_progress, 0);
163165
rb_define_private_method(cDuckDBConnection, "_connect", duckdb_connection_connect, 1);
166+
/* TODO: query_sql => _query_sql */
164167
rb_define_private_method(cDuckDBConnection, "query_sql", duckdb_connection_query_sql, 1);
165168
}

ext/duckdb/pending_result.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,13 @@ static VALUE duckdb_pending_result_execute_pending(VALUE self) {
124124
return result;
125125
}
126126

127+
/* :nodoc: */
127128
static VALUE duckdb_pending_result__state(VALUE self) {
128129
rubyDuckDBPendingResult *ctx = get_struct_pending_result(self);
129130
return INT2FIX(ctx->state);
130131
}
131132

133+
/* :nodoc: */
132134
static VALUE duckdb_pending_result__execute_check_state(VALUE self) {
133135
rubyDuckDBPendingResult *ctx = get_struct_pending_result(self);
134136
return INT2FIX(duckdb_pending_execute_check_state(ctx->pending_result));

ext/duckdb/prepared_statement.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,18 +316,21 @@ static VALUE duckdb_prepared_statement_bind_null(VALUE self, VALUE vidx) {
316316
return self;
317317
}
318318

319+
/* :nodoc: */
319320
static VALUE duckdb_prepared_statement__statement_type(VALUE self) {
320321
rubyDuckDBPreparedStatement *ctx;
321322
TypedData_Get_Struct(self, rubyDuckDBPreparedStatement, &prepared_statement_data_type, ctx);
322323
return INT2FIX(duckdb_prepared_statement_type(ctx->prepared_statement));
323324
}
324325

326+
/* :nodoc: */
325327
static VALUE duckdb_prepared_statement__param_type(VALUE self, VALUE vidx) {
326328
rubyDuckDBPreparedStatement *ctx;
327329
TypedData_Get_Struct(self, rubyDuckDBPreparedStatement, &prepared_statement_data_type, ctx);
328330
return INT2FIX(duckdb_param_type(ctx->prepared_statement, NUM2ULL(vidx)));
329331
}
330332

333+
/* :nodoc: */
331334
static VALUE duckdb_prepared_statement__bind_date(VALUE self, VALUE vidx, VALUE year, VALUE month, VALUE day) {
332335
rubyDuckDBPreparedStatement *ctx;
333336
duckdb_date dt;
@@ -344,6 +347,7 @@ static VALUE duckdb_prepared_statement__bind_date(VALUE self, VALUE vidx, VALUE
344347
return self;
345348
}
346349

350+
/* :nodoc: */
347351
static VALUE duckdb_prepared_statement__bind_time(VALUE self, VALUE vidx, VALUE hour, VALUE min, VALUE sec, VALUE micros){
348352
rubyDuckDBPreparedStatement *ctx;
349353
duckdb_time time;
@@ -361,6 +365,7 @@ static VALUE duckdb_prepared_statement__bind_time(VALUE self, VALUE vidx, VALUE
361365
return self;
362366
}
363367

368+
/* :nodoc: */
364369
static VALUE duckdb_prepared_statement__bind_timestamp(VALUE self, VALUE vidx, VALUE year, VALUE month, VALUE day, VALUE hour, VALUE min, VALUE sec, VALUE micros) {
365370
duckdb_timestamp timestamp;
366371
rubyDuckDBPreparedStatement *ctx;
@@ -375,6 +380,7 @@ static VALUE duckdb_prepared_statement__bind_timestamp(VALUE self, VALUE vidx, V
375380
return self;
376381
}
377382

383+
/* :nodoc: */
378384
static VALUE duckdb_prepared_statement__bind_interval(VALUE self, VALUE vidx, VALUE months, VALUE days, VALUE micros) {
379385
duckdb_interval interval;
380386
rubyDuckDBPreparedStatement *ctx;
@@ -390,6 +396,7 @@ static VALUE duckdb_prepared_statement__bind_interval(VALUE self, VALUE vidx, VA
390396
return self;
391397
}
392398

399+
/* :nodoc: */
393400
static VALUE duckdb_prepared_statement__bind_hugeint(VALUE self, VALUE vidx, VALUE lower, VALUE upper) {
394401
duckdb_hugeint hugeint;
395402
rubyDuckDBPreparedStatement *ctx;
@@ -406,6 +413,7 @@ static VALUE duckdb_prepared_statement__bind_hugeint(VALUE self, VALUE vidx, VAL
406413
return self;
407414
}
408415

416+
/* :nodoc: */
409417
static VALUE duckdb_prepared_statement__bind_decimal(VALUE self, VALUE vidx, VALUE lower, VALUE upper, VALUE width, VALUE scale) {
410418
duckdb_hugeint hugeint;
411419
duckdb_decimal decimal;

ext/duckdb/result.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ static VALUE destroy_data_chunk(VALUE arg) {
224224
return Qnil;
225225
}
226226

227+
/* :nodoc: */
227228
static VALUE duckdb_result_chunk_each(VALUE oDuckDBResult) {
228229
/*
229230
#ifdef HAVE_DUCKDB_H_GE_V1_0_0
@@ -258,6 +259,7 @@ static VALUE duckdb_result_chunk_each(VALUE oDuckDBResult) {
258259
*/
259260
}
260261

262+
/* :nodoc: */
261263
static VALUE duckdb_result__chunk_stream(VALUE oDuckDBResult) {
262264
rubyDuckDBResult *ctx;
263265
struct chunk_arg arg;
@@ -301,12 +303,14 @@ static VALUE yield_rows(VALUE arg) {
301303
return Qnil;
302304
}
303305

306+
/* :nodoc: */
304307
static VALUE duckdb_result__column_type(VALUE oDuckDBResult, VALUE col_idx) {
305308
rubyDuckDBResult *ctx;
306309
TypedData_Get_Struct(oDuckDBResult, rubyDuckDBResult, &result_data_type, ctx);
307310
return LL2NUM(duckdb_column_type(&(ctx->result), NUM2LL(col_idx)));
308311
}
309312

313+
/* :nodoc: */
310314
static VALUE duckdb_result__return_type(VALUE oDuckDBResult) {
311315
rubyDuckDBResult *ctx;
312316
TypedData_Get_Struct(oDuckDBResult, rubyDuckDBResult, &result_data_type, ctx);
@@ -320,12 +324,14 @@ static VALUE duckdb_result__return_type(VALUE oDuckDBResult) {
320324
#endif
321325
}
322326

327+
/* :nodoc: */
323328
static VALUE duckdb_result__statement_type(VALUE oDuckDBResult) {
324329
rubyDuckDBResult *ctx;
325330
TypedData_Get_Struct(oDuckDBResult, rubyDuckDBResult, &result_data_type, ctx);
326331
return INT2FIX(duckdb_result_statement_type(ctx->result));
327332
}
328333

334+
/* :nodoc: */
329335
static VALUE duckdb_result__enum_internal_type(VALUE oDuckDBResult, VALUE col_idx) {
330336
rubyDuckDBResult *ctx;
331337
VALUE type = Qnil;
@@ -340,6 +346,7 @@ static VALUE duckdb_result__enum_internal_type(VALUE oDuckDBResult, VALUE col_id
340346
return type;
341347
}
342348

349+
/* :nodoc: */
343350
static VALUE duckdb_result__enum_dictionary_size(VALUE oDuckDBResult, VALUE col_idx) {
344351
rubyDuckDBResult *ctx;
345352
VALUE size = Qnil;
@@ -354,6 +361,7 @@ static VALUE duckdb_result__enum_dictionary_size(VALUE oDuckDBResult, VALUE col_
354361
return size;
355362
}
356363

364+
/* :nodoc: */
357365
static VALUE duckdb_result__enum_dictionary_value(VALUE oDuckDBResult, VALUE col_idx, VALUE idx) {
358366
rubyDuckDBResult *ctx;
359367
VALUE value = Qnil;

lib/duckdb/column.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
module DuckDB
44
class Column
5-
#
65
# returns column type symbol
76
# `:unknown` means that the column type is unknown/unsupported by ruby-duckdb.
87
# `:invalid` means that the column type is invalid in duckdb.
@@ -15,7 +14,6 @@ class Column
1514
# users = con.query('SELECT * FROM users')
1615
# columns = users.columns
1716
# columns.first.type #=> :integer
18-
#
1917
def type
2018
type_id = _type
2119
DuckDB::Converter::IntToSym.type_to_sym(type_id)

lib/duckdb/interval.rb

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module DuckDB
2929
# .end_row
3030
# .flush
3131
class Interval
32+
# :stopdoc:
3233
ISO8601_REGEXP = Regexp.compile(
3334
'(?<negativ>-{0,1})P
3435
(?<year>-{0,1}\d+Y){0,1}
@@ -40,6 +41,8 @@ class Interval
4041
((?<sec>-{0,1}\d+)\.{0,1}(?<usec>\d*)S){0,1}',
4142
Regexp::EXTENDED
4243
)
44+
private_constant :ISO8601_REGEXP
45+
# :startdoc:
4346

4447
class << self
4548
# parses the ISO8601 format string and return the Interval object.
@@ -93,7 +96,7 @@ def to_interval(value)
9396

9497
private
9598

96-
def matched_to_i(matched)
99+
def matched_to_i(matched) # :nodoc:
97100
sign = to_sign(matched)
98101
sec = to_sec(matched)
99102
usec = to_usec(matched)
@@ -104,35 +107,35 @@ def matched_to_i(matched)
104107
sign.positive? ? value : value.map { |v| v * sign }
105108
end
106109

107-
def to_sign(matched)
110+
def to_sign(matched) # :nodoc:
108111
matched[:negativ] == '-' ? -1 : 1
109112
end
110113

111-
def to_year(matched)
114+
def to_year(matched) # :nodoc:
112115
matched[:year].to_i
113116
end
114117

115-
def to_month(matched)
118+
def to_month(matched) # :nodoc:
116119
matched[:month].to_i
117120
end
118121

119-
def to_day(matched)
122+
def to_day(matched) # :nodoc:
120123
matched[:day].to_i
121124
end
122125

123-
def to_hour(matched)
126+
def to_hour(matched) # :nodoc:
124127
matched[:hour].to_i
125128
end
126129

127-
def to_min(matched)
130+
def to_min(matched) # :nodoc:
128131
matched[:min].to_i
129132
end
130133

131-
def to_sec(matched)
134+
def to_sec(matched) # :nodoc:
132135
matched[:sec].to_i
133136
end
134137

135-
def to_usec(matched)
138+
def to_usec(matched) # :nodoc:
136139
matched[:usec].to_s.ljust(6, '0')[0, 6].to_i
137140
end
138141
end

lib/duckdb/pending_result.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module DuckDB
1919
# end
2020
# result = pending_result.execute_pending
2121
class PendingResult
22-
STATES = %i[ready not_ready error no_tasks].freeze
22+
STATES = %i[ready not_ready error no_tasks].freeze # :nodoc:
2323

2424
# returns the state of the pending result.
2525
# the result can be :ready, :not_ready, :error, :no_tasks.

0 commit comments

Comments
 (0)