Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/z-song/simpleorm
simple data Orm based on PDO
https://github.com/z-song/simpleorm
Last synced: 30 days ago
JSON representation
simple data Orm based on PDO
- Host: GitHub
- URL: https://github.com/z-song/simpleorm
- Owner: z-song
- Created: 2013-03-14T09:41:11.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-03-27T09:23:44.000Z (over 11 years ago)
- Last Synced: 2024-10-20T18:30:30.397Z (2 months ago)
- Language: C
- Size: 184 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
SimpleOrm
=========simple data Orm based on PDO
# Installing/Configuring
```
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
```
Then add
```
extension="SimpleOrm.so"
```
to your php.ini#Usage
###SimpleOrm::getInstance(PDO $pdo)
```php
query('select * from actor');
```###SimpleOrm::exec(string $query)
```php
exec('insert into actor (id, name, age)');
```###SimpleOrm::select(string $table)
```php
select('actor');
```###SimpleOrm::find(mixed)
```php
select('actor')->find();//find record where id==2
$obj->select('actor')->find(2);//find record where id in [1,2,4,5,6]
$obj->select('actor')->find([1,2,4,5,6]);
```###SimpleOrm::field(string $columns)
```php
select('actor')->field('actor_id,first_name,last_name');
```###SimpleOrm::where(string $where)
```php
select('actor')->field('actor_id,first_name,last_name')->where("where last_name='GABLE'");
```###SimpleOrm::order(string $order)
```php
select('actor')->where("where last_name='GABLE'")->order('order by first_name desc');
```###SimpleOrm::limit(int $limit[, $offset])
```php
select('actor')->where("where last_name='GABLE'")->limit(10);
//or
$obj->select('actor')->where("where last_name='GABLE'")->limit(10, 10);
```###SimpleOrm::top(int $top)
```php
select('actor')->top(10);
```###SimpleOrm::end(int $end)
```php
select('actor')->end(10);
```###SimpleOrm::insert(string $table, array $data)
```php
insert('actor', array(...));
//or
$obj->table='actor';
$obj->insert(array(...));
```