Hachiojipm11

6,719 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
6,719
On SlideShare
0
From Embeds
0
Number of Embeds
320
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Hachiojipm11

  1. 1. Hachioji.pm #11 2011/12/3
  2. 2. About MeHideaki Ohno Twitter : @hide_o_55 Hatena: id:hide_o_55 github: http://hideo55.github.com/
  3. 3. Theme
  4. 4. Theme
  5. 5. DB
  6. 6. DB
  7. 7. MySQL
  8. 8. PostgreSQL
  9. 9. PostgreSQLForeign Data Wrapper Perl
  10. 10. Foreign Data Wrapper SQL MED(Management of ExternalData) PostgreSQL PostgreSQLPostgreSQL 9.1MySQL, Twitter, IMAP ...
  11. 11. Foreign Data Wrappertypedef FdwPlan *(*PlanForeignScan_function) (Oid foreigntableid, PlannerInfo*root, RelOptInfo*baserel);typedef void (*ExplainForeignScan_function) (ForeignScanState *node, struct ExplainState*es);typedef void (*BeginForeignScan_function) (ForeignScanState *node, int eflags);typedef TupleTableSlot *(*IterateForeignScan_function) (ForeignScanState*node);typedef void (*ReScanForeignScan_function) (ForeignScanState *node);typedef void (*EndForeignScan_function) (ForeignScanState *node);typedef struct FdwRoutine{ NodeTag type; PlanForeignScan_function PlanForeignScan; ExplainForeignScan_function ExplainForeignScan; BeginForeignScan_function BeginForeignScan; IterateForeignScan_function IterateForeignScan; ReScanForeignScan_function ReScanForeignScan; EndForeignScan_function EndForeignScan;} FdwRoutine;
  12. 12. perl_fdwDatum perl_fdw_handler( PG_FUNCTION_ARGS) { FdwRoutine *fdwroutine = makeNode(FdwRoutine); fdwroutine->PlanForeignScan = perlPlanForeignScan; fdwroutine->ExplainForeignScan = perlExplainForeignScan; fdwroutine->BeginForeignScan = perlBeginForeignScan; fdwroutine->IterateForeignScan = perlIterateForeignScan; fdwroutine->ReScanForeignScan = perlReScanForeignScan; fdwroutine->EndForeignScan = perlEndForeignScan; PG_RETURN_POINTER(fdwroutine);}
  13. 13. perl_fdw
  14. 14. perl_fdwCREATE EXTENSION perl_fdw;CREATE SERVER perl_hoge FOREIGNDATA WRAPPER perl_fdwoptions ( wrapper Foo::Bar);
  15. 15. perl_fdwCREATE FOREIGN TABLE hoge ( id INTEGER, name text) SERVER perl_hoge OPTIONS( foo ‘bar’);
  16. 16. m(__)m
  17. 17. PGXN(PostgreSQL Extension Network) Chrome Extension PGXN Searchhttps://github.com/hideo55/chrome-pgxn-search

×