mysql

How do you modify a Domain Class in Grails?

I can't figure how what the "standard practice" is for modifying a Domain Class after it has automatically created the corresponding database table. There's no "migration" in Grails, and there's no way that I can find to tell it to output the new SQL it would generate so you can compare it to the previous table definition and manually i...

PHP\MySql Multiuser System Backend Structure

Hey guys I'm writing a multiple user log in system using PHP and MySql, the way i have done it in the past is to have a central "processing" file that will handle all of the code on the backend, like logging in, messaging other users etc..., I've used forms with hidden fields to define which action to perform in the processing file. he...

Creating Date Intervals in Python

I want to use a for loop to print every date between 2 dates. Actually going to merge this with a MySQL query to pass the date into the query itself and into the filename of the output. So, how can I change this: sum = 0 for i in range(1,11): print sum sum += i To this? InputDate = '2009-01-01' for i in range('2009-01-01','2009-0...

How to add links to a html formatted text? (randomly, using program)

I am using PHP. I have some articles stored in MySQL and they all have some style (like with some css or tags). Now I have to add some links to some text randomly and automatically. This means I have to add links to the text and make sure the links do not break the style. I think the most difficult part is how to add links but not to ...

Drawbacks to having (potentially) thousands of directories in a server instead of a database?

I'm trying to start using plain text files to store data on a server, rather than storing them all in a big MySQL database. The problem is that I would likely be generating thousands of folders and hundreds of thousands of files (if I ever have to scale). What are the problems with doing this? Does it get really slow? Is it about the sam...

Executing a MySQL query on command line via os.system in Python

I am trying to pass the 'day' from the while loop into a sql statement that then gets passed into a MySQL command line to be executed with -e I can not use the DB module or other python libraries to access MySQL, it needs to be done via command line. It also looks like I might need to convert the day to a string before concatenating to...

Selecting data in MySQL and limiting (WHERE) by temporary column data

I am trying to sort order-entries by their status, however in my database there is no column for status and I'm trying to generate it on-the-fly with current values on other columns in the database. I've created a "temporary" column in my query with a CASE-statement. What I want to do now is get only the table rows that match the value ...

Rollback and Preview in a CMS

I am creating a CMS and am using serialize to handle publish and rollback, which seems to work fine. Basically, The normal site tables are what gets displayed and anything not displayed is serialized in a separate table. The problem however is in making the 'Preview' functions work. Since the front end is created using normal SQL ca...

Problem with ä,ö, å etc. characters in MySQL 5

I have MySQL 5.xx running on Linux system. My application writes correctly ä, ö, å etc. characters to database and even gets these values correctly. But when I use WHERE to filter search for char 'ä', it will return also Strings that contain 'a' chars. Why MySQL thinks that a is equal to ä? Example query: SELECT column FROM table WHER...

Sql query (inner join + count + group by) using Propel

I want to show the number of comments for each blog post (along with category, date, author etc) on a page that has a list of blog posts. How do i write the following mysql query in propel? SELECT post.id, post.title, post.more_columns , COUNT(comments.post_id) AS numofcomments FROM post INNER JOIN comments ON post.id = comments.post_id...

C++ mysql and boost asio header conflict

There seems to be a conflict with the windows headers between the mysql c-api and boost::asio. If I include mysql first I get: boost/asio/detail/socket_types.hpp(27) : fatal error C1189: #error : WinSock.h has already been included #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) # if defined(_WINSOCKAPI_) && !defined(_WINSOCK2A...

Mysql NDB Cluster add another data node after setup

Hi All, I have a NDB Cluster set up with two data nodes, i want to add third data node in this, What steps i need to follow. For ex:- I have to install mysql server on that third server and change the config file add the third server ip. Please correct me if i am wrong Thanks in advance ...

MySQL Join excluding certain records?

Hi, i'm trying to build a join, but I can't get it to work in MySQL, I know there must be a way. I have two tables: 1. Setting and 2. User_Setting (and ofcourse User but that won't be needed here). Structure Setting.setting_id Setting.description Setting.value_type Setting.default_value User_Setting.user_id User_Setting.setting_id ...

INSERT INTO wont work!

im having some problem with this code: if (count($_POST)) { $username = mysql_real_escape_string($_POST['username']); $passwd = mysql_real_escape_string($_POST['passwd']); mysql_query("INSERT INTO users (username, password) VALUES ($username, $passwd)"); } <form method="post"> <p><input type="text" name="username" /></...

Adobe AIR with PHP/MySql or sqllite

What would be a better choice for making a database driven Adobe AIR(Desktop) application? Using PHP+MySql with AIR OR Using SQLite If I choose SQLite, then I cannot reuse my code for an online application. If I choose 1, I have to block few port numbers on User's machine. Also, I am using XAMPP for providing the user with PHP a...

MySQL triggers: move to trash

I want to create a trigger in MySQL that will do two things: if forum's topic is located in trash or it is hidden, delete it, elsewhere move the topic to trash. The question is how to stop the delete action in 'before delete' trigger? ...

Get the type of a variable in MySQL

If I define a variable like set @a = "1";. How can I see that @a is a string? ...

Getting last months data from the database

My query currently gets yesterdays data but I now want to get all of last months data. (E.g.from 1st to 31st) $res = mysql_query("SELECT FROM_UNIXTIME( enquiry_time ), `id` , `fullname` , `address1` , `citytown` , `postcode` , `telno` , `property_value` ,`total_secured_debt` , `email` , `on_market` , `agent` , `reason` , `price_conce...

checking to see if data exist with in a table

How do i go about looking into a table and searching to see if a row exist. the back gorund behind it is the table is called enemies. Every row has a unique id and is set to auto_increment. Each row also has a unique value called monsterid. the monster id isn't auto_increment. when a monster dies the row is deleted and replaced by a new...

VARCHARS: 2, 4, 8, 16, etc.? Or 1, 3, 7, 15, etc.?

I see VARCHAR(255) being used all the time instead of VARCHAR(256), but I also see VARCHAR(16) being used instead of VARCHAR(15). This seems inconsistent to me. If an extra byte is being used to store the VARCHAR's length, shouldn't this rule also apply to the smaller lengths like 2, 4, 8 to be 1, 3, 7, instead? Or am I totally missing ...