queryflatfile
3.1.0

queryflatfile 은 PHP로 작성된 플랫 파일 데이터베이스 라이브러리입니다. 기본적으로 JSON 형식으로 데이터를 저장하고 txt , msgPack 및 igbinary 형식도 지원합니다. SQL 구문과 유사한 QueryBuilder를 사용하여 데이터를 조작합니다.
| 버전 PHP | queryflatfile 3.1.x |
|---|---|
| <= 7.1 | ✗ 지원되지 않음 |
| 7.2 / 7.3 / 7.4 | ✓ 지원됨 |
| 8.0 / 8.1 / 8.2 | ✓ 지원됨 |
txt ,json ,필요한 최소 메모리 양은 처리하려는 데이터 양과 작업 유형에 따라 다릅니다.
데이터를 저장할 디렉터리의 파일을 쓰고 읽을 수 있는 권한입니다.
Composer를 통해 queryflatfile 설치하려면 설치 프로그램이나 바이너리 파일 Composer가 있어야 합니다.
프로젝트 디렉터리로 이동하여 명령 프롬프트를 열고 다음 명령을 실행합니다.
composer require soosyze/ queryflatfile --no-dev또는 바이너리 파일을 사용하는 경우,
php composer.phar require soosyze/ queryflatfile --no-dev require __DIR__ . ' /vendor/autoload.php ' ;
use Soosyze queryflatfile Schema ;
use Soosyze queryflatfile Request ;
use Soosyze queryflatfile TableBuilder ;
use Soosyze queryflatfile Driver Json ;
$ sch = new Schema ( __DIR__ . ' data ' , ' schema ' , new Json ());
$ req = new Request ( $ sch );
$ sch -> createTableIfNotExists ( ' user ' , function ( TableBuilder $ table ): void {
$ table -> increments ( ' id ' )
$ table -> string ( ' name ' )
$ table -> string ( ' firstname ' )-> nullable ();
});
$ req -> insertInto ( ' user ' , [ ' name ' , ' firstname ' ])
-> values ([ ' NOEL ' , ' Mathieu ' ])
-> values ([ ' DUPOND ' , ' Jean ' ])
-> values ([ ' MARTIN ' , null ])
-> execute ();
$ data = $ req -> select ( ' id ' , ' name ' )
-> from ( ' user ' )
-> where ( ' firstname ' , ' = ' , ' Jean ' )
-> fetch ();
print_r ( $ data );
$ sch -> dropTableIfExists ( ' user ' );위의 예는 다음과 같이 출력됩니다.
Array
(
[id] => 2
[name] => DUPOND
)
개요
dropSchema() ,getIncrement( string $tableName ) ,getSchema() ,getTableSchema( string $tableName ) ,hasColumn( string $tableName, $columnName ) ,hasTable( string $tableName ) ,setConfig( string $host, string $name = 'schema', DriverInterface $driver = null ) .테이블 취급
alterTable( string $tableName, callable $callback ) ,createTable( string $tableName, callable $callback = null ) ,createTableIfNotExists( string $tableName, callable $callback = null ) :boolean( string $name ) ,char( string $name, $length = 1) ,date( string $name ) ,dateTime( string $name ) ,float( string $name ) ,increments( string $name ) ,integer( string $name ) ,string( string $name, $length = 255) ,text( string $name ) .dropTable( string $tableName ) ,dropTableIfExists( string $tableName ) ,truncateTable( string $tableName ) .선발요청
select( string ...$columnNames ) ,from( string $tableName ) ,leftJoin( string $tableName, Closure|string $column, string $condition = '', string $value = '' ) ,rightJoin( string $tableName, Closure|string $column, string $condition = '', string $value = '' ) ,union( RequestInterface $union ) ,unionAll( RequestInterface $union ) ,orderBy( string $columnName, int $order = SORT_DESC|SORT_ASC ) ,limit( int $limit, int $offset = 0 ) .집행요청
insertInto( string $tableName, array $columnNames ) ,values( array $rowValues ) ,update( string $tableName, array $row ) ,delete() ,execute() 데이터의 삽입, 수정, 삭제를 수행합니다.쿼리 결과
fetch(): array 쿼리의 첫 번째 결과를 반환합니다.fetchAll(): array 쿼리의 모든 결과를 반환합니다.lists( string $columnName, string $key = null ): array 매개변수에 전달된 열의 목록을 반환합니다.어디
where( string $columnName, string $condition, null|scalar $value ) ,orWhere( string $columnName, string $condition, null|scalar $value ) ,notWhere( string $columnName, string $condition, null|scalar $value ) ,orNotWhere( string $columnName, string $condition, null|scalar $value ) .지원되는 조건(===, ==, !=, <>, <, <=, >, >=, like, ilike, not like, not ilike)
어디
whereGroup( Closure $columnName ) ,orWhereGroup( Closure $columnName ) ,notWhereGroup( Closure $columnName ) ,orNotWhereGroup( Closure $columnName ) .어디 사이에
between( string $columnName, $min, $max ) ,orBetween( string $columnName, $min, $max ) ,notBetween( string $columnName, $min, $max ) ,orNotBetween( string $columnName, $min, $max ) .어디에
in( string $columnName, array $values ) ,orIn( string $columnName, array $values ) ,notIn( string $columnName, array $values ) ,orNotIn( string $columnName, array $values ) .Null은 어디에 있습니까?
isNull( string $columnName ) ,orIsNull( string $columnName ) ,isNotNull( string $columnName ) ,orIsNotNull( string $columnName ) .정규식
regex( string $columnName, string $pattern ) ,orRegex( string $columnName, string $pattern ) ,notRegex( string $columnName, string $pattern ) ,orNotRegex( string $columnName, string $pattern ) . 사용 예는 사용자 설명서를 참조하세요.
이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여됩니다.