Comments (4)
Where is the full SQL query statement as example you using?
Where are you getting this execution info from?
Anyway, this library main focus is using the CRUD shortcut methods, not actually writing full SQL statements by hand. It's really not concerned about the actual underlying database. One set of statements with any vendor.
Look over the tests folder, see if any of them results in the same behavior.
from ezsql.
Hello, thanks for the quick reply.
Here is the full SQL query statement example with PHP:
<?php
require 'vendor/autoload.php';
use ezsql\Database;
define( 'DB_NAME', 'mydb' );
define( 'DB_USER', 'root' );
define( 'DB_PASSWORD', 'password');
define( 'DB_HOST', '127.0.0.1' );
$db = Database::initialize('mysqli', [DB_USER, DB_PASSWORD, DB_NAME, DB_HOST], 'db1');
$result = $db->get_var("SELECT COUNT(cid) FROM customer");
print_r($result);
And here's the result when I use SET GLOBAL general_log = 'ON';
(this is where I'm getting the exeuction info from)
2023-01-04T03:47:30.513881Z 1669 Connect root@localhost on mydb using TCP/IP
2023-01-04T03:47:30.514375Z 1669 Query SET NAMES utf8
2023-01-04T03:47:30.514583Z 1669 Init DB mydb
2023-01-04T03:47:30.514750Z 1669 Query SHOW CHARACTER SET
2023-01-04T03:47:30.516131Z 1669 Query SET NAMES 'utf8'
2023-01-04T03:47:30.516353Z 1669 Query SELECT COUNT(cid) FROM customer
2023-01-04T03:47:30.531272Z 1669 Quit
Notice the SET NAMES utf8
and SHOW CHARACTER SET
- everytime I run a SELECT I see these 2 queries. And on our production site they're the most executed query recorded.
from ezsql.
I think you will need to understand how PHP mysqli_query
function or how the internals MySQL driver works.
Check lib/Database/ez_mysqli.php
at query(), connect() and dbSelect() methods, and overwrite them.
from ezsql.
I've been trying to understand the code under lib/Database/ez_mysqli.php but I'm still not sure if it's safe to comment out / remove this code:
if ($charset != '') {
$encoding = \strtolower(\str_replace('-', '', $charset));
$charsetArray = array();
$recordSet = \mysqli_query($this->dbh, 'SHOW CHARACTER SET');
while ($row = \mysqli_fetch_array($recordSet, \MYSQLI_ASSOC)) {
$charsetArray[] = $row['Charset'];
}
if (\in_array($charset, $charsetArray)) {
\mysqli_query($this->dbh, 'SET NAMES \'' . $encoding . '\'');
}
}
From my tests on the application, everything still seems to be functioning properly.
Please advice.
from ezsql.
Related Issues (20)
- Setting Table Name and Prefix HOT 2
- Tests for JOIN needs fixing
- ezFunctions.php - Errors HOT 4
- Return 500 error while getting more than 100000 rows HOT 1
- Call to undefined function eq() HOT 3
- How to check if connection has worked? HOT 2
- Warning appears on query_prepared method. HOT 1
- Add disconnect function the can be initialized again in loop. HOT 4
- Access a query error rather than an array of errors HOT 1
- try catch with ezsql HOT 4
- Can't insert emoji in utf8mb4 table & column HOT 4
- Could SOMEone speak to ezsql lineage... HOT 1
- SQLite3: table exist while insertting HOT 6
- Deprecated: define(): Declaration of case-insensitive constants is deprecated in xxx\ezsql-3\shared\ezFunctions.php on line 189 HOT 4
- Not compatible with php 8.0 HOT 1
- $db->num_rows not working HOT 6
- lastval throws an error in postgres HOT 2
- Fatal error: Uncaught Error: Call to undefined method ezSQL_mysqli::count() HOT 1
- How to use? HOT 1
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 ezsql.