database

In django, how can I include some default records in my models.py?

If I have a models.py like class WidgetType(models.Model): name = models.CharField(max_length=200) class Widget(models.Model): typeid = models.ForeignKey(WidgetType) data = models.CharField(max_length=200) How can I build in a set of built in constant values for WidgetType when I know I'm only going to have a certain f...

Cakephp, don't use a databse table.

I don't a controllers model to use a database table. I have a pages controller and model but it is saying "pages table not found". How do I tell the model not to use a the database at all? Cheers! ...

"Data type mismatch in criteria expression"

Hey guys ! I have a problem when i want to insert values from textboxes to my access database ! When i want to save i get that error ("Data type mismatch in criteria expression") The code: string conString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\\Users\\Simon\\Desktop\\test5\\test5\\test5\\save.mdb"; Ole...

Multiple table relationships in Zend Help

Hi Guys I have been doing some DB mapping to link two tables to no avail. Everytime I run the code I get the following error: Message: File "Role.php" does not exist or class "Role" was not found in the file Stack trace: #0 C:\wamp\www\zend\library\Zend\Db\Table\Row\Abstract.php(867): Zend_Db_Table_Row_Abstract->_getTableFromString('R...

What are the best settings of the H2 database for high concurrency?

There are a lot of settings that can be used in H2 database. AUTO_SERVER, MVCC, LOCK_MODE, FILE_LOCK and MULTI_THREADED. I wonder what combination works best for high concurrency setup e.g. one thread is doing INSERTs and another connection does some UPDATEs and SELECTs? I tried MVCC=TRUE;LOCK_MODE=3lFILE_LOCK=NO but whenever I do some ...

INET_ATON() and INET_NTOA() in PHP?

I want to store IP addresses in my database, but I also need to use them throughout my application. I read about using INET_ATON() and INET_NTOA() in my MySQL queries to get a 32-bit unsigned integer out of an IP address, which is exactly what I want as it will make searching through the database faster than using char(15). The thing is...

C#: thread makes crash with blue screen

Hi all.In my project I am using thread to search via bluetooth devices.But when it searchs some times it crashs and appears ble screan.I couldent read all because it restarts computer but I saw that it is abour some ram blocks. X8001 something like this.Is thread couse this?Or I am also using database Mysql.When it searchs it also gets v...

select statement in C#

Where's the problem in my code ? string constr = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\\Users\\Simon\\Desktop\\test5\\test5\\test5\\save.mdb"; OleDbConnection conn = new OleDbConnection(constr); string sql = "SELECT users.user_name,naziv,obroki_save.datum" + "FROM zivila JOIN obroki_save ON zivila.ID=obroki_save.ID_...

Kohana v3, automatically escape illegal characters?

Quick question, does Kohana (version 3) automatically escape data that is passed into ORM::factory..... (and everywhere else that has to do with the database)? For example: $thread = ORM::factory('thread', $this->request->param('id')); Would the data passed in the second argument be auto-escaped before it goes in the SQL query or do ...

Best way for saving infinit playlists (arrays) into db? (php mySql)

So client gives me a string like "1,23,23,abc,ggg,544,tf4," from user 12 . There can be infinit number of elements with no spaces just value,value,... structure. I have users table (with users uId(key), names etc). I have streams table with ( sId(key), externalID, etc values). User sends me externalId's. And I need to hawe externalId's ...

sql statement question. Need to query 3 tables in one go!

Hey there, I have an sql database. In this database is 3 tables I need to query. The first table has all the item info called item and the other two tables has data for votes and comments called userComment and the third for votes called userItem I currently have a function which uses this sql query to get the latest more popular (in te...

Would an ORM have any way of determining that a SQLite column contains date-times or booleans?

I've been thinking about using SQLite for my next project, but I'm concerned that it seems to lack proper datetime and bit data types. If I use DbLinq (or some other ORM) to generate C# classes, will the data types of the properties be "dumbed down"? Will date-time data be placed in properties of type string or double? Will boolean data...

Adjusting sql statement in a function based upon input

Hey there, This is a bit urgent! I'm trying to make a simple filter search where-by you can choose from a series of 3 drop downs and then based upon this the results are then displayed, How would I go about adjusting the sql query for each and if you were to only choose to search from aone of the 3 rather than all 3 etc... example ther...

Database Replication

I have tried to follow the steps outlined in http://www.howtoforge.com/mysql_database_replication for Database Replication. I have created the database exampledb, and create some tables and load them with values. But when I execute USE exampledb; FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS; I do not get any output, it says 0 rows ...

SQL to retrieve the latest records, grouping by unique foreign keys

I'm creating query to retrieve the latest posts in a forum using a SQL DB. I've got a table called "Post". Each post has a foreign key relation to a "Thread" and a "User" as well as a creation date. The trick is I don't want to show two posts by the same user or two posts in the same thread. Is it possible to create a query that contai...

How do I load a sql.gz file to my database? (importing)

is this right? mysql -uroot -ppassword mydb < myfile.sql.gz ...

Is this safe? Is this OK to do in MYSQL?

I have always done this: mysqldump -hlocalhost -uuser -ppass MYDATABASE > /home/f/db_backup/MYDATABASE.sql mysql -uuser -ppass MYDATABASE < MYDATABASE.sql But, if I do this instead...is this safe? Is this identical to the above??? mysqldump -hlocalhost -uuser -ppass MYDATABASE | gzip > /home/f/db_backup/MYDATABASE.sql.gz zcat MYDATAB...

When SET SCAN ON used after END throws error

Hi, Im trying to use SET SCAN ON after as follows.. SET SCAN OFF; DECLARE -- declared a variable BEGIN --update statement END; SET SCAN ON; The use of SET SCAN ON; is causing the error when i try to run the script. The error captured ORA-06550: line 16, column 1: PLS-00103: Encountered the symbol "SET" 06550. 00000 - "line ...

What is AppEngine database "cold start time"?

One of the more common complaints I have read about the AppEngine database (for Java) is that it is extremely slow when it come to "cold start time". What does this mean? And is it something I should be worried about? ...

ASP .net Dropdown list not saving the selected value to database

Hi In the following code i want to save the value selected by user from drop downlist into database. but whatever value is selected by user, first value of dropdown lsit is saved to database View <% =Html.DropDownList("lstUsertype", (SelectList)ViewData["UserTypeID"])%> Controller public ActionResult CreateUser() { ...