Typedefs | |
| typedef struct DuiTxnQuery_s | DuiTxnQuery |
Functions | |
| DuiTxnQuery * | dui_txnquery_new (void) |
| void | dui_txnquery_destroy (DuiTxnQuery *q) |
| void | dui_txnquery_set_table (DuiTxnQuery *qry, DuiField *tabfld, const char *sql_querytype) |
| void | dui_txnquery_set_tablename (DuiTxnQuery *qry, const char *tablename) |
| void | dui_txnquery_set_querytype (DuiTxnQuery *qry, const char *sql_querytype) |
| void | dui_txnquery_add_term (DuiTxnQuery *qry, DuiFieldMap *fm) |
| void | dui_txnquery_add_source_match_term (DuiTxnQuery *qry, DuiFieldMap *fm) |
| DuiFieldMap * | dui_txnquery_get_source_match_term (DuiTxnQuery *qry) |
| void | dui_txnquery_set_resolver (DuiTxnQuery *qry, DuiResolver *) |
| void | dui_txnquery_set_database (DuiTxnQuery *q, DuiDatabase *db) |
| void | dui_txnquery_do_realize (DuiTxnQuery *qry) |
| void | dui_txnquery_connect (DuiTxnQuery *qry) |
| DuiDBRecordSet * | dui_txnquery_run (DuiTxnQuery *qry) |
| DuiDBRecordSet * | dui_txnquery_rerun_last_query (DuiTxnQuery *qry) |
| void dui_txnquery_add_source_match_term | ( | DuiTxnQuery * | qry, | |
| DuiFieldMap * | fm | |||
| ) |
For when the value sources are coming from a table, this specifies the way in which the source table row is matched.
The memory management for the fieldmap passed in is taken over by this routine, and when the query is deleted, the fieldmap will be too.
Definition at line 285 of file duitxnquery.c.
00286 { 00287 if (!qry || !fm) return; 00288 00289 if (qry->source_match) 00290 { 00291 PERR ("Source Row Matcher already specified!\n"); 00292 } 00293 dui_resolver_add_field (qry->resolver, &fm->source); 00294 dui_resolver_add_field (qry->resolver, &fm->target); 00295 dui_field_map_resolve (fm); 00296 00297 qry->source_match = fm; 00298 }
| void dui_txnquery_add_term | ( | DuiTxnQuery * | qry, | |
| DuiFieldMap * | fm | |||
| ) |
Add a term to the SQL query. For SELECT field names, set the fieldmap target to DUI_FIELD_CONST. For UPDATE field & new value, set the fieldmap target to DUI_FIELD_SQL. For WHERE macthing terms, set the fieldmap target to DUI_FIELD_WHERE.
The memory management for the fieldmap passed in is taken over by this routine, and when the query is deleted, the fieldmap will be too.
< Field with const value
Definition at line 264 of file duitxnquery.c.
00265 { 00266 if (!qry || !fm) return; 00267 dui_resolver_add_field (qry->resolver, &fm->source); 00268 dui_resolver_add_field (qry->resolver, &fm->target); 00269 dui_field_map_resolve (fm); 00270 00271 /* If its a SELECT term then we can handle it statically. 00272 * The name of the SELECT field will be stored as a const target 00273 */ 00274 if (DUI_FIELD_IS_TYPE(&fm->target,DUI_FIELD_CONST)) 00275 { 00276 sql_builder_set_str (qry->sql_builder, fm->target.u.value, NULL); 00277 } 00278 else 00279 { 00280 qry->terms = g_list_append (qry->terms, fm); 00281 } 00282 }
| void dui_txnquery_connect | ( | DuiTxnQuery * | qry | ) |
Establish connection to the SQL db. XXX this should probably be done automatically, at query-run time. We don't/shouldn't need a separate step here, right?
Definition at line 347 of file duitxnquery.c.
00348 { 00349 if (!qry) return; 00350 qry->db_conn = dui_database_do_realize (qry->database); 00351 }
| void dui_txnquery_do_realize | ( | DuiTxnQuery * | qry | ) |
the txnquery_do_realize is currently a no-op. and should stay that way. XXX remove this routine ... right? ...
Definition at line 336 of file duitxnquery.c.
00337 { 00338 /* Everything was resolved at the time the terms were added. 00339 * And that's good, there's no benefit, just complications 00340 * and dependency-on-order-of-resolution problems with late resolution. 00341 */ 00342 }
| void dui_txnquery_set_querytype | ( | DuiTxnQuery * | qry, | |
| const char * | sql_querytype | |||
| ) |
Specify the sql query to be performed. sql_querytype must be one of "select", "update", "insert", "delete", "tables" or "fields". The first four correspiond to the standard SQL query types. The "fields" query type can be used to obtain the column names of a given table. Handy if you don't yet know the column names. The "tables" query type can be used to obtain a listing of all the table names in the database.
| void dui_txnquery_set_table | ( | DuiTxnQuery * | qry, | |
| DuiField * | tabfld, | |||
| const char * | sql_querytype | |||
| ) |
Specify the sql table that will be queried. sql_querytype must be one of "select", "update", "insert", "delete", "tables" or "fields". If the querytype is "tables", then the 'tabfld' may be NULL; in all other cases, the 'tabfld', when evaluated, must return the name of a valid SQL table.
| void dui_txnquery_set_tablename | ( | DuiTxnQuery * | qry, | |
| const char * | tablename | |||
| ) |
Specify the table name, or names, to be queried. If multiple table names are specified, they must be comma-separated (as they would normally be in an SQL statement).
1.5.5