TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Software World > Programming

Notices

Change detection in MySQL.

Programming


Reply
 
Thread Tools Display Modes
Old 27-05-2009, 04:22 PM   #21
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Re: Change detection in MySQL.

what is the default escape character in MySQL?

We have in ORACLE like ' " ', in MSSQL like ' [] ' which is used while creating table.

MSSQL
create table [aa/njh] (col1 INT);

ORACLE
create table "aa/njh" (col1 INT);


If I use both( ", []) in MYSQL while create table it is nor working fine.
My aim is to mhave table name with special character on numeric.
amit_27 is offline   Reply With Quote
Old 27-05-2009, 04:35 PM   #22
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Re: Change detection in MySQL.

i got solution as :
mysql> CREATE TABLE "test" (col INT);
ERROR 1064: You have an error in your SQL syntax...
mysql> SET sql_mode='ANSI_QUOTES';
mysql> CREATE TABLE "test" (col INT);
Query OK, 0 rows affected (0.00 sec)
amit_27 is offline   Reply With Quote
Old 27-05-2009, 08:30 PM   #23
ƒ(ψ)=Θº×φ
 
bakuryu's Avatar
 
Join Date: May 2006
Location: India
Age: 23
Posts: 6,621
Thanks: 19
Thanked 645 Times in 603 Posts
Rep Power: 87 bakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant future


OS: Windows XP Windows Vista Windows 7


Send a message via Yahoo to bakuryu
Re: Change detection in MySQL.

Code:
create table `aaa/bbb` (col INT)
that should work.

also your 2nd query worked. and a better way to use mysql is using phpmyadmin.
__________________
Please don't click here
bakuryu is offline   Reply With Quote
Old 04-06-2009, 01:27 PM   #24
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Re: MySQL connect error

Hi

I am trying to connect to MySQL database. But it is giving me error as
"ERROR 1130: Host '' is not allowed to connect to this MySQL server"

mysql>musql -h 'a.b.c.d' -u root -p
Enter password: ********

"ERROR 1130: Host 'a.b.c.d' is not allowed to connect to this MySQL server"

Also I tried to do the following :

mysql> create user 'root'@'a.b.c.d' identified by 'root';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to 'root'@'a.b.c.d' with gran
t option;
Query OK, 0 rows affected (0.00 sec)

mysql> show grants for 'root'@'a.b.c.d';
+-------------------------------------------------------------------------------
-----------------------------------------------------------------------+
| Grants for root@a.b.c.d
|
+-------------------------------------------------------------------------------
-----------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'a.b.c.d' IDENTIFIED BY
PASSWORD '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B' WITH GRANT OPTION |
+-------------------------------------------------------------------------------
-----------------------------------------------------------------------+
1 row in set (0.00 sec)

>exit

Again trying from begining

>mysql -h a.b.c.d -u root –p
Enter password: ********
ERROR 1045 (28000): Access denied for user 'root'@'ps4743.persistent.co.in' (usi
ng password: YES)


Can you please tell me if anything goes wrong?
amit_27 is offline   Reply With Quote
Old 04-06-2009, 06:34 PM   #25
ƒ(ψ)=Θº×φ
 
bakuryu's Avatar
 
Join Date: May 2006
Location: India
Age: 23
Posts: 6,621
Thanks: 19
Thanked 645 Times in 603 Posts
Rep Power: 87 bakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant future


OS: Windows XP Windows Vista Windows 7


Send a message via Yahoo to bakuryu
Re: Change detection in MySQL.

where is the MySQL server ? Is it in your local machine ? or on shared hosting server ?
bakuryu is offline   Reply With Quote
Thanked Users:
amit_27 (04-06-2009)
Old 04-06-2009, 06:37 PM   #26
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Re: Change detection in MySQL.

MySQL is on my local machine.

I solved my problem. Thanks for answering me.
amit_27 is offline   Reply With Quote
Old 11-06-2009, 12:06 PM   #27
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Re: Change detection in MySQL.

Hi,

I am trying to fire a query in MyLSQ 5.1.34 like

mysql> select table_schema from INFORMATION_SCHEMA.TABLES where table_name='table11';

Empty set (0.08 sec)

where table11 is not present in the INFORMATION_SCHEMA.TABLES.

I am expecting the error as table not found but as it is returning the empty set.

I tried to fire a query using mysql_real_query() API. How would I get the correct result as table not found?

Or any other ways to achieve same?
amit_27 is offline   Reply With Quote
Old 11-06-2009, 11:51 PM   #28
ƒ(ψ)=Θº×φ
 
bakuryu's Avatar
 
Join Date: May 2006
Location: India
Age: 23
Posts: 6,621
Thanks: 19
Thanked 645 Times in 603 Posts
Rep Power: 87 bakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant future


OS: Windows XP Windows Vista Windows 7


Send a message via Yahoo to bakuryu
Re: Change detection in MySQL.

Quote:
I am expecting the error as table not found but as it is returning the empty set.
MySQL doesn't return errors like that. if it doesn't find anything it will return an empty set. However it will throw table not found error when the table on which you are running the query does not exists, like say you deleted the INFORMATION_SCHEMA.TABLES table.

select count(*) from INFORMATION_SCHEMA.TABLES where table_name='table11'

if it returns 0 then you can conclude table not found if you are having problems to deal with empty sets.
bakuryu is offline   Reply With Quote
Old 12-06-2009, 12:54 PM   #29
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Re: Change detection in MySQL.

How do I get the Parameter information of table?
I have table like

mysql> desc account;

+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| acct_num | int(11) | NO | PRI | NULL | |
| amount | decimal(2,0) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+

I want all the information like colname, datatype, collength, precision, scale, Nullable. I tried using the

MYSQL_FIELD *fields;
unsigned int num_fields;

pResult = mysql_store_result(MySQLDB);
num_fields= mysql_num_fields(pResult);
fields = mysql_fetch_fields(pResult);
for( i = 0; i < num_fields; i++)
{
printf("Field %u is %s\n", i, fields[i].name);
}

It is giving me output like :
Field
Type
NULL
KEY
Default

row = mysql_fetch_row(pResult);
it will give me output as :
acct_num

Which I wanted to get.

But other information not gettting like datatype, precision, scale, nullable.

If I fire a query select * from account;It will gives me What I want in fields.
But it is not good if the there are 100 table which has millions of records and I want information of each table.
Is ther any other way to get only the reuqired information?
amit_27 is offline   Reply With Quote
Old 12-06-2009, 03:22 PM   #30
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Re: Change detection in MySQL.

In short to above query -----

How can we get the table schema information in MYSQL 5.1.34?

Like we use in ORACLE to get it as:

OCIDescribeAny() // //get the describe handle for the table to be described.

OCIAttrGet() // to get parameter handle

OCIAttrGet() ////get the number of columns in the table
amit_27 is offline   Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 09:20 AM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional