# Migration from 5.x versions to 6.x versions

## Overview

Version 6.0 of &LIBGDA; has been driven by the desire to have a more robust and well designed core library, with many small corrections accumulated over the years, and also to have a library which is truely easy to use in a multi threaded environment.

As such there are a few API adaptations, a few renamings and quite a big part about multi threading transparency.

## GdaConnection changes

This sections lists all the modifications which need to be done regarding the GdaConnection object.

### Status signals

A set of status and their possible transitions has been defined for the GdaConnection, see the GdaConnectionStatus documentation.

- A new "status-changed" has been introduced to signal any change in a connection's status. This signal is of course emitted withing the context of the thread which provokes the status change

- The "conn-opened" signal has been renamed to "opened"

- The "conn-closed" signal has been renamed to "closed"

- The "conn-to-close" signal has been removed because &LIBGDA; could not guarantee that it would be emitted everytime (a connection can be closed without the programmer requesting it and no notification can be done beforehand)

### Changed properties

Some properties related to multi threading and which were difficult to understand have been removed:

- The "thread-owner" property

- The "is-wrapper" property

- The "monitor-wrapped-in-mainloop" property

### Connection opening options

Similarly to properties, the following options specified upon connection opening have been removed because they have become useless as all connections are completely thread safe:

- The GDA_CONNECTION_OPTIONS_THREAD_SAFE option

- The GDA_CONNECTION_OPTIONS_THREAD_ISOLATED option

### Features to query

Similarly to properties, the following features which can be queried using gda_connection_supports_feature() have been removed because they have become useless as all connections support these features:

- The GDA_CONNECTION_FEATURE_MULTI_THREADING feature

- The GDA_CONNECTION_FEATURE_ASYNC_EXEC feature

### API changes

This section documents most of the API changes for the GdaConnection object.

- The gda_connection_close() signature has changed

- The gda_connection_close_no_warning() function has been removed, it is now redundant with gda_connection_close()

- The gda_connection_async_cancel() function has been removed

- The gda_connection_async_fetch_result() function has been removed

- The gda_connection_async_statement_execute() function has been removed

- The gda_connection_internal_get_provider_data() has been replaced by gda_connection_internal_get_provider_data_error()

- The gda_server_operation_get_sql_identifier_at() and gda_server_operation_get_sql_identifier_at_path() now have an extra argument for errors

## API changes

Version 6.0 introduced some API changes which are listed below and in the section about GdaConnection's API changes.

- GdaMutex has been removed, being redundant with GRecMutex

- gdaui_data_proxy_column_show_actions() has been removed, as it is no longer necessary.

## Multi threading and asynchronicity

In versions 5.x and before, multi threading handling, along with the way asynchronous operations were carried was a complicated piece of engineering and had a lot of caveats. Form version 6.x on, each connection (or, if not supported by the database's C API, then each provider) is internally used from a specific thread, always different than from the "user" threads (the threads the user of &LIBGDA; creates). The consequence is that any connection can now be used by any thread the user creates.

Regarding asynchronicity, versions 5.x and earlier had specific APIs to cope with non locking calls. The resulting code was very difficult to manage as operations were splitted into several different functions called in the correct order. Starting with version 6.x, the user can pass a GMainContext to the GdaConnection object which is used to process pending events, and making the calls non blocking. Refer to the gda_connection_set_main_context() function for more information.

Finally the GdaThreadWrapper and the artificial GdaThreadProvider (used internally) have been removed, and replaced by the GdaWorker object.