Search Results

Search found 955 results on 39 pages for 'inserts'.

Page 10/39 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Cleanest way to build an SQL string in Java

    - by Vidar
    I want to build an SQL string to do database manipulation (updates, deletes, inserts, selects, that sort of thing) - instead of the awful string concat method using millions of "+"'s and quotes which is unreadable at best - there must be a better way. I did think of using MessageFormat - but its supposed to be used for user messages, although I think it would do a reasonable job - but I guess there should be something more aligned to SQL type operations in the java sql libraries. Would Groovy be any good? Any help much appreciated.

    Read the article

  • MySQL database - backup problem

    - by Mike
    Hi I need to backup MySQL database and then deploy it on another MySQL server. The problem is, I need it backup without data , just script which creates database, tables, procedures, users, resets autoincrements etc. ... I tried MySQL administrator tool (Windows) and UNchecked "complete inserts check box", but it still created it ... Thanks in advance

    Read the article

  • validation in php

    - by fusion
    i have a submit page in html. when i submit the form data, it goes to a php page, which inserts the data in the database. my question is how would i ensure that the data on the html page is not null or empty without using javascript? is there anyway this could be done in php? thanks!

    Read the article

  • editing Rnw in Emacs, gets confused if in math mode or not

    - by stevejb
    When editing .Rnw files with emacs, sometimes it gets confused as to if I am in math mode or not. Then, the syntax highlighting gets messed up, and C-f-i inserts \textit{} and \mathit{} opposite to how it normally should. Is seems like there is some bool storing the state of math mode or not, and it gets inadvertently flipped. Is there a way I can manually flip it back?

    Read the article

  • INSERT and transaction serialization in PostreSQL

    - by Alexander
    I have a question. Transaction isolation level is set to serializable. When the one user opens a transaction and INSERTs or UPDATEs data in "table1" and then another user opens a transaction and tries to INSERT data to the same table, does the second user need to wait 'til the first user commits the transaction?

    Read the article

  • Should we denormalize database to improve performance?

    - by Groo
    We have a requirement to store 500 measurements per second, coming from several devices. Each measurement consists of a timestamp, a quantity type, and several vector values. Right now there is 8 vector values per measurement, and we may consider this number to be constant for needs of our prototype project. We are using HNibernate. Tests are done in SQLite (disk file db, not in-memory), but production will probably be MsSQL. Our Measurement entity class is the one that holds a single measurement, and looks like this: public class Measurement { public virtual Guid Id { get; private set; } public virtual Device Device { get; private set; } public virtual Timestamp Timestamp { get; private set; } public virtual IList<VectorValue> Vectors { get; private set; } } Vector values are stored in a separate table, so that each of them references its parent measurement through a foreign key. We have done a couple of things to ensure that generated SQL is (reasonably) efficient: we are using Guid.Comb for generating IDs, we are flushing around 500 items in a single transaction, ADO.Net batch size is set to 100 (I think SQLIte does not support batch updates? But it might be useful later). The problem Right now we can insert 150-200 measurements per second (which is not fast enough, although this is SQLite we are talking about). Looking at the generated SQL, we can see that in a single transaction we insert (as expected): 1 timestamp 1 measurement 8 vector values which means that we are actually doing 10x more single table inserts: 1500-2000 per second. If we placed everything (all 8 vector values and the timestamp) into the measurement table (adding 9 dedicated columns), it seems that we could increase our insert speed up to 10 times. Switching to SQL server will improve performance, but we would like to know if there might be a way to avoid unnecessary performance costs related to the way database is organized right now. [Edit] With in-memory SQLite I get around 350 items/sec (3500 single table inserts), which I believe is about as good as it gets with NHibernate (taking this post for reference: http://ayende.com/Blog/archive/2009/08/22/nhibernate-perf-tricks.aspx). But I might as well switch to SQL server and stop assuming things, right? I will update my post as soon as I test it.

    Read the article

  • datagrid doesn't refresh on changed data

    - by Jakob
    Hi. I have 2 datagrids with data that binds at loadtime in xaml. Then I have a button that inserts a row in the database, but rows aren't added to the datagrids when I press the button. I would like a fix that doesn't just add a gridrow, but actually refreshes the data and fetches the new row from the db. I'm using riaservices, so if that opens up to any tools that can help me, please let me know? thx in advance :D

    Read the article

  • Basic Hibernate Caching Question

    - by manyxcxi
    Doe Hibernate use cache (second level or otherwise) if all I am doing is batch inserts? No entities are being requested from the database, and no generators are used. Also, would StatelessSession vs Session change the answer? What if I was using a Session with a JDBC batch size of 50? The cache I will be using is Ehcache

    Read the article

  • How would I create a silverlight control for tagging content similar to StackOverflow?

    - by Dan Ryan
    I am new to Silverlight. How would I go about creating a control for users to tag content. I would like it to work like it does it StackOverflow i.e. Autocomplete and when you press space it inserts the tag in a box with a remove button. I want the control to be bindable to a collection of strings. If someone can just point me in the right direction to get me started I would be very grateful.

    Read the article

  • Is READ UNCOMMITTED / NOLOCK safe in this situation?

    - by Ben Challenor
    I know that snapshot isolation would fix this problem, but I'm wondering if NOLOCK is safe in this specific case so that I can avoid the overhead. I have a table that looks something like this: drop table Data create table Data ( Id BIGINT NOT NULL, Date BIGINT NOT NULL, Value BIGINT, constraint Cx primary key (Date, Id) ) create nonclustered index Ix on Data (Id, Date) There are no updates to the table, ever. Deletes can occur but they should never contend with the SELECT because they affect the other, older end of the table. Inserts are regular and page splits to the (Id, Date) index are extremely common. I have a deadlock situation between a standard INSERT and a SELECT that looks like this: select top 1 Date, Value from Data where Id = @p0 order by Date desc because the INSERT acquires a lock on Cx (Date, Id; Value) and then Ix (Id, Date), but the SELECT acquires a lock on Ix (Id, Date) and then Cx (Date, Id; Value). This is because the SELECT first seeks on Ix and then joins to a seek on Cx. Swapping the clustered and non-clustered index would break this cycle, but it is not an acceptable solution because it would introduce cycles with other (more complex) SELECTs. If I add NOLOCK to the SELECT, can it go wrong in this case? Can it return: More than one row, even though I asked for TOP 1? No rows, even though one exists and has been committed? Worst of all, a row that doesn't satisfy the WHERE clause? I've done a lot of reading about this online, but the only reproductions of over- or under-count anomalies I've seen (one, two) involve a scan. This involves only seeks. Jeff Atwood has a post about using NOLOCK that generated a good discussion. I was particularly interested in a comment by Rick Townsend: Secondly, if you read dirty data, the risk you run is of reading the entirely wrong row. For example, if your select reads an index to find your row, then the update changes the location of the rows (e.g.: due to a page split or an update to the clustered index), when your select goes to read the actual data row, it's either no longer there, or a different row altogether! Is this possible with inserts only, and no updates? If so, then I guess even my seeks on an insert-only table could be dangerous. Update: I'm trying to figure out how snapshot isolation works. It seems to be row-based, where transactions read the table (with no shared lock!), find the row they are interested in, and then see if they need to get an old version of the row from the version store in tempdb. But in my case, no row will have more than one version, so the version store seems rather pointless. And if the row was found with no shared lock, how is it different to just using NOLOCK?

    Read the article

  • Choosing the MVC view engine

    - by leonard
    I want to allow the end-users of my web application to modify views (via web based back office), stored in the database. The desired view engine is expected to be code-injection safe, meaning that the end-user will be limited to the absolute minimum number of expressions available, no server code inserts are allowed. Is any suitable view engine available to download?

    Read the article

  • Have Javascript insert a backspace within ContentEditable Div.

    - by DavidR
    An odd request, I know. I want Javascript to pretend the user just pressed the backspace. That's all I really want, if you want more info: My last topic here, gives more explaination. In short: I press a key, javascript converts the key to the greek equivalent, then puts that key in instead. The problem is, when onKeyUp is activated, it starts a function which looks for combinable character pairs put together (for accents) and inserts that key.

    Read the article

  • C# tableadapter add/update/delete

    - by ChrisMuench
    I'm using the table adapter in C# where visual studio generates the code for you. I have inserts and updates working just fine using the following code. However when trying to delete using the .update it gives me the following error. Update requires a valid DeleteCommand when passed DataRow collection with deleted rows. this.workersTableAdapter.Update(this.nursery_dbDataSet_workers.workers);

    Read the article

  • Linq to SQL - Error handling

    - by Sundararajan S
    I have a linq to sql statement that inserts records in the database. If there is a duplicate, it throws Primary key violation . after this happens, whenever i try to execute any other statement, it repeatedly shows this error. Is this a problem of transaction not getting closed. Also how to handle transactions in a more reliable way in LINQ to SQL

    Read the article

  • How to make a stored procedure return the last inserted id

    - by Luke101
    Here I have a stored procedure that inserts a row but how do you make it return the last inserted id without making another query CREATE PROCEDURE [dbo].[spInsertCriteriaItem] @GroupID int AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; insert into CriteriaItem (CriteriaGroupID) VALUES(@GroupID) --I don't want to make another query here END Is it possible to do this

    Read the article

  • Drupal SQL injection attacks prevention and apostrophe handling in Forms

    - by jini
    in typical PHP applications I used to use mysql_real_escape_string before I did SQL inserts. However I am unable to do that in Drupal so would need some assistance. And without any sort of function like that, user input with apostrophes is breaking my code. Please suggest. Thank You My SQL is as follows: $sql = "INSERT INTO some_table (field1, field2) VALUES ('$field1', '$field2')"; db_query($sql);

    Read the article

  • GNU Smalltalk text interface hard to use

    - by None
    I built GNU Smalltalk from source on my Mac because I couldn't get it working using fink and I found VMs like Squeak hard to understand. When I run the gst command it works fine, but unlike command line interfaces such the Python and Lua ones, it is hard to use because when I use the left or right arrow keys, I want the cursor to move left or right, but instead it inserts text like "^[[D". I understand why it does this but is there any way to fix it so it is more usable?

    Read the article

  • UTF-8 - Oracle issue

    - by goe
    I set my NLS_LANG variable as 'AMERICAN_AMERICA.AL32UTF8' in the perl file that connects to oracle and tries to insert the data. However when I insert a record with one value having this 'ñ' character the sql fails. But if I use 'Ñ' it inserts just fine. What am I doing wrong here?

    Read the article

  • Getting keypress cursor co-ordinates

    - by nijikunai
    I'm writing a simple browser based ide with intellisense (code completion) support. So whenever the user inserts a dot (.) character, I need to display a div element (as context menu) near the cursor. Can this can be done and if yes how? Thanks in advance!

    Read the article

  • What are the Options for Storing Hierarchical Data in a Relational Database?

    - by orangepips
    Good Overviews One more Nested Intervals vs. Adjacency List comparison: the best comparison of Adjacency List, Materialized Path, Nested Set and Nested Interval I've found. Models for hierarchical data: slides with good explanations of tradeoffs and example usage Representing hierarchies in MySQL: very good overview of Nested Set in particular Hierarchical data in RDBMSs: most comprehensive and well organized set of links I've seen, but not much in the way on explanation Options Ones I am aware of and general features: Adjacency List: Columns: ID, ParentID Easy to implement. Cheap node moves, inserts, and deletes. Expensive to find level (can store as a computed column), ancestry & descendants (Bridge Hierarchy combined with level column can solve), path (Lineage Column can solve). Use Common Table Expressions in those databases that support them to traverse. Nested Set (a.k.a Modified Preorder Tree Traversal) First described by Joe Celko - covered in depth in his book Trees and Hierarchies in SQL for Smarties Columns: Left, Right Cheap level, ancestry, descendants Compared to Adjacency List, moves, inserts, deletes more expensive. Requires a specific sort order (e.g. created). So sorting all descendants in a different order requires additional work. Nested Intervals Combination of Nested Sets and Materialized Path where left/right columns are floating point decimals instead of integers and encode the path information. Bridge Table (a.k.a. Closure Table: some good ideas about how to use triggers for maintaining this approach) Columns: ancestor, descendant Stands apart from table it describes. Can include some nodes in more than one hierarchy. Cheap ancestry and descendants (albeit not in what order) For complete knowledge of a hierarchy needs to be combined with another option. Flat Table A modification of the Adjacency List that adds a Level and Rank (e.g. ordering) column to each record. Expensive move and delete Cheap ancestry and descendants Good Use: threaded discussion - forums / blog comments Lineage Column (a.k.a. Materialized Path, Path Enumeration) Column: lineage (e.g. /parent/child/grandchild/etc...) Limit to how deep the hierarchy can be. Descendants cheap (e.g. LEFT(lineage, #) = '/enumerated/path') Ancestry tricky (database specific queries) Database Specific Notes MySQL Use session variables for Adjacency List Oracle Use CONNECT BY to traverse Adjacency Lists PostgreSQL ltree datatype for Materialized Path SQL Server General summary 2008 offers HierarchyId data type appears to help with Lineage Column approach and expand the depth that can be represented.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >