Conversion of some mysql php functions to oci functions.
Conversion of some mysql php functions to oci functions.
Hi,
I am trying to make serendipity to work with oracle. so i am trying ot write the file similar to mysql.inc.php.
While converting, there are some functions in mysql.inc.php, which are not in oci.
mysql_insert_id ,
mysql_info,
mysql_real_escape_string,
mysql_escape_string,
mysql_select_db.
Can you please help me to find the functions having similar functionalites?
Thanks in advance,
Amita
I am trying to make serendipity to work with oracle. so i am trying ot write the file similar to mysql.inc.php.
While converting, there are some functions in mysql.inc.php, which are not in oci.
mysql_insert_id ,
mysql_info,
mysql_real_escape_string,
mysql_escape_string,
mysql_select_db.
Can you please help me to find the functions having similar functionalites?
Thanks in advance,
Amita
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Conversion of some mysql php functions to oci functions.
Hi!
Please try to keep your questions in one single thread. It's a bit problematic if you open a new thread for every posting. Thanks.
I'll now answer here, please do not open new threads about the OCI conversion.
The OCI functions are documented here:
http://uk.php.net/oci
It seems that OCI does not have corresponding funtions for what you need. You'd need to look up the OCI SQL syntax manual to try to find it - but I can tell you what the functions do:
mysql_insert_id returns the last autoincremented ID key for a table. In MySQL you could also achieve that witha "SELECT LAST_INSERT_ID()" SQL statement.
mysql_info only returns some link information; I don't think you need to use this in the context of your OCI layer.
mysql_escape_string / mysql_real_escape_string escapes potentially dangerous values for a SQL statement. Like the " character gets replaced with \". You could build a manual PHP functions that emulates this:
You'd need to look up the OCI SQL syntax manual to see which SQL strings need escaping.
mysql_select_db is just the same like "USE xxx" SQL command to select a default database. I think OCI selects the DB in the connet statement already.
HTH,
Garvin
Please try to keep your questions in one single thread. It's a bit problematic if you open a new thread for every posting. Thanks.
I'll now answer here, please do not open new threads about the OCI conversion.
The OCI functions are documented here:
http://uk.php.net/oci
It seems that OCI does not have corresponding funtions for what you need. You'd need to look up the OCI SQL syntax manual to try to find it - but I can tell you what the functions do:
mysql_insert_id returns the last autoincremented ID key for a table. In MySQL you could also achieve that witha "SELECT LAST_INSERT_ID()" SQL statement.
mysql_info only returns some link information; I don't think you need to use this in the context of your OCI layer.
mysql_escape_string / mysql_real_escape_string escapes potentially dangerous values for a SQL statement. Like the " character gets replaced with \". You could build a manual PHP functions that emulates this:
Code: Select all
function oci_escape_string($string) {
return str_replace(array('"', "'", '\\'), array('\\"', '\\\'', '\\\\'), $string);
}
mysql_select_db is just the same like "USE xxx" SQL command to select a default database. I think OCI selects the DB in the connet statement already.
HTH,
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/
# 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/
-
srinathk11
- Regular
- Posts: 17
- Joined: Fri Jun 16, 2006 9:05 am
Help needed
hi garvin,
Thanks for ur valuable contribution!
Can we get the source code fro the following functions:
mysql_insert_id()
mysql_select_db()
mysql_info()
bcoz even after going thru the OCI SQL syntax manual we could not figure out functions or combination o ffunctions which could perform the same task as the above mysql functions.So we felt that we implement the functions..
Like mysql_query() is similar to OCIParse followed by OCIExecute we didn't find any functions similar to mysql_insert_id(),etc..
Thanks..
srinath.
Thanks for ur valuable contribution!
Can we get the source code fro the following functions:
mysql_insert_id()
mysql_select_db()
mysql_info()
bcoz even after going thru the OCI SQL syntax manual we could not figure out functions or combination o ffunctions which could perform the same task as the above mysql functions.So we felt that we implement the functions..
Like mysql_query() is similar to OCIParse followed by OCIExecute we didn't find any functions similar to mysql_insert_id(),etc..
Thanks..
srinath.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Help needed
Hi!
Yes, you can get the sourcecode. Here it is:
http://cvs.php.net/viewvc.cgi/php-src/e ... iew=markup
It is the C-extension of PHP.
I wish I could help you more, but I've never worked with Oracle.
Best regards,
Garvin
Yes, you can get the sourcecode. Here it is:
http://cvs.php.net/viewvc.cgi/php-src/e ... iew=markup
It is the C-extension of PHP.
I wish I could help you more, but I've never worked with Oracle.
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/
# 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/
Re: Help needed
Hey, if it will be include in the official oci-extensions it will be great!srinathk11 wrote:bcoz even after going thru the OCI SQL syntax manual we could not figure out functions or combination o ffunctions which could perform the same task as the above mysql functions.So we felt that we implement the functions..
-
srinathk11
- Regular
- Posts: 17
- Joined: Fri Jun 16, 2006 9:05 am
Serendipity database and tables..
Hi,
After installation of serendipity using mysql as database we find that serendipity database is created in mysql with several tables like categories,comments,entries,ect created in the database..
Are these tables and database created automatically or shud we create them manually...
Where are the definitions for these table creation written if this is done automatically.
when we try to install serendipity for oracle from index.php we get warnings/errors like
"database you specified doesnot exist
The oci error was: Array"
Should we create those tables and database manually for oracle..or will they be created automatically.
Thanks.
Srinath.
After installation of serendipity using mysql as database we find that serendipity database is created in mysql with several tables like categories,comments,entries,ect created in the database..
Are these tables and database created automatically or shud we create them manually...
Where are the definitions for these table creation written if this is done automatically.
when we try to install serendipity for oracle from index.php we get warnings/errors like
"database you specified doesnot exist
The oci error was: Array"
Should we create those tables and database manually for oracle..or will they be created automatically.
Thanks.
Srinath.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Falk, that's actually a bit misleading. In SQL you only need to add DB_UPDATE files for specific installations. But for OCI you don't need it, since OCI support would only start with the recent file.
Thus, you people would need to look into the "db.sql" main SQL file, this contains the basic Table structure.
Your serendipity_db_schema_import() function of the Oracle layer will need to replace {PRIMARY} and other {...} variables of that db.sql file so that it works in Oracle.
HTH,
Garvin
Falk, that's actually a bit misleading. In SQL you only need to add DB_UPDATE files for specific installations. But for OCI you don't need it, since OCI support would only start with the recent file.
Thus, you people would need to look into the "db.sql" main SQL file, this contains the basic Table structure.
Your serendipity_db_schema_import() function of the Oracle layer will need to replace {PRIMARY} and other {...} variables of that db.sql file so that it works in Oracle.
HTH,
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/
# 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/
-
srinathk11
- Regular
- Posts: 17
- Joined: Fri Jun 16, 2006 9:05 am
Please let us know what changes should be made in the code
Hi garvin,
Thanks for your constant support!
Please let us know what changes should be made in serendipity_db_schema_import() function:
function serendipity_db_schema_import($query) {
static $search = array('{AUTOINCREMENT}', '{PRIMARY}',
'{UNSIGNED}', '{FULLTEXT}', '{FULLTEXT_MYSQL}', '{BOOLEAN}');
static $replace = array('int(11) not null auto_increment', 'primary key',
'unsigned' , 'FULLTEXT', 'FULLTEXT', 'enum (\'true\', \'false\') NOT NULL default \'true\'');
static $is_utf8 = null;
global $serendipity;
if ($is_utf8 === null) {
$search[] = '{UTF_8}';
if ( (isset($_POST['charset']) && $_POST['charset'] == 'UTF-8/') ||
$serendipity['charset'] == 'UTF-8/' ||
$serendipity['POST']['charset'] == 'UTF-8/' ||
LANG_CHARSET == 'UTF-8' ) {
$replace[] = '/*!40100 CHARACTER SET utf8 COLLATE utf8_unicode_ci */';
} else {
$replace[] = '';
}
}
$query = trim(str_replace($search, $replace, $query));
if ($query{0} == '@') {
// Errors are expected to happen (like duplicate index creation)
return serendipity_db_query(substr($query, 1), false, 'both', false, false, false, true);
} else {
return serendipity_db_query($query);
}
}
Thanks for your constant support!
Please let us know what changes should be made in serendipity_db_schema_import() function:
function serendipity_db_schema_import($query) {
static $search = array('{AUTOINCREMENT}', '{PRIMARY}',
'{UNSIGNED}', '{FULLTEXT}', '{FULLTEXT_MYSQL}', '{BOOLEAN}');
static $replace = array('int(11) not null auto_increment', 'primary key',
'unsigned' , 'FULLTEXT', 'FULLTEXT', 'enum (\'true\', \'false\') NOT NULL default \'true\'');
static $is_utf8 = null;
global $serendipity;
if ($is_utf8 === null) {
$search[] = '{UTF_8}';
if ( (isset($_POST['charset']) && $_POST['charset'] == 'UTF-8/') ||
$serendipity['charset'] == 'UTF-8/' ||
$serendipity['POST']['charset'] == 'UTF-8/' ||
LANG_CHARSET == 'UTF-8' ) {
$replace[] = '/*!40100 CHARACTER SET utf8 COLLATE utf8_unicode_ci */';
} else {
$replace[] = '';
}
}
$query = trim(str_replace($search, $replace, $query));
if ($query{0} == '@') {
// Errors are expected to happen (like duplicate index creation)
return serendipity_db_query(substr($query, 1), false, 'both', false, false, false, true);
} else {
return serendipity_db_query($query);
}
}
garvinhicking wrote:Hi!
Falk, that's actually a bit misleading. In SQL you only need to add DB_UPDATE files for specific installations. But for OCI you don't need it, since OCI support would only start with the recent file.
Thus, you people would need to look into the "db.sql" main SQL file, this contains the basic Table structure.
Your serendipity_db_schema_import() function of the Oracle layer will need to replace {PRIMARY} and other {...} variables of that db.sql file so that it works in Oracle.
HTH,
Garvin
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Please let us know what changes should be made in the co
Hi!
You're welcome.
I would love to tell you, but since I don't know Oracle's SQL, I cannot tell you what needs to be changed so that it works in Oracle. I'm sorry!
It is specific to what Oracle needs to have as fieldnames, fieldtypes, primary keys etc., so this would require knowledge of Oracle. This is where your experience comes in.
Best regards,
Garvin
You're welcome.
I would love to tell you, but since I don't know Oracle's SQL, I cannot tell you what needs to be changed so that it works in Oracle. I'm sorry!
It is specific to what Oracle needs to have as fieldnames, fieldtypes, primary keys etc., so this would require knowledge of Oracle. This is where your experience comes in.
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/
# 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/
In serendipity , there are a set of files in include\admin\importers folder
such as , b2evolution.inc.php, bblog.inc.php, bmachine.inc.php, geeklog.inc.php, nucleus.inc.php, phpbb.inc.php, pmachine.inc.php, sunlog.inc.php, textpattern.inc.php, wordpress.inc.php etc . these all files contains mysql fuctions as mysql_select_db, mysql_connect, etc.
Do we need to create such functions for oracle conversion? If yes, how?
One more question, Is it possible or not for making serendipity to work with Oracle?
trying a lot... but giving problems....
Thanks,
Amita
such as , b2evolution.inc.php, bblog.inc.php, bmachine.inc.php, geeklog.inc.php, nucleus.inc.php, phpbb.inc.php, pmachine.inc.php, sunlog.inc.php, textpattern.inc.php, wordpress.inc.php etc . these all files contains mysql fuctions as mysql_select_db, mysql_connect, etc.
Do we need to create such functions for oracle conversion? If yes, how?
One more question, Is it possible or not for making serendipity to work with Oracle?
Thanks,
Amita
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi Amita!
I answered your question already. Importers are for blogsoftwares. They have nothing to do with dabase engines.

Let's be serous: You can create a Oracle DB Layer for Serendipity. But it involves coding, as I already said.
Oracle is NOT MEANT for PHP web applications. Oracle has its advantages in persistent frameworks like JSP. For the web, use pgsql or mysql. The reason why little Oracle PHP applications exist, is because of that. And the licensing of Oracle, of course.
Bottom line: You can do it. But you must know your Oracle, SQL and PHP.
One more question: Are amita and srinathk11 the same person? Are you working together? I really get confused.
Best regards,
Garvin
I answered your question already. Importers are for blogsoftwares. They have nothing to do with dabase engines.
It is also possible to turn Serendipity into a spreadsheet application, but it needs to be coded.One more question, Is it possible or not for making serendipity to work with Oracle?trying a lot... but giving problems....
Let's be serous: You can create a Oracle DB Layer for Serendipity. But it involves coding, as I already said.
Oracle is NOT MEANT for PHP web applications. Oracle has its advantages in persistent frameworks like JSP. For the web, use pgsql or mysql. The reason why little Oracle PHP applications exist, is because of that. And the licensing of Oracle, of course.
Bottom line: You can do it. But you must know your Oracle, SQL and PHP.
One more question: Are amita and srinathk11 the same person? Are you working together? I really get confused.
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/
# 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/
Re: Please let us know what changes should be made in the co
The placeholders {PRIMARY} must replace with the oracle keywords for primary key, the {AUTOINCREMENT} must be replace with a trigger and a sequence und so one. And i think varchar must be replaced by varchar2. I have the oracle<->mysql table not in my headsrinathk11 wrote:Hi garvin,
Thanks for your constant support!
Please let us know what changes should be made in serendipity_db_schema_import() function:
@garvin: _Oracle_ is not designed for the web, but you can write php programms using oracle (i do it). You only spend more time for solving problems you doesn't have with mysql and co.
hi,
[quote= "Garvin"] Let's be serous: You can create a Oracle DB Layer for Serendipity. But it involves coding, as I already said.
One more question: Are amita and srinathk11 the same person? Are you working together? I really get confused.[/quote]
Myself and srinathk11 are not the same person. We are two different persons working together and require your help.
you said to upgrade db.sql, do we need to upgrade any other file in sql folder?
Garvin and Falk , thanks a lot for your co-operation... and expecting the same till the end of our work...
we both cant do it except your help.
Thanks,
Amita
[quote= "Garvin"] Let's be serous: You can create a Oracle DB Layer for Serendipity. But it involves coding, as I already said.
One more question: Are amita and srinathk11 the same person? Are you working together? I really get confused.[/quote]
Myself and srinathk11 are not the same person. We are two different persons working together and require your help.
you said to upgrade db.sql, do we need to upgrade any other file in sql folder?
Garvin and Falk , thanks a lot for your co-operation... and expecting the same till the end of our work...
Thanks,
Amita
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Ah, okay, now I understand the threads a bit better. It just was confusing because you two posted similar things.
Apart from db.sql the other files don't need touching. Only in the future when new serendipity versions come out, a specific db_update_xxx.sql file needs to be created which contains DB upgrades. But for now, don't pay attention to that fact.
Best regards,
Garvin
Ah, okay, now I understand the threads a bit better. It just was confusing because you two posted similar things.
Apart from db.sql the other files don't need touching. Only in the future when new serendipity versions come out, a specific db_update_xxx.sql file needs to be created which contains DB upgrades. But for now, don't pay attention to that fact.
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/
# 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/