leafsphp / db Goto Github PK
View Code? Open in Web Editor NEW๐ Leaf PHP db module
Home Page: https://leafphp.dev/modules/db/
๐ Leaf PHP db module
Home Page: https://leafphp.dev/modules/db/
Db connection + documentation not extensive enough. It needs to cover popular db types like mssql and sqlite
I tried connecting my local codebase with the remote database through PDO but its not working, after that I made some changes in core.php and created a function using mysqli, and now the connection is working.
I used the same connection variables and pem files for verification
I also tried directly writing the PDO code as follows:
$clientCertPath = $_SERVER['DOCUMENT_ROOT'] . "/client-cert.pem";
$clientKeyPath = $_SERVER['DOCUMENT_ROOT'] . "/client-key.pem";
$caCertPath = $_SERVER['DOCUMENT_ROOT'] . "/server-ca.pem";
// PDO Connection options for SSL
$pdoOptions = array(
\PDO::MYSQL_ATTR_SSL_CA => $caCertPath,
\PDO::MYSQL_ATTR_SSL_KEY => $clientKeyPath,
\PDO::MYSQL_ATTR_SSL_CERT => $clientCertPath,
\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
);
Leaf DB is now the longest class with 800+ lines of code. It needs to be managed to improve performance and generally make the code easier to follow
Could not connect to sql server , I had to modify this function and add 'sqlsrv' to make it work
protected function dsn(): string
{
$dbtype = $this->config('dbtype');
$dbname = $this->config('dbname');
$host = $this->config('host');
if ($dbtype === 'sqlite') {
$dsn = "sqlite:$dbname";
}
else if ($dbtype === 'sqlsrv') {
$dsn = $dbtype.":Server=".$this->config('host');
$dsn .= ";Database=".$this->config('database');
} else {
$dsn = "$dbtype:host=$host";
if ($dbname !== '') $dsn .= ";dbname=$dbname";
if ($this->config('port')) $dsn .= ';port=' . $this->config('port');
if ($this->config('charset')) $dsn .= ';charset=' . $this->config('charset');
if ($this->config('unixSocket')) $dsn .= ';unix_socket=' . $this->config('unixSocket');
}
return $dsn;
}
How can to connect with a Microsoft Access 2000 Database?
The function db()->lastInsertId does not work with with uuid. It works fine with incremental ids
Steps to reproduce
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.