Code Monkey home page Code Monkey logo

doclite's Introduction

doclite's People

Contributors

awilum avatar dwgebler avatar igusev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

doclite's Issues

unfinit class not found issue

@dwgebler @Awilum @iGusev

Hi,

I am trying to give doclite a try, but unfortunately I cant get it setup

it keeps asking for uncaught class, when I reference it, it just shows another one, and so

Uncaught Error: Class 'Gebler\Doclite\Connection\DatabaseConnection' not found in

can you give me pls, a functional example, from referencing to save and get ?

kindest regards

doclite returns nothing if searched data contains /

Hi @dwgebler

when trying to fetch data with "/" it returns nothing, I've tried to escape it, but nothing retruned

[email] => eJxLzs8rSUwucUjOz0ut0EupAgA2mAZW this works when querying with
[website] => eJwrLy/XS87PS63QS6kCAB9bBL0= this returns nothing when querying with that data

any help

doclite built in functions

Hi Doclite,

thank you for the awesome library,

is there any built-in function for example to get the count of documents in a collection, and such functions? (like the last id)

if not, is there any high-performance solution to do it, rather than querying all the documents and calculating the array count

regards

Badly written docs

You have a good library but the read me docs is very bad.

The documentation is badly written... Its not easy for a beginner to understand at all...

You did not differentiate between a document and collection... You are using document as same as collection thereby confusing the reader or user

  1. You did not specify or show how data can be added to collections. You just kept pointing out methods that no one even understands where they are from...

Please Take a good look at this documentation for couchbase https://php-on-couch.readthedocs.io/. You will see how the designer highlighted each methods and showed how to insert data properly with expected output.

Your readme does not show how to process the output which is very poor...

It will be good if you can make a change to this. Thanks.

shoutout to Doclite

I really thank you for the effort and the awesome lib, I hope it gets the credit it merits, and see it as a big volume database adopted by the mass.

regards

README.md import/export modes constants

Hi!
A tiny thing.
In readme.md, 'Import and export data' section:
These constants throw exceptions:

Database::EXPORT_COLLECTIONS;
Database::EXPORT_DOCUMENTS;

These work fine:

Database::MODE_EXPORT_COLLECTIONS;
Database::MODE_EXPORT_DOCUMENTS;

Anyway, thanks a lot for DocLite.

any doclite news

Hi @dwgebler

grateful for y ou library, and wondering is there is any news or coming features ?

kindest regards

extensive documentation for doclite

Hi @dwgebler

I find it difficult to manipulate it easily in some scenarios, otherwise it's super cool,

also, if you do have extensive documentation of the library, it will be better to read it and study it further and reduce the questions posted.

kindest regards

how to do condition on join table

@dwgebler Hi

how to do condition query on joined table

foreach($merchantCollection->where('__id', '!=', "")->join($appsCollection, "merchant_hid","_hid")->and('_id', '=', 2)->fetch() as $merchantArr) {

I want to apply this ->and('_id', '=', 2) on the second table $appsCollection

didn't work for me

malformed json, when docliteid contains '\'

This might not be a bug:

If the document id contains \, the document won't save. I'm using a custom entity object class and using collection->save($obj) to save the object.

In DatabaseConnection.php line 219:

  Error executing query


In DatabaseConnection.php line 214:

  SQLSTATE[HY000]: General error: 1 malformed JSON

Check for JSON1 fails on newer versions of SQLite?

First of all: thanks for this great library! I'm afraid I have run into an issue, though ๐Ÿ˜

I work on a Mac. It has SQLite 3.39.5 installed. When I try to use Doclite, I get the following error:

Fatal error: Uncaught Gebler\Doclite\Exception\DatabaseException: DocLite requires SQLite3 to be built with JSON1 extension in {project_path}/vendor/dwgebler/doclite/src/Connection/DatabaseConnection.php:486

However, as far as I can see, the JSON functions in SQLite are bundled into core from version 3.38.0 onwards. So, they are present in my version of SQLite, even though the extension appears not to be there.

The error seems to be thrown here:

$compileOptions = $this->conn->query('PRAGMA compile_options')->fetchAll(PDO::FETCH_COLUMN);
if (!in_array('ENABLE_JSON1', $compileOptions)) {
$ex = new DatabaseException(
'DocLite requires SQLite3 to be built with JSON1 extension',
DatabaseException::ERR_NO_JSON1
);
$this->logException($ex);
throw $ex;
}

If I remove the check which is done on these lines, Doclite works as expected. Which confirms that the JSON functions are bundled in my version of SQLite, but they are simply not detected by Doclite, because the JSON1 extension is no longer needed when the SQLite version is higher than 3.38.0.

I'm not sure what a fix would look like. Maybe check the SQLite version as well? Or look for the DSQLITE_OMIT_JSON mentioned in the docs page?

Cheers!

Problem querying floating point number fields with where.

If you have a floating point number in a document you can't query it using where

$doclite = new FileDatabase('database.db');
$products = $doclite->collection('products');

$product = $products->get();
$product->name = 'Product 1';
$product->price = 10.50;
$product->save();

// Outputs 1
echo iterator_count($products->findAllBy(['price' => 10.50])) . "\n";

// Outputs 0
echo $products->where('price', '=', 10.50)->count() . "\n";

column data issue with nested rows or JOIN

Hi @dwgebler

I have a weird issue,

I save encrypted data, in 2 tables, related by ID

when fetching the rows individually, without JOIN, and decrypting data, it works

when, JOIN the two tables, and decrypt the main row, it decrypt well,
but when, decrypting the joined rows, it does not !!!

when I copy past the row field data, and decrypt it, it decrypt, but when decrypt it in loop it does not

// this works

$appArr = $appsCollection->findOneBy([
    "_sts" => 1,
]);

$app = $appArr->toArray();

$app["api_id"]                        = decryptData($app["api_id"]);

echo "<pre>";
print_r($app);
echo "</pre>";

// this works partially !!!

foreach($merchantCollection->where('__id', '!=', "")->join($appsCollection, "merchant_hid","_hid")->fetch() as $merchantArr) {
$merchant2 = $merchantArr->toArray();

    $merchant2["merchant_user2"]                 = decryptData($merchant2["merchant_user2"]); // this works well

    foreach ($merchant2["apps"] as $key => $value) {

        $merchant2["apps"][$key]["api_id"]                        = decryptData($value["api_id"]); // this does not work

    }
    
    echo "<pre>";
    print_r($merchant2);
    echo "</pre>";
}

critical issue when inserting crash

Hi @dwgebler

there is a serious issue when for example trying to generate a long list of arrays, and the server goes down for any reason, the database became unusable !! and can't retrieve data, this is what I get, when trying to get a full list of records,

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 5 database is locked in \vendor\dwgebler\doclite\src\Connection\DatabaseConnection.php:281 Stack trace: #0 \vendor\dwgebler\doclite\src\Connection\DatabaseConnection.php(281): PDO->exec('DELETE FROM "us...') #1 \vendor\dwgebler\doclite\src\Database.php(935): Gebler\Doclite\Connection\DatabaseConnection->exec('DELETE FROM "us...') #2 \vendor\dwgebler\doclite\src\Collection.php(402): Gebler\Doclite\Database->getCache('users_cache', 'dqlQuery', '085a8b0e3654018...', Object(DateTimeImmutable)) #3 [internal function]: Gebler\Doclite\Collection->getCache('dqlQuery', Array) #4 \vendor\dwgebler\doclite\src\Collection.php(340): Generator->current() #5 [internal function]: Gebler\Doclite\Collection->executeDqlQuery('SELECT COUNT (D...', Array, true) #6 \vendor\dwgebler\doclite\src\QueryBuilder.php(248): Generator->current() #7 \vendor\dwgebler\doclite\src\Collection.php(967): Gebler\Doclite\QueryBuilder->count() #8 bench.php(119): Gebler\Doclite\Collection->count() #9 bench.php(30): generateUsers() #10 {main} Next Gebler\Doclite\Exception\DatabaseException: Error executing statement in \vendor\dwgebler\doclite\src\Connection\DatabaseConnection.php on line 290

any thoughts, and how can avoid this issue in the future, I am benchmarking the library to decide which I will use it an important project for me, and don't want to get stuck in the future and can't resolve it.

and thank you again for the awesome library, I am a pro nosql databases to a high level
regards

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.