From 63112f3fc14f0395677b40d071b7e5204ed419e8 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 22 Dec 2007 23:39:13 +0000 Subject: got data and sql query output working; added float handling to sql_query_set_atom() svn path=/trunk/externals/hcs/; revision=9103 --- sql_query.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'sql_query.c') diff --git a/sql_query.c b/sql_query.c index f051a91..37242bb 100644 --- a/sql_query.c +++ b/sql_query.c @@ -57,14 +57,14 @@ typedef struct _sql_query { t_object x_obj; - t_binbuf* x_query_binbuf; // store query in a binbuf for reuse + t_binbuf* x_query_binbuf; // binbuf for converting args to string - struct _proxy_inlet*inlets; // pointer to array of _proxy_inlets - t_atom* atoms; // pointer to array of atoms - unsigned int placeholder_count; // number of items in above arrays + struct _proxy_inlet*inlets; // pointer to array of _proxy_inlets + t_atom* atoms; // pointer to array of atoms + unsigned int placeholder_count;// number of items in above arrays - t_outlet* x_data_outlet; // for list of data to plug into query - t_outlet* x_query_outlet; // for SQL query + t_outlet* x_data_outlet; // for list of data to plug into query + t_outlet* x_query_outlet; // for SQL query } t_sql_query; @@ -133,16 +133,13 @@ static void sql_query_anything(t_sql_query *x, t_symbol *s, int argc, t_atom *ar sql_query_set_atom(x, 0, s, argv); } -static void sql_query_bang(t_sql_query *x) +static void sql_query_output(t_sql_query *x) { - DEBUG(post("sql_query_bang");); - unsigned int i; - char buf[MAXPDSTRING]; - for(i=0; i < x->placeholder_count; ++i) - { - atom_string(&x->atoms[i], &buf, MAXPDSTRING); - post("output atom %d: %s", i, buf); - } + DEBUG(post("sql_query_output");); + int natom = binbuf_getnatom(x->x_query_binbuf); + t_atom *vec = binbuf_getvec(x->x_query_binbuf); + outlet_anything(x->x_query_outlet, vec[0].a_w.w_symbol, natom - 1, vec + 1); + outlet_list(x->x_data_outlet, &s_list, x->placeholder_count, x->atoms); } static void sql_query_free(t_sql_query *x) @@ -204,7 +201,7 @@ void sql_query_setup(void) 0); /* add inlet datatype methods */ - class_addbang(sql_query_class, (t_method) sql_query_bang); + class_addbang(sql_query_class, (t_method) sql_query_output); class_addanything(sql_query_class, (t_method) sql_query_anything); } -- cgit v1.2.1