|
Thanks for your feedback. You can see the equivalent C code for any statement pretty easy. For example, if you go to "tutorials", then "tutorial-stock_app", and follow the tutorial instructions, you can always see the generated C code, which would be in: /var/lib/vv/bld/stockapp/__stock.o.c
(so here "stock" is the application name and there's "stock.v" file).For example, when you see this Vely statement in stock.v (which obviously obtains input parameters from either GET or POST request): input-param stock_name
this is line 9 in stock.v.All you need to do is look for: #line 9 "stock.v"
in the generated code (which is
/var/lib/vv/bld/stock/__stock.o.c), in this case it's: char *stock_name = vey_get_input_param (vey_get_config()->ctx.req, "stock_name")
So in this case, it's just one line of C code. In other cases, it may be many lines. For example, Vely statement which apparently runs the INSERT SQL query: run-query#add_data@db = "insert into stock (stock_name, stock_price) vaues ('%s', '%s') on duplicate key update stock_price='%s'" : stock_name, stock_price, stock_price
This is on line 12 in stock.v, and you can simply search for #line 12 "stock.v"
in /var/lib/vv/bld/stock/__stock.o.c file. In this case, the generated code looks like: VV_UNUSED (_column_count_add_data);
vely_get_config()->ctx.db->ind_current_db=0;
static void *_sql_prep_add_data_stock_v_649 = NULL;
_is_input_used_add_data[0]=1;
_is_input_used_add_data[1]=1;
_is_input_used_add_data[2]=1;
add_data = "insert into stock (stock_name, stock_price) values ('%s', '%s') on duplicate key update stock_price='%s'";
const char *fname_loc_add_data = "stock.v";
num lnum_add_data = 12;
vely_location (&fname_loc_add_data, &lnum_add_data, 1);
vely_make_SQL (&_sql_buf_add_data, 3, add_data , _is_input_used_add_data[0]==1 ? (stock_name) : NULL , _is_input_used_add_data[1]==1 ? (stock_price) : NULL , _is_input_used_add_data[2]==1 ? (stock_price) : NULL );
if (_qry_executed_add_data == 1) {vely_report_error("Query [add_data] has executed the second time; if you want to execute the same query twice in a row without a loop-query, use different queries with the same query text (or variable) if that is your intention, file [stock.v], line number [12] ");}
_qry_executed_add_data = 1;
vely_execute_SQL (_sql_buf_add_data, &_arow_add_data, (const char**)&_err_add_data, (const char**)&_errm_add_data, 0, 1, 0, &_sql_prep_add_data_stock_v_649, _sql_paramcount_add_data, _sql_params_add_data);
_nrow_add_data=0;
vely_db_free_result ();
vely_free (_sql_buf_add_data);
so about 16 ines of code.This way you can see what actual C code is generated for any Vely code. And you can also step through this code in gdb by using --c-lines option in vv. |
There is a lot going on in your big example, and I wouldn't want to have to download and run it first to get a rough mental model of what's happening.