cursor

数据库连接池

半腔热情 提交于 2020-01-07 08:11:04
a id="cb_post_title_url" class="postTitle2" href="https://www.cnblogs.com/DragonFire/p/9498396.html">DBUtils - Python数据库连接池 创建数据库连接池: 1 import time 2 import pymysql 3 import threading 4 from DBUtils.PooledDB import PooledDB, SharedDBConnection 5 POOL = PooledDB( 6 creator=pymysql, # 使用链接数据库的模块 7 maxconnections=6, # 连接池允许的最大连接数,0和None表示不限制连接数 8 mincached=2, # 初始化时,链接池中至少创建的空闲的链接,0表示不创建 9 maxcached=5, # 链接池中最多闲置的链接,0和None不限制 10 maxshared=3, # 链接池中最多共享的链接数量,0和None表示全部共享。PS: 无用,因为pymysql和MySQLdb等模块的 threadsafety都为1,所有值无论设置为多少,_maxcached永远为0,所以永远是所有链接都共享。 11 blocking=True, # 连接池中如果没有可用连接后,是否阻塞等待

Nested Cursor based update

烈酒焚心 提交于 2020-01-07 06:36:47
问题 So this is for a SSRS report so I'm using temp tables. I have two tables, one for transactions that I'm just using it to pull the account and the amounts. The second is amortized delinquency information I'm trying to adjust based on the transaction but I'm running into syntax issues. Are case statements not allowed to be used with cursors or updates? --Example Transaction:Account 123456 Principal 500.00 Interest 250.00 delinquent 5 months of 200 principal each month, the transaction had

Caused by: java.lang.IllegalStateException: get field slot from row 0 col -1 failed

两盒软妹~` 提交于 2020-01-07 03:22:03
问题 i want to select value from my database but i got error Caused by: java.lang.IllegalStateException: get field slot from row 0 col -1 failed i don't know where is the wrong in my code.. this is my code in dbHelper. public Cursor pilihEnkripsi( String chiperteks ) { Cursor c = dba.rawQuery("SELECT idenkripsi FROM TB_enkripsi where chiperteks = '"+chiperteks+"'", null); return c; } and i want to get the value in other class. i use this code. Cursor cursorEnkripsi = data.pilihEnkripsi(ciper); if

Basic Cursor in MS SQL Server

早过忘川 提交于 2020-01-07 01:59:07
问题 I am looking for basic direction on Cursor use in MSSS. Say there is a table, TABLE1 , with 2 fields ( ID , Date ). The ID is not a unique key. The table records events by id, and some ids occur frequently, some infrequently. For example: ID | Date 1 | 2010-01-01 2 | 2010-02-01 3 | 2010-02-15 2 | 2010-02-15 4 | 2010-03-01 I would like to create a new table with the following fields: ID, Date, Number of times ID appears in 6 months previous to Date, Number of times ID appears in 6 months after

SQL Server : Insert cursor within stored procedure

雨燕双飞 提交于 2020-01-07 01:48:10
问题 I'm new to SQL Server and was given a task where I have to use cursor to duplicate records for Phone Link table. Other tables I have managed to duplicate without needing to use cursor. However I have primary key constraint problem with Phone Link table. Will someone please assist me? Thank you. Following is my stored procedure. Intake parameter is comp_companyid. My requirement is to duplicate every column into the same table and generate new primary key & foreign key. P/S: EntityID = 5

context.getContentResolver().query()详细用法详解

别等时光非礼了梦想. 提交于 2020-01-06 20:37:48
1.获取联系人姓名 一个简单的例子,这个函数获取设备上所有的联系人ID和联系人NAME。 [java] view plain copy public void fetchAllContacts() { ContentResolver contentResolver = this.getContentResolver(); Cursor cursor = contentResolver.query(android.provider.ContactsContract.Contacts.CONTENT_URI, null, null, null, null); cursor.getCount(); while(cursor.moveToNext()) { System.out.println(cursor.getString(cursor.getColumnIndex(android.provider.ContactsContract.Contacts._ID))); System.out.println(cursor.getString(cursor.getColumnIndex(android.provider.ContactsContract.Contacts.DISPLAY_NAME))); } cursor.close(); } 执行结果: [java] view plain

Oracle cursor not returning the complete resultset

旧时模样 提交于 2020-01-06 19:57:39
问题 This post is in continuation to the problem solved about generating dynamic SQL. for loop inside a cursor oracle Below is the PL/SQL I am executing which generates a dynamic sql by looping through the TYPE created as mentioned in the post above. PROCEDURE p_XXX_XX( p_id_i IN VARCHAR2, p_error_code_o OUT VARCHAR2, p_error_message_o OUT VARCHAR2, pcur_XXX OUT SYS_REFCURSOR ) AS l_array siebel.intl_crm.t_array; strSelect_statement VARCHAR2(20000); BEGIN l_array := f_Split_String(p_company_id_i);

SQL Update of one table based on values in cursor of another table

微笑、不失礼 提交于 2020-01-06 15:41:57
问题 The mark on my forehead from the wall is getting too red, so posting hear.... I have a two tables and need to update values of one based on selection criteria of another. I know I can use an update with a "where exists", but I have many updates to loop through. So I am trying to use a cursor to put the values from one table into vars and then use an update on the other table with these vars. No errors are occurring, but also no updates. When I change the code to a Select statement, it shows

Strange behaviours with oracle nested cursors

放肆的年华 提交于 2020-01-06 15:40:22
问题 Below is stored procedure I have written which used nested cursor. create or replace PROCEDURE SP_RUN_EMPLOYEE_UPDATES ( IN_DATE IN VARCHAr2 ) IS update_sql varchar2(4000); employee_id BI_EMPLOYEE_UPDATE.employee_id%TYPE; effective_date date ; created_by number; created_on date; comments varchar2(4000); CURSOR employees IS SELECT distinct(employee_id) FROM BI_EMPLOYEE_UPDATE WHERE EFFECTIVE_DATE = to_date(IN_DATE,'dd-mm-yy') AND EXECUTED = 'N' AND ACTIVITY_ID = '0'; CURSOR e_updates IS SELECT

Get the address of the recipient for a threaded sms

风格不统一 提交于 2020-01-06 13:31:29
问题 I have been searching how to fetch the recipient phone number for a threaded sms. A threaded sms can contain multiple recipients and i must get all the contact numbers. Can anyone pls help me. Note : i need to fetch only for sent sms so multiple receivers is possible 回答1: "content://sms/" is not officially documented and it's realisation is up to device manufacturer. there is no clean way of retrieving any sms-related info. 来源: https://stackoverflow.com/questions/7939122/get-the-address-of