<commit_before>Model
=====

## Create

    $author = new Author;
    $ret = $author->create(array(
        'name' => 'Foo'
    ));

`$ret` is an operation result, you can check if this operation succeed.

To check status:

    if( true === $ret->success ) {
        echo $ret->message;   // record created
    }
    else {
        echo $ret->exception;  // exception
        echo $ret->sql;   // sql statement
        print_r( $ret->vars );   // variables that applied for PDO
    }

## Load

Load record with primary key through constructor:

    $author = new Author( 1 );

Load record with hash through constructor:

    $author = new Author( array( 
        'name' => 'John'
    ));

use load method to load record:

    $author->load( array(  
        'name' => 'John',
    ));


<commit_msg>Update model usage doc.<commit_after>Model
=====

## Create

    $author = new Author;
    $ret = $author->create(array(
        'name' => 'Foo'
    ));

`$ret` is an operation result, you can check if this operation succeed.

To check status:

    if( true === $ret->success ) {
        echo $ret->message;   // record created
    }
    else {
        echo $ret->exception;  // exception
        echo $ret->sql;   // sql statement
        print_r( $ret->vars );   // variables that applied for PDO
    }

## Load

Load record with primary key through constructor:

    $author = new Author( 1 );

Load record with hash through constructor:

    $author = new Author( array( 
        'name' => 'John'
    ));

use load method to load record:

    $author->load( array(  
        'name' => 'John',
    ));


## Update

    $author->update(array(
        'name' => 'Mary'
    ));

## Delete

    $author->load(1);
    $author->delete();


# Static Helper Functions

## Create

    $record = \tests\Author::create(array( 
        'name' => 'Mary',
        'email' => 'zz@zz',
        'identity' => 'zz',
    ));

## Load

        $record = \tests\Author::load( 1 );
        $record = \tests\Author::load( array( 'id' => $id ));

## Update

The following lines runs:

    UPDATE authors SET name = 'Rename' WHERE name = 'Mary'

    $ret = \tests\Author::update(array( 'name' => 'Rename' ))
        ->where()
        ->equal('name','Mary')
        ->execute();

## Delete

    $ret = \tests\Author::delete()
        ->where()
        ->equal('name','Rename')
        ->execute();


{'fraction_non_alphanumeric': 0.16308470290771176, 'fraction_numerical': 0.001685630004214075, 'mean_word_length': 2.1653333333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '595363', 'n_tokens_mistral': 762, 'n_tokens_neox': 722, 'n_words': 217}