GithubHelp home page GithubHelp logo

storm's Introduction

STORM

idiorm짝퉁

테이블마다 id라는 이름의 UNIQUE 필드가 있어야 사용 가능

Configuration

ORM::configure("host", "localhost");
ORM::configure("user", "pjc");
ORM::configure("password", "1234");
ORM::configure("db", "dbname");

ORM::init();

ORM::quit();

SELECT Query

auto query = ORM::from("test");

auto result = query
  ->where("id", "foo")
  ->where("nick", "bar")
  ->select("level")
  ->find_one();
cout<<(*result)["level"];
  
auto = results = query
  ->where_raw("nick=foo")
  ->limit(5)
  ->find_many();
for(auto result : results)
  cout<<(*result)["level"]<<endl;

INSERT Query

auto query =
  ORM::from("test")->create();

query->set("id", "pjc");
query->set("nick", "anz");

(*query)["another"] = "method";

query->save();

UPDATE Query

auto query =
  ORM::from("test")
    ->where("id", "pjc0247")
    ->find_one();

(*query)["nickname"] = "anz";

query->save();

DELETE Query

auto query =
  ORM::from("test")
    ->where("id", "pjc0247")
    ->find_one();
query->remove();

auto query = 
  ORM::from("test")
    ->where("level", "1")
    ->remove();

TRANSACTION

ORM::begin();
  // do some work
ORM::commit();

if( ORM::try_begin() ){
    // do some work
  ORM::rollback();
}

storm's People

Contributors

pjc0247 avatar

Watchers

 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.