The latest daily SVN snapshot produces fixes for the add module issue. The missing id is now signed and I was able to add modules in an normal fashion.
I'm converting a module I made for the new PN 0.8 standard, but are not sure what the "official" method for calling and activing DB are for writing and reading. Any suggestions are appriciated.( I just like to get close to the standard. )
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- internetking created topic »password problem« 25. May
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
- mdee created topic »How to implement returnpage ?« 25. May
- nestormateo responded to »Fillters in Clip« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Creating tables using dbutil
-
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
aase,
See Database access using DBUtil. Feel free to improve & extend the docs as you write your code.
-Mark
--
Visit My homepage and Zikula themes. -
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 110
hi again,
I actually used the DBUtil version in my first attempt, but only got table creation failed. I just tried the sample given in the Wiki with the same results.
I tried a simple version just creating the table (no content) and got this error
Exit-Handler: DBUtil::createTable: neither the SQL parameter nor the pntable array contain the ADODB dictionary representation of table to create...
It may look to me that the problem is me trying to add this module inside the modules folder and somehow this generate a conflict.
Any suggestions?
-
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
As indicated by the error message you need to either pass the createTable method a valid SQL string (in ADODB data dictionary format) or have the same information in pntables.php.
Check out how some of the existing modules work for some sample code.
-Mark
--
Visit My homepage and Zikula themes. -
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 110
Hi Mark,
I'm aware of that. And the samples have been according to samples given in the Wiki.
like:
Code
$sql = "id I NOTNULL AUTO PRIMARY,
title C(255) NOTNULL DEFAULT '',
content C(255) NOTNULL DEFAULT '',
online L NOTNULL DEFAULT 0";
if (!DBUtil::createTable('test_table', $sql)) {
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
return false;
}
What I ment in the last post is that
Code
if (!DBUtil::createTable('test_table')) {
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
return false;
}
should be able to create a table named 'test_table'.
For some strange reason none of this works.
PHP 5+
SQL 4+
PN last SVN snapshot
Folder with pninit.php (modules/test/pninit.php)
Error is allways table creation failed. -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
In the latter example you *must* have the full table definition in pntables.php. The Wiki only gives an example of the table definiton in pninit.php but there is another method.
-Mark
--
Visit My homepage and Zikula themes. -
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 110
k, well the first sample should work... without any definitions made in pntables as well.
I notice DBUtil is used in the system modules. For the pnaddons modules the old dbcall method is used.
Ofcourse I can go back to the old method, but it is better to walk the same path as PN I guess;) -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
The first example should work provided the standard table entries in pntables.php are correct. The value addons haven't been updated yet but will be.
Send me across your module to markwest at postnuke dot com and i'll take a look.
-Mark
--
Visit My homepage and Zikula themes. -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 29
The issue was also discussed here: http://community.postnuke.com/module-Forum-viewtopic-topic-50397.htm
- Moderated by:
- Support
Users on-line
- 0 users
This list is based on users active over the last 60 minutes.
