source: vendor/python/2.5/Lib/sqlite3/dbapi2.py@ 3225

Last change on this file since 3225 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 2.6 KB
Line 
1#-*- coding: ISO-8859-1 -*-
2# pysqlite2/dbapi2.py: the DB-API 2.0 interface
3#
4# Copyright (C) 2004-2005 Gerhard Häring <[email protected]>
5#
6# This file is part of pysqlite.
7#
8# This software is provided 'as-is', without any express or implied
9# warranty. In no event will the authors be held liable for any damages
10# arising from the use of this software.
11#
12# Permission is granted to anyone to use this software for any purpose,
13# including commercial applications, and to alter it and redistribute it
14# freely, subject to the following restrictions:
15#
16# 1. The origin of this software must not be misrepresented; you must not
17# claim that you wrote the original software. If you use this software
18# in a product, an acknowledgment in the product documentation would be
19# appreciated but is not required.
20# 2. Altered source versions must be plainly marked as such, and must not be
21# misrepresented as being the original software.
22# 3. This notice may not be removed or altered from any source distribution.
23
24import datetime
25import time
26
27from _sqlite3 import *
28
29paramstyle = "qmark"
30
31threadsafety = 1
32
33apilevel = "2.0"
34
35Date = datetime.date
36
37Time = datetime.time
38
39Timestamp = datetime.datetime
40
41def DateFromTicks(ticks):
42 return apply(Date, time.localtime(ticks)[:3])
43
44def TimeFromTicks(ticks):
45 return apply(Time, time.localtime(ticks)[3:6])
46
47def TimestampFromTicks(ticks):
48 return apply(Timestamp, time.localtime(ticks)[:6])
49
50version_info = tuple([int(x) for x in version.split(".")])
51sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")])
52
53Binary = buffer
54
55def register_adapters_and_converters():
56 def adapt_date(val):