0
- docCopyright("Jeremy Cowgar", 2006)
0
- docLicense("BSD revised")
0
- docCategory("Databases")
0
- docObject("DBIResult")
0
- docDescription("A DBI Result created by a call to DBIConn query.")
0
+//metadoc DBIResult copyright Jeremy Cowgar, 2006
0
+//metadoc DBIResult license BSD revised
0
+//metadoc DBIResult category Databases
0
+//metadoc DBIResult description A DBI Result created by a call to DBIConn query.
0
@@ -141,18 +137,16 @@ IoObject *IoDBIResult_rowToMap_(void *state, IoDBIResult *self,
0
IoObject *IoDBIResult_size(IoDBIResult *self, IoObject *locals,
0
- docSlot("size", "Returns the number of rows available")
0
+ //doc DBIResult size Returns the number of rows available.
0
return IONUMBER(dbi_result_get_numrows(DATA(self)->result));
0
IoObject *IoDBIResult_fields(IoDBIResult *self, IoObject *locals,
0
- docSlot("fields", "Returns a list of field names in the result")
0
+ //doc DBIResult fields Returns a list of field names in the result.
0
IoList *list = IOREF(IoList_new(IOSTATE));
0
@@ -168,9 +162,8 @@ IoObject *IoDBIResult_fields(IoDBIResult *self, IoObject *locals,
0
IoObject *IoDBIResult_first(IoDBIResult *self, IoObject *locals,
0
- docSlot("first", "Move the cursor to the first record")
0
+ //doc DBIResult first Move the cursor to the first record.
0
if (1 != dbi_result_first_row(DATA(self)->result))
0
ReportDBIError(DATA(self)->conn, IOSTATE, m);
0
@@ -182,9 +175,8 @@ IoObject *IoDBIResult_first(IoDBIResult *self, IoObject *locals,
0
IoObject *IoDBIResult_previous(IoDBIResult *self, IoObject *locals,
0
- docSlot("previous", "Move the cursor to the previous record")
0
+ //doc DBIResult previous Move the cursor to the previous record.
0
if (1 != dbi_result_prev_row(DATA(self)->result))
0
ReportDBIError(DATA(self)->conn, IOSTATE, m);
0
@@ -196,9 +188,8 @@ IoObject *IoDBIResult_previous(IoDBIResult *self, IoObject *locals,
0
IoObject *IoDBIResult_next(IoDBIResult *self, IoObject *locals,
0
- docSlot("next", "Move the cursor to the next record.")
0
+ //doc DBIResult next Move the cursor to the next record.
0
dbi_result res = DATA(self)->result;
0
if (0 == dbi_result_next_row(res))
0
@@ -213,9 +204,8 @@ IoObject *IoDBIResult_next(IoDBIResult *self, IoObject *locals,
0
IoObject *IoDBIResult_last(IoDBIResult *self, IoObject *locals,
0
- docSlot("last", "Move the cursor to the last record")
0
+ //doc DBIResult last Move the cursor to the last record.
0
dbi_result res = DATA(self)->result;
0
if (0 == dbi_result_last_row(res))
0
@@ -230,9 +220,8 @@ IoObject *IoDBIResult_last(IoDBIResult *self, IoObject *locals,
0
IoObject *IoDBIResult_seek(IoDBIResult *self, IoObject *locals,
0
- docSlot("seek(row_number)", "Move the cursor to the nth record")
0
+ //doc DBIResult seek(row_number) Move the cursor to the nth record.
0
dbi_result res = DATA(self)->result;
0
IoObject *row = IoMessage_locals_valueArgAt_(m, locals, 0);
0
@@ -245,11 +234,12 @@ IoObject *IoDBIResult_seek(IoDBIResult *self, IoObject *locals,
0
rowIdx = IoNumber_asLong(row);
0
if (1 != dbi_result_seek_row(res, rowIdx))
0
- int errorCode = dbi_conn_error(DATA(self)->conn,
0
+ int errorCode = dbi_conn_error(DATA(self)->conn, &error);
0
@@ -265,12 +255,10 @@ IoObject *IoDBIResult_seek(IoDBIResult *self, IoObject *locals,
0
return IOBOOL(self, 1);
0
-IoObject *IoDBIResult_position(
0
- IoDBIResult *self, IoObject *locals, IoMessage *m)
0
+IoObject *IoDBIResult_position(IoDBIResult *self, IoObject *locals, IoMessage *m)
0
- docSlot("position", "Return the current row's position (or index).")
0
+ //doc DBIResult position Return the current row's position (or index).
0
unsigned long long rowNum = dbi_result_get_currow(DATA(self)->result);
0
@@ -283,9 +271,9 @@ IoObject *IoDBIResult_position(
0
IoObject *IoDBIResult_at(IoDBIResult *self, IoObject *locals, IoMessage *m)
0
- docSlot("at(index_or_name)", "Return the contents of the given field. The
0
-parameter can be a field index or a field name.")
0
+ /*doc DBIResult at(index_or_name)
0
+ Returns the contents of the given field.
0
+ The parameter can be a field index or a field name.
0
dbi_result res = DATA(self)->result;
0
@@ -316,11 +304,11 @@ parameter can be a field index or a field name.")
0
IoObject *IoDBIResult_populate(IoDBIResult *self, IoObject *locals,
0
- docSlot("populate(object)", "Populate a decendent of DBIRecord with the
0
-current record's contents. See `DBIRecord' for further explanation and an
0
+ /*doc DBIResult populate(object)
0
+ Populates a decendent of DBIRecord with the current record's contents.
0
+ See `DBIRecord' for further explanation and an example.
0
dbi_result res = DATA(self)->result;
0
IoObject *baseObject = IoMessage_locals_valueArgAt_(m, locals, 0);
0
IoObject *o = IOCLONE(baseObject);
0
@@ -335,10 +323,9 @@ example.")
0
IoObject *IoDBIResult_foreach(IoDBIResult *self, IoObject *locals,
0
- docSlot("foreach([Object], value, message)", """Loops over the records in the
0
-result starting at either the first result (if the cursor has never been
0
-moved) or it's current location if moved. i.e.
0
+/*doc DBIResult foreach([Object], value, message)
0
+Loops over the records in the result starting at either the first result
0
+(if the cursor has never been moved) or it's current location if moved. i.e.
0
r := conn query("SELECT * FROM people")
0
@@ -360,8 +347,8 @@ The above would start at the record #4, not at the beginning.
0
The optional Object parameter would cause a decendent of DBIRecord to be
0
populate instead of the index being set. This allows for advanced
0
functionality. Please see `DBIRecord' for further information and an example.
0
dbi_result res = DATA(self)->result;
0
IoObject *result = IONIL(self);
0
@@ -442,11 +429,12 @@ done:
0
IoObject *IoDBIResult_done(IoDBIResult *self, IoObject *locals, IoMessage *m)
0
- docSlot("done", "Close and free the result. This <b>must</b> be called on
0
+ Close and free the result. This <b>must</b> be called on
0
each result. Failure to do so will cause memory leaks and open queries with
0
if (0 != dbi_result_free(DATA(self)->result))
0
ReportDBIError(DATA(self)->conn, IOSTATE, m);