Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 406b30ad6a
Fetching contributors…

Cannot retrieve contributors at this time

64 lines (52 sloc) 1.788 kb
#include "ps_sqlite3.h"
INTVAL SQLite3DataTable_type;
pmclass SQLite3DataTable dynpmc auto_attrs provides iterator {
ATTR Hash *colnames;
ATTR PMC *rows;
void class_init() {
SQLite3DataTable_type = entry;
}
VTABLE void init()
{
PObj_custom_mark_SET(SELF);
}
VTABLE void set_pointer(void *rawptr)
{
Hash * const colnames = (Hash*)rawptr;
if (!colnames)
Parrot_ex_throw_from_c_args(INTERP, NULL, 0, "SQLite: Null column names hash");
else {
PMC * const rows = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
PARROT_SQLITE3DATATABLE(SELF)->colnames = colnames;
PARROT_SQLITE3DATATABLE(SELF)->rows = rows;
}
}
VTABLE void mark()
{
Parrot_SQLite3DataTable_attributes * const attrs = PARROT_SQLITE3DATATABLE(SELF);
if (!PMC_IS_NULL(attrs->colnames))
Parrot_hash_mark(INTERP, attrs->colnames);
if (!PMC_IS_NULL(attrs->rows))
Parrot_gc_mark_PMC_alive(INTERP, attrs->rows);
}
VTABLE void push_pmc(PMC * row)
{
VTABLE_push_pmc(INTERP, PARROT_SQLITE3DATATABLE(SELF)->rows, row);
}
VTABLE PMC *get_pmc_keyed_int(INTVAL idx)
{
return VTABLE_get_pmc_keyed_int(INTERP, PARROT_SQLITE3DATATABLE(SELF)->rows, idx);
}
VTABLE INTVAL get_integer_keyed_str(STRING *colname)
{
return (INTVAL)Parrot_hash_get(INTERP, PARROT_SQLITE3DATATABLE(SELF)->colnames, (void*)colname);
}
VTABLE PMC *get_iter()
{
return Parrot_pmc_new_init(INTERP, enum_class_ArrayIterator, PARROT_SQLITE3DATATABLE(SELF)->rows);
}
VTABLE void *get_pointer_keyed(PMC * row)
{
return PARROT_SQLITE3DATATABLE(SELF)->colnames;
}
}
Jump to Line
Something went wrong with that request. Please try again.