Search Results

Search found 7391 results on 296 pages for 'record locking'.

Page 43/296 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • concatenate multi values in one record without duplication

    - by mikehjun
    I have a dbf table like below which is the result of one to many join from two tables. I want to have unique zone values from one Taxlot id field. table name: input table tid ----- zone 1 ------ A 1 ------ A 1 ------ B 1 ------ C 2 ------ D 2 ------ E 3 ------ C Desirable output table table name: input table tid ----- zone 1 ------ A, B, C 2 ------ D, E 3 ------ C I got some help but couldn't make it to work. inputTbl = r"C:\temp\input.dbf" taxIdZoningDict = {} searchRows = gp.searchcursor(inputTbl) searchRow = searchRows.next() while searchRow: if searchRow.TID in taxIdZoningDict: taxIdZoningDict[searchRow.TID].add(searchRow.ZONE) else: taxIdZoningDict[searchRow.TID] = set() #a set prevents dulpicates! taxIdZoningDict[searchRow.TID].add(searchRow.ZONE) searchRow = searchRows.next() outputTbl = r"C:\temp\output.dbf" gp.CreateTable_management(r"C:\temp", "output.dbf") gp.AddField_management(outputTbl, "TID", "LONG") gp.AddField_management(outputTbl, "ZONES", "TEXT", "", "", "20") tidList = taxIdZoningDict.keys() tidList.sort() #sorts in ascending order insertRows = gp.insertcursor(outputTbl) for tid in tidList: concatString = "" for zone in taxIdZoningDict[tid] concatString = concatString + zone + "," insertRow = insertRows.newrow() insertRow.TID = tid insertRow.ZONES = concatString[:-1] insertRows.insertrow(insertRow) del insertRow del insertRows

    Read the article

  • unable to catch org.hibernate.StaleObjectStateException while deleting record that doesn't exists in database

    - by JAB
    My application has a delete user option. Now in order to check concurrency condition I tried the following use case opened application in chrome and firefox browser. deleted user in firefox now trying to delete the same user in chrome browser I get exception org.hibernate.StaleObjectStateException .. which is right .. since I am trying to delete an object which doesn't exists. But I am not able to catch this exception try{ getHibernateTemplate().delete(userObj); } catch (StaleObjectStateException e) { e.printStackTrace(); } How do i catch this exception ??

    Read the article

  • First record does not show in pagination script

    - by whitstone86
    This is my pagination script which extracts info for my TV guide project that I am working on. Currently I've been experimenting with different PHP/MySQL before it becomes a production site. This is my current script: <?php /*********************************** * PhpMyCoder Paginator * * Created By PhpMyCoder * * 2010 PhpMyCoder * * ------------------------------- * * You may use this code as long * * as this notice stays intact and * * the proper credit is given to * * the author. * ***********************************/ // set the default timezone to use. Available since PHP 5.1 putenv("TZ=US/Eastern") ?> <head> <title> Pagination Test - Created By PhpMyCoder</title> <style type="text/css"> #nav { font: normal 13px/14px Arial, Helvetica, sans-serif; margin: 2px 0; } #nav a { background: #EEE; border: 1px solid #DDD; color: #000080; padding: 1px 7px; text-decoration: none; } #nav strong { background: #000080; border: 1px solid #DDD; color: #FFF; font-weight: normal; padding: 1px 7px; } #nav span { background: #FFF; border: 1px solid #DDD; color: #999; padding: 1px 7px; } </style> </head> <?php //Require the file that contains the required classes include("pmcPagination.php"); //PhpMyCoder Paginator $paginator = new pmcPagination(20, "page"); //Connect to the database mysql_connect("localhost","root","PASSWORD"); //Select DB mysql_select_db("mytvguide"); //Select only results for today and future $result = mysql_query("SELECT programme, channel, airdate, expiration, episode, setreminder FROM lagunabeach where expiration >= now() order by airdate, 3 ASC LIMIT 0, 100;"); //You can also add reuslts to paginate here mysql_data_seek($queryresult,0) ; while($row = mysql_fetch_array($result)) { $paginator->add(new paginationData($row['programme'], $row['channel'], $row['airdate'], $row['expiration'], $row['episode'], $row['setreminder'])); } ?> <?php //Show the paginated results $paginator->paginate (); ?><? include("pca-footer1.php"); ?> <?php //Show the navigation $paginator->navigation(); ?> Despite me having two records for the programmes airing today, it only shows records from the second one onwards - the programme that airs at 8:35pm UK time GMT does not show, but the later 11:25pm UK time GMT one does show. How should I fix this? Above is my code if that is of any use! Thanks

    Read the article

  • fetch fourth maximum record from the table field

    - by chetan
    Following is the command to fetch maximum salary form empsalary table in mysql select max(salary) from empsalary; but I want to fetch employee who got fourth highest from the list of employee. I don't want to use trigger or function because I know there is direct command to fetch.

    Read the article

  • slow record deletion with large ntext values

    - by asking
    I'm having trouble deleting some records via a stored procedure from a table in SQLServer 2008R2 that has ntext columns. The stored proc is timing out and running the query directly takes a very long time. The initial query was a straight "delete from y where x = z" and I've also tried running it in batches of 1000 with transactions but it is still slow and timing out in a stored proc. The majority of the records in the table will not be deleted each time (it's not just a once-off query but will be run other times). The ntext columns are not used in the where clause and I can't change the column types. Any suggestions on the quickest way to delete records with large ntext values? Thanks

    Read the article

  • NHibernate will not insert a record

    - by Brian Beckham
    I have an application that is now 4+ years old that is exhibiting some odd behavior on our latest deployment. The application uses nHibernate for all inserts / updates / selects, etc. We are currently using .NET 2.0, and nHibernate 1.2 (I know, we need to upgrade) This deployment is on Windows 2008 Server x64, IIS 7.5 - what I have seen so far is that the application runs, but is unable to insert or update records in the DB - reads seem fine so far, but writes are a problem. SOME writes actually work, inserts into some small tables, but most never even make it to the DB. Using SQL Profiler, the insert / updates never make it to the server, and turning log4net up to DEBUG, and show_sql true - the select statements appear, but the insert / update statements never make it into the log at all, and never show up at the server. What's even more odd is that the application seems to be oblivious to this - the commandandclose runs without exception (open session in view with an httpmodule), the domain objects come back with uuid's generated, etc. but never get persisted. Certainly an upgrade is due, but I would hate to try it during a deployment, and without time to accurately test the app. Any ideas?

    Read the article

  • database row/ record pointers

    - by David
    Hi I don't know the correct words for what I'm trying to find out about and as such having a hard time googling. I want to know whether its possible with databases (technology independent but would be interested to hear whether its possible with Oracle, MySQL and Postgres) to point to specific rows instead of executing my query again. So I might initially execute a query find some rows of interest and then wish to avoid searching for them again by having a list of pointers or some other metadata which indicates the location on a database which I can go to straight away the next time I want those results. I realise there is caching on databases, but I want to keep these "pointers" else where and as such caching doesn't ultimately solve this problem. Is this just an index and I store the index and look up by this? most of my current tables don't have indexes and I don't want the speed decrease that sometimes comes with indexes. So whats the magic term I've been trying to put into google? Cheers

    Read the article

  • MySQL - Join as zero if record Not IN

    - by Zurahn
    To explain by example, take two tables, A and B Table A id foo 1 x 2 y 3 z Table B id aid bar 1 3 50 2 1 100 An example join SELECT foo, bar FROM a, b WHERE a.id = b.aid; Garners a result of foo bar z 50 x 100 What I would like to do is get all values of foo and for any instances where there isn't a corresponding bar value, return 0 for that column. My best guess was something along the lines of SELECT foo, bar AS br FROM a, b WHERE a.id = b.aid OR a.id NOT IN (SELECT aid FROM b); But that returns duplicates and non-zero values for bar. Possible?

    Read the article

  • SQL Server - Select one random record not showing duplicates

    - by Lukes123
    I have two tables, events and photos, which relate together via the 'Event_ID' column. I wish to select ONE random photo from each event and display them. How can I do this? I have the following which displays all the photos which are associated. How can I limit it to one per event? SELECT Photos.Photo_Id, Photos.Photo_Path, Photos.Event_Id, Events.Event_Title, Events.Event_StartDate, Events.Event_EndDate FROM Photos, Events WHERE Photos.Event_Id = Events.Event_Id AND Events.Event_EndDate < GETDATE() AND Events.Event_EndDate IS NOT NULL AND Events.Event_StartDate IS NOT NULL ORDER BY NEWID() Thanks Luke Stratton

    Read the article

  • MYSQL - REMOVE HTML TAGS from Record

    - by Dam
    Need help to form the MYSQL query from table one column having the bellow content Row1 : this is first <a href='mytext.txt'>row</a> from the table Row 2 : THis is the second row <img src ='mytext.jpg'> my image is there Row 3 : <p>This is the Third row my mytext is there </p> Row 4 : <p class='te_mytext'>This is the Third row my text is there </p> this is the table rows i try to search the keyword as 'mytext' my query is SELECT * from table WHERE colmn_name ` like '%mytext%' " i will get all the 4 rows as result but the result is wrong ..... need to get the correct output as only Row 3 the reason this row only having the mytext inside the content all other are not in content but mytext having in all rows how can i write the Query MYSQL please help me (NOT in PHP only MYSQL )

    Read the article

  • How does google-analytics guarantees that the tracking record is coming from the real site

    - by tuler
    When you sign up to google analytics it instructs you to use a javascript snippet on every page you want to track. This code includes an API key, which is visible to everyone who views your source code. How does it guarantees that the request is coming from the real site, and not from a third-party who wants to mess with your statistics? Does it check the HTTP Referer header? Even that is not safe, as it can be forged.

    Read the article

  • SQL query to select distinct record with 2 or more repetition in another field

    - by kyohiros
    So I have this table of book orders, it contains 2 columns, one is the order ID(primary key) and another is the ID of the book that the customer ordered. For example: | OrderID | BookID | | 0001 | B002 | | 0002 | B005 | | 0003 | B002 | | 0004 | B003 | | 0005 | B005 | | 0006 | B002 | | 0007 | B002 | What I want is to get the IDs of the books that got 2 or more purchases/orders, for example if I run the SQL query against the above data, I would get this as the result: | BookID | | B002 | | B005 | I don't know if this can be archived in SQL or I have to built a simpler statement and repetitive run the query against all the records in another language. I need some help and thanks for reading my question.

    Read the article

  • Hyperlink for each record

    - by shantanuo
    I need a link for each depotname that will bring up a child window with the details of the last 10 backup status. while($data=mysql_fetch_array($res)) { if(is_null($depot_array) || !in_array($data['depotname'],$depot_array )) { $depot_array[$r]=$data['depotname']; if($data['SCP_status'] <> 'success') { echo "<tr id='fail'>"; The results of the following query should be displayed in a child window. select * from backup_log where depotname = $data['depotname']

    Read the article

  • When destroying one record, another one gets destroyed

    - by normalocity
    Products (like an iPod Classic) :has_many = :listings, :dependent = :destroy Listings (like "My name is Joe, and I have an iPod for sale) :belongs_to = :product So, if I delete a given Product, all the listings that point to it get deleted. That makes sense, and is by design. However, I am writing a "merge" function, where you merge two Products into one, and combine their Listings. So, let's say my two products are "iPod Color" and "iPod Classic", and I want to merge the two. What I want to do is say, "iPod Color, merge into iPod Classic", and result should be that: All the iPod Color Listings are re-pointed to the iPod Classic product After the product_id change, the Listing(s) are saved I then delete the "iPod Color" product Well, that should all work fine, without deleting any Listings. However, I've got this controller, and for whatever reason when I destroy the "iPod Color" Product, even after confirming that the Listings have been moved to "iPod Classic" and saved to the database, the Listings that were previously pointed to "iPod Color" get destroyed as well, and I can't figure out why. It's as if they are retaining some kind of link to the destroyed product, and therefore begin destroyed themselves. What painfully obvious thing am I missing? def merge merging_from = Product.find(params[:id]) merging_to = Product.find_by_model(params[:merging_to]) unless merging_to.nil? unless merging_from.nil? unless merging_from == merging_to # you don't want to merge something with itself merging_from.listings.each do |l| l.product = merging_to l.save end # through some debugging, I've confirmed that my missing Listings are disappearing as a result of the following destroy call merging_from.destroy end end end

    Read the article

  • nservicebus deleting subscription record after inserting it?

    - by Justin Holbrook
    I have been playing with nservicebus for a few weeks now and since everything was going well on my local machine I decided to try to set up a test environment and work on deployment. I am using the generic host that comes with nservicebus and was using the nservicebus.Integration profile when running locally, but would like to use Nservicebus.Production in the test environment. I set up a sql server 2008 database, made changes to my app.config and everything seemed to work fine. But after a few attempts, I noticed messages were not being picked up by my subscriber. I checked the subscription table and it was empty. Upon examination of the logs I noticed the following: 2010-05-06 15:07:57,416 [1] DEBUG NHibernate.Persister.Entity.AbstractEntityPers ister [(null)] <(null) - Insert 0: INSERT INTO [Subscription] (SubscriberEndpo int, MessageType) VALUES (?, ?) 2010-05-06 15:07:57,416 [1] DEBUG NHibernate.Persister.Entity.AbstractEntityPers ister [(null)] <(null) - Update 0: 2010-05-06 15:07:57,416 [1] DEBUG NHibernate.Persister.Entity.AbstractEntityPers ister [(null)] <(null) - Delete 0: DELETE FROM [Subscription] WHERE Subscriber Endpoint = ? AND MessageType = ? Why would it insert then delete my subscription right afterwards? To try to rule out a nhibernate dialect issue I tried switching my subscription storage to an oracle 10g database. It behaved exactly the same, it worked the first 2 times, then I started seeing my subscriptions being deleted right after they were inserted. Any ideas what is causing this behavior?

    Read the article

  • Rails always include (join) on initialize

    - by Seth
    Hello, I have a User model as illustrated below: class User < ActiveRecord belongs_to :college belongs_to :class_level end I want to ALWAYS join with those other two tables returning one simplified User object. How do I accomplish this in my User model. I'm aware that I can do this in another model: class Foo < ActiveRecord has_many :users, :include => [:college, :class_level] end But I want to do this in my User model, so Foo.users will either be eager loaded OR be joined already. Is there a way to create an initialize this in the User model?

    Read the article

  • uploading database file in assets not returning a record

    - by Alexander
    I have a problem with a database file not being read I have added the database file in assets called mydb but when i run my code it says its not being located. It is calling this toast Toast.makeText(this, "No contact found", Toast.LENGTH_LONG).show(); This is being called because no records are being returned. This is an example form Android Application Development book. public class DatabaseActivity extends Activity { /** Called when the activity is first created. */ TextView quest, response1, response2; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView quest = (TextView) findViewById(R.id.quest); try { String destPath = "/data/data/" + getPackageName() + "/databases/MyDB"; File f = new File(destPath); if (!f.exists()) { CopyDB( getBaseContext().getAssets().open("mydb"), new FileOutputStream(destPath)); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } DBAdapter db = new DBAdapter(this); //---get a contact--- db.open(); Cursor c = db.getContact(2); if (c.moveToFirst()) DisplayContact(c); else Toast.makeText(this, "No contact found", Toast.LENGTH_LONG).show(); db.close(); } public void CopyDB(InputStream inputStream, OutputStream outputStream) throws IOException { //---copy 1K bytes at a time--- byte[] buffer = new byte[1024]; int length; while ((length = inputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, length); } inputStream.close(); outputStream.close(); } public void DisplayContact(Cursor c) { quest.setText(String.valueOf(c.getString(1))); //quest.setText(String.valueOf("this is a text string")); } }

    Read the article

  • Get latest record from second table left joined to first table

    - by codef0rmer
    I have a candidate table say candidates having only id field and i left joined profiles table to it. Table profiles has 2 fields namely, candidate_id & name. e.g. Table candidates: id 1 2 and Table `profiles`: candidate_id name 1 Foobar 1 Foobar2 2 Foobar3 i want the latest name of a candidate in a single query which is given below: SELECT C.id, P.name FROM candidates C LEFT JOIN profiles P ON P.candidate_id = C.id GROUP BY C.id ORDER BY P.name; But this query returns: 1 Foobar 2 Foobar3 Instead of: 1 Foobar2 2 Foobar3

    Read the article

  • duplicate record

    - by user349953
    Insert into Attendancemst ( emp_code , name, date , timetable , on_duty,out_duty,clockin , clockout, late, early, mis_in , mis_out , absent , halfday, total_time ) values (pemp_code,pname,pdate,ptimetable,pon_duty,pout_duty ,pclockin,pclockout,plate, pearly, pmis_in,pmis_out,pabsent,phalfday,ptotal_time )ON DUPLICATE KEY UPDATE emp_code=pemp_code and date = pdate;

    Read the article

  • Making A ScrollBar Go To Selected Record In TreeView ASP.Net

    - by Nick
    I have a treeview control that gets populated at runtime with a pyramid of employee names. I put the css scrollbar on the view by putting overflow:auto" in the tag where the treeview is located. The users are now asking me to to have the scrollbar go down in the treeview where a treeview item is selected. How do I make a scroll bar to go to a place where the treeview has been selected? Note: treeView1.SelectedNode.EnsureVisible(); is not available in asp.net need another way.

    Read the article

  • EGODatabase does not retain inserted record

    - by user135775
    Hi Guy! I'm using EGODatabase to process my data. When I tried to insert data into the database which I created with Base and attached to the project, the data that was inserted programmatically will not show up when I restart my app.However the data inserted manually using Base will show up just fine. Following is the code for inserting data into the database: NSString *path = [[NSBundle mainBundle] pathForResource:@"Database" ofType:@"db"]; db = [EGODatabase databaseWithPath:path]; if ([db open]) { NSLog(@"Database is opened successfully!"); } else { NSLog(@"Database is failed to open!"); } NSArray *params = [NSArray arrayWithObjects:[aFeed feedID], [aFeed title], nil]; [db executeUpdate:@"Insert INTO Feed (FeedID, Title) VALUES (?, ?)" parameters:params]; EGODatabaseResult *results = [db executeQuery:@"SELECT * FROM Feed"]; for ( EGODatabaseRow * row in results) { NSLog(@"ID: %@ Title: %@", [row stringForColumn:@"FeedID"], [row stringForColumn:@"Title"]); } I appreciate if anyone can share me a working sample code for EGODatabase. I'm using EGODatabase because I might have multi-threading code that write to the database. Thank in advance.

    Read the article

  • Rails Active Record find(:all, :order => ) issue.

    - by CodingWithoutComments
    I seem to be unable to use :order_by for more than one column at a time. For example, I have a "Show" model with date and attending columns. If I run the following code: @shows = Show.find(:all, :order => "date") I get the following results: [#<Show id: 7, date: "2009-04-18", attending: 2>, #<Show id: 1, date: "2009-04-18", attending: 78>, #<Show id: 2, date: "2009-04-19", attending: 91>, #<Show id: 3, date: "2009-04-20", attending: 16>, #<Show id: 4, date: "2009-04-21", attending: 136>] If I run the following code: @shows = Show.find(:all, :order => "attending DESC") [#<Show id: 4, date: "2009-04-21", attending: 136>, #<Show id: 2, date: "2009-04-19", attending: 91>, #<Show id: 1, date: "2009-04-18", attending: 78>, #<Show id: 3, date: "2009-04-20", attending: 16>, #<Show id: 7, date: "2009-04-18", attending: 2>] But, if I run: @shows = Show.find(:all, :order => "date, attending DESC") OR @shows = Show.find(:all, :order => "date, attending ASC") OR @shows = Show.find(:all, :order => "date ASC, attending DESC") I get the same results as only sorting by date: [#<Show id: 7, date: "2009-04-18", attending: 2>, #<Show id: 1, date: "2009-04-18", attending: 78>, #<Show id: 2, date: "2009-04-19", attending: 91>, #<Show id: 3, date: "2009-04-20", attending: 16>, #<Show id: 4, date: "2009-04-21", attending: 136>] Where as, I want to get these results: [#<Show id: 1, date: "2009-04-18", attending: 78>, #<Show id: 7, date: "2009-04-18", attending: 2>, #<Show id: 2, date: "2009-04-19", attending: 91>, #<Show id: 3, date: "2009-04-20", attending: 16>, #<Show id: 4, date: "2009-04-21", attending: 136>] This is the query being generated from the logs: [4;35;1mUser Load (0.6ms)[0m [0mSELECT * FROM "users" WHERE ("users"."id" = 1) LIMIT 1[0m [4;36;1mShow Load (3.0ms)[0m [0;1mSELECT * FROM "shows" ORDER BY date ASC, attending DESC[0m [4;35;1mUser Load (0.6ms)[0m [0mSELECT * FROM "users" WHERE ("users"."id" = 1) [0m Finally, here is my model: create_table "shows", :force => true do |t| t.string "headliner" t.string "openers" t.string "venue" t.date "date" t.text "description" t.datetime "created_at" t.datetime "updated_at" t.decimal "price" t.time "showtime" t.integer "attending", :default => 0 t.string "time" end What am I missing? What am I doing wrong? UPDATE: Thanks for all your help, but it seems that all of you were stumped as much as I was. What solved the problem was actually switching databases. I switched from the default sqlite3 to mysql.

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >