对于一般的猿媛来说,升级原来的程序绝对是一件痛苦的事情,而更痛苦的是:除了一个 projcet ,其他什么都没有,就连数据库字段的描述都没有,更不用说是设计文档,数据库设计文档,需求文档等等的。 最近大boss让对一个6年前的项目进行升级,不仅要把程序升
对于一般的猿媛来说,升级原来的程序绝对是一件痛苦的事情,而更痛苦的是:除了一个 projcet ,其他什么都没有,就连数据库字段的描述都没有,更不用说是设计文档,数据库设计文档,需求文档等等的。
最近大boss让对一个6年前的项目进行升级,不仅要把程序升级,界面更换,而且还要从sql server 数据库迁移到mysql 上来,可是当拿到项目的那一刻,真是头大。因为除了项目本身,其他什么都没有,而且项目开发人员早已经离职,任何文档都没有,就连各个表的字段描述都没有,只能凭借程序猿的第六感来猜测各个字段是什么意思... ...
废话不说了,直接说问题,在修改到某一个查询时候,报错:java.sql.SQLException: Invalid column name 。第一眼一看,我靠这以前都能好好运行的项目,没有做任何的改动,怎么能这样呐,有点晕了,语句如下:
SELECT distinct s.id AS id, s.name AS name, s.url AS url,s.siteMap as siteMap,s.isFlag as isFlag, s.stat AS stat, t.id as tmpl_id, t.description as tmDescription FROM bbs_site1 s LEFT JOIN bbs_tmpl1 t ON s.tmpl_id = t.id where 1=1
自从棱角之后,谷爸算是彻底赶出了神州大地,哎,咋说呐,猿媛们不还得生活,不还得赚money吗,好歹也要想办法找到谷爸吧,不是难事,可难 的是:怎么着也没有找到我想要的答案,为啥这个语句就会报错?
本猿百思不得其解,尝试使用索引获取,不行,使用sql的resultset 获取字符串,也不OK ,气死我了,
好在天无绝人之路,哥哥终于找到原因了,因为程序底层使用的是rowset (继承之resultset),对于红色部分的id颇有不满,不知道取那个,它不会按照as 后边的别名来取值,之后按照id来取值,真的是很不知所以,不过,找到问题之后,解决方案也就来了。第一个使用id (rs.getInt("id")),第二个id就使用索引来取值(rs.getInt(index)),这样一切都OK 了。真的是不知道原来还有这么大的一个坑呀,受教了哦,故记录在此。
改完之后,一想,真的是觉得以前的思路,方式欠妥,也算是给自己提点意见:
1. 程序设计时候,字段的意思一定要给出描述,即便是不描述,也要在文档中做出明确的说明。
2,每个字段符合通俗,易用原则,一看字段就知道是什么意思,比如name ,人有name,物品有name ,如果都定位name,就不好了,而应该界定好:per_name, pro_name 这样是否会好多了呐?
3.文档说明,没有文档说明,让被人改动codes,真的是很犯晕。
4. 注释,这个也是很头痛的事情,在本项目中,他没有给注释,我卡卡卡卡,一个函数写几十行,而且还是乱换行,哥真的是脾气好,不然真得发怒了。
5,可扩展性,着点很多时候都没有考虑到,尤其是在程序升级或者是添加新功能的时候,所以这个应该是一个共性,值得好好思索。
6.公共的,通用的方法,类,函数等的一定要提出来,千万不要遇到一次写一次,太麻烦了。
以上这六点算是本猿提出的小小建议,确实值得思考、、、 、、、
知易行难,都知道这些,再次说出来,无非是引起重视,可是究竟自己做的怎么样,那只有自己之道了。

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 English version
Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.