ThreeLetters / SuperSQL

A light, efficient and powerful php sql database framework. Allows you to quickly and securely develop anything using sql databases.
https://threeletters.github.io/SuperSQL/
MIT License
13 stars 5 forks source link

Get not working #8

Closed ezetojo closed 6 years ago

ezetojo commented 6 years ago

Call to undefined method SuperSQL\SuperSQL::get()

Andrews54757 commented 6 years ago

@ezetojo https://github.com/ThreeLetters/SuperSQL/blob/master/SuperSQL/helper.php#L182

The get method is only available for the helper class. To use the helper class, just replace the new SuperSQL\SuperSQL(/* args */) to new SuperSQL\SQLHelper(/* args */)

In addition, you must have it included by using this file. Or, you can also use this smaller file, which has everything, so you do not need two files.

Andrews54757 commented 6 years ago

@ezetojo Also, it is not recommended to use the get method. You can use this instead, and it will have better performance. This is because the get method gets all the rows (If your database does not support LIMIT such as SQL Server or MSAccess), and then selects one, but if you use this syntax, only the first row will be retrieved from the server.

$dt = $db->select("users", ["*"], ["id"=>"oeid389hdjwsjhd"], null, 1); // Query only 1 row

$first = $dt[0]; // Only get first row (Even when LIMIT is not supported), When you use this, only the first row is retrieved - So it is really fast.
ezetojo commented 6 years ago

Thank you @Andrews54757. I'll try.