|
View previous topic :: View next topic |
| Author |
Message |
DJ Maze Developer


Offline Joined: Apr 19, 2004 Posts: 5683 Location: http://tinyurl.com/5z8dmv
|
Posted: Thu Nov 04, 2010 9:05 am Post subject: New SQL classes |
|
I've added a new SQL library.
It tries to be compatible with the old system BUT is more strict when it comes to writing SQL queries.
Correct ANSI/ISO syntax is required to make the most cross-db implementation possible.
So, if you find any SQL errors that weren't there, here's your chance to make them ISO SQL-92 compliant.
New features:
Example:
| PHP: |
$result = $db->query("SELECT * FROM {$SQL->TBL->admins}");
$result->num_rows;
foreach ($result as $index => $values) { // code here }
|
DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
|
|
| Back to top |
|
 |
NanoCaiordo Developer


Offline Joined: Jun 29, 2004 Posts: 3878 Location: Melbourne, AU
|
Posted: Thu Nov 04, 2010 11:27 pm Post subject: Re: New SQL classes |
|
| PHP: |
// To sync DB: $db->XML->sync_schema_from_file($file)
// To create a XML export scheme header('Content-Type: application/xml'); $db->XML->export_schema(fopen('php://output', 'w')); exit;
|
_________________ .:: I met php the 03 December 2003 :: Unforgettable day! ::.
Linux 64bit / Apache 2.2 / PHP 5.4 / MySQL 5.5.22 / v9, v10
Linux 32bit / Apache 2.2 / PHP 5.3.10 / MySQL 5.5.22 / v9, v10
Windows 64bit / IIS 7.5 / PHP 5.3.10 / MySQL 5.5.22 / v9, v10
NanoCaiordo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) mixed
|
|
| Back to top |
|
 |
Phoenix • Many Posts •


Offline Joined: Apr 19, 2004 Posts: 8799 Location: Netizen
|
Posted: Sun Nov 07, 2010 7:16 am Post subject: Re: New SQL classes |
|
A tip to existing CVS users - do not update.
CVS is severely broken as a result of this change and is not functional.
Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
|
|
| Back to top |
|
 |
DJ Maze Developer


Offline Joined: Apr 19, 2004 Posts: 5683 Location: http://tinyurl.com/5z8dmv
|
Posted: Sun Nov 07, 2010 12:24 pm Post subject: Re: New SQL classes |
|
Problem currently still relies in 4 methods:
- list_databases
- list_tables
- list_columns
- list_indexes
Working my ass off to get this incompatibility fixed.
DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
|
|
| Back to top |
|
 |
DJ Maze Developer


Offline Joined: Apr 19, 2004 Posts: 5683 Location: http://tinyurl.com/5z8dmv
|
Posted: Sun Nov 07, 2010 5:57 pm Post subject: Re: New SQL classes |
|
Install should work again.
Please inform when something is still fails at install (not after!)
DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
|
|
| Back to top |
|
 |
Phoenix • Many Posts •


Offline Joined: Apr 19, 2004 Posts: 8799 Location: Netizen
|
Posted: Sun Nov 07, 2010 10:45 pm Post subject: Re: New SQL classes |
|
Let's build the database gives the impression of nothing happening, which might prompt extra clicking of the button.
Unimpeded, it eventually breaks with:
| Code:: |
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('26','6','2000','Francisco Burzi registers the PHP-Nuke project at Sou' at line 1 |
core.xml history data set obviously hasn't converted properly - several fields have extra column(s) of data.
sql/data/core.xml fix committed (twice)
| Code:: |
Fatal error: require() [function.require]: Failed opening required '/install/sql/data/core.php' (include_path='.:/includes:/usr/lib/php:/usr/local/lib/php') in /install/sql/new.php on line 20
|
Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
|
|
| Back to top |
|
 |
DJ Maze Developer


Offline Joined: Apr 19, 2004 Posts: 5683 Location: http://tinyurl.com/5z8dmv
|
Posted: Thu Nov 11, 2010 5:33 pm Post subject: Re: New SQL classes |
|
Thanks phoenix!
I've added the missing table data and added a unique index on security table to prevent duplicate entries.
DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
|
|
| Back to top |
|
 |
DJ Maze Developer


Offline Joined: Apr 19, 2004 Posts: 5683 Location: http://tinyurl.com/5z8dmv
|
Posted: Thu Nov 11, 2010 9:39 pm Post subject: Re: New SQL classes |
|
Just added XML support for PostgreSQL
DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
|
|
| Back to top |
|
 |
Phoenix • Many Posts •


Offline Joined: Apr 19, 2004 Posts: 8799 Location: Netizen
|
Posted: Thu Nov 11, 2010 9:47 pm Post subject: Re: New SQL classes |
|
| Code:: |
Remove install.php and the install directory right now!
|
Database installed without error, but no forum or PM tables.
Unfortunately, it doesn't proceed to Gather important info & Create super admin account
Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
|
|
| Back to top |
|
 |
Phoenix • Many Posts •


Offline Joined: Apr 19, 2004 Posts: 8799 Location: Netizen
|
|
| Back to top |
|
 |
movix Nice poster


Offline Joined: Feb 10, 2008 Posts: 131
|
Posted: Fri Nov 12, 2010 12:47 pm Post subject: Re: New SQL classes |
|
Hello,
Just a question about those new SQL functionalities, would it be possible to have the FULL parameter added to the get_column method in order to retreive comments on the table columns.
i know that the request will be much longer to perform upon using the FULL option, so perhaps it can be optionally set on the get_clolumn method.
Hope the question is clear.
movix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/Apache/MySQL 5.1.49/PHP 5.3.6/ DF 9.3.2.0
|
|
| Back to top |
|
 |
DJ Maze Developer


Offline Joined: Apr 19, 2004 Posts: 5683 Location: http://tinyurl.com/5z8dmv
|
Posted: Fri Nov 12, 2010 5:27 pm Post subject: Re: New SQL classes |
|
| movix wrote: |
| Just a question about those new SQL functionalities, would it be possible to have the FULL parameter added to the get_column method in order to retreive comments on the table columns. |
There is no get_column.
Instead use:
| Code:: |
$db->list_columns(table_name); |
It will return a multidimensional array as:
| Code:: |
array(
'column_name' => array(
'type' => (string),
'notnull' => (boolean),
'default' => (string),
'extra' => (string),
'comment' => (string)
),
......
) |
DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
|
|
| Back to top |
|
 |
movix Nice poster


Offline Joined: Feb 10, 2008 Posts: 131
|
Posted: Fri Nov 12, 2010 7:10 pm Post subject: Re: New SQL classes |
|
Hi DZ Maze,
Thanks for your reply.
Yes is is indeed list_columns.
Correct me, but this method did not returned the comment in 9.x
Movix
movix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/Apache/MySQL 5.1.49/PHP 5.3.6/ DF 9.3.2.0
|
|
| Back to top |
|
 |
DJ Maze Developer


Offline Joined: Apr 19, 2004 Posts: 5683 Location: http://tinyurl.com/5z8dmv
|
Posted: Fri Nov 12, 2010 11:32 pm Post subject: Re: New SQL classes |
|
| movix wrote: |
| Correct me, but this method did not returned the comment in 9.x |
Correct, it didn't.
Now it does as it is supported by our XML DB schema.xsd.
Due to that we can add comments to tables and columns in xml db schemas like core.xml
DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
|
|
| Back to top |
|
 |
movix Nice poster


Offline Joined: Feb 10, 2008 Posts: 131
|
Posted: Fri Nov 12, 2010 11:48 pm Post subject: Re: New SQL classes |
|
what about perfomance when using the FULL option in the query to retrieve comments and extra ?
Is it worth to make this optional upon calling the method ?
For my part i noticed that the query tooks about 10 times longer when using the FULL option in the query.
movix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/Apache/MySQL 5.1.49/PHP 5.3.6/ DF 9.3.2.0
|
|
| Back to top |
|
 |
|
|