定制 derilkillms/pdo-orm 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

derilkillms/pdo-orm

最新稳定版本:1.04

Composer 安装命令:

composer require derilkillms/pdo-orm

包简介

orm connection with pdo driver

README 文档

README

Instalation

composer require derilkillms/pdo-orm

Information

About ORM : (wikipedia) Object–relational mapping (ORM, O/RM, and O/R mapping tool) in computer science is a programming technique for converting data between a relational database and the heap of an object-oriented programming language. This creates, in effect, a virtual object database that can be used from within the programming language.

....

This Repository Based : PHP

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbdriver  = 'pdo';
$CFG->dbtype    = 'mysql'; //mysql or pgsql
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'YOUR_DB_NAME';
$CFG->dbuser    = 'root';
$CFG->dbpass    = '';
$CFG->prefix    = 'd_';

require_once(__DIR__ .'/vendor/autoload.php'); // add derilkillms/pdo-orm/Database.php if not autoloaded

use Derilkillms\PdoOrm\Database;

$DB = new Database();

Use query sql

$users = $DB->get_records_sql("SELECT * FROM {users} where city=?",array('ciamis')); //for get rows data 

$user = $DB->get_record_sql("SELECT * FROM {user} where id=?",array(1)); // for get row data / one data 

$user = $DB->execute("DELETE FROM {user} WHERE id=?",array(1)); // for execute query like insert update delete

DML simple query

//intialize key and value with object
$data = new stdClass();
$data->name = 'test';
$data->value = 'test';
//insert record
$insert =  $DB->insert_record('table', $data);


$data = new stdClass();
$data->id = 1; //id params is important for update
$data->name = 'tests';
$data->value = 'tests';
//update record
$update =  $DB->update_record('table', $data);
//delete record
$delete = $DB->delete_record('table','id=?',array(7));

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-20