]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg.pm
added "poll" flag to surveys; split up driver so we can use the CDBI stuff
[working/Evergreen.git] / Open-ILS / src / perlmods / OpenILS / Application / Storage / Driver / Pg.pm
1 #{ # Based on the change to Class::DBI in OpenILS::Application::Storage.  This will
2 #  # allow us to use TSearch2 via a simple cdbi "search" interface.
3 #       #-------------------------------------------------------------------------------
4 #       use Class::DBI;
5 #       package Class::DBI;
6 #
7 #       sub search_fti {
8 #               my $self = shift;
9 #               my @args = @_;
10 #               if (ref($args[-1]) eq 'HASH') {
11 #                       $args[-1]->{_placeholder} = "to_tsquery('default',?)";
12 #               } else {
13 #                       push @args, {_placeholder => "to_tsquery('default',?)"};
14 #               }
15 #               $self->_do_search("@@"  => @args);
16 #       }
17 #}
18 #
19 #{ # Every driver needs to provide a 'compile()' method to OpenILS::Application::Storage::FTS.
20 #  # If that driver wants to support FTI, that is...
21 #       #-------------------------------------------------------------------------------
22 #       package OpenILS::Application::Storage::FTS;
23 #       use OpenSRF::Utils::Logger qw/:level/;
24 #       my $log = 'OpenSRF::Utils::Logger';
25 #
26 #       sub compile {
27 #               my $self = shift;
28 #               my $term = shift;
29 #
30 #               $self = ref($self) || $self;
31 #               $self = bless {} => $self;
32 #
33 #               $self->decompose($term);
34 #
35 #               my $newterm = join('&', $self->words);
36 #
37 #               if (@{$self->nots}) {
38 #                       $newterm = '('.$newterm.')&('. join('|', $self->nots) . ')';
39 #               }
40 #
41 #               $log->debug("Compiled term is [$newterm]", DEBUG);
42 #               $newterm = OpenILS::Application::Storage::Driver::Pg->quote($newterm);
43 #               $log->debug("Quoted term is [$newterm]", DEBUG);
44 #
45 #               $self->{fts_query} = ["to_tsquery('default',$newterm)"];
46 #               $self->{fts_query_nots} = [];
47 #               $self->{fts_op} = '@@';
48 #               $self->{text_col} = shift;
49 #               $self->{fts_col} = shift;
50 #
51 #               return $self;
52 #       }
53 #
54 #       sub sql_where_clause {
55 #               my $self = shift;
56 #               my $column = $self->fts_col;
57 #               my @output;
58 #       
59 #               my @ranks;
60 #               for my $fts ( $self->fts_query ) {
61 #                       push @output, join(' ', $self->fts_col, $self->{fts_op}, $fts);
62 #                       push @ranks, "rank($column, $fts)";
63 #               }
64 #               $self->{fts_rank} = \@ranks;
65 #       
66 #               my $phrase_match = $self->sql_exact_phrase_match();
67 #               return join(' AND ', @output) . $phrase_match;
68 #       }
69 #
70 #}
71 #
72
73 { # The driver package itself just needs a db_Main method (or db_Slaves if
74   #Class::DBI::Replication is in use) for Class::DBI to call.
75   #
76   # Any other fixups can go in here too... Also, the drivers should subclass the
77   # DBI driver that they are wrapping, or provide a 'quote()' method that calls
78   # the DBD::xxx::quote() method on FTI's behalf.
79   #
80   # The dirver MUST be a subclass of Class::DBI(::Replication) and
81   # OpenILS::Application::Storage.
82   #-------------------------------------------------------------------------------
83         package OpenILS::Application::Storage::Driver::Pg;
84         use OpenILS::Application::Storage::Driver::Pg::cdbi;
85         use OpenILS::Application::Storage::Driver::Pg::fts;
86         use OpenILS::Application::Storage::Driver::Pg::storage;
87         use OpenILS::Application::Storage::Driver::Pg::dbi;
88         use Class::DBI;
89         use base qw/Class::DBI OpenILS::Application::Storage/;
90         use DBI;
91         use OpenSRF::EX qw/:try/;
92         use OpenSRF::DomainObject::oilsResponse;
93         use OpenSRF::Utils::Logger qw/:level/;
94         my $log = 'OpenSRF::Utils::Logger';
95
96         __PACKAGE__->set_sql( retrieve_limited => 'SELECT * FROM __TABLE__ ORDER BY id LIMIT ?' );
97         __PACKAGE__->set_sql( copy_start => 'COPY %s (%s) FROM STDIN;' );
98         __PACKAGE__->set_sql( copy_end => '\.' );
99
100         my $master_db;
101         my @slave_dbs;
102         my $_db_params;
103         sub child_init {
104                 my $self = shift;
105                 $_db_params = shift;
106
107                 $log->debug("Running child_init inside ".__PACKAGE__, INTERNAL);
108
109                 $_db_params = [ $_db_params ] unless (ref($_db_params) eq 'ARRAY');
110
111                 my %attrs = (   %{$self->_default_attributes},
112                                 RootClass => 'DBIx::ContextualFetch',
113                                 ShowErrorStatement => 1,
114                                 RaiseError => 1,
115                                 AutoCommit => 1,
116                                 PrintError => 1,
117                                 Taint => 1,
118                                 pg_enable_utf8 => 1,
119                                 FetchHashKeyName => 'NAME_lc',
120                                 ChopBlanks => 1,
121                 );
122
123                 my $master = shift @$_db_params;
124                 $master_db = DBI->connect("dbi:Pg:host=$$master{host};dbname=$$master{db}",$$master{user},$$master{pw}, \%attrs);
125                 $master_db->do("SET NAMES '$$master{client_encoding}';") if ($$master{client_encoding});
126
127                 $log->debug("Connected to MASTER db '$$master{db} at $$master{host}", INFO);
128                 
129                 for my $db (@$_db_params) {
130                         push @slave_dbs, DBI->connect("dbi:Pg:host=$$db{host};dbname=$$db{db}",$$db{user},$$db{pw}, \%attrs);
131                         $slave_dbs[-1]->do("SET NAMES '$$db{client_encoding}';") if ($$master{client_encoding});
132
133                         $log->debug("Connected to MASTER db '$$master{db} at $$master{host}", INFO);
134                 }
135
136                 $log->debug("All is well on the western front", INTERNAL);
137         }
138
139         sub db_Main {
140                 my $self = shift;
141                 return $master_db if ($self->current_xact_session);
142                 return $master_db unless (@slave_dbs);
143                 return ($master_db, @slave_dbs)[rand(scalar(@slave_dbs))];
144         }
145
146         sub quote {
147                 my $self = shift;
148                 return $self->db_Main->quote(@_)
149         }
150
151 #       sub tsearch2_trigger {
152 #               my $self = shift;
153 #               return unless ($self->value);
154 #               $self->index_vector(
155 #                       $self->db_Slaves->selectrow_array(
156 #                               "SELECT to_tsvector('default',?);",
157 #                               {},
158 #                               $self->value
159 #                       )
160 #               );
161 #       }
162
163         my $_xact_session;
164
165         sub current_xact_session {
166                 my $self = shift;
167                 if (defined($_xact_session)) {
168                         return $_xact_session;
169                 }
170                 return undef;
171         }
172
173         sub current_xact_is_auto {
174                 my $self = shift;
175                 my $auto = shift;
176                 if (defined($_xact_session) and ref($_xact_session)) {
177                         if (defined $auto) {
178                                 $_xact_session->session_data(autocommit => $auto);
179                         }
180                         return $_xact_session->session_data('autocommit'); 
181                 }
182         }
183
184         sub current_xact_id {
185                 my $self = shift;
186                 if (defined($_xact_session) and ref($_xact_session)) {
187                         return $_xact_session->session_id;
188                 }
189                 return undef;
190         }
191
192         sub set_xact_session {
193                 my $self = shift;
194                 my $ses = shift;
195                 if (!defined($ses)) {
196                         return undef;
197                 }
198                 $_xact_session = $ses;
199                 return $_xact_session;
200         }
201
202         sub unset_xact_session {
203                 my $self = shift;
204                 my $ses = $_xact_session;
205                 undef $_xact_session;
206                 return $ses;
207         }
208
209 }
210
211 #
212 #{
213 #       package OpenILS::Application::Storage;
214 #       use OpenSRF::Utils::Logger;
215 #       my $log = 'OpenSRF::Utils::Logger';
216 #
217 #       my $pg = 'OpenILS::Application::Storage::Driver::Pg';
218 #
219 #
220 #       sub current_xact {
221 #               my $self = shift;
222 #               my $client = shift;
223 #               return $pg->current_xact_id;
224 #       }
225 #       __PACKAGE__->register_method(
226 #               method          => 'current_xact',
227 #               api_name        => 'open-ils.storage.transaction.current',
228 #               api_level       => 1,
229 #               argc            => 0,
230 #       );
231 #
232 #
233 #       sub pg_begin_xaction {
234 #               my $self = shift;
235 #               my $client = shift;
236 #
237 #               if (my $old_xact = $pg->current_xact_session) {
238 #                       if ($pg->current_xact_is_auto) {
239 #                               $log->debug("Commiting old autocommit transaction with Open-ILS XACT-ID [$old_xact]", INFO);
240 #                               $self->pg_commit_xaction($client);
241 #                       } else {
242 #                               $log->debug("Rolling back old NON-autocommit transaction with Open-ILS XACT-ID [$old_xact]", INFO);
243 #                               $self->pg_rollback_xaction($client);
244 #                               throw OpenSRF::DomainObject::oilsException->new(
245 #                                               statusCode => 500,
246 #                                               status => "Previous transaction rolled back!",
247 #                               );
248 #                       }
249 #               }
250 #               
251 #               $pg->set_xact_session( $client->session );
252 #               my $xact_id = $pg->current_xact_id;
253 #
254 #               $log->debug("Beginning a new trasaction with Open-ILS XACT-ID [$xact_id]", INFO);
255 #
256 #               my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
257 #               
258 #               try {
259 #                       $dbh->begin_work;
260 #
261 #               } catch Error with {
262 #                       my $e = shift;
263 #                       $log->debug("Failed to begin a new trasaction with Open-ILS XACT-ID [$xact_id]: ".$e, INFO);
264 #                       throw $e;
265 #               };
266 #
267 #
268 #               my $death_cb = $client->session->register_callback(
269 #                       death => sub {
270 #                               __PACKAGE__->pg_rollback_xaction;
271 #                       }
272 #               );
273 #
274 #               $log->debug("Registered 'death' callback [$death_cb] for new trasaction with Open-ILS XACT-ID [$xact_id]", DEBUG);
275 #
276 #               $client->session->session_data( death_cb => $death_cb );
277 #
278 #               if ($self->api_name =~ /autocommit$/o) {
279 #                       $pg->current_xact_is_auto(1);
280 #                       my $dc_cb = $client->session->register_callback(
281 #                               disconnect => sub {
282 #                                       my $ses = shift;
283 #                                       $ses->unregister_callback(death => $death_cb);
284 #                                       __PACKAGE__->pg_commit_xaction;
285 #                               }
286 #                       );
287 #                       $log->debug("Registered 'disconnect' callback [$dc_cb] for new trasaction with Open-ILS XACT-ID [$xact_id]", DEBUG);
288 #                       if ($client and $client->session) {
289 #                               $client->session->session_data( disconnect_cb => $dc_cb );
290 #                       }
291 #               }
292 #
293 #               return 1;
294 #
295 #       }
296 #       __PACKAGE__->register_method(
297 #               method          => 'pg_begin_xaction',
298 #               api_name        => 'open-ils.storage.transaction.begin',
299 #               api_level       => 1,
300 #               argc            => 0,
301 #       );
302 #       __PACKAGE__->register_method(
303 #               method          => 'pg_begin_xaction',
304 #               api_name        => 'open-ils.storage.transaction.begin.autocommit',
305 #               api_level       => 1,
306 #               argc            => 0,
307 #       );
308 #
309 #       sub pg_commit_xaction {
310 #               my $self = shift;
311 #
312 #               my $xact_id = $pg->current_xact_id;
313 #
314 #               try {
315 #                       $log->debug("Committing trasaction with Open-ILS XACT-ID [$xact_id]", INFO);
316 #                       my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
317 #                       $dbh->commit;
318 #
319 #               } catch Error with {
320 #                       my $e = shift;
321 #                       $log->debug("Failed to commit trasaction with Open-ILS XACT-ID [$xact_id]: ".$e, INFO);
322 #                       return 0;
323 #               };
324 #               
325 #               $pg->current_xact_session->unregister_callback( death => 
326 #                       $pg->current_xact_session->session_data( 'death_cb' )
327 #               ) if ($pg->current_xact_session);
328 #
329 #               if ($pg->current_xact_is_auto) {
330 #                       $pg->current_xact_session->unregister_callback( disconnect => 
331 #                               $pg->current_xact_session->session_data( 'disconnect_cb' )
332 #                       );
333 #               }
334 #
335 #               $pg->unset_xact_session;
336 #
337 #               return 1;
338 #               
339 #       }
340 #       __PACKAGE__->register_method(
341 #               method          => 'pg_commit_xaction',
342 #               api_name        => 'open-ils.storage.transaction.commit',
343 #               api_level       => 1,
344 #               argc            => 0,
345 #       );
346 #
347 #       sub pg_rollback_xaction {
348 #               my $self = shift;
349 #
350 #               my $xact_id = $pg->current_xact_id;
351 #               try {
352 #                       my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
353 #                       $log->debug("Rolling back a trasaction with Open-ILS XACT-ID [$xact_id]", INFO);
354 #                       $dbh->rollback;
355 #
356 #               } catch Error with {
357 #                       my $e = shift;
358 #                       $log->debug("Failed to roll back trasaction with Open-ILS XACT-ID [$xact_id]: ".$e, INFO);
359 #                       return 0;
360 #               };
361 #       
362 #               $pg->current_xact_session->unregister_callback( death =>
363 #                       $pg->current_xact_session->session_data( 'death_cb' )
364 #               ) if ($pg->current_xact_session);
365 #
366 #               if ($pg->current_xact_is_auto) {
367 #                       $pg->current_xact_session->unregister_callback( disconnect =>
368 #                               $pg->current_xact_session->session_data( 'disconnect_cb' )
369 #                       );
370 #               }
371 #
372 #               $pg->unset_xact_session;
373 #
374 #               return 1;
375 #       }
376 #       __PACKAGE__->register_method(
377 #               method          => 'pg_rollback_xaction',
378 #               api_name        => 'open-ils.storage.transaction.rollback',
379 #               api_level       => 1,
380 #               argc            => 0,
381 #       );
382 #
383 #       sub copy_create {
384 #               my $self = shift;
385 #               my $client = shift;
386 #               my @fm_nodes = @_;
387 #
388 #               return undef unless ($pg->current_xact_session);
389 #
390 #               my $cdbi = $self->{cdbi};
391 #
392 #               my $pri = $cdbi->columns('Primary');
393 #
394 #               my @cols = grep {$_ ne $pri} $cdbi->columns('All');
395 #
396 #               my $col_list = join ',', @cols;
397 #
398 #               $log->debug('Starting COPY import for '.$cdbi->table." ($col_list)", DEBUG);
399 #               $cdbi->sql_copy_start($cdbi->table, $col_list)->execute;
400 #
401 #               my $dbh = $cdbi->db_Main;
402 #               for my $node ( @fm_nodes ) {
403 #                       next unless ($node);
404 #                       my $line = join("\t", map { defined($node->$_()) ? $node->$_() : '\N' } @cols);
405 #                       $log->debug("COPY line: [$line]",DEBUG);
406 #                       $dbh->func($line."\n", 'putline');
407 #               }
408 #
409 #               $dbh->func('endcopy');
410 #
411 #               return scalar(@fm_nodes);
412 #       }
413 #
414 #}
415 #
416 #
417 #{
418 #       #---------------------------------------------------------------------
419 #       package action::survey;
420 #       
421 #       action::survey->table( 'action.survey' );
422 #       action::survey->sequence( 'action.survey_id_seq' );
423 #       
424 #       #---------------------------------------------------------------------
425 #       package action::survey_question;
426 #       
427 #       action::survey_question->table( 'action.survey_question' );
428 #       action::survey_question->sequence( 'action.survey_question_id_seq' );
429 #       
430 #       #---------------------------------------------------------------------
431 #       package action::survey_answer;
432 #       
433 #       action::survey_answer->table( 'action.survey_answer' );
434 #       action::survey_answer->sequence( 'action.survey_answer_id_seq' );
435 #       
436 #       #---------------------------------------------------------------------
437 #       package action::survey_response;
438 #       
439 #       action::survey_response->table( 'action.survey_response' );
440 #       action::survey_response->sequence( 'action.survey_response_id_seq' );
441 #       
442 #       #---------------------------------------------------------------------
443 #       package config::copy_status;
444 #       
445 #       config::standing->table( 'config.copy_status' );
446 #       config::standing->sequence( 'config.copy_status_id_seq' );
447 #       
448 #       #---------------------------------------------------------------------
449 #       package config::net_access_level;
450 #       
451 #       config::standing->table( 'config.net_access_level' );
452 #       config::standing->sequence( 'config.net_access_level_id_seq' );
453 #       
454 #       #---------------------------------------------------------------------
455 #       package config::standing;
456 #       
457 #       config::standing->table( 'config.standing' );
458 #       config::standing->sequence( 'config.standing_id_seq' );
459 #       
460 #       #---------------------------------------------------------------------
461 #       package config::metabib_field;
462 #       
463 #       config::metabib_field->table( 'config.metabib_field' );
464 #       config::metabib_field->sequence( 'config.metabib_field_id_seq' );
465 #       
466 #       #---------------------------------------------------------------------
467 #       package config::bib_source;
468 #       
469 #       config::bib_source->table( 'config.bib_source' );
470 #       config::bib_source->sequence( 'config.bib_source_id_seq' );
471 #       
472 #       #---------------------------------------------------------------------
473 #       package config::identification_type;
474 #       
475 #       config::identification_type->table( 'config.identification_type' );
476 #       config::identification_type->sequence( 'config.identification_type_id_seq' );
477 #       
478 #       #---------------------------------------------------------------------
479 #       package asset::call_number_note;
480 #       
481 #       asset::call_number->table( 'asset.call_number_note' );
482 #       asset::call_number->sequence( 'asset.call_number_note_id_seq' );
483 #       
484 #       #---------------------------------------------------------------------
485 #       package asset::copy_note;
486 #       
487 #       asset::copy->table( 'asset.copy_note' );
488 #       asset::copy->sequence( 'asset.copy_note_id_seq' );
489 #
490 #       #---------------------------------------------------------------------
491 #       package asset::call_number;
492 #       
493 #       asset::call_number->table( 'asset.call_number' );
494 #       asset::call_number->sequence( 'asset.call_number_id_seq' );
495 #       
496 #       #---------------------------------------------------------------------
497 #       package asset::copy_location;
498 #       
499 #       asset::copy->table( 'asset.copy_location' );
500 #       asset::copy->sequence( 'asset.copy_location_id_seq' );
501 #
502 #       #---------------------------------------------------------------------
503 #       package asset::copy;
504 #       
505 #       asset::copy->table( 'asset.copy' );
506 #       asset::copy->sequence( 'asset.copy_id_seq' );
507 #
508 #       #---------------------------------------------------------------------
509 #       package asset::stat_cat;
510 #       
511 #       asset::stat_cat->table( 'asset.stat_cat' );
512 #       asset::stat_cat->sequence( 'asset.stat_cat_id_seq' );
513 #       
514 #       #---------------------------------------------------------------------
515 #       package asset::stat_cat_entry;
516 #       
517 #       asset::stat_cat_entry->table( 'asset.stat_cat_entry' );
518 #       asset::stat_cat_entry->sequence( 'asset.stat_cat_entry_id_seq' );
519 #       
520 #       #---------------------------------------------------------------------
521 #       package asset::stat_cat_entry_copy_map;
522 #       
523 #       asset::stat_cat_entry_copy_map->table( 'asset.stat_cat_entry_copy_map' );
524 #       asset::stat_cat_entry_copy_map->sequence( 'asset.stat_cat_entry_copy_map_id_seq' );
525 #       
526 #       #---------------------------------------------------------------------
527 #       package biblio::record_entry;
528 #       
529 #       biblio::record_entry->table( 'biblio.record_entry' );
530 #       biblio::record_entry->sequence( 'biblio.record_entry_id_seq' );
531 #
532 #       #---------------------------------------------------------------------
533 #       #package biblio::record_marc;
534 #       #
535 #       #biblio::record_marc->table( 'biblio.record_marc' );
536 #       #biblio::record_marc->sequence( 'biblio.record_marc_id_seq' );
537 #       #
538 #       #---------------------------------------------------------------------
539 #       package biblio::record_note;
540 #       
541 #       biblio::record_note->table( 'biblio.record_note' );
542 #       biblio::record_note->sequence( 'biblio.record_note_id_seq' );
543 #       
544 #       #---------------------------------------------------------------------
545 #       package actor::user;
546 #       
547 #       actor::user->table( 'actor.usr' );
548 #       actor::user->sequence( 'actor.usr_id_seq' );
549 #
550 #       #---------------------------------------------------------------------
551 #       package actor::user_address;
552 #       
553 #       actor::user_address->table( 'actor.usr_address' );
554 #       actor::user_address->sequence( 'actor.usr_address_id_seq' );
555 #
556 #       #---------------------------------------------------------------------
557 #       package actor::org_address;
558 #       
559 #       actor::org_address->table( 'actor.org_address' );
560 #       actor::org_address->sequence( 'actor.org_address_id_seq' );
561 #       
562 #       #---------------------------------------------------------------------
563 #       package actor::profile;
564 #       
565 #       actor::profile->table( 'actor.profile' );
566 #       actor::profile->sequence( 'actor.profile_id_seq' );
567 #       
568 #       #---------------------------------------------------------------------
569 #       package actor::org_unit_type;
570 #       
571 #       actor::org_unit_type->table( 'actor.org_unit_type' );
572 #       actor::org_unit_type->sequence( 'actor.org_unit_type_id_seq' );
573 #
574 #       #---------------------------------------------------------------------
575 #       package actor::org_unit;
576 #       
577 #       actor::org_unit->table( 'actor.org_unit' );
578 #       actor::org_unit->sequence( 'actor.org_unit_id_seq' );
579 #
580 #       #---------------------------------------------------------------------
581 #       package actor::stat_cat;
582 #       
583 #       actor::stat_cat->table( 'actor.stat_cat' );
584 #       actor::stat_cat->sequence( 'actor.stat_cat_id_seq' );
585 #       
586 #       #---------------------------------------------------------------------
587 #       package actor::stat_cat_entry;
588 #       
589 #       actor::stat_cat_entry->table( 'actor.stat_cat_entry' );
590 #       actor::stat_cat_entry->sequence( 'actor.stat_cat_entry_id_seq' );
591 #       
592 #       #---------------------------------------------------------------------
593 #       package actor::stat_cat_entry_user_map;
594 #       
595 #       actor::stat_cat_entry_user_map->table( 'actor.stat_cat_entry_copy_map' );
596 #       actor::stat_cat_entry_user_map->sequence( 'actor.stat_cat_entry_usr_map_id_seq' );
597 #       
598 #       #---------------------------------------------------------------------
599 #       package actor::card;
600 #       
601 #       actor::card->table( 'actor.card' );
602 #       actor::card->sequence( 'actor.card_id_seq' );
603 #
604 #       #---------------------------------------------------------------------
605 #
606 #       #-------------------------------------------------------------------------------
607 #       package metabib::metarecord;
608 #
609 #       metabib::metarecord->table( 'metabib.metarecord' );
610 #       metabib::metarecord->sequence( 'metabib.metarecord_id_seq' );
611 #
612 #       OpenILS::Application::Storage->register_method(
613 #               api_name        => 'open-ils.storage.direct.metabib.metarecord.batch.create',
614 #               method          => 'copy_create',
615 #               api_level       => 1,
616 #               'package'       => 'OpenILS::Application::Storage',
617 #               cdbi            => 'metabib::metarecord',
618 #       );
619 #
620 #
621 #       #-------------------------------------------------------------------------------
622 #
623 #       #-------------------------------------------------------------------------------
624 #       package metabib::title_field_entry;
625 #
626 #       metabib::title_field_entry->table( 'metabib.title_field_entry' );
627 #       metabib::title_field_entry->sequence( 'metabib.title_field_entry_id_seq' );
628 #       metabib::title_field_entry->columns( 'FTS' => 'index_vector' );
629 #
630 ##      metabib::title_field_entry->add_trigger(
631 ##              before_create => \&OpenILS::Application::Storage::Driver::Pg::tsearch2_trigger
632 ##      );
633 ##      metabib::title_field_entry->add_trigger(
634 ##              before_update => \&OpenILS::Application::Storage::Driver::Pg::tsearch2_trigger
635 ##      );
636 #
637 #       OpenILS::Application::Storage->register_method(
638 #               api_name        => 'open-ils.storage.direct.metabib.title_field_entry.batch.create',
639 #               method          => 'copy_create',
640 #               api_level       => 1,
641 #               'package'       => 'OpenILS::Application::Storage',
642 #               cdbi            => 'metabib::title_field_entry',
643 #       );
644 #
645 #       #-------------------------------------------------------------------------------
646 #
647 #       #-------------------------------------------------------------------------------
648 #       package metabib::author_field_entry;
649 #
650 #       metabib::author_field_entry->table( 'metabib.author_field_entry' );
651 #       metabib::author_field_entry->sequence( 'metabib.author_field_entry_id_seq' );
652 #       metabib::author_field_entry->columns( 'FTS' => 'index_vector' );
653 #
654 #       OpenILS::Application::Storage->register_method(
655 #               api_name        => 'open-ils.storage.direct.metabib.author_field_entry.batch.create',
656 #               method          => 'copy_create',
657 #               api_level       => 1,
658 #               'package'       => 'OpenILS::Application::Storage',
659 #               cdbi            => 'metabib::author_field_entry',
660 #       );
661 #
662 #       #-------------------------------------------------------------------------------
663 #
664 #       #-------------------------------------------------------------------------------
665 #       package metabib::subject_field_entry;
666 #
667 #       metabib::subject_field_entry->table( 'metabib.subject_field_entry' );
668 #       metabib::subject_field_entry->sequence( 'metabib.subject_field_entry_id_seq' );
669 #       metabib::subject_field_entry->columns( 'FTS' => 'index_vector' );
670 #
671 #       OpenILS::Application::Storage->register_method(
672 #               api_name        => 'open-ils.storage.direct.metabib.subject_field_entry.batch.create',
673 #               method          => 'copy_create',
674 #               api_level       => 1,
675 #               'package'       => 'OpenILS::Application::Storage',
676 #               cdbi            => 'metabib::subject_field_entry',
677 #       );
678 #
679 #       #-------------------------------------------------------------------------------
680 #
681 #       #-------------------------------------------------------------------------------
682 #       package metabib::keyword_field_entry;
683 #
684 #       metabib::keyword_field_entry->table( 'metabib.keyword_field_entry' );
685 #       metabib::keyword_field_entry->sequence( 'metabib.keyword_field_entry_id_seq' );
686 #       metabib::keyword_field_entry->columns( 'FTS' => 'index_vector' );
687 #
688 #       OpenILS::Application::Storage->register_method(
689 #               api_name        => 'open-ils.storage.direct.metabib.keyword_field_entry.batch.create',
690 #               method          => 'copy_create',
691 #               api_level       => 1,
692 #               'package'       => 'OpenILS::Application::Storage',
693 #               cdbi            => 'metabib::keyword_field_entry',
694 #       );
695 #
696 #       #-------------------------------------------------------------------------------
697 #
698 #       #-------------------------------------------------------------------------------
699 #       #package metabib::title_field_entry_source_map;
700 #
701 #       #metabib::title_field_entry_source_map->table( 'metabib.title_field_entry_source_map' );
702 #
703 #       #-------------------------------------------------------------------------------
704 #
705 #       #-------------------------------------------------------------------------------
706 #       #package metabib::author_field_entry_source_map;
707 #
708 #       #metabib::author_field_entry_source_map->table( 'metabib.author_field_entry_source_map' );
709 #
710 #       #-------------------------------------------------------------------------------
711 #
712 #       #-------------------------------------------------------------------------------
713 #       #package metabib::subject_field_entry_source_map;
714 #
715 #       #metabib::subject_field_entry_source_map->table( 'metabib.subject_field_entry_source_map' );
716 #
717 #       #-------------------------------------------------------------------------------
718 #
719 #       #-------------------------------------------------------------------------------
720 #       #package metabib::keyword_field_entry_source_map;
721 #
722 #       #metabib::keyword_field_entry_source_map->table( 'metabib.keyword_field_entry_source_map' );
723 #
724 #       #-------------------------------------------------------------------------------
725 #
726 #       #-------------------------------------------------------------------------------
727 #       package metabib::metarecord_source_map;
728 #
729 #       metabib::metarecord_source_map->table( 'metabib.metarecord_source_map' );
730 #       OpenILS::Application::Storage->register_method(
731 #               api_name        => 'open-ils.storage.direct.metabib.metarecord_source_map.batch.create',
732 #               method          => 'copy_create',
733 #               api_level       => 1,
734 #               'package'       => 'OpenILS::Application::Storage',
735 #               cdbi            => 'metabib::metarecord_source_map',
736 #       );
737 #
738 #
739 #       #-------------------------------------------------------------------------------
740 #       package metabib::record_descriptor;
741 #
742 #       metabib::record_descriptor->table( 'metabib.rec_descriptor' );
743 #       metabib::record_descriptor->sequence( 'metabib.rec_descriptor_id_seq' );
744 #
745 #       OpenILS::Application::Storage->register_method(
746 #               api_name        => 'open-ils.storage.direct.metabib.record_descriptor.batch.create',
747 #               method          => 'copy_create',
748 #               api_level       => 1,
749 #               'package'       => 'OpenILS::Application::Storage',
750 #               cdbi            => 'metabib::record_descriptor',
751 #       );
752 #
753 #       #-------------------------------------------------------------------------------
754 #
755 #
756 #       #-------------------------------------------------------------------------------
757 #       package metabib::full_rec;
758 #
759 #       metabib::full_rec->table( 'metabib.full_rec' );
760 #       metabib::full_rec->sequence( 'metabib.full_rec_id_seq' );
761 #       metabib::full_rec->columns( 'FTS' => 'index_vector' );
762 #
763 #       OpenILS::Application::Storage->register_method(
764 #               api_name        => 'open-ils.storage.direct.metabib.full_rec.batch.create',
765 #               method          => 'copy_create',
766 #               api_level       => 1,
767 #               'package'       => 'OpenILS::Application::Storage',
768 #               cdbi            => 'metabib::full_rec',
769 #       );
770 #
771 #
772 #       #-------------------------------------------------------------------------------
773 #}
774 #
775
776 1;