mysql

CREATE TABLE auto append default columns?

In MySQL, is it possible to append default columns after creation or create them automatically? A brief overview is this: All tables must have 5 fields that are standardized across our databases (created_on, created_by, row_status etc). Its sometimes hard for developers to remember to do this and/or not done uniformly. Going forward we'...

Coldfusion and mySQL - seeking recommendations for general and off site backup strategy

CF9, Windows Server 2008 Standard, IIS7, mySQL 5.1.48 community. I have managed to get CF to take a database mySQLdump which I was going to run as a nightly cfschedule task, with a server time based lock on the application controlled in application.cfc That will get me a local copy, but whats the best strategy to encrypt the datadump....

The best way to name tables

hi just a quick question, is it better to use underscore whilst naming tables or is it better to use camelcase. example table_name or tableName which one is better? and if there is a reason to be using either what is it? many thanks. ...

Mysql, replace entire column with another tables column.

I have a column in a table which needs to be replaced with a column from another table. Basically one is the short description of items and the other (that was found in another table) is the long descriptions of the same items in the same order. I'm pretty new to actually writing queries with mysql, (i've always relied on ActiveRecord o...

How to validate expiry date on MySQL query

Here is my current mysql table id | file | expiry_date --------------------------------------- 1 | sample.zip | 2010-02-03 11:07:03 2 | sample2.zip | 2010-07-13 11:07:03 Query: SELECT * FROM download WHERE expiry_date` `how to validate here` I want to validate if expiry_date is expired the file cannot download....

Hibernate mysql innodb

Hi! I wanted to force hibernate to use innodb. So, i changed the "hibernate.dialect" in order to have innodb, but i can connect to mysql, but when i do some transactions i have the following error: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.Rol...

PHP MYSQL upload file and store as blob

I am trying to create the functionality to upload a file in PHP and store it in my mysql database as a BLOB. I have run into a few issues that I need some help on. The first issue is how can I do this without using forms? I am currently using the codeigniter framework and I do not want have the form do anything on the action, I would p...

Should I ping mysql server before each query?

So I was wondering whether I should or should not ping the mysql server (mysqli_ping) to ensure that the server is always alive before running query? ...

IIS + PHP + MySQL returns 500 - Internal server error

We're building a new server and using IIS 7. PHP pages a served just fine and dandy, but the second we use any code to access a MySQL database, the page hangs for a good minute and serves the following error: Server Error 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed. ...

Mysql Many to Many Query

I have a many to many table setup in my mysql database. Teams can be in many games and each game has 2 teams. There is a table in between them called teams_games. SHOW CREATE TABLE information follows. I have been messing with this query for a while. At this point I don't care if it requires sub-queries, joins, or unions. I have tried a...

Adding data from Excel to Mysql via VBA

UPDATED QUESTION...SEE BELOW I have an excel sheet which accesses a MySQL db as a backend.... I insert new records into MySql the following way, but I am not sure if this is the best way. For rowline = 1 To 50 strSQL = myquerystring (INSERT 5 columns per excel row) rs.Open strSQL, oConn, adOpenDynamic, adLock...

MySQL and PHP: Atomicity and re-entrancy of a PHP code block executing two subsequent queries - how dangerous?

In MySQL I have to check whether select query has returned any records, if not I insert a record. I am afraid though that the whole if-else operation in PHP scripts is NOT as atomic as I would like, i.e. will break in some scenarios, for example if another instance of the script is called where the same record needs to be worked with: i...

how to get text of item checked in dhtmlx using`getAllChecked()`

Hi, I am using dhtmlx to populate mysql data in treeview in php. Everything was fine, except, when I use getAllChecked() to get all the items checked as array, it shows identificators instead of text of the nodes. Is anyone of you have used dhtmlx, can you please help me out in getting the text of node instead of id please? ...

MySql (Update-) SP only works in terminal ?

I have a stored procedure that works in the mysql> terminal, but when I try to run it through my application it doesn't work. I don't get any error messages or anything. If I try to execute the sp through MySql Query Browser the response is simply : "Query canceled." This particular SP is just a simple update command, but I have other...

How do you merge rows from 2 SQL tables without duplicating rows?

Hi, I guess this query is a little basic and I should know more about SQL but haven't done much with joins yet which I guess is the solution here. What I have is a table of people and a table of job roles they hold. A person can have multiple jobs and I wish to have one set of results with a row per person containing their details and...

MySQL query question, I can't get it.

I hope someone can help me out. I have a table that logs our import jobs. I need a query that will produce a matrix with the names of tables on the vertical axis, the import dates on the horizontal axis, and the total number of records imported for that table on that date in the matrix cell. I don't care if we have to create a temporary ...

Use of URL Fields in Doctrine

I am building the site and planning on implementing OpenID. I can get an OpenID URL back from Google, but Doctrine appears to do funny things with URLs in the where clause of my query. How can I fix that? Here is the function /* This function queries docrtrine for a user OpenID URL * and returns the user object. */ function getUserBy...

Can I start logging application-initiated sql queries so I can learn what it's doing?

Hey, I'm learning an ecommerce package (Spree). The problem arises after I delete a product thru the GUI. I try to manually undo the delete by changing/adding rows back in, but I fail. My question is this: is there any way I can add application or dbms code/config/software to log transactions? Preferably, this will work with sqlite3,...

Updating a mySQL column

Hi guys, I would like to update a mySQL column, basically I would like to get a specific user in the DB, and then add the number I have to the number in the DB column. So say for instance user 12345 has 55 points, and I wanna add 25 points to his score, how would I go about updating the points column to reflect 80? Thanx in advance! ...

Character encoding issue between different versions of PHP, Apache and MySQL.

I recently converted an old MySQL database stored as latin1_swedish_ci to utf8_general_ci. I've now got the the HTTP header specifying UTF-8, the HTML tag on the page, and the data in the database is correctly encoded as utf8_general_ci. It all works fine on my testing server, so I upload the updated HTML files and PHP scripts to the ...