- 50,361
- 26,407
What "IDE" are you talking about?DaveC426913 said:the SQLite IDE
What "IDE" are you talking about?DaveC426913 said:the SQLite IDE
I'd hoped the SQLite would take up the server-side comms. Isn't that the point of it?PeterDonis said:What are you going to run on your server? Your client-side Javascript is talking to a server, right?
What "server-side comms" are you talking about? What "SQLite" program are you talking about?DaveC426913 said:I'd hoped the SQLite would take up the server-side comms.
The part where I download and install SQLite in my development environment.PeterDonis said:What "IDE" are you talking about?
Yes. But there are innumerable possible solutions. I can't try them all, so I'm asking questions of people who can guide me toward or way from appropriate ones.PeterDonis said:What "server-side comms" are you talking about? What "SQLite" program are you talking about?
It seems to me that you might benefit from actually trying to set up this kind of configuration so you can see for yourself what each of the pieces can and cannot do. Try setting it all up on your local machine, running whatever server you expect to run on the client's web host and surfing to it at a localhost address. Then add the "SQLIte" piece and see what you can and can't make it do.
The "SQLite" you download is a standalone program that runs on your local machine. It has no "comms" with anything.DaveC426913 said:The part where I download and install SQLite in my development environment.
Yes, an sqlite database file on your local machine. You would then have to upload it to your client's web host and tell the web host's server software (PHP with its SQLite support, I assume) where to find it. Then the web host's server software would be running code to access that file. The "SQLite" program on your local machine would be out of the picture entirely.DaveC426913 said:it gives me a prompt to create and edit tables, which - I assume - end up in a stand-alone file or files
Not really. At any rate, it seems to me that you have enough information from this thread to try the one I described locally. I have used this method many times. It really helps me to understand what all the pieces are doing and how they have to fit together.DaveC426913 said:But there are innumerable possible solutions.
This part I'm not familiar with. What kind of code does this SQLite program give you? Can you give an example? And an example of the Javascript that hooks into it?DaveC426913 said:along with code to handle CRUD that my JavaScript hooks into
I can't. I'm not there yet.PeterDonis said:This part I'm not familiar with. What kind of code does this SQLite program give you? Can you give an example? And an example of the Javascript that hooks into it?
Well, you know more than I do about the "code to handle CRUD" that the SQLite tool you describe gives you. Even if you can't give a specific example for this application, some general information would help. Does it give you SQL statements? C code? Javascript? Something else?DaveC426913 said:I'm still at the 30,000 foot level of assessing if this is the tool to do what I want. And that's why I'm here asking those who know more.
Which specific SQLite IDE are you using? There seem to be a number of them available.DaveC426913 said:The part where I download and install SQLite in my development environment.
Yes of course.PeterDonis said:Yes, an sqlite database file on your local machine. You would then have to upload it to your client's web host
Ok so this sounds like SQLite is ONLY a database, and does not provide any inherent server-side layer that would normally be implemented in PHP for example.PeterDonis said:and tell the web host's server software (PHP with its SQLite support, I assume) where to find it.
You want something to run on a web host that is not dependent on the web host? This is an impossible dream. But dependency on the client's web host is actually a good thing because it means that they are responsible for all of the boring bits of system admin that you don't want to worry about. All you need to do is make sure that you only depend on what every web host provides i.e. a current version of PHP (which includes a sqlite driver).DaveC426913 said:Dependency on my (or any) particular webhost's offerings is exactly what I am hoping to avoid. I want my app encapsulated and portable so it won't matter where it ends up. Ideally, it'll end up on my client's website, and I don't want to be responsible for collaborating with their hosts to set it up.
You seem to be thinking that you can access files or processes on the server as a local Linux (or Windows) user from a remote Javascript client. You can't, the client can only access scripts installed on the server via the web server which will always run as the same user (often www-data). You need to manage permissions via the server script (or possibly using HTTP basic authentication, but this would be clunky). This could be by checking for a "secret" key in a JavaScript Fetch request header (for standardization use an OAuth Bearer token https://www.oauth.com/oauth2-servers/differences-between-oauth-1-2/bearer-tokens/), although this is not a very secure solution.DaveC426913 said:Currently, that's entirely folder-based permissions - which is simple enough that every webhost has it and can be trivially configured.
There could be many reasons for this: I'm not sure that "PHP and MySQL are inherently horrible" is one of them.DaveC426913 said:My own web portal is built in hand-rolled PHP and mySQL db. I just hate it.
This is all correct, butDaveC426913 said:The part where I download and install SQLite in my development environment.
Among other things, it gives me a prompt to create and edit tables, which - I assume - end up in a stand-alone file or files
this is not correct. All you can do with a web browser is send HTTP requests to a server. You have to write the CRUD code (as well as code to authenticate the request) in a language that is available in the web server environment. Almost all web hosts provide PHP which has a driver to access the sqlite database file you have uploaded built in (since some version that was EOL years ago). Some web hosts also enable persistent Python and/or Node JS processes so you can use a framework like Django or Express if you really don't like PHP.DaveC426913 said:- along with code to handle CRUD that my JavaScript hooks into
$JSONdb = file_get_contents('database.json');
$db = json_decode($JSONdb);
$newValues = $_POST['new-values']; // This should be sanitized
/* manipulate the $db object (or array) as you wish to update it with $newValues */
$updatedJSONdb = json_encode($db);
file_put_contents('database.json', $updatedJSONdb);
Indeed: I had already suggested this in #5.jack action said:It seemed you did not want a server - doing everything in Javascript - so I thought everything was done on a local machine, within a browser. This is why I gave the solution in post #20.
No, the OP seems to have decided that sqlite (which implements the essential parts of SQL without requiring a daemon to be installed on the server, which the web host would almost certainly not allow) is the way to go.jack action said:Now it seems you have a central server. I'm assuming the client's web browsers are fetching your JSON database every time they make a request to the website.
How very Web 1.0jack action said:If that is the case, your server must have some kind of CGI (it may be PHP, but it could be Perl, Python, etc.). All you have to do is to create that JS file that can define the values to update the JSON "database" and send the modified values with a form to your server
No need (and how would each client know which version to ask for?), just set headers in the response to prevent browser caching.jack action said:Some kind of URL renaming for the JSON file should be done such that anyone requesting it gets a fresh copy (something like /database.json?version=1.2).
The SQLite project itself would not, but the PHP project might. The SQLite project just provides the library written in C and with a C interface. (The sqlite Python bindings, for example, are maintained by the Python project, not the SQLite project.)DaveC426913 said:this sounds like SQLite is ONLY a database, and does not provide any inherent server-side layer that would normally be implemented in PHP for example.
This is going to be true for anything you run on a web host. That's inherent in how web hosts work. Don't you already have the same issue with the web host code you are running that displays things geographically for the client?DaveC426913 said:I'm still stuck having to deal with the headache of a dependency on the web host particulars.
Taking that at face-value, I disagree. Plenty of websites are built - with quite complex content, graphics and interactivity that the web host has no involvement in except as a vessel.pbuk said:You want something to run on a web host that is not dependent on the web host? This is an impossible dream.
I am responsible for setting all that up. And that get a lot headachier when it's not my web host but my client's.pbuk said:But dependency on the client's web host is actually a good thing because it means that they are responsible for all of the boring bits of system admin that you don't want to worry about.
No I do not.pbuk said:You seem to be thinking that you can access files or processes on the server as a local Linux (or Windows) user from a remote Javascript client.
I think that is correct. More precisely, I think there are two issues here:DaveC426913 said:I am getting the message that I am wrong about what SQLite can do for me.