Comments (3)
I need to update the README, but you can use the find() method on the table objects. The find() method takes two arguments. the first is the list of fields to match along with their respective values. the second is optional operator to use for each field. For example, to search an imaginary users table:
$userstable = $db->table("users");
$userstable->find(array("last_update" => date("Y-m-d", time()-24*60*60),
"username" => "someuser"),
array("last_update" => "<="));
If an operator isn't provided, then it'll default to LIKE for text columns and = for everything else. The provided values can be an array, and in that case it'll use field IN (values array here)
for the search
from json-to-mysql.
Thanks very much for the explanation. It makes much better sense.
I realised I was entering duplicates because I hadn't specified a unique ID for the JSON being inserted. The find & update worked automatically if the ID column was included.
I'm using the project to reduce times on a query which, up until now, used common_schema2.2 to extract the JSON. The difference is staggering (~75s down to ~18s). So thanks again!
from json-to-mysql.
awesome glad to hear it!
from json-to-mysql.
Related Issues (20)
- Goal 1 Notes: Create Table and Insert Data
- need to handle array (object) subdata HOT 3
- Your software doesn't work HOT 3
- DIRECTORY_SEPARATOR HOT 1
- JSON-Data won't be processed completely (ignores sub-arrays)
- Dont use PHP short tags (use <?php instead) HOT 1
- example.php does not work HOT 3
- Import nested JSON sub-arrays
- Goal 2: validate table structure
- need to handle array subdata HOT 3
- Composer package
- Example typo and bug in line 208 HOT 1
- Goal 3: Search table with JSON object
- Goal 4: Auto-Index
- handle custom primary key
- handle sub object and subsubobject data
- Validate it and remove any fields not on the table
- There is no DatabaseException class HOT 2
- DatabaseException class not found; also mysql_connect (and similar are dropped from PHP)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-to-mysql.