About the native language that manages the DB from the source at the backend

Asked 2 years ago, Updated 2 years ago, 74 views

I've heard this recently. For example, if you write a backend with PHP, Scratch data from linked DB, save, modify, etc. The part that manages the data I heard that you squeeze it in with Python code. Even if it's not Php or Python, Can I work by inserting native language into the backend source? I'd like to learn that method if possible, do you have a link to refer to? In addition, if there is a source to refer to as an example, I would appreciate it more if you could show it with it

back-end database native

2022-09-22 12:55

1 Answers

I don't know if I understand the question well, but if you're curious about "how one backend processing script executes another script in another language," you can handle it with the system command.
Because it is impossible to mix and write languages, you have the command execution method supported by each language, and you run the script in the language you want.

PHP, for example, is roughly like this. (This is a virtual source)

// If the reservation is successful, forward the contents to the email sending daemon
if ($reservation->save()) {

    // PHP can send system commands with the exec() function.
    $error = exec('/usr/bin/python /var/pymailer/queue.py reserved '.$reservation->id);

    // If there's an error, can I show you?
    if (!empty($error)) return $error;
}

Or... If each language is operating in the form of a web server that processes requests while listening to different ports, it can also be processed by requesting in the form HTTP POST http://localhost:appropriate port/somewhat.
For example, if your websocket is implemented as Node.js and django needs to use it, you can get Node.js execution results by requesting AJAX to http://localhost:3000/maybe.


2022-09-22 12:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.