Your class really takes ezSQL to the next level. I’m a big fan of SQLite, so I’ve ported a PDO module to your improved ezSQL. You can find the source code here:
You replied so quickly! That’s wonderful!
I downloaded the latest version you have posted and it is still like that. It’s an easy fix, I just changed
public static $throw_exceptions = true;
in ezdb.class.php to:
public static $use_exceptions = true;
I have another question.
I would like to define the character encoding used in the database. There is an excellent page at http://www.stumbleupon.com/group/php/forum/37465/
He suggests using something like:
// Make sure we are using UTF-8 Character Encoding.
mysql_query(“SET NAMES ‘utf8′;”, $this->dbh);
mysql_query(“SET CHARACTER SET ‘utf8′;”, $this->dbh);
just after opening the connection to the database.
How could I incorporate this into the ezdb script most elegantly?
Hi Jackie, Thanks! I’m not too familiar with CodeIgnitor, but it doesn’t have it own database functions? If it doesn’t, I’m sure there’s a way to include external libraries
[...] ezSQL 2.0 [...]
Nice Works.!
You can add this feature?
$table_prefix =”m2_”;
$tables = array( ‘table1′ => ‘table1′,
‘table2′ => ‘menu’,
‘table3′ => ‘users’ );
$db->mapping_tables($tables,$table_prefix);
echo $db->users; // m2_table3
—————
classs db
function mapping_tables($tables = array(), $prefix=”m2_”)
{
$this->tables = $tables;
$this->prefix = $prefix;
// build the mapping with prefixes
foreach ( $this->tables as $s => $t ) {
$this->$t= $prefix .$s ;
}
}
Your class really takes ezSQL to the next level. I’m a big fan of SQLite, so I’ve ported a PDO module to your improved ezSQL. You can find the source code here:
http://github.com/jaywilliams/ultralite/raw/012e2cfeced015c4bc5658ad85e726cd1ea2780f/app/classes/Pixelpost/DB/PDO.php
You’ll probably have to make a few modifications from the source, but the bulk of it should be usable.
Hello,
How can I get the last inserted id after doing $res=DB::query(“INSERT…”);
I’ve tried with $id=DB::$insert_id; but a I get an empty value…
Thanks
I forgot to say that I use the mysqli class “ezDB_MySQLi.class.php”
Sounds like a bug. I have a few fixes, which I need to commit upto github.
Hello,
Are you going to commit it soon? Or maybe you can give me a clue on how to fix it meanwhile…
Many thanks!
I really appreciate this script. Thank you for working on it!
I believe there is one issue in error handling.
In ezDB.class.php on line 58, we see:
[code]public static $throw_exceptions = true;[/code]
then, throughout the rest of the scripts we see:
[code]if($this->use_exceptions)[/code]
shouldn’t these be the same?
Thanks again!
Thanks for your reply. I think I’ve fixed that, I will check it though. There’s an updated copy on github which I had updated a few days ago. Cheers!
You replied so quickly! That’s wonderful!
I downloaded the latest version you have posted and it is still like that. It’s an easy fix, I just changed
public static $throw_exceptions = true;
in ezdb.class.php to:
public static $use_exceptions = true;
I have another question.
I would like to define the character encoding used in the database. There is an excellent page at http://www.stumbleupon.com/group/php/forum/37465/
He suggests using something like:
// Make sure we are using UTF-8 Character Encoding.
mysql_query(“SET NAMES ‘utf8′;”, $this->dbh);
mysql_query(“SET CHARACTER SET ‘utf8′;”, $this->dbh);
just after opening the connection to the database.
How could I incorporate this into the ezdb script most elegantly?
Thank you once again for the great scripts!
Hi Jon,
It’s updated on github, I had fixed that, along with a few mysqli issues. You can also post issues on the site there
The easiest way for that might just be:
DB::query(‘SET NAMES `utf8`’)
DB::query(‘SET CHARACTER SET `utf8`’);
Thanks to improve ezsql.
I really love ezsql.
but want to have ezDB and use it with codeigniter..
so help me how to use ezDB with codeigniter….
Hi Jackie, Thanks! I’m not too familiar with CodeIgnitor, but it doesn’t have it own database functions? If it doesn’t, I’m sure there’s a way to include external libraries