## GdaDbView GdaDbView — Object to represent view database object |

## Stability Level

Stable, unless otherwise indicated

## Functions

GdaDbView * | gda_db_view_new ()
const gchar * | gda_db_view_get_defstring ()
void | gda_db_view_set_defstring ()
gboolean | gda_db_view_get_ifnoexist ()
void | gda_db_view_set_ifnoexist ()
gboolean | gda_db_view_get_istemp ()
void | gda_db_view_set_istemp ()
gboolean | gda_db_view_get_replace ()
void | gda_db_view_set_replace ()
gboolean | gda_db_view_prepare_create ()

## Properties

char * | defstring | Read / Write
gboolean | ifnoexist | Read / Write
gboolean | istemp | Read / Write
gboolean | replace | Read / Write

## Types and Values

| GdaDbView
enum | GdaDbViewRefAction
#define | GDA_TYPE_DB_VIEW

## Object Hierarchy

        GObject
        ╰── GdaDbBase
            ╰── GdaDbView

## Implemented Interfaces

GdaDbView implements GdaDbBuildable and GdaDdlModifiable.

## Includes

    #include <libgda/libgda.h>

## Description

This object represents a view of a database. The view can be constracted manually using API or generated from xml file together with other databse objects. See GdaDbCatalog. GdaDbView implements GdaDbBuildable interface for parsing xml file. This is typical example how GdaDbView can be used

    1
    2
    3
    4
    5
    6
    7
    8
    9
    GdaDbView *myview = gda_db_view_new ();
    gda_db_base_set_name (GDA_DB_BASE (myview), "MyView");
    gda_db_view_set_istemp (myview, FALSE);
    gda_db_view_set_defstring (myview, "SELECT name, project_id FROM NewEmployee");

    res = gda_db_view_create (myview, fixture->cnc, TRUE, &error);

    if (!res)
      GDA_PGSQL_ERROR_HANDLE (error);

## Functions

### gda_db_view_new ()

    GdaDbView *
    gda_db_view_new (void);

#### Returns

A new instance of GdaDbView.

[transfer full]

Since: 6.0

Stability Level: Stable

### gda_db_view_get_defstring ()

    const gchar *
    gda_db_view_get_defstring (GdaDbView *self);

#### Parameters

self | a GdaDbView object |

#### Returns

view definition string

Since: 6.0

Stability Level: Stable

### gda_db_view_set_defstring ()

    void
    gda_db_view_set_defstring (GdaDbView *self,
                               const gchar *str);

#### Parameters

self | a GdaDbView object |
str | view definition string to set. Should be valid SQL string |

Since: 6.0

Stability Level: Stable

### gda_db_view_get_ifnoexist ()

    gboolean
    gda_db_view_get_ifnoexist (GdaDbView *self);

#### Parameters

self | a GdaDbView object |

#### Returns

`TRUE` if th view should be created with "IF NOT EXISTS" key, `FALSE` otherwise

Since: 6.0

Stability Level: Stable

### gda_db_view_set_ifnoexist ()

    void
    gda_db_view_set_ifnoexist (GdaDbView *self,
                               gboolean noexist);

#### Parameters

self | a GdaDbView object |
noexist | a value to set |

Since: 6.0

Stability Level: Stable

### gda_db_view_get_istemp ()

    gboolean
    gda_db_view_get_istemp (GdaDbView *self);

#### Parameters

self | a GdaDbView object |

#### Returns

`TRUE` if the view is temporary, `FALSE` otherwise

Since: 6.0

Stability Level: Stable

### gda_db_view_set_istemp ()

    void
    gda_db_view_set_istemp (GdaDbView *self,
                            gboolean temp);

#### Parameters

self | a GdaDbView object |
temp | value to set |

Since: 6.0

Stability Level: Stable

### gda_db_view_get_replace ()

    gboolean
    gda_db_view_get_replace (GdaDbView *self);

#### Parameters

self | a GdaDbView object |

#### Returns

`TRUE` if the current view should replace the existing one in the database, `FALSE` otherwise.

Since: 6.0

Stability Level: Stable

### gda_db_view_set_replace ()

    void
    gda_db_view_set_replace (GdaDbView *self,
                             gboolean replace);

#### Parameters

self | a GdaDbView object |
replace | a value to set |

Since: 6.0

Stability Level: Stable

### gda_db_view_prepare_create ()

    gboolean
    gda_db_view_prepare_create (GdaDbView *self,
                                GdaServerOperation *op,
                                GError **error);

Populate `op` with information needed to perform CREATE_VIEW operation. This method was desgned for internal use and will be obsolete in the future. Do not use it for the new code.

#### Parameters

self | a GdaDbView instance |
op | GdaServerOperation instance to populate |
error | error container |

#### Returns

`TRUE` if succeeded and `FALSE` otherwise.

Stability Level: Stable

## Types and Values

### GdaDbView

    typedef struct _GdaDbView GdaDbView;

### enum GdaDbViewRefAction

#### Members

GDA_DB_VIEW_RESTRICT |  |
GDA_DB_VIEW_CASCADE |  |

### GDA_TYPE_DB_VIEW

    #define GDA_TYPE_DB_VIEW (gda_db_view_get_type())

## Property Details

### The `“defstring”` property

      “defstring”                char *

Define view.

Owner: GdaDbView

Flags: Read / Write

Default value: NULL

### The `“ifnoexist”` property

      “ifnoexist”                gboolean

Create view if it doesn't exist.

Owner: GdaDbView

Flags: Read / Write

Default value: FALSE

### The `“istemp”` property

      “istemp”                   gboolean

Set if view is temp.

Owner: GdaDbView

Flags: Read / Write

Default value: FALSE

### The `“replace”` property

      “replace”                  gboolean

Set if view should be repalced.

Owner: GdaDbView

Flags: Read / Write

Default value: TRUE

## See Also

GdaDbTable, GdaDbCatalog