{"id":15016693,"url":"https://github.com/nukopian/dbix-squirrel","last_synced_at":"2026-03-15T19:38:53.660Z","repository":{"id":232421590,"uuid":"781578676","full_name":"nukopian/DBIx-Squirrel","owner":"nukopian","description":"A Perl package for working with SQL databases, occupying a sweet spot between DBI and DBIx::Class.","archived":false,"fork":false,"pushed_at":"2025-03-09T18:08:22.000Z","size":5155,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T18:26:13.111Z","etag":null,"topics":["database","dbi","perl5"],"latest_commit_sha":null,"homepage":"https://metacpan.org/dist/DBIx-Squirrel","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nukopian.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-03T16:42:49.000Z","updated_at":"2025-02-28T15:44:41.000Z","dependencies_parsed_at":"2024-05-30T20:39:13.148Z","dependency_job_id":"fb3bf0de-45ca-42f7-b3ab-98b4b0dab3fe","html_url":"https://github.com/nukopian/DBIx-Squirrel","commit_stats":null,"previous_names":["nukopian/dbix-squirrel"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukopian%2FDBIx-Squirrel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukopian%2FDBIx-Squirrel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukopian%2FDBIx-Squirrel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukopian%2FDBIx-Squirrel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nukopian","download_url":"https://codeload.github.com/nukopian/DBIx-Squirrel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243313964,"owners_count":20271287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","dbi","perl5"],"created_at":"2024-09-24T19:49:14.736Z","updated_at":"2025-12-24T19:05:16.005Z","avatar_url":"https://github.com/nukopian.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv id=\"dbix-squirrel-top\" align=\"center\"\u003e\n    \u003ca href=\"https://metacpan.org/dist/DBIx-Squirrel\" title=\"Go to the distribution's page on MetaCPAN\"\u003e\u003cimg src=\"./resources/images/ekorn.png\" width=\"128\"\u003e\u003c/a\u003e\n    \u003ch1\u003e\n        DBIx-Squirrel\u003cbr\u003e\n        \u003ca href=\"https://metacpan.org/dist/DBIx-Squirrel\" title=\"Go to the distribution's page on MetaCPAN\"\u003e\u003cimg src=\"https://img.shields.io/cpan/v/DBIx-Squirrel\"\u003e\u003c/a\u003e\n        \u003ca href=\"https://github.com/nukopian/DBIx-Squirrel/releases/tag/1.6.4\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/nukopian/DBIx-Squirrel?label=github\u0026color=tan\"\u003e\u003c/a\u003e\n        \u003ca href=\"https://github.com/nukopian/DBIx-Squirrel/releases/tag/1.6.4\"\u003e\u003cimg src=\"https://img.shields.io/github/release-date/nukopian/DBIx-Squirrel?color=tan\"\u003e\u003c/a\u003e\n        \u003cimg src=\"https://img.shields.io/cpan/l/DBIx-Squirrel\"\u003e\n    \u003c/h1\u003e\n    \u003cp\u003e\u003cem\u003eThe little Perl DBI extension that makes working with databases\n    a lot easier.\u003c/em\u003e\u003cp\u003e\n    \u003cp\u003e• \u003ca href=\"http://fast-matrix.cpantesters.org/?dist=DBIx-Squirrel%201.6.4\"\u003eCurrent release status on the CPAN Testers Matrix\u003c/a\u003e •\u003c/p\u003e\n\u003c/div\u003e\n\n## Development Halted\n\nI'm at a fork in the road. I want future versions of this project to move in a different direction, while using a more modern approach. To that end, \u003ca href=\"https://github.com/nukopian/dbix-squirrel-v2\"\u003e\u003ctt\u003eDBIx::Squirrel::v2\u003c/tt\u003e\u003c/a\u003e is being forged in its own separate repository in order to preserve this one.\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Installation](#installation)\n- [POD page](docs/POD/)\n\n\n## Introduction\n\nUsing DBIx-Squirrel is just like using the DBI, but with upgrades.\nThose with some experience of classic DBI and DBIx-Class programming\ncan quickly get to a sweet-spot somewhere between both.\n\nJust as with the DBI, all database queries are crafted with SQL,\nkeeping you close to the data. With its built-in support for named,\npositional and legacy parameter placeholders, DBIx-Squirrel makes\nthe task of crafting that SQL a lot less bothersome, while its\niterators and transformations offer a clean and elegant way to\nprocess results.\n\nMost comforting of all, everything that could be done with the DBI\ncan still be done using DBIx-Squirrel. Enhancements are subtle and\nprogressive in nature, and intended to work in harmony features\nprovided by its venerable ancestor.\n\nWhile this package is not going to set the world on fire, it will\nhelp those with a need to quickly hack-together data-processing\nscripts, and to do so with absolute ease.\n\n#### Examples\n\nTo whet the appetite, let's take a look at some example code.\n\nThe DBIx-Squirrel distribution ships with a SQLite database\n(`t/data/chinook.db`), which is used for testing. We will use\nthe same database for the examples.\n\n##### 1. `examples/04.pl`\n\n```perl\nuse DBIx::Squirrel;\n\n$dbh = DBIx::Squirrel-\u003econnect('dbi:SQLite:dbname=t/data/chinook.db', '', '');\n\n$artists = $dbh-\u003eresults(\n    'SELECT Name FROM artists ORDER BY Name' =\u003e sub {$_-\u003eName}\n);\n\nprint \"$_\\n\" while $artists-\u003enext();\n\n$dbh-\u003edisconnect();\n```\n\nTo run, change to the directory in which you untarred the distribution,\nand type:\n\n```shell\nperl -Ilib examples/04.pl\n```\n\nSummary:\n\n- connect to the database;\n- print the names of all artists in alphabetic order;\n- disconnect from the database.\n\nClearly, the tasks of connecting to and disconnecting from the database\nare accomplished here as they would be with the DBI.\n\nThe `$dbh-\u003eresults(...)` call returns a result set iterator instance,\nand this is being assigned to `$artists`. The iterator is based upon\na standard SQL query, which also takes care of ordering the results.\n\nThe `=\u003e sub {$_-\u003eName}` following the SQL query is a single-stage\ntransformation returning the result's `Name` attribute. This type of\niterator allows access to attribute values using accessors. Without the\ntransformation, a row object would be returned to the caller.\n\nThe intended purpose of a transformation is to change the shape of\ndata, ensuring that only the information required by the caller is\nreturned. The caller retains the flexibility to tailor results to\ntheir specific requirements, removing the need for the function's \nauthor to anticipate and bake-in those requirements.\n\nThe manner in which transformations are declared produces a visibly\nclear and logical association between them and the SQL query from which\nresults will emanate.\n\nNext we print out the results, one at a time. The `while $artists-\u003enext()`\npostfix while-loop ensures that we do this only while the iterator\nproduces a \"truthy\" result. That's good enough here, *but there are\nbetter ways to do it.*\n\nThis approach is succinct, clean and elegant, and there is no clutter\nlittering the calling context\u0026mdash;*no temporary state, and definitely\nno untangling the innards of results just to get at the information\nwe wanted.*\n\n\u003cdiv align=\"right\"\u003eGo to: \u003ca href=\"#dbix-squirrel-top\"\u003eTop\u003c/a\u003e\u003c/div\u003e\n\n##### 2. `examples/05.pl`\n\n```perl\nuse DBIx::Squirrel;\n\n$dbh = DBIx::Squirrel-\u003econnect('dbi:SQLite:dbname=./t/data/chinook.db', '', '');\n\n$artists = $dbh-\u003eresults(\n    'SELECT * FROM artists ORDER BY ArtistId' =\u003e sub {\n        my($result) = @_;\n        printf STDERR \"# %3d. %s\\n\", $result-\u003eArtistId, $result-\u003eName\n            if !!$ENV{DEBUG};\n        $result;\n    } =\u003e sub {\n        return $_-\u003eName;\n    }\n);\n\n@artists = $artists-\u003eall();\n\n$dbh-\u003edisconnect();\n```\n\nTo run, change to the directory in which you untarred the distribution,\nand type:\n\n```shell\nperl -Ilib examples/05.pl\n```\n\nSummary:\n\n- connect to the database;\n- gather the names of all artists in alphabetic order;\n- disconnect from the database.\n\nNot too dissimilar from the previous example. This time, we confessf caution\nto the wind and gather *all* of the artists' names into the `@artists`\narray.\n\nOrdinarily, that would be the end of it. On this occasion, however,\nwe require some assurance that things are working as intended. To this\nend, an extra processing stage has been injected at the start of the\ntransformation, and its purpose is to output the needed debug information\nif the `DEBUG` environment variable contains a truthy value. The result\nis passed unchanged along to the next stage of the transformation.\n\nA transformation is presented as a *contiguous* chain of one or\nmore CODEREFs at the end of the iterator's argument list. Stages\nare separated other arguments (and each other) using the comma\n(`,`). Separation using the long-comma (`=\u003e`) is also possible, provided\nthe token to its left is not a bare word; it also serves as a metaphor\nfor the result's direction of travel through the transformation\nprocess.\n\nFrom these examples, we can intuit the following about transformations:\n\n- the result (in its current form) enters a transformation stage as `$_`,\nand as the first element of the `@_` array, for when we need something\nless ephemeral;\n- the result (which may, or may not, have changed), is passed to the\nnext stage of the transformation, or to the caller, as the final\nevaluated expression, or using an explicit `return` statement.\n\n\u003cdiv align=\"right\"\u003eGo to: \u003ca href=\"#dbix-squirrel-top\"\u003eTop\u003c/a\u003e\u003c/div\u003e\n\n## Installation\n\n### Install with `App::cpanminus`\n\n#### Automated installation\n\n```shell\ncpanm DBIx::Squirrel\n```\n\n#### Manual installation\n\nIf you prefer to install manually, or you would like to try out any of the\nexample code in a sub-shell:\n\n```shell\ncpanm --look DBIx::Squirrel\nperl Makefile.PL\nmake \u0026\u0026 make test \u0026\u0026 make install\n```\n\n#### Uninstall with `App::cpanminus`\n\nIn the unfortunate event that things don't work out...\n```shell\ncpanm --uninstall DBIx::Squirrel\n```\n\n\u003cdiv align=\"right\"\u003eGo to: \u003ca href=\"#dbix-squirrel-top\"\u003eTop\u003c/a\u003e\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnukopian%2Fdbix-squirrel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnukopian%2Fdbix-squirrel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnukopian%2Fdbix-squirrel/lists"}