Module: Pg

Defined in:
lib/tep/pg.rb

Overview

Tep ships the PG battery – a libpq wrapper that mirrors the ruby-pg gem’s public surface (PG::Connection / PG::Result / PG::Error and SQLSTATE-keyed subclasses) so an eventual ActiveRecord-on-spinel port reuses the existing AR pg adapter with minimal divergence.

Implementation:

- lib/tep/tep_pg.c   -- the libpq C shim (integer-handle slot
  tables, rotating return-string buffer, param accumulator).
- this file          -- the Ruby surface.

Why not the ‘pg` gem? It’s a CRuby native extension against MRI’s ABI; spinel produces a static binary with no MRI runtime. The C-shim model (same pattern as Tep::SQLite) replaces “load a gem” with “link a .o at compile time.”

Namespace note: PG lives at the top level (matching ‘require ’pg’‘ from gem-shaped code), not under Tep::. This is the one battery that bends the Tep::Foo convention to keep AR-portability free.

See docs/PG-BATTERY.md for the full design + per-method compatibility table.