grel.inc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {*
  2. * grel.inc
  3. *
  4. * depends on gtypes.inc
  5. *}
  6. type
  7. PGTuples = ^TGTuples;
  8. TGTuples = record
  9. len : guint;
  10. end;
  11. PGRelation = pointer;
  12. { GRelation
  13. Indexed Relations. Imagine a really simple table in a
  14. database. Relations are not ordered. This data type is meant for
  15. maintaining a N-way mapping.
  16. g_relation_new() creates a relation with FIELDS fields
  17. g_relation_destroy() frees all resources
  18. g_tuples_destroy() frees the result of g_relation_select()
  19. g_relation_index() indexes relation FIELD with the provided
  20. equality and hash functions. this must be done before any
  21. calls to insert are made.
  22. g_relation_insert() inserts a new tuple. you are expected to
  23. provide the right number of fields.
  24. g_relation_delete() deletes all relations with KEY in FIELD
  25. g_relation_select() returns ...
  26. g_relation_count() counts ...
  27. }
  28. function g_relation_new(fields:gint):PGRelation;cdecl;external gliblib name 'g_relation_new';
  29. procedure g_relation_destroy(relation:PGRelation);cdecl;external gliblib name 'g_relation_destroy';
  30. procedure g_relation_index(relation:PGRelation; field:gint; hash_func:TGHashFunc; key_equal_func:TGEqualFunc);cdecl;external gliblib name 'g_relation_index';
  31. {$IFNDEF KYLIX}
  32. procedure g_relation_insert(relation:PGRelation; args:array of const);cdecl;overload;external gliblib name 'g_relation_insert';
  33. procedure g_relation_insert(relation:PGRelation);cdecl;overload;external gliblib name 'g_relation_insert';
  34. {$ELSE}
  35. procedure g_relation_insert(relation:PGRelation);varargs;cdecl;external gliblib name 'g_relation_insert';
  36. {$ENDIF}
  37. function g_relation_delete(relation:PGRelation; key:gconstpointer; field:gint):gint;cdecl;external gliblib name 'g_relation_delete';
  38. function g_relation_select(relation:PGRelation; key:gconstpointer; field:gint):PGTuples;cdecl;external gliblib name 'g_relation_select';
  39. function g_relation_count(relation:PGRelation; key:gconstpointer; field:gint):gint;cdecl;external gliblib name 'g_relation_count';
  40. {$IFNDEF KYLIX}
  41. function g_relation_exists(relation:PGRelation; args:array of const):gboolean;cdecl;overload;external gliblib name 'g_relation_exists';
  42. function g_relation_exists(relation:PGRelation):gboolean;cdecl;overload;external gliblib name 'g_relation_exists';
  43. {$ELSE}
  44. function g_relation_exists(relation:PGRelation):gboolean;varargs;cdecl;external gliblib name 'g_relation_exists';
  45. {$ENDIF}
  46. procedure g_relation_print(relation:PGRelation);cdecl;external gliblib name 'g_relation_print';
  47. procedure g_tuples_destroy(tuples:PGTuples);cdecl;external gliblib name 'g_tuples_destroy';
  48. function g_tuples_index(tuples:PGTuples; index:gint; field:gint):gpointer;cdecl;external gliblib name 'g_tuples_index';