PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Jul 05, 2020 6:35 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Basic SQL Interpreter
PostPosted: Sun May 11, 2008 7:12 am 
Offline
Forum Newbie

Joined: Sun May 11, 2008 7:05 am
Posts: 5


Top
 Profile  
 
PostPosted: Fri May 16, 2008 12:55 pm 
Offline
DevNet Resident
User avatar

Joined: Sun Sep 03, 2006 5:19 am
Posts: 1579
Location: Sofia, Bulgaria
I'm sorry, but I fail to see the purpose. Can you describe some usage scenarios? (No comments on the security, I haven't even scanned the code yet)


Top
 Profile  
 
PostPosted: Sat May 17, 2008 5:11 am 
Offline
Forum Newbie

Joined: Sun May 11, 2008 7:05 am
Posts: 5
The idea, to allow SQL manipulation of php arrays.
If you believe this has no true purpose, are there better alternatives, or should array manipulation just be done with several functions specifically each time.


Top
 Profile  
 
PostPosted: Sat May 17, 2008 5:32 am 
Offline
Jedi Mod
User avatar

Joined: Tue Dec 21, 2004 6:03 pm
Posts: 5263
Location: usrlab.com
I can imagine it'd be useful if you store large quantities of data in a PHP array ... but to be honest I never do that.


Top
 Profile  
 
PostPosted: Sat May 17, 2008 9:18 am 
Offline
DevNet Resident
User avatar

Joined: Sun Sep 03, 2006 5:19 am
Posts: 1579
Location: Sofia, Bulgaria
You are reinventing, if not the wheel, then at least the database. There are already enough database solutions, the world doesn't need a PHP-based one. And don't explain your rationale for developing an SQL-over-array database with "to allow SQL manipulation of php arrays" - okay, I will believe you what the code does. What I asked was "why".


Top
 Profile  
 
PostPosted: Sat May 17, 2008 10:12 am 
Offline
Forum Newbie

Joined: Sun May 11, 2008 7:05 am
Posts: 5
I appologise for not answering your question.

Why, would be to extend the use of SQL queries to PHP arrays, this is of use to myself in that I use several means of data storage, for systems without access to proper databases, I was not intending to reinvent a data storage medium, just possibly enhance the manipulation of it. The contained PHP arrays are for example only, and could be the result of any number of data storage systems.

Currently I am making great use of CSV based storage, and occasionally allowing a user to build their data storage by adding a text based file (or even 'drag and drop'-ing pictures into album folders with a simple metadata plaintext file) to a simple directory structure has been useful.

My hope was that this interpretation of manipulation strings could simplify the process further.

The reason for posting this code was to know what people thought of the idea (not necessarily new) or the functionality, and I appreciate your feedback. Would you suggest all users without true database systems available should transfer to hosts providing such to enable CMS systems, blogs, wikis, albums? (!! I am aware that this functionality is already available, the interpreter would merely be to simplify manipulation).

Thanks, Seb.


Top
 Profile  
 
PostPosted: Sat May 17, 2008 12:18 pm 
Offline
DevNet Master
User avatar

Joined: Fri Jan 18, 2008 1:36 am
Posts: 3549
Location: Israel, ME
There is database-less database solution for PHP, it's called SQLite .


Top
 Profile  
 
PostPosted: Sat May 17, 2008 1:59 pm 
Offline
DevNet Resident
User avatar

Joined: Sun Sep 03, 2006 5:19 am
Posts: 1579
Location: Sofia, Bulgaria
Databases solve, often invisibly to the unexperienced user (which is not to say that you specifically are unexperienced) many problems which I doubt you have had the chance to address (but I still haven't checked your code, so you might have). File-based solutions work well on the development machine, and fail in unpredictable ways in the production environment. SQL queries in modern databases are well optimized before executing, so it's harder for the user to shoot himself in the foot. PHP itself is not well suited for handling huge datasets, while a natively compiled code will work much better on natively represented data.

Also, there are no systems without a database (any such you can point out is just statistical error ;) )

So, in short, I think it's a great intellectual exercise, but it has little practical value even on paper (and it will get no better when implemented in code).

@pytrin: SQLite is a regular database, just has fewer features and tighter storage. So is sebble_dot's project. A database is just organised storage (with an optional SQL interface, if you so insist)


Top
 Profile  
 
PostPosted: Sat May 17, 2008 2:35 pm 
Offline
Forum Newbie

Joined: Sun May 11, 2008 7:05 am
Posts: 5
@pytrin: Thanks, I'll have a look at SQLite in a bit more detail. Seb


Top
 Profile  
 
PostPosted: Sat May 17, 2008 3:08 pm 
Offline
DevNet Master
User avatar

Joined: Fri Jan 18, 2008 1:36 am
Posts: 3549
Location: Israel, ME
@Mordred:
SQLite is not like a regular database, in the sense that it doesn't have a separate server process - meaning it does not require an SQL database engine to be running as service on the server for it to work. I think this is what sebble was looking for.


Top
 Profile  
 
PostPosted: Sat May 17, 2008 3:55 pm 
Offline
Forum Newbie

Joined: Sun May 11, 2008 7:05 am
Posts: 5


Top
 Profile  
 
PostPosted: Sat May 17, 2008 4:33 pm 
Offline
DevNet Master
User avatar

Joined: Fri Jan 18, 2008 1:36 am
Posts: 3549
Location: Israel, ME
Can't you send a request to your server's NOC asking them to activate the php_sqlite module? We ask those kind of things all the time (hosted at servInt) and they usually follow through.


Top
 Profile  
 
PostPosted: Sat May 17, 2008 10:19 pm 
Offline
DevNet Resident
User avatar

Joined: Sun Sep 03, 2006 5:19 am
Posts: 1579
Location: Sofia, Bulgaria
Ah, so you both meant a database server.
I still can't think of any particular benefit for web development to use a built-in database versus a database server. Local sockets are fast, there is support for in-memory tables... No really, can you give one example where SQLite or sebble_dot's project will be better?


Top
 Profile  
 
PostPosted: Sun May 18, 2008 7:21 pm 
Offline
DevNet Master
User avatar

Joined: Fri Jan 18, 2008 1:36 am
Posts: 3549
Location: Israel, ME
Don't get me wrong, I believe a database server such as MySQL is a superior solution and would always choose that given the choice. He asked about a specific database implementation (re: SQL parser) so I thought SQLite might be a good alternative.


Top
 Profile  
 
PostPosted: Thu Mar 11, 2010 11:02 am 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6446
Location: 53.01N x 112.48W
Sounds like you've written something like Linq ()

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group