libglom-1.32: Glom::SqlUtils Namespace Reference

libglom-1.32 1.31.6

- Main Page
- Namespaces
- Classes

- Namespace List
- Namespace Members

Typedefs | Functions
Glom::SqlUtils Namespace Reference

## Typedefs
typedef std::pair< std::shared_ptr< const LayoutItem_Field >, bool > | type_pair_sort_field
| field, ascending More...
typedef std::vector< type_pair_sort_field > | type_sort_clause
typedef std::vector< std::shared_ptr< const LayoutItem_Field > > | type_vecConstLayoutFields
typedef std::vector< std::shared_ptr< LayoutItem_Field > > | type_vecLayoutFields

## Functions
Gnome::Gda::SqlExpr | build_simple_where_expression (const Glib::ustring& table_name, const std::shared_ptr< const Field >& key_field, const Gnome::Gda::Value& key_value)
Gnome::Gda::SqlExpr | build_combined_where_expression (const Gnome::Gda::SqlExpr& a, const Gnome::Gda::SqlExpr& b, Gnome::Gda::SqlOperatorType op)
void | build_sql_select_add_fields_to_get (const Glib::RefPtr< Gnome::Gda::SqlBuilder >& builder, const Glib::ustring& table_name, const type_vecConstLayoutFields& fieldsToGet, const type_sort_clause& sort_clause, bool extra_join)
| Generate a SQL statement to SELECT field values, even if the fields are in related (or doubly related) records. More...
Glib::RefPtr< Gnome::Gda::SqlBuilder > | build_sql_select_with_where_clause (const Glib::ustring& table_name, const type_vecLayoutFields& fieldsToGet, const Gnome::Gda::SqlExpr& where_clause=Gnome::Gda::SqlExpr(), const std::shared_ptr< const Relationship >& extra_join=std::shared_ptr< const Relationship >(), const type_sort_clause& sort_clause=type_sort_clause(), guint limit=0)
| Generate a SQL statement to SELECT field values, even if the fields are in related (or doubly related) records, narrowing the records down with a WHERE clause. More...
Glib::RefPtr< Gnome::Gda::SqlBuilder > | build_sql_select_with_where_clause (const Glib::ustring& table_name, const type_vecConstLayoutFields& fieldsToGet, const Gnome::Gda::SqlExpr& where_clause=Gnome::Gda::SqlExpr(), const std::shared_ptr< const Relationship >& extra_join=std::shared_ptr< const Relationship >(), const type_sort_clause& sort_clause=type_sort_clause(), guint limit=0)
| Just a version of build_sql_select_with_where_clause() that takes a list of const fields. More...
Glib::RefPtr< Gnome::Gda::SqlBuilder > | build_sql_select_with_key (const Glib::ustring& table_name, const type_vecLayoutFields& fieldsToGet, const std::shared_ptr< const Field >& key_field, const Gnome::Gda::Value& key_value, const type_sort_clause& sort_clause=type_sort_clause(), guint limit=0)
Glib::RefPtr< Gnome::Gda::SqlBuilder > | build_sql_select_with_key (const Glib::ustring& table_name, const type_vecConstLayoutFields& fieldsToGet, const std::shared_ptr< const Field >& key_field, const Gnome::Gda::Value& key_value, const type_sort_clause& sort_clause=type_sort_clause(), guint limit=0)
| Just a version of build_sql_select_with_key() that takes a list of const fields. More...
Glib::RefPtr< Gnome::Gda::SqlBuilder > | build_sql_select_count_rows (const Glib::RefPtr< const Gnome::Gda::SqlBuilder >& sql_query)
| Build a SQL query to discover how many rows a SQL query would return if it was run. More...
Gnome::Gda::SqlExpr | get_find_where_clause_quick (const std::shared_ptr< const Document >& document, const Glib::ustring& table_name, const Gnome::Gda::Value& quick_search)
Glib::RefPtr< Gnome::Gda::SqlBuilder > | build_sql_update_with_where_clause (const Glib::ustring& table_name, const std::shared_ptr< const Field >& field, const Gnome::Gda::Value& value, const Gnome::Gda::SqlExpr& where_clause)
| Generate a SQL statement to UPDATE field values,. More...
std::string | sqlbuilder_get_full_query (const Glib::RefPtr< const Gnome::Gda::SqlBuilder >& builder)
| Get the full query string suitable for use with std::cout. More...

## Typedef Documentation

typedef std::pair< std::shared_ptr<const LayoutItem_Field>, bool> Glom::SqlUtils::type_pair_sort_field

field, ascending

typedef std::vector<type_pair_sort_field> Glom::SqlUtils::type_sort_clause

typedef std::vector< std::shared_ptr<const LayoutItem_Field> > Glom::SqlUtils::type_vecConstLayoutFields

typedef std::vector< std::shared_ptr<LayoutItem_Field> > Glom::SqlUtils::type_vecLayoutFields

## Function Documentation

Gnome::Gda::SqlExpr Glom::SqlUtils::build_combined_where_expression | ( | const Gnome::Gda::SqlExpr & | a,
|  | const Gnome::Gda::SqlExpr & | b,
|  | Gnome::Gda::SqlOperatorType | op
| ) |  |

Gnome::Gda::SqlExpr Glom::SqlUtils::build_simple_where_expression | ( | const Glib::ustring & | table_name,
|  | const std::shared_ptr< const Field >& | key_field,
|  | const Gnome::Gda::Value & | key_value
| ) |  |

void Glom::SqlUtils::build_sql_select_add_fields_to_get | ( | const Glib::RefPtr< Gnome::Gda::SqlBuilder > & | builder,
|  | const Glib::ustring & | table_name,
|  | const type_vecConstLayoutFields& | fieldsToGet,
|  | const type_sort_clause& | sort_clause,
|  | bool | extra_join
| ) |  |

Generate a SQL statement to SELECT field values, even if the fields are in related (or doubly related) records.

Glib::RefPtr<Gnome::Gda::SqlBuilder> Glom::SqlUtils::build_sql_select_count_rows | ( | const Glib::RefPtr< const Gnome::Gda::SqlBuilder > & | sql_query | ) |

Build a SQL query to discover how many rows a SQL query would return if it was run.

This uses a COUNT * on a the sql_query as a sub-statement. Be careful not to include ORDER BY clauses in the supplied SQL query, because that would make it unnecessarily slow.

Parameters

  sql_query | A SQL query.

Returns
  The number of rows.

Glib::RefPtr<Gnome::Gda::SqlBuilder> Glom::SqlUtils::build_sql_select_with_key | ( | const Glib::ustring & | table_name,
|  | const type_vecLayoutFields& | fieldsToGet,
|  | const std::shared_ptr< const Field >& | key_field,
|  | const Gnome::Gda::Value & | key_value,
|  | const type_sort_clause& | sort_clause = `type_sort_clause()`,
|  | guint | limit = `0`
| ) |  |

Parameters

  key_value | If this is empty then all records in the tables will be retrieved.

Glib::RefPtr<Gnome::Gda::SqlBuilder> Glom::SqlUtils::build_sql_select_with_key | ( | const Glib::ustring & | table_name,
|  | const type_vecConstLayoutFields& | fieldsToGet,
|  | const std::shared_ptr< const Field >& | key_field,
|  | const Gnome::Gda::Value & | key_value,
|  | const type_sort_clause& | sort_clause = `type_sort_clause()`,
|  | guint | limit = `0`
| ) |  |

Just a version of build_sql_select_with_key() that takes a list of const fields.

Glib::RefPtr<Gnome::Gda::SqlBuilder> Glom::SqlUtils::build_sql_select_with_where_clause | ( | const Glib::ustring & | table_name,
|  | const type_vecLayoutFields& | fieldsToGet,
|  | const Gnome::Gda::SqlExpr & | where_clause = `Gnome::Gda::SqlExpr()`,
|  | const std::shared_ptr< const Relationship >& | extra_join = `std::shared_ptr< const Relationship >()`,
|  | const type_sort_clause& | sort_clause = `type_sort_clause()`,
|  | guint | limit = `0`
| ) |  |

Generate a SQL statement to SELECT field values, even if the fields are in related (or doubly related) records, narrowing the records down with a WHERE clause.

Glib::RefPtr<Gnome::Gda::SqlBuilder> Glom::SqlUtils::build_sql_select_with_where_clause | ( | const Glib::ustring & | table_name,
|  | const type_vecConstLayoutFields& | fieldsToGet,
|  | const Gnome::Gda::SqlExpr & | where_clause = `Gnome::Gda::SqlExpr()`,
|  | const std::shared_ptr< const Relationship >& | extra_join = `std::shared_ptr< const Relationship >()`,
|  | const type_sort_clause& | sort_clause = `type_sort_clause()`,
|  | guint | limit = `0`
| ) |  |

Just a version of build_sql_select_with_where_clause() that takes a list of const fields.

Glib::RefPtr<Gnome::Gda::SqlBuilder> Glom::SqlUtils::build_sql_update_with_where_clause | ( | const Glib::ustring & | table_name,
|  | const std::shared_ptr< const Field >& | field,
|  | const Gnome::Gda::Value & | value,
|  | const Gnome::Gda::SqlExpr & | where_clause
| ) |  |

Generate a SQL statement to UPDATE field values,.

Gnome::Gda::SqlExpr Glom::SqlUtils::get_find_where_clause_quick | ( | const std::shared_ptr< const Document >& | document,
|  | const Glib::ustring & | table_name,
|  | const Gnome::Gda::Value & | quick_search
| ) |  |

std::string Glom::SqlUtils::sqlbuilder_get_full_query | ( | const Glib::RefPtr< const Gnome::Gda::SqlBuilder > & | builder | ) |

Get the full query string suitable for use with std::cout.