定制 sibertec/data 二次开发

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

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

sibertec/data

最新稳定版本:2.03

Composer 安装命令:

composer require sibertec/data

包简介

Sibertec.Data is a small, easy to use PHP library that manages connections to MySQL databases, and also can act as an Object Relational Mapper.

README 文档

README

Sibertec.Data is a small, easy to use PHP library that manages connections to MySQL or SQLite databases, and also can act as an Object Relational Mapper.

How to Use

The data settings are read from a YAML file.

You can either pass the path to the YAML file to the constructor, or set the path in a global variable, $sibertec_settings_file;

The settings can be in a file with other settings, or in a YAML file by themselves.

For MySQL data, use the following example.

database:
  driver: MySQL
  server: localhost
  database: your_database
  user: your_username
  pwd: your_password

For SQLite data, use the following example. Only the local file system is supported.

database:
  driver: SQLite
  server: local_file_system
  database: /path/to/your/data_file.sqlite
  user: not-used
  pwd: not-used

How to use

You can pass the full path to the SQL fiole to load, or put your SQL files in a directory, and set the location with either define('SQL_DIR', '/path/to/sql'); or $sibertec_sql_dir = '/path/to/sql';.

Load an object from the database using a SQL file.

$sibertec_settings_file = '/var/www/sites/your-site/settings.yaml'
$sibertec_sql_dir = '/var/www/sites/your-site/sql';

$db = AppData::MainDatabase();

$obj = SqlHelper::SqlFileToScalarObject('get_one.sql', $db);

Execute a SQL statement;

$sibertec_settings_file = '/var/www/sites/your-site/settings.yaml'

$db = AppData::MainDatabase();

$db->run_sql("delete from your_table where id < 101");

Execute a SQL statement, returning an integer;

$sibertec_settings_file = '/var/www/sites/your-site/settings.yaml'

$db = AppData::MainDatabase();

$val = $db->execute_scalar_int("select count(*) from your_table");

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-06-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固