ermetadb.h

Go to the documentation of this file.
00001 #ifndef __ERMETADB_H__
00002 #define __ERMETADB_H__
00003 
00004 /**
00005  * File Name  : ermetadb.h
00006  *
00007  * Description: eReader metadata database object
00008  */
00009 
00010 /*
00011  * This file is part of libermetadb.
00012  *
00013  * libermetadb is free software: you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation, either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * libermetadb is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00025  */
00026 
00027 /**
00028  * Copyright (C) 2008 iRex Technologies B.V.
00029  * All rights reserved.
00030  */
00031 
00032 
00033 //----------------------------------------------------------------------------
00034 // Include Files
00035 //----------------------------------------------------------------------------
00036 
00037 #include <glib.h>
00038 #include <glib-object.h>
00039 
00040 #include "ermetadb_error.h"
00041 #include "metadata_table.h"
00042 
00043 G_BEGIN_DECLS
00044 
00045 //----------------------------------------------------------------------------
00046 // Type Declarations
00047 //----------------------------------------------------------------------------
00048 
00049 typedef struct erMetadb_t *erMetadb;
00050 
00051 //----------------------------------------------------------------------------
00052 // Global Constants
00053 //----------------------------------------------------------------------------
00054 
00055 #define ERMETADB_GLOBAL_DATABASE_FILE    "global.db"
00056 #define ERMETADB_LOCAL_DATABASE_FILE     "metadata.db"
00057 
00058 //============================================================================
00059 // Public Functions
00060 //============================================================================
00061 
00062 /**---------------------------------------------------------------------------
00063  *
00064  * Name :  ermetadb_global_open
00065  *
00066  * @brief  opens a global metadata database
00067  *
00068  * @param  [in]  folder, path of .db file
00069  *         [in]  readonly, to open db readonly or not
00070  *               if NOT readonly and db is corrupt/non-existent, a new db will be created
00071  *
00072  * @return Pointer to the newly created object, or NULL
00073  *
00074  *--------------------------------------------------------------------------*/
00075 erMetadb ermetadb_global_open (const gchar *folder, gboolean readonly);
00076 
00077 
00078 /**---------------------------------------------------------------------------
00079  *
00080  * Name :  ermetadb_local_open
00081  *
00082  * @brief  opens a local metadata database
00083  *
00084  * @param  [in]  folder, path of .db file
00085  * @param  [in]  create, whether to create one if it doesn't exist or is corrupt
00086  *
00087  * @return Pointer to the newly created object, or NULL
00088  *
00089  *--------------------------------------------------------------------------*/
00090 erMetadb ermetadb_local_open (const gchar *folder, gboolean create);
00091 
00092 
00093 /**---------------------------------------------------------------------------
00094  *
00095  * Name :  ermetadb_local_open_custom
00096  *
00097  * @brief  opens a local metadata database with specified name
00098  *
00099  * @param  [in]  folder, path of .db file
00100  * @param  [in]  filename, name of .db file
00101  *
00102  * @return Pointer to the newly created object, or NULL
00103  *
00104  *--------------------------------------------------------------------------*/
00105 erMetadb ermetadb_local_open_custom (const gchar *folder, const gchar *filename);
00106 
00107 
00108 /**---------------------------------------------------------------------------
00109  *
00110  * Name :  ermetadb_get_dir
00111  *
00112  * @brief  returns path where database was openened
00113  *
00114  * @param  [in]  thiz - erMetadb object
00115  *
00116  * @return path. Does not have to be freed
00117  *
00118  *--------------------------------------------------------------------------*/
00119 const gchar* ermetadb_get_dir(erMetadb thiz);
00120 
00121 
00122 /**---------------------------------------------------------------------------
00123  *
00124  * Name :  ermetadb_close
00125  *
00126  * @brief  Close and free a metadata database
00127  *
00128  * @param  [in]  thiz - erMetadb object or NULL
00129  *
00130  * @return ER_OK or error code
00131  *
00132  *--------------------------------------------------------------------------*/
00133 void ermetadb_close (erMetadb thiz);
00134 
00135 
00136 /**---------------------------------------------------------------------------
00137  *
00138  * Name :  ermetadb_global_create_database
00139  *
00140  * @brief  Create a new global metadata database,
00141  *         overwriting the existing database if present
00142  *
00143  * @param  [in]  folder - directory in which the database file must be located
00144  *
00145  * @return ER_OK or error code
00146  *
00147  *--------------------------------------------------------------------------*/
00148 int ermetadb_global_create_database (const gchar *folder);
00149 
00150 int ermetadb_local_create_database (const gchar *folder, const gchar *filename);
00151 
00152 
00153 /**---------------------------------------------------------------------------
00154  *
00155  * Name :  ermetadb_begin_transaction
00156  *
00157  * @brief  Start a database transaction
00158  *         Only a single transaction is allowed, as seen from the application.
00159  *
00160  * @param  [in]  thiz - erMetadb object on which to start a transaction
00161  *
00162  * @return ER_OK or error
00163  *
00164  *--------------------------------------------------------------------------*/
00165 int ermetadb_begin_transaction (erMetadb thiz);
00166 
00167 
00168 /**---------------------------------------------------------------------------
00169  *
00170  * Name :  ermetadb_begin_transaction_readonly
00171  *
00172  * @brief  Start a read-only database transaction
00173  *         Only a single transaction is allowed, as seen from the application.
00174  *
00175  * @param  [in]  thiz - erMetadb object on which to start a transaction
00176  *
00177  * @return ER_OK or error
00178  *
00179  *--------------------------------------------------------------------------*/
00180 int ermetadb_begin_transaction_readonly (erMetadb thiz);
00181 
00182 
00183 /**---------------------------------------------------------------------------
00184  *
00185  * Name :  ermetadb_end_transaction
00186  *
00187  * @brief  Commit or rollback a database transaction
00188  *         Only a single transaction is allowed, as seen from the application.
00189  *         Library decides whether to commit or to rollback the changes.
00190  *         Basically when any query during this transaction has failed, the entire
00191  *         transaction is rolled back, otherwise the transaction is committed.
00192  *         Superfluous calls to ermetadb_end_transaction are ignored.
00193  *
00194  * @param  [in]  thiz - erMetadb object on which to end a transaction
00195  *
00196  * @return ER_OK or error
00197  *         or 'err' value when this is not ER_OK
00198  *
00199  *--------------------------------------------------------------------------*/
00200 int ermetadb_end_transaction (erMetadb thiz);
00201 
00202 
00203 /**---------------------------------------------------------------------------
00204  *
00205  * Name :  ermetadb_global_add_folder
00206  *
00207  * @brief  Add a folder to the metadata database
00208  *
00209  * @param  [in]  thiz - erMetadb object
00210  * @param  [in]  filepath - directory_path of the document
00211  * @param  [in]  foldername - filename of the folder
00212  * @param  [in]  time_modified - folder modification date/time as seconds since epoch
00213  *
00214  * @return ER_OK or error code
00215  *
00216  *--------------------------------------------------------------------------*/
00217 int ermetadb_global_add_folder (erMetadb     thiz,
00218                                 const gchar  *filepath,
00219                                 const gchar  *foldername,
00220                                 const gint64 time_modified );
00221 
00222 
00223 /**---------------------------------------------------------------------------
00224  *
00225  * Name :  ermetadb_global_remove_folder
00226  *
00227  * @brief  Remove a folder from the metadata database
00228  *
00229  * NOTE: does NOT remove local metadata. Not a problem, since
00230  *       complete directory is deleted anyway.
00231  *
00232  * @param  [in]  thiz - erMetadb object
00233  * @param  [in]  filepath - path of the folder
00234  * @param  [in]  filename - filename of the folder
00235  *
00236  * @return ER_OK or error code
00237  *         ER_OK when foldername not present in database
00238  *
00239  *--------------------------------------------------------------------------*/
00240 int ermetadb_global_remove_folder (erMetadb thiz,
00241                                    const gchar *filepath,
00242                                    const gchar *filename);
00243 
00244 
00245 /**---------------------------------------------------------------------------
00246  *
00247  * Name :  ermetadb_global_add_file
00248  *
00249  * @brief  Add a file to the metadata database
00250  *
00251  * @param  [in]  thiz - erMetadb object
00252  * @param  [in]  filepath - directory_path of the file
00253  * @param  [in]  filename - filename of the file
00254  * @param  [in]  size - size of file
00255  * @param  [in]  time_modified - folder modification date/time as seconds since epoch
00256  * @param  [in]  title - title  of file or NULL
00257  * @param  [in]  author - author of file or NULL
00258  * @param  [in]  tag - tag of file or NULL
00259  *
00260  * @return ER_OK or error code
00261  *
00262  *--------------------------------------------------------------------------*/
00263 int ermetadb_global_add_file (erMetadb     thiz,
00264                               const gchar  *filepath,
00265                               const gchar  *filename,
00266                               const gint64  size,
00267                               const gint64  time_modified,
00268                               const gchar  *title,
00269                               const gchar  *author,
00270                               const gchar  *tag);
00271 
00272 
00273 /**---------------------------------------------------------------------------
00274  *
00275  * Name :  ermetadb_global_rename_file
00276  *
00277  * @brief  Renames a file to another name.
00278  *
00279  * @param  [in]  thiz - erMetadb object
00280  * @param  [in]  filepath - directory_path for the document
00281  * @param  [in]  filename - old filename of the document
00282  * @param  [in]  new_filename - new filename of the document
00283  * @param  [in]  new_title- new title of the document
00284  *
00285  * @return ER_OK or error code
00286  *         ER_OK when filename with filepath not present in database
00287  *
00288  *--------------------------------------------------------------------------*/
00289 int ermetadb_global_rename_file (erMetadb    thiz,
00290                                  const gchar *filepath,
00291                                  const gchar *filename,
00292                                  const gchar *new_filename,
00293                                  const gchar *new_title);
00294 
00295 
00296 /**---------------------------------------------------------------------------
00297  *
00298  * Name :  ermetadb_global_remove_file
00299  *
00300  * @brief  Remove a document from the global AND local database
00301  *
00302  * @param  [in]  thiz - erMetadb object
00303  * @param  [in]  filepath - directory_path for the document
00304  * @param  [in]  filename - filename of the document
00305  *
00306  * @return ER_OK or error code
00307  *         ER_OK when filename with filepath not present in database
00308  *
00309  *--------------------------------------------------------------------------*/
00310 int ermetadb_global_remove_file (erMetadb    thiz,
00311                                  const gchar *filepath,
00312                                  const gchar *filename);
00313 
00314 
00315 /**---------------------------------------------------------------------------
00316  *
00317  * Name :  ermetadb_global_get_file
00318  *
00319  * @brief  Get selected file_metadata fields for a file or folder
00320  *
00321  * @param  [in]  thiz - erMetadb object
00322  * @param  [in]  filepath - directory_path for the document or folder
00323  * @param  [in]  filename - filename of the document or folder
00324  * @param  [in]  names_tbl - metadata_table holding metadata names
00325  *                           or NULL to get all metadata columns
00326  * @param  [out] values_tbl - metadata_table holding metadata names and values
00327  *                            a single row only, because data is for one file or folder
00328  *                            or NULL on error
00329  *                            Caller must use metadata_table_free() to release this table.
00330  *
00331  * @return ER_OK or error code
00332  *
00333  *--------------------------------------------------------------------------*/
00334 int ermetadb_global_get_file (erMetadb              thiz,
00335                               const gchar           *filepath,
00336                               const gchar           *filename,
00337                               const metadata_table  *names_tbl,
00338                               metadata_table        **values_tbl);
00339 
00340 
00341 /**---------------------------------------------------------------------------
00342  *
00343  * Name :  ermetadb_global_change_file
00344  *
00345  * @brief  Set selected file_metadata fields for a file or folder
00346  *
00347  * @param  [in]  thiz - erMetadb object
00348  * @param  [in]  filepath - directory_path for the document or folder
00349  * @param  [in]  filename - filename of the document or folder
00350  * @param  [in]  values_tbl - metadata_table holding metadata names and values
00351  *                            a single row only, because data is for one file or folder
00352  *
00353  * @return ER_OK or error code
00354  *
00355  *--------------------------------------------------------------------------*/
00356 int ermetadb_global_change_file (erMetadb              thiz,
00357                                  const gchar           *filepath,
00358                                  const gchar           *filename,
00359                                  const metadata_table  *values_tbl);
00360 
00361 
00362 /**---------------------------------------------------------------------------
00363  *
00364  * Name :  ermetadb_global_remove_entry
00365  *
00366  * @brief  Remove a file/folder from the global AND local database
00367  *
00368  * @param  [in]  thiz - erMetadb object
00369  * @param  [in]  file_id  - db id of entry
00370  * @param  [in]  filepath - directory_path for the document
00371  * @param  [in]  filename - filename of the document
00372  * @param  [in]  is_dir - whether entry is a dir
00373  *
00374  * @return ER_OK or error code
00375  *         ER_OK when filename with filepath not present in database
00376  *
00377  *--------------------------------------------------------------------------*/
00378 int ermetadb_global_remove_entry (erMetadb    thiz,
00379                                   gint64      file_id,
00380                                   const gchar *filepath,
00381                                   const gchar *filename,
00382                                   gboolean    is_dir);
00383 
00384 
00385 /**---------------------------------------------------------------------------
00386  *
00387  * Name :  ermetadb_global_update_size
00388  *
00389  * @brief  Updates size and last modified fields of entry
00390  *
00391  * @param  [in]  thiz - erMetadb object
00392  * @param  [in]  file_id  - db id of entry
00393  * @param  [in]  last_modified - when file was last modified
00394  * @param  [in]  filesize - size of file
00395  *
00396  * @return ER_OK or error code
00397  *
00398  *--------------------------------------------------------------------------*/
00399 int ermetadb_global_update_size (erMetadb thiz,
00400                                  gint64   file_id,
00401                                  gint64   last_modified,
00402                                  gint64   filesize);
00403 
00404 
00405 /**---------------------------------------------------------------------------
00406  *
00407  * Name :  ermetadb_global_update_title
00408  *
00409  * @brief  Updates title and author fields of entry
00410  *
00411  * @param  [in]  thiz - erMetadb object
00412  * @param  [in]  file_id  - db id of entry
00413  * @param  [in]  title - title field. cannot be NULL
00414  * @param  [in]  author - author field. cannot be NULL
00415  *
00416  * @return ER_OK or error code
00417  *
00418  *--------------------------------------------------------------------------*/
00419 int ermetadb_global_update_title (erMetadb    thiz,
00420                                   gint64      file_id,
00421                                   const gchar *title,
00422                                   const gchar *author);
00423 
00424 
00425 /**---------------------------------------------------------------------------
00426  *
00427  * Name :  ermetadb_global_select_all
00428  *
00429  * @brief  Returns the contents of the file_metadata table
00430  *
00431  * @param  [in]  thiz - erMetadb object
00432  * @param [out]  values_tbl - tables with all the results
00433  *
00434  * @return ER_OK or error code
00435  *
00436  *--------------------------------------------------------------------------*/
00437 int ermetadb_global_select_all (erMetadb thiz, metadata_table **values_tbl);
00438 
00439 
00440 /**---------------------------------------------------------------------------
00441  *
00442  * Name :  ermetadb_global_select_files
00443  *
00444  * @brief  Get selected file_metadata fields for a group of files/folders
00445  *         sorted on (1) specified metadata field and (2) filename ascending
00446  *         This function mainly exists for content browser assistance.
00447  *
00448  * @param  [in]  thiz - erMetadb object
00449  * @param  [in]  sort_key - metadata field to sort on
00450  *                          or NULL when no sort required (i.e. sort on filename only)
00451  * @param  [in]  sort_is_ascending - sorting order
00452  * @param  [in]  start_item - index (0 ..) of the first item from the selection to be returned
00453  * @param  [in]  num_items - maximum number of items to be returned
00454  *                           or -1 for unlimited number of items
00455  * @param  [in]  names_tbl - metadata_table holding metadata names
00456  * @param  [out] values_tbl - metadata_table holding metadata names and values
00457  *                            one row per file or folder
00458  *                            or NULL on error
00459  *                            Caller must use metadata_table_free() to release this table.
00460  * @param  [in]  tag_filter - tag filter to be used or NULL
00461  *
00462  * @return ER_OK or error code
00463  *
00464  *--------------------------------------------------------------------------*/
00465 int ermetadb_global_select_files (erMetadb              thiz,
00466                                   const gchar           *sort_key,
00467                                   gboolean              sort_is_ascending,
00468                                   const metadata_table  *names_tbl,
00469                                   metadata_table        **values_tbl,
00470                                   const gchar           *tag_filter);
00471 
00472 int ermetadb_global_select_recent (erMetadb              thiz,
00473                                    const gchar           *sort_key,
00474                                    int                   num_items,
00475                                    const metadata_table  *names_tbl,
00476                                    metadata_table        **values_tbl);
00477 
00478 int ermetadb_global_select_subdir (erMetadb              thiz,
00479                                    const gchar           *sort_key,
00480                                    gboolean              sort_is_ascending,
00481                                    const metadata_table  *names_tbl,
00482                                    metadata_table        **values_tbl,
00483                                    const gchar           *path_filter);
00484 
00485 int ermetadb_global_select_search (erMetadb              thiz,
00486                                    const gchar           *sort_key,
00487                                    gboolean              sort_is_ascending,
00488                                    const metadata_table  *names_tbl,
00489                                    metadata_table        **values_tbl,
00490                                    const gchar           *search_filter);
00491 
00492 
00493 /**---------------------------------------------------------------------------
00494  *
00495  * Name :  ermetadb_local_remove_application_data
00496  *
00497  * @brief  Remove selected application_data fields for a file or folder
00498  *
00499  * @param  [in]  thiz - erMetadb object
00500  * @param  [in]  filename - filename of the document or folder
00501  * @param  [in]  names_tbl - metadata_table holding application keys
00502  *                           a single row only, because keys are for one file or folder
00503  *
00504  * @return ER_OK or error code
00505  *
00506  *--------------------------------------------------------------------------*/
00507 int ermetadb_local_remove_application_data (erMetadb             thiz,
00508                                             const gchar          *filename,
00509                                             const metadata_table *names_tbl);
00510 
00511 
00512 /**---------------------------------------------------------------------------
00513  *
00514  * Name :  ermetadb_local_set_application_data
00515  *
00516  * @brief  Set selected application_data fields for a file or folder
00517  *
00518  * @param  [in]  thiz - erMetadb object
00519  * @param  [in]  filename - filename of the document or folder
00520  * @param  [in]  values_tbl - metadata_table holding application keys (column name) and values
00521  *                            a single row only, because keys/values are for one file or folder
00522  *                            keys with value type METADATA_NULL will be removed from the database
00523  *
00524  * @return ER_OK or error code
00525  *
00526  *--------------------------------------------------------------------------*/
00527 int ermetadb_local_set_application_data (erMetadb             thiz,
00528                                          const gchar          *filename,
00529                                          const metadata_table *values_tbl);
00530 
00531 
00532 /**---------------------------------------------------------------------------
00533  *
00534  * Name :  ermetadb_local_get_application_data
00535  *
00536  * @brief  Get selected application_data fields for a file or folder
00537  *
00538  * @param  [in]  thiz - erMetadb object
00539  * @param  [in]  filename - filename of the document or folder
00540  * @param  [in]  names_tbl - metadata_table holding application keys
00541  *                           a single row only, because keys are for one file or folder
00542  * @param  [out] values_tbl - metadata_table holding application keys and values
00543  *                            a single row only, because keys/values are for one file or folder
00544  *                            or NULL on error
00545  *                            Caller must use metadata_table_free() to release this table.
00546  *
00547  * @return ER_OK or error code
00548  *
00549  *--------------------------------------------------------------------------*/
00550 int ermetadb_local_get_application_data (erMetadb             thiz,
00551                                          const gchar          *filename,
00552                                          const metadata_table *names_tbl,
00553                                          metadata_table       **values_tbl);
00554 
00555 
00556 /**---------------------------------------------------------------------------
00557  *
00558  * Name :  ermetadb_local_remove_annotation
00559  *
00560  * @brief  Remove selected annotation
00561  *
00562  * @param  [in]  thiz - erMetadb object
00563  * @param  [in]  annotation_id - unique id of this annotation
00564  *
00565  * @return ER_OK or error code
00566  *
00567  *--------------------------------------------------------------------------*/
00568 int ermetadb_local_remove_annotation (erMetadb thiz, const gint64 annotation_id);
00569 
00570 
00571 /**---------------------------------------------------------------------------
00572  *
00573  * Name :  ermetadb_local_create_annotation
00574  *
00575  * @brief  Set selected annotation fields for a file or folder
00576  *
00577  * @param  [in]  thiz - erMetadb object
00578  * @param  [in]  filename - file or folder to which this annotation belongs
00579  * @param  [out] annotation_id - unique id of this annotation
00580  * @param  [in]  annotation_type - specifies what type of annotation this is
00581  * @param  [in]  layer - specifies what layer this annotation belongs to
00582  *                       or empty string when no layer is applicable
00583  * @param  [in]  file_position - page number (1, 2, ..) for page-oriented docs like pdf,
00584  *                               relative position (0 .. 100,000 for 0 .. 100%) for reflowable content
00585  * @param  [in]  title - specifies a title for this annotation
00586  *                       or NULL when no title is applicable
00587  * @param  [in]  start_anchor - exact begin position of this annotation in the document
00588  *                              or NULL when not relevant
00589  * @param  [in]  end_anchor - exact end position of this annotation in the document
00590  *                            or NULL when not relevant
00591  * @param  [in]  data_blob - data belonging to this annotation as a blob
00592  *                           or NULL when no data
00593  *                           Note: caller must release this data after the function returns.
00594  * @param  [in]  data_len - number of bytes in data_blob
00595  *                          or zero when no data
00596  *
00597  * @return ER_OK or error code
00598  *
00599  *--------------------------------------------------------------------------*/
00600 int ermetadb_local_create_annotation (erMetadb     thiz,
00601                                       const gchar  *filename,
00602                                       gint64       *annotation_id,
00603                                       const gchar  *annotation_type,
00604                                       const gchar  *layer,
00605                                       const gint64 file_position,
00606                                       const gchar  *title,
00607                                       const gchar  *start_anchor,
00608                                       const gchar  *end_anchor,
00609                                       const gchar  *data_blob,
00610                                       const guint  data_len);
00611 
00612 
00613 /**---------------------------------------------------------------------------
00614  *
00615  * Name :  ermetadb_local_set_annotation
00616  *
00617  * @brief  Set selected annotation fields for a file or folder
00618  *
00619  * @param  [in]  thiz - erMetadb object
00620  * @param  [in]  annotation_id - unique id of this annotation
00621  * @param  [in]  annotation_type - specifies what type of annotation this is
00622  * @param  [in]  layer - specifies what layer this annotation belongs to
00623  *                       or empty string when no layer is applicable
00624  * @param  [in]  file_position - page number (1, 2, ..) for page-oriented docs like pdf,
00625  *                               relative position (0 .. 100,000 for 0 .. 100%) for reflowable content
00626  * @param  [in]  title - specifies a title for this annotation
00627  *                       or NULL when no title is applicable
00628  * @param  [in]  start_anchor - exact begin position of this annotation in the document
00629  *                              or NULL when not relevant
00630  * @param  [in]  end_anchor - exact end position of this annotation in the document
00631  *                            or NULL when not relevant
00632  * @param  [in]  data_blob - data belonging to this annotation as a blob
00633  *                           or NULL when no data
00634  *                           Note: caller must release this data after the function returns.
00635  * @param  [in]  data_len - number of bytes in data_blob
00636  *                          or zero when no data
00637  *
00638  * @return ER_OK or error code
00639  *
00640  *--------------------------------------------------------------------------*/
00641 int ermetadb_local_set_annotation (erMetadb      thiz,
00642                                    const gint64  annotation_id,
00643                                    const gchar   *annotation_type,
00644                                    const gchar   *layer,
00645                                    const gint64  file_position,
00646                                    const gchar   *title,
00647                                    const gchar   *start_anchor,
00648                                    const gchar   *end_anchor,
00649                                    const gchar   *data_blob,
00650                                    const guint   data_len         );
00651 
00652 
00653 /**---------------------------------------------------------------------------
00654  *
00655  * Name :  ermetadb_local_get_annotations
00656  *
00657  * @brief  Get details of the specified list of annotations
00658  *
00659  * @param  [in]  thiz - erMetadb object
00660  * @param  [in]  annotation_id_list - unique id's of these annotations
00661  * @param  [in]  annotation_id_num - number of unique id's in annotation_id_list
00662  * @param  [out] values_tbl - metadata_table holding annotation values
00663  *                            one row per annotation_id
00664  *                            or NULL on error
00665  *                            Caller must use metadata_table_free() to release this table.
00666  *
00667  * @return ER_OK or error code
00668  *
00669  *--------------------------------------------------------------------------*/
00670 int ermetadb_local_get_annotations (erMetadb        thiz,
00671                                     const gint64    *annotation_id_list,
00672                                     long            annotation_id_num,
00673                                     metadata_table  **values_tbl);
00674 
00675 
00676 /**---------------------------------------------------------------------------
00677  *
00678  * Name :  ermetadb_local_select_annotations
00679  *
00680  * @brief  Get basic annotation fields within the specified range for a file or folder
00681  *         Basic annotation fields are the following columns from table annotations:
00682  *             annotation_id, annotation_type, layer, file_position, start_anchor, end_anchor
00683  *         Results are sorted on (1) file_position and (2) annotation_type and (3) layer
00684  *         Application must select from result the annotations it is really interested in,
00685  *         then call ermetadb_local_get_annotations() for the details of these. This avoids 
00686  *         retrieving blob data for annotations that are not used by the application.
00687  *         Note that the library can select on file_position only, which is a pretty course selection,
00688  *         while the application can select on start_anchor and end_anchor, which is much more accurate.
00689  *
00690  * @param  [in]  thiz - erMetadb object
00691  * @param  [in]  filename - filename of the document or folder
00692  * @param  [in]  annotation_type - specifies what type of annotation is requested
00693  *                                 or NULL to select all annotation types
00694  * @param  [in]  layer - specifies what layer these annotations belong to
00695  *                       or empty string to select annotation to which no layer is applicable
00696  *                       or NULL to select all layers
00697  * @param  [in]  file_position_min - minimum value for file_position of selected annotations
00698  *                                   or -1 when no minimum selection on file_position
00699  * @param  [in]  file_position_max - maximum value for file_position of selected annotations
00700  *                                   or -1 when no maximum selection on file_position
00701  * @param  [out] values_tbl - metadata_table holding annotation values
00702  *                            one row per annotation
00703  *                            or NULL on error
00704  *                            Caller must use metadata_table_free() to release this table.
00705  *
00706  * @return ER_OK or error code
00707  *
00708  *--------------------------------------------------------------------------*/
00709 int ermetadb_local_select_annotations (erMetadb       thiz,
00710                                        const gchar    *filename,
00711                                        const gchar    *annotation_type,
00712                                        const gchar    *layer,
00713                                        const gint64   file_position_min,
00714                                        const gint64   file_position_max,
00715                                        metadata_table **values_tbl);
00716 
00717 G_END_DECLS
00718 
00719 #endif // __ERMETADB_H__
00720 
Generated by  doxygen 1.6.2-20100208