Encerrado

Flexible flat file database

a PHP class that? uses SQLite as a repository for key=>value arrays. arrays may have some keys in common, but there is no? preconceived schema.

the class must allow for retrieval of arrays in methods similar to sql SELECT WHERE (accepting ORDER BY and? LIKE and also? common operators such as >, <, =, <> etc.). arrays not containing the keys? in the? SELECT? will not be returned.

## Deliverables

enclosed is the skeleton for the class that is reuired, please contact me for further elaboration:

<?php

class generic_repository{

? ? ? public $DB; // this is the path of the sqlite database to use, if it does not exist, the class will create it and enforce whatever schema necessary, if it is not set, class is inactive and throws exceptions when methods are called

? ? ? function insert($array){

? ? ? ? ? ? ? // this function will insert $array into the db and return the id of the inserted array

? ? ? ? ? ? ? // all objects sent to this function are guaranteed NOT to have an 'id' field, this field should be added upon insert and should be a unique string of 8 random alphanumeric characters

? ? ? }

? ? ? function delete($where, $delete_multiple=true){

? ? ? ? ? ? ? // this function understands the 'where' clause in standard SQL syntax

? ? ? ? ? ? ? // if and only if $delete_multiple=false, this function may delete multiple records, if an attempt is made to delete multiple records with this flag set to 'true', method will throw an exception

? ? ? }

? ? ?

? ? ? function update($where, $array, $delete_multiple=true){

? ? ? ? ? ? ? // this function understands the 'where' clause in standard SQL syntax

? ? ? ? ? ? ? // if and only if $delete_multiple=false, this function may update multiple records, if an attempt is made to update multiple records with this flag set to 'true', method will throw an exception

? ? ? ? ? ? ? // $array contains key=>value pairs to be updated in the record

? ? ? ? ? ? ? // fields not contained in $array are left untouched

? ? ? }

? ? ?

? ? ? function get($where, $order_by, $offset=0, $limit=0){

? ? ? ? ? ? ? // this function understands the 'where' clause in standard SQL syntax

? ? ? ? ? ? ? // function returns a list of arrays that match the criteria

? ? ? ? ? ? ? // syntax for $order_by is '<field_name> <direction>' - for example: 'name asc' or 'date desc'

? ? ? ? ? ? ? // $offset and $limit work as expected in SQL

? ? ? }

}

?>

Habilidades: Engenharia, Linux, MySQL, PHP, Gestão de projetos, Arquitetura de software, Teste de Software, SQL, Hospedagem Web, Gestão de Site , Teste de Website

Ver mais: string match, set of pairs, schema update, return path, repository.db, match string, common string, asc it, create a flat, function delete php flat file, select list flag, insert multiple records, php file array, use string offset, update sql file, php select insert sql, php random file name, skeleton php, flat php, return file, php flat, repository database, php use string offset array, use string offset array php, database sqlite

Acerca do Empregador:
( 0 comentários ) Israel

ID do Projeto: #3060262

2 freelancers estão ofertando em média $71 para este trabalho

tatasthuinfotech

See private message.

$127.5 USD in 14 dias
(13 Comentários)
3.3
vw7254142vw

See private message.

$13.6 USD in 14 dias
(6 Comentários)
0.0