int main(int argc, char **argv) { Eina_Value vtv, vtz; struct timeval tv; struct timezone tz; char *s; eina_init(); eina_value_setup(&vtv, EINA_VALUE_TYPE_TIMEVAL); eina_value_setup(&vtz, &TZ_TYPE); gettimeofday(&tv, &tz); eina_value_set(&vtv, tv); eina_value_set(&vtz, tz); s = eina_value_to_string(&vtv); printf("time: %s\n", s); free(s); s = eina_value_to_string(&vtz); printf("timezone: %s\n", s); free(s); eina_value_flush(&vtz); eina_value_flush(&vtv); }
// emodel_load static unsigned int _esql_load(Esql_Res *res, void *data, Eina_Bool children_load) { Esql_Model_Data *pd = (Esql_Model_Data*)data; Eina_Iterator *i; const Esql_Row *r; int cols; unsigned int count = 0; cols = esql_res_cols_count(res); i = esql_res_row_iterator_new(res); EINA_ITERATOR_FOREACH(i, r) { int c; for (c = 0; c < cols; ++c, ++count) { Eina_Value val; if (esql_row_value_column_get(r, c, &val)) { if(children_load == EINA_TRUE) { Eo *o; char *table = eina_value_to_string(&val); o = eo_add_ref(ESQL_MODEL_TABLE_CLASS, NULL, esql_model_table_constructor(pd->e, pd->conn.database, table, count)); pd->children_list = eina_list_append(pd->children_list, o); free(table); eina_value_flush(&val); } } } }
/** * Callbacks */ static unsigned int _esql_model_load(Esql_Res *res, void *data) { Eina_Iterator *i; const Esql_Row *r; unsigned int count = 0; Esql_Model_Table_Data *pd = (Esql_Model_Table_Data*)data; i = esql_res_row_iterator_new(res); EINA_ITERATOR_FOREACH(i, r) { Eina_Value val; if (esql_row_value_column_get(r, 0, &val)) { Eo *child; char *str = eina_value_to_string(&val); char *database = NULL, *table = NULL; unsigned int _count = 0; count = atoi(str); free(str); eina_value_flush(&val); eina_value_struct_get(pd->properties, "database", &database); eina_value_struct_get(pd->properties, "table", &table); EINA_SAFETY_ON_NULL_RETURN_VAL(database, count); EINA_SAFETY_ON_NULL_RETURN_VAL(table, count); if(count) { for(; _count < count; ++_count) { child = eo_add_ref(ESQL_MODEL_ROW_CLASS, pd->obj, esql_model_row_constructor(pd->e, database, table, _count)); pd->children_list = eina_list_append(pd->children_list, child); } } } }