Giter VIP home page Giter VIP logo

pgsqldb.class.php's Introduction

pgsqlDB.class.php

postgre sql wrapper

Methods

<?php
connect(); \\ create database connection

close(); \\ close database connection

query($query_string); \\ send query request 

fetch_array($query_id); \\ get query result row

item($query_string, $key = null); \\ return first row of query result or return property value of first row, if $key argument is not null

table($query_string, $key_index_name = null, $value_index_name = null); \\ return array of query result rows. If key_index_name is not null, then each index of each array item will assigned to value by $key_index_name from current row, if $value_index_name is not null, then each item will contain property value from current_row

escape($string); \\ escape string value 

affected_rows(); \\ return number of affected rows in last query

last_insert_id(); \\ return identity value of last insert query

tree($query_string); \\ return nested array(tree), built from the query (per one request). $result[0] - will contain rooted element, each tree node has 'childs' property (contain Array of childs), each tree branch is available by address $result[$node_id].
?>

mssqlDB.class.php

ms sql wrapper

Methods

<?php
connect(); \\ create database connection

close(); \\ close database connection

query($query_string); \\ send query request 

fetch_array($query_id); \\ get query result row

item($query_string, $key = null); \\ return first row of query result or return property value of first row, if $key argument is not null

table($query_string, $key_index_name = null, $value_index_name = null); \\ return array of query result rows. If key_index_name is not null, then each index of each array item will assigned to value by $key_index_name from current row, if $value_index_name is not null, then each item will contain property value from current_row

escape($string); \\ escape string value 

affected_rows(); \\ return number of affected rows in last query

last_insert_id(); \\ return identity value of last insert query

tree($query_string); \\ return nested array(tree), built from the query (per one request). $result[0] - will contain rooted element, each tree node has 'childs' property (contain Array of childs), each tree branch is available by address $result[$node_id].
?>

Example

<?php
$db_conf = array(
  'host' => '127.0.0.1',
  'user' => 'root',
  'password' => 'root',
  'port' => '3456',
  'db_name' => 'test'
);
$db = new PgsqlDB($db_conf);
$i = $db -> item('SELECT * FROM table1');
?>

pgsqldb.class.php's People

Contributors

ggpc avatar

Watchers

xuhaifu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.