Re: [gentoo-user] php CURRENT_TIMESTAMP vs NOW()

2012-12-28 Thread Joseph

On 12/28/12 02:00, Michael Orlitzky wrote:

On 12/28/2012 01:44 AM, Joseph wrote:

I'm not a PHP programmer but I'll try to explain my problem.
I've create table in my php database:

DROP TABLE IF EXISTS visual_verify_code;
CREATE TABLE visual_verify_code (
   oscsid varchar(32) NOT NULL,
   code varchar(6) NOT NULL,
   dt TIMESTAMP(12) NOT NULL DEFAULT NOW(),
   PRIMARY KEY (oscsid)
);



Looks fine.



It worked OK, after few days I backup my database and try to restore it, but it keeps 
complaining on the dt:
ERROR 1067 (42000) at line 38009: Invalid default value for 'dt'

so the database is dropped but never restored. The backup data base contain:

create table visual_verify_code (
   oscsid varchar(32) not null ,
   code varchar(6) not null ,
   dt timestamp default 'CURRENT_TIMESTAMP' not null ,
   PRIMARY KEY (oscsid)
);



CURRENT_TIMESTAMP shouldn't be quoted. How are you backing up the database?


Your are correct, when I removed the quotes it worked.

I'm backing it up through the backup.php sript that came with osCommerce, I can 
post it but it is a long one.

--
Joseph



Re: [gentoo-user] php CURRENT_TIMESTAMP vs NOW()

2012-12-28 Thread Michael Orlitzky
On 12/28/12 10:56, Joseph wrote:
 
 Your are correct, when I removed the quotes it worked.
 
 I'm backing it up through the backup.php sript that came with
 osCommerce, I can post it but it is a long one.
 

I am... familiar... with osCommerce. You will be much better off doing a
mysqldump if you have access. You can run it either on the server or
remotely if the MySQL ports on the server are open.



Re: [gentoo-user] php CURRENT_TIMESTAMP vs NOW()

2012-12-28 Thread Joseph

On 12/28/12 11:06, Michael Orlitzky wrote:

On 12/28/12 10:56, Joseph wrote:


Your are correct, when I removed the quotes it worked.

I'm backing it up through the backup.php sript that came with
osCommerce, I can post it but it is a long one.



I am... familiar... with osCommerce. You will be much better off doing a
mysqldump if you have access. You can run it either on the server or
remotely if the MySQL ports on the server are open.


Yes, I run osCommerce on my server.
Is the manuall command:

mysqldump --opt -ppassword catalog  catalog_backup.sql

--
Joseph



Re: [gentoo-user] php CURRENT_TIMESTAMP vs NOW()

2012-12-28 Thread Michael Orlitzky
On 12/28/12 12:51, Joseph wrote:
 
 Yes, I run osCommerce on my server.
 Is the manuall command:
 
 mysqldump --opt -ppassword catalog  catalog_backup.sql
 

I think --opt is on by default, but yes, that should do it. If you would
like to automate the backup (say, nightly), you can add the following to
~/.my.cnf [1]:

  [mysqldump]
  user = your mysql username
  password = your mysql password

Then, when you run the `mysqldump` command, it will use that username
and password automatically (and not prompt you). That way you can make
the backups in a cron job.


[1] Warning: chmod 600 the ~/.my.cnf file if you create one.



Re: [gentoo-user] php CURRENT_TIMESTAMP vs NOW()

2012-12-28 Thread Joseph

On 12/28/12 13:00, Michael Orlitzky wrote:

On 12/28/12 12:51, Joseph wrote:


Yes, I run osCommerce on my server.
Is the manuall command:

mysqldump --opt -ppassword catalog  catalog_backup.sql



I think --opt is on by default, but yes, that should do it. If you would
like to automate the backup (say, nightly), you can add the following to
~/.my.cnf [1]:

 [mysqldump]
 user = your mysql username
 password = your mysql password

Then, when you run the `mysqldump` command, it will use that username
and password automatically (and not prompt you). That way you can make
the backups in a cron job.


[1] Warning: chmod 600 the ~/.my.cnf file if you create one.


Thank you, that will help.
I'm stuck with oSCommerce 2.2rc2 as they don't want to put visa module in the 
new oSC ver. 3

{@} * {@} * {@} Happy New Year!
{@} * {@} * {@} * {@}   
{@} * {@} * {@}   
\ \ \ 2013 / / /


--
Joseph



[gentoo-user] php CURRENT_TIMESTAMP vs NOW()

2012-12-27 Thread Joseph

I'm not a PHP programmer but I'll try to explain my problem.
I've create table in my php database:

DROP TABLE IF EXISTS visual_verify_code;
CREATE TABLE visual_verify_code (
  oscsid varchar(32) NOT NULL,
  code varchar(6) NOT NULL,
  dt TIMESTAMP(12) NOT NULL DEFAULT NOW(),
  PRIMARY KEY (oscsid)
);

It worked OK, after few days I backup my database and try to restore it, but it keeps 
complaining on the dt:
ERROR 1067 (42000) at line 38009: Invalid default value for 'dt'

so the database is dropped but never restored. The backup data base contain:

create table visual_verify_code (
  oscsid varchar(32) not null ,
  code varchar(6) not null ,
  dt timestamp default 'CURRENT_TIMESTAMP' not null ,
  PRIMARY KEY (oscsid)
);

so the difference is:

 dt TIMESTAMP(12) NOT NULL DEFAULT NOW(),
vs
 dt timestamp default 'CURRENT_TIMESTAMP' not null ,

If I change in backup database the line to: dt TIMESTAMP(12) NOT NULL DEFAULT 
NOW(),
I can restore it without problems.  

Why is it doing it?  
In dt table structure the default has option:

- None
- As Defined:
- NULL
- CURRENT_TIMESTAMP

If I change setting from CURRENT_TIMESTAMP to any of the above will it help restore it correctly? 


--
Joseph



Re: [gentoo-user] php CURRENT_TIMESTAMP vs NOW()

2012-12-27 Thread Michael Orlitzky
On 12/28/2012 01:44 AM, Joseph wrote:
 I'm not a PHP programmer but I'll try to explain my problem.
 I've create table in my php database:
 
 DROP TABLE IF EXISTS visual_verify_code;
 CREATE TABLE visual_verify_code (
oscsid varchar(32) NOT NULL,
code varchar(6) NOT NULL,
dt TIMESTAMP(12) NOT NULL DEFAULT NOW(),
PRIMARY KEY (oscsid)
 );
 

Looks fine.


 It worked OK, after few days I backup my database and try to restore it, but 
 it keeps complaining on the dt:
 ERROR 1067 (42000) at line 38009: Invalid default value for 'dt'
 
 so the database is dropped but never restored. The backup data base contain:
 
 create table visual_verify_code (
oscsid varchar(32) not null ,
code varchar(6) not null ,
dt timestamp default 'CURRENT_TIMESTAMP' not null ,
PRIMARY KEY (oscsid)
 );


CURRENT_TIMESTAMP shouldn't be quoted. How are you backing up the database?