Skip to content

DBIx::Custom Documents

yuki-kimoto edited this page Nov 14, 2012 · 35 revisions

DBIx::Custom Documents

DBIx::Custom is a DBI extended class to execute insert, update, delete, and select statement easily. DBIx::Custom has many useful features. Compared to other O/R mapper modules, it is easy to learn, because DBIx::Custom has many SQL-like syntax.

This is an example.

use DBIx::Custom;

# Connect to database
my $dbi = DBIx::Custom->connect(dsn => $dsn);

# Insert
$dbi->insert({id => 1, title => 'Perl'}, table => 'book');

# Update
$dbi->update({title => 'Perl'}, table => 'book', where => {id => 1});

# Delete
$dbi->delete(table => 'book', where => {id => 1});

# Select
my $rows = $dbi->select(table => 'book')->all;

Features

DBIx::Custom have the following features.

  • Execute insert, update, delete, or select statement easily

  • Create where clause flexibly

  • Named place holder support

  • Model support

  • Connection manager support

  • Choice your favorite relational database management system, MySQL, SQLite, PostgreSQL, Oracle, Microsoft SQL Server, Microsoft Access, DB2 or anything,

  • Filtering by data type or column name

  • Create order by clause flexibly

  • Fast multiple data insert support

  • Bulk insert support (MySQL, PostgreSQL)

If you search O/R mapper like Ruby's ActiveRecord or think DBIx::Custom is very complex or think DBIx::Simple don't have enough features, I recommend DBIx::Custom for you. DBIx::Custom also have SQL generation features like SQL::Abstruct. DBIx::Custom is not depended on specific RDBMS. you can use this module with any RDMBS.

Installation

Connect to database

Query execution

Fetching rows

Where clause

Order by clause

Filter

Model

Parameter mapping

Connection manager

Performance

Debug

Advanced

Generate SQL

Table and column information

  • [http://d.hatena.ne.jp/perlcodesample/20110911/1319008159:title=すべてのテーブルを表示する show_tables]

  • [http://d.hatena.ne.jp/perlcodesample/20110825/1318591639:title=テーブルの情報を取得する get_table_info]

  • [http://d.hatena.ne.jp/perlcodesample/20110824/1318591588:title=列の情報を取得する get_column_info]

  • [http://d.hatena.ne.jp/perlcodesample/20110805/1317195340:title=データベースの列の情報を設定する user_column_info]

  • [http://d.hatena.ne.jp/perlcodesample/20110912/1319008343:title=テーブルを指定してすべての列のタイプ名を表示する show_typename]

  • [http://d.hatena.ne.jp/perlcodesample/20110910/1319008051:title=指定したテーブルのすべての列のデータタイプを表示する show_datatype]

  • [http://d.hatena.ne.jp/perlcodesample/20110810/1317638296:title=タイプ名の一覧の取得 available_typename]

  • [http://d.hatena.ne.jp/perlcodesample/20110807/1317348255:title=データタイプの一覧の取得 available_datatype]

  • [http://d.hatena.ne.jp/perlcodesample/20110804/1317125191:title=検索するテーブルから特定のテーブルを除外する exclude_table]

Utility

  • [http://d.hatena.ne.jp/perlcodesample/20110904/1319005796:title=ヘルパーメソッドを登録する helper]

  • [http://d.hatena.ne.jp/perlcodesample/20110903/1319005554:title=パラメーターをマージする merge_param]

  • [http://d.hatena.ne.jp/perlcodesample/20110907/1319006732:title=DBIx::Customオブジェクトを生成する new]

Example

  • [http://d.hatena.ne.jp/perlcodesample/20110620/1310369955:title=テーブルの存在を確認する]

Clone this wiki locally