Conversion of some mysql php functions to oci functions.

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
srinathk11
Regular
Posts: 17
Joined: Fri Jun 16, 2006 9:05 am

Need some help

Post by srinathk11 »

Hi,

While continuing with simple installation after making changes we get some warnings. And i found a query with table called "authorgroups" in warnings,but this table definition is not found in db.sql...
Also please have a look at some of the warnings and do the needful.

SELECT * from serendipity_plugins WHERE placement = 'event' ORDER BY placement, sort_order/ SELECT * from serendipity_plugins WHERE placement = 'event' ORDER BY placement, sort_order/
ADMIN_FRONTPAGE
NO_ENTRIES_TO_PRINT
« PREVIOUS_PAGE (PAGE_BROWSE_ENTRIES) NEXT_PAGE »
ADMIN_FRONTPAGE
SELECT * from serendipity_plugins WHERE placement = 'event' ORDER BY placement, sort_order/

SELECT name, value
FROM serendipity_config
WHERE authorid = 0/
SELECT * from serendipity_plugins WHERE placement = 'event' ORDER BY placement, sort_order/
SELECT * from serendipity_plugins WHERE placement = 'event' ORDER BY placement, sort_order/
SELECT COUNT(placement) AS count from serendipity_plugins WHERE placement='left' /
SELECT COUNT(placement) AS count from serendipity_plugins WHERE placement='right' /
SELECT * from serendipity_plugins WHERE placement = 'event' ORDER BY placement, sort_order/
SELECT


e.id,
e.title,
e.timestamp,
e.comments,
e.exflag,
e.authorid,
e.trackbacks,
e.isdraft,
e.allow_comments,
e.last_modified,

a.realname AS author,
a.email
, e.body, e.extended

FROM
serendipity_entries AS e
LEFT JOIN serendipity_authors a
ON e.authorid = a.authorid
LEFT JOIN serendipity_entrycat ec
ON e.id = ec.entryid
LEFT JOIN serendipity_category c
ON ec.categoryid = c.categoryid
LEFT JOIN serendipity_authorgroups AS acl_a
ON acl_a.authorid = 0
LEFT JOIN serendipity_access AS acl_acc
ON ( acl_acc.artifact_mode = 'read'
AND acl_acc.artifact_type = 'category'
AND acl_acc.artifact_id = c.categoryid
)
WHERE isdraft = 'false' AND e.timestamp <= 1151498346 AND (
c.categoryid IS NULL
OR ( acl_acc.groupid = 0)
OR ( acl_acc.artifact_id IS NULL

)
)
GROUP BY e.id
ORDER BY timestamp DESC
LIMIT 15/
SELECT * from serendipity_plugins WHERE placement = 'event' ORDER BY placement, sort_order/
SELECT count(distinct e.id)
FROM
serendipity_entries AS e
LEFT JOIN serendipity_authors a
ON e.authorid = a.authorid
LEFT JOIN serendipity_entrycat ec
ON e.id = ec.entryid
LEFT JOIN serendipity_category c
ON ec.categoryid = c.categoryid
LEFT JOIN serendipity_authorgroups AS acl_a
ON acl_a.authorid = 0
LEFT JOIN serendipity_access AS acl_acc
ON ( acl_acc.artifact_mode = 'read'
AND acl_acc.artifact_type = 'category'
AND acl_acc.artifact_id = c.categoryid
)
WHERE isdraft = 'false' AND e.timestamp <= 1151498346 AND (
c.categoryid IS NULL
OR ( acl_acc.groupid = 0)
OR ( acl_acc.artifact_id IS NULL

)
)/
SELECT * from serendipity_plugins WHERE placement = 'event' ORDER BY placement, sort_order/
POWERED_BY s9y - Design by Carl
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Need some help

Post by garvinhicking »

Hi!

The authorgroups table does exist in db.sql:

Code: Select all

create table {PREFIX}authorgroups (
  groupid int(10) {UNSIGNED} not null default '0',
  authorid int(10) {UNSIGNED} not null default '0'
) {UTF_8};
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
amita
Regular
Posts: 29
Joined: Mon Jun 19, 2006 10:24 am

Post by amita »

Hi Garvin,

I think we were so stuck to the problem... that we missed to create that table authorgroups.
:D thanks a lot....

Now we are here with a new problem.... :)

Actually the following queries are created dynamically there eventhough all tha tables are present. And they r giving warnings.... When we click on "Visit you blog now" this page appear...

Code: Select all

Warning: ociexecute() [function.ociexecute]: ORA-00933: SQL command not properly ended in E:\Program Files\Apache Group\Apache2\htdocs\serendipity-1.0-beta3.tar\serendipity-1.0-beta3\serendipity\include\db\oci8.inc.php on line 82

SELECT 
                    

                    e.id,
                    e.title,
                    e.timestamp,
                    e.comments,
                    e.exflag,
                    e.authorid,
                    e.trackbacks,
                    e.isdraft,
                    e.allow_comments,
                    e.last_modified,

                    a.realname AS author,
                    a.email
                     , e.body, e.extended
                     
                FROM
                    serendipity_entries AS e
                    LEFT JOIN serendipity_authors a
                        ON e.authorid = a.authorid
                    LEFT JOIN serendipity_entrycat ec
                        ON e.id = ec.entryid
                    LEFT JOIN serendipity_category c
                        ON ec.categoryid = c.categoryid
                     LEFT JOIN serendipity_authorgroups AS acl_a
                                   ON acl_a.authorid = 0
                            LEFT JOIN serendipity_access AS acl_acc
                                   ON (    acl_acc.artifact_mode = 'read'
                                       AND acl_acc.artifact_type = 'category'
                                       AND acl_acc.artifact_id   = c.categoryid
                                      )
                    WHERE isdraft = 'false' AND e.timestamp <= 1151554323 AND     (
                                 c.categoryid IS NULL
                                 OR ( acl_acc.groupid = 0)
                                 OR ( acl_acc.artifact_id IS NULL
                                      
                                    )
                               )
                     GROUP BY e.id
            ORDER BY timestamp DESC
                      LIMIT 15/ 
SELECT * from serendipity_plugins  WHERE  placement =  'event'  ORDER BY placement, sort_order/ 
Warning: ociexecute() [function.ociexecute]: ORA-00933: SQL command not properly ended in E:\Program Files\Apache Group\Apache2\htdocs\serendipity-1.0-beta3.tar\serendipity-1.0-beta3\serendipity\include\db\oci8.inc.php on line 82

SELECT count(distinct e.id) 
                FROM
                    serendipity_entries AS e
                    LEFT JOIN serendipity_authors a
                        ON e.authorid = a.authorid
                    LEFT JOIN serendipity_entrycat ec
                        ON e.id = ec.entryid
                    LEFT JOIN serendipity_category c
                        ON ec.categoryid = c.categoryid
                     LEFT JOIN serendipity_authorgroups AS acl_a
                                   ON acl_a.authorid = 0
                            LEFT JOIN serendipity_access AS acl_acc
                                   ON (    acl_acc.artifact_mode = 'read'
                                       AND acl_acc.artifact_type = 'category'
                                       AND acl_acc.artifact_id   = c.categoryid
                                      )
                    WHERE isdraft = 'false' AND e.timestamp <= 1151554323 AND     (
                                 c.categoryid IS NULL
                                 OR ( acl_acc.groupid = 0)
                                 OR ( acl_acc.artifact_id IS NULL
                                      
                                    )
                               )/ 

Actually this syntax doesnt work in oracle. "AS" is not supported in oracle.... so we need to change it.... where these queries are getting created?
Please help us....

Thanks,
Amita
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Oh, if oracle does not support "AS", then this might be a major problem. How else does oracle support aliasing column and table names?

The queries are scattered throughout the whole codebase. You must search all files for " AS ". The query you referred to is created in include/functions_entries.inc.php, function serendipity_fetchEntries().

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
falk
Regular
Posts: 512
Joined: Tue Sep 27, 2005 10:16 am
Location: DD
Contact:

Post by falk »

Question: How did you solve the problem with the autoincrement?
amita
Regular
Posts: 29
Joined: Mon Jun 19, 2006 10:24 am

Post by amita »

Hi Garvin,

I removed all "AS" in queries. but then too those 2 queries rae displayed. And we are not able to move further. Now it is displaying "AS" only for following lines in both the queries. It seems that these queries rae created by $cond[joins]. I commented all $cond[joins] and tried to run... but then too showing the same queries.

Code: Select all

LEFT JOIN serendipity_authorgroups AS acl_a 
                                   ON acl_a.authorid = 0 
                            LEFT JOIN serendipity_access AS acl_acc 
Now what would have been happened? :? :roll:

Thanks,
Amita
amita
Regular
Posts: 29
Joined: Mon Jun 19, 2006 10:24 am

Post by amita »

Hi falk,
falk wrote:Question: How did you solve the problem with the autoincrement?
We used sequence and trigger for autoincrement.

Thanks,
Amita
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi Amita!

So using a query like "LEFT JOIN serendipity_authorgroups acl_a" would work for oracle to get the right alias?

Those queries are found somewhere in the include/*.php files. You should search through all files.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
amita
Regular
Posts: 29
Joined: Mon Jun 19, 2006 10:24 am

Post by amita »

Hi Garvin,

Again we are one step ahead ... thanks to you.... :D

But agn we are with a new problem.... :D

Actually... Now we are able to navigate through all the steps,
1) Its showing Database Extension as oci8
2) After Clicking on Simple Installation , its asking for the all database values ... i mean the second page is coming...
3) In third step, its showing serendipity installed succesfully... VISIT YOUR BLOG
4) On clicking on this link.... there is a page with the sql generated queries(I asked you regd that in last question) with no warnings or no errors. I tried to run those queries from sql+, its getting executed.

Values are inserted in serendipity_authors , _permalinks etc tables.
But there is no blog page.... and no link to go further

What may be the new problem now?

Thanks,
Amita
amita
Regular
Posts: 29
Joined: Mon Jun 19, 2006 10:24 am

Post by amita »

Garvin,

After crossing the installtion page, I am supposed to be directed to a page with Header Text as "John Doe's personal blog" which has calendar, go button and Rss feeds. But in that I am able to see only these links which are disabled « PREVIOUS_PAGE (PAGE_BROWSE_ENTRIES) NEXT_PAGE »
ADMIN_FRONTPAGE . All other links are not showing up.

I ignore this page for the time being. I go to URL and type http://localhost/serendipity-1.0-beta3/ ... _admin.php. I get a screen where I am entering the user name and password which have been saved to the database (I checked from back end query). Even after I enter correct credentials it is giving me an error "WRONG_USERNAME_OR_PASSWORD"

Pls provide some pointers on how to resolve this.
As always, your help will be greatly appreciated.

Thanks,
Amita
[/img]
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

BTW, one thought for your " AS " problem. How about just putting somthing like:

Code: Select all

$sql = str_replace(' AS ', '', $sql);
inside the serendipity_db_query() function? So all SQL will get replaced there and you don't need to patch any of the other files.

If you installed s9y properly, you should be able to call http://yourhost/serendipity_admin.php to log into the backend!

If you see thinkgs like "PREVIOUS_PAGE" etc. it means that your language PHP file did not get parsed! Usually depending on your configured language ("lang" entry in serendipity_config DB table) there must be included a lang/serendipity_lang_XX.inc.php file to insert those constants!

Check if all variables are in place; you might want to compare your table structure and content with those created on a MySQL installation!

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
amita
Regular
Posts: 29
Joined: Mon Jun 19, 2006 10:24 am

Post by amita »

Hi Garvin,

Tha problem of "AS" has been solved.

But still we are gettings things like "PREVIOUS PAGE" "NEXT PAGE" etc.

We checked with the mysql configuration also. The set of table and values inserted inside the table during installation are same.

But the Mysql configuration is going to next "Blog Creation " page and we are stuck with the problem... means there is no link or anything to go further.

Using link http://yourhost/serendipity_admin.php also we are not able to view any page. It is showing Page not Displayed.

How to resolve this?

Thanks,
Amita
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, this sounds to me as if your serendipity_config.inc.php file is malfunctioning or that configuration values cannot be retrieved from the database.

Did you check the results of "serendipity_db_query" for each SQL query? Compare that with your MySQL installation, the returned SQL rows should be the same.

I bet that Oracle is not returning the values like it's being returned by MySQL/PGSql/SQLite?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
amita
Regular
Posts: 29
Joined: Mon Jun 19, 2006 10:24 am

Post by amita »

Hi Garvin,

I checked with all the sequence of queries in mysql and oracle. The same set of queries are getting executed.

the values inserted are also same in databases except in mysql , id inserted is 1 and for oracle it is 0.

Even i feel the same problem that configuration values are not retrived from tha database serendipity_config properly? But how to fix that?

Please tell me the proper steps to get out of this problem...

Thanks,
Amita
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Please find include/functions_config.inc.php, the function serendipity_loadconfiguration(). Replace it with this:

Code: Select all

function serendipity_load_configuration($author = null) {
    global $serendipity;
    static $config_loaded = array();

    echo "Loading configuration for author '$author'<br />\n";
    if (isset($config_loaded[$author])) {
        return true;
    }

    if (!empty($author)) {
        // Replace default configuration directives with user-relevant data
        $rows = serendipity_db_query("SELECT name,value
                                        FROM {$serendipity['dbPrefix']}config
                                        WHERE authorid = '". (int)$author ."'");
    } else {
        // Only get default variables, user-independent (frontend)
        $rows = serendipity_db_query("SELECT name, value
                                        FROM {$serendipity['dbPrefix']}config
                                        WHERE authorid = 0");
    }

    echo "Result is: <pre>" . print_r($rows, true) . "</pre><br />\n";

    if (is_array($rows)) {
        foreach ($rows as $row) {
            // Convert 'true' and 'false' into booleans
            $serendipity[$row['name']] = serendipity_get_bool($row['value']);
        }
    }
    
    echo "Final Result is: <pre>" . print_r($serendipity, true) . "</pre><br />\n";

    $config_loaded[$author] = true;
}
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply