MySQL操作程序二十(mscorder1.pl,mscorder1.htm)

返回


追加packing时,同时在738/524的packing栏追加M670,因为738/524一齐packing。 mysql> select id, packing from order1 where length(packing) > 5; +-------+-------------------------+ | id | packing | +-------+-------------------------+ | 670 | 738=524 | | 4815 | 6036=6891 | | 6203 | 6505=6712=6714 | | 6421 | 6665=6430=6732 | | 6970 | 7659=7657 | | 7028 | 10012=9968 | | 7111 | 7112=7115 | | 7283 | 7342=7344 | | 7522 | 7526=7527=7528=7529 | | 8185 | 5617=5618 | | 8487 | 8499=8543 | | 8630 | 8634=8643 | | 11069 | 10959=10821=10769=11038 | +-------+-------------------------+ 13 rows in set (0.01 sec) 追加shipping时,同时在11330/11331/11332的shipping栏追加M12110,因为11330/11331/11332和12110一齐shipping。 mysql> select id, shipping,length(shipping) from order1 where id = 12110; +-------+-------------------+------------------+ | id | shipping | length(shipping) | +-------+-------------------+------------------+ | 12110 | 11330=11331=11332 | 17 | +-------+-------------------+------------------+ 1 row in set (0.08 sec) mysql> update order1 set orderno = 'NO' where length(orderno) < 2; Query OK, 9828 rows affected (0.44 sec) Rows matched: 9828 Changed: 9828 Warnings: 0 mysql> select id,orderno from order1 where length(orderno) < 2; Empty set (0.02 sec) mysql> show columns from order1; +-----------------+-----------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------+-----------+------+-----+------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | NULL | | | orderno | char(100) | NO | | NO | | | ORIGINid | int(11) | YES | | NULL | | | PRICEid | int(11) | YES | | NULL | | | PAYMENTid | int(11) | YES | | NULL | | | DELIVERY | text | YES | | NULL | | | memo | text | YES | | NULL | | | consignee | text | YES | | NULL | | | changeprice | text | YES | | NULL | | | discount | text | YES | | NULL | | | total | text | YES | | NULL | | | LANGUAGEid | int(11) | YES | | NULL | | | packing_charge | text | YES | | NULL | | | freight_charges | text | YES | | NULL | | | delivery_charge | text | YES | | NULL | | | delivery_place | text | YES | | NULL | | | disc | text | YES | | NULL | | | shipping | text | YES | | NULL | | | packing | text | YES | | NULL | | | packing_info | text | YES | | NULL | | | post | char(100) | NO | | NO | | | posttime | date | NO | | 2011-00-00 | | | paytime | date | NO | | 0000-00-00 | | | status | int(11) | NO | | 0 | | | arrivaltime | date | NO | | 2011-00-00 | | | arrivalmemo | text | YES | | NULL | | | size | text | YES | | NULL | | | weight | text | YES | | NULL | | +-----------------+-----------+------+-----+------------+----------------+ 29 rows in set (1.16 sec) mysql> ALTER TABLE order1 CHANGE orderno orderno char(100) NOT NULL DEFAULT 'NO' ; Query OK, 12383 rows affected (1.13 sec) Records: 12383 Duplicates: 0 Warnings: 0 注意:要先把NULL的orderno都写入NO! mysql> UPDATE order1 SET orderno = 'NO' WHERE orderno IS NULL; Query OK, 10 rows affected (0.16 sec) Rows matched: 10 Changed: 10 Warnings: 0 mysql> select id, orderno from order1 where length(orderno) > 20; +------+-----------------------+ | id | orderno | +------+-----------------------+ | 2049 | 330-08,UIR28557-12-08 | | 7036 | FQN-SP-002.005.006-10 | +------+-----------------------+ 2 rows in set (0.01 sec) mysql> select id, orderno from order1 where length(orderno) > 30; Empty set (0.03 sec) mysql> ALTER TABLE order1 CHANGE orderno orderno char(100) NOT NULL DEFAULT 'NO' ; ERROR 1265 (01000): Data truncated for column 'orderno' at row 12373 mysql> ALTER TABLE order1 MODIFY orderno TEXT NOT NULL DEFAULT 'NO'; ERROR 1101 (42000): BLOB/TEXT column 'orderno' can't have a default value mysql> show columns from order1; +-----------------+-----------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------+-----------+------+-----+------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | NULL | | | orderno | text | YES | | NULL | | | ORIGINid | int(11) | YES | | NULL | | | PRICEid | int(11) | YES | | NULL | | | PAYMENTid | int(11) | YES | | NULL | | | DELIVERY | text | YES | | NULL | | | memo | text | YES | | NULL | | | consignee | text | YES | | NULL | | | changeprice | text | YES | | NULL | | | discount | text | YES | | NULL | | | total | text | YES | | NULL | | | LANGUAGEid | int(11) | YES | | NULL | | | packing_charge | text | YES | | NULL | | | freight_charges | text | YES | | NULL | | | delivery_charge | text | YES | | NULL | | | delivery_place | text | YES | | NULL | | | disc | text | YES | | NULL | | | shipping | text | YES | | NULL | | | packing | text | YES | | NULL | | | packing_info | text | YES | | NULL | | | post | char(100) | NO | | NO | | | posttime | date | NO | | 2011-00-00 | | | paytime | date | NO | | 0000-00-00 | | | status | int(11) | NO | | 0 | | | arrivaltime | date | NO | | 2011-00-00 | | | arrivalmemo | text | YES | | NULL | | | size | text | YES | | NULL | | | weight | text | YES | | NULL | | +-----------------+-----------+------+-----+------------+----------------+ 29 rows in set (0.02 sec)
[Sun Sep 12 12:42:52 2010] [error] [client 127.0.0.1] Use of uninitialized value in array dereference at ./pro/mscorder1.pl line 366, <CONFIG> line 11., # 输入价格表格 $$pref{id} = $t{order1_id}; ($pref,$self) = show_parts3($pref,$self); 366: @loop1 = @{ $$pref{list} }; 修改如下(该修改失败!): if (@{ $$pref{list} }) @loop1 = @{ $$pref{list} }; } else { @loop1 = (); } 增加如下(该修改成功!): sub show_parts3 { my ($pref,$self) = @_; my(%t,$n,$n1,%seen,$item); @{ $$pref{list} } = (); [Sun Sep 12 12:53:39 2010] [error] [client 127.0.0.1] Argument "P2" isn't numeric in multiplication (*) at ./pro/mscorder1.pl line 652, <CONFIG> line 11., referer: http://localhost/cgi-bin/msc_start.cgi [Sun Sep 12 12:53:39 2010] [error] [client 127.0.0.1] Use of uninitialized value in multiplication (*) at ./pro/mscorder1.pl line 652, <CONFIG> line 11., referer: http://localhost/cgi-bin/msc_start.cgi 652: $t{price2} = $t{prices}[$t{NO}-1]*$t{Q1}; 修改如下: if ( $t{price1} && $t{price1} ne 'P2') { $t{price2} = $t{prices}[$t{NO}-1]*$t{Q1}; } else { $t{price2} = 0; } ---------------------------------------------------------------- $t{content} = $t{q}->param("content"); $t{content} =~ s/\s+$//; # 把后面的空格去掉
返回