database

Why can't I do this INSERT in MYSQL? (Python MySQLdb)

This is a follow up to this question I asked earlier: http://stackoverflow.com/questions/2267034/why-cant-i-insert-into-mysql/2267076#2267076 That question solved it partly. Now I'm doing it in Python and it's not working :( cursor.execute("INSERT INTO life(user_id, utm) values(%s,PointFromWKB(point(%s,%s)))",the_user_id, utm_easting,...

How do I use the @ sign in Mysql?

A user on SO recently gave me this Query to put into MYSQL, but I don't know what to do with the @ sign. SELECT user_id, GLength(LineString(utm, @mypoint)) FROM users WHERE MBRWithin(utm, LineString(Point(X(@mypoint) - 20, Y(@mypoint - 20)), Point(X(@mypoint) + 20, Y(@mypoint + 20)) AND GLength(LineString(utm, @mypoint)) <...

Find the distance between two points in MYSQL. (using the Point Datatype)

Suppose I have a 2 column table like this: | user_id | int(11) | NO | UNI | NULL | | | utm | point | NO | MUL | NULL | | As you can see, it's very simple. utm is a Point data-type. I insert it like this: INSERT INTO mytable(user_id, utm) VALUES(1, PointFromWKB(point(50, 50))); ...

mysql is handling one sql query at the time?

if you got 100 000 users, is mysql executing one sql query at the time? cause in my php code i check if a certain row exists. if it doesn't it creates one. if it does, it just update the row counter. it crossed my mind that perhaps 100 users are checking if the row exists at the same time, and when it doesn't they all create one row ea...

Using a remote PHP service with Flex (Flash Builder) AIR Application?

Hello, I'm developing a Adobe AIR application using Flash Builder 4. This app needs to access a remote PHP service which is being hosted on a remote web server. I am having troubles figuring out how to add a PHP data service which uses a remote service. I can add the PHP data service in Flash Builder as a service hosted on localhos...

help with sql query with parentheses

i have following code: SELECT * FROM table WHERE thread = $thread AND (user != $user1 OR user != $user2) i want the code to pick all rows that contains $thread BUT the user isn't $user1 or $user2. is my code correct? or should it be like: SELECT * FROM table WHERE thread = $thread (AND user != $user1 OR user != $user2) thanks in a...

Why Django does not create full table from a model?

I have 2 models. I run manage.py syncdb but it creates only id fields for 2 models. How to make it generate the remaining fields? Please kindly advise. Your help is much appreciated! Here's my models.py: from django.db import models GENDER_CHOICES = ( ('M', 'Male') , ('F', 'Female') ) ACTIVATION_CHOICES = ( ('Y', 'Activat...

Is there a Ruby database migration gem, that helps you move content from an old structure to a new structure?

Hi there, Are there any Ruby gems/libraries that help you migrate from an old DB structure to a new structure? ActiveRecord migrations do a good job keeping track of a new db structure, but I wonder if there's something that helps you migrate an entire legacy db to a new structure: transfer_from(:source_table => 'person', :destination_...

Compound/Composite primary/unique key with Django

How to create models and tables with Compound/Composite primary/unique key with Django? ...

When to split up models into multiple database tables?

I'm working with Ruby on Rails, but this question I think is broader than that and applies to database design generally. When is it a good idea to split a single model up into multiple tables? For example, assume I have a User model, and the number of fields in the model is really starting to add up. For example, the User can enter hi...

negation of Set unused command

Hi, Is there any option available for restoring a column which is set unused by ALTER TABLE command? ...

Database schema - organise by object or data?

I'm refactoring a horribly interwoven db schema, it's not that it's overly normalised; just grown ugly over time and not terribly well laid out. There are several tables (forum boards, forum posts, idea posts, blog entries) that share virtually identical data structures and composition, but are seperated simply because they represent di...

Is there any way to access a datasource from one project, in another project?

I have access to a database table that has been added as a datasource in project (A). Is there any way to refer to this database table from project (B) WITHOUT adding it to project (B)'s datasource? i.e. ProjB.databasetable.GetDataSetSchema Any ideas would be really appreciated. Thanks guys! ...

How can I access a codeigniter config variable from a model/controller?

I would like to access the $db['default']['dbprefix'] variable from /application/config/database.php from within a model so I can write my own queries using the value from the file. How can this be done? ...

How can I store data against specific contact ID?

I want to store some additional data for each contact on Android. I would have in mind creating my own database table for it, and then bind them to the real contact via a unique id. I am wondering if Android has built in functionality to store additional data against contacts? EDIT 2 Is there a defined field for birthday of the contact...

Best database solution for managing a huge amount of data

I have to design a traffic database which includes data from different towns (8 towns) 2mb in a period of 10 min for each town 24h. The incoming data is the same for all Town. So my first question is what is better on the performance side: design one database for all towns with many tables (one table for each town) or design many databas...

Retrieving encrypted data in code

I am using sql server 2k5 database encryption with a symmetric key protected by password. Symmteric key password is stored in memory on the server and cannot be stored in plain text in sps. In SQL Mgmt Studio, i run a query opening key, exec Mysp and closing key - data returns decrypted. In my c# code tho, when i want to call the same s...

How to store the object data in mysql db using php class function?

Hello! I have created a table in DB with name "member" having field "name", "college", "email", "zid" now I have created a class(in php) like class member { private $name,$college,$email,$zid; private function adduser { //function definition } public function autherise($id) { //function definition } } now at index page...

Match text against wildcard expressions in database?

Given an input string, I'd like to return the rows from a (MySQL) database that contain a wildcard expression that would match the string. For example, if I have a table containing these wildcard expressions: foo.* foo.bar.* erg.foo.* and my input string is "foo.bar.baz", then I should get the rows "foo.*" and "foo.bar.*". Any ideas ...

VB6 ADODB Fails with SQL Compact: Multipe-Step operation generated errors

Hi, I am converting an old application to use SQL Compact database (it works ok with SQ Server 2005 and 2008) and using the following code gives an error when attempting to execute a simple select command: Private Const mSqlProvider As String = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;" Private Const mSqlHost ...