定制 seiryow/db-php 二次开发

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

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

seiryow/db-php

Composer 安装命令:

composer require seiryow/db-php

包简介

PDO wrapper which enable to use Relational DataBase without SQL.

关键字:

README 文档

README

PDO wrapper

index.php

//CONNECT DB
//SQLITE
$dbtype = "sqlite";
$dbname = "./test.db";
$table = "test";
$test = new DB($dbtype, $dbname, $table, null, null);

////MYSQL
//$dbtype = "mysql";
//$host = "localhost";
//$dbname = "test";
//$table = "testtbl";
//$user = "root";
//$pass = "";
//$test = new DB($dbtype, "host={$host};dbname={$dbname}", $table, $user, $pass);

//CREATE TABLE
$schema = array ();
$schema["testint"] = "INTEGER";
$schema["testtxt"] = "TEXT";
$test->create($schema);

//INSERT
$data = array ();
$data["testint"] = 123;
$test->insert($data);
$data["testint"] = 456;
$data["testtxt"] = "abc";
$test->insert($data);
$data["testint"] = 456;
$data["testtxt"] = "xyz";
$test->insert($data);
$data["testint"] = 789;
$data["testtxt"] = "def";
$test->insert($data);

//SELECT ALL
$r = $test->selectAll();
//dump($r);

//SELECT
$where = array ();
$where["testint"] = 456;
$r = $test->select($where);
//dump($r);

//UPDATE
$where = array ();
$update = array ();
$where["testint"] = 789;
$update["testtxt"] = "ghi";
$test->update($update, $where);

$r = $test->select($where);
//dump($r);

$test->insert($data);
$r = $test->selectAll();
//dump($r);
//SELECT by LIKE
$where = array ();
$where["testtxt"] = array (
	"like" => "b"
);
$r = $test->select($where);
//dump($r);

//SELECT with AND
$where = array ();
$where["testint"] = 456;
$update["testtxt"] = "xyz";
$r = $test->select($where);
//dump($r);

//SELECT with OR
$where = array ();
$where["testtxt"] = array (
	"" => "abc",
	"" => "xyz"
);
$r = $test->select($where);
//dump($r);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2014-01-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固